Эх сурвалжийг харах

维修管理 报工 转派

huang_an 1 жил өмнө
parent
commit
1f511ad877

+ 9 - 0
src/api/equipment/work.js

@@ -38,3 +38,12 @@ export async function deviceWorkList(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 非完成报工
+export async function loseReport(data) {
+  const res = await request.post('/eam/workordermaintenance/loseReport', data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 5 - 5
src/views/maintenance/components/MaterialAdd.vue

@@ -47,7 +47,7 @@
               <span>{{ row.category.specification }}</span>
             </template>
             <template v-slot:pathName="{ row }">
-              <span>{{ row.position[0]&&row.position[0].pathName }}</span>
+              <span>{{ row.position[0] && row.position[0].pathName }}</span>
             </template>
           </ele-pro-table>
         </template>
@@ -80,7 +80,7 @@
           label: 'name'
         },
         type: null,
-        disposalType:'',
+        disposalType: '',
         // 表格列配置
         columns: [
           {
@@ -160,14 +160,14 @@
           size: limit,
           categoryLevelId: this.categoryLevelId,
           rootCategoryLevelId: this.rootId,
-          disposalType:this.disposalType
+          disposalType: this.disposalType
         });
         console.log('res---------', res);
         this.categoryId = res.list[0]?.categoryId;
         return res;
       },
-      open(ruleIdList, ruleIdListIndex, isAlone, data,disposalType) {
-        this.disposalType=disposalType
+      open(ruleIdList, ruleIdListIndex, isAlone, data, disposalType) {
+        this.disposalType = disposalType;
         console.log(ruleIdList);
         console.log(ruleIdListIndex);
         let list = [];

+ 24 - 123
src/views/maintenance/components/redeployOther.vue

@@ -1,28 +1,15 @@
 <template>
-  <el-dialog
-    :visible.sync="visible"
-    title="转派工单"
-    width="60%"
-    :modal="false"
-  >
+  <el-dialog :visible.sync="visible" title="转派工单" width="60%">
     <div class="sparepart-apply">
-      <el-tabs
-        v-model="tabValue"
-        class="demo-monitor-tabs"
-        @tab-click="handleClickTab"
-      >
-        <el-tab-pane label="执行人" name="1" />
-        <el-tab-pane label="辅助人" name="2" />
-      </el-tabs>
       <div class="select-box">
         <el-form label-width="80px">
-          <el-row :gutter="24">
-            <el-col :span="12">
+          <el-row :gutter="40">
+            <el-col :span="10">
               <el-form-item label="工单单号">
                 <el-input v-model="row.code" disabled></el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="12">
+            <el-col :span="10">
               <el-form-item label="部门">
                 <deptSelect v-model="groupId" @changeGroup="deptClick" />
                 <!-- <selectTree
@@ -39,12 +26,12 @@
                       /> -->
               </el-form-item>
             </el-col>
-            <el-col :span="12">
+            <el-col :span="10">
               <el-form-item label="" label-width="10px">
                 <el-input v-model="name" placeholder="搜索姓名"></el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="12" style="text-align: right">
+            <el-col :span="6">
               <el-form-item label="" label-width="10px">
                 <el-button @click="search" type="primary" icon="el-icon-search"
                   >搜索</el-button
@@ -61,15 +48,12 @@
       <div class="data-tab">
         <ele-pro-table
           ref="tableRef"
-          row-key="id"
           :columns="columns"
           highlight-current-row
           :datasource="datasource"
-          @selection-change="handleSelectionChange"
+          @current-change="handleChange"
           cache-key="redeployOther"
-          @done="handDone"
-        >
-        </ele-pro-table>
+        ></ele-pro-table>
       </div>
       <div slot="footer" class="footer">
         <el-button @click="cancel">返回</el-button>
@@ -83,10 +67,7 @@
 
 <script>
   import deptSelect from '@/components/CommomSelect/dept-select.vue';
-  import {
-    workOrderRotate,
-    addAssists
-  } from '@/api/maintenance/patrol_maintenance';
+  import { workOrderRotate } from '@/api/maintenance/patrol_maintenance';
   import { getUserPage } from '@/api/system/organization';
   export default {
     components: { deptSelect },
@@ -107,18 +88,11 @@
         },
         total: 0,
         selectedRow: {},
-        selectedRowData: [],
         groupId: '',
         executorDeptName: '',
         name: '',
         row: {},
         columns: [
-          {
-            width: 45,
-            type: 'selection',
-            columnKey: 'selection',
-            align: 'center'
-          },
           {
             columnKey: 'index',
             label: '序号',
@@ -152,60 +126,20 @@
             align: 'center',
             showOverflowTooltip: true
           }
-        ],
-        tabValue: '1',
-        selectedRowDataId: '',
-        tableData: [],
-        arry: []
+        ]
       };
     },
-    created() {
-      this.getList();
-    },
-
+    async created() {},
     methods: {
-      async getList() {
-        const data = await getUserPage({
-          pageNum: 1,
-          size: -1,
-          groupId: '',
-          name: '',
-          groupId: this.groupId
-        });
-        this.tableData = data.list;
-      },
-      handleClickTab(tab, event) {
-        this.selectedRow = {};
-        this.selectedRowData = [];
-        this.tabValue = tab.name;
-        this.$refs.tableRef.clearSelection();
-      },
       open(row) {
         this.row = row;
         this.name = '';
         this.groupId = '';
         this.executorDeptName = '';
-        this.tabValue = '2';
-        this.arry = row.assists.split(',');
+        this.selectedRow = {};
         this.visible = true;
       },
 
-      handDone() {
-        this.$nextTick(() => {
-          this.arry.forEach((item) => {
-            this.tableData.find((item2) => {
-              let arr = {
-                id: item2.id,
-                name: item2.name
-              };
-              if (item == item2.id) {
-                this.$refs.tableRef.toggleRowSelection(arr, true);
-              }
-            });
-          });
-        });
-      },
-
       //重置
       reset() {
         this.name = '';
@@ -235,65 +169,32 @@
         });
       },
 
-      handleSelectionChange(row) {
-        if (this.tabValue == '1') {
-          if (row.length > 1) {
-            this.$refs.tableRef.clearSelection();
-            this.$refs.tableRef.toggleRowSelection(row.pop());
-          }
-          this.selectedRow = row[0];
-        } else {
-          this.selectedRowData = row;
-          let arr = row.map((item) => {
-            return item.id;
-          });
-          this.selectedRowDataId = arr.toString();
+      // 表格选中行
+      handleChange(row) {
+        console.log(row);
+        if (row) {
+          this.selectedRow = row;
         }
       },
 
-      changeSelectAll(arr) {
-        console.log(arr, 'sssss');
-        if (arr.length != 0) {
-          this.checkRadioData = arr;
-        } else {
-          this.checkRadioData = [];
-        }
-      },
       async submit() {
-        if (this.tabValue == '1') {
-          if (this.selectedRow.id) {
-            this.btnLoading = true;
-            let params = {
-              acceptUserId: this.selectedRow.id,
-              workOrderId: this.row.id
-            };
-            workOrderRotate(params).then(() => {
-              this.$message.success(`该工单成功转派给${this.selectedRow.name}`);
-              this.visible = false;
-              this.$emit('refresh');
-              this.btnLoading = false;
-            });
-          } else {
-            return this.$message.warning('请选择转派人员');
-          }
-        } else {
+        if (this.selectedRow.id) {
           this.btnLoading = true;
           let params = {
-            acceptUserId: this.selectedRowDataId,
+            acceptUserId: this.selectedRow.id,
             workOrderId: this.row.id
           };
-          addAssists(params).then(() => {
+          workOrderRotate(params).then(() => {
+            this.$message.success(`该工单成功转派给${this.selectedRow.name}`);
             this.visible = false;
             this.$emit('refresh');
             this.btnLoading = false;
           });
+        } else {
+          return this.$message.warning('请选择转派人员');
         }
       },
       cancel() {
-        this.tabValue = '1';
-        this.selectedRow = {};
-        this.selectedRowData = [];
-        datasourcope;
         this.visible = false;
       }
     }
@@ -304,7 +205,7 @@
   .sparepart-apply {
     min-height: 40vh;
     .select-box {
-      padding: 10px 0;
+      margin-bottom: 10px;
     }
 
     .material-item + .material-item {

+ 366 - 0
src/views/maintenance/components/redeployOther2.vue

@@ -0,0 +1,366 @@
+<template>
+  <el-dialog
+    :visible.sync="visible"
+    title="转派工单"
+    width="60%"
+    :modal="false"
+  >
+    <div class="sparepart-apply">
+      <el-tabs
+        v-model="tabValue"
+        class="demo-monitor-tabs"
+        @tab-click="handleClickTab"
+      >
+        <el-tab-pane label="执行人" name="1" />
+        <!-- 非完成报工不显示辅助人 -->
+        <el-tab-pane
+          v-if="entranceValue == 'transfer'"
+          label="辅助人"
+          name="2"
+        />
+      </el-tabs>
+      <div class="select-box">
+        <el-form label-width="80px">
+          <el-row :gutter="24">
+            <el-col :span="12">
+              <el-form-item label="工单单号">
+                <el-input v-model="row.code" disabled></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="部门">
+                <deptSelect v-model="groupId" @changeGroup="deptClick" />
+                <!-- <selectTree
+                        ref="treeDept"
+                        class="form-input"
+                        :options="treeList"
+                        size="small"
+                        :props="{
+                          value: 'code',
+                          label: 'name',
+                          children: 'children',
+                        }"
+                        @getValue="deptClick"
+                      /> -->
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="" label-width="10px">
+                <el-input v-model="name" placeholder="搜索姓名"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12" style="text-align: right">
+              <el-form-item label="" label-width="10px">
+                <el-button @click="search" type="primary" icon="el-icon-search"
+                  >搜索</el-button
+                >
+                <el-button @click="reset" icon="el-icon-refresh-left"
+                  >重置</el-button
+                >
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+      </div>
+
+      <div class="data-tab">
+        <ele-pro-table
+          ref="tableRef"
+          row-key="id"
+          :columns="columns"
+          :datasource="datasource"
+          @select-all="handleSelectAll"
+          @selection-change="handleSelectionChange"
+          cache-key="redeployOther"
+          @done="handleDone"
+          :header-cell-class-name="headerCellClassName"
+        >
+        </ele-pro-table>
+      </div>
+      <div slot="footer" class="footer">
+        <el-button @click="cancel">返回</el-button>
+        <el-button
+          v-if="entranceValue == 'transfer'"
+          :loading="btnLoading"
+          type="primary"
+          @click="submit"
+          >提交</el-button
+        >
+        <el-button
+          v-if="entranceValue == 'noFinishSubmit'"
+          :loading="btnLoading"
+          type="primary"
+          @click="confirm"
+          >确认</el-button
+        >
+      </div>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import deptSelect from '@/components/CommomSelect/dept-select.vue';
+  import {
+    workOrderRotate,
+    addAssists
+  } from '@/api/maintenance/patrol_maintenance';
+  import { getUserPage } from '@/api/system/organization';
+  export default {
+    components: { deptSelect },
+    props: {
+      // sourceType: {
+      //   type: Number, //1,保养工单;2,维修工单
+      //   required: true
+      // }
+    },
+    data() {
+      return {
+        btnLoading: false,
+        visible: false,
+        treeList: [],
+        pages: {
+          pageNum: 1,
+          size: 15
+        },
+        total: 0,
+        selectedRow: {},
+        selectedRowData: [],
+        groupId: '',
+        executorDeptName: '',
+        name: '',
+        row: {},
+        columns: [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center'
+            // selectable: (row, index) => {
+            //  return row.id !== this.row.executeUserId;
+            // }
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'jobNumber',
+            label: '工号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '姓名',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'phone',
+            label: '电话',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'groupName',
+            label: '部门',
+            align: 'center',
+            showOverflowTooltip: true
+          }
+        ],
+        tabValue: '',
+        selectedRowDataId: '',
+        tableData: [],
+        arry: [],
+        entranceValue: ''
+      };
+    },
+    created() {
+      this.getList();
+    },
+
+    methods: {
+      async getList() {
+        const data = await getUserPage({
+          pageNum: 1,
+          size: -1,
+          groupId: '',
+          name: '',
+          groupId: this.groupId
+        });
+        this.tableData = data.list;
+      },
+      handleClickTab(tab, event) {
+        this.selectedRow = {};
+        this.selectedRowData = [];
+        this.tabValue = tab.name;
+        this.$refs.tableRef.clearSelection();
+      },
+      open(row, val) {
+        this.entranceValue = val;
+        if (val == 'noFinishSubmit') {
+          this.tabValue = '1';
+        }
+        if (val == 'transfer') {
+          this.tabValue = '2';
+          if (row.assists) {
+            this.arry = row.assists.split(',');
+          }
+        }
+        this.row = row;
+        this.name = '';
+        this.groupId = '';
+        this.executorDeptName = '';
+        this.visible = true;
+      },
+      handleDone() {
+        console.log('handDone');
+        // this.$nextTick(() => {
+        //   this.arry.forEach((item) => {
+        //     this.tableData.find((item2) => {
+        //       if (item == item2.id) {
+        //         console.log(item2, 'item2');
+        //         this.$refs.tableRef.toggleRowSelection(item2, true);
+        //       }
+        //     });
+        //   });
+        // });
+      },
+      //重置
+      reset() {
+        this.name = '';
+        this.search();
+      },
+      // 搜索
+      search() {
+        this.$refs.tableRef.reload();
+      },
+
+      deptClick(data) {
+        if (data) {
+          this.$refs.tableRef.reload();
+        }
+      },
+
+      // 获取审核人列表、巡点检人员
+      async datasource({ page, limit, where, order }) {
+        this.selectedRow = {};
+        // 如果传了参数就是获取巡点检人员数据
+        return getUserPage({
+          pageNum: page,
+          size: limit,
+          ...where,
+          groupId: this.groupId,
+          name: this.name
+        });
+      },
+      handleSelectAll(selection) {
+        this.$refs.tableRef.clearSelection();
+      },
+      handleSelectionChange(row) {
+        if (this.tabValue == '1') {
+          if (row.length > 1) {
+            this.$refs.tableRef.clearSelection();
+            this.$refs.tableRef.toggleRowSelection(row.pop());
+          }
+          this.selectedRow = row[0];
+        } else {
+          this.selectedRowData = row;
+          let arr = row.map((item) => {
+            return item.id;
+          });
+          this.selectedRowDataId = arr.toString();
+        }
+      },
+      headerCellClassName({ columnIndex }) {
+        // 如果是第一列(通常是全选框),则返回自定义的class名
+        if (columnIndex === 0) {
+          return 'hide-selection-checkbox';
+        }
+        return '';
+      },
+      async submit() {
+        if (this.tabValue == '1') {
+          if (this.selectedRow.id) {
+            this.btnLoading = true;
+            let params = {
+              acceptUserId: this.selectedRow.id,
+              workOrderId: this.row.id
+            };
+            workOrderRotate(params).then(() => {
+              this.$message.success(`该工单成功转派给${this.selectedRow.name}`);
+              this.visible = false;
+              this.$emit('refresh');
+              this.btnLoading = false;
+            });
+          } else {
+            return this.$message.warning('请选择转派人员');
+          }
+        } else {
+          this.btnLoading = true;
+          let params = {
+            acceptUserId: this.selectedRowDataId,
+            workOrderId: this.row.id
+          };
+          addAssists(params).then(() => {
+            this.visible = false;
+            this.$emit('refresh');
+            this.btnLoading = false;
+          });
+        }
+      },
+      confirm() {
+        this.visible = false;
+        this.$emit('confirm', this.selectedRow.id);
+      },
+      cancel() {
+        this.tabValue = '1';
+        this.selectedRow = {};
+        this.selectedRowData = [];
+        this.visible = false;
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .sparepart-apply {
+    min-height: 40vh;
+    .select-box {
+      padding: 10px 0;
+    }
+
+    .material-item + .material-item {
+      margin-top: 10px;
+    }
+  }
+
+  .flex-between {
+    display: flex;
+    justify-content: space-between;
+    padding-right: 20%;
+  }
+
+  .list-box {
+    max-height: 60vh;
+    overflow-y: auto;
+    overflow-x: hidden;
+  }
+
+  .footer {
+    padding: 10px;
+    text-align: right;
+    background: #fff;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+  }
+  ::v-deep .hide-selection-checkbox .cell .el-checkbox {
+    visibility: hidden !important;
+  }
+</style>

+ 10 - 0
src/views/maintenance/repair/components/WorkOrderTab.vue

@@ -142,6 +142,16 @@
           <span>{{ logs[item.id].createTime }}</span>
         </div>
         <div slot="description" class="work_report_desc">
+          <div> 报工人:{{ logs[item.id].content.rawUserName }} </div>
+          <div>
+            辅助人:{{
+              logs[item.id].content.assists.length > 0
+                ? logs[item.id].content.assists
+                    .map((item) => item.name)
+                    .toString()
+                : ''
+            }}
+          </div>
           <div> 处理说明:{{ logs[item.id].content.reason }} </div>
           <div style="display: flex">
             附件:

+ 62 - 20
src/views/maintenance/repair/components/repairReportingWork.vue

@@ -170,26 +170,30 @@
     </el-form>
     <div slot="footer" class="footer">
       <el-button @click="cancel">返回</el-button>
-      <!-- <el-button :loading="btnLoading" type="primary" @click="noFinishSubmit"
+      <el-button :loading="btnLoading" type="primary" @click="submit('1')"
         >非完成报工</el-button
-      > -->
-      <el-button :loading="btnLoading" type="primary" @click="submit"
+      >
+      <el-button :loading="btnLoading" type="primary" @click="submit('2')"
         >报工</el-button
       >
     </div>
-    <!-- <redeployOther ref="redeployOtherRef" @refresh="onClose" /> -->
+    <redeployOther
+      ref="redeployOtherRef"
+      @refresh="onClose"
+      @confirm="onConfirm"
+    />
   </el-dialog>
 </template>
 
 <script>
-  import { report } from '@/api/equipment/work.js';
+  import { report, loseReport } from '@/api/equipment/work.js';
   import {
     getById,
     getRepairInfoById
   } from '@/api/maintenance/patrol_maintenance';
 
   import fileMain from '@/components/addDoc/index.vue';
-  import redeployOther from '@/views/maintenance/components/redeployOther.vue';
+  import redeployOther from '@/views/maintenance/components/redeployOther2.vue';
 
   export default {
     components: {
@@ -225,13 +229,21 @@
             { required: true, message: '请选择实际起始时间', trigger: 'blur' }
           ]
         },
-        rowData: {}
+        rowData: {},
+        acceptUserId: '',
+        hasClickOnce: false
       };
     },
     methods: {
       open(row, isRepaire) {
+        this.formData = {
+          time: [],
+          reason: '',
+          attachments: []
+        };
         this.rowData = row;
         this.getInfo(row, isRepaire);
+        this.hasClickOnce = false;
         this.visible = true;
       },
       cancel() {
@@ -241,10 +253,27 @@
         this.$refs.redeployOtherRef.visible = false;
         this.getInfo(this.rowData);
       },
-      // async noFinishSubmit() {
-      //   this.$refs.redeployOtherRef.open(this.rowData);
-      // },
-      async submit() {
+      onConfirm(val) {
+        this.acceptUserId = val;
+      },
+      async submit(val) {
+        if (val == '1') {
+          if (
+            !this.hasClickOnce ||
+            this.formData.time.length < 1 ||
+            this.formData.reason == ''
+          ) {
+            this.$refs.redeployOtherRef.open(this.rowData, 'noFinishSubmit');
+            this.hasClickOnce = true;
+          } else {
+            this.submitForm(val);
+          }
+        } else {
+          this.submitForm(val);
+        }
+      },
+
+      async submitForm(val) {
         this.$refs.ruleForm.validate(async (valid) => {
           if (valid) {
             // if (this.formData.time.length > 0) {
@@ -253,7 +282,7 @@
             this.infoData.deviceList = this.infoData.planDeviceList;
             this.infoData.reason = this.formData.reason;
             this.infoData.attachments = this.formData.attachments;
-            console.log(this.infoData);
+
             this.btnLoading = true;
             let deviceList = this.infoData.deviceList
               .map((item) => {
@@ -262,14 +291,27 @@
               .flat();
             let boolen = deviceList.every((item) => item.status > -1);
             this.infoData.isAbnormal = boolen ? 1 : 0;
-            report(this.infoData).then((res) => {
-              if (res.code == 0) {
-                this.$message.success('报工成功');
-                this.visible = false;
-                this.btnLoading = false;
-                this.$emit('refresh');
-              }
-            });
+            this.infoData.acceptUserId = this.acceptUserId;
+            if (val == '1') {
+              loseReport(this.infoData).then((res) => {
+                if (res.code == 0) {
+                  // this.$message.success('非报工成功');
+                  this.visible = false;
+                  this.btnLoading = false;
+                  this.$emit('refresh');
+                }
+              });
+            } else {
+              report(this.infoData).then((res) => {
+                if (res.code == 0) {
+                  this.$message.success('报工成功');
+                  this.visible = false;
+                  this.btnLoading = false;
+                  this.$emit('refresh');
+                }
+              });
+            }
+
             // } else {
             //   this.$message.error('请选择实际起始时间');
             // }

+ 2 - 3
src/views/maintenance/repair/workOrder/index.vue

@@ -106,7 +106,7 @@
   import edit from '@/views/sparePartsApply/components/edit';
   import RepairReportingWork from '../components/repairReportingWork.vue';
   import RepairDetailsDialog from '../components/RepairDetailsDialog.vue';
-  import redeployOther from '@/views/maintenance/components/redeployOther.vue';
+  import redeployOther from '@/views/maintenance/components/redeployOther2.vue';
   import {
     getWorkOrderList,
     applySpareParts,
@@ -407,8 +407,7 @@
 
       // 转派
       toRedeploy(row) {
-        console.log(row, 'd');
-        this.$refs.redeployOtherRef.open(row);
+        this.$refs.redeployOtherRef.open(row, 'transfer');
       },
       // 报工
       toReport(row) {