Kaynağa Gözat

refactor(repair-application): 优化维修申请表和检查表相关代码格式与逻辑

- BaseForm组件优化执行人方式选择器及部门树加载逻辑
- 删除无用的deptName变量及相关处理函数
- 修正RepairApplicationForm组件中表单元素自闭合格式
- 统一简化多处v-for循环及属性绑定代码格式
- 调整查询参数及表格操作相关方法命名风格
- 修复部分表格列配置及按钮事件绑定格式
- 注释Detail组件中配件清单和维修报告相关代码
- 优化数据加载和刷新逻辑,移除冗余代码
- 调整表格Alert提示及批量删除功能
- 调整了部分组件标签自闭合和属性书写格式,提升代码规范性
408249787@qq.com 12 saat önce
ebeveyn
işleme
53dad6228a

+ 8 - 13
src/views/check/checkstandard/modules/BaseForm.vue

@@ -48,8 +48,8 @@
         </row-item>
         <row-item>
           <a-form-item label="执行人方式" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
-            <a-select @change="handleCheckUserTypeChange" v-decorator="['checkUserType', { rules: [{ required: true, message: '执行人方式不能为空' }] }]"
-              placeholder="请选择">
+            <a-select @change="handleCheckUserTypeChange"
+              v-decorator="['checkUserType', { rules: [{ required: true, message: '执行人方式不能为空' }] }]" placeholder="请选择">
               <a-select-option v-for="(label, value) in checkUserTypeMap" :key="value" :label="label"
                 :value="parseInt(value)">{{ label }}
               </a-select-option>
@@ -59,9 +59,8 @@
         <row-item v-if="currentCheckUserType === 4">
           <a-form-item label="执行班组" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
             <a-tree-select style="width: 100%" :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
-              :treeData="deptTree" :treeNodeFilterProp="'title'" :showSearch="true"
-              v-decorator="['checkDeptId', { rules: [{ required: true, message: '请选择执行班组' }] }]" placeholder="请选择班组"
-              @change="handleDeptChange">
+              :treeData="deptTree" treeNodeFilterProp="title" :showSearch="true"
+              v-decorator="['checkDeptId', { rules: [{ required: true, message: '请选择执行班组' }] }]" placeholder="请选择班组">
             </a-tree-select>
           </a-form-item>
         </row-item>
@@ -302,7 +301,6 @@ export default {
       periodTypeMap: {},
       currentCheckUserType: null,
       deptTree: [],
-      deptName: null,
       checkImgList: [], // 图片
       checkFileList: [], // 文档
       defaultCheckImgList: [],
@@ -475,6 +473,8 @@ export default {
       queryUser({}).then((res) => {
         this.userList = res.data
       })
+      this.loadDeptTree()
+
       queryCheckDetail().then((res) => {
         this.checkDetailList = res.data
         // 字典加载完成后,若已选定标准类型则刷新保养项列表,避免竞态导致保养项为空无法保存
@@ -495,7 +495,6 @@ export default {
         this.data = []
         this.cacheData = []
         this.currentCheckUserType = null
-        this.deptName = null
         if (sbId != null) {
           this.sbId = sbId
           const {
@@ -791,13 +790,9 @@ export default {
     },
     handleCheckUserTypeChange(value) {
       this.currentCheckUserType = value
-      if (value === 4) {
-        this.loadDeptTree()
-      }
-    },
-    handleDeptChange(value, label, extra) {
-      this.deptName = extra ? extra.triggerNode.props.title : null
+
     },
+
     loadDeptTree() {
       if (this.deptTree && this.deptTree.length > 0) return
       getDeptTree({}).then((res) => {

+ 48 - 65
src/views/repair/application-form/RepairApplicationForm.vue

@@ -6,36 +6,33 @@
           <a-row :gutter="48">
             <a-col :md="6" :sm="24">
               <a-form-item label="关键字">
-                <a-input v-model="queryParam.keyword" placeholder="请输入设备名称/设备新号"/>
+                <a-input v-model="queryParam.keyword" placeholder="请输入设备名称/设备新号" />
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="设备旧号">
-                <a-input v-model="queryParam.zbh" placeholder="请输入设备旧号"/>
+                <a-input v-model="queryParam.zbh" placeholder="请输入设备旧号" />
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="报修人">
-                <a-input v-model="queryParam.actualUser" placeholder="请输入报修人"/>
+                <a-input v-model="queryParam.actualUser" placeholder="请输入报修人" />
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="维修人">
-                <a-input v-model="queryParam.repairUserName" placeholder="请输入维修人"/>
+                <a-input v-model="queryParam.repairUserName" placeholder="请输入维修人" />
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="问题描述">
-                <a-input v-model="queryParam.content" placeholder="问题描述模糊查询"/>
+                <a-input v-model="queryParam.content" placeholder="问题描述模糊查询" />
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-item label="状态">
+              <a-form-item label="工单类别">
                 <a-select v-model="queryParam.category" placeholder="请选择">
-                  <a-select-option
-                    v-for="(label,value) in categoryMap"
-                    :key="value"
-                    :label="label"
+                  <a-select-option v-for="(label, value) in categoryMap" :key="value" :label="label"
                     :value="parseInt(value)">{{ label }}
                   </a-select-option>
                 </a-select>
@@ -44,10 +41,7 @@
             <a-col :md="6" :sm="24">
               <a-form-item label="状态">
                 <a-select v-model="queryParam.status" placeholder="请选择">
-                  <a-select-option
-                    v-for="(label,value) in statusMap"
-                    :key="value"
-                    :label="label"
+                  <a-select-option v-for="(label, value) in statusMap" :key="value" :label="label"
                     :value="parseInt(value)">{{ label }}
                   </a-select-option>
                 </a-select>
@@ -55,20 +49,14 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="报修起始日期">
-                <a-date-picker
-                  v-model="queryParam.searchStartTime"
-                  style="width: 100%"
-                  :format="BaseTool.Date.PICKER_NORM_DATETIME_PATTERN"
-                />
+                <a-date-picker v-model="queryParam.searchStartTime" style="width: 100%"
+                  :format="BaseTool.Date.PICKER_NORM_DATETIME_PATTERN" />
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="报修结束日期">
-                <a-date-picker
-                  v-model="queryParam.searchEndTime"
-                  style="width: 100%"
-                  :format="BaseTool.Date.PICKER_NORM_DATETIME_PATTERN"
-                />
+                <a-date-picker v-model="queryParam.searchEndTime" style="width: 100%"
+                  :format="BaseTool.Date.PICKER_NORM_DATETIME_PATTERN" />
               </a-form-item>
             </a-col>
             <a-col :md="8 || 24" :sm="24">
@@ -82,8 +70,10 @@
       </div>
 
       <div class="table-operator">
-        <a-button v-if="$auth('repair-application-forms-add')" type="primary" icon="plus" @click="$refs.baseModal.base({},{filter: -1})">新增</a-button>
-        <a-button style="margin-left: 8px" v-if="$auth('repair-application-forms-export')" type="primary" icon="download" @click="doExport">导出</a-button>
+        <a-button v-if="$auth('repair-application-forms-add')" type="primary" icon="plus"
+          @click="$refs.baseModal.base({}, { filter: -1 })">新增</a-button>
+        <a-button style="margin-left: 8px" v-if="$auth('repair-application-forms-export')" type="primary"
+          icon="download" @click="doExport">导出</a-button>
         <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('repair-application-forms-del')">
           <a-menu slot="overlay">
             <a-popconfirm title="是否要删除所选数据?" @confirm="batchDelete()">
@@ -96,37 +86,30 @@
         </a-dropdown>
       </div>
 
-      <s-table
-        ref="table"
-        size="default"
-        rowKey="id"
-        :columns="columns"
-        :data="loadData"
-        :alert="options.alert"
-        :rowSelection="options.rowSelection"
-        :scroll="{x: 1000, y: BaseTool.Constant.scrollY }"
-        showPagination="auto"
-      >
+      <s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData" :alert="options.alert"
+        :rowSelection="options.rowSelection" :scroll="{ x: 1000, y: BaseTool.Constant.scrollY }" showPagination="auto">
         <span slot="action" slot-scope="record">
           <template>
             <a @click="handleView(record)">查看</a>
             <operation-button
               v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-edit')"
-              @click="handleEdit(record)" >修改</operation-button>
+              @click="handleEdit(record)">修改</operation-button>
           </template>
         </span>
         <span slot="status" slot-scope="text">
-          <badge :text="BaseTool.Object.getField(statusMap,text)" :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_STATUS[text]"/>
+          <badge :text="BaseTool.Object.getField(statusMap, text)"
+            :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_STATUS[text]" />
         </span>
         <span slot="level" slot-scope="text">
-          <badge :text="BaseTool.Object.getField(levelMap,text)" :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_LEVEL[text]"/>
+          <badge :text="BaseTool.Object.getField(levelMap, text)"
+            :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_LEVEL[text]" />
         </span>
       </s-table>
     </div>
-    <base-form ref="baseModal" @ok="handleOk"/>
-    <base-out-form ref="baseOutModal" @ok="handleOk"/>
-    <detail ref="detailModal" @ok="handleOk"/>
-    <detail-out ref="detailOutModal" @ok="handleOk"/>
+    <base-form ref="baseModal" @ok="handleOk" />
+    <base-out-form ref="baseOutModal" @ok="handleOk" />
+    <detail ref="detailModal" @ok="handleOk" />
+    <detail-out ref="detailOutModal" @ok="handleOk" />
     <assign-form ref="assignForm" @ok="handleOk" />
     <dispatch-base-form ref="dispatchBaseForm" @ok="handleOk" />
   </a-card>
@@ -164,7 +147,7 @@ export default {
       default: 1
     }
   },
-  data () {
+  data() {
     return {
       // 查询参数
       queryParam: {
@@ -210,15 +193,15 @@ export default {
           width: '120px',
           dataIndex: 'repairUserName'
         },
-      /*  {
-          title: '报修来源',
-          checked: true,
-          width: '100px',
-          dataIndex: 'source',
-          customRender: (text, record, index) => {
-            return this.BaseTool.Object.getField(this.sourceMap, text)
-          }
-        },*/
+        /*  {
+            title: '报修来源',
+            checked: true,
+            width: '100px',
+            dataIndex: 'source',
+            customRender: (text, record, index) => {
+              return this.BaseTool.Object.getField(this.sourceMap, text)
+            }
+          },*/
         {
           title: '工单类型',
           checked: true,
@@ -335,7 +318,7 @@ export default {
       optionAlertShow: false
     }
   },
-  created () {
+  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)
@@ -350,7 +333,7 @@ export default {
     this.tableOption()
   },
   methods: {
-    tableOption () {
+    tableOption() {
       if (!this.optionAlertShow) {
         this.options = {
           alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
@@ -374,7 +357,7 @@ export default {
         this.optionAlertShow = false
       }
     },
-    batchDelete (id) {
+    batchDelete(id) {
       let ids = []
       if (this.BaseTool.String.isBlank(id)) {
         const length = this.selectedRows.length
@@ -392,14 +375,14 @@ export default {
         this.$refs.table.clearSelected()
       })
     },
-    handleEdit (record) {
+    handleEdit(record) {
       fetchRepairApplicationForm({ id: record.id }).then(res => {
         const type = res.data.type
         const modal = type === 2 ? this.$refs.baseOutModal : this.$refs.baseModal
         modal.base(res.data)
       })
     },
-    handleView (record) {
+    handleView(record) {
       fetchRepairApplicationForm({ id: record.id }).then(res => {
         this.visible = false
         const type = res.data.type
@@ -407,26 +390,26 @@ export default {
         modal.base(res.data)
       })
     },
-    handleAssign (record) {
+    handleAssign(record) {
       const modal = this.$refs.assignForm
       modal.base(record)
     },
-    handleOk () {
+    handleOk() {
       this.visible = true
       this.queryParam.searchStartTime = this.queryParam.searchStartTime ? this.BaseTool.Date.formatter(this.queryParam.searchStartTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN) : null
       this.queryParam.searchEndTime = this.queryParam.searchEndTime ? this.BaseTool.Date.formatter(this.queryParam.searchEndTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN) : null
       this.$refs.table.refresh()
     },
-    onSelectChange (selectedRowKeys, selectedRows) {
+    onSelectChange(selectedRowKeys, selectedRows) {
       this.selectedRowKeys = selectedRowKeys
       this.selectedRows = selectedRows
     },
-    resetSearchForm () {
+    resetSearchForm() {
       this.queryParam = {
       }
       this.$refs.table.refresh(true)
     },
-    doExport () {
+    doExport() {
       const parameter = {
         ...this.queryParam,
         searchStartTime: this.queryParam.searchStartTime,
@@ -436,7 +419,7 @@ export default {
         this.BaseTool.UPLOAD.downLoadExportExcel(file)
       })
     },
-    handleDispatching (record) {
+    handleDispatching(record) {
       const modal = this.$refs.dispatchBaseForm
       modal.base(record)
     }

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

@@ -23,7 +23,7 @@
 
             <detail-list-item term="报修人">{{ model.actualUser }}</detail-list-item>
             <detail-list-item term="报修来源">{{ BaseTool.Object.getField(this.sourceMap, model.source)
-              }}</detail-list-item>
+            }}</detail-list-item>
             <!--            <detail-list-item term="紧急等级"><badge :text="BaseTool.Object.getField(levelMap,model.level)" :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_LEVEL[model.applicationLevel]"/></detail-list-item>-->
             <detail-list-item term="报修时间">{{ model.applyTime }}</detail-list-item>
             <detail-list-item term="报修状态">
@@ -101,9 +101,9 @@
           </div>
         </a-layout-sider>
       </a-layout>
-      <title-divider title="配件清单" width="90px"></title-divider>
+      <!-- <title-divider title="配件清单" width="90px"></title-divider>
       <a-table :data-source="dataSpare" :columns="columnsSpare" tableLayout="auto" rowKey="id">
-      </a-table>
+      </a-table>-->
 
       <title-divider title="委外记录" width="90px"></title-divider>
       <a-table :data-source="dataFee" :columns="columnsFee" tableLayout="auto" rowKey="id">
@@ -114,14 +114,14 @@
         </span>
       </a-table>
 
-      <title-divider title="维修报告" width="90px"></title-divider>
-      <a-table :data-source="dataReason" :columns="columnsReason" tableLayout="fixed" rowKey="id">
-        <span slot="action" slot-scope="record">
-          <template>
+      <!--<title-divider title="维修报告" width="90px"></title-divider>
+<a-table :data-source="dataReason" :columns="columnsReason" tableLayout="fixed" rowKey="id">
+  <span slot="action" slot-scope="record">
+    <template>
             <a @click="handleViewReason(record)">查看</a>
           </template>
-        </span>
-      </a-table>
+  </span>
+</a-table> -->
 
     </a-card>
     <check-form ref="checkForm" @ok="handleOk" />