quwangxin 3 лет назад
Родитель
Сommit
cf0542e4e1

+ 8 - 0
src/api/maintenance/patrol_maintenance.js

@@ -24,3 +24,11 @@ export async function getById (id) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+// 撤回
+export async function revocation (id) {
+  const res = await request.get(`/eam/planmaintenance/revocation/${id}`);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 28 - 26
src/api/maintenance/repair.js

@@ -1,34 +1,36 @@
 import request from '@/utils/request';
 
 // 分页
-export async function getPage (data) {
-  const res = await request.get('/eam/repairrequest/page', { params: data });
+export async function getWorkOrderList (data) {
+  const res = await request.get('/eam/workorder/getWorkOrderList', {
+    params: data
+  });
   if (res.data.code == 0) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
-// 保存
-export async function save (data) {
-  const res = await request.post('/eam/repairrequest/save', data);
-  if (res.data.code == 0) {
-    return res.data;
-  }
-  return Promise.reject(new Error(res.data.message));
-}
-// 修改
-export async function update (data) {
-  const res = await request.post('/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) {
-  const res = await request.get(`/eam/repairrequest/getById/${id}`);
-  if (res.data.code == 0) {
-    return res.data;
-  }
-  return Promise.reject(new Error(res.data.message));
-}
+// // 保存
+// export async function save (data) {
+//   const res = await request.post('/eam/repairrequest/save', data);
+//   if (res.data.code == 0) {
+//     return res.data;
+//   }
+//   return Promise.reject(new Error(res.data.message));
+// }
+// // 修改
+// export async function update (data) {
+//   const res = await request.post('/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) {
+//   const res = await request.get(`/eam/repairrequest/getById/${id}`);
+//   if (res.data.code == 0) {
+//     return res.data;
+//   }
+//   return Promise.reject(new Error(res.data.message));
+// }

+ 34 - 0
src/api/maintenance/repair_report.js

@@ -0,0 +1,34 @@
+import request from '@/utils/request';
+
+// 分页
+export async function getPage (data) {
+  const res = await request.get('/eam/repairrequest/page', { params: data });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 保存
+export async function save (data) {
+  const res = await request.post('/eam/repairrequest/save', data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 修改
+export async function update (data) {
+  const res = await request.post('/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) {
+  const res = await request.get(`/eam/repairrequest/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 5 - 6
src/components/AssetDialog/categoryDialog.vue

@@ -9,12 +9,11 @@
   >
     <div class="search_wrapper">
       <el-input
-        size="small"
         v-model="searchParams.code"
         class="search_input"
         placeholder="请输入编码"
       ></el-input>
-      <el-button type="primary" size="small" @click="doSearch">搜索</el-button>
+      <el-button type="primary" @click="doSearch">搜索</el-button>
     </div>
     <el-row style="height: 80vh">
       <el-col class="tree-col" :span="6">
@@ -40,8 +39,8 @@
           @select-all="pickSpareData"
           :header-cell-style="{ background: '#F0F3F3' }"
         >
-          <el-table-column prop="assetCode" label="物品编码"></el-table-column>
-          <el-table-column prop="assetName" label="物品名称"></el-table-column>
+          <el-table-column prop="code" label="物品编码"></el-table-column>
+          <el-table-column prop="name" label="物品名称"></el-table-column>
           <el-table-column
             :prop="item.prop"
             :label="item.label"
@@ -56,7 +55,8 @@
             </template></el-table-column
           >
 
-          <el-table-column type="selection" width="55"> </el-table-column>
+          <el-table-column type="selection" width="55" align="center">
+          </el-table-column>
         </el-table>
       </el-col>
     </el-row>
@@ -151,7 +151,6 @@
           categoryLevelId: this.currentTreeData.id
         };
         const res = await getCategoryList(params);
-        console.log('res', res);
         this.tableLoading = false;
         if (res.list.length) {
           this.tableData = res.list;

+ 1 - 0
src/components/CommomSelect/dept-select.vue

@@ -8,6 +8,7 @@
     label-key="name"
     value-key="id"
     default-expand-all
+    size="medium"
     :placeholder="placeholder"
     @input="updateValue"
     v-on="$listeners"

+ 69 - 104
src/components/addPatrolPlanDialog/index.vue

@@ -20,7 +20,6 @@
             <el-form-item label="计划单号" prop="code">
               <el-input
                 v-model="addForm.code"
-                size="small"
                 placeholder="自动带出"
                 disabled
               ></el-input>
@@ -28,20 +27,12 @@
           </el-col>
           <el-col :span="8">
             <el-form-item label="计划名称" prop="name">
-              <el-input
-                v-model="addForm.name"
-                size="small"
-                placeholder="请输入"
-              ></el-input>
+              <el-input v-model="addForm.name" placeholder="请输入"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="8">
             <el-form-item label="自动派单" prop="autoOrder">
-              <el-select
-                v-model="addForm.autoOrder"
-                size="small"
-                style="width: 100%"
-              >
+              <el-select v-model="addForm.autoOrder" style="width: 100%">
                 <el-option :value="1" label="是"></el-option>
                 <el-option :value="0" label="否"></el-option>
               </el-select>
@@ -51,7 +42,6 @@
             <el-form-item label="规则名称" prop="ruleId">
               <el-select
                 v-model="addForm.ruleId"
-                size="small"
                 style="width: 100%"
                 @change="handleRuleNameChange"
               >
@@ -68,11 +58,7 @@
           <el-col :span="8">
             <el-form-item label="计划完成时长" prop="duration">
               <div style="display: flex">
-                <el-input
-                  v-model="addForm.duration"
-                  size="small"
-                  placeholder="请输入"
-                >
+                <el-input v-model="addForm.duration" placeholder="请输入">
                   <template #suffix>分钟</template>
                 </el-input>
               </div>
@@ -81,7 +67,6 @@
           <el-col :span="8">
             <el-form-item label="设备分类" prop="categoryLevelId">
               <equipmentSelect
-                size="small"
                 v-model="addForm.categoryLevelId"
                 @changeNode="chooseClassify"
                 @setRootId="getRootId"
@@ -92,7 +77,6 @@
             <el-form-item label="设备类别" prop="categoryId">
               <el-select
                 v-model="addForm.categoryId"
-                size="small"
                 style="width: 100%"
                 filterable
               >
@@ -108,13 +92,12 @@
           </el-col>
           <el-col :span="8">
             <el-form-item label="审核人" prop="verifyUserId">
-              <personSelect v-model="addForm.verifyUserId" size="small" />
+              <personSelect v-model="addForm.verifyUserId" />
             </el-form-item>
           </el-col>
           <el-col :span="8" v-if="addForm.autoOrder">
             <el-form-item :label="formLabel + '部门'" prop="groupId">
               <deptSelect
-                size="small"
                 v-model="addForm.groupId"
                 @change="searchDeptNodeClick"
               />
@@ -129,32 +112,12 @@
               ]"
             >
               <personSelect
-                size="small"
                 ref="executorRef"
                 v-model="addForm.executorId"
                 :init="false"
               />
-              <!-- <el-select
-                v-model="addForm.executorId"
-                size="small"
-                style="width: 100%"
-              >
-                <el-option
-                  v-for="item in executorList"
-                  :key="item.userId"
-                  :value="item.userId"
-                  :label="item.trueName"
-                  @click.native="
-                    {
-                      addForm.executorName = item.trueName;
-                      addForm.executorPhone = item.mobile;
-                    }
-                  "
-                ></el-option>
-              </el-select> -->
             </el-form-item>
           </el-col>
-          <!-- :validate-event="false" -->
           <el-col :span="24">
             <el-form-item label="备注" prop="remark">
               <el-input
@@ -163,7 +126,6 @@
                 v-model="addForm.remark"
                 :rows="2"
                 placeholder="请详细说明"
-                size="small"
               ></el-input>
             </el-form-item>
           </el-col>
@@ -269,7 +231,6 @@
                 <template slot-scope="scope">
                   <el-input
                     v-model.number="scope.row.num"
-                    size="small"
                     oninput="value=value.replace(/[^\d]/g,'')"
                     style="width: 100%"
                     placeholder="输入数量"
@@ -310,8 +271,8 @@
       </div>
     </div>
     <div slot="footer" class="dialog_footer">
-      <el-button size="small" type="primary" @click="submit">提交</el-button>
-      <el-button size="small" @click="handleClose">关闭</el-button>
+      <el-button type="primary" @click="submit">提交</el-button>
+      <el-button @click="handleClose">关闭</el-button>
     </div>
     <RuleItemSelection
       ref="ruleItemSelectionRef"
@@ -342,6 +303,7 @@
   import { getDetail, getCode } from '@/api/ruleManagement/matter';
   import { saveOrUpdate } from '@/api/maintenance/patrol_maintenance';
   import { deepClone } from '@/utils';
+  import { getById } from '@/api/maintenance/patrol_maintenance';
   export default {
     name: 'addPatrolPlanDialog',
     components: {
@@ -352,14 +314,7 @@
       RuleItemSelection,
       AddSpareDialog
     },
-    props: {
-      dialogTitle: {
-        type: String,
-        default: () => {
-          return '新增巡点检计划';
-        }
-      }
-    },
+    props: {},
     data () {
       return {
         defaultProps: {
@@ -398,13 +353,7 @@
           executorId: '', // 巡点检人员id
           remark: '', // 备注
           categoryId: '', //
-          planType: 'PATROL', // 计划规则类型 巡点检: 'PATROL', 保养: 'MAINTAIN', 盘点: 'INVENTORY'
-          // 计划规则设备列表
-          sparePartsApply: {
-            sourceType: 1,
-            status: 0,
-            sparePartsApplyDetailList: []
-          }
+          planType: 'PATROL' // 计划规则类型 巡点检: 'PATROL', 保养: 'MAINTAIN', 盘点: 'INVENTORY'
         },
         // 计划规则设备列表
         planDeviceList: [
@@ -446,33 +395,48 @@
         ruleNameList: [],
         equipmentList: [],
         currentNode: null,
-        rootId: null
+        rootId: null,
+        dialogTitle: '新增保养计划配置'
       };
     },
     computed: {},
-    watch: {
-      addPatrolPlanDialog (val) {
-        if (val) {
-          this.formLabel = this.dialogTitle.includes('巡点检')
-            ? '巡点检'
-            : this.dialogTitle.includes('保养')
-            ? '保养'
-            : '盘点';
-          const planRuleTypeObj = {
-            巡点检: 'PATROL',
-            保养: 'MAINTAIN',
-            盘点: 'INVENTORY'
-          };
-          this.addForm.planType = planRuleTypeObj[this.formLabel];
+    async created () {},
+    methods: {
+      open (title, row) {
+        this.dialogTitle = title;
+        this.formLabel = this.dialogTitle.includes('巡点检')
+          ? '巡点检'
+          : this.dialogTitle.includes('保养')
+          ? '保养'
+          : '盘点';
+        const planRuleTypeObj = {
+          巡点检: 'PATROL',
+          保养: 'MAINTAIN',
+          盘点: 'INVENTORY'
+        };
 
-          // 获取规则名称
-          this._getRuleNameList();
+        if (row?.id) {
+          // 编辑
+          this.addForm.id = row.id;
+          this.getInfo(this.addForm.id);
+        } else {
+          // 新增
+          this.addForm.planType = planRuleTypeObj[this.formLabel];
           this.getOrderCode(this.dialogTitle);
         }
-      }
-    },
-    async created () {},
-    methods: {
+        // 获取规则名称
+        this._getRuleNameList();
+        this.addPatrolPlanDialog = true;
+      },
+      async getInfo (id) {
+        const res = await getById(id);
+
+        const data = res.data;
+
+        this.addForm = data;
+
+        this._getEquipmentList();
+      },
       // 获取计划配置单号
       async getOrderCode (tips) {
         if (tips.includes('巡点检')) {
@@ -480,7 +444,7 @@
           this.$set(this.addForm, 'code', data);
         }
         if (tips.includes('保养')) {
-          const code = await getCode('maintainconfig_code');
+          const code = await getCode('maintenance_code');
           this.$set(this.addForm, 'code', code);
         }
       },
@@ -521,17 +485,14 @@
           groupId: '', // 巡点检部门code
           executorId: '', // 巡点检人员id
           remark: '', // 备注
-          planType: 'PATROL', // 计划规则类型 巡点检: 'PATROL', 保养: 'MAINTAIN', 盘点: 'INVENTORY'
-
-          sparePartsApply: {
-            sourceType: 1,
-            status: 0,
-            sparePartsApplyDetailList: []
-          }
+          planType: 'PATROL' // 计划规则类型 巡点检: 'PATROL', 保养: 'MAINTAIN', 盘点: 'INVENTORY'
         };
       },
       getRootId (val) {
         this.rootId = val;
+        if (this.addForm?.id) {
+          this._getEquipmentList();
+        }
       },
       // 设备分类选择
       async handleEquipmentClassChange (item) {
@@ -553,10 +514,13 @@
       },
       // 封装 - 获取设备分类列表
       async _getEquipmentList (val) {
+        if (!((val || this.addForm.categoryId) && this.rootId)) {
+          return;
+        }
         const params = {
           pageNum: 1,
           size: -1,
-          categoryId: val,
+          categoryId: val || this.addForm.categoryId,
           rootCategoryLevelId: this.rootId
         };
         try {
@@ -583,17 +547,23 @@
             this.planDeviceList[0]['equiLocationCode'] = equiLocationCode;
 
             // 对比详情返回的数据和设备分类下面所有的设备列表,将sparePart同步过去
-            if (this.addForm.deviceInfo) {
+            if (this.addForm.planDeviceList) {
               for (let i = 0; i < this.planDeviceList.length; i++) {
-                for (let j = 0; j < this.addForm.deviceInfo.length; j++) {
+                for (let j = 0; j < this.addForm.planDeviceList.length; j++) {
                   if (
-                    this.planDeviceList[i].code ===
-                    this.addForm.deviceInfo[j].substanceCode
+                    this.planDeviceList[i].id ===
+                    this.addForm.planDeviceList[j].deviceId
                   ) {
+                    this.$refs.equiListTree.setChecked(
+                      this.planDeviceList[i].id,
+                      true
+                    );
+                    this.planDeviceList[i]['workItems'] =
+                      this.addForm.planDeviceList[j]['workItems'];
                     this.planDeviceList[i]['sparePart'] =
-                      this.addForm.deviceInfo[j]['sparePart'];
-                    // this.$set(this.planDeviceList[i],'totalCost',this.addForm.deviceInfo[j]['totalCost'])
-                    // this.planDeviceList[i]['totalCost'] = this.addForm.deviceInfo[j]['totalCost']
+                      this.addForm.planDeviceList[j]['sparePart'];
+                    // this.$set(this.planDeviceList[i],'totalCost',this.addForm.planDeviceList[j]['totalCost'])
+                    // this.planDeviceList[i]['totalCost'] = this.addForm.planDeviceList[j]['totalCost']
                   }
                 }
               }
@@ -613,15 +583,10 @@
       },
       // 封装 - 获取设备位置名称和code方法
       getEquiLocation (data) {
-        // 设备位置名称
-        const path = data.position[0].path;
-        const arry = [];
-        path.map((item) => {
-          arry.push(item.name);
-        });
-        const equiLocation = arry.join('/');
         // 设备位置编码
         const equiLocationCode = data.position[0].pathIds;
+        // 设备位置名称
+        const equiLocation = data.position[0].pathName;
         return { equiLocation, equiLocationCode };
       },
       // 设备列表树点击

+ 290 - 0
src/views/maintenance/components/detailSelect.vue

@@ -0,0 +1,290 @@
+<template>
+  <el-dialog
+    :visible.sync="visible"
+    title="选择备品备件"
+    width="90vw"
+    append-to-body
+  >
+    <el-form :model="formData" label-width="120px">
+      <el-row>
+        <el-col :span="6">
+          <el-form-item label="货位" prop="cargoSpaceCode">
+            <el-input
+              v-model.trim="formData.cargoSpaceCode"
+              placeholder="请输入"
+              size="small"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item :label="`${title}编码`" prop="onlyCode">
+            <el-input
+              v-model.trim="formData.onlyCode"
+              placeholder="请输入"
+              size="small"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="批次号" prop="batchNum">
+            <el-input
+              v-model.trim="formData.batchNum"
+              placeholder="请输入"
+              size="small"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="包装编码" prop="num">
+            <el-input
+              v-model.trim="formData.num"
+              placeholder="请输入"
+              size="small"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="生产日期" prop="time">
+            <el-date-picker
+              v-model="formData.time"
+              type="daterange"
+              style="width: 100%"
+              value-format="yyyy-MM-dd"
+              range-separator="至"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              placeholder="选择日期"
+            >
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="采购日期" prop="productTime">
+            <el-date-picker
+              v-model="formData.productTime"
+              type="daterange"
+              style="width: 100%"
+              value-format="yyyy-MM-dd"
+              range-separator="至"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              placeholder="选择日期"
+            >
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8" style="text-align: right">
+          <el-button @click="reset" icon="el-icon-refresh-left" size="small"
+            >重置</el-button
+          >
+          <el-button
+            type="primary"
+            @click="handleList"
+            icon="el-icon-search"
+            size="small"
+            >搜索</el-button
+          >
+        </el-col>
+      </el-row>
+    </el-form>
+    <div class="info-box">
+      <div class="select-box"><span>已选数量</span> {{ selectedNum }}条</div>
+    </div>
+    <el-table
+      height="60vh"
+      ref="tableRef"
+      :data="tableData"
+      @selection-change="handleSelectionChange"
+      style="width: 100%"
+      :header-cell-style="{ background: '#EEEEEE', border: 'none' }"
+    >
+      <el-table-column label="序号" type="index"></el-table-column>
+      <el-table-column
+        label="货位"
+        prop=""
+        show-overflow-tooltip
+        min-width="200"
+      >
+        <template slot-scope="{ row }">
+          {{ row.warehouseName }}-{{ row.areaName }}-{{ row.shelfCode }}-{{
+            row.cargoSpaceCode
+          }}
+        </template>
+      </el-table-column>
+      <el-table-column
+        :label="`${title}编码`"
+        prop="onlyCode"
+        width="200px"
+      ></el-table-column>
+      <el-table-column label="批次号" prop="batchNum"></el-table-column>
+      <el-table-column
+        label="生产日期"
+        prop="manufactureTime"
+        width="180"
+      ></el-table-column>
+      <el-table-column
+        label="采购日期"
+        prop="procurementTime"
+        width="180"
+      ></el-table-column>
+      <el-table-column
+        :label="`最小包装单元`"
+        prop=""
+        v-if="!infoData.isUnpack"
+      >
+        <template slot-scope="{ row }">
+          {{ row.measurementUnit }}{{ row.unit }}/{{ row.minPackUnit }}
+        </template>
+      </el-table-column>
+      <el-table-column label="包装编码" prop="num"></el-table-column>
+      <el-table-column label="入库时间" prop="createTime"></el-table-column>
+      <el-table-column width="50" type="selection"> </el-table-column>
+    </el-table>
+    <div slot="footer" class="footer">
+      <div>
+        <el-button @click="cancel">取消</el-button>
+        <el-button type="primary" @click="confirm">确定</el-button>
+      </div>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  // import { getWarehouseActualDetail } from '@/api/stockManagement/stockLedger.js'
+  // import { deepClone } from '@/utils'
+
+  export default {
+    props: {
+      tableHeader: {
+        type: Array,
+        default: () => []
+      },
+      title: {
+        type: String,
+        default: ''
+      },
+      warehouseId: {
+        type: [Number, String],
+        default: ''
+      }
+    },
+    data () {
+      return {
+        visible: false,
+        confirmResolve: null,
+        tableData: [],
+        selectList: [],
+        formData: {
+          cargoSpaceCode: '',
+          time: '',
+          productTime: '',
+          batchNum: '',
+          num: '',
+          onlyCode: ''
+        },
+        infoData: {},
+        memo: [],
+        selectionList: []
+      };
+    },
+    computed: {
+      selectedNum () {
+        return this.memo.length + this.selectionList.length;
+      },
+      checkedAll: {
+        get () {
+          return this.tableData.every((item) => item.checked);
+        },
+        set (val) {
+          this.tableData.forEach((item) => (item.checked = val));
+        }
+      }
+    },
+    methods: {
+      open (infoData, memo = []) {
+        this.visible = true;
+        this.batchVisible = false;
+        this.infoData = infoData;
+        this.selectionList = [];
+        this.tableData = [];
+        this.formData = {};
+
+        this.memo = deepClone(memo || []);
+        this.multipleNum = this.memo.length;
+
+        this.handleList();
+
+        return new Promise((res) => (this.confirmResolve = res));
+      },
+      cancel () {
+        this.visible = false;
+      },
+      confirm () {
+        if (!this.selectedNum) {
+          return this.$message.error('请勾选数据');
+        }
+        this.confirmResolve &&
+          this.confirmResolve([...this.memo, ...this.selectionList]);
+        this.cancel();
+      },
+      reset () {
+        this.formData = {};
+        this.handleList();
+      },
+      handleSelectionChange (val) {
+        this.selectionList = val;
+      },
+      // 表格数据
+      async handleList () {
+        // 搜索前把已选缓存
+        this.memo.push(...this.selectionList);
+
+        const params = {
+          assetCode: this.infoData.informationCode,
+          ...this.formData
+        };
+        if (params.time?.length) {
+          params.startTime = params.time[0];
+          params.endTime = params.time[1];
+        }
+        if (params.productTime?.length) {
+          params.startProductTime = params.productTime[0];
+          params.endProductTime = params.productTime[1];
+        }
+        params.warehouseId = this.warehouseId;
+        delete params.time;
+        delete params.productTime;
+        const res = await getWarehouseActualDetail(params);
+        if (res?.success) {
+          this.tableData = res.data;
+          this.$nextTick(() => {
+            this.tableData.map((i) => {
+              const index = this.memo.findIndex(
+                (itm) => i.onlyCode === itm.onlyCode
+              );
+              if (index > -1) {
+                this.memo.splice(index, 1);
+                this.$refs.tableRef.toggleRowSelection(i, true);
+              }
+            });
+          });
+        }
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .info-box {
+    display: flex;
+    justify-content: flex-end;
+    align-items: center;
+    font-size: 14px;
+    padding: 20px 0 5px;
+  }
+
+  .footer {
+    display: flex;
+    justify-content: flex-end;
+  }
+</style>

+ 361 - 0
src/views/maintenance/components/sparepartApply.vue

@@ -0,0 +1,361 @@
+<template>
+  <el-dialog :visible.sync="visible" title="备品备件申请单" width="90%">
+    <div class="sparepart-apply">
+      <div class="select-box">
+        <el-row :gutter="40">
+          <el-col :span="8">
+            <el-form label-position="left" label-width="50px">
+              <el-form-item label="仓库" required>
+                <el-select
+                  filterable
+                  ref="selectRef"
+                  class="w100"
+                  size="small"
+                  v-model="warehouseId"
+                  placeholder="请选择"
+                  @change="handleWarehouseChange"
+                >
+                  <el-option
+                    :key="item.id"
+                    :value="item.id"
+                    :label="item.name"
+                    v-for="(item, index) in warehouseList"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+            </el-form>
+          </el-col>
+          <el-col :span="6">
+            <el-button type="primary" @click="addGoods">添加物品</el-button>
+          </el-col>
+        </el-row>
+      </div>
+      <div class="list-box">
+        <div
+          class="material-item"
+          v-for="(item, index) in registerlist"
+          :key="index"
+        >
+          <el-descriptions
+            title=""
+            :column="3"
+            :labelStyle="{ width: '10%' }"
+            size="medium"
+            border
+          >
+            <el-descriptions-item label="物品编码">
+              {{ item.informationCode }}
+            </el-descriptions-item>
+            <el-descriptions-item label="物品名称">
+              {{ item.informationName }}
+            </el-descriptions-item>
+            <el-descriptions-item label="规格型号">
+              {{ item.specification }}\{{ item.modelType }}
+            </el-descriptions-item>
+            <el-descriptions-item label="单位">
+              <!-- :label="item.isUnpack ? '包装单位' : '计量单位'" `${item.measuringUnit}/${item.minPackUnit}` -->
+              {{ item.isUnpack ? item.measuringUnit : item.minPackUnit }}
+            </el-descriptions-item>
+            <el-descriptions-item label="所需数量" :span="2">
+              <div class="flex-between">
+                {{ item.selectNum || 0 }}{{ item.measuringUnit
+                }}{{
+                  sourceType == 1 ? `/${item.num}${item.measuringUnit}` : ''
+                }}
+                <el-link @click="addSparepart(item)" type="primary">
+                  添加备品备件</el-link
+                >
+              </div>
+            </el-descriptions-item>
+            <!-- <el-descriptions-item label=""> 添加备品备件 </el-descriptions-item> -->
+          </el-descriptions>
+          <el-table
+            border
+            :data="item.tableData"
+            :header-cell-style="{ background: '#F0F3F3' }"
+          >
+            <el-table-column
+              label="序号"
+              type="index"
+              width="80"
+            ></el-table-column>
+            <el-table-column
+              width="160"
+              show-overflow-tooltip
+              label="备品备件编码"
+              prop="onlyCode"
+            ></el-table-column>
+            <el-table-column label="批次号" prop="batchNum"></el-table-column>
+            <el-table-column
+              label="生产日期"
+              width="160"
+              prop="manufactureTime"
+            ></el-table-column>
+            <el-table-column
+              label="采购日期"
+              width="160"
+              prop="procurementTime"
+            ></el-table-column>
+            <el-table-column label="最小包装单元" prop="" v-if="!item.isUnpack"
+              ><template slot-scope="{ row }">
+                {{ row.measurementUnit }}{{ row.unit }}/{{ row.minPackUnit }}
+              </template></el-table-column
+            >
+            <el-table-column label="包装编码" prop="num"></el-table-column>
+            <el-table-column
+              label="货位"
+              prop=""
+              show-overflow-tooltip
+              width="300"
+            >
+              <template slot-scope="{ row }">
+                {{ row.warehouseName }}-{{ row.areaName }}-{{
+                  row.shelfCode
+                }}-{{ row.cargoSpaceCode }}
+              </template></el-table-column
+            >
+            <el-table-column label="操作">
+              <template slot-scope="{ row, $index }">
+                <el-link type="danger" @click="handleDelete(item, row, $index)"
+                  >删除</el-link
+                >
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+      </div>
+    </div>
+    <div slot="footer" class="footer">
+      <el-button @click="cancel">取消</el-button>
+      <el-button type="primary" @click="submit">提交</el-button>
+    </div>
+    <AssetsDialog
+      ref="assetsDialogRef"
+      title="备品备件"
+      :warehousingMaterialList="registerlist"
+      :assetType="7"
+      :warehouseId="warehouseId"
+      @selectTableData="onSelectTableData"
+    />
+
+    <detailSelect ref="detailSelectRef" :warehouseId="warehouseId" />
+  </el-dialog>
+</template>
+
+<script>
+  // import detailSelect from './detailSelect.vue'
+  // import {
+  //   getSparePartsApplyDetail,
+  //   sparePartsApplySave
+  // } from '@/api/stockManagement/stocking'
+  // import { warehouseListValuable } from '@/api/stockManagement/warehouseDefinition'
+  // import AssetsDialog from '@/views/warehouseManagement/components/AssetsDialog.vue'
+  // import { deepClone } from '@/utils'
+  export default {
+    components: { detailSelect, AssetsDialog },
+    props: {
+      sourceType: {
+        type: Number, //1,保养工单;2,维修工单
+        required: true
+      }
+    },
+    data () {
+      return {
+        visible: false,
+        registerlist: [],
+        warehouseIdOld: '',
+        warehouseId: '',
+        warehouseList: [],
+        row: {},
+        planList: []
+      };
+    },
+    methods: {
+      open (row) {
+        this.row = row;
+        this.warehouseId = '';
+        this.warehouseIdOld = '';
+        this.registerlist = [];
+        this._getWarehouse();
+        if (this.sourceType == 1) {
+          this._getSparePartsApplyDetail(row.planCode);
+        }
+        this.visible = true;
+      },
+      async submit () {
+        const params = {
+          sparePartsApplyDetailList: this.registerlist
+            .filter((i) => i.tableData.length)
+            .map((i) => i.tableData)
+            .flat()
+            .map((i) => {
+              delete i.id;
+              return {
+                informationCode: i.assetCode,
+                informationName: i.assetName,
+                assetCode: i.onlyCode
+              };
+            }),
+          sourceCode: this.row.workOrderCode,
+          sourceId: this.row.id,
+          sourceType: this.sourceType
+        };
+
+        if (!params.sparePartsApplyDetailList.length) {
+          return this.$message.error('请添加备品备件!');
+        }
+
+        const res = await sparePartsApplySave(params);
+
+        if (res?.success) {
+          this.$message.success('提交成功!');
+          this.visible = false;
+          this.$emit('success');
+        }
+      },
+      cancel () {
+        this.visible = false;
+      },
+      addSparepart (item) {
+        if (!this.warehouseId) {
+          return this.$message.error('请选择仓库!');
+        }
+        this.$refs.detailSelectRef.open(item, item.tableData).then((res) => {
+          item.tableData = res;
+
+          const obj = this.planList.find((i) => i.curId === item.curId);
+
+          item.selectNum = item.tableData.reduce((next, pre) => {
+            next += pre.isUnpack ? 1 : pre.measurementUnit || 0;
+
+            return next;
+          }, 0);
+          if (!obj) {
+            // 非计划
+            item.num = item.selectNum;
+          }
+        });
+      },
+      // 切换仓库清空选择
+      handleWarehouseChange () {
+        if (
+          this.registerlist.length > this.planList.length ||
+          this.registerlist.some((i) => i.tableData.length)
+        ) {
+          Promise.resolve().then(() => {
+            this.$refs.selectRef.blur();
+            if (this.warehouseIdOld) {
+              this.$confirm(
+                '仓库修改后,已添加的备品备件信息将会被清空,是否要继续修改仓库?'
+              )
+                .then(() => {
+                  this.registerlist = deepClone(this.planList);
+                  this.warehouseIdOld = this.warehouseId;
+                })
+                .catch(() => {
+                  this.warehouseId = this.warehouseIdOld;
+                });
+            } else {
+              this.registerlist = deepClone(this.planList);
+              this.warehouseIdOld = this.warehouseId;
+            }
+          });
+        }
+      },
+      handleDelete (item, row, index) {
+        this.$confirm(`确定删除${row.onlyCode}?`).then(() => {
+          item.tableData.splice(index, 1);
+        });
+      },
+      async _getSparePartsApplyDetail (planCode) {
+        const res = await getSparePartsApplyDetail({ planCode });
+        if (res?.success) {
+          this.registerlist = res.data.map((item) => ({
+            ...item,
+            selectNum: 0,
+            curId: item.informationCode,
+            tableData: []
+          }));
+
+          this.planList = deepClone(this.registerlist);
+        }
+      },
+      addGoods () {
+        if (!this.warehouseId) {
+          return this.$message.error('请选择仓库!');
+        }
+        this.$refs.assetsDialogRef.open();
+      },
+      // 选择物品
+      onSelectTableData (selectList) {
+        this.registerlist = this.registerlist.filter((item) => {
+          const index = selectList.findIndex((i) => i.curId === item.curId);
+
+          if (index > -1) {
+            selectList.splice(index, 1);
+          }
+
+          return index > -1;
+        });
+
+        this.registerlist.push(
+          ...selectList.map((item) => {
+            return {
+              curId: item.curId,
+              isUnpack: item.isUnpack,
+              informationCode: item.assetCode || item.informationCode,
+              informationName: item.assetName || item.informationName,
+              specification: item.specification,
+              minPackUnit: item.minPackUnit,
+              modelType: item.modelType,
+              measuringUnit: item.unit || item.measuringUnit,
+              tableData: item.tableData || [],
+              num: 0,
+              selectNum: 0
+            };
+          })
+        );
+      },
+      async _getWarehouse () {
+        if (this.warehouseList.length) return;
+        const res = await warehouseListValuable();
+        if (res?.success) {
+          this.warehouseList = res.data.filter((i) => !!i.status);
+        }
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .sparepart-apply {
+    min-height: 40vh;
+    .select-box {
+      margin-bottom: 10px;
+    }
+    .material-item {
+      width: 100%;
+    }
+    .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;
+  }
+</style>

+ 7 - 3
src/views/maintenance/equipment/plan/details.vue

@@ -19,12 +19,16 @@
               </el-col>
               <el-col :span="12">
                 <el-form-item label="保养部门">
-                  <!-- <span> {{ data.executorDeptName }} </span> -->
+                  <span v-if="data.executor && data.executor.length">
+                    {{ data.executor[0].groupName }}
+                  </span>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
                 <el-form-item label="保养人员">
-                  <!-- <span> {{ data.executorName }} </span> -->
+                  <span v-if="data.executor && data.executor.length">
+                    {{ data.executor.map((i) => i.name).join(',') }}
+                  </span>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
@@ -49,7 +53,7 @@
               </el-col>
               <el-col :span="12">
                 <el-form-item label="创建部门">
-                  <!-- <span> {{ data.createOrgName }} </span> -->
+                  <span> {{ data.createUserGroupName }} </span>
                 </el-form-item>
               </el-col>
               <el-col :span="12">

+ 26 - 21
src/views/maintenance/equipment/plan/index.vue

@@ -16,17 +16,9 @@
             type="primary"
             icon="el-icon-plus"
             class="ele-btn-icon"
-            @click="openEdit()"
+            @click="openAdd('新增巡点检计划')"
           >
-            新建
-          </el-button>
-          <el-button
-            size="small"
-            type="primary"
-            class="ele-btn-icon"
-            @click="goDetail()"
-          >
-            详情
+            新建临时计划
           </el-button>
         </template>
         <!-- 	     <template v-slot:enable="{ row }">
@@ -47,6 +39,14 @@
         </template>
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="openAdd('编辑巡点检计划', row)"
+          >
+            编辑
+          </el-link>
           <el-link
             type="primary"
             :underline="false"
@@ -68,11 +68,7 @@
     </el-card>
 
     <!-- 新建或编辑弹窗 -->
-    <AddPatrolPlanDialog
-      ref="addPatrolPlanDialogRef"
-      :dialogTitle="dialogTitle"
-      @refreshList="reload"
-    />
+    <AddPatrolPlanDialog ref="addPatrolPlanDialogRef" @refreshList="reload" />
   </div>
 </template>
 
@@ -183,7 +179,6 @@
         // 加载状态
         loading: false,
         pageType: 'add',
-        dialogTitle: '',
         isBindPlan: false
       };
     },
@@ -208,12 +203,22 @@
       reload (where) {
         this.$refs.table.reload({ page: 1, where });
       },
+      handleWithdraw (row) {
+        // 撤回
 
-      openEdit (row) {
-        this.$refs.addPatrolPlanDialogRef.addPatrolPlanDialog = true;
-        this.$refs.addPatrolPlanDialogRef.$refs.addFormRef &&
-          this.$refs.addPatrolPlanDialogRef.$refs.addFormRef.clearValidate();
-        this.dialogTitle = '新增保养计划';
+        this.$confirm(`确认撤回计划${row.name}?`, '提示').then(async () => {
+          revocation(row.id)
+            .then(() => {
+              this.$message.success('撤回成功!');
+              this.reload();
+            })
+            .catch((err) => {
+              this.$message.success(err.message || '撤回失败!');
+            });
+        });
+      },
+      openAdd (dialogTitle, row) {
+        this.$refs.addPatrolPlanDialogRef.open(dialogTitle, row);
       },
 
       goDetail ({ id }) {

+ 8 - 4
src/views/maintenance/patrol/plan/details.vue

@@ -14,7 +14,7 @@
               </el-col>
               <el-col :span="12">
                 <el-form-item label="来源计划配置单号">
-                  <!-- <span> {{ data.planRuleCode }} </span> -->
+                  <span> {{ data.planConfigCode }} </span>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
@@ -24,12 +24,16 @@
               </el-col>
               <el-col :span="12">
                 <el-form-item label="巡点检部门">
-                  <!-- <span> {{ data.executorDeptName }} </span> -->
+                  <span v-if="data.executor && data.executor.length">
+                    {{ data.executor[0].groupName }}
+                  </span>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
                 <el-form-item label="巡点检人员">
-                  <!-- <span> {{ data.executorName }} </span> -->
+                  <span v-if="data.executor && data.executor.length">
+                    {{ data.executor.map((i) => i.name).join(',') }}
+                  </span>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
@@ -61,7 +65,7 @@
               </el-col>
               <el-col :span="12">
                 <el-form-item label="创建部门">
-                  <!-- <span> {{ data.createOrgName }} </span> -->
+                  <span> {{ data.createUserGroupName }} </span>
                 </el-form-item>
               </el-col>
               <el-col :span="12">

+ 29 - 13
src/views/maintenance/patrol/plan/index.vue

@@ -16,7 +16,7 @@
             type="primary"
             icon="el-icon-plus"
             class="ele-btn-icon"
-            @click="openEdit()"
+            @click="openAdd('新增巡点检计划')"
           >
             新建临时计划
           </el-button>
@@ -43,7 +43,15 @@
             type="primary"
             :underline="false"
             icon="el-icon-edit"
-            @click="openEdit(row)"
+            @click="openAdd('编辑巡点检计划', row)"
+          >
+            编辑
+          </el-link>
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="openAdd('新增巡点检计划')"
           >
             派单
           </el-link>
@@ -51,7 +59,7 @@
             type="primary"
             :underline="false"
             icon="el-icon-edit"
-            @click="openEdit(row)"
+            @click="handleWithdraw(row)"
           >
             撤回
           </el-link>
@@ -60,18 +68,14 @@
     </el-card>
 
     <!-- 新建或编辑弹窗 -->
-    <AddPatrolPlanDialog
-      ref="addPatrolPlanDialogRef"
-      :dialogTitle="dialogTitle"
-      @refreshList="reload"
-    />
+    <AddPatrolPlanDialog ref="addPatrolPlanDialogRef" @refreshList="reload" />
   </div>
 </template>
 
 <script>
   import AddPatrolPlanDialog from '@/components/addPatrolPlanDialog';
   import PlanSearch from './components/plan-search.vue';
-  import { getPage } from '@/api/maintenance/patrol_maintenance';
+  import { getPage, revocation } from '@/api/maintenance/patrol_maintenance';
   export default {
     components: {
       PlanSearch,
@@ -175,7 +179,6 @@
         // 加载状态
         loading: false,
         pageType: 'add',
-        dialogTitle: '',
         isBindPlan: false
       };
     },
@@ -200,10 +203,23 @@
       reload (where) {
         this.$refs.table.reload({ page: 1, where });
       },
+      handleWithdraw (row) {
+        // 撤回
+
+        this.$confirm(`确认撤回计划${row.name}?`, '提示').then(async () => {
+          revocation(row.id)
+            .then(() => {
+              this.$message.success('撤回成功!');
+              this.reload();
+            })
+            .catch((err) => {
+              this.$message.success(err.message || '撤回失败!');
+            });
+        });
+      },
 
-      openEdit (row) {
-        this.$refs.addPatrolPlanDialogRef.addPatrolPlanDialog = true;
-        this.dialogTitle = '新增巡点检计划';
+      openAdd (dialogTitle, row) {
+        this.$refs.addPatrolPlanDialogRef.open(dialogTitle, row);
       },
 
       goDetail ({ id }) {

+ 10 - 43
src/views/maintenance/repair/repairNotes/components/addDialog.vue

@@ -9,9 +9,7 @@
   >
     <div class="dialog_top">
       <!-- <div>报修记录编号:{{ addForm.repairsCode }}</div> -->
-      <el-button type="primary" size="small" @click="selectEquipment"
-        >选择设备</el-button
-      >
+      <el-button type="primary" @click="selectEquipment">选择设备</el-button>
     </div>
     <div class="main_container">
       <el-form :model="addForm" :rules="addFormRules" label-width="120px">
@@ -21,7 +19,6 @@
               <el-input
                 v-model="addForm.equiCode"
                 placeholder="选择设备带出"
-                size="small"
                 disabled
               ></el-input>
             </el-form-item>
@@ -30,7 +27,6 @@
             <el-form-item label="权属部门:" prop="ownerDeptName">
               <el-input
                 v-model="addForm.ownerDeptName"
-                size="small"
                 placeholder="选择设备带出"
                 disabled
               ></el-input>
@@ -42,7 +38,6 @@
             <el-form-item label="设备名称:" prop="equiName">
               <el-input
                 v-model="addForm.equiName"
-                size="small"
                 placeholder="选择设备带出"
                 disabled
               ></el-input>
@@ -52,7 +47,6 @@
             <el-form-item label="权属人:" prop="ownerName">
               <el-input
                 v-model="deviceData.ownerName"
-                size="small"
                 placeholder="选择设备带出"
                 disabled
               ></el-input>
@@ -64,7 +58,6 @@
             <el-form-item label="固定资产编码:" prop="fixedAssetCode">
               <el-input
                 v-model="addForm.fixedAssetCode"
-                size="small"
                 placeholder="选择设备带出"
                 disabled
               ></el-input>
@@ -74,7 +67,6 @@
             <el-form-item label="权属人电话:" prop="ownerPhone">
               <el-input
                 v-model="deviceData.ownerPhone"
-                size="small"
                 placeholder="选择设备带出"
                 disabled
               ></el-input>
@@ -86,7 +78,6 @@
             <el-form-item label="规格型号:" prop="equiModel">
               <el-input
                 v-model="addForm.equiModel"
-                size="small"
                 placeholder="选择设备带出"
                 disabled
               ></el-input>
@@ -96,7 +87,6 @@
             <el-form-item label="设备位置:" prop="equiLocation">
               <el-input
                 v-model="deviceData.equiLocation"
-                size="small"
                 placeholder="选择设备带出"
                 disabled
               ></el-input>
@@ -106,20 +96,7 @@
         <el-row>
           <el-col :span="12">
             <el-form-item label="接收人部门:" prop="recipient">
-              <!--              <selectTree
-                class="form-ipt"
-                style="width: 100%"
-                ref="tree"
-                :value="recipientDep"
-                :options="recipientDepList"
-                :props="{
-                  value: 'code',
-                  label: 'name',
-                  children: 'children'
-                }"
-                @getValue="nodeClick"
-              >
-              </selectTree> -->
+              <dept-select v-model="addForm.recipientdept" />
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -129,7 +106,6 @@
                 type="datetime"
                 style="width: 100%"
                 placeholder="选择日期时间"
-                size="small"
                 value-format="yyyy-MM-dd HH:mm:ss"
               >
               </el-date-picker>
@@ -138,20 +114,7 @@
 
           <el-col :span="12">
             <el-form-item label="接收人:" prop="recipient">
-              <el-select
-                v-model="addForm.recipient"
-                size="small"
-                multiple
-                style="width: 100%"
-                @focus="focusRecipient"
-              >
-                <el-option
-                  v-for="item in recipientList"
-                  :key="item.userId"
-                  :value="item.userId + ',' + item.trueName"
-                  :label="item.trueName"
-                ></el-option>
-              </el-select>
+              <person-select v-model="addForm.recipient" multiple clearable />
             </el-form-item>
           </el-col>
           <el-col :span="24">
@@ -185,8 +148,8 @@
       </el-form>
     </div>
     <div class="btns">
-      <el-button type="primary" size="small" @click="submitAdd">提交</el-button>
-      <el-button size="small" @click="handleClose">关闭</el-button>
+      <el-button type="primary" @click="submitAdd">提交</el-button>
+      <el-button @click="handleClose">关闭</el-button>
     </div>
     <CategoryDialog
       ref="equipmentDialogRef"
@@ -198,6 +161,8 @@
 
 <script>
   import CategoryDialog from '@/components/AssetDialog/categoryDialog';
+  import DeptSelect from '@/components/CommomSelect/dept-select.vue';
+  import PersonSelect from '@/components/CommomSelect/person-select.vue';
 
   export default {
     props: {
@@ -215,7 +180,9 @@
       }
     },
     components: {
-      CategoryDialog
+      CategoryDialog,
+      DeptSelect,
+      PersonSelect
       // SelectUpload, selectTree
     },
     watch: {

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

@@ -20,26 +20,12 @@
           >
             新建
           </el-button>
-          <el-button
-            size="small"
-            type="primary"
-            class="ele-btn-icon"
-            @click="goDetail({ id: 12 })"
-          >
-            详情
-          </el-button>
         </template>
-        <!-- 	     <template v-slot:enable="{ row }">
-	       <el-switch
-	         v-model="row.enable"
-	         active-color="#13ce66"
-	         inactive-color="#ff4949"
-	         :active-value="1"
-	         :inactive-value="0"
-	         @change="changeEnable(row)"
-	       >
-	       </el-switch>
-	     </template> -->
+        <template v-slot:code="{ row }"
+          ><el-link type="primary" :underline="false" @click="goDetail(row)">
+            {{ row.code }}
+          </el-link></template
+        >
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
           <el-link
@@ -48,7 +34,23 @@
             icon="el-icon-edit"
             @click="openEdit(row)"
           >
-            撤回
+            委外
+          </el-link>
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="openEdit(row)"
+          >
+            修改
+          </el-link>
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="openEdit(row)"
+          >
+            撤销
           </el-link>
         </template>
       </ele-pro-table>
@@ -73,7 +75,7 @@
 </template>
 
 <script>
-  import { getPage } from '@/api/maintenance/repair';
+  import { getPage } from '@/api/maintenance/repair_report';
   // import AddPatrolPlanDialog from '@/components/addPatrolPlanDialog'
   import NotesSearch from './components/notes-search.vue';
   import AddDialog from './components/addDialog.vue';
@@ -99,6 +101,8 @@
             fixed: 'left'
           },
           {
+            columnKey: 'code',
+            slot: 'code',
             prop: 'code',
             label: '报修记录编码',
             align: 'center',
@@ -127,7 +131,7 @@
             minWidth: 110
           },
           {
-            prop: 'sourceType',
+            prop: 'sourceType1',
             label: '来源',
             align: 'center',
             showOverflowTooltip: true,
@@ -166,11 +170,11 @@
           },
           {
             columnKey: 'action',
+            slot: 'action',
             label: '操作',
             width: 230,
             align: 'center',
             resizable: false,
-            slot: 'action',
             showOverflowTooltip: true
           }
         ],

+ 60 - 50
src/views/maintenance/repair/workOrder/components/workorder-search.vue

@@ -1,7 +1,7 @@
 <!-- 搜索表单 -->
 <template>
   <el-form
-    label-width="50px"
+    label-width="80px"
     class="ele-form-search"
     @keyup.enter.native="search"
     @submit.native.prevent
@@ -19,77 +19,87 @@
         </el-form-item>
       </el-col>
       <el-col v-bind="styleResponsive ? { lg: 5, md: 12 } : { span: 5 }">
-        <el-form-item label="执行人:"  label-width="80px">
-          <el-input clearable v-model="where.dep" placeholder="请输入" />
+        <el-form-item label="执行人:">
+          <el-input
+            clearable
+            v-model="where.executeUserName"
+            placeholder="请输入"
+          />
         </el-form-item>
       </el-col>
       <el-col v-bind="styleResponsive ? { lg: 9, md: 12 } : { span: 9 }">
-            <el-form-item label="创建时间:" label-width="80px">
-            	<el-date-picker
-            		v-model="where.time"
-            		type="daterange"
-            		range-separator="至"
-            		start-placeholder="开始日期"
-            		end-placeholder="结束日期"
-            		value-format="yyyy-MM-dd HH:mm:ss"
-            		:default-time="['00:00:00', '23:59:59']"
-            		>
-            	</el-date-picker>
-            </el-form-item>
-			<div class="ele-form-actions">
-				<el-button
-					type="primary"
-					icon="el-icon-search"
-					class="ele-btn-icon"
-					@click="search"
-					size="small"
-				>
-					查询
-				</el-button>
-				 <el-button @click="reset"
-					 icon="el-icon-refresh-left"
-					 size="small"
-					 type="primary"
-				 >重置</el-button>
-			</div>
+        <el-form-item label="创建时间:">
+          <el-date-picker
+            v-model="where.time"
+            type="daterange"
+            range-separator="至"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            :default-time="['00:00:00', '23:59:59']"
+          >
+          </el-date-picker>
+        </el-form-item>
+        <div class="ele-form-actions">
+          <el-button
+            type="primary"
+            icon="el-icon-search"
+            class="ele-btn-icon"
+            @click="search"
+            size="small"
+          >
+            查询
+          </el-button>
+          <el-button
+            @click="reset"
+            icon="el-icon-refresh-left"
+            size="small"
+            type="primary"
+            >重置</el-button
+          >
+        </div>
       </el-col>
     </el-row>
   </el-form>
 </template>
 
 <script>
-  import { login } from '@/api/login';
   export default {
-    data() {
+    data () {
       // 默认表单数据
       const defaultWhere = {
-        name: '',
+        staus: '',
         code: '',
-        fixCode:'',
-        ownershipGroupId:''
+        time: [],
+        executeUserName: ''
       };
       return {
         // 表单数据
         where: { ...defaultWhere },
-        treeData:[]
+        treeData: []
       };
     },
     computed: {
       // 是否开启响应式布局
-      styleResponsive() {
+      styleResponsive () {
         return this.$store.state.theme.styleResponsive;
       }
     },
-    created(){
-    },
+    created () {},
     methods: {
       /* 搜索 */
-      search() {
-        console.log(this.where);
-        this.$emit('search', this.where);
+      search () {
+        const where = this.where;
+
+        if (where.time?.length) {
+          where.startTime = where.time[0];
+          where.endTime = where.time[1];
+        }
+
+        this.$emit('search', where);
       },
       /*  重置 */
-      reset() {
+      reset () {
         this.where = { ...this.defaultWhere };
         this.search();
       }
@@ -97,9 +107,9 @@
   };
 </script>
 <style lang="scss" scoped>
-    .ele-form-actions{
-		display:flex;
-		align-items: center;
-		justify-content: flex-end;
-	}
-</style>
+  .ele-form-actions {
+    display: flex;
+    align-items: center;
+    justify-content: flex-end;
+  }
+</style>

+ 166 - 177
src/views/maintenance/repair/workOrder/index.vue

@@ -1,58 +1,48 @@
 <template>
   <div class="ele-body">
-     <el-card shadow="never" v-loading="loading">
-	   <workorder-search @search="reload">
-	   </workorder-search>
-	   <!-- 数据表格 -->
-	   <ele-pro-table
-	     ref="table"
-	     :columns="columns"
-	     :datasource="datasource"
-	     cache-key="systemRoleTable"
-	   >
-	     <!-- 表头工具栏 -->
-	     <template v-slot:toolbar>
-		   <el-button
-		     size="small"
-		     type="primary"
-		     class="ele-btn-icon"
-		     @click="goDetail({id:1})"
-		   >
-		     详情
-		   </el-button>
-	     </template>
-		 <!-- 操作列 -->
-		 <template v-slot:action="{ row }">
-			 <el-link
-			   type="primary"
-			   :underline="false"
-			   icon="el-icon-truck"
-			 >
-			   申请备品备件
-			 </el-link>
-			   <el-link
-				 type="primary"
-				 :underline="false"
-				 icon="el-icon-edit"
-			   >
-				 报工
-			   </el-link>
-			 <el-link
-				 type="primary"
-				 :underline="false"
-				 icon="el-icon-edit"
-				  @click="toRedeploy(row)"
-			 >
-			 	转派
-			 </el-link>
-		 </template>
+    <el-card shadow="never" v-loading="loading">
+      <workorder-search @search="reload"> </workorder-search>
+      <!-- 数据表格 -->
+      <ele-pro-table
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        cache-key="systemRoleTable"
+      >
+        <!-- 表头工具栏 -->
+        <!-- <template v-slot:toolbar>
+          <el-button
+            size="small"
+            type="primary"
+            class="ele-btn-icon"
+            @click="goDetail({ id: 1 })"
+          >
+            详情
+          </el-button>
+        </template> -->
+        <!-- 操作列 -->
+        <template v-slot:action="{ row }">
+          <el-link type="primary" :underline="false" icon="el-icon-truck">
+            申请备品备件
+          </el-link>
+          <el-link type="primary" :underline="false" icon="el-icon-edit">
+            报工
+          </el-link>
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="toRedeploy(row)"
+          >
+            转派
+          </el-link>
+        </template>
+      </ele-pro-table>
+    </el-card>
 
-	   </ele-pro-table>
-     </el-card>
-	 
-	 <RepairDetailsDialog ref="detailsDialogRef" />
-	 <!-- 转派弹窗 -->
-	 <redeployOther ref="redeployOtherRef" @refresh="reload" />
+    <RepairDetailsDialog ref="detailsDialogRef" />
+    <!-- 转派弹窗 -->
+    <redeployOther ref="redeployOtherRef" @refresh="reload" />
   </div>
 </template>
 
@@ -60,129 +50,132 @@
   import WorkorderSearch from './components/workorder-search.vue';
   import RepairDetailsDialog from '../components/RepairDetailsDialog.vue';
   import redeployOther from '@/views/maintenance/components/redeployOther.vue';
-  import { pageRoles } from '@/api/system/role'; 
+  import { getWorkOrderList } from '@/api/maintenance/repair';
   export default {
     components: {
       WorkorderSearch,
-	  RepairDetailsDialog,
-	  redeployOther
+      RepairDetailsDialog,
+      redeployOther
     },
     data () {
       return {
-		// 表格列配置
-		columns: [
-		  {
-		    columnKey: 'index',
-		    label: '序号',
-		    type: 'index',
-		    width: 55,
-		    align: 'center',
-		    showOverflowTooltip: true,
-		    fixed: 'left'
-		  },
-		  {
-		    prop: 'workOrderCode',
-		    label: '工单编号',
-		    align: 'center',	
-		    showOverflowTooltip: true,
-		    minWidth: 110
-		  },
-		  {
-		    prop: 'planCode',
-		    label: '计划单号',
-		    align: 'center',
-		    showOverflowTooltip: true,
-		    minWidth: 110
-		  },
-		  {
-		    prop: 'planName',
-		    label: '计划名称',
-		    align: 'center',	
-		    showOverflowTooltip: true,
-		    minWidth: 110
-		  },
-		  {
-		    prop: 'equiCode',
-		    label: '设备编号',
-		    align: 'center',	
-		    showOverflowTooltip: true,
-		    minWidth: 110
-		  },
-		  {
-		    prop: 'equiName',
-		    label: '设备名称',
-		    align: 'center',	
-		    showOverflowTooltip: true,
-		    minWidth: 110
-		  },
-			{
-			  prop: 'executeUserName',
-			  label: '执行人',
-			  align: 'center',	
-			  showOverflowTooltip: true,
-			  minWidth: 110
-			},
-			{
-			  prop: 'planFinishTime',
-			  label: '计划完成时间',
-			  align: 'center',	
-			  showOverflowTooltip: true,
-			  minWidth: 110
-			},
-		  {
-		    prop: 'acceptTime',
-		    label: '开工时间',
-		    align: 'center',	
-		    showOverflowTooltip: true,
-		    minWidth: 110
-		  },
-		  {
-		    prop: 'finishTime',
-		    label: '报工时间',
-		    align: 'center',
-		    showOverflowTooltip: true,
-		    minWidth: 110
-		  },
-			{
-			  prop: 'sj',
-			  label: '实际工时',
-			  align: 'center',
-			  showOverflowTooltip: true,
-			  minWidth: 110
-			},
-			{
-			  prop: 'status',
-			  label: '状态',
-			  align: 'center',
-			  showOverflowTooltip: true,
-			  minWidth: 110
-			},
-			{
-			  columnKey: 'action',
-			  label: '操作',
-			  width: 250,
-			  align: 'center',
-			  resizable: false,
-			  slot: 'action',
-			  showOverflowTooltip: true
-			}
-		],
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'code',
+            label: '工单编号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'planCode',
+            label: '计划单号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'planName',
+            label: '计划名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'equiCode',
+            label: '设备编号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'equiName',
+            label: '设备名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'executeUserName',
+            label: '执行人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'planFinishTime',
+            label: '计划完成时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'acceptTime',
+            label: '开工时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'finishTime',
+            label: '报工时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'sj',
+            label: '实际工时',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'status',
+            label: '状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 250,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ],
         // 加载状态
         loading: false,
         pageType: 'add',
         dialogTitle: '',
-		isBindPlan:false,
+        isBindPlan: false
       };
     },
-    computed: {
-
-    },
+    computed: {},
     methods: {
       /* 表格数据源 */
-      datasource({ page, limit, where, order }) {
-        return pageRoles({ pageNum: page, size: limit, ...where });
+      datasource ({ page, limit, where, order }) {
+        return getWorkOrderList({
+          pageNum: page,
+          size: limit,
+          ...where,
+          type: 3
+        });
       },
-      async changeEnable(row) {
+      async changeEnable (row) {
         const res = await putRoles(row);
         if (res.code == 0) {
           this.$message({
@@ -194,26 +187,22 @@
         }
       },
       /* 刷新表格 */
-      reload(where) {
+      reload (where) {
         this.$refs.table.reload({ page: 1, where });
       },
-	  
-	  
-	  goDetail(row){
-		  row.title = '工单详情'
-		  row.tabLabel = '工单信息'
-		  this.$refs.detailsDialogRef.init(row)
-	  },
-	  
-	  // 转派
-	  toRedeploy(row) {
-	    this.$refs.redeployOtherRef.open(row);
-	  },
-	  
+
+      goDetail (row) {
+        row.title = '工单详情';
+        row.tabLabel = '工单信息';
+        this.$refs.detailsDialogRef.init(row);
+      },
+
+      // 转派
+      toRedeploy (row) {
+        this.$refs.redeployOtherRef.open(row);
+      }
     }
   };
 </script>
 
-<style lang="scss" scoped>
-
-</style>
+<style lang="scss" scoped></style>