linwenxin 4 kuukautta sitten
vanhempi
commit
5a96559497

+ 8 - 0
src/api/fddContractTemplate.js

@@ -63,3 +63,11 @@ export function contractTemplateStatus(params) {
     params: params
   })
 }
+
+export function contractTemplateGetField(params) {
+  return request({
+    url: '/contract/template/get/field',
+    method: 'post',
+    params: params
+  })
+}

+ 273 - 8
src/views/setting/networkSigning/contractManagement/fddContractTemplate/index.vue

@@ -26,6 +26,7 @@
                 :form-data="formData"
                 :form-items="items2"
               />
+              <zj-form-module title="签约信息" label-width="120px" :form-data="formData" :form-items="items3" />
             </zj-form-container>
           </zj-page-fill>
           <!-- 操作按钮 -->
@@ -53,7 +54,8 @@ import {
   contractTemplateDetail,
   contractTemplateQueryRelaWebsit,
   contractTemplateDel,
-  contractTemplateStatus
+  contractTemplateStatus,
+  contractTemplateGetField
 } from '@/api/fddContractTemplate'
 import { commonTemplateDownload } from '@/api/common.js'
 import operation_mixin from '@/components/template/operation_mixin.js'
@@ -61,9 +63,10 @@ import { required, requiredValueMin } from '@/components/template/rules_verify.j
 import { getWebsit } from '@/api/customerManagement.js'
 import { EventBus } from '@/utils/eventBus'
 import ImageUpload from '@/components/file-upload'
+import editTable from '@/components/template/editTable.js'
 export default {
   components: { TemplatePage },
-  mixins: [import_mixin, operation_mixin],
+  mixins: [import_mixin, operation_mixin, editTable],
   data() {
     return {
       // 表格属性
@@ -95,7 +98,11 @@ export default {
         status: '',
         updateBy: '',
         updateTime: '',
-        validDate: ''
+        validDate: '',
+        partyASignFiled: '',
+        companySignFiled: '',
+        managerSignField: '',
+        fieldItems: []
       },
       formRules: {},
       contractTemplateMAIN: [],
@@ -103,7 +110,8 @@ export default {
         websitId: '',
         websitName: ''
       },
-      itemsList: []
+      itemsList: [],
+      contractTemplateGetFieldList: []
     }
   },
   computed: {
@@ -123,7 +131,6 @@ export default {
         ]
       ]
     },
-
     items() {
       return [
         {
@@ -377,6 +384,254 @@ export default {
           }
         }
       ]
+    },
+    items3() {
+      return [
+        {
+          name: 'el-input',
+          md: 8,
+          attributes: {
+            placeholder: '请输入'
+          },
+          formItemAttributes: {
+            label: '甲方公章',
+            prop: 'partyASignFiled',
+            rules: [...required]
+          }
+        },
+        {
+          name: 'el-input',
+          md: 8,
+          attributes: {
+            placeholder: '请输入'
+          },
+          formItemAttributes: {
+            label: '乙方公章',
+            prop: 'companySignFiled',
+            rules: [...required]
+          }
+        },
+        {
+          name: 'el-input',
+          md: 8,
+          attributes: {
+            placeholder: '请输入'
+          },
+          formItemAttributes: {
+            label: '乙方负责人签章',
+            prop: 'managerSignField',
+            rules: [...required]
+          }
+        },
+        {
+          name: 'slot-component',
+          md: 24,
+          formItemAttributes: {
+            label: '文本域明细',
+            prop: 'fieldItems',
+            rules: [...required]
+          },
+          render: (h, { props, onInput }) => {
+            var { value } = props
+            return this.convertTableJson(
+              value,
+              [
+                {
+                  columnAttributes: {
+                    label: '文本域字段名称',
+                    prop: 'fieldName'
+                  },
+                  editRender: (h, { row, column, index }) => {
+                    return (
+                      <div class="redbordererr">
+                        <el-form-item
+                          label=""
+                          label-width="0px"
+                          prop={`fieldItems.${index}.${column.columnAttributes.prop}`}
+                          rules={[{ required: true, message: '请填写', trigger: 'blur' }]}
+                        >
+                          <el-input
+                            value={row[column.columnAttributes.prop]}
+                            onInput={val => {
+                              row[column.columnAttributes.prop] = val
+                            }}
+                            placeholder="请输入内容"
+                          ></el-input>
+                        </el-form-item>
+                      </div>
+                    )
+                  },
+                  viewRender: (h, { row, column, index }) => {
+                    return (
+                      <div class="redbordererr">
+                        <el-form-item
+                          label=""
+                          label-width="0px"
+                          prop={`fieldItems.${index}.${column.columnAttributes.prop}`}
+                          rules={[{ required: true, message: '请填写', trigger: 'blur' }]}
+                        >
+                          <el-input
+                            disabled={true}
+                            value={row[column.columnAttributes.prop]}
+                            onInput={val => {
+                              row[column.columnAttributes.prop] = val
+                            }}
+                            placeholder="请输入内容"
+                          ></el-input>
+                        </el-form-item>
+                      </div>
+                    )
+                  }
+                },
+                {
+                  columnAttributes: {
+                    label: '文本域字段类型',
+                    prop: 'fieldType'
+                  },
+                  editRender: (h, { row, column, index }) => {
+                    return (
+                      <div class="redbordererr">
+                        <el-form-item
+                          label=""
+                          label-width="0px"
+                          prop={`fieldItems.${index}.${column.columnAttributes.prop}`}
+                          rules={[{ required: true, message: '请填写', trigger: 'blur' }]}
+                        >
+                          <el-select
+                            filterable={true}
+                            value={row[column.columnAttributes.prop]}
+                            onInput={val => {
+                              if (val != 'CUSTOM') {
+                                row['fieldValue'] = ''
+                              }
+                              row[column.columnAttributes.prop] = val
+                            }}
+                            placeholder="请输入内容"
+                          >
+                            {this.contractTemplateGetFieldList.map((item, index_) => (
+                              <el-option key={index_} label={item.label} value={item.value}></el-option>
+                            ))}
+                          </el-select>
+                        </el-form-item>
+                      </div>
+                    )
+                  },
+                  viewRender: (h, { row, column, index }) => {
+                    return (
+                      <div class="redbordererr">
+                        <el-form-item
+                          label=""
+                          label-width="0px"
+                          prop={`fieldItems.${index}.${column.columnAttributes.prop}`}
+                          rules={[{ required: true, message: '请填写', trigger: 'blur' }]}
+                        >
+                          <el-select
+                            disabled={true}
+                            filterable={true}
+                            value={row[column.columnAttributes.prop]}
+                            onInput={val => {
+                              row[column.columnAttributes.prop] = val
+                            }}
+                            placeholder="请输入内容"
+                          >
+                            {this.contractTemplateGetFieldList.map((item, index_) => (
+                              <el-option key={index_} label={item.label} value={item.value}></el-option>
+                            ))}
+                          </el-select>
+                        </el-form-item>
+                      </div>
+                    )
+                  }
+                },
+                {
+                  columnAttributes: {
+                    label: '文本域字段值',
+                    prop: 'fieldValue'
+                  },
+                  editRender: (h, { row, column, index }) => {
+                    return (
+                      <div class="redbordererr">
+                        <el-form-item
+                          label=""
+                          label-width="0px"
+                          rules={[{ required: true, message: '请填写', trigger: 'blur' }]}
+                        >
+                          <el-input
+                            disabled={row.fieldType != 'CUSTOM'}
+                            value={row[column.columnAttributes.prop]}
+                            onInput={val => {
+                              row[column.columnAttributes.prop] = val
+                            }}
+                            placeholder="请输入内容"
+                          ></el-input>
+                        </el-form-item>
+                      </div>
+                    )
+                  },
+                  viewRender: (h, { row, column, index }) => {
+                    return (
+                      <div class="redbordererr">
+                        <el-form-item
+                          label=""
+                          label-width="0px"
+                          rules={[{ required: true, message: '请填写', trigger: 'blur' }]}
+                        >
+                          <el-input
+                            disabled={true}
+                            value={row[column.columnAttributes.prop]}
+                            onInput={val => {
+                              row[column.columnAttributes.prop] = val
+                            }}
+                            placeholder="请输入内容"
+                          ></el-input>
+                        </el-form-item>
+                      </div>
+                    )
+                  }
+                }
+              ],
+              {
+                isEdit: true,
+                isAdd: true,
+                isDel: true
+              },
+              {
+                add: () => {
+                  this.formData.fieldItems.push({
+                    contractTemplateId: '',
+                    fieldName: '',
+                    fieldType: '',
+                    fieldValue: ''
+                  })
+                  this.isEditTableIndex = this.formData.fieldItems.length - 1
+                },
+                delete: ({ row, column, index }, cb) => {
+                  if (this.isEditTableIndex == index) {
+                    this.isEditTableIndex = -1
+                  } else if (this.isEditTableIndex > index) {
+                    this.isEditTableIndex--
+                  }
+                  cb && cb()
+                },
+                verify: ({ row, column, index }, isEditTableIndex) => {
+                  return new Promise(r => {
+                    this.$refs.formRef.validateField(
+                      [`fieldItems.${isEditTableIndex}.fieldName`, `fieldItems.${isEditTableIndex}.fieldType`],
+                      v => {
+                        if (v) {
+                          r(true)
+                        } else {
+                          r(false)
+                        }
+                      }
+                    )
+                  })
+                }
+              }
+            )
+          }
+        }
+      ]
     }
   },
   methods: {
@@ -425,7 +680,15 @@ export default {
                 this.formData = {
                   ...res.data,
                   items: (res.data?.items || [])?.map(item => ({ ...item })),
-                  contractTemplatePdf: res.data?.contractTemplatePdf ? [{ url: res.data?.contractTemplatePdf }] : []
+                  contractTemplatePdf: res.data?.contractTemplatePdf ? [{ url: res.data?.contractTemplatePdf }] : [],
+                  ...(() => {
+                    if (!res.data.fieldItems) {
+                      return {
+                        fieldItems: []
+                      }
+                    }
+                    return {}
+                  })()
                 }
                 this.itemsList = (this.formData?.items || [])?.map(item => ({ ...item }))
                 this.$nextTick(() => {
@@ -497,9 +760,11 @@ export default {
             { param: 'a.contract_type', compare: '=', value: 'MAIN' },
             { param: 'a.status', compare: '=', value: 'ON' }
           ]
-        })
-      ]).then(([res1]) => {
+        }),
+        contractTemplateGetField()
+      ]).then(([res1, res2]) => {
         this.contractTemplateMAIN = res1.data.records
+        this.contractTemplateGetFieldList = Object.keys(res2.data).map(key => ({ label: res2.data[key], value: key }))
         this.$nextTick(() => {
           cb?.()
         })