Преглед изворни кода

设备巡点检,设备保养明细添加零部件编码和名称,bom明细表添加打印条码。

huang_an пре 1 година
родитељ
комит
5a9f0b9400

+ 168 - 0
src/views/ledgerAssets/equipment/components/DialogMoveTo.vue

@@ -0,0 +1,168 @@
+<template>
+  <div class="dialog-moveto">
+    <el-dialog
+      :title="title"
+      :visible.sync="dialogVisible"
+      width="30%"
+      :before-close="handleClose"
+    >
+      <div class="form">
+        <el-form
+          label-width="120px"
+          :rules="rules"
+          :model="addForm"
+          ref="form"
+          class="ele-form-search"
+        >
+          <el-form-item
+            v-if="componentsType == 'move'"
+            label="设备分类"
+            label-width="100px"
+            prop="id"
+          >
+            <el-select v-model="addForm.id" placeholder="请选择">
+              <el-option
+                v-for="item in list"
+                :label="item.name"
+                :value="item.id"
+                :key="item.id"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item
+            v-if="componentsType == 'person'"
+            label="片区负责人部门"
+            prop="repairGroupId"
+          >
+            <DeptSelect v-model="addForm.repairGroupId" @input="getwhbm" />
+          </el-form-item>
+          <el-form-item v-if="componentsType == 'person'" label="片区负责人">
+            <el-select v-model="addForm.repairUserId" placeholder="请选择">
+              <el-option
+                v-for="item in personList"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-form>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="handleClose">取 消</el-button>
+        <el-button type="primary" @click="submit" :loading="loading"
+          >确 定</el-button
+        >
+      </span>
+    </el-dialog>
+  </div>
+</template>
+<script>
+  import {
+    changeSubstanceCateId,
+    updateRepairUserAndGroup
+  } from '@/api/ledgerAssets';
+  import { getTreeByPid } from '@/api/classifyManage';
+  import DeptSelect from '@/components/CommomSelect/dept-select.vue';
+  import { getUserPage } from '@/api/system/organization';
+  export default {
+    components: { DeptSelect },
+    data() {
+      return {
+        componentsType: '',
+        dialogVisible: false,
+        addForm: {},
+        loading: false,
+        checkoutArr: [],
+        rules: {
+          id: [{ required: true, message: '请选择设备分类', trigger: 'blur' }],
+          repairGroupId: [
+            { required: true, message: '请选择片区负责人部门', trigger: 'blur' }
+          ]
+        },
+        list: [],
+        title: '',
+        personList: []
+      };
+    },
+    methods: {
+      async getwhbm() {
+        if (!this.addForm.repairGroupId) return;
+        let data = await getUserPage({
+          pageNum: 1,
+          size: 9999,
+          groupId: this.addForm.repairGroupId
+        });
+        this.personList = data.list;
+      },
+      submit() {
+        this.$refs.form.validate(async (flag) => {
+          if (flag) {
+            try {
+              this.loading = true;
+              if (this.componentsType == 'move') {
+                const paramsArr = this.checkoutArr.map((item) => {
+                  return { categoryLevelId: this.addForm.id, id: item.id };
+                });
+                console.log(paramsArr);
+                await changeSubstanceCateId(paramsArr);
+              } else {
+                const listId = this.checkoutArr.map((item) => {
+                  return item.id;
+                });
+                const newObj = {
+                  ...this.addForm,
+                  id: listId
+                };
+                console.log(newObj);
+                await updateRepairUserAndGroup(newObj);
+              }
+              this.$message.success('成功!');
+              this.dialogVisible = false;
+              this.$emit('success', true);
+            } finally {
+              this.loading = false;
+            }
+          } else {
+            return false;
+          }
+        });
+      },
+
+      open(arr, current, type) {
+        this.addForm = {};
+        this.dialogVisible = true;
+        this.componentsType = type;
+        this.checkoutArr = arr;
+        if (type === 'move') {
+          this.getTreeData(current);
+          this.title = '移动到';
+        } else {
+          this.title = '批量设置片区负责人';
+        }
+      },
+      async getTreeData(current) {
+        const res = await getTreeByPid(4);
+        if (res.code == 0) {
+          this.list = [];
+          console.log(current);
+          console.log('==res.data', res.data);
+          res.data.forEach((e) => {
+            if (e.id == current.parentId) {
+              e.children.forEach((item) => {
+                if (item.id == current.preParentId) {
+                  this.list = item.children;
+                }
+              });
+            }
+          });
+        }
+      },
+      handleClose() {
+        this.dialogVisible = false;
+      }
+    }
+  };
+</script>

+ 44 - 2
src/views/ledgerAssets/equipment/components/detailedList.vue

@@ -7,6 +7,8 @@
       :datasource="datasource"
       class="dict-table"
       tool-class="ele-toolbar-actions"
+      @select="selectChange"
+      @select-all="changeSelectAll"
     >
       <template v-slot:toolbar>
         <div class="toolbar_box">
@@ -19,6 +21,16 @@
             </el-input>
             <DictSelection dictName="计量单位" v-model="attributeData.unit"
           /></div>
+
+          <el-button
+            size="small"
+            icon="el-icon-set-up"
+            class="ele-btn-icon"
+            style="margin-right: 12px"
+            @click="handlePrinting()"
+          >
+            打印条码
+          </el-button>
         </div>
       </template>
 
@@ -90,6 +102,7 @@
         </el-input>
       </template>
     </ele-pro-table>
+    <print ref="printRef"></print>
   </div>
 </template>
 
@@ -103,14 +116,22 @@
   } from '@/api/material/BOM';
   import { getByCode } from '@/api/system/dictionary-data';
 
+  import print from './print.vue';
+
   export default {
     name: 'SystemDictionary',
-    components: { BOMSearch },
+    components: { BOMSearch, print },
 
     data() {
       return {
         // 表格列配置
         columns: [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center'
+          },
           {
             label: '序号',
             columnKey: 'index',
@@ -238,7 +259,9 @@
 
         newTreeId: null,
 
-        dictList: []
+        dictList: [],
+
+        checkRadioData: []
       };
     },
 
@@ -328,6 +351,25 @@
           this.gysList = res.list;
           console.log(this.gysList, '供应商列表');
         });
+      },
+      handlePrinting() {
+        this.$refs.printRef.open(this.checkRadioData);
+      },
+      // 全选
+      changeSelectAll(arr) {
+        console.log(arr);
+        if (arr.length != 0) {
+          this.checkRadioData = arr;
+        } else {
+          this.checkRadioData = [];
+        }
+      },
+      selectChange(selection, row) {
+        if (selection.length != 0) {
+          this.checkRadioData = selection;
+        } else {
+          this.checkRadioData = [];
+        }
       }
     }
   };

+ 4 - 3
src/views/ledgerAssets/equipment/components/equipment-list.vue

@@ -86,7 +86,7 @@
         <el-link type="primary" @click="handelBOM(row)">BOM</el-link>
       </template>
     </ele-pro-table>
-    <!-- <DialogMoveto ref="movetoRef" @success="sucesstion" /> -->
+    <DialogMoveto ref="movetoRef" @success="sucesstion" />
     <print ref="printRef"></print>
     <printSr ref="printSrRef"></printSr>
     <printTg ref="printTgRef"></printTg>
@@ -107,7 +107,8 @@
   } from '@/utils/dict/warehouse';
 
   import EquipmentSearch from './equipment-search.vue';
-  // import DialogMoveto from './DialogMoveTo.vue';
+  import DialogMoveto from './DialogMoveTo.vue';
+
   import {
     getAssetList,
     downloadAsset,
@@ -129,7 +130,7 @@
   export default {
     components: {
       EquipmentSearch,
-      // DialogMoveto,
+      DialogMoveto,
       print,
       printSr,
       printTg,

+ 133 - 0
src/views/ledgerAssets/equipment/components/print.vue

@@ -0,0 +1,133 @@
+<template>
+  <ele-modal
+    title="二维码"
+    :visible.sync="QRvisible"
+    v-if="QRvisible"
+    width="800px"
+    :modal="false"
+  >
+    <div id="printSection">
+      <div
+        v-for="(item, index) in codeList"
+        :key="index"
+        style="
+          display: flex;
+          padding-left: 20px;
+          align-items: center;
+          justify-content: center;
+          margin: auto;
+        "
+      >
+        <div style="width: 250px; height: 240px">
+          <img
+            :src="item.qrcode"
+            alt="QR Code"
+            style="width: 240px; height: 240px"
+          />
+        </div>
+        <div
+          style="
+            width: 440px;
+            height: 240px;
+            display: flex;
+            flex-direction: column;
+            flex-wrap: wrap;
+            justify-content: center;
+          "
+        >
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block; width: 100px">编码:</span>
+            <span style="color: #000">{{ item.code }}</span>
+          </div>
+
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block; width: 100px">名称:</span>
+            <span style="color: #000">{{ item.name }}</span>
+          </div>
+        </div>
+      </div>
+    </div>
+
+    <div slot="footer">
+      <el-button @click="print">打印预览</el-button>
+      <el-button @click="close">关闭</el-button>
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+  import QRCode from 'qrcode';
+  export default {
+    name: 'print',
+    data() {
+      return {
+        QRvisible: false,
+        codeList: []
+      };
+    },
+
+    methods: {
+      open(data) {
+        this.codeList = data;
+        this.QRvisible = true;
+        this.$nextTick(() => {
+          this.generateQRCodes();
+        });
+        // queryPrint({ ids }).then(res => {
+        //     this.codeList = res;
+        //     this.QRvisible = true
+        //     this.$nextTick(() => {
+        //         this.generateQRCodes()
+        //     })
+        // })
+      },
+
+      generateQRCodes() {
+        this.codeList.forEach((item) => {
+          QRCode.toDataURL(item.code)
+            .then((url) => {
+              item.qrcode = url;
+              this.$forceUpdate();
+            })
+            .catch((err) => {
+              console.error(err);
+            });
+        });
+      },
+
+      close() {
+        this.QRvisible = false;
+      },
+
+      print() {
+        const printSection = document.getElementById('printSection');
+        // 创建打印任务
+        const printWindow = window.open('', '_blank');
+        printWindow.document.open();
+        printWindow.document.write('<html><head><title>打印预览</title>');
+        printWindow.document.write(
+          '<link rel="stylesheet" href="your-stylesheet-url.css" type="text/css" />'
+        );
+        printWindow.document.write('</head><body>');
+        printWindow.document.write(printSection.innerHTML);
+        printWindow.document.write('</body></html>');
+        printWindow.document.close();
+        printWindow.onload = function () {
+          printWindow.print();
+        };
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  @media print {
+    #printSection {
+      font-size: 34px;
+
+      span {
+        font-size: 34px;
+      }
+    }
+  }
+</style>

+ 46 - 8
src/views/maintenance/components/programRulesDialog.vue

@@ -6,7 +6,7 @@
     :append-to-body="true"
     custom-class="ele-dialog-form"
     :title="dialogTitle"
-  
+    :before-close="onClose"
   >
     <header-title title="基本信息"></header-title>
     <el-form
@@ -256,6 +256,40 @@
                     <span>{{ scope.$index + 1 }}</span>
                   </template>
                 </el-table-column>
+                <el-table-column
+                  label="零部件编码"
+                  prop="categoryCode"
+                  width="100"
+                >
+                  <template slot-scope="scope">
+                    <div v-if="scope.row.isNew">
+                      <el-input
+                        v-model="scope.row.categoryCode"
+                        placeholder="请输入零部件编码"
+                      ></el-input>
+                    </div>
+                    <div v-else>
+                      <span>{{ scope.row.categoryCode }}</span>
+                    </div>
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  label="零部件名称"
+                  prop="categoryName"
+                  width="100"
+                >
+                  <template slot-scope="scope">
+                    <div v-if="scope.row.isNew">
+                      <el-input
+                        v-model="scope.row.categoryName"
+                        placeholder="请输入零部件名称"
+                      ></el-input>
+                    </div>
+                    <div v-else>
+                      <span>{{ scope.row.categoryName }}</span>
+                    </div>
+                  </template>
+                </el-table-column>
                 <el-table-column label="事项" prop="name" width="100">
                   <template slot-scope="scope">
                     <div v-if="scope.row.isNew">
@@ -421,7 +455,7 @@
         default: () => {
           return '新增巡检点计划配置';
         }
-      },
+      }
       // visible: {
       //   type: Boolean,
       //   default: false
@@ -440,7 +474,7 @@
         bomList: []
       };
       return {
-        visible:false,
+        visible: false,
         ruleIndex: 0, // 规则index
         ruleId: '',
         formLabel: '',
@@ -620,7 +654,7 @@
       async init(row, tips) {
         console.log(row);
         console.log(tips);
-        this.visible=true;
+        this.visible = true;
         if (row) {
           this.getInfo(row.id, tips);
         } else {
@@ -695,8 +729,9 @@
                     deviceId: item.id,
                     codeNumber: item.codeNumber,
                     // equiModel: item.modelType,
-                    equiLocation: item.position[0]&&item.position[0].pathName,
-                    equiLocationCode: item.position[0]&&item.position[0].pathIds,
+                    equiLocation: item.position[0] && item.position[0].pathName,
+                    equiLocationCode:
+                      item.position[0] && item.position[0].pathIds,
                     workItems: ruleItem.ruleItems ? ruleItem.ruleItems : []
                     // categoryId: item.category.categoryLevelId,
                     // categoryName: item.category.categoryLevelName
@@ -732,8 +767,7 @@
                 if (res) {
                   this.$message.success(type + '成功!');
                   this.$emit('done');
-                  this.visible=false
-
+                  this.visible = false;
                 }
               } catch (error) {
                 this.$message.error(type + '失败!');
@@ -1070,6 +1104,10 @@
         } else {
           this.$message.error('请误重复添加规则');
         }
+      },
+      onClose() {
+        console.log('关闭窗口');
+        this.visible = false;
       }
     }
   };

+ 23 - 0
src/views/maintenance/equipment/plan/details.vue

@@ -169,6 +169,28 @@
                       <span>{{ scope.$index + 1 }}</span>
                     </template>
                   </el-table-column>
+                  <el-table-column
+                    label="零部件编码"
+                    prop="categoryCode"
+                    width="100"
+                  >
+                    <template slot-scope="scope">
+                      <div>
+                        <span>{{ scope.row.categoryCode }}</span>
+                      </div>
+                    </template>
+                  </el-table-column>
+                  <el-table-column
+                    label="零部件名称"
+                    prop="categoryName"
+                    width="100"
+                  >
+                    <template slot-scope="scope">
+                      <div>
+                        <span>{{ scope.row.categoryName }}</span>
+                      </div>
+                    </template>
+                  </el-table-column>
                   <el-table-column label="事项" prop="name" width="100">
                     <template slot-scope="scope">
                       <div>
@@ -452,6 +474,7 @@
         });
         if (res?.data) {
           this.infoData = res.data;
+          console.log(this.infoData.planDeviceList, 'planDeviceList');
         }
         this.pageLoading = false;
       },

+ 1 - 1
src/views/maintenance/equipment/workOrder/components/work-search.vue

@@ -22,7 +22,7 @@
       </el-col>
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
         <el-form-item label="计划单号:">
-          <el-input clearable v-model="where.planId" placeholder="请输入" />
+          <el-input clearable v-model="where.planCode" placeholder="请输入" />
         </el-form-item>
         <el-form-item label="状态:">
           <!-- <DictSelection dictName="规则状态" clearable v-model="where.staus">

+ 22 - 0
src/views/maintenance/patrol/plan/details.vue

@@ -169,6 +169,28 @@
                       <span>{{ scope.$index + 1 }}</span>
                     </template>
                   </el-table-column>
+                  <el-table-column
+                    label="零部件编码"
+                    prop="categoryCode"
+                    width="100"
+                  >
+                    <template slot-scope="scope">
+                      <div>
+                        <span>{{ scope.row.categoryCode }}</span>
+                      </div>
+                    </template>
+                  </el-table-column>
+                  <el-table-column
+                    label="零部件名称"
+                    prop="categoryName"
+                    width="100"
+                  >
+                    <template slot-scope="scope">
+                      <div>
+                        <span>{{ scope.row.categoryName }}</span>
+                      </div>
+                    </template>
+                  </el-table-column>
                   <el-table-column label="事项" prop="name" width="100">
                     <template slot-scope="scope">
                       <div>

+ 2 - 2
src/views/maintenance/patrol/workOrder/components/work-search.vue

@@ -21,7 +21,7 @@
       </el-col>
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
         <el-form-item label="计划单号:">
-          <el-input clearable v-model="where.planId" placeholder="请输入" />
+          <el-input clearable v-model="where.planCode" placeholder="请输入" />
         </el-form-item>
         <el-form-item label="状态:">
           <el-select
@@ -90,7 +90,7 @@
           icon="el-icon-refresh-left"
           size="small"
           type="primary"
-        >重置</el-button
+          >重置</el-button
         >
       </el-col>
     </el-row>

+ 24 - 2
src/views/maintenance/patrol/workOrder/details.vue

@@ -173,6 +173,28 @@
                       <span>{{ scope.$index + 1 }}</span>
                     </template>
                   </el-table-column>
+                  <el-table-column
+                    label="零部件编码"
+                    prop="categoryCode"
+                    width="100"
+                  >
+                    <template slot-scope="scope">
+                      <div>
+                        <span>{{ scope.row.categoryCode }}</span>
+                      </div>
+                    </template>
+                  </el-table-column>
+                  <el-table-column
+                    label="零部件名称"
+                    prop="categoryName"
+                    width="100"
+                  >
+                    <template slot-scope="scope">
+                      <div>
+                        <span>{{ scope.row.categoryName }}</span>
+                      </div>
+                    </template>
+                  </el-table-column>
                   <el-table-column label="事项" prop="name" width="100">
                     <template slot-scope="scope">
                       <div>
@@ -276,7 +298,7 @@
           </div>
         </div>
         <HeaderTitle title="备品备件申请单" size="16px"></HeaderTitle>
-       <editd :id="infoData.id" />
+        <editd :id="infoData.id" />
 
         <!-- 巡点检、缺陷设备报修记录 -->
         <!-- <div class="repair_notes">
@@ -323,7 +345,7 @@
   import editd from '@/views/sparePartsApply/components/editd';
 
   export default {
-    components:{
+    components: {
       editd
     },
     mixins: [dictMixins],

+ 1 - 1
vue.config.js

@@ -35,7 +35,7 @@ module.exports = {
         // target: 'http://124.71.68.31:50001',
         // target: 'http://192.168.1.139:18086', // 粟
         // target: 'http://192.168.1.132:18086', // 徐
-        target: 'http://192.168.1.107:18086', //本
+        target: 'http://192.168.1.116:18086', //本
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {
           '^/api': ''