|
|
@@ -6,20 +6,24 @@
|
|
|
<title>资产管理</title>
|
|
|
<link rel="stylesheet" href="../../lib/layui/css/layui.css">
|
|
|
<style>
|
|
|
- body { padding: 10px; overflow: hidden; }
|
|
|
+ body {
|
|
|
+ padding: 10px;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+
|
|
|
.dict-container {
|
|
|
- display: flex;
|
|
|
height: calc(100vh - 60px);
|
|
|
gap: 10px;
|
|
|
}
|
|
|
+
|
|
|
.dict-left {
|
|
|
- width: 45%;
|
|
|
background: #fff;
|
|
|
border-radius: 4px;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
+
|
|
|
.dict-left .panel-header {
|
|
|
padding: 12px 15px;
|
|
|
border-bottom: 1px solid #eee;
|
|
|
@@ -28,16 +32,19 @@
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
|
}
|
|
|
+
|
|
|
.dict-left .panel-header .title {
|
|
|
font-size: 14px;
|
|
|
font-weight: 600;
|
|
|
color: #333;
|
|
|
}
|
|
|
+
|
|
|
.dict-left .search-form {
|
|
|
padding: 10px;
|
|
|
border-bottom: 1px solid #eee;
|
|
|
background: #fafafa;
|
|
|
}
|
|
|
+
|
|
|
.dict-left .search-box .input-clear {
|
|
|
position: absolute;
|
|
|
right: 38px;
|
|
|
@@ -48,25 +55,41 @@
|
|
|
display: none;
|
|
|
font-size: 14px;
|
|
|
}
|
|
|
+
|
|
|
.dict-left .search-box .input-clear:hover {
|
|
|
color: #666;
|
|
|
}
|
|
|
+
|
|
|
.dict-left .search-box .search-btn {
|
|
|
margin-left: 6px;
|
|
|
}
|
|
|
+
|
|
|
.dict-left .panel-body {
|
|
|
flex: 1;
|
|
|
overflow: hidden;
|
|
|
padding: 0;
|
|
|
}
|
|
|
+
|
|
|
.dict-right {
|
|
|
- flex: 1;
|
|
|
+ position: fixed;
|
|
|
+ right: 0;
|
|
|
+ top: 10px;
|
|
|
+ bottom: 70px;
|
|
|
+ width: 0;
|
|
|
background: #fff;
|
|
|
border-radius: 4px;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
- overflow: auto;
|
|
|
+ overflow-y: auto;
|
|
|
+ z-index: 100;
|
|
|
+ box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
|
|
|
+ transition: width 0.3s ease-in-out;
|
|
|
+ }
|
|
|
+
|
|
|
+ .dict-right.active {
|
|
|
+ width: 70%;
|
|
|
}
|
|
|
+
|
|
|
.dict-right .panel-header {
|
|
|
padding: 12px 15px;
|
|
|
border-bottom: 1px solid #eee;
|
|
|
@@ -75,34 +98,41 @@
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
|
}
|
|
|
+
|
|
|
.dict-right .panel-header .title {
|
|
|
font-size: 14px;
|
|
|
font-weight: 600;
|
|
|
color: #333;
|
|
|
}
|
|
|
+
|
|
|
.dict-right .search-form {
|
|
|
padding: 12px 15px;
|
|
|
border-bottom: 1px solid #f0f0f0;
|
|
|
}
|
|
|
+
|
|
|
.dict-right .panel-body {
|
|
|
flex: 1;
|
|
|
padding: 0;
|
|
|
overflow: auto;
|
|
|
}
|
|
|
+
|
|
|
.dict-right .table-toolbar {
|
|
|
padding: 10px 15px;
|
|
|
border-bottom: 1px solid #f0f0f0;
|
|
|
}
|
|
|
+
|
|
|
.empty-tip {
|
|
|
text-align: center;
|
|
|
padding: 60px 20px;
|
|
|
color: #999;
|
|
|
}
|
|
|
+
|
|
|
.empty-tip i {
|
|
|
font-size: 48px;
|
|
|
margin-bottom: 15px;
|
|
|
color: #ddd;
|
|
|
}
|
|
|
+
|
|
|
.type-info-card {
|
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
|
color: #fff;
|
|
|
@@ -113,15 +143,18 @@
|
|
|
justify-content: space-between;
|
|
|
align-items: flex-start;
|
|
|
}
|
|
|
+
|
|
|
.type-info-card .type-info {
|
|
|
flex: 1;
|
|
|
min-width: 0;
|
|
|
}
|
|
|
+
|
|
|
.type-info-card .type-name {
|
|
|
font-size: 20px;
|
|
|
font-weight: 600;
|
|
|
margin-bottom: 8px;
|
|
|
}
|
|
|
+
|
|
|
.type-info-card .type-code {
|
|
|
font-size: 13px;
|
|
|
opacity: 0.9;
|
|
|
@@ -129,47 +162,94 @@
|
|
|
align-items: center;
|
|
|
gap: 8px;
|
|
|
}
|
|
|
+
|
|
|
.type-info-card .type-actions {
|
|
|
display: flex;
|
|
|
gap: 8px;
|
|
|
flex-shrink: 0;
|
|
|
}
|
|
|
+
|
|
|
.type-info-card .type-actions .layui-btn {
|
|
|
- background: rgba(255,255,255,0.2);
|
|
|
+ background: rgba(255, 255, 255, 0.2);
|
|
|
border: none;
|
|
|
color: #fff;
|
|
|
}
|
|
|
+
|
|
|
.type-info-card .type-actions .layui-btn:hover {
|
|
|
- background: rgba(255,255,255,0.35);
|
|
|
+ background: rgba(255, 255, 255, 0.35);
|
|
|
}
|
|
|
+
|
|
|
.type-info-card .type-actions .layui-btn-danger {
|
|
|
- background: rgba(255,59,48,0.6);
|
|
|
+ background: rgba(255, 59, 48, 0.6);
|
|
|
}
|
|
|
+
|
|
|
.type-info-card .type-actions .layui-btn-danger:hover {
|
|
|
- background: rgba(255,59,48,0.8);
|
|
|
+ background: rgba(255, 59, 48, 0.8);
|
|
|
}
|
|
|
+
|
|
|
.type-detail-card {
|
|
|
background: #fff;
|
|
|
margin: 0 10px 10px 10px;
|
|
|
border-radius: 4px;
|
|
|
padding: 12px 15px;
|
|
|
+ overflow: hidden;
|
|
|
+ max-height: 500px;
|
|
|
+ transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out, margin 0.3s ease-in-out;
|
|
|
+ }
|
|
|
+
|
|
|
+ .type-detail-card.collapsed {
|
|
|
+ max-height: 0;
|
|
|
+ padding-top: 0;
|
|
|
+ padding-bottom: 0;
|
|
|
+ margin-top: 0;
|
|
|
+ margin-bottom: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .detail-card-header {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ padding: 10px 15px;
|
|
|
+ margin: 0 10px;
|
|
|
+ background: #f5f5f5;
|
|
|
+ border-radius: 4px;
|
|
|
+ cursor: pointer;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #666;
|
|
|
+ }
|
|
|
+
|
|
|
+ .detail-card-header:hover {
|
|
|
+ background: #eee;
|
|
|
+ }
|
|
|
+
|
|
|
+ .detail-card-header i {
|
|
|
+ transition: transform 0.3s ease-in-out;
|
|
|
+ }
|
|
|
+
|
|
|
+ .detail-card-header i.collapsed {
|
|
|
+ transform: rotate(180deg);
|
|
|
}
|
|
|
+
|
|
|
.type-detail-card .detail-row {
|
|
|
display: flex;
|
|
|
gap: 20px;
|
|
|
margin-bottom: 10px;
|
|
|
}
|
|
|
+
|
|
|
.type-detail-card .detail-row:last-child {
|
|
|
margin-bottom: 0;
|
|
|
}
|
|
|
+
|
|
|
.type-detail-card .detail-group {
|
|
|
flex: 1;
|
|
|
min-width: 0;
|
|
|
}
|
|
|
+
|
|
|
.type-detail-card .detail-label {
|
|
|
color: #999;
|
|
|
font-size: 12px;
|
|
|
}
|
|
|
+
|
|
|
.type-detail-card .detail-value {
|
|
|
color: #333;
|
|
|
font-size: 13px;
|
|
|
@@ -177,71 +257,80 @@
|
|
|
overflow: hidden;
|
|
|
text-overflow: ellipsis;
|
|
|
}
|
|
|
+
|
|
|
.layui-table-view {
|
|
|
margin: 0;
|
|
|
}
|
|
|
</style>
|
|
|
</head>
|
|
|
<body>
|
|
|
- <div class="dict-container">
|
|
|
- <!-- 左侧:资产信息列表 -->
|
|
|
- <div class="dict-left">
|
|
|
- <div class="panel-header">
|
|
|
- <span class="title"><i class="layui-icon layui-icon-app"></i> 资产信息</span>
|
|
|
- <button class="layui-btn layui-btn-xs layui-btn-normal" id="btnAddAsset"><i class="layui-icon layui-icon-add-1"></i></button>
|
|
|
- </div>
|
|
|
- <div class="search-form">
|
|
|
- <form class="layui-form layui-form-pane" lay-filter="assetSearchForm">
|
|
|
- <div class="layui-form-item" style="margin-bottom: 0;">
|
|
|
- <div class="layui-inline">
|
|
|
- <div class="layui-input-inline">
|
|
|
- <input type="text" name="assetCode" placeholder="资产编码" class="layui-input">
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="layui-inline">
|
|
|
- <div class="layui-input-inline">
|
|
|
- <input type="text" name="assetType" placeholder="资产类型" class="layui-input">
|
|
|
- </div>
|
|
|
+<div class="dict-container">
|
|
|
+ <!-- 左侧:资产信息列表 -->
|
|
|
+ <div class="dict-left">
|
|
|
+ <div class="panel-header">
|
|
|
+ <span class="title"><i class="layui-icon layui-icon-app"></i> 资产信息</span>
|
|
|
+ <button class="layui-btn layui-btn-xs layui-btn-normal" id="btnAddAsset"><i
|
|
|
+ class="layui-icon layui-icon-add-1"></i></button>
|
|
|
+ </div>
|
|
|
+ <div class="search-form">
|
|
|
+ <form class="layui-form layui-form-pane" lay-filter="assetSearchForm">
|
|
|
+ <div class="layui-form-item" style="margin-bottom: 0;">
|
|
|
+ <div class="layui-inline">
|
|
|
+ <div class="layui-input-inline">
|
|
|
+ <input type="text" name="assetCode" placeholder="资产编码" class="layui-input">
|
|
|
</div>
|
|
|
- <div class="layui-inline">
|
|
|
- <div class="layui-input-inline">
|
|
|
- <input type="text" name="model" placeholder="型号" class="layui-input">
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+ <div class="layui-inline">
|
|
|
+ <div class="layui-input-inline">
|
|
|
+ <input type="text" name="assetType" placeholder="资产类型" class="layui-input">
|
|
|
</div>
|
|
|
- <div class="layui-inline">
|
|
|
- <div class="layui-input-inline">
|
|
|
- <select name="deptName" id="searchDeptSelect" lay-search>
|
|
|
- <option value="">管理部门</option>
|
|
|
- </select>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+ <div class="layui-inline">
|
|
|
+ <div class="layui-input-inline">
|
|
|
+ <input type="text" name="model" placeholder="型号" class="layui-input">
|
|
|
</div>
|
|
|
- <div class="layui-inline">
|
|
|
- <button type="button" class="layui-btn layui-btn-sm" id="btnSearchAsset"><i class="layui-icon layui-icon-search"></i></button>
|
|
|
- <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary">重置</button>
|
|
|
+ </div>
|
|
|
+ <div class="layui-inline">
|
|
|
+ <div class="layui-input-inline">
|
|
|
+ <select name="deptName" id="searchDeptSelect" lay-search>
|
|
|
+ <option value="">管理部门</option>
|
|
|
+ </select>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </form>
|
|
|
- </div>
|
|
|
- <div class="panel-body">
|
|
|
- <table id="assetList" lay-filter="assetList"></table>
|
|
|
- </div>
|
|
|
+ <div class="layui-inline">
|
|
|
+ <button type="button" class="layui-btn layui-btn-sm" id="btnSearchAsset"><i
|
|
|
+ class="layui-icon layui-icon-search"></i></button>
|
|
|
+ <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary">重置</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
</div>
|
|
|
+ <div class="panel-body">
|
|
|
+ <table id="assetList" lay-filter="assetList"></table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
- <!-- 右侧:资产状态历史 -->
|
|
|
- <div class="dict-right">
|
|
|
- <div class="type-info-card-container">
|
|
|
- <!-- 资产详情卡片 -->
|
|
|
- <div class="type-info-card" id="assetInfoCard" style="display:none;">
|
|
|
- <div class="type-info">
|
|
|
- <div class="type-name" id="assetInfoCode">-</div>
|
|
|
- <div class="type-code" id="assetInfoType">-</div>
|
|
|
- </div>
|
|
|
- <div class="type-actions">
|
|
|
- <button class="layui-btn layui-btn-xs" id="btnEditAsset"><i class="layui-icon layui-icon-edit"></i></button>
|
|
|
- <button class="layui-btn layui-btn-xs layui-btn-danger" id="btnDelAsset"><i class="layui-icon layui-icon-delete"></i></button>
|
|
|
- </div>
|
|
|
+ <!-- 右侧:资产状态历史 -->
|
|
|
+ <div class="dict-right">
|
|
|
+ <div class="type-info-card-container">
|
|
|
+ <!-- 资产详情卡片 -->
|
|
|
+ <div class="type-info-card" id="assetInfoCard" style="display:none;">
|
|
|
+ <div class="type-info">
|
|
|
+ <div class="type-name" id="assetInfoCode">-</div>
|
|
|
+ <div class="type-code" id="assetInfoType">-</div>
|
|
|
+ </div>
|
|
|
+ <div class="type-actions">
|
|
|
+ <button class="layui-btn layui-btn-xs" id="btnEditAsset"><i class="layui-icon layui-icon-edit"></i>
|
|
|
+ </button>
|
|
|
+ <button class="layui-btn layui-btn-xs layui-btn-danger" id="btnDelAsset"><i
|
|
|
+ class="layui-icon layui-icon-delete"></i></button>
|
|
|
</div>
|
|
|
- <div class="type-detail-card" id="assetDetailCard" style="display:none;">
|
|
|
+ </div>
|
|
|
+ <div class="detail-card-header" id="detailCardHeader">
|
|
|
+ <span>资产详情</span>
|
|
|
+ <i class="layui-icon layui-icon-up" id="detailCardToggle"></i>
|
|
|
+ </div>
|
|
|
+ <div class="type-detail-card" id="assetDetailCard">
|
|
|
<div class="detail-row">
|
|
|
<div class="detail-group">
|
|
|
<div class="detail-label">品牌</div>
|
|
|
@@ -305,425 +394,476 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div class="panel-header">
|
|
|
- <span class="title"><i class="layui-icon layui-icon-time"></i> <span id="historyTitle">状态历史</span></span>
|
|
|
- </div>
|
|
|
- <div class="search-form">
|
|
|
- <form class="layui-form layui-form-pane" lay-filter="historySearchForm">
|
|
|
- <div class="layui-form-item" style="margin-bottom: 0;">
|
|
|
- <div class="layui-inline">
|
|
|
- <div class="layui-input-inline">
|
|
|
- <select name="useStatus" class="layui-select">
|
|
|
- <option value="">使用状态</option>
|
|
|
- <option value="在库">在库</option>
|
|
|
- <option value="正常使用">正常使用</option>
|
|
|
- <option value="已转移">已转移</option>
|
|
|
- <option value="报废中">报废中</option>
|
|
|
- <option value="维修中">维修中</option>
|
|
|
- </select>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="layui-inline">
|
|
|
- <div class="layui-input-inline">
|
|
|
- <input type="text" name="useDept" placeholder="使用部门" class="layui-input">
|
|
|
- </div>
|
|
|
+ <div class="panel-header">
|
|
|
+ <span class="title"><i class="layui-icon layui-icon-time"></i> <span
|
|
|
+ id="historyTitle">状态历史</span></span>
|
|
|
+ <button class="layui-btn layui-btn-xs" id="btnCollapseRight"
|
|
|
+ style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);"><i
|
|
|
+ class="layui-icon layui-icon-prev"></i> 收起
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ <div class="search-form">
|
|
|
+ <form class="layui-form layui-form-pane" lay-filter="historySearchForm">
|
|
|
+ <div class="layui-form-item" style="margin-bottom: 0;">
|
|
|
+ <div class="layui-inline">
|
|
|
+ <div class="layui-input-inline">
|
|
|
+ <select name="useStatus" class="layui-select">
|
|
|
+ <option value="">使用状态</option>
|
|
|
+ <option value="在库">在库</option>
|
|
|
+ <option value="正常使用">正常使用</option>
|
|
|
+ <option value="已转移">已转移</option>
|
|
|
+ <option value="报废中">报废中</option>
|
|
|
+ <option value="维修中">维修中</option>
|
|
|
+ </select>
|
|
|
</div>
|
|
|
- <div class="layui-inline">
|
|
|
- <button type="button" class="layui-btn layui-btn-sm" id="btnSearchHistory"><i class="layui-icon layui-icon-search"></i></button>
|
|
|
- <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary">重置</button>
|
|
|
+ </div>
|
|
|
+ <div class="layui-inline">
|
|
|
+ <div class="layui-input-inline">
|
|
|
+ <input type="text" name="useDept" placeholder="使用部门" class="layui-input">
|
|
|
</div>
|
|
|
</div>
|
|
|
- </form>
|
|
|
- </div>
|
|
|
- <div class="table-toolbar">
|
|
|
- <button class="layui-btn layui-btn-sm" id="btnAddHistory2"><i class="layui-icon layui-icon-add-1"></i> 添加状态</button>
|
|
|
- </div>
|
|
|
- <div class="panel-body">
|
|
|
- <div id="emptyTip" class="empty-tip" style="display:none;">
|
|
|
- <i class="layui-icon layui-icon-tree"></i>
|
|
|
- <p>请从左侧选择一个资产</p>
|
|
|
+ <div class="layui-inline">
|
|
|
+ <button type="button" class="layui-btn layui-btn-sm" id="btnSearchHistory"><i
|
|
|
+ class="layui-icon layui-icon-search"></i></button>
|
|
|
+ <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary">重置</button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <table id="historyList" lay-filter="historyList"></table>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+ <div class="table-toolbar">
|
|
|
+ <button class="layui-btn layui-btn-sm" id="btnAddHistory2"><i class="layui-icon layui-icon-add-1"></i>
|
|
|
+ 添加状态
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ <div class="panel-body">
|
|
|
+ <div id="emptyTip" class="empty-tip" style="display:none;">
|
|
|
+ <i class="layui-icon layui-icon-tree"></i>
|
|
|
+ <p>请从左侧选择一个资产</p>
|
|
|
</div>
|
|
|
+ <table id="historyList" lay-filter="historyList"></table>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+</div>
|
|
|
+
|
|
|
+<script type="text/html" id="assetToolbar">
|
|
|
+ <a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i> 编辑</a>
|
|
|
+ <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i> 删除</a>
|
|
|
+</script>
|
|
|
+
|
|
|
+<script type="text/html" id="historyToolbar">
|
|
|
+ <a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i> 编辑</a>
|
|
|
+ <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i> 删除</a>
|
|
|
+</script>
|
|
|
+
|
|
|
+<script type="text/html" id="invstkStatusTpl">
|
|
|
+ {{# if(d.invstkStatus === '1') { }}
|
|
|
+ <span class="layui-badge layui-bg-green">已盘点</span>
|
|
|
+ {{# } else { }}
|
|
|
+ <span class="layui-badge layui-bg-gray">未盘点</span>
|
|
|
+ {{# } }}
|
|
|
+</script>
|
|
|
+
|
|
|
+<script type="text/html" id="purchaseValueTpl">
|
|
|
+ {{# if(d.purchaseValue) { }}
|
|
|
+ ¥{{d.purchaseValue}}
|
|
|
+ {{# } else { }}
|
|
|
+ -
|
|
|
+ {{# } }}
|
|
|
+</script>
|
|
|
+
|
|
|
+<script type="text/html" id="useStatusTpl">
|
|
|
+ {{# if(d.useStatus === '在库') { }}
|
|
|
+ <span class="layui-badge layui-bg-gray">在库</span>
|
|
|
+ {{# } else if(d.useStatus === '正常使用') { }}
|
|
|
+ <span class="layui-badge layui-bg-green">正常使用</span>
|
|
|
+ {{# } else if(d.useStatus === '已转移') { }}
|
|
|
+ <span class="layui-badge layui-bg-blue">已转移</span>
|
|
|
+ {{# } else if(d.useStatus === '报废中') { }}
|
|
|
+ <span class="layui-badge layui-bg-orange">报废中</span>
|
|
|
+ {{# } else if(d.useStatus === '维修中') { }}
|
|
|
+ <span class="layui-badge layui-bg-yellow">维修中</span>
|
|
|
+ {{# } else { }}
|
|
|
+ <span class="layui-badge layui-bg-cyan">{{d.useStatus}}</span>
|
|
|
+ {{# } }}
|
|
|
+</script>
|
|
|
+
|
|
|
+<script src="../../lib/jquery.min.js"></script>
|
|
|
+<script src="../../lib/layui/layui.js"></script>
|
|
|
+<script src="../../js/config.js"></script>
|
|
|
+<script src="../../js/common.js"></script>
|
|
|
+<script>
|
|
|
+ layui.use(['table', 'layer', 'form'], function () {
|
|
|
+ var table = layui.table;
|
|
|
+ var layer = layui.layer;
|
|
|
+ var form = layui.form;
|
|
|
+
|
|
|
+ var currentAsset = null;
|
|
|
+ var historyTableIns = null;
|
|
|
+ var assetTableIns = null;
|
|
|
+
|
|
|
+ // 加载部门列表(用于搜索)
|
|
|
+ function loadSearchDepartments() {
|
|
|
+ Common.get(Config.api.department.list, function (res) {
|
|
|
+ if (res.code === 200 && res.data) {
|
|
|
+ var depts = res.data || [];
|
|
|
+ var html = '<option value="">管理部门</option>';
|
|
|
+ depts.forEach(function (dept) {
|
|
|
+ html += '<option value="' + dept.deptName + '">' + dept.deptName + '</option>';
|
|
|
+ });
|
|
|
+ $('#searchDeptSelect').html(html);
|
|
|
+ form.render('select');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- <script type="text/html" id="assetToolbar">
|
|
|
- <a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i> 编辑</a>
|
|
|
- <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i> 删除</a>
|
|
|
- </script>
|
|
|
-
|
|
|
- <script type="text/html" id="historyToolbar">
|
|
|
- <a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i> 编辑</a>
|
|
|
- <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i> 删除</a>
|
|
|
- </script>
|
|
|
-
|
|
|
- <script type="text/html" id="invstkStatusTpl">
|
|
|
- {{# if(d.invstkStatus === '1') { }}
|
|
|
- <span class="layui-badge layui-bg-green">已盘点</span>
|
|
|
- {{# } else { }}
|
|
|
- <span class="layui-badge layui-bg-gray">未盘点</span>
|
|
|
- {{# } }}
|
|
|
- </script>
|
|
|
-
|
|
|
- <script type="text/html" id="purchaseValueTpl">
|
|
|
- {{# if(d.purchaseValue) { }}
|
|
|
- ¥{{d.purchaseValue}}
|
|
|
- {{# } else { }}
|
|
|
- -
|
|
|
- {{# } }}
|
|
|
- </script>
|
|
|
-
|
|
|
- <script type="text/html" id="useStatusTpl">
|
|
|
- {{# if(d.useStatus === '在库') { }}
|
|
|
- <span class="layui-badge layui-bg-gray">在库</span>
|
|
|
- {{# } else if(d.useStatus === '正常使用') { }}
|
|
|
- <span class="layui-badge layui-bg-green">正常使用</span>
|
|
|
- {{# } else if(d.useStatus === '已转移') { }}
|
|
|
- <span class="layui-badge layui-bg-blue">已转移</span>
|
|
|
- {{# } else if(d.useStatus === '报废中') { }}
|
|
|
- <span class="layui-badge layui-bg-orange">报废中</span>
|
|
|
- {{# } else if(d.useStatus === '维修中') { }}
|
|
|
- <span class="layui-badge layui-bg-yellow">维修中</span>
|
|
|
- {{# } else { }}
|
|
|
- <span class="layui-badge layui-bg-cyan">{{d.useStatus}}</span>
|
|
|
- {{# } }}
|
|
|
- </script>
|
|
|
-
|
|
|
- <script src="../../lib/jquery.min.js"></script>
|
|
|
- <script src="../../lib/layui/layui.js"></script>
|
|
|
- <script src="../../js/config.js"></script>
|
|
|
- <script src="../../js/common.js"></script>
|
|
|
- <script>
|
|
|
- layui.use(['table', 'layer', 'form'], function() {
|
|
|
- var table = layui.table;
|
|
|
- var layer = layui.layer;
|
|
|
- var form = layui.form;
|
|
|
-
|
|
|
- var currentAsset = null;
|
|
|
- var historyTableIns = null;
|
|
|
- var assetTableIns = null;
|
|
|
-
|
|
|
- // 加载部门列表(用于搜索)
|
|
|
- function loadSearchDepartments() {
|
|
|
- Common.get(Config.api.department.list, function(res) {
|
|
|
- if (res.code === 200 && res.data) {
|
|
|
- var depts = res.data || [];
|
|
|
- var html = '<option value="">管理部门</option>';
|
|
|
- depts.forEach(function(dept) {
|
|
|
- html += '<option value="' + dept.deptName + '">' + dept.deptName + '</option>';
|
|
|
- });
|
|
|
- $('#searchDeptSelect').html(html);
|
|
|
- form.render('select');
|
|
|
+ // 加载资产详情
|
|
|
+ function loadAssetInfo(assetId) {
|
|
|
+ Common.get(Config.api.assets.getInfo + '/' + assetId, function (res) {
|
|
|
+ if (res.code === 200 && res.data) {
|
|
|
+ var info = res.data;
|
|
|
+ $('#assetInfoCard').show();
|
|
|
+ $('#assetDetailCard').show();
|
|
|
+ // 主卡片:资产编码 + 资产类型
|
|
|
+ $('#assetInfoCode').text(info.assetCode || '-');
|
|
|
+ $('#assetInfoType').text(info.assetType || '-');
|
|
|
+ // 详情卡片:所有字段
|
|
|
+ $('#assetDetailDept').text(info.deptName || '-');
|
|
|
+ $('#assetDetailBrand').text(info.brand || '-');
|
|
|
+ $('#assetDetailModel').text(info.model || '-');
|
|
|
+ $('#assetDetailPurchaseDate').text(info.purchaseDate || '-');
|
|
|
+ $('#assetDetailPurchaseValue').text(info.purchaseValue ? '¥' + info.purchaseValue : '-');
|
|
|
+ var statusText = info.invstkStatus === '1' ? '已盘点' : '未盘点';
|
|
|
+ var statusClass = info.invstkStatus === '1' ? 'layui-bg-green' : 'layui-bg-gray';
|
|
|
+ $('#assetDetailStatus').html('<span class="layui-badge ' + statusClass + '">' + statusText + '</span>');
|
|
|
+ $('#assetDetailLastInvstkTime').text(info.lastInvstkTime || '-');
|
|
|
+ $('#assetDetailRemark').text(info.remark || '-');
|
|
|
+ // 扩展字段
|
|
|
+ var hasExt = info.attribute1 || info.attribute2 || info.attribute3 || info.attribute4;
|
|
|
+ if (hasExt) {
|
|
|
+ $('#extFieldRow').show();
|
|
|
+ $('#extFieldRow2').show();
|
|
|
+ $('#assetDetailAttr1').text(info.attribute1 || '-');
|
|
|
+ $('#assetDetailAttr2').text(info.attribute2 || '-');
|
|
|
+ $('#assetDetailAttr3').text(info.attribute3 || '-');
|
|
|
+ $('#assetDetailAttr4').text(info.attribute4 || '-');
|
|
|
+ } else {
|
|
|
+ $('#extFieldRow').hide();
|
|
|
+ $('#extFieldRow2').hide();
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- // 加载资产详情
|
|
|
- function loadAssetInfo(assetId) {
|
|
|
- Common.get(Config.api.assets.getInfo + '/' + assetId, function(res) {
|
|
|
- if (res.code === 200 && res.data) {
|
|
|
- var info = res.data;
|
|
|
- $('#assetInfoCard').show();
|
|
|
- $('#assetDetailCard').show();
|
|
|
- // 主卡片:资产编码 + 资产类型
|
|
|
- $('#assetInfoCode').text(info.assetCode || '-');
|
|
|
- $('#assetInfoType').text(info.assetType || '-');
|
|
|
- // 详情卡片:所有字段
|
|
|
- $('#assetDetailDept').text(info.deptName || '-');
|
|
|
- $('#assetDetailBrand').text(info.brand || '-');
|
|
|
- $('#assetDetailModel').text(info.model || '-');
|
|
|
- $('#assetDetailPurchaseDate').text(info.purchaseDate || '-');
|
|
|
- $('#assetDetailPurchaseValue').text(info.purchaseValue ? '¥' + info.purchaseValue : '-');
|
|
|
- var statusText = info.invstkStatus === '1' ? '已盘点' : '未盘点';
|
|
|
- var statusClass = info.invstkStatus === '1' ? 'layui-bg-green' : 'layui-bg-gray';
|
|
|
- $('#assetDetailStatus').html('<span class="layui-badge ' + statusClass + '">' + statusText + '</span>');
|
|
|
- $('#assetDetailLastInvstkTime').text(info.lastInvstkTime || '-');
|
|
|
- $('#assetDetailRemark').text(info.remark || '-');
|
|
|
- // 扩展字段
|
|
|
- var hasExt = info.attribute1 || info.attribute2 || info.attribute3 || info.attribute4;
|
|
|
- if (hasExt) {
|
|
|
- $('#extFieldRow').show();
|
|
|
- $('#extFieldRow2').show();
|
|
|
- $('#assetDetailAttr1').text(info.attribute1 || '-');
|
|
|
- $('#assetDetailAttr2').text(info.attribute2 || '-');
|
|
|
- $('#assetDetailAttr3').text(info.attribute3 || '-');
|
|
|
- $('#assetDetailAttr4').text(info.attribute4 || '-');
|
|
|
- } else {
|
|
|
- $('#extFieldRow').hide();
|
|
|
- $('#extFieldRow2').hide();
|
|
|
+ // 初始化资产表格
|
|
|
+ function initAssetTable() {
|
|
|
+ assetTableIns = TableRender.init({
|
|
|
+ elem: '#assetList',
|
|
|
+ url: Config.api.assets.page,
|
|
|
+ page: true,
|
|
|
+ limit: 20,
|
|
|
+ limits: [10, 20, 50, 100],
|
|
|
+ where: {},
|
|
|
+ cols: [[
|
|
|
+ {field: 'assetCode', title: '资产编码', width: 120},
|
|
|
+ {field: 'assetType', title: '资产类型', width: 120},
|
|
|
+ {field: 'model', title: '型号'},
|
|
|
+ {field: 'brand', title: '品牌'},
|
|
|
+ {field: 'deptName', title: '管理部门', width: 120},
|
|
|
+ {field: 'purchaseValue', title: '采购价(元)', width: 120, templet: '#purchaseValueTpl'},
|
|
|
+ {field: 'invstkStatus', title: '盘点状态', width: 120, templet: '#invstkStatusTpl'},
|
|
|
+ {field: 'lastInvstkTime', title: '最后盘点时间', width: 200},
|
|
|
+ {fixed: 'right', title: '操作', width: 180, align: 'center', toolbar: '#assetToolbar'}
|
|
|
+ ]],
|
|
|
+ done: function (res, curr, count) {
|
|
|
+ // 默认选中第一行
|
|
|
+ /*if (count > 0 && !currentAsset) {
|
|
|
+ var firstRow = res.data[0];
|
|
|
+ if (firstRow) {
|
|
|
+ selectAsset(firstRow.id, firstRow);
|
|
|
+ // 延迟显示右侧面板(等待DOM渲染)
|
|
|
+ setTimeout(function () {
|
|
|
+ $('.dict-right').addClass('active');
|
|
|
+ }, 100);
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
+ }*/
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 选中资产
|
|
|
+ function selectAsset(assetId, rowData) {
|
|
|
+ currentAsset = rowData;
|
|
|
+ loadAssetInfo(assetId);
|
|
|
+ loadHistoryList(assetId);
|
|
|
+ // 显示并滑入右侧面板
|
|
|
+ $('#emptyTip').hide();
|
|
|
+ $('.dict-right').addClass('active');
|
|
|
+ // 左侧选中行样式
|
|
|
+ $('.dict-left .layui-table tbody tr').removeClass('selected');
|
|
|
+ $(this).find('tr[data-index="' + rowData.LAY_TABLE_INDEX + '"]').addClass('selected');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 搜索资产
|
|
|
+ function searchAssetList() {
|
|
|
+ var data = form.val('assetSearchForm');
|
|
|
+ table.reload('assetList', {
|
|
|
+ where: {
|
|
|
+ assetCode: data.assetCode,
|
|
|
+ assetType: data.assetType,
|
|
|
+ model: data.model,
|
|
|
+ deptName: data.deptName
|
|
|
+ },
|
|
|
+ page: {curr: 1}
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 加载状态历史列表
|
|
|
+ function loadHistoryList(assetId) {
|
|
|
+ if (!assetId) {
|
|
|
+ $('#emptyTip').show();
|
|
|
+ return;
|
|
|
}
|
|
|
+ $('#emptyTip').hide();
|
|
|
|
|
|
- // 初始化资产表格
|
|
|
- function initAssetTable() {
|
|
|
- assetTableIns = TableRender.init({
|
|
|
- elem: '#assetList',
|
|
|
- url: Config.api.assets.page,
|
|
|
+ if (historyTableIns) {
|
|
|
+ table.reload('historyList', {
|
|
|
+ where: {assetId: assetId},
|
|
|
+ page: {curr: 1}
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ historyTableIns = TableRender.init({
|
|
|
+ elem: '#historyList',
|
|
|
+ id: 'historyList',
|
|
|
+ url: Config.api.assetStatusHistory.page,
|
|
|
+ where: {assetId: assetId},
|
|
|
page: true,
|
|
|
- limit: 20,
|
|
|
+ limit: 10,
|
|
|
limits: [10, 20, 50, 100],
|
|
|
- maxHeight: '500px',
|
|
|
- where: {},
|
|
|
cols: [[
|
|
|
- { field: 'assetCode', title: '资产编码', width: 120 },
|
|
|
- { field: 'assetType', title: '资产类型', width: 120 },
|
|
|
- { field: 'model', title: '型号', width: 120 },
|
|
|
- { field: 'brand', title: '品牌', width: 120 },
|
|
|
- { field: 'deptName', title: '管理部门', width: 120 },
|
|
|
- { field: 'purchaseValue', title: '采购价(元)', width: 120, templet: '#purchaseValueTpl' },
|
|
|
- { field: 'invstkStatus', title: '盘点状态', width: 120, templet: '#invstkStatusTpl' },
|
|
|
- { field: 'lastInvstkTime', title: '最后盘点时间', width: 120 },
|
|
|
- { fixed: 'right', title: '操作', width: 180, align: 'center', toolbar: '#assetToolbar' }
|
|
|
- ]],
|
|
|
- done: function(res, curr, count) {
|
|
|
- // 默认选中第一行
|
|
|
- if (count > 0 && !currentAsset) {
|
|
|
- var firstRow = res.data[0];
|
|
|
- if (firstRow) {
|
|
|
- selectAsset(firstRow.id, firstRow);
|
|
|
+ {field: 'useCompany', title: '使用公司', width: 120},
|
|
|
+ {field: 'useDept', title: '使用部门', width: 120},
|
|
|
+ {field: 'useUser', title: '使用人', width: 100},
|
|
|
+ {field: 'useStatus', title: '使用状态', width: 110, templet: '#useStatusTpl'},
|
|
|
+ {field: 'curLocation', title: '当前位置', width: 120},
|
|
|
+ {
|
|
|
+ field: 'startDate', title: '生效开始', width: 120, templet: function (d) {
|
|
|
+ return d.startDate || '-';
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'endDate', title: '生效结束', width: 120, templet: function (d) {
|
|
|
+ return d.endDate || '-';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {field: 'operatorName', title: '操作人', width: 100},
|
|
|
+ {field: 'operatorDate', title: '操作时间', width: 120},
|
|
|
+ {field: 'assistantName', title: '协管员', width: 120},
|
|
|
+ {field: 'remark', title: '备注', width: 120},
|
|
|
+ {fixed: 'right', title: '操作', width: 180, align: 'center', toolbar: '#historyToolbar'}
|
|
|
+ ]]
|
|
|
});
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- // 选中资产
|
|
|
- function selectAsset(assetId, rowData) {
|
|
|
- currentAsset = rowData;
|
|
|
- loadAssetInfo(assetId);
|
|
|
- loadHistoryList(assetId);
|
|
|
- }
|
|
|
+ // 初始化资产表格
|
|
|
+ initAssetTable();
|
|
|
|
|
|
- // 搜索资产
|
|
|
- function searchAssetList() {
|
|
|
- var data = form.val('assetSearchForm');
|
|
|
- table.reload('assetList', {
|
|
|
- where: {
|
|
|
- assetCode: data.assetCode,
|
|
|
- assetType: data.assetType,
|
|
|
- model: data.model,
|
|
|
- deptName: data.deptName
|
|
|
- },
|
|
|
- page: { curr: 1 }
|
|
|
- });
|
|
|
+ // 加载部门列表用于搜索
|
|
|
+ loadSearchDepartments();
|
|
|
+
|
|
|
+ // 点击左侧空白区域收回右侧面板
|
|
|
+ $('.dict-left').on('click', function (e) {
|
|
|
+ // 检查是否点击的是表格行
|
|
|
+ if ($(e.target).closest('.layui-table tbody tr').length === 0) {
|
|
|
+ // 点击空白区域,收起右侧面板
|
|
|
+ $('.dict-right').removeClass('active');
|
|
|
+ currentAsset = null;
|
|
|
+ $('#assetInfoCard').hide();
|
|
|
+ $('#assetDetailCard').hide();
|
|
|
}
|
|
|
+ });
|
|
|
|
|
|
- // 加载状态历史列表
|
|
|
- function loadHistoryList(assetId) {
|
|
|
- if (!assetId) {
|
|
|
- $('#emptyTip').show();
|
|
|
- return;
|
|
|
- }
|
|
|
- $('#emptyTip').hide();
|
|
|
+ // 搜索资产
|
|
|
+ $('#btnSearchAsset').click(function () {
|
|
|
+ searchAssetList();
|
|
|
+ });
|
|
|
|
|
|
- if (historyTableIns) {
|
|
|
- table.reload('historyList', {
|
|
|
- where: { assetId: assetId },
|
|
|
- page: { curr: 1 }
|
|
|
- });
|
|
|
- } else {
|
|
|
- historyTableIns = TableRender.init({
|
|
|
- elem: '#historyList',
|
|
|
- url: Config.api.assetStatusHistory.page,
|
|
|
- where: { assetId: assetId },
|
|
|
- page: true,
|
|
|
- limits: [10, 20, 50],
|
|
|
- maxHeight: '500',
|
|
|
- cols: [[
|
|
|
- { field: 'useCompany', title: '使用公司', width: 120 },
|
|
|
- { field: 'useDept', title: '使用部门', width: 120 },
|
|
|
- { field: 'useUser', title: '使用人', width: 100 },
|
|
|
- { field: 'useStatus', title: '使用状态', width: 110, templet: '#useStatusTpl' },
|
|
|
- { field: 'curLocation', title: '当前位置', width: 120 },
|
|
|
- { field: 'startDate', title: '生效开始', width: 120, templet: function(d) { return d.startDate || '-'; } },
|
|
|
- { field: 'endDate', title: '生效结束', width: 120, templet: function(d) { return d.endDate || '-'; } },
|
|
|
- { field: 'operatorName', title: '操作人', width: 100 },
|
|
|
- { field: 'operatorDate', title: '操作时间', width: 120 },
|
|
|
- { field: 'assistantName', title: '协管员', width: 120 },
|
|
|
- { field: 'remark', title: '备注', width: 120 },
|
|
|
- { fixed: 'right', title: '操作', width: 180, align: 'center', toolbar: '#historyToolbar' }
|
|
|
- ]]
|
|
|
- });
|
|
|
- }
|
|
|
+ // 输入时显示/隐藏清除按钮
|
|
|
+ $('#assetCodeSearch').on('input', function () {
|
|
|
+ var val = $(this).val();
|
|
|
+ if (val) {
|
|
|
+ $('#inputClear').show();
|
|
|
+ } else {
|
|
|
+ $('#inputClear').hide();
|
|
|
}
|
|
|
+ });
|
|
|
|
|
|
- // 初始化资产表格
|
|
|
- initAssetTable();
|
|
|
-
|
|
|
- // 加载部门列表用于搜索
|
|
|
- loadSearchDepartments();
|
|
|
+ // 点击清除按钮
|
|
|
+ $('#inputClear').click(function () {
|
|
|
+ $('#assetCodeSearch').val('');
|
|
|
+ $(this).hide();
|
|
|
+ searchAssetList();
|
|
|
+ });
|
|
|
|
|
|
- // 搜索资产
|
|
|
- $('#btnSearchAsset').click(function() {
|
|
|
+ // 回车搜索
|
|
|
+ $('#assetCodeSearch').keypress(function (e) {
|
|
|
+ if (e.which === 13) {
|
|
|
searchAssetList();
|
|
|
- });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- // 输入时显示/隐藏清除按钮
|
|
|
- $('#assetCodeSearch').on('input', function() {
|
|
|
- var val = $(this).val();
|
|
|
- if (val) {
|
|
|
- $('#inputClear').show();
|
|
|
- } else {
|
|
|
- $('#inputClear').hide();
|
|
|
- }
|
|
|
- });
|
|
|
+ // 资产行点击
|
|
|
+ table.on('row(assetList)', function (obj) {
|
|
|
+ selectAsset(obj.data.id, obj.data);
|
|
|
+ });
|
|
|
|
|
|
- // 点击清除按钮
|
|
|
- $('#inputClear').click(function() {
|
|
|
- $('#assetCodeSearch').val('');
|
|
|
- $(this).hide();
|
|
|
- searchAssetList();
|
|
|
+ // 搜索状态历史
|
|
|
+ $('#btnSearchHistory').click(function () {
|
|
|
+ if (!currentAsset) {
|
|
|
+ layer.msg('请先选择资产', {icon: 0});
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var data = form.val('historySearchForm');
|
|
|
+ data.assetId = currentAsset.id;
|
|
|
+ table.reload('historyList', {
|
|
|
+ where: data,
|
|
|
+ page: {curr: 1}
|
|
|
});
|
|
|
+ });
|
|
|
|
|
|
- // 回车搜索
|
|
|
- $('#assetCodeSearch').keypress(function(e) {
|
|
|
- if (e.which === 13) {
|
|
|
- searchAssetList();
|
|
|
- return false;
|
|
|
- }
|
|
|
+ // 添加资产
|
|
|
+ $('#btnAddAsset').click(function () {
|
|
|
+ Common.open({
|
|
|
+ title: '添加资产',
|
|
|
+ area: ['50%', '80%'],
|
|
|
+ content: 'assets_form.html'
|
|
|
});
|
|
|
+ });
|
|
|
+
|
|
|
+ // 收回右侧面板
|
|
|
+ $('#btnCollapseRight').click(function () {
|
|
|
+ $('.dict-right').removeClass('active');
|
|
|
+ });
|
|
|
+
|
|
|
+ // 收缩/展开资产详情卡片
|
|
|
+ $('#detailCardHeader').click(function () {
|
|
|
+ $('#assetDetailCard').toggleClass('collapsed');
|
|
|
+ $('#detailCardToggle').toggleClass('collapsed');
|
|
|
+ });
|
|
|
|
|
|
- // 资产行点击
|
|
|
- table.on('row(assetList)', function(obj) {
|
|
|
- selectAsset(obj.data.id, obj.data);
|
|
|
+ // 编辑资产
|
|
|
+ $('#btnEditAsset').click(function () {
|
|
|
+ if (!currentAsset) {
|
|
|
+ layer.msg('请先选择资产', {icon: 0});
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Common.open({
|
|
|
+ title: '编辑资产',
|
|
|
+ area: ['50%', '80%'],
|
|
|
+ content: 'assets_form.html?id=' + currentAsset.id
|
|
|
});
|
|
|
+ });
|
|
|
|
|
|
- // 搜索状态历史
|
|
|
- $('#btnSearchHistory').click(function() {
|
|
|
- if (!currentAsset) {
|
|
|
- layer.msg('请先选择资产', { icon: 0 });
|
|
|
- return;
|
|
|
- }
|
|
|
- var data = form.val('historySearchForm');
|
|
|
- data.assetId = currentAsset.id;
|
|
|
- table.reload('historyList', {
|
|
|
- where: data,
|
|
|
- page: { curr: 1 }
|
|
|
+ // 删除资产
|
|
|
+ $('#btnDelAsset').click(function () {
|
|
|
+ if (!currentAsset) {
|
|
|
+ layer.msg('请先选择资产', {icon: 0});
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Common.confirm('确定要删除资产 【' + currentAsset.assetCode + '】 吗?', function () {
|
|
|
+ Common.del(Config.api.assets.remove + '/' + currentAsset.id, function (res) {
|
|
|
+ Common.success('删除成功', function () {
|
|
|
+ currentAsset = null;
|
|
|
+ $('#assetInfoCard').hide();
|
|
|
+ $('#assetDetailCard').hide();
|
|
|
+ $('.dict-right').removeClass('active');
|
|
|
+ table.reload('assetList');
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
+ });
|
|
|
|
|
|
- // 添加资产
|
|
|
- $('#btnAddAsset').click(function() {
|
|
|
- Common.open({
|
|
|
- title: '添加资产',
|
|
|
- area: ['50%', '80%'],
|
|
|
- content: 'assets_form.html'
|
|
|
- });
|
|
|
+ // 添加状态历史
|
|
|
+ function openHistoryForm() {
|
|
|
+ if (!currentAsset) {
|
|
|
+ layer.msg('请先选择资产', {icon: 0});
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Common.open({
|
|
|
+ title: '添加状态历史',
|
|
|
+ area: ['50%', '80%'],
|
|
|
+ content: 'asset_status_history_form.html?assetId=' + currentAsset.id
|
|
|
});
|
|
|
+ }
|
|
|
|
|
|
- // 编辑资产
|
|
|
- $('#btnEditAsset').click(function() {
|
|
|
- if (!currentAsset) {
|
|
|
- layer.msg('请先选择资产', { icon: 0 });
|
|
|
- return;
|
|
|
- }
|
|
|
+ $('#btnAddHistory, #btnAddHistory2').click(function () {
|
|
|
+ openHistoryForm();
|
|
|
+ });
|
|
|
+
|
|
|
+ // 资产表格操作
|
|
|
+ table.on('tool(assetList)', function (obj) {
|
|
|
+ var data = obj.data;
|
|
|
+ var event = obj.event;
|
|
|
+
|
|
|
+ if (event === 'edit') {
|
|
|
Common.open({
|
|
|
title: '编辑资产',
|
|
|
area: ['50%', '80%'],
|
|
|
- content: 'assets_form.html?id=' + currentAsset.id
|
|
|
+ content: 'assets_form.html?id=' + data.id
|
|
|
});
|
|
|
- });
|
|
|
-
|
|
|
- // 删除资产
|
|
|
- $('#btnDelAsset').click(function() {
|
|
|
- if (!currentAsset) {
|
|
|
- layer.msg('请先选择资产', { icon: 0 });
|
|
|
- return;
|
|
|
- }
|
|
|
- Common.confirm('确定要删除资产 【' + currentAsset.assetCode + '】 吗?', function() {
|
|
|
- Common.del(Config.api.assets.remove + '/' + currentAsset.id, function(res) {
|
|
|
- Common.success('删除成功', function() {
|
|
|
- currentAsset = null;
|
|
|
- $('#assetInfoCard').hide();
|
|
|
- $('#assetDetailCard').hide();
|
|
|
- table.reload('assetList');
|
|
|
+ } else if (event === 'del') {
|
|
|
+ Common.confirm('确定要删除资产 【' + data.assetCode + '】 吗?', function () {
|
|
|
+ Common.del(Config.api.assets.remove + '/' + data.id, function (res) {
|
|
|
+ Common.success('删除成功', function () {
|
|
|
+ obj.del();
|
|
|
+ if (currentAsset && currentAsset.id === data.id) {
|
|
|
+ currentAsset = null;
|
|
|
+ $('#assetInfoCard').hide();
|
|
|
+ $('#assetDetailCard').hide();
|
|
|
+ $('.dict-right').removeClass('active');
|
|
|
+ }
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
- });
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- // 添加状态历史
|
|
|
- function openHistoryForm() {
|
|
|
- if (!currentAsset) {
|
|
|
- layer.msg('请先选择资产', { icon: 0 });
|
|
|
- return;
|
|
|
- }
|
|
|
+ // 状态历史表格操作
|
|
|
+ table.on('tool(historyList)', function (obj) {
|
|
|
+ var data = obj.data;
|
|
|
+ var event = obj.event;
|
|
|
+
|
|
|
+ if (event === 'edit') {
|
|
|
Common.open({
|
|
|
- title: '添加状态历史',
|
|
|
+ title: '编辑状态历史',
|
|
|
area: ['50%', '80%'],
|
|
|
- content: 'asset_status_history_form.html?assetId=' + currentAsset.id
|
|
|
+ content: 'asset_status_history_form.html?assetId=' + currentAsset.id + '&id=' + data.id
|
|
|
});
|
|
|
- }
|
|
|
-
|
|
|
- $('#btnAddHistory, #btnAddHistory2').click(function() {
|
|
|
- openHistoryForm();
|
|
|
- });
|
|
|
-
|
|
|
- // 资产表格操作
|
|
|
- table.on('tool(assetList)', function(obj) {
|
|
|
- var data = obj.data;
|
|
|
- var event = obj.event;
|
|
|
-
|
|
|
- if (event === 'edit') {
|
|
|
- Common.open({
|
|
|
- title: '编辑资产',
|
|
|
- area: ['50%', '80%'],
|
|
|
- content: 'assets_form.html?id=' + data.id
|
|
|
- });
|
|
|
- } else if (event === 'del') {
|
|
|
- Common.confirm('确定要删除资产 【' + data.assetCode + '】 吗?', function() {
|
|
|
- Common.del(Config.api.assets.remove + '/' + data.id, function(res) {
|
|
|
- Common.success('删除成功', function() {
|
|
|
- obj.del();
|
|
|
- if (currentAsset && currentAsset.id === data.id) {
|
|
|
- currentAsset = null;
|
|
|
- $('#assetInfoCard').hide();
|
|
|
- $('#assetDetailCard').hide();
|
|
|
- }
|
|
|
- });
|
|
|
+ } else if (event === 'del') {
|
|
|
+ Common.confirm('确定要删除该状态历史记录吗?', function () {
|
|
|
+ Common.del(Config.api.assetStatusHistory.remove + '/' + data.id, function (res) {
|
|
|
+ Common.success('删除成功', function () {
|
|
|
+ obj.del();
|
|
|
});
|
|
|
});
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- // 状态历史表格操作
|
|
|
- table.on('tool(historyList)', function(obj) {
|
|
|
- var data = obj.data;
|
|
|
- var event = obj.event;
|
|
|
-
|
|
|
- if (event === 'edit') {
|
|
|
- Common.open({
|
|
|
- title: '编辑状态历史',
|
|
|
- area: ['50%', '80%'],
|
|
|
- content: 'asset_status_history_form.html?assetId=' + currentAsset.id + '&id=' + data.id
|
|
|
- });
|
|
|
- } else if (event === 'del') {
|
|
|
- Common.confirm('确定要删除该状态历史记录吗?', function() {
|
|
|
- Common.del(Config.api.assetStatusHistory.remove + '/' + data.id, function(res) {
|
|
|
- Common.success('删除成功', function() {
|
|
|
- obj.del();
|
|
|
- });
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- // 监听弹窗关闭,刷新资产列表
|
|
|
- window.refreshAssetList = function() {
|
|
|
- table.reload('assetList');
|
|
|
- };
|
|
|
+ // 监听弹窗关闭,刷新资产列表
|
|
|
+ window.refreshAssetList = function () {
|
|
|
+ table.reload('assetList');
|
|
|
+ };
|
|
|
|
|
|
- // 监听弹窗关闭,刷新状态历史
|
|
|
- window.refreshHistoryList = function() {
|
|
|
- if (currentAsset) {
|
|
|
- loadHistoryList(currentAsset.id);
|
|
|
- }
|
|
|
- };
|
|
|
- });
|
|
|
- </script>
|
|
|
+ // 监听弹窗关闭,刷新状态历史
|
|
|
+ window.refreshHistoryList = function () {
|
|
|
+ if (currentAsset) {
|
|
|
+ loadHistoryList(currentAsset.id);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ });
|
|
|
+</script>
|
|
|
</body>
|
|
|
</html>
|