Browse Source

添加费用

chenyuehu 4 years ago
parent
commit
8842b87d8f

+ 10 - 0
src/views/repair/application-form/modules/Detail.vue

@@ -116,6 +116,7 @@
       rowKey="id">
       <span slot="action" slot-scope="record">
         <template>
+          <a @click="handleViewFee(record)">查看</a>
           <operation-button
             v-if="$auth('repair-application-forms-finish') && ( DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)"
             @click="handleEditFee(record)" >修改</operation-button>
@@ -140,6 +141,7 @@
     <fee-base-form ref="feeForm" @ok="handleOk" />
     <finish-form ref="finishForm" @ok="handleOk" />
     <dispatch-form ref="dispatchForm" @ok="handleCancel" />
+    <fee-detail ref="feeDetail" @ok="handleOk" />
   </a-card>
 </template>
 
@@ -154,6 +156,7 @@ import SparePickFormSelectTable from '@/views/store/sparepickform/modules/SpareP
 import { selectSparePartUsedListByRepairId } from '@/api/sqarepartmanage/sparepartused'
 import { selectRepairProjectListByRepairId } from '@/api/repair/repairprojectrelation'
 import FeeBaseForm from '@/views/repair/fee/modules/BaseForm'
+import FeeDetail from '@/views/repair/fee/modules/Detail'
 import { deleteRepairFees, fetchRepairFee } from '@/api/repair/fee'
 const DetailListItem = DetailList.Item
 
@@ -164,6 +167,7 @@ export default {
     DetailList,
     DetailListItem,
     FinishForm,
+    FeeDetail,
     FeeBaseForm,
     DispatchForm,
     SparePartUsedSelectTable,
@@ -393,6 +397,12 @@ export default {
         modal.base(res.data, this.model)
       })
     },
+    handleViewFee (record) {
+      fetchRepairFee({ id: record.id }).then(res => {
+        const modal = this.$refs.feeDetail
+        modal.base(res.data)
+      })
+    },
     handleApprove () {
       approve(this.model).then(() => {
         this.$message.info('操作成功')

+ 10 - 0
src/views/repair/application-form/modules/DetailRepair.vue

@@ -136,6 +136,7 @@
       rowKey="id">
       <span slot="action" slot-scope="record">
         <template>
+          <a @click="handleViewFee(record)">查看</a>
           <operation-button
             v-if="$auth('repair-application-forms-finish') && ( DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)"
             @click="handleEditFee(record)" >修改</operation-button>
@@ -166,6 +167,7 @@
     <base-form-for-repair ref="baseFormForRepair" @ok="handleOk" />
     <spare-store-select-modal ref="spareStoreSelectModal" @selected="handleSpareStoreSelected"/>
     <fee-base-form ref="feeForm" @ok="handleOk" />
+    <fee-detail ref="feeDetail" @ok="handleOk" />
   </a-card>
 </template>
 
@@ -187,6 +189,7 @@ import { selectSparePartUsedListByRepairId, addSparePartUsedBatch, deleteSparePa
 import SpareStoreSelectModal from '@/views/store/sparestore/modules/SpareStoreSelectModal'
 import BaseTool from '@/utils/tool'
 import FeeBaseForm from '@/views/repair/fee/modules/BaseForm'
+import FeeDetail from '@/views/repair/fee/modules/Detail'
 import { deleteRepairFees, fetchRepairFee, queryRepairFee } from '@/api/repair/fee'
 
 const DetailListItem = DetailList.Item
@@ -199,6 +202,7 @@ export default {
     DetailListItem,
     FinishForm,
     DispatchForm,
+    FeeDetail,
     AssignForm,
     FeeBaseForm,
     SparePickBaseForm,
@@ -458,6 +462,12 @@ export default {
         modal.base(data, this.model)
       })
     },
+    handleViewFee (record) {
+      fetchRepairFee({ id: record.id }).then(res => {
+        const modal = this.$refs.feeDetail
+        modal.base(res.data)
+      })
+    },
     handleApprove () {
       approve(this.model).then(() => {
         this.$message.info('操作成功')

+ 74 - 0
src/views/repair/fee/modules/BaseForm.vue

@@ -81,6 +81,38 @@
         <a-textarea
           v-decorator="['remark']" />
       </a-form-item>
+      <a-form-item
+        label="图片"
+        :labelCol="BaseTool.Constant.labelCol"
+        :wrapperCol="BaseTool.Constant.wrapperCol"
+      >
+        <a-upload
+          :action="uploadUrl"
+          :multiple="true"
+          list-type="picture"
+          :file-list="defaultImageList"
+          @change="handleImageFileChange"
+          accept="image/*"
+          :headers="headers"
+        >
+          <a-button> <a-icon type="upload" /> 上传图片 </a-button>
+        </a-upload>
+      </a-form-item>
+      <a-form-item
+        label="附件"
+        :labelCol="BaseTool.Constant.labelCol"
+        :wrapperCol="BaseTool.Constant.wrapperCol"
+      >
+        <a-upload
+          :action="uploadUrl"
+          :multiple="true"
+          :file-list="defaultFileList"
+          @change="handleFileChange"
+          :headers="headers"
+        >
+          <a-button> <a-icon type="upload" /> 上传文件 </a-button>
+        </a-upload>
+      </a-form-item>
     </a-form>
     <template slot="footer">
       <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
@@ -91,6 +123,9 @@
 <script>
 import pick from 'lodash.pick'
 import { addRepairFee, updateRepairFee } from '@/api/repair/fee'
+import { uploadUrl } from '@/api/upms/file'
+import Vue from 'vue'
+import { ACCESS_TOKEN } from '@/store/mutation-types'
 
 export default {
   name: 'BaseRepairFee',
@@ -98,6 +133,14 @@ export default {
     return {
       confirmLoading: false,
       modalTitle: null,
+      defaultImageList: [],
+      imageList: [],
+      defaultFileList: [],
+      fileList: [],
+      uploadUrl: uploadUrl,
+      headers: {
+        Authorization: 'Bearer ' + Vue.ls.get(ACCESS_TOKEN)
+      },
       form: this.$form.createForm(this),
       visible: false,
       // 下拉框map
@@ -122,9 +165,17 @@ export default {
             'repairNo': repairForm.no
           })
         })
+        this.imageList = []
+        this.fileList = []
+        this.defaultImageList = []
+        this.defaultFileList = []
         this.modalTitle = '添加'
         return
       }
+      this.imageList = record.imageList
+      this.fileList = record.fileList
+      this.defaultImageList = this.BaseTool.UPLOAD.transImg(this.imageList)
+      this.defaultFileList = this.BaseTool.UPLOAD.transImg(this.fileList)
       this.modalTitle = '编辑'
       // 日期处理
       this.$nextTick(() => {
@@ -148,6 +199,9 @@ export default {
           this.confirmLoading = false
           return
         }
+        // 上传文件
+        values.imageList = this.imageList
+        values.fileList = this.fileList
         // 日期处理
         if (this.BaseTool.String.isBlank(values.id)) {
           addRepairFee(values)
@@ -166,6 +220,26 @@ export default {
         }
       })
     },
+    handleImageFileChange (info) {
+      this.defaultImageList = info.fileList
+      this.imageList = this.setFileList(info, 18)
+    },
+    handleFileChange (info) {
+      this.defaultFileList = info.fileList
+      this.fileList = this.setFileList(info, 18)
+    },
+    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 []
+      }
+    },
     handleCancel (values) {
       this.visible = false
       this.confirmLoading = false

+ 12 - 0
src/views/repair/fee/modules/Detail.vue

@@ -17,6 +17,18 @@
       <detail-list-item term="创建人">{{ model.createdUserName }}</detail-list-item>
       <detail-list-item term="更新人">{{ model.updateUserName }}</detail-list-item>
     </detail-list>
+    <detail-list title="图片:" :col="6">
+      <upload-image-detail :images-list="model.imageList"/>
+    </detail-list>
+    <detail-list title="" :col="8">
+      <detail-list-item term="文件">
+        <a-upload
+          :multiple="true"
+          :fileList="BaseTool.UPLOAD.transImg(model.fileList)"
+        >
+        </a-upload>
+      </detail-list-item>
+    </detail-list>
 
     <template slot="footer">
       <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">返回</a-button>