Browse Source

维修完善

guarantee-lsq 2 years ago
parent
commit
668bcdf674

+ 8 - 0
src/api/customize/fieldTemplateData.js

@@ -71,6 +71,14 @@ export function updateCustomFieldTemplateData(parameter) {
   })
 }
 
+export function updateRepairRecord (parameter) {
+  return axios({
+    url: '/customize/fieldTemplateData/repair/' + parameter.id,
+    method: 'PUT',
+    data: parameter
+  })
+}
+
 /**
  * fetch single func
  * parameter: { }

+ 69 - 30
src/views/repair/application-form/modules/CheckForm.vue

@@ -13,16 +13,35 @@
         <a-input v-decorator="['id']" type="hidden"/>
       </a-form-item>
 
-      <row-list :col="2">
+      <row-list :col="1">
         <row-item>
           <a-form-item
-            label="原因"
+            label="备注"
             :labelCol="BaseTool.Constant.labelCol2"
             :wrapperCol="BaseTool.Constant.wrapperCol2"
           >
             <a-textarea
               :rows="4"
-              v-decorator="['checkContent', {rules: [{required: true, message: '原因不能为空'}]}]"/>
+              v-decorator="['remark', {rules: [{required: true, message: '原因不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="图片"
+            :labelCol="BaseTool.Constant.labelCol2"
+            :wrapperCol="BaseTool.Constant.wrapperCol2"
+          >
+            <a-upload
+              :action="uploadUrl"
+              :multiple="true"
+              list-type="picture"
+              :file-list="defaultVerifyImages"
+              @change="handleRepairFileChange"
+              accept="image/*"
+              :headers="headers"
+            >
+              <a-button> <a-icon type="upload" /> 上传图片 </a-button>
+            </a-upload>
           </a-form-item>
         </row-item>
       </row-list>
@@ -35,8 +54,10 @@
 
 <script>
 import pick from 'lodash.pick'
-import { returnRepair } from '@/api/repair/application-form'
-import { queryUser } from '@/api/upms/user'
+import { examine, returnRepair } from '@/api/repair/application-form'
+import { uploadUrl } from '@/api/upms/file'
+import Vue from 'vue'
+import { ACCESS_TOKEN } from '@/store/mutation-types'
 
 export default {
   name: 'BaseRepairApplicationForm',
@@ -47,13 +68,14 @@ export default {
       form: this.$form.createForm(this),
       visible: false,
       // 下拉框map
-      sourceMap: {},
-      levelMap: {},
-      needStopMap: {},
-      descripitionMap: {},
       statusMap: {},
       model: null,
-      userList: []
+      headers: {
+        Authorization: 'Bearer ' + Vue.ls.get(ACCESS_TOKEN)
+      },
+      uploadUrl: uploadUrl,
+      defaultVerifyImages: [],
+      verifyImages: [] // 图片,
     }
   },
   components: {
@@ -62,23 +84,12 @@ export default {
   },
   created () {
     // 下拉框map
-    this.sourceMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_SOURCE)
-    this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_LEVEL)
-    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS)
-    this.needStopMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
-    this.getUsers()
   },
   methods: {
-    base (record) {
-      console.log('11111')
+    base (record, type) {
       this.visible = true
       this.model = record
-      // 如果是空标识添加
-      if (this.BaseTool.Object.isBlank(record)) {
-        this.modalTitle = '添加'
-        return
-      }
-      this.modalTitle = '驳回'
+      this.model.type = type
       const { form: { setFieldsValue } } = this
       // 日期处理
       record.applyTime = this.BaseTool.Moment(record.applyTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
@@ -87,11 +98,27 @@ export default {
           'id'
         ])))
       })
+      if (type === 1) {
+        this.modalTitle = '报修审核驳回'
+      } else if (type === 2) {
+        this.modalTitle = '提交报修审核'
+      }
     },
-    getUsers () {
-      queryUser({ status: 1 }).then(res => {
-        this.userList = res.data
-      })
+    handleRepairFileChange (info) {
+      this.defaultVerifyImages = info.fileList
+      this.verifyImages = this.setFileList(info, 12)
+    },
+    setFileList (info, type) {
+      const file = info.file
+      const fileList = info.fileList
+      if (file.status === 'done') {
+        return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
+      } else if (file.status === 'removed') {
+        return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
+      } else if (file.status === 'error') {
+        this.$message.error('上传失败')
+        return []
+      }
     },
     save () {
       const { form: { validateFieldsAndScroll } } = this
@@ -101,13 +128,25 @@ export default {
           this.confirmLoading = false
           return
         }
+        values.verifyImages = this.verifyImages
         // 日期处理
-        returnRepair(values)
-          .then(() => {
-            this.handleCancel(values)
+        if (this.model.type === 1) {
+          returnRepair(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+              this.confirmLoading = false
+            })
+        } else if (this.model.type === 2) {
+          examine(values).then(() => {
+            this.$message.info('已提交,请等待审核')
+            setTimeout(() => {
+              this.handleCancel(values)
+            }, 2000)
           }).catch(() => {
             this.confirmLoading = false
           })
+        }
       })
     },
     handleCancel (values) {

+ 89 - 0
src/views/repair/application-form/modules/DetailCheckNew.vue

@@ -0,0 +1,89 @@
+<template>
+  <a-card :bordered='false' v-show='visible' class='card' :title='modalTitle'>
+    <a-row :gutter='48' slot='extra'>
+      <a-col :md='48' :sm='48'>
+              <span class='table-page-search-submitButtons' style='float: right'>
+                <a-button style='margin-left: 8px' type='default' @click='handleCancel()'>返回</a-button>
+              </span>
+      </a-col>
+    </a-row>
+    <detail-list title='' :col='2'>
+      <detail-list-item term='审核人'>{{ model.createdUserName }}</detail-list-item>
+      <detail-list-item term='审核时间'>{{ model.createdTime }}</detail-list-item>
+      <detail-list-item term='审核类别'>{{ model.typeStr }}</detail-list-item>
+      <detail-list-item term='审核状态'>{{ model.statusStr }}</detail-list-item>
+    </detail-list>
+    <detail-list title='' :col='1'>
+      <detail-list-item term='审核意见'>{{ model.dataRemark }}</detail-list-item>
+    </detail-list>
+    <title-divider title="审核图片" width="90px"></title-divider>
+    <detail-list title="" :col="1">
+      <detail-list-item term="" v-if="model.imageList != null && model.imageList.length > 0">
+        <viewer :images="model.imageList" @inited="inited" ref="viewer" :index="1" >
+          <img v-for="item in model.imageList" :src="item.url" :key="item.id" class="image">
+        </viewer>
+      </detail-list-item>
+      <detail-list-item term="" v-if="model.imageList == null || model.imageList.length === 0">
+        暂无
+      </detail-list-item>
+    </detail-list>
+  </a-card>
+</template>
+
+<script>
+import DetailList from '@/components/tools/DetailList'
+
+const DetailListItem = DetailList.Item
+
+export default {
+  name: 'DetailCheckNew',
+  components: {
+    DetailList,
+    DetailListItem
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      // 下拉框map
+      model: {
+        'dataRemark': null,
+        'imageList': null,
+        'createdUserName': null,
+        'createdTime': null,
+        'status': null,
+        'statusStr': null,
+        'type': null,
+        'typeStr': null
+      }
+    }
+  },
+  created () {
+    // 下拉框map
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      this.modalTitle = '审核详情'
+      this.model = record
+      if (record.status === 1) {
+        this.model.statusStr = '审核通过'
+      } else if (record.status === 2) {
+        this.model.statusStr = '审核拒绝'
+      }
+      if (record.type === 1) {
+        this.model.typeStr = '维修审核'
+      } else if (record.type === 2) {
+        this.model.typeStr = '报修审核'
+      }
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+      this.$emit('ok')
+    }
+  }
+}
+</script>

+ 115 - 14
src/views/repair/application-form/modules/DetailRepair.vue

@@ -134,7 +134,19 @@
           </div>
         </div>
         <div class="main gutter-color" v-show="current == 2">
-          <div class="title">审核详情</div>
+          <div class="title">审核记录</div>
+          <a-table
+            :data-source="dataVerifyRecord"
+            :columns="columnsVerifyRecord"
+            tableLayout="auto"
+            rowKey="id">
+            <span slot="action" slot-scope="record">
+              <template>
+                <a @click="handleVerifyRecord(record)">审核详情</a>
+              </template>
+            </span>
+          </a-table>
+<!--          <div class="title">审核详情</div>
           <a-descriptions bordered>
             <a-descriptions-item label="审核开始时间">{{ model.checkStartTime }}</a-descriptions-item>
             <a-descriptions-item label="审核结束时间">{{ model.checkEndTime }}</a-descriptions-item>
@@ -153,7 +165,7 @@
                 </viewer></div>
               <div v-if="model.checkFileList == null || model.checkFileList.length === 0"> 暂无</div>
             </a-descriptions-item>
-          </a-descriptions >
+          </a-descriptions >-->
         </div>
         <div class="main gutter-color" v-show="current == 3">
           <div class="title">维修记录</div>
@@ -165,9 +177,8 @@
             <span slot="action" slot-scope="record">
               <template>
                 <a @click="handleViewRecord(record)">维修详情</a>
-                <!--                 <operation-button
-                                  @click="handleEditRecord(record)" >修改</operation-button>
-                               <operation-button
+                <operation-button @click="handleEditRecord(record)" >编辑</operation-button>
+<!--                               <operation-button
                                   title="确认该条维修记录?"
                                   @confirm="deleteRecord(record.id)" >删除</operation-button>-->
               </template>
@@ -214,10 +225,10 @@
         </div>
         <div class="main gutter-color" v-show="current == 5">
           <div class="title">费用清单</div>
-          <div style="margin:20px;" class="table-operator" v-if="$auth('repair-application-forms-finish')">
+          <div style="margin:20px;margin-left:45%;" class="table-operator" v-if="$auth('repair-application-forms-finish')">
             <a-button type="primary" @click="handleAddFee">
               <a-icon type="plus"/>
-              添加
+              费用单
             </a-button>
           </div>
           <a-table
@@ -239,10 +250,10 @@
         </div>
         <div class="main gutter-color" v-show="current == 6">
           <div class="title">维修报告</div>
-          <div style="margin:20px;" class="table-operator" v-if="$auth('repair-application-forms-finish') && ((dataReason === null) || (dataReason.length===0))">
+          <div style="margin:20px;margin-left:45%;" class="table-operator" v-if="$auth('repair-application-forms-finish') && ((dataReason === null) || (dataReason.length===0))">
             <a-button type="primary" @click="handleAddReason">
               <a-icon type="plus"/>
-              添加
+              维修报告
             </a-button>
           </div>
           <a-table
@@ -337,13 +348,15 @@
     <resolve-detail ref="resolveDetail" @ok="handleResolveOk"/>
     <detail-repair-record ref="detailRepairRecord" @ok="handleRepairRecordOk"/>
     <transfer-form ref="transferForm" @ok="handleOk"/>
+    <detail-check-new ref='detailCheckNew' @ok='handleVerifyRecordOk'/>
+    <repair-record-form ref='repairRecordForm' @ok='handleRepairRecordOk' />
   </div>
 </template>
 
 <script>
 // import { stringify } from 'qs'
 import DetailList from '@/components/tools/DetailList'
-import { fetchRepairApplicationForm, examine, approve, receive } from '@/api/repair/application-form'
+import { fetchRepairApplicationForm, approve, receive } from '@/api/repair/application-form'
 import CheckForm from './CheckForm'
 import BaseOutForm from './BaseOutForm'
 import FinishForm from './FinishForm'
@@ -377,6 +390,8 @@ import ResolveBaseForm from '@/views/repair/repair/modules/BaseForm'
 import ResolveDetail from '@/views/repair/repair/modules/Detail'
 import DetailRepairRecord from './DetailRepairRecord'
 import TransferForm from './TransferForm'
+import DetailCheckNew from './DetailCheckNew'
+import RepairRecordForm from './RepairRecordForm'
 const DetailListItem = DetailList.Item
 
 export default {
@@ -408,7 +423,9 @@ export default {
     ResolveBaseForm,
     ResolveDetail,
     DetailRepairRecord,
-    TransferForm
+    TransferForm,
+    DetailCheckNew,
+    RepairRecordForm
   },
   data () {
     return {
@@ -439,6 +456,7 @@ export default {
       dataReason: [],
       dataRepairResolve: [],
       dataRecord: [],
+      dataVerifyRecord: [],
       // 表头
       columns: [
         {
@@ -553,6 +571,65 @@ export default {
           scopedSlots: { customRender: 'action' }
         }
       ],
+      columnsVerifyRecord: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          width: '70px',
+          customRender: (text, record, index) => {
+            return `${index + 1}`
+          }
+        },
+        {
+          title: '审核人',
+          dataIndex: 'createdUserName',
+          width: '100px'
+        },
+        {
+          title: '审核时间',
+          dataIndex: 'createdTime',
+          width: '150px'
+        },
+        {
+          title: '审核类别',
+          dataIndex: 'type',
+          ellipsis: true,
+          width: '100px',
+          customRender: (text, record, index) => {
+            if (text === 1) {
+              return '维修审核'
+            } else if (text === 2) {
+              return '报修审核'
+            }
+          }
+        },
+        {
+          title: '审核状态',
+          dataIndex: 'status',
+          ellipsis: true,
+          width: '100px',
+          customRender: (text, record, index) => {
+            if (text === 1) {
+              return '审核通过'
+            } else if (text === 2) {
+              return '审核拒绝'
+            }
+          }
+        },
+        {
+          title: '审核意见',
+          dataIndex: 'dataRemark',
+          ellipsis: true,
+          width: '150px'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
       columnsRecord: [
         {
           title: '序号',
@@ -861,6 +938,13 @@ export default {
         modal.base(res.data)
       })
     },
+    handleVerifyRecord (record) {
+      this.visible = false
+      fetchCustomDataForRepairRecord({ id: record.id }).then(res => {
+        const modal = this.$refs.detailCheckNew
+        modal.base(res.data)
+      })
+    },
     batchDeleteReason (id) {
       let ids = []
       if (this.BaseTool.String.isBlank(id)) {
@@ -911,9 +995,16 @@ export default {
         this.handleOk()
       })
     },
+    handleEditRecord (record) {
+      this.visible = false
+      fetchCustomDataForRepairRecord({ id: record.id }).then(res => {
+        const modal = this.$refs.repairRecordForm
+        modal.base(res.data)
+      })
+    },
     handleReturn () {
       const modal = this.$refs.checkForm
-      modal.base(this.model)
+      modal.base(this.model, 1)
     },
     handleOk () {
       this.loading = true
@@ -941,18 +1032,28 @@ export default {
         this.dataRecord = res.data.rows
       })
     },
+    handleVerifyRecordOk () {
+      this.loading = true
+      this.visible = true
+      queryRepairRecord({ objId: this.model.id, remark: 'repair_verify_record' }).then(res => {
+        this.loading = false
+        this.dataVerifyRecord = res.data.rows
+      })
+    },
     handleFinish () {
       const modal = this.$refs.finishForm
       modal.base(this.model)
     },
     handleExamine () {
-      examine({ id: this.model.id }).then(res => {
+      const modal = this.$refs.checkForm
+      modal.base(this.model, 2)
+      /* examine({ id: this.model.id }).then(res => {
         this.loading = false
         this.visible = true
         this.model.status = this.DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ACCEPTANCE
         this.$message.info('已提交,请等待审核')
       })
-      this.init()
+      this.init() */
     },
     handleDispatch () {
       const modal = this.$refs.dispatchForm

+ 209 - 0
src/views/repair/application-form/modules/RepairRecordForm.vue

@@ -0,0 +1,209 @@
+<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="2">
+        <row-item>
+          <a-form-item
+            label="维修人"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              disabled='disabled'
+              v-decorator="['createdUserName']"/>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="维修时间"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-date-picker
+              showTime
+              disabled='disabled'
+              v-decorator="['createdTime']"
+              style="width: 100%"
+              :format="BaseTool.Date.PICKER_NORM_DATETIME_PATTERN"
+            />
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="维修结束时间"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-date-picker
+              showTime
+              disabled='disabled'
+              v-decorator="['updateTime']"
+              style="width: 100%"
+              :format="BaseTool.Date.PICKER_NORM_DATETIME_PATTERN"
+            />
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="维修时长"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              disabled='disabled'
+              v-decorator="['repairHours']"/>
+          </a-form-item>
+        </row-item>
+      </row-list>
+      <row-list :col="1">
+        <row-item>
+          <a-form-item
+            label="维修意见"
+            :labelCol="BaseTool.Constant.labelCol2"
+            :wrapperCol="BaseTool.Constant.wrapperCol2"
+          >
+            <a-textarea v-decorator="['dataRemark']"/>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="维修图片"
+            :labelCol="BaseTool.Constant.labelCol2"
+            :wrapperCol="BaseTool.Constant.wrapperCol2"
+          >
+            <a-upload
+              :action="uploadUrl"
+              :multiple="true"
+              list-type="picture"
+              :file-list="defaultRepairFileList"
+              @change="handleRepairFileChange"
+              accept="image/*"
+              :headers="headers"
+            >
+              <a-button> <a-icon type="upload" /> 上传图片 </a-button>
+            </a-upload>
+          </a-form-item>
+        </row-item>
+      </row-list>
+    </a-form>
+    <spare-part-used-select-modal ref="sparePartUsedSelectModal" />
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import pick from 'lodash.pick'
+import { finish } from '@/api/repair/application-form'
+import { uploadUrl } from '@/api/upms/file'
+import { updateRepairRecord } from '@/api/customize/fieldTemplateData'
+import Vue from 'vue'
+import { ACCESS_TOKEN } from '@/store/mutation-types'
+
+export default {
+  name: 'BaseRepairApplicationForm',
+  data () {
+    return {
+      model: null,
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      visible: false,
+      headers: {
+        Authorization: 'Bearer ' + Vue.ls.get(ACCESS_TOKEN)
+      },
+      uploadUrl: uploadUrl,
+      defaultRepairFileList: [],
+      repairFileList: [], // 维修图片,
+    }
+  },
+  components: {
+  },
+  props: {
+  },
+  created () {
+    // 下拉框map
+  },
+  methods: {
+    base (record) {
+      this.setTree()
+      this.visible = true
+      this.model = record
+      // 如果是空标识添加
+      this.modalTitle = '维修编辑'
+      this.repairFileList = record.imageList
+      this.defaultRepairFileList = this.BaseTool.UPLOAD.transImg(this.repairFileList)
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      record.createdTime = this.BaseTool.Date.formatter(record.createdTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
+      record.updateTime = this.BaseTool.Date.formatter(record.updateTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign(pick(record, [
+          'id',
+          'createdTime',
+          'updateTime',
+          'createdUserName',
+          'repairHours',
+          'dataRemark'
+        ])))
+      })
+    },
+    handleRepairFileChange (info) {
+      this.defaultRepairFileList = info.fileList
+      this.repairFileList = this.setFileList(info, 12)
+    },
+    setFileList (info, type) {
+      const file = info.file
+      const fileList = info.fileList
+      if (file.status === 'done') {
+        return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
+      } else if (file.status === 'removed') {
+        return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
+      } else if (file.status === 'error') {
+        this.$message.error('上传失败')
+        return []
+      }
+    },
+    save () {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        }
+        // 日期处理
+        values.imageList = this.repairFileList
+        values.remark = values.dataRemark
+        values.createdTime = this.BaseTool.Date.formatter(values.createdTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
+        values.updateTime = this.BaseTool.Date.formatter(values.updateTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
+        updateRepairRecord(values).then(() => {
+          this.handleCancel(values)
+        }).catch(() => {
+          this.confirmLoading = false
+        })
+      })
+    },
+    handleCancel (values) {
+      this.visible = false
+      this.confirmLoading = false
+      this.form.resetFields()
+      if (this.BaseTool.Object.isNotBlank(values)) {
+        this.$emit('ok')
+      }
+    }
+  }
+}
+</script>