Jelajahi Sumber

Merge remote-tracking branch 'origin/demo_' into demo_

1 tahun lalu
induk
melakukan
78e06cbffe

+ 13 - 0
src/api/idle-assets/idle-assets.js

@@ -29,6 +29,19 @@ export function addSbUnused (parameter) {
     data: parameter
   })
 }
+/**
+ * page func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function updataSbUnused (parameter) {
+  return axios({
+    url: '/sbUnused/unused/saveAgain',
+    method: 'post',
+    data: parameter
+  })
+}
 /**
  * page func
  * parameter: { }

+ 11 - 2
src/views/idle-assets/IdleAssets.vue

@@ -59,9 +59,13 @@
       >
         <span slot="action" slot-scope="record">
           <a @click="handleView(record)">查看</a>
+          <operation-button
+            v-if="record.status===4"
+            @click="handleEdit(record)"
+          >修改提交</operation-button>
           <!-- <operation-button
             @click="handleEdit(record)"
-          >修改</operation-button> -->
+          >再次提交</operation-button> -->
           <operation-button
             v-if="record.status===1||record.status===2"
             @click="handleAudit(record)"
@@ -237,7 +241,12 @@ export default {
       }
       this.$refs.table.refresh(true)
     },
-
+    handleEdit (record) {
+      getUnusedInfo({ id: record.id }).then(res => {
+        const modal = this.$refs.baseForm
+        modal.base(res.data)
+      })
+    },
     handleEnter () {
       this.$refs.table.refresh(true)
     },

+ 72 - 30
src/views/idle-assets/modules/BaseForm.vue

@@ -43,22 +43,21 @@
           </row-item>
         </row-list>
 
-        <row-list :col="1">
-          <row-item >
-            <a-form-item
-              label="设备集合"
-              :labelCol="BaseTool.Constant.labelCol2"
-              :wrapperCol="BaseTool.Constant.wrapperCol2"
-            >
-              <a-input
-                style="width: 80%"
-                disabled
-                v-model="sbs" />
-              <a-button :disabled="title==='编辑'" style="width: 20%" type="primary" @click="handleSbSelect">选择</a-button>
-            </a-form-item>
-          </row-item>
-        </row-list>
       </a-form>
+      <title-divider title="设备集合" width="90px"></title-divider>
+      <a-button type="primary" @click="handleSbSelect">选择</a-button>
+      <br>
+      <br>
+      <a-table
+        :columns="columns"
+        bordered
+        :data-source="sbInfoDTOS"
+      >
+        <span slot="action" slot-scope="record">
+          <a @click="handleDelete(record)">删除</a>
+
+        </span>
+      </a-table>
     </a-card>
     <template slot="footer">
       <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
@@ -69,7 +68,7 @@
 
 <script>
 import pick from 'lodash.pick'
-import { addSbUnused, getUnusedUsers } from '@/api/idle-assets/idle-assets'
+import { addSbUnused, getUnusedUsers, updataSbUnused } from '@/api/idle-assets/idle-assets'
 import SbInfoSelectModal from './SbInfoSelectModal'
 
 export default {
@@ -84,9 +83,34 @@ export default {
       title: '新增',
       modal: {},
       verityUserIdMap: [],
-      sbs: '',
       sbInfoDTOS: [],
-      confirmLoading: false
+      confirmLoading: false,
+      columns: [
+        {
+          title: '设备名称',
+          dataIndex: 'name',
+          key: 'name'
+        },
+        {
+          title: '设备位号',
+          dataIndex: 'positionNo',
+          key: 'positionNo'
+        },
+        {
+          title: '设备编号',
+          dataIndex: 'no',
+          key: 'no'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          fixed: 'right',
+          checked: true,
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ]
     }
   },
 
@@ -106,9 +130,19 @@ export default {
       const { form: { setFieldsValue } } = this
       this.$nextTick(() => {
         setFieldsValue(Object.assign(pick(record, [
-          'id'
+          'id',
+          'name',
+          'verityUserId'
         ])))
       })
+      this.sbInfoDTOS = record.sbUnusedDetailVOS.map(item => {
+        return {
+          id: item.sbId,
+          name: item.sbName,
+          no: item.sbNo,
+          positionNo: item.positionNo
+        }
+      })
     },
     getUnusedUsers () {
       getUnusedUsers().then(res => {
@@ -117,13 +151,10 @@ export default {
     },
 
     handleSbSelect () {
-      this.$refs.sbInfoSelectModal.base({})
+      this.$refs.sbInfoSelectModal.base()
     },
-    handleSbSelectd (keys, rows) {
-      console.log(keys, rows)
-      const sbs = []
-      this.sbInfoDTOS = rows.map(item => {
-        sbs.push(item.name)
+    handleSbSelectd (rows) {
+      const sbInfoDTOS = rows.map(item => {
         return {
           id: item.id,
           name: item.name,
@@ -131,7 +162,10 @@ export default {
           positionNo: item.positionNo
         }
       })
-      this.sbs = sbs.join(',')
+      this.sbInfoDTOS = [...sbInfoDTOS, ...this.sbInfoDTOS]
+    },
+    handleDelete (record) {
+      this.sbInfoDTOS = this.sbInfoDTOS.filter(item => item.id !== record.id)
     },
     save () {
       const { form: { validateFieldsAndScroll } } = this
@@ -145,10 +179,18 @@ export default {
           return
         }
         values.sbInfoDTOS = this.sbInfoDTOS
-        addSbUnused(values).then(res => {
-          this.$message.success('修改成功!')
-          this.handleCancel()
-        })
+        if (values.id) {
+          values.saveFlag = true
+          updataSbUnused(values).then(res => {
+            this.$message.success('修改成功!')
+            this.handleCancel()
+          })
+        } else {
+          addSbUnused(values).then(res => {
+            this.$message.success('修改成功!')
+            this.handleCancel()
+          })
+        }
       })
     },
     handleCancel (values) {

+ 16 - 19
src/views/idle-assets/modules/SbInfoSelectModal.vue

@@ -313,21 +313,21 @@ export default {
                 name: record.id
               }
             })
-          },
-          customRow: (record) => {
-            return {
-              on: { // 事件
-                click: (event) => { // 点击行
-                  // 选择对象
-                  this.mySelect([record.id], [record])
-                },
-                dblclick: (event) => {
-                  this.mySelect([record.id], [record])
-                  this.handleSelect()
-                }
-              }
-            }
           }
+          // customRow: (record) => {
+          //   return {
+          //     on: { // 事件
+          //       click: (event) => { // 点击行
+          //         // 选择对象
+          //         this.mySelect([record.id], [record])
+          //       },
+          //       dblclick: (event) => {
+          //         this.mySelect([record.id], [record])
+          //         this.handleSelect()
+          //       }
+          //     }
+          //   }
+          // }
         }
         this.optionAlertShow = true
       } else {
@@ -354,12 +354,10 @@ export default {
     /**
      * 设置设备类型树
      */
-    base (record, queryParam = {}) {
+    base (keys, rows) {
       this.visible = true
       this.modalTitle = '选择设备'
-      this.queryParam = queryParam
       if (this.isCreated) {
-        console.log(this.$refs.table)
         this.$refs.table.clearSelected()
         this.options.rowSelection.type = this.type
         this.handleOk()
@@ -367,7 +365,6 @@ export default {
         this.tableOption()
         this.isCreated = true
       }
-      // this.mySelect(this.selectedRowKeys, this.selectedRows)
     },
     handleCancel () {
       this.visible = false
@@ -378,7 +375,7 @@ export default {
         this.$message.warn('请至少选择一项信息')
       } else {
         this.confirmLoading = true
-        this.$emit('selected', this.selectedRowKeys, this.selectedRows)
+        this.$emit('selected', this.selectedRows)
         this.confirmLoading = false
         this.visible = false
       }