linwenxin il y a 4 mois
Parent
commit
cbc6367447
1 fichiers modifiés avec 86 ajouts et 20 suppressions
  1. 86 20
      src/views/workOrder/appraiseAppeal/appraisalStatement/index.vue

+ 86 - 20
src/views/workOrder/appraiseAppeal/appraisalStatement/index.vue

@@ -33,10 +33,10 @@
           <!-- 操作按钮 -->
           <div style="box-sizing: border-box; padding: 10px; text-align: right">
             <el-button size="mini" @click="handleClose">取 消</el-button>
-            <el-button v-if="~[0, 1, 2].indexOf(formType)" size="mini" @click="formConfirm" type="primary"
+            <el-button v-if="[0, 1, 2].includes(formType)" size="mini" @click="formConfirm" type="primary"
               >确 定</el-button
             >
-            <el-button v-if="~[3, 4].indexOf(formType)" size="mini" @click="quedingshenhe" type="primary"
+            <el-button v-if="[3, 4].includes(formType)" size="mini" @click="quedingshenhe" type="primary"
               >确 定</el-button
             >
           </div>
@@ -62,8 +62,9 @@ import operation_mixin from '@/components/template/operation_mixin.js'
 import { required, requiredValueMin } from '@/components/template/rules_verify.js'
 import { orderBaseDetail } from '@/api/workOrderPool.js'
 import { EventBus } from '@/utils/eventBus'
+import ImageUpload from '@/components/file-upload'
 export default {
-  components: { TemplatePage },
+  components: { TemplatePage, ImageUpload },
   mixins: [import_mixin, operation_mixin],
   data() {
     return {
@@ -106,7 +107,9 @@ export default {
         workerMobile: '',
         workerName: '',
         workerNumber: '',
-        workerResult: ''
+        workerResult: '',
+        recordingFile: [],
+        applicationDocument: []
       },
       formRules: {}
     }
@@ -296,7 +299,7 @@ export default {
           name: 'el-input',
           md: 18,
           attributes: {
-            disabled: !!this?.formData?.id,
+            disabled: ![0, 1, 2].includes(this.formType),
             placeholder: '请输入'
           },
           formItemAttributes: {
@@ -352,7 +355,7 @@ export default {
           name: 'el-input',
           md: 24,
           attributes: {
-            disabled: false,
+            disabled: ![0, 1, 2].includes(this.formType),
             type: 'textarea',
             rows: 3,
             placeholder: '请输入'
@@ -364,10 +367,46 @@ export default {
           }
         },
         {
+          md: 24,
+          name: 'slot-component',
+          formItemAttributes: {
+            label: '录音文件',
+            prop: 'recordingFile',
+            rules: []
+          },
+          render: (h, { props, onInput }) => {
+            return (
+              <ImageUpload
+                fileList={this.formData.recordingFile}
+                limit={1}
+                isEdit={[0, 1, 2].includes(this.formType)}
+              />
+            )
+          }
+        },
+        {
+          md: 24,
+          name: 'slot-component',
+          formItemAttributes: {
+            label: '申请图片',
+            prop: 'applicationDocument',
+            rules: []
+          },
+          render: (h, { props, onInput }) => {
+            return (
+              <ImageUpload
+                fileList={this.formData.applicationDocument}
+                limit={100}
+                isEdit={[0, 1, 2].includes(this.formType)}
+              />
+            )
+          }
+        },
+        {
           name: 'el-input',
           md: 24,
           attributes: {
-            disabled: false,
+            disabled: ![0, 1, 2].includes(this.formType),
             type: 'textarea',
             rows: 3,
             placeholder: '请输入'
@@ -386,7 +425,7 @@ export default {
           name: 'el-input',
           md: 6,
           attributes: {
-            disabled: true,
+            disabled: ![3, 4].includes(this.formType),
             placeholder: '请输入'
           },
           formItemAttributes: {
@@ -399,7 +438,7 @@ export default {
           name: 'el-input',
           md: 6,
           attributes: {
-            disabled: true,
+            disabled: ![3, 4].includes(this.formType),
             placeholder: '请输入'
           },
           formItemAttributes: {
@@ -458,7 +497,7 @@ export default {
         })(),
         {
           md: 24,
-          isShow: true,
+          isShow: ![3, 4].includes(this.formType),
           name: 'el-radio',
           options: [
             { label: '是', value: true },
@@ -473,7 +512,7 @@ export default {
         },
         {
           md: 24,
-          isShow: true,
+          isShow: ![3, 4].includes(this.formType),
           name: 'el-radio',
           options: [
             { label: '无责', value: 'NOT' },
@@ -489,7 +528,7 @@ export default {
         },
         {
           md: 24,
-          isShow: true,
+          isShow: ![3, 4].includes(this.formType),
           name: 'el-radio',
           options: [
             { label: '无责', value: 'NOT' },
@@ -507,7 +546,7 @@ export default {
           name: 'el-input',
           md: 24,
           attributes: {
-            disabled: false,
+            disabled: ![3, 4].includes(this.formType),
             type: 'textarea',
             rows: 3,
             placeholder: '请输入'
@@ -602,10 +641,15 @@ export default {
     formConfirm() {
       this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
         if (valid) {
-          appraiseApplyApplySubmit(this.formData).then(res => {
+          appraiseApplyApplySubmit({
+            ...this.formData,
+            items: [
+              ...this.formData.recordingFile.map(item => ({ ...item, type: 'C' })),
+              ...this.formData.applicationDocument.map(item => ({ ...item, type: 'I' }))
+            ]
+          }).then(res => {
             this.$message({ type: 'success', message: '成功!' })
             if (this.pageType == 'zhidingshenshu') {
-              // EventBus.$emit('closeSelectedTag_wb')
               this.$router.push({
                 name: 'appraisalStatement'
               })
@@ -620,7 +664,13 @@ export default {
     quedingshenhe() {
       this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
         if (valid) {
-          appraiseApplyApplyConfirm(this.formData).then(res => {
+          appraiseApplyApplyConfirm({
+            ...this.formData,
+            items: [
+              ...this.formData.recordingFile.map(item => ({ ...item, type: 'C' })),
+              ...this.formData.applicationDocument.map(item => ({ ...item, type: 'I' }))
+            ]
+          }).then(res => {
             this.$message({ type: 'success', message: '成功!' })
             this.$refs.pageRef.refreshList()
             this.handleClose()
@@ -636,7 +686,11 @@ export default {
             appraiseApplyApplyDetail({
               id: row.id
             }).then(res => {
-              this.formData = { ...res.data }
+              this.formData = {
+                ...res.data,
+                recordingFile: (res.data?.items || []).filter(item => item.type == 'C'),
+                applicationDocument: (res.data?.items || []).filter(item => item.type == 'I')
+              }
               this.$nextTick(() => {
                 this.formType = 5
                 this.formBool = true
@@ -653,7 +707,11 @@ export default {
             appraiseApplyApplyDetail({
               id: row.id
             }).then(res => {
-              this.formData = { ...res.data }
+              this.formData = {
+                ...res.data,
+                recordingFile: (res.data?.items || []).filter(item => item.type == 'C'),
+                applicationDocument: (res.data?.items || []).filter(item => item.type == 'I')
+              }
               this.$nextTick(() => {
                 this.formType = 2
                 this.formBool = true
@@ -670,7 +728,11 @@ export default {
             appraiseApplyApplyDetail({
               id: row.id
             }).then(res => {
-              this.formData = { ...res.data }
+              this.formData = {
+                ...res.data,
+                recordingFile: (res.data?.items || []).filter(item => item.type == 'C'),
+                applicationDocument: (res.data?.items || []).filter(item => item.type == 'I')
+              }
               this.$nextTick(() => {
                 this.formType = 3
                 this.formBool = true
@@ -687,7 +749,11 @@ export default {
             appraiseApplyApplyDetail({
               id: row.id
             }).then(res => {
-              this.formData = { ...res.data }
+              this.formData = {
+                ...res.data,
+                recordingFile: (res.data?.items || []).filter(item => item.type == 'C'),
+                applicationDocument: (res.data?.items || []).filter(item => item.type == 'I')
+              }
               this.$nextTick(() => {
                 this.formType = 4
                 this.formBool = true