Browse Source

科研资产清单优化

ljb 10 months ago
parent
commit
0b4b48f529

+ 30 - 18
src/option/basicResource/kyAssetList.js

@@ -6,11 +6,10 @@ export default {
   searchMenuSpan: 6,
   border: true,
   index: true,
-  viewBtn: true,
   selection: true,
   searchLabelWidth: 140,
   labelWidth: 140,
-  menuWidth: 220,
+  menuWidth: 290,
   dialogClickModal: false,
   dialogWidth: 500,
   dialogType: "drawer",
@@ -37,7 +36,7 @@ export default {
       prop: 'zcmc',
       type: 'input',
       span: 24,
-      minWidth: 200,
+      minWidth: 160,
       search: true,
       showOverflowTooltip: true,
       rules: [
@@ -58,7 +57,7 @@ export default {
         value: 'dictKey',
       },
       span: 24,
-      width: 120,
+      width: 90,
       align: 'center',
       showOverflowTooltip: true,
       search: true,
@@ -73,11 +72,14 @@ export default {
     {
       label: '功率',
       prop: 'gl',
-      type: 'input',
+      type: 'number',
+      min: 0,
+      precision: 0,
       span: 24,
-      width: 90,
+      width: 60,
       align: 'center',
       showOverflowTooltip: true,
+      display: true
     },
     {
       label: '用途',
@@ -90,7 +92,7 @@ export default {
       },
       search: true,
       span: 24,
-      width: 120,
+      width: 65,
       align: 'center',
       showOverflowTooltip: true,
       rules: [
@@ -106,7 +108,7 @@ export default {
       prop: 'kssj',
       type: 'date',
       span: 24,
-      width: 120,
+      width: 90,
       search: true,
       align: 'center',
       showOverflowTooltip: true,
@@ -123,7 +125,7 @@ export default {
       prop: 'sysm',
       type: 'number',
       span: 24,
-      width: 90,
+      width: 70,
       min: 0,
       precision: 0,
       search: true,
@@ -142,7 +144,7 @@ export default {
       prop: 'ysysm',
       type: 'number',
       span: 24,
-      width: 100,
+      width: 85,
       min: 0,
       precision: 0,
       align: 'center',
@@ -161,7 +163,7 @@ export default {
       prop: 'zcyz',
       type: 'number',
       span: 24,
-      width: 100,
+      width: 95,
       min: 0,
       precision: 2,
       align: 'center',
@@ -179,7 +181,7 @@ export default {
       prop: 'jcz',
       type: 'number',
       span: 24,
-      width: 80,
+      width: 70,
       min: 0,
       max: 100,
       align: 'center',
@@ -214,14 +216,24 @@ export default {
       label: '状态',
       prop: 'status',
       type: 'select',
-      dicUrl: '/api/kd-system/dict/dictionary?code=zczt',
-      props: {
-        label: 'dictValue',
-        value: 'dictKey',
-      },
+      // dicUrl: '/api/kd-system/dict/dictionary?code=zczt',
+      // props: {
+      //   label: 'dictValue',
+      //   value: 'dictKey',
+      // },
+      dicData: [{
+        label: '正常',
+        value: 0
+      }, {
+        label: '停用',
+        value: 1
+      }, {
+        label: '已足额折旧',
+        value: 2
+      }],
       search: true,
       span: 24,
-      width: 90,
+      width: 70,
       align: 'center',
       showOverflowTooltip: true,
       display: false,

+ 55 - 0
src/views/basic-resource/comp-basic-info/ky-asset-list.vue

@@ -54,6 +54,21 @@
         </div>
       </template>
 
+      <template slot-scope="{row}" slot="menu">
+        <el-button v-if="[1,2].indexOf(row.status) > -1" type="text" size="mini" @click="handleChangeStatus(row, 0)">恢复</el-button>
+        <el-button v-if="row.status === 0" type="text" size="mini" @click="handleChangeStatus(row, 1)">停用</el-button>
+        <el-button v-if="row.status === 0" type="text" size="mini" @click="handleChangeStatus(row, 2)">已足额折旧</el-button>
+      </template>
+
+      <template slot="gl" slot-scope="{row}">
+        <span v-if="'软件,专利,非专利技术'.indexOf(row.zclb) > -1">/</span>
+        <span v-else>{{ row.gl }}</span>
+      </template>
+
+      <!-- <template slot="glForm" slot-scope="{row}">
+        <el-input-number v-if="'软件,专利,非专利技术'.indexOf(row.zclb) === -1" type="number" />
+      </template> -->
+
       <!-- 开始时间 -->
       <template slot="kssjSearch">
         <el-date-picker
@@ -140,6 +155,22 @@ export default window.$crudCommon({
       };
     },
   },
+  mounted() {
+    let newOption = { ...this.option };
+    // 资产类别下拉框,设置监听事件
+    newOption.column.forEach(item => {
+      if (item.prop == "zclb") {
+        item.change = ({ item }) => {
+          if (!!item && "软件,专利权,非专利技术".indexOf(item.dictValue) > -1) {
+            newOption.column[3].display = false;
+          } else {
+            newOption.column[3].display = true;
+          }
+        }
+      }
+    });
+    this.option = { ...newOption };
+  },
   methods: {
     searchChange(params, done) {
       if (done) done();
@@ -210,6 +241,30 @@ export default window.$crudCommon({
         });
       });
     },
+    handleChangeStatus(rowData, status) {
+      let msgText = '';
+      if (status === 0) {
+        msgText = `确认恢复资产“${rowData.zcmc}”吗?`
+      } else if (status === 1) {
+        msgText = `确认停用资产“${rowData.zcmc}”吗?`
+      } else if (status === 2) {
+        msgText = `确认将资产“${rowData.zcmc}”设置为已足额折旧吗?`
+      }
+
+      this.$confirm(msgText, "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        const params = { ...rowData, status };
+        this.api.update(params).then(({ data }) => {
+          if (data.success) {
+            this.$message.success("操作成功!");
+            this.getList(this.page);
+          }
+        });
+      });
+    },
     /**
      * 打印表格
      * @param isLandscape 是否横向打印