whj 1 年之前
父節點
當前提交
4eecab5337
共有 2 個文件被更改,包括 138 次插入7 次删除
  1. 17 7
      src/views/idle-assets/IdleAssets.vue
  2. 121 0
      src/views/idle-assets/modules/AuditForm.vue

+ 17 - 7
src/views/idle-assets/IdleAssets.vue

@@ -50,6 +50,10 @@
           <operation-button
             @click="handleEdit(record)"
           >修改</operation-button>
+          <operation-button
+            v-if="record.status===1||record.status===2"
+            @click="handleAudit(record)"
+          >审核</operation-button>
         </span>
         <template #status="text">
           <badge :text="BaseTool.Object.getField(statusMap,text)" :status="DictCache.COLOR.SB_UNUSED_STATUS[text]"/>
@@ -57,6 +61,7 @@
       </s-table>
     </div>
     <BaseForm ref="baseForm" @ok="handleOk"/>
+    <AuditForm ref="auditForm" @ok="handleOk"/>
   </a-card>
 </template>
 
@@ -64,12 +69,14 @@
 import { STable, Ellipsis } from '@/components'
 import { getSbUnusedPage } from '@/api/idle-assets/idle-assets'
 import BaseForm from './modules/BaseForm.vue'
+import AuditForm from './modules/AuditForm.vue'
 export default {
   name: 'IdleAssets',
   components: {
     STable,
     Ellipsis,
-    BaseForm
+    BaseForm,
+    AuditForm
   },
   data () {
     return {
@@ -89,7 +96,7 @@ export default {
           }
         },
         {
-          title: '闲置名称',
+          title: '名称',
           dataIndex: 'name',
           checked: true,
           width: 100
@@ -123,11 +130,11 @@ export default {
       loadData: parameter => {
         parameter = {
           ...parameter,
-          ...this.queryParam
-          // dataScope: {
-          //   sortBy: 'desc',
-          //   sortName: 'created_time'
-          // }
+          ...this.queryParam,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'created_time'
+          }
         }
         return getSbUnusedPage(Object.assign(parameter, this.queryParam))
           .then(res => {
@@ -190,6 +197,9 @@ export default {
     handleEnter () {
       this.$refs.table.refresh(true)
     },
+    handleAudit (record) {
+      this.$refs.auditForm.base(record)
+    },
     handleEdit (record) {
 
     },

+ 121 - 0
src/views/idle-assets/modules/AuditForm.vue

@@ -0,0 +1,121 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="800"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    class="ant-modal2"
+    @cancel="handleCancel"
+  >
+    <a-form :form="form">
+
+      <a-form-item v-show="false" >
+        <a-input v-decorator="['id']" type="hidden"/>
+      </a-form-item>
+
+      <row-list :col="1">
+        <row-item>
+          <a-form-item
+            label="备注"
+            :labelCol="BaseTool.Constant.labelCol2"
+            :wrapperCol="BaseTool.Constant.wrapperCol2"
+          >
+            <a-radio-group v-decorator="['status', {initialValue: status, rules: [{required: true, message: '审核人不能为空'}]}]">
+              <a-radio-button :value="status">
+                通过
+              </a-radio-button>
+              <a-radio-button :value="4">
+                拒绝
+              </a-radio-button>
+            </a-radio-group>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="备注"
+            :labelCol="BaseTool.Constant.labelCol2"
+            :wrapperCol="BaseTool.Constant.wrapperCol2"
+          >
+            <a-textarea
+              :rows="4"
+              v-decorator="['advice']"/>
+          </a-form-item>
+        </row-item>
+      </row-list>
+    </a-form>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import pick from 'lodash.pick'
+import { checkSbUnused } from '@/api/idle-assets/idle-assets'
+
+export default {
+  name: 'BaseRepairApplicationForm',
+  data () {
+    return {
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      visible: false,
+      status: 0,
+      // 下拉框map
+      model: null
+    }
+  },
+  components: {
+  },
+  props: {
+  },
+  created () {
+    // 下拉框map
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      this.model = record
+      this.status = record.status === 1 ? 2 : 3
+      // 如果是空标识添加
+      this.modalTitle = '审核'
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign(pick(record, [
+          'id'
+        ])))
+      })
+    },
+    save () {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        }
+        // 日期处理
+        checkSbUnused(values)
+          .then(() => {
+            this.handleCancel(values)
+          }).catch(() => {
+            this.confirmLoading = false
+          })
+      })
+    },
+    handleCancel (values) {
+      this.visible = false
+      this.confirmLoading = false
+      this.status = 0
+      this.model = null
+      this.form.resetFields()
+      if (this.BaseTool.Object.isNotBlank(values)) {
+        this.$emit('ok')
+      }
+    }
+
+  }
+}
+</script>