Просмотр исходного кода

报修记录接口对接提交

LAPTOP-16IUEB3P\Lenovo 3 лет назад
Родитель
Сommit
853a6d2d62

+ 21 - 3
src/api/maintenance/repair_report.js

@@ -18,17 +18,35 @@ export async function save (data) {
 }
 // 修改
 export async function update (data) {
-  const res = await request.post('/eam/repairrequest/update', data);
+  const res = await request.put('/eam/repairrequest/update', data);
   if (res.data.code == 0) {
     return res.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
 // 详情
-export async function getById (id) {
+export async function getRepairById (id) {
   const res = await request.get(`/eam/repairrequest/getById/${id}`);
   if (res.data.code == 0) {
-    return res.data;
+    return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 撤销
+export async function removeRequest(id) {
+  const res = await request.get(`/eam/repairrequest/delete/${id}` );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 委外 
+export async function addOutsource (data) {
+  const res = await request.post('/outsourc-work-order/addOrEdit', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 42 - 27
src/components/AssetDialog/categoryDialog.vue

@@ -9,11 +9,12 @@
   >
     <div class="search_wrapper">
       <el-input
-        v-model="searchParams.code"
+        v-model="code"
         class="search_input"
         placeholder="请输入编码"
       ></el-input>
       <el-button type="primary" @click="doSearch">搜索</el-button>
+	  <el-button type="primary" @click="reset">重置</el-button>
     </div>
     <el-row style="height: 80vh">
       <el-col class="tree-col" :span="6">
@@ -35,8 +36,8 @@
           style="width: 100%; overflow: auto"
           height="80vh"
           border
-          @select="pickSpareData"
-          @select-all="pickSpareData"
+		  @select-all="onSelectAll"
+		  @selection-change="selectItem"
           :header-cell-style="{ background: '#F0F3F3' }"
         >
           <el-table-column prop="code" label="物品编码"></el-table-column>
@@ -54,7 +55,6 @@
               <template v-else>{{ row[item.prop] }}</template>
             </template></el-table-column
           >
-
           <el-table-column type="selection" width="55" align="center">
           </el-table-column>
         </el-table>
@@ -70,7 +70,8 @@
 
 <script>
   import AssetTree from '@/components/AssetTree';
-  import { getList as getCategoryList } from '@/api/classifyManage/itemInformation';
+  // import { getList as getCategoryList } from '@/api/classifyManage/itemInformation';
+   import { getAssetList } from '@/api/ledgerAssets';
   import { tableHeader } from '@/utils/category.js';
   import dictMixins from '@/mixins/dictMixins';
   export default {
@@ -82,8 +83,8 @@
     props: {
       // 类型
       type: {
-        type: Array,
-        default: () => []
+        type: String,
+        default: () => ''
       },
       // 反显列表
       memoList: {
@@ -94,11 +95,7 @@
     data () {
       return {
         dialogVisible: false,
-        searchParams: {
-          code: '',
-          page: 1,
-          size: 99999
-        },
+        code:'',
         tableLoading: false,
         tableData: [],
         currentTreeData: {},
@@ -124,13 +121,13 @@
       },
 
       async doSearch () {
-        const params = {
-          categoryLevelId: this.currentTreeData.id,
-          rootCategoryLevelId: this.rootId,
-          code: this.searchParams.code
-        };
-        this._getClassificationList(params);
+        this._getClassificationList();
       },
+	  
+	  async reset(){
+		  this.code = ''
+		 this._getClassificationList(); 
+	  },
 
       // 获取根节点id
       setRootId (id) {
@@ -140,17 +137,19 @@
       // 树结构点击事件
       async handleNodeClick (data, node) {
         this.currentTreeData = data;
-        this._getClassificationList(data);
+        this._getClassificationList();
       },
       // 获取添物品信息表格数据
-      async _getClassificationList (data) {
+      async _getClassificationList () {
         this.tableLoading = true;
         let params = {
-          page: 1,
-          size: 99999,
-          categoryLevelId: this.currentTreeData.id
+          pageNum: 1,
+          size: -1,
+          categoryLevelId: this.currentTreeData.id,
+		  rootCategoryLevelId:this.rootId,
+		  code:this.code
         };
-        const res = await getCategoryList(params);
+        const res = await getAssetList(params);
         this.tableLoading = false;
         if (res.list.length) {
           this.tableData = res.list;
@@ -169,8 +168,24 @@
         }
       },
       // 备件单选框选择时事件
-      pickSpareData (data) {
-        this.selectionList = data;
+      onSelectAll() {
+        this.$refs.dialogMultipleTable.clearSelection();
+      },
+      selectItem(rows) {
+        if (rows.length > 1) {
+          const newRows = rows.filter((it, index) => {
+            if (index == rows.length - 1) {
+              this.$refs.dialogMultipleTable.toggleRowSelection(it, true);
+              return true;
+            } else {
+              this.$refs.dialogMultipleTable.toggleRowSelection(it, false);
+              return false;
+            }
+          });
+          this.selectionList = newRows;
+        } else {
+          this.selectionList = rows;
+        }
       },
 
       // 关闭弹窗
@@ -180,7 +195,7 @@
       },
 
       async submit () {
-        this.$emit('success', this.selectionList);
+        this.$emit('success', this.selectionList[0].id);
         this.handleClose();
         //   this.form.exportList = this.selectionList
         //   this.$forceUpdate()

+ 1 - 1
src/components/CommomSelect/person-select.vue

@@ -25,7 +25,7 @@
     },
     props: {
       value: {
-        type: [String, Number],
+        type: [String, Number,Array],
         default: ''
       },
       init: {

+ 2 - 1
src/components/addPatrolConfigDialog/index.vue

@@ -488,7 +488,7 @@
       async getInfo(id) {
         const res = await getInfoById(id);
         this.addForm = res;
-		this.isBindPlan = res.isBindPlan
+	    this.isBindPlan = res.isBindPlan
         this.categoryEquipment(res.categoryLevelId);
         const params = { groupId: res.groupId };
         this.getUserList(params);
@@ -795,6 +795,7 @@
                 : this.dialogTitle.includes('保养')
                 ? 2
                 : 3;
+			  this.addForm.isBindPlan = this.isBindPlan
               const res = await saveOrUpdate(this.addForm);
               if (res) {
                 const type = this.dialogTitle.includes('新增')

+ 66 - 11
src/utils/category.js

@@ -4,17 +4,37 @@ export const tableHeader = (type) => {
       return [{ label: '牌号', prop: 'brandNum' }];
     case 8:
       return [
-        { label: '型号', prop: 'modelType' },
-        { label: '规格', prop: 'specification' }
+        {  label: '型号', prop: 'modelType' ,
+		   formatter (row) {
+		     if (!row?.category) return '';
+		     return row.category.modelType;
+		   }
+		},
+        { label: '规格', prop: 'specification',
+		  formatter (row) {
+		    if (!row?.category) return '';
+		    return row.category.specification;
+		  }
+		}
       ];
     case 4:
       return [
         { label: '牌号', prop: 'brandNum' },
-        { label: '型号', prop: 'modelType' }
+        {  label: '型号', prop: 'modelType' ,
+           formatter (row) {
+             if (!row?.category) return '';
+             return row.category.modelType;
+           }
+        },
       ];
     case 5: //'周转车'
       return [
-        { label: '规格', prop: 'specification' },
+        { label: '规格', prop: 'specification',
+          formatter (row) {
+            if (!row?.category) return '';
+            return row.category.specification;
+          }
+        },
         {
           label: '材质',
           prop: 'texture',
@@ -38,8 +58,18 @@ export const tableHeader = (type) => {
       ];
     case 2: //'舟皿'
       return [
-        { label: '规格', prop: 'specification' },
-        { label: '型号', prop: 'modelType' },
+        { label: '规格', prop: 'specification',
+          formatter (row) {
+            if (!row?.category) return '';
+            return row.category.specification;
+          }
+        },
+        {  label: '型号', prop: 'modelType' ,
+           formatter (row) {
+             if (!row?.category) return '';
+             return row.category.modelType;
+           }
+        },
         {
           label: '长宽高',
           prop: '',
@@ -54,13 +84,28 @@ export const tableHeader = (type) => {
       ];
     case 1: //'设备'
       return [
-        { label: '型号', prop: 'modelType' },
-        { label: '规格', prop: 'specification' }
+        {  label: '型号', prop: 'modelType' ,
+           formatter (row) {
+             if (!row?.category) return '';
+             return row.category.modelType;
+           }
+        },
+		{ label: '规格', prop: 'specification',
+		  formatter (row) {
+		    if (!row?.category) return '';
+		    return row.category.specification;
+		  }
+		}
       ];
     case 6: //'模具'
       return [
         { label: '牌号', prop: 'brandNum' },
-        { label: '型号', prop: 'modelType' },
+        {  label: '型号', prop: 'modelType' ,
+           formatter (row) {
+             if (!row?.category) return '';
+             return row.category.modelType;
+           }
+        },
         {
           label: '收缩系数',
           prop: '',
@@ -73,8 +118,18 @@ export const tableHeader = (type) => {
       ];
     case 7: //'备品备件'
       return [
-        { label: '规格', prop: 'specification' },
-        { label: '型号', prop: 'modelType' }
+        { label: '规格', prop: 'specification',
+          formatter (row) {
+            if (!row?.category) return '';
+            return row.category.specification;
+          }
+        },
+        {  label: '型号', prop: 'modelType' ,
+           formatter (row) {
+             if (!row?.category) return '';
+             return row.category.modelType;
+           }
+        },
       ];
   }
 

+ 41 - 44
src/views/maintenance/repair/components/RepairDetailsDialog.vue

@@ -161,7 +161,7 @@
         <el-row class="repair_row">
           <el-col :span="12" class="repair_column">
             <span>报修记录编号:</span>
-            <span>{{ infoData ? infoData.repairsCode : '' }}</span>
+            <span>{{ infoData ? infoData.code : '' }}</span>
           </el-col>
           <el-col :span="12" class="repair_column">
             <span>报修时间:</span>
@@ -171,9 +171,7 @@
         <el-row class="repair_row">
           <el-col :span="12" class="repair_column">
             <span>来源:</span>
-            <span>{{
-              infoData && infoData.source ? infoData.source.desc : ''
-            }}</span>
+            <span>{{infoData ?getDictValue('报修来源', infoData.sourceType):''}}</span>
           </el-col>
           <el-col :span="12" class="repair_column">
             <span>来源编码:</span>
@@ -183,11 +181,11 @@
         <el-row class="repair_row">
           <el-col :span="12" class="repair_column">
             <span>报修部门:</span>
-            <span>{{ infoData ? infoData.repairsDeptName : '' }}</span>
+            <span>{{ infoData ? infoData.requestDeptName : '' }}</span>
           </el-col>
           <el-col :span="12" class="repair_column">
             <span>报修人:</span>
-            <span>{{ infoData ? infoData.repairsPerson : '' }}</span>
+            <span>{{ infoData ? infoData.requestUserName : '' }}</span>
           </el-col>
         </el-row>
         <el-row class="repair_row">
@@ -203,10 +201,10 @@
         <el-row class="repair_row">
           <el-col :span="24" class="repair_column">
             <span>故障描述:</span>
-            <span>{{ infoData ? infoData.repairsDescription : '' }}</span>
+            <span>{{ infoData ? infoData.remark : '' }}</span>
           </el-col>
         </el-row>
-        <el-row class="repair_row">
+<!--        <el-row class="repair_row">
           <el-col :span="24" class="repair_column">
             <span>图片:</span>
             <el-image
@@ -217,7 +215,7 @@
               :preview-src-list="[item.url]"
             />
           </el-col>
-        </el-row>
+        </el-row> -->
         <!-- <el-row class="repair_row">
           <el-col :span="24" class="repair_column">
             <span class="label">视频:</span>
@@ -335,19 +333,13 @@
 </template>
 
 <script>
-// import repair from '@/api/maintenance/repair/repair'
-// import maintenancePlan from '@/api/maintenance/repair/maintenancePlan'
-// import {
-//   workOrderDetails,
-//   sendAudit,
-//   getNewinfo,
-//   getSparePartDetail,
-//   getUseDetail
-// } from '@/api/stockManagement/stocking'
-import RepairNotesTab from './RepairNotesTab.vue'
-import WorkOrderTab from './WorkOrderTab.vue'
-// import { imageView } from '@/utils'
+import RepairNotesTab from './RepairNotesTab.vue';
+import WorkOrderTab from './WorkOrderTab.vue';
+import { getAssetInfo } from '@/api/ledgerAssets';
+import { getRepairById } from '@/api/maintenance/repair_report';
+import dictMixins from '@/mixins/dictMixins';
 export default {
+  mixins: [dictMixins],
   props: {
     // dialogTitle: {
     //   type: String,
@@ -409,6 +401,10 @@ export default {
       ]
     }
   },
+  created () {
+    this.requestDict('报修来源');
+    this.requestDict('报修状态');
+  },
   methods: {
     handleClose () {
       this.equipmentdialog = false
@@ -427,28 +423,29 @@ export default {
         this.detailsTabsActiveName = 'keepInRepair'
       }
       if (row.title === '报修记录详情') {
-        this.getSbinfo({ code: this.row.equiCode })
-        const res = await repair.getInfo(row.id)
-        this.infoData = res.data ? res.data : {}
-        this.repairInfoLogs = res.data.repairInfoLogs.reverse()
+        this.getSbinfo(this.row.deviceId)
+        const res = await getRepairById(row.id)
+		console.log('报修记录详情',res)
+        this.infoData = res ? res : {}
+        // this.repairInfoLogs = res.data.repairInfoLogs.reverse()
         // 处理图片
-        if (this.infoData && this.infoData.repairsImg) {
-          const repairsImg = this.infoData.repairsImg
-          this.infoData.repairsImg = []
-          repairsImg.split(',').map(item => {
-            imageView(item).then(res => {
-              this.infoData.repairsImg.push({
-                name: item.substring('/download/'.length),
-                url: res
-              })
-            })
+        // if (this.infoData && this.infoData.repairsImg) {
+        //   const repairsImg = this.infoData.repairsImg
+        //   this.infoData.repairsImg = []
+        //   repairsImg.split(',').map(item => {
+        //     imageView(item).then(res => {
+        //       this.infoData.repairsImg.push({
+        //         name: item.substring('/download/'.length),
+        //         url: res
+        //       })
+        //     })
 
-            console.log(this.infoData.repairsImg)
-            return
-          })
-        }
+        //     console.log(this.infoData.repairsImg)
+        //     return
+        //   })
+        // }
       } else if (row.title === '消息信息详情') {
-        this.getSbinfo({ code: this.row.workOrderCode })
+        this.getSbinfo(this.row.deviceId)
         const res = await repair.getInfo(row.workOrderId)
         this.infoData = res.data ? res.data : {}
         this.repairInfoLogs = res.data.repairInfoLogs.reverse()
@@ -467,7 +464,7 @@ export default {
           })
         }
       } else {
-        this.getSbinfo({ code: this.row.equiCode })
+        this.getSbinfo(this.row.deviceId )
         const res = await maintenancePlan.getWorkOrderDetail(row.workOrderCode)
         this.workOrderInfo = res.data
         this.planInfo = res.data.planInfo
@@ -494,9 +491,9 @@ export default {
     },
 
     getSbinfo (params) {
-      getNewinfo(params).then(res => {
-        if (res.success) {
-          this.equipmentInfo = res.data
+      getAssetInfo(params).then(res => {
+        if (res) {
+          this.equipmentInfo = res
         }
       })
     },

+ 2 - 27
src/views/maintenance/repair/outsourcingOrder/components/order-search.vue

@@ -20,21 +20,7 @@
       </el-col>
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
         <el-form-item label="执行人:" label-width="60px">
-<!--           <el-select
-             v-model="where.approvalUserId"
-             size="small"
-             clearable
-             style="width: 100%"
-           	 filterable
-           >
-             <el-option
-               v-for="item in uerList"
-               :key="item.id"
-               :value="item.id"
-               :label="item.name"
-             ></el-option>
-           </el-select> -->
-					 <personSelect v-model="where.approvalUserId" />
+			 <personSelect v-model="where.approvalUserId" />
         </el-form-item>
       </el-col>
       <el-col v-bind="styleResponsive ? { lg: 7, md: 12 } : { span: 7 }">
@@ -73,7 +59,6 @@
 </template>
 
 <script>
-  import {  getUserPage } from '@/api/system/organization';
   import personSelect from '@/components/CommomSelect/person-select.vue';
   export default {
 		components: { personSelect },
@@ -98,7 +83,6 @@
       }
     },
     created(){
-		this.getUserList()
     },
     methods: {
       /* 搜索 */
@@ -110,16 +94,7 @@
       reset() {
         this.where = { ...this.defaultWhere };
         this.search();
-      },
-	  
-	  // 获取执行人列表
-	  async getUserList () {
-	    try {
-	      let data = {  pageNum: 1 ,size:-1 }
-	      const res = await getUserPage(data)
-	      this.uerList = res.list
-	    } catch (error) {}
-	  },
+      }
     }
   };
 </script>

+ 128 - 211
src/views/maintenance/repair/repairNotes/components/addDialog.vue

@@ -15,18 +15,18 @@
       <el-form :model="addForm" :rules="addFormRules" label-width="120px">
         <el-row>
           <el-col :span="12">
-            <el-form-item label="设备编码:" prop="equiCode">
+            <el-form-item label="设备编码:" prop="code">
               <el-input
-                v-model="addForm.equiCode"
+                v-model="addForm.code"
                 placeholder="选择设备带出"
                 disabled
               ></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="权属部门:" prop="ownerDeptName">
+            <el-form-item label="权属部门:" prop="ownershipGroupName">
               <el-input
-                v-model="addForm.ownerDeptName"
+                v-model="addForm.ownershipGroupName"
                 placeholder="选择设备带出"
                 disabled
               ></el-input>
@@ -35,18 +35,18 @@
         </el-row>
         <el-row>
           <el-col :span="12">
-            <el-form-item label="设备名称:" prop="equiName">
+            <el-form-item label="设备名称:" prop="name">
               <el-input
-                v-model="addForm.equiName"
+                v-model="addForm.name"
                 placeholder="选择设备带出"
                 disabled
               ></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="权属人:" prop="ownerName">
+            <el-form-item label="权属人:" prop="ownershipUserName">
               <el-input
-                v-model="deviceData.ownerName"
+                v-model="addForm.ownershipUserName"
                 placeholder="选择设备带出"
                 disabled
               ></el-input>
@@ -55,18 +55,18 @@
         </el-row>
         <el-row>
           <el-col :span="12">
-            <el-form-item label="固定资产编码:" prop="fixedAssetCode">
+            <el-form-item label="固定资产编码:" prop="fixCode">
               <el-input
-                v-model="addForm.fixedAssetCode"
+                v-model="addForm.fixCode"
                 placeholder="选择设备带出"
                 disabled
               ></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="权属人电话:" prop="ownerPhone">
+            <el-form-item label="权属人电话:" prop="ownershipUserMobile">
               <el-input
-                v-model="deviceData.ownerPhone"
+                v-model="addForm.ownershipUserMobile"
                 placeholder="选择设备带出"
                 disabled
               ></el-input>
@@ -86,17 +86,27 @@
           <el-col :span="12">
             <el-form-item label="设备位置:" prop="equiLocation">
               <el-input
-                v-model="deviceData.equiLocation"
+                v-model="addForm.equiLocation"
                 placeholder="选择设备带出"
                 disabled
               ></el-input>
             </el-form-item>
           </el-col>
+		  <el-col :span="12">
+		    <el-form-item label="维修部门:" prop="repairGroupName">
+		      <dept-select v-model="addForm.repairGroupName" placeholder="选择设备带出" disabled/>
+		    </el-form-item>
+		  </el-col>
+		  <el-col :span="12">
+		    <el-form-item label="维修人:" prop="repairUserName">
+		      <person-select v-model="addForm.repairUserName" multiple clearable placeholder="选择设备带出" disabled/>
+		    </el-form-item>
+		  </el-col>
         </el-row>
         <el-row>
           <el-col :span="12">
-            <el-form-item label="接收人部门:" prop="recipient">
-              <dept-select v-model="addForm.recipientdept" />
+            <el-form-item label="接收人部门:" prop="repairDeptId">
+              <dept-select v-model="addForm.repairDeptId" />
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -113,16 +123,16 @@
           </el-col>
 
           <el-col :span="12">
-            <el-form-item label="接收人:" prop="recipient">
-              <person-select v-model="addForm.recipient" multiple clearable />
+            <el-form-item label="接收人:" prop="repairUserId">
+              <person-select v-model="addForm.repairUserId" clearable @change="changeUser"/>
             </el-form-item>
           </el-col>
           <el-col :span="24">
-            <el-form-item label="故障描述:" prop="repairsDescription">
+            <el-form-item label="故障描述:" prop="remark">
               <el-input
                 type="textarea"
                 :rows="3"
-                v-model="addForm.repairsDescription"
+                v-model="addForm.remark"
                 placeholder="请输入故障描述"
                 resize="none"
                 maxlength="500"
@@ -130,17 +140,17 @@
               ></el-input>
             </el-form-item>
           </el-col>
-          <el-col :span="24">
+<!--          <el-col :span="24">
             <el-form-item label="图片:" prop="repairsImg">
-              <!--  <SelectUpload
+               <SelectUpload
                 multiple
                 ref="selectUploadRef"
                 @getImgs="getImgs"
                 :limit="4"
                 :initData="initData"
-              /> -->
+              />
             </el-form-item>
-          </el-col>
+          </el-col> -->
           <!-- <el-col :span="24">
             <el-form-item label="视频:" prop="repairsVideo"> </el-form-item>
           </el-col> -->
@@ -148,13 +158,13 @@
       </el-form>
     </div>
     <div class="btns">
-      <el-button type="primary" @click="submitAdd">提交</el-button>
+      <el-button type="primary" @click="submitAdd" :loading="loading">提交</el-button>
       <el-button @click="handleClose">关闭</el-button>
     </div>
     <CategoryDialog
       ref="equipmentDialogRef"
       @success="selectedEquipment"
-      type="1"
+      :type="'1'"
     />
   </el-dialog>
 </template>
@@ -163,17 +173,15 @@
   import CategoryDialog from '@/components/AssetDialog/categoryDialog';
   import DeptSelect from '@/components/CommomSelect/dept-select.vue';
   import PersonSelect from '@/components/CommomSelect/person-select.vue';
-
+  import { getAssetInfo } from '@/api/ledgerAssets';
+  import { save , update } from '@/api/maintenance/repair_report';
+  import { getUserPage } from '@/api/system/organization';
   export default {
     props: {
       dialogTitle: {
         type: String,
         default: '新增报修记录'
       },
-      deviceInfo: {
-        type: Object,
-        default: {}
-      },
       infoData: {
         type: Object,
         default: {}
@@ -183,100 +191,42 @@
       CategoryDialog,
       DeptSelect,
       PersonSelect
-      // SelectUpload, selectTree
     },
     watch: {
       infoData (val) {
-        console.log('vall', val);
-        this.selectedEquipment(val);
-        // this.addForm = JSON.parse(JSON.stringify(val))
-        // console.log(' this.addForm', this.addForm)
-        if (val.repairsImg) {
-          this.initData = val.repairsImg.split(',').map((item) => {
-            return {
-              name: item.substring('/download/'.length),
-              url: item
-            };
-          });
-        }
-
-        if (val.receiveUser) {
-          const recipient = JSON.parse(val.receiveUser).map((item) => {
-            return item.receiveUserId + ',' + item.receiveUserName;
-          });
-          this.$set(this.addForm, 'recipient', recipient);
-        }
-
-        this.$set(this.addForm, 'expectedTime', val.expectedTime);
-        this.$set(this.addForm, 'repairsDescription', val.repairsDescription);
-        this.$nextTick(() => {
-          this.recipientDep = val.repairsDeptCode;
-          this.getUserList(this.recipientDep);
-        });
+        let id = val.id
+        this.selectedEquipment(id);
       },
-      deviceInfo (val) {
-        this.deviceData = val;
-      }
     },
     data () {
       return {
         addRepairNotesDialog: false,
-        addForm: {
-          // repairsCode: getRuleNo('BX'), // 报修记录编号
-          equiCode: '', // 设备编码
-          equiName: '', // 设备名称
-          fixedAssetCode: '', // 固定资产编码
-          equiModel: '', // 规格型号
-          ownerDeptCode: '', // 权属部门code
-          ownerDeptName: '', // 权属部门名称
-          expectedTime: '', // 期望完成时间
-          recipient: [], // 接收人集合
-          repairsDescription: '', // 故障描述
-          repairsImg: '' // 图片
-          // repairsVideo: '' // 视频
-        },
+        addForm: { },
         initData: [],
-        recipientDep: '', // 接收人部门
-        deptName: '', //接收人部门名称
-        recipientDepList: [], // 接收人部门列表
-        recipientList: [], // 接收人
         addFormRules: {},
-        deviceData: {
-          ownerName: '', // 权属人
-          ownerPhone: '', // 权属部门电话
-          equiLocation: '' // 设备位置
-        }
+		loading:false,
+		row:null,
+		receiverList:[]
       };
     },
     created () {
-      // this.getrecipientDep()
+		this.getUserList()
     },
     methods: {
+	  init(row){
+		  this.addRepairNotesDialog = true;
+		  this.row = row
+		  if(row){
+			  this.selectedEquipment(row.deviceId)
+		  }else{
+			  
+		  } 
+	  },
+		
       handleClose () {
-        // this.$refs.selectUploadRef.clearUploadFiles()
         this.initData = [];
         this.addRepairNotesDialog = false;
-        this.recipientDep = '';
-        this.addForm = {
-          // repairsCode: getRuleNo('BX'), // 报修记录编号
-          equiTypeId: '', // 设备分类ID
-          equiTypeName: '', // 	设备分类名称
-          equiCode: '', // 设备编码
-          equiName: '', // 设备名称
-          fixedAssetCode: '', // 固定资产编码
-          equiModel: '', // 规格型号
-          ownerDeptCode: '', // 权属部门code
-          ownerDeptName: '', // 权属部门名称
-          expectedTime: '', // 期望完成时间
-          repairsDescription: '', // 故障描述
-          repairsImg: '' // 图片
-          // repairsVideo: '' // 视频
-        };
-        this.deviceData = {
-          ownerName: '', // 权属人
-          ownerPhone: '', // 权属人电话
-          equiLocation: '' // 设备位置
-        };
+        this.addForm = {}
       },
       // 打开选择设备弹窗
       selectEquipment () {
@@ -289,120 +239,87 @@
       },
 
       // 获取接收人列表
-      getUserList (deptCode) {
-        let par = {
-          deptCode,
-          page: 1,
-          size: 999999
-        };
-        geUserlist(par).then((res) => {
-          this.recipientList = res.data.items;
-        });
+      async getUserList (deptCode) {
+        let data = { pageNum: 1, size: -1 };
+        const res = await getUserPage(data);
+        this.receiverList = res.list;
       },
+	  
+	  changeUser(data){
+		  this.receiverList.map(item=>{
+			  if(item.id==data){
+				  this.addForm.repairUserName = item.name
+			  }
+		  })
+	  },
+	  
 
       // 选择的设备
-      selectedEquipment (row) {
-        // console.log('选择的设备信息',row)
-        getNewinfo({ code: row.code }).then((res) => {
-          if (res.success) {
-            console.log('选择的设备信息res', res.data);
-            let info = res.data.information;
-            this.addForm.equiTypeId = res.data.assetType; // 设备分类id
-            this.addForm.equiId = res.data.id; // 设备id
-            this.addForm.equiName = res.data.assetName; // 设备名称
-            this.addForm.equiCode = res.data.assetCode; // 设备编码
-            this.addForm.fixedAssetCode = res.data.fixAssetCode; // 固定资产编码
-            this.addForm.ownerDeptName = res.data.ownershipDeptName; // 权属部门名称
-            this.deviceData.ownerPhone = res.data.ownershipUserMobile; // 权属人电话
-            this.deviceData.ownerName = res.data.ownershipUserName; // 权属人
-
-            const model = info.modelType ? info.modelType : '';
-            const specification = info.specification
-              ? info.specification + '|'
-              : info.modelType
-              ? '|'
-              : '';
-            this.addForm.equiModel = specification + model; // 规格型号
-
-            const factoryName = res.data.factoryName
-              ? res.data.factoryName + '-'
-              : '';
-            const workshopName = res.data.workshopName
-              ? res.data.workshopName + '-'
-              : '';
-            const lineName = res.data.lineName ? res.data.lineName + '-' : '';
-            const detailLocation = res.data.detailLocation
-              ? res.data.detailLocation
-              : '';
-            this.deviceData.equiLocation =
-              factoryName + workshopName + lineName + detailLocation; // 设备位置
-          }
+      selectedEquipment (id) {
+        getAssetInfo(id).then((res) => {
+			this.addForm = res
+			this.addForm.equiLocation = res.positionList[0].pathName
+			const model = res.category.modelType ? res.category.modelType : "";
+			const specification = res.category.specification
+				? res.category.specification + "|"
+				: res.category.modelType
+				? "|"
+				: "";
+			this.addForm.equiModel = specification + model; // 规格型号
+			if(this.row){				
+				this.$set(this.addForm,'repairDeptId',this.row.repairDeptId)
+						this.$set(this.addForm,'repairUserId',this.row.repairUserId)  
+				this.$set(this.addForm,'expectedTime',this.row.expectedTime)
+				this.$set(this.addForm,'remark',this.row.remark)
+			}
         });
-        // this.addForm['equiTypeName'] = row.equiTypeName // 设备分类名称
-        // this.deviceData.equiLocation =  row.positionFarm // 设备位置
       },
       // 提交新增
-      submitAdd () {
-        if (!this.addForm.equiCode) {
+     submitAdd () {
+        if (!this.addForm.code) {
           return this.$message.warning('请选择报修设备!');
         }
-        let msg = '新增成功!';
-        // 编辑
-        if (this.addForm.id) {
-          delete this.addForm.repairInfoLogs;
-          msg = '修改成功!';
-        }
-        if (this.addForm.recipient) {
-          this.addForm['receiveUserList'] = this.addForm.recipient.map(
-            (item) => {
-              return {
-                receiveUserId: item.split(',')[0],
-                receiveUserName: item.split(',')[1],
-                deptName: this.deptName
-              };
-            }
-          );
-        }
-        let form = JSON.parse(JSON.stringify(this.addForm));
-
-        if (this.infoData.id) {
-          form.id = this.infoData.id;
-        }
-        delete form.recipient;
-        delete form.receiveUser;
-        delete form.source;
-        delete form.sourceCode;
-        form.ownerPhone = this.deviceData.ownerPhone;
-        form.ownerPhone = this.deviceData.ownerName;
-        form.equiLocation = this.deviceData.equiLocation;
-        repair
-          .saveOrEditInfo(form)
-          .then((res) => {
-            this.handleClose();
-            this.$message.success(msg);
-            this.$emit('refresh');
-          })
-          .catch(() => {});
-      },
-      // 获取接收人部门
-      getrecipientDep () {
-        geDeptTree().then((res) => {
-          console.log('asdasd', res);
-          this.recipientDepList = res.data;
-        });
-      },
-      nodeClick (info) {
-        //部门
-        this.recipientDep = info.code;
-        this.deptName = info.name;
-        this.getUserList(this.recipientDep);
+		const params = {
+			deviceId: this.addForm.id,
+			expectedTime : this.addForm.expectedTime,
+			remark: this.addForm.remark,
+			repairDeptId: this.addForm.repairDeptId,
+			repairUserId: this.addForm.repairUserId,
+			status:0,
+			sourceType:1,
+			deviceCode: this.addForm.code,
+			deviceName: this.addForm.name,			
+			repairUserName: this.addForm.repairUserName
+		}
+		this.loading = true;
+		if(this.row){
+			params.id = this.row.id
+			params.code = this.row.code
+			update(params).then(res=>{
+				this.$message.success('修改成功!');
+			    this.$emit('refresh');
+				this.loading = false;
+				this.handleClose()
+			})
+			.catch((e) => {
+			  this.loading = false;
+			});
+		}else{
+			save(params).then(res=>{
+				this.$message.success('新增成功!');
+			    this.$emit('refresh');
+				this.loading = false;
+				this.handleClose()
+			})
+			.catch((e) => {
+			  this.loading = false;
+			});
+		}
+		
       },
-      // 如果没先选接受部门,则提示
-      focusRecipient () {
-        if (!this.recipientDep) {
-          this.$message.warning('请选择接收人部门');
-        }
-      }
+
+
+
     }
   };
 </script>

+ 14 - 15
src/views/maintenance/repair/repairNotes/components/entrustDialog.vue

@@ -11,10 +11,9 @@
       <el-form :model="addForm" :rules="addFormRules" label-width="120px"  ref="addFormRef">
         <el-row>
           <el-col :span="12">
-            <el-form-item label="报修记录编号:" prop="repairsCode">
+            <el-form-item label="报修记录编号:" prop="repairsRequestCode">
               <el-input
-                v-model="addForm.repairsCode"
-                size="small"
+                v-model="addForm.repairsRequestCode"
                 disabled
               ></el-input>
             </el-form-item>
@@ -23,7 +22,6 @@
             <el-form-item label="设备编码:" prop="equiCode">
               <el-input
                 v-model="addForm.equiCode"
-                size="small"
                 disabled
               ></el-input>
             </el-form-item>
@@ -34,14 +32,16 @@
             <el-form-item label="设备名称:" prop="equiName">
               <el-input
                 v-model="addForm.equiName"
-                size="small"
                 disabled
               ></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="委外单位:" prop="outsourcUnit">
-              <el-select
+				<el-input
+				  v-model="addForm.outsourcUnit"
+				></el-input>
+              <!-- <el-select
                 size="small"
                 style="width: 100%"
                 clearable
@@ -55,7 +55,7 @@
                   :value="item.name"
                 >
                 </el-option>
-              </el-select>
+              </el-select> -->
             </el-form-item>
           </el-col>
         </el-row>
@@ -67,7 +67,6 @@
                 type="datetime"
                 style="width: 100%"
                 placeholder="选择日期时间"
-                size="small"
                 value-format="yyyy-MM-dd HH:mm:ss"
               >
               </el-date-picker>
@@ -84,8 +83,7 @@
 </template>
 
 <script>
-
-// import { addOutsource, getAllSupplier } from '@/api/maintenance/repair/repair'
+  import { addOutsource } from '@/api/maintenance/repair_report';
 export default {
   props: {
 
@@ -97,7 +95,7 @@ export default {
     return {
       addForm: {},
       addFormRules: {
-        outsourcUnit:[{ required: true, message: '请选择委外单位', trigger: 'change' }],
+        outsourcUnit:[{ required: true, message: '请选择委外单位', trigger: 'blur' }],
         plannCompletionTime:[{ required: true, message: '请选择计划完成时间', trigger: 'change' }]
       },
       entrustVisible:false,
@@ -110,10 +108,11 @@ export default {
   methods: {
     init(row){
        this.addForm = {}
-       this.addForm.repairsCode = row.repairsCode
-       this.addForm.equiCode = row.equiCode
-       this.addForm.equiName = row.equiName
-       this.addForm.equiId = row.equiId
+       this.addForm.repairsRequestCode = row.code
+       this.addForm.repairsRequestId = row.id
+       this.addForm.equiName = row.deviceName
+       this.addForm.equiId = row.deviceId
+	   this.addForm.equiCode = row.deviceCode
        this.addForm.status = 0
        // this.getgys()
        this.entrustVisible = true

+ 17 - 11
src/views/maintenance/repair/repairNotes/components/notes-search.vue

@@ -9,12 +9,12 @@
     <el-row :gutter="15">
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
         <el-form-item label="来源编码:">
-          <el-input clearable v-model="where.code" placeholder="请输入" />
+          <el-input clearable v-model="where.sourceCode" placeholder="请输入" />
         </el-form-item>
       </el-col>
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
-        <el-form-item label="来源:">
-          <DictSelection dictName="报修来源" v-model="where.code" />
+        <el-form-item label="来源类型:">
+          <DictSelection dictName="报修来源" v-model="where.sourceType" />
         </el-form-item>
       </el-col>
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
@@ -24,12 +24,12 @@
       </el-col>
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
         <el-form-item label="报修人:">
-          <personSelect v-model="where.userId" />
+          <personSelect v-model="where.requestUserId" />
         </el-form-item>
       </el-col>
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
         <el-form-item label="状态:">
-          <DictSelection dictName="报修状态" v-model="where.code" />
+          <DictSelection dictName="报修状态" v-model="where.status" />
         </el-form-item>
       </el-col>
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
@@ -77,15 +77,16 @@
     data() {
       // 默认表单数据
       const defaultWhere = {
-        name: '',
+        sourceCode: '',
+		sourceType:'',
         code: '',
-        fixCode: '',
-        ownershipGroupId: ''
+        requestUserId: '',
+        status: '',
+		time: [],
       };
       return {
         // 表单数据
         where: { ...defaultWhere },
-        treeData: []
       };
     },
     computed: {
@@ -98,8 +99,13 @@
     methods: {
       /* 搜索 */
       search () {
-        console.log(this.where);
-        this.$emit('search', this.where);
+        const parmas = this.where;
+        if (parmas.time?.length) {
+          parmas.startTime = parmas.time[0];
+          parmas.endTime = parmas.time[1];
+        }
+        delete parmas.time;
+        this.$emit('search', parmas);
       },
       /*  重置 */
       reset () {

+ 66 - 27
src/views/maintenance/repair/repairNotes/index.vue

@@ -32,7 +32,7 @@
             type="primary"
             :underline="false"
             icon="el-icon-edit"
-            @click="openEdit(row)"
+            @click="appoint(row)"
           >
             委外
           </el-link>
@@ -44,14 +44,17 @@
           >
             修改
           </el-link>
-          <el-link
-            type="primary"
-            :underline="false"
-            icon="el-icon-edit"
-            @click="openEdit(row)"
-          >
-            撤销
-          </el-link>
+			<el-popconfirm
+			  class="ele-action"
+			  title="确定要撤销此报修记录吗?"
+			  @confirm="remove(row)"
+			>
+			  <template v-slot:reference>
+				<el-link type="danger" :underline="false" icon="el-icon-delete">
+				  撤销
+				</el-link>
+			  </template>
+			</el-popconfirm>
         </template>
       </ele-pro-table>
     </el-card>
@@ -68,24 +71,29 @@
     <DetailsDialog
       ref="detailsDialogRef"
       :dialogTitle="detailsDialogTitle"
-      :infoData="infoData"
-      :repairInfoLogs="repairInfoLogs"
     />
+	<!-- 委外弹窗 -->
+	<EntrustDialog
+	  ref="entDialogRef"	 
+	  @refresh="reload"
+	/>
   </div>
 </template>
 
 <script>
-  import { getPage } from '@/api/maintenance/repair_report';
-  // import AddPatrolPlanDialog from '@/components/addPatrolPlanDialog'
+  import { getPage , removeRequest } from '@/api/maintenance/repair_report';
   import NotesSearch from './components/notes-search.vue';
   import AddDialog from './components/addDialog.vue';
+  import EntrustDialog from './components/entrustDialog.vue';
   import DetailsDialog from '../components/RepairDetailsDialog.vue';
+  import dictMixins from '@/mixins/dictMixins';
   export default {
+	mixins: [dictMixins],
     components: {
       NotesSearch,
       AddDialog,
-      DetailsDialog
-      // AddPatrolPlanDialog
+      DetailsDialog,
+      EntrustDialog
     },
     data () {
       return {
@@ -110,32 +118,38 @@
             minWidth: 110
           },
           {
-            prop: 'deviceId',
+            prop: 'deviceCode',
             label: '设备编码',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110
           },
           {
-            prop: 'enable',
+            prop: 'deviceName',
             label: '设备名称',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110
           },
           {
-            prop: 'sourceType',
+            prop: 'type',
             label: '报修类型',
             align: 'center',
             showOverflowTooltip: true,
-            minWidth: 110
+            minWidth: 110,
+			formatter: (_row, _column, cellValue) => {
+			  return _row.sourceType==3?'自动报修':'人工报修'
+			}
           },
           {
-            prop: 'from',
+            prop: 'sourceType',
             label: '来源',
             align: 'center',
             showOverflowTooltip: true,
-            minWidth: 110
+            minWidth: 110,
+			formatter: (_row, _column, cellValue) => {
+			  return this.getDictValue('报修来源', _row.sourceType);
+			}
           },
           {
             prop: 'sourceCode',
@@ -149,10 +163,13 @@
             label: '状态',
             align: 'center',
             showOverflowTooltip: true,
-            minWidth: 110
+            minWidth: 110,
+			formatter: (_row, _column, cellValue) => {
+			  return this.getDictValue('报修状态', _row.status);
+			}
           },
           {
-            prop: 'requestUserId',
+            prop: 'requestUserName',
             label: '报修人',
             align: 'center',
             showOverflowTooltip: true,
@@ -172,7 +189,7 @@
             columnKey: 'action',
             slot: 'action',
             label: '操作',
-            width: 230,
+            width: 200,
             align: 'center',
             resizable: false,
             showOverflowTooltip: true
@@ -188,6 +205,10 @@
       };
     },
     computed: {},
+	created () {
+	  this.requestDict('报修来源');
+	  this.requestDict('报修状态');
+	},
     methods: {
       /* 表格数据源 */
       datasource ({ page, limit, where, order }) {
@@ -210,8 +231,12 @@
       },
 
       openEdit (row) {
-        this.addDialogTitle = '新增报修记录';
-        this.$refs.addDialogRef.addRepairNotesDialog = true;
+		  if(row){
+			 this.addDialogTitle = '编辑报修记录'; 
+		  }else{
+			  this.addDialogTitle = '新增报修记录';
+		  }
+		this.$refs.addDialogRef.init(row)
       },
 
       goDetail (row) {
@@ -225,7 +250,21 @@
         //   //   id
         //   // }
         // })
-      }
+      },
+	  
+	  // 委外
+	  appoint(row) {
+	    this.$refs.entDialogRef.init(row);
+	  },
+	  
+	  // 撤销
+	  remove(row){
+		  removeRequest(row.id).then((res) => {
+		    this.$message.success('撤销成功!');
+		    this.reload();
+		  });
+	  }
+	  
     }
   };
 </script>

+ 2 - 2
vue.config.js

@@ -33,10 +33,10 @@ module.exports = {
       '/api': {
         // target: 'http://192.168.3.51:86', // 测试
         // target: 'http://192.168.3.34:8080', // 刘毅
-        // target: 'http://192.168.3.35:8080', // kang杨威
+        target: 'http://192.168.3.35:8080', // kang杨威
         // target: 'http://192.168.3.25:8080', // 黄峥嵘
         // target: 'http://192.168.3.41:8080', // 何江鹏
-        target: 'http://192.168.3.33:8080', // 谢一平
+        // target: 'http://192.168.3.33:8080', // 谢一平
         // target: 'http://192.168.3.34:8080', // 刘毅
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域