2213980799@qq.com 1 год назад
Родитель
Сommit
843d83a4c9

+ 1 - 3
src/views/maintenance/patrol/workOrder/index.vue

@@ -236,9 +236,7 @@ export default {
     reload(where) {
       this.$refs.table.reload({ page: 1, where });
     },
-    // this.form.deviceName = row.substanceDetailVO.name;
-    //       this.form.fixCode = row.substanceDetailVO.fixCode;
-    //       this.form.deviceCode = row.substanceDetailVO.codeNumber;
+
     // 添加备品备件
     async addSpareItems(row) {
       let data = await getWordOrderDetail(row.id);

+ 275 - 0
src/views/sparePartsApply/components/MaterialAdd.vue

@@ -0,0 +1,275 @@
+<template>
+  <el-dialog
+    :title="title"
+    :visible.sync="visible"
+    :before-close="handleClose"
+    class="productModal_dialog"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="90%"
+  >
+    <el-card shadow="never">
+      <ele-split-layout
+        width="244px"
+        allow-collapse
+        :right-style="{ overflow: 'hidden' }"
+      >
+        <div class="ele-border-lighter split-layout-right-content">
+          <el-tree
+            :data="treeList"
+            :props="defaultProps"
+            ref="treeRef"
+            :expand-on-click-node="false"
+            :default-expanded-keys="categoryId ? [categoryId] : []"
+            :highlight-current="true"
+            node-key="id"
+            @node-click="handleNodeClick"
+          ></el-tree>
+        </div>
+
+        <!-- 数据表格 -->
+        <template v-slot:content>
+          <ProductSearch @search="reload" ref="searchRef" />
+          <ele-pro-table
+            height="400"
+            ref="table"
+            :columns="columns"
+            :datasource="datasource"
+            :current.sync="current"
+            highlight-current-row
+            row-key="id"
+            :initLoad="false"
+          >
+            <template v-slot:modelType="{ row }">
+              <span>{{ row.category.modelType }}</span>
+            </template>
+            <template v-slot:specification="{ row }">
+              <span>{{ row.category.specification }}</span>
+            </template>
+            <template v-slot:pathName="{ row }">
+              <span>{{ row.position[0] && row.position[0].pathName }}</span>
+            </template>
+          </ele-pro-table>
+        </template>
+      </ele-split-layout>
+    </el-card>
+
+    <div class="rx-sc">
+      <el-button type="primary" size="small" @click="selected">选择</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import ProductSearch from '@/views/maintenance/components/product-search.vue';
+import { getAssetList } from '@/api/ruleManagement/plan';
+import { getTreeByPid, getTreeByGroup } from '@/api/classifyManage';
+export default {
+  data() {
+    return {
+      ruleIdListIndex: 0,
+      visible: false,
+      title: '选择设备',
+      categoryLevelId: null,
+      categoryId: 1,
+      treeList: [],
+      treeLoading: false,
+      defaultProps: {
+        children: 'children',
+        label: 'name'
+      },
+      type: null,
+      // 表格列配置
+      columns: [
+        {
+          label: '设备名称',
+          prop: 'name'
+        },
+        {
+          label: '编号',
+          prop: 'codeNumber'
+        },
+        {
+          label: '固资编码',
+          prop: 'fixCode'
+        },
+        {
+          label: '使用人',
+          prop: 'usePerson'
+        },
+        {
+          label: '使用岗位',
+          prop: 'postName'
+        },
+        {
+          label: '负责人',
+          prop: 'chargePerson'
+        },
+        {
+          label: '有效开始时间',
+          prop: 'startTime'
+        },
+        {
+          label: '有效结束时间',
+          prop: 'endTime'
+        },
+        {
+          label: '型号',
+          prop: 'modelType',
+          slot: 'modelType'
+        },
+        {
+          label: '规格',
+          prop: 'specification',
+          slot: 'specification'
+        },
+        {
+          label: '设备位置',
+          prop: 'pathName',
+          slot: 'pathName'
+        }
+      ],
+
+      // 表格选中数据
+      current: {}
+    };
+  },
+  components: {
+    ProductSearch
+  },
+  methods: {
+    /* 表格数据源 */
+    async datasource({ page, limit, where }) {
+      const res = await getAssetList({
+        ...where,
+        pageNum: page,
+        size: limit,
+        categoryLevelId: this.categoryLevelId,
+        rootCategoryLevelId: this.rootId
+      });
+      console.log('res---------', res);
+      this.categoryId = res.list[0]?.categoryId;
+      return res;
+    },
+    open() {
+      this.visible = true;
+      this.getTreeData();
+    },
+
+    async getTreeData() {
+      try {
+        this.treeLoading = true;
+        const res = await getTreeByGroup({ type: 4 });
+        console.log('res---treeList----------', res);
+        this.treeLoading = false;
+        if (res?.code === '0') {
+          this.treeList = res.data;
+          return this.treeList;
+        }
+      } catch (error) {
+        console.log(error);
+      }
+      this.treeLoading = false;
+    },
+
+    handleNodeClick(data) {
+      this.rootId = data.rootCategoryLevelId;
+      this.categoryLevelId = data.id;
+      this.$refs.table.reload({ pageNum: 1, where: {} });
+    },
+
+    /* 刷新表格 */
+    reload(where) {
+      if (this.rootId && this.categoryLevelId) {
+        this.$refs.table.reload({ page: 1, where: where });
+      } else {
+        this.$message.error('请选择设备');
+      }
+    },
+
+    handleClose() {
+      this.visible = false;
+    },
+    selected() {
+      if (!this.current.id) {
+        this.$message.error('请至少选择一条数据');
+        return;
+      }
+
+      this.$emit('chooseEquipment', this.current);
+      this.handleClose();
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.productModal_dialog {
+  overflow: hidden;
+  ::v-deep .el-dialog {
+    margin: 50px auto !important;
+    height: 90%;
+    overflow: hidden;
+
+    .el-dialog__body {
+      position: absolute;
+      left: 0;
+      top: 54px;
+      bottom: 0;
+      right: 0;
+      padding: 0;
+      z-index: 1;
+      overflow: hidden;
+      overflow-y: auto;
+      // 下边设置字体,我的需求是黑底白字
+      color: #ffffff;
+      line-height: 30px;
+      padding: 0 15px;
+      display: flex;
+      flex-direction: column;
+      > div {
+        flex: 1;
+        .el-card__body {
+          height: 100%;
+          display: flex;
+          flex-direction: column;
+          box-sizing: border-box;
+          > div {
+            flex: 1;
+            .ele-split-panel-body {
+              display: flex;
+              flex-direction: column;
+              > div {
+                height: 100%;
+                display: flex;
+                flex-direction: column;
+                .el-table {
+                  flex: 1 0 auto;
+                  height: 0;
+                  overflow: auto;
+                }
+              }
+            }
+          }
+        }
+      }
+      .rx-sc {
+        flex: 0 0 50px;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+      }
+    }
+  }
+}
+::v-deep {
+  .el-checkbox__input.is-disabled .el-checkbox__inner {
+    background-color: #c1c1c1 !important;
+  }
+}
+.ml60 {
+  margin-left: 60px;
+}
+</style>

+ 85 - 45
src/views/sparePartsApply/components/edit.vue

@@ -1,5 +1,5 @@
 <template>
-  <ele-modal :visible.sync="visible" :title="title" width="60vw" append-to-body>
+  <ele-modal :visible.sync="visible" :title="title" width="60vw" append-to-body @close="cancel">
     <headerTitle title="基本信息" style="margin-top: 15px"></headerTitle>
     <el-form
       ref="form"
@@ -15,9 +15,20 @@
           </el-form-item>
         </el-col>
         <el-col v-bind="styleResponsive ? { lg: 8, md: 12 } : { span: 8 }">
-          <el-form-item label="工单编码:" prop="repairCode">
+          <el-form-item
+            label="工单编码:"
+            prop="repairCode"
+            v-if="form.repairId&&type!='edit'"
+          >
             <el-input v-model="form.repairCode" disabled />
           </el-form-item>
+          <el-form-item label="工单编码:" prop="repairCode" v-else>
+            <el-input
+              v-model="form.repairCode"
+              @click.native="addRepair"
+              placeholder="请选择工单"
+            />
+          </el-form-item>
         </el-col>
         <el-col v-bind="styleResponsive ? { lg: 8, md: 12 } : { span: 8 }">
           <el-form-item label="工单名称:" prop="repairName">
@@ -25,7 +36,11 @@
           </el-form-item>
         </el-col>
         <el-col v-bind="styleResponsive ? { lg: 8, md: 12 } : { span: 8 }">
-          <el-form-item label="设备名称:" prop="deviceName">
+          <el-form-item
+            label="设备名称:"
+            prop="deviceName"
+            v-if="form.repairId"
+          >
             <el-input
               v-model="form.deviceName"
               disabled
@@ -47,6 +62,13 @@
               </el-option>
             </el-select>
           </el-form-item>
+          <el-form-item v-else label="设备名称:" prop="deviceName">
+            <el-input
+              v-model="form.deviceName"
+              @click.native="materialAdd"
+              placeholder="请选择设备"
+            />
+          </el-form-item>
         </el-col>
 
         <el-col v-bind="styleResponsive ? { lg: 8, md: 12 } : { span: 8 }">
@@ -108,7 +130,7 @@
         </div>
       </template>
 
-      <template v-slot:totalCount="{ row, $index }" v-if="type == 'add'">
+      <template v-slot:totalCount="{ row, $index }" v-if="type != 'detail'">
         <el-input
           type="number"
           placeholder="请输入"
@@ -145,17 +167,43 @@
     <!-- 选择产品 -->
     <AssetsDialog ref="equipmentRefs" :assetType="6" @choose="confirmChoose">
     </AssetsDialog>
+    <MaterialAdd ref="materialAddRef" @chooseEquipment="chooseEquipment">
+    </MaterialAdd>
+    <workList ref="workListRef" @open="init"> </workList>
   </ele-modal>
 </template>
 
 <script>
 import AssetsDialog from './AssetsDialog.vue';
+import workList from './workList.vue';
+import MaterialAdd from './MaterialAdd.vue';
 import { save } from '@/api/maintenance/repair';
 import { detailsId } from '@/api/sparePartsApply/index.js';
-
+const defForm = {
+  name: '',
+  repairId: '', //维修工单id
+  repairCode: '',
+  code: '',
+  repairName: '',
+  deviceName: '',
+  fixCode: '',
+  deviceCode: '',
+  type: '4', //类型
+  status: '1', //状态
+  purpose: '',
+  userId: '', //使用人id
+  userName: '',
+  useDeptId: '', //使用部门
+  useDeptName: '',
+  warehouseId: '',
+  usageTime: '', //使用时间 //详情信息
+  detailList: []
+};
 export default {
   components: {
-    AssetsDialog
+    AssetsDialog,
+    MaterialAdd,
+    workList
   },
   data() {
     return {
@@ -163,26 +211,7 @@ export default {
       loading: false,
       title: '备品备件申请单',
       type: '',
-      form: {
-        name: '',
-        repairId: '', //维修工单id
-        repairCode: '',
-        code: '',
-        repairName: '',
-        deviceName: '',
-        fixCode: '',
-        deviceCode: '',
-        type: '4', //类型
-        status: '1', //状态
-        purpose: '',
-        userId: '', //使用人id
-        userName: '',
-        useDeptId: '', //使用部门
-        useDeptName: '',
-        warehouseId: '',
-        usageTime: '', //使用时间 //详情信息
-        detailList: []
-      },
+      form: { ...defForm },
       rules: {
         deviceName: [{ required: true, message: '请选择', trigger: 'change' }]
       },
@@ -200,16 +229,16 @@ export default {
   },
   created() {},
   methods: {
+    addRepair() {
+      this.$refs.workListRef.open();
+    },
+    materialAdd() {
+      this.$refs.materialAddRef.open();
+    },
     // 出库数量限制
     handleInput(row, index) {
-      console.log(row.measureQuantity, 'row.measureQuantity');
-      console.log(row.totalCount, 'row.outboundNum');
-
       if (row.totalCount > row.measureQuantity) {
-        console.log(index, 'index');
-
         this.$set(this.tableList[index], 'totalCount', row.measureQuantity);
-        // row.outboundNum = row.measureQuantity;
       }
     },
     deviceChange(item) {
@@ -265,7 +294,7 @@ export default {
           prop: 'measureQuantity',
           label: '库存',
           align: 'center',
-          show: type == 'add'
+          show: type != 'detail'
         },
         {
           prop: 'measureUnit',
@@ -288,17 +317,8 @@ export default {
           showOverflowTooltip: true
         }
       ];
-      if (type == 'add') {
-        this.form.repairCode = row.code;
-        this.form.repairName = row.planName;
-        this.form.repairId = row.id;
-        if (!row.sparePartsApplyList) {
-          this.form.deviceName = row.substanceDetailVO.name;
-          this.form.fixCode = row.substanceDetailVO.fixCode;
-          this.form.deviceCode = row.substanceDetailVO.codeNumber;
-        } else {
-          this.sparePartsApplyList = row.sparePartsApplyList;
-        }
+      if (type != 'detail') {
+        this.init(row);
       } else {
         const data = await detailsId(row.id);
         this.form = data;
@@ -311,9 +331,29 @@ export default {
       this.tableList = this.tableList.filter((item) => item.id != id);
     },
     cancel() {
+      this.sparePartsApplyList = [];
+      this.tableList = [];
+      this.form={...defForm}
       this.visible = false;
     },
-
+    init(row) {
+      console.log(row);
+      if (!row) {
+        return;
+      }
+      this.form.repairCode = row.code;
+      this.form.repairName = row.planName;
+      this.form.repairId = row.id;
+      this.form.deviceName = row.substanceDetailVO?.name;
+      this.form.fixCode = row.substanceDetailVO?.fixCode;
+      this.form.deviceCode = row.substanceDetailVO?.codeNumber;
+      this.sparePartsApplyList = row.sparePartsApplyList||[]
+    },
+    chooseEquipment(data) {
+      this.form.deviceName = data.name;
+      this.form.fixCode = data.fixCode;
+      this.form.deviceCode = data.code;
+    },
     addEquipment() {
       this.$refs.equipmentRefs.open(this.tableList);
     },

+ 451 - 0
src/views/sparePartsApply/components/workList.vue

@@ -0,0 +1,451 @@
+<template>
+  <el-dialog
+    :visible.sync="visible"
+    :close-on-click-modal="true"
+    :close-on-press-escape="false"
+    append-to-body
+    width="80vw"
+  >
+    <div class="patrol">
+      <div class="ele-body">
+        <el-card shadow="never">
+          <div class="switch">
+            <div class="switch_left">
+              <ul>
+                <li
+                  v-for="item in tabOptions"
+                  :key="item.key"
+                  :class="{ active: activeComp == item.key }"
+                  @click="activeChange(item.key)"
+                >
+                  {{ item.name }}
+                </li>
+              </ul>
+            </div>
+          </div>
+          <ele-pro-table
+            ref="table"
+            :columns="columns()"
+            :datasource="datasource"
+            :current.sync="current"
+            highlight-current-row
+            row-key="id"
+          >
+          </ele-pro-table>
+        </el-card>
+      </div>
+    </div>
+    <template v-slot:footer>
+      <el-button @click="visible = false">取消</el-button>
+
+      <el-button type="primary" @click="add"> 确认 </el-button>
+    </template>
+  </el-dialog>
+</template>
+<script>
+import {
+  getWorkOrderPage,
+  getWordOrderDetail
+} from '@/api/maintenance/patrol_maintenance';
+import { getWorkOrderList } from '@/api/maintenance/repair';
+export default {
+  data() {
+    return {
+      visible: false,
+      activeComp: '1',
+      tabOptions: [
+        { key: '1', name: '巡点检工单' },
+        { key: '2', name: '保养工单' },
+        { key: '3', name: '维修工单' }
+      ],
+      current: {},
+      patrolColumns: [
+        {
+          columnKey: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          showOverflowTooltip: true,
+          fixed: 'left'
+        },
+        {
+          columnKey: 'code',
+          slot: 'code',
+          prop: 'code',
+          label: '工单单号',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 140
+        },
+        {
+          prop: 'planCode',
+          label: '计划单号',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 140
+        },
+        {
+          prop: 'planName',
+          label: '巡点检名称',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 120
+        },
+        {
+          prop: 'executeGroupName',
+          label: '巡点检部门',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 120
+        },
+        {
+          prop: 'executeUserName',
+          label: '巡点检人员',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'ruleName',
+          label: '规则名称',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'createTime',
+          label: '工单生成时间',
+          align: 'center',
+          // sortable: true,
+          showOverflowTooltip: true,
+          width: 170
+        },
+        {
+          prop: 'acceptTime',
+          label: '开工时间',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'finishTime',
+          label: '报工时间',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          columnKey: 'orderHour',
+          label: '实际工时(分钟)',
+          align: 'center',
+          resizable: false,
+          showOverflowTooltip: true,
+          minWidth: 120,
+          formatter: (row) => {
+            if (row.finishTime && row.acceptTime) {
+              return parseInt(
+                (new Date(row.finishTime).getTime() -
+                  new Date(row.acceptTime).getTime()) /
+                  60000
+              );
+            }
+          }
+        },
+        {
+          prop: 'orderStatus',
+          label: '状态',
+          align: 'center',
+          showOverflowTooltip: true,
+          formatter: (row) => {
+            return {
+              0: '待接收',
+              1: '已接收',
+              2: '执行中',
+              3: '已完成'
+            }[row.orderStatus];
+          }
+        },
+        {
+          prop: 'acceptanceStatus',
+          label: '执行结果',
+          align: 'center',
+          showOverflowTooltip: true,
+          formatter(row) {
+            return { 0: '缺陷', 1: '正常' }[row.isAbnormal];
+          }
+        }
+      ],
+      equipmentColumns: [
+        {
+          columnKey: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          showOverflowTooltip: true,
+          fixed: 'left'
+        },
+        {
+          columnKey: 'code',
+          slot: 'code',
+          prop: 'code',
+          label: '工单单号',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 140
+        },
+        {
+          prop: 'planCode',
+          label: '计划单号',
+          align: 'center',
+          showOverflowTooltip: true,
+          slot: 'planCode',
+          minWidth: 140
+        },
+        {
+          prop: 'planName',
+          label: '保养名称',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 120
+        },
+        {
+          prop: 'executeGroupName',
+          label: '保养部门',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 120
+        },
+        {
+          prop: 'executeUserName',
+          label: '保养人员',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'ruleName',
+          label: '规则名称',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'createTime',
+          label: '工单生成时间',
+          // sortable: true,
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 170
+        },
+        {
+          prop: 'acceptTime',
+          label: '开工时间',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'finishTime',
+          label: '报工时间',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          columnKey: 'orderHour',
+          label: '实际工时(分钟)',
+          align: 'center',
+          resizable: false,
+          showOverflowTooltip: true,
+          minWidth: 120,
+          formatter: (row) => {
+            if (row.finishTime && row.acceptTime) {
+              return parseInt(
+                (new Date(row.finishTime).getTime() -
+                  new Date(row.acceptTime).getTime()) /
+                  60000
+              );
+            }
+          }
+        },
+        {
+          prop: 'orderStatus',
+          label: '状态',
+          align: 'center',
+          showOverflowTooltip: true,
+          formatter: (row) => {
+            return {
+              0: '待接收',
+              1: '已接收',
+              2: '执行中',
+              3: '已完成'
+            }[row.orderStatus];
+          }
+        },
+        {
+          prop: 'executeResult',
+          label: '执行结果',
+          align: 'center',
+          showOverflowTooltip: true,
+          formatter(row) {
+            return { 0: '缺陷', 1: '正常' }[row.isAbnormal];
+          }
+        }
+      ],
+      repairColumns: [
+        {
+          columnKey: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          showOverflowTooltip: true,
+          fixed: 'left'
+        },
+        {
+          prop: 'code',
+          slot: 'code',
+          label: '工单编号',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 150
+        },
+        {
+          prop: 'planCode',
+          // label: '关联单号',
+          label: '计划单号',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'planName',
+          label: '维修名称',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'substanceDetailVO.name',
+          label: '设备名称',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'substanceDetailVO.fixCode',
+          label: '固资编码',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'substanceDetailVO.codeNumber',
+          label: '设备编号',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'executeUserName',
+          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: 'planFinishTime',
+          label: '计划完成时间',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          columnKey: 'orderHour',
+          label: '实际工时(分钟)',
+          align: 'center',
+          resizable: false,
+          showOverflowTooltip: true,
+          minWidth: 120,
+          formatter: (row) => {
+            if (row.finishTime && row.acceptTime) {
+              return parseInt(
+                (new Date(row.finishTime).getTime() -
+                  new Date(row.acceptTime).getTime()) /
+                  60000
+              );
+            }
+          }
+        }
+      ]
+    };
+  },
+  methods: {
+    async open() {
+      this.visible = true;
+    },
+    /* 表格数据源 */
+    datasource({ page, limit, where }) {
+      where.type = this.activeComp;
+      let api = this.activeComp == 3 ? getWorkOrderList : getWorkOrderPage;
+      return api({
+        pageNum: page,
+        size: limit,
+        ...where
+      });
+    },
+    columns() {
+      return this.activeComp == 1
+        ? this.patrolColumns
+        : this.activeComp == 2
+        ? this.equipmentColumns
+        : this.repairColumns;
+    },
+    activeChange(key) {
+      this.activeComp = key;
+      this.$refs.table.reload();
+    },
+    async add() {
+      let data = null;
+      if (!this.current.id) {
+        this.$message.error('请至少选择一条数据');
+        return;
+      }
+      if (this.activeComp == 3) {
+        data = this.current;
+      } else {
+        data = await getWordOrderDetail(this.current.id);
+        data['sparePartsApplyList'] = data.deviceList.map((item) => {
+          return {
+            deviceName: item.substance.name,
+            fixCode: item.substance.fixCode,
+            deviceCode: item.substance.code
+          };
+        });
+      }
+      this.$emit('open', data);
+      this.visible = false;
+    }
+  }
+};
+</script>
+<style lang="scss" scoped>
+::v-deep .el-card__body {
+  padding-top: 0;
+  padding-left: 0;
+}
+.main {
+  padding-left: 17px;
+  .plan {
+    padding-top: 15px;
+  }
+}
+</style>

+ 27 - 2
src/views/sparePartsApply/index.vue

@@ -5,6 +5,31 @@
 
       <!-- 数据表格 -->
       <ele-pro-table ref="table" :columns="columns" :datasource="datasource">
+
+   <!-- 表头工具栏 -->
+   <template v-slot:toolbar="{ row }">
+          <el-button
+            size="small"
+            type="primary"
+            icon="el-icon-plus"
+            class="ele-btn-icon"
+            @click="open(null,'edit')"
+          >
+            新建
+          </el-button>
+
+          <!-- <el-button size="small" class="ele-btn-icon" @click="handlDelete"
+          >删除</el-button
+        >
+        <el-button
+          size="small"
+          @click="moveTo(checkRadioData, 'move')"
+          :disabled="checkRadioData.length == 0"
+          class="ele-btn-icon"
+          >移动到</el-button
+        > -->
+        </template>
+
         <template v-slot:totalCount="{ row }">
           {{ row.totalCount }} {{ row.measuringUnit }}
         </template>
@@ -89,14 +114,14 @@ export default {
           label: '编码',
           showOverflowTooltip: true,
           align: 'center',
-          minWidth: 110
+          minWidth: 150
         },
         {
           prop: 'repairCode',
           showOverflowTooltip: true,
           label: '工单编码',
           align: 'center',
-          minWidth: 110
+          minWidth: 150
         },
         {
           prop: 'repairName',