linwenxin 6 mesi fa
parent
commit
8e82c40e39
1 ha cambiato i file con 57 aggiunte e 159 eliminazioni
  1. 57 159
      src/views/userManagement/qualityGuaranteeFund/index.vue

+ 57 - 159
src/views/userManagement/qualityGuaranteeFund/index.vue

@@ -13,18 +13,12 @@
     key="pageType"
   >
     <div class="cartographer_big">
-      <el-dialog
-        title="设置师傅组别"
-        width="100%"
-        :modal="false"
-        :visible.sync="formDialog"
-        :before-close="handleClose"
-      >
+      <el-dialog title="新增" width="100%" :modal="false" :visible.sync="formDialog" :before-close="handleClose">
         <zj-page-container>
           <zj-page-fill>
             <div style="box-sizing: border-box; padding: 20px 20px 0 20px">
               <zj-form-container ref="formRef" :form-data="formData" :form-attributes="{ size: 'mini' }">
-                <zj-form-module title="师傅组" label-width="100px" :form-data="formData" :form-items="formItems">
+                <zj-form-module title="新增" label-width="100px" :form-data="formData" :form-items="formItems">
                 </zj-form-module>
               </zj-form-container>
             </div>
@@ -44,16 +38,15 @@ import TemplatePage from '@/components/template/template-page-1.vue'
 import import_mixin from '@/components/template/import_mixin.js'
 import operation_mixin from '@/components/template/operation_mixin.js'
 import {
-  workerTeamList,
-  workerTeamListExport,
-  workerTeamAdd,
-  workerTeamUpdate,
-  workerTeamImport,
-  workerTeamQueryWebsitWorker
-} from '@/api/masterGroup.js'
+  workerWarrantyList,
+  workerWarrantyListExport,
+  workerWarrantyImport,
+  workerWarrantyAdd,
+  workerWarrantyRefund,
+  workerWarrantyDetail
+} from '@/api/qualityGuaranteeFund.js'
 import { commonTemplateDownload } from '@/api/common.js'
-import { getWebsit } from '@/api/customerManagement.js'
-import { required, requiredValueMin } from '@/components/template/rules_verify.js'
+import { required } from '@/components/template/rules_verify.js'
 export default {
   components: { TemplatePage },
   mixins: [import_mixin, operation_mixin],
@@ -74,18 +67,7 @@ export default {
       recordSelected: [],
       /** 表单变量 */
       formDialog: false,
-      formData: {
-        assistantWorkerId: '',
-        assistantWorkerName: '',
-        companyWechatId: '',
-        companyWechatName: '',
-        masterWorkerId: '',
-        masterWorkerName: '',
-        status: 'ON',
-        websitId: ''
-      },
-      websitList: [],
-      workerTeamQueryWebsitWorkerList: []
+      formData: {}
     }
   },
   computed: {
@@ -101,19 +83,47 @@ export default {
         ],
         [
           [
-            this.optionsEvensAuth('import', ({ moduleName }) => {
+            this.optionsEvensAuth('listImport', ({ moduleName }) => {
               return {
                 name: moduleName,
                 render: () => {
-                  return this.importButton(workerTeamImport, moduleName)
+                  return this.importButton(workerWarrantyImport, moduleName)
                 }
               }
             })
           ],
           [
-            this.optionsEvensAuth('template', {
+            this.optionsEvensAuth('downloadTemplate1', {
               click: () => {
-                commonTemplateDownload({ name: '师傅组队导入模板.xlsx' }, `${this.$route.meta.title}`)
+                commonTemplateDownload({ name: '质保金新增模板.xlsx' }, `质保金新增模板`)
+                  .then(res => {
+                    this.$message({
+                      message: '下载成功',
+                      type: 'success'
+                    })
+                  })
+                  .catch(err => {
+                    this.$message.error('下载失败')
+                  })
+              }
+            })
+          ]
+        ],
+        [
+          [
+            this.optionsEvensAuth('payFeesImport', ({ moduleName }) => {
+              return {
+                name: moduleName,
+                render: () => {
+                  return this.importButton(workerWarrantyImport, moduleName)
+                }
+              }
+            })
+          ],
+          [
+            this.optionsEvensAuth('downloadTemplate2', {
+              click: () => {
+                commonTemplateDownload({ name: '质保金缴费模板.xlsx' }, `质保金缴费模板`)
                   .then(res => {
                     this.$message({
                       message: '下载成功',
@@ -134,116 +144,14 @@ export default {
       return []
     },
     formItems() {
-      return [
-        {
-          name: 'el-select',
-          md: 12,
-          options: this.websitList.map(item => ({ label: `(${item.websitId})${item.name}`, value: item.websitId })),
-          attributes: {
-            clearable: true,
-            filterable: true,
-            disabled: false,
-            placeholder: '请输入'
-          },
-          formItemAttributes: {
-            label: '所属网点',
-            prop: 'websitId',
-            rules: [...required]
-          },
-          events: {
-            change: val => {
-              this.formData.masterWorkerId = ''
-              this.formData.masterWorkerName = ''
-              this.formData.assistantWorkerId = ''
-              this.formData.assistantWorkerName = ''
-              this.workerTeamQueryWebsitWorkerList = []
-              if (val) {
-                workerTeamQueryWebsitWorker({ websitId: val }).then(res => {
-                  this.workerTeamQueryWebsitWorkerList = res.data
-                })
-              }
-            }
-          }
-        },
-        {
-          name: 'el-select',
-          md: 12,
-          options: this.workerTeamQueryWebsitWorkerList.map(item => ({
-            label: item.workerNumber ? `(${item.workerNumber})${item.workerName}` : item.workerName,
-            value: item.workerId,
-            disabled: item.workerId == this.formData.assistantWorkerId
-          })),
-          // .filter(item => item.workerId != this.formData.assistantWorkerId)
-          attributes: {
-            clearable: true,
-            filterable: true,
-            placeholder: '请输入',
-            disabled: !this.formData.websitId
-          },
-          formItemAttributes: {
-            label: '选择大工',
-            prop: 'masterWorkerId',
-            rules: [...required]
-          },
-          events: {
-            change: val => {
-              this.formData.masterWorkerName = this.workerTeamQueryWebsitWorkerList?.find(
-                item => item.workerId === val
-              )?.workerName
-            }
-          }
-        },
-        {
-          name: 'el-select',
-          md: 12,
-          options: this.workerTeamQueryWebsitWorkerList.map(item => ({
-            label: item.workerNumber ? `(${item.workerNumber})${item.workerName}` : item.workerName,
-            value: item.workerId,
-            disabled: item.workerId == this.formData.masterWorkerId
-          })),
-          //.filter(item => item.workerId != this.formData.masterWorkerId)
-          attributes: {
-            clearable: true,
-            filterable: true,
-            placeholder: '请输入',
-            disabled: !this.formData.masterWorkerId
-          },
-          formItemAttributes: {
-            label: '选择小工',
-            prop: 'assistantWorkerId',
-            rules: [...required]
-          },
-          events: {
-            change: val => {
-              this.formData.assistantWorkerName = this.workerTeamQueryWebsitWorkerList?.find(
-                item => item.workerId === val
-              )?.workerName
-            }
-          }
-        },
-        {
-          md: 12,
-          isShow: true,
-          name: 'el-radio',
-          options: [
-            { label: '有效', value: 'ON' },
-            { label: '无效', value: 'OFF' }
-          ],
-          attributes: {},
-          formItemAttributes: {
-            label: '状态',
-            prop: 'status',
-            rules: [...required]
-          }
-        }
-      ]
+      return []
     }
   },
   methods: {
     // 列表请求函数
-    getList: workerTeamList,
+    getList: workerWarrantyList,
     // 列表导出函数
-    exportList: workerTeamListExport,
+    exportList: workerWarrantyListExport,
     // 表格列解析渲染数据更改
     columnParsing(item, defaultData) {
       return defaultData
@@ -254,22 +162,7 @@ export default {
     },
     // 打开创建弹窗
     openForm() {
-      Promise.all([getWebsit({ type: 'C', status: true })]).then(([res1]) => {
-        this.websitList = res1.data
-        this.formDialog = true
-      })
-    },
-    // 打开详情弹窗
-    openDetailForm(row) {
-      Promise.all([
-        getWebsit({ type: 'C', status: true }),
-        workerTeamQueryWebsitWorker({ websitId: row.websitId })
-      ]).then(([res1, res2]) => {
-        this.websitList = res1.data
-        this.workerTeamQueryWebsitWorkerList = res2.data
-        this.formData = { ...row }
-        this.formDialog = true
-      })
+      this.formDialog = true
     },
     handleClose() {
       this.$refs?.formRef?.resetFields()
@@ -279,10 +172,15 @@ export default {
     // 操作按钮
     operation() {
       return this.operationBtn({
-        edit: {
-          click: ({ row, index, column }) => {
-            this.openDetailForm(row)
-          }
+        details: {
+          click: ({ row, index, column }) => {}
+        },
+        refund: {
+          prompt: '是否确定退款?',
+          conditions: ({ row, index, column }) => {
+            return (row.payableAmount || 0) - (row.refundAmount || 0) > 0
+          },
+          click: ({ row, index, column }) => {}
         }
       })
     },
@@ -290,7 +188,7 @@ export default {
     save() {
       this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
         if (valid) {
-          ;(this.formData?.id ? workerTeamUpdate : workerTeamAdd)(this.formData).then(res => {
+          workerWarrantyAdd(this.formData).then(res => {
             this.$message({
               type: 'success',
               message: '保存成功'