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

Merge remote-tracking branch 'origin/master'

姜永辉 пре 3 година
родитељ
комит
193593d4ed

+ 9 - 2
src/components-app/base/dk-app-field/dk-app-field.vue

@@ -2,13 +2,13 @@
 <template>
   <van-field ref="input" :name="name" v-model="model" :center="center" :label="label" :size="size"
              :type="typeInput" :focus="focus" :colon="colon" :border="border"
-             :password="password"
+             :password="password"  :readonly="readonly":clickable="clickable"
              :maxlength="maxlength" :title-width="titleWidth" :placeholder="placeholder"
              :auto-focus="autoFocus" :is-link="isLink" :show-word-limit="showWordLimit"
              :arrow-direction="arrowDirection" :error="error" :format-trigger="formatTrigger" :formatter="formatter"
              :error-message="errorMessage" :error-message-align="errorMessageAlign" :input-align="inputAlign"
              :autosize="autosize" :left-icon="leftIcon" :right-icon="rightIcon"
-             @input="onInput" @focus="onFocus" @blur="onBlur">
+             @input="onInput" @focus="onFocus" @blur="onBlur" @click="onClick">
     <!-- label	自定义输入框标签,如果设置了label属性则不生效
       left-icon	自定义输入框头部图标
       right-icon	自定义输入框尾部图标
@@ -178,6 +178,13 @@ export default {
       this.$emit("input", this.model)
     },
     /**
+     * 点击事件
+     * @param {*} event
+     */
+    onClick(event) {
+      this.$emit("click", this.model)
+    },
+    /**
      * 输入内容时触发
      * @param {*} event
      */

+ 121 - 0
src/components/business/process/edge-modal/edge-modal.vue

@@ -0,0 +1,121 @@
+<!-- @desc:工艺流程节点弹窗  @auth:张潇木  @time:2023/1/29 10:13 -->
+<template>
+  <div>
+    <DkModal
+     title="工艺路线"
+     width="40%"
+     v-model="process.edgeModal.display"
+     :mask-closable="false"
+     :mask="false"
+     :closable="false"
+     draggable
+     sticky
+     @modalOk="modalOk"
+     @modalCancel="modalCancel">
+      {{process.currentEdgeId}}
+      {{edgeData}}
+      <DkForm ref="formInline" :col-count="2" >
+        <!--    默认分级    -->
+        <DkFormItem prop="productGrade">
+          <SelectPop ref="productGrade" v-model="edgeData.productGrade" label-key="typeName" value-key="typeId" :multiple="true"
+                     :options="[{typeId:1,typeName:'良品'}, {typeId:2,typeName:'次品'}]"/>
+        </DkFormItem>
+        <!--    成型标签    -->
+        <DkFormItem prop="moldingSysTags">
+          <SelectPop ref="moldingSysTags" v-model="edgeData.moldingSysTags" label-key="typeName" value-key="typeId" :multiple="true"
+                     :options="[{typeId:1,typeName:'高压'}, {typeId:2,typeName:'普通'}]"/>
+        </DkFormItem>
+        <!--    备注    -->
+        <DkFormItem prop="remarks" :span="24">
+          <InputPop ref="remarks" v-model="edgeData.remarks" maxlength=500 textareaFlag/>
+        </DkFormItem>
+        <Divider></Divider>
+        <div style="padding-left: 30px; display: flex">
+          <!--    工序在制品    -->
+          <EditTable ref="goodsTable" :data="edgeData.pdtList"
+                     :columns="pdtColumns"
+                     enabledRepeatId="pdtId"
+                     controlId="pdtId"
+                     :height="200"
+                     :showSeqBtnFlag="false"
+                     :enabledRepeat="false"/>
+        </div>
+      </DkForm>
+    </DkModal>
+  </div>
+</template>
+
+<script>
+import {mapState, mapMutations} from 'vuex'
+import Process from '@/view/process/index.js'
+export default {
+  name: 'EdgeModal',
+  props: {
+    flowKind: {
+      type: Number,
+      default: undefined,
+    },
+  },
+  computed: {
+    ...mapState(['process']),
+    id(){
+      return this.process.currentEdgeId
+    }
+  },
+  watch:{
+    id(n,o){
+      let graph = Process.graph;
+      let cell = graph.getCellById(this.process.currentEdgeId);
+      console.log('edgeData',cell)
+      this.edgeData=cell.data
+    }
+  },
+  data() {
+    return {
+      edgeData: {},
+      pdtColumns:[
+        // {type: 'seq', width: 60},
+        {field: 'pdtCode', type: 'disabled'},
+        {field: 'pdtName', type: 'disabled'},
+        {field: 'pdtType', type: 'disabled'},
+        {field: 'pdtSpec', type: 'disabled'},
+      ],
+    }
+  },
+  created() {
+  },
+  methods: {
+    ...mapMutations(['setProcessEdgeModalDisplay']),
+    /**
+     * @desc   : 确定
+     * @author : 张潇木
+     * @date   : 2023/1/5 10:38
+     */
+    modalOk(){
+      this.setProcessEdgeModalDisplay(false)
+      let graph = Process.graph;
+      let cell = graph.getCellById(this.process.currentEdgeId);
+      cell.setData(this.edgeData)
+      // cell.setAttrs({ });
+    },
+    /**
+     * @desc   : 取消
+     * @author : 张潇木
+     * @date   : 2023/1/5 10:38
+     */
+    modalCancel(){
+      this.setProcessEdgeModalDisplay(false)
+    },
+  }
+
+}
+</script>
+
+<style scoped>
+/deep/ .ivu-radio-wrapper{
+  font-size: 12px!important;
+}
+.ivu-divider-horizontal{
+  margin: 12px 0!important;
+}
+</style>

+ 2 - 0
src/components/business/process/edge-modal/index.js

@@ -0,0 +1,2 @@
+import EdgeModal from './edge-modal.vue'
+export default EdgeModal

+ 186 - 47
src/components/business/process/node-modal/node-modal.vue

@@ -12,57 +12,152 @@
      sticky
      @modalOk="modalOk"
      @modalCancel="modalCancel">
-      <DkForm ref="formInline" :col-count="4">
-        <!--    节点编码    -->
-        <DkFormItem prop="nodeCode" :required="true">
-          <InputPop v-model="nodeData.nodeCode" ref="nodeCode"/>
-        </DkFormItem>
+      {{process.currentNodeId}}
+      {{nodeData}}
+      <DkForm ref="formInline" :col-count="4" :label-max-words="6">
         <!--    节点名称    -->
         <DkFormItem prop="nodeName" :required="true">
           <InputPop v-model="nodeData.nodeName" ref="nodeName"/>
         </DkFormItem>
-        <!--    节点类型    -->
-        <DkFormItem prop="nodeType" :required="true">
-          <InputPop v-model="nodeData.nodeType" ref="nodeType"/>
+        <!--    流程类型    -->
+        <DkFormItem prop="flowKind" :required="true">
+          <SelectPop ref="flowKind" v-model="nodeData.flowKind"  label-key="typeName" value-key="typeId" :multiple="false"
+                     :options="[{typeId:1,typeName:'开始节点'}, {typeId:2,typeName:'中间节点'}, {typeId:3,typeName:'结束节点'},]" />
         </DkFormItem>
-        <!--    组织机构    -->
-        <DkFormItem prop="organization" :required="true">
-          <SelectMagnifier v-model="nodeData.orgId" :display-text="nodeData.orgName"
-                           :type="this.$config.MagnifierType.organization"
-                           :multiple="false"></SelectMagnifier>
+        <!--    工号类型    -->
+        <DkFormItem prop="userKind" :required="true">
+          <SelectPop ref="userKind" v-model="nodeData.userKind" label-key="typeName" value-key="typeId" :multiple="false"
+                     :options="[{typeId:1,typeName:'操作工号'},{typeId:2,typeName:'生产工号'},]" />
         </DkFormItem>
         <!--    采集方式    -->
-        <DkFormItem prop="collectType" :required="true">
-          <DkRadio ref="collectType" v-model="nodeData.collectType" :options="[{value:1,label:'单点采集'}, {value:2,label:'集中采集'},]"/>
+        <DkFormItem prop="pieceKind" :required="true">
+          <SelectPop ref="pieceKind" v-model="nodeData.pieceKind" label-key="typeName" value-key="typeId" :multiple="false"
+                   :options="[{typeId:1,typeName:'单品'}, {typeId:2,typeName:'批量'},{typeId:3,typeName:'数量'}, {typeId:4,typeName:'特殊'},]"/>
+        </DkFormItem>
+        <!--    操作模式    -->
+        <DkFormItem prop="opnKind" :required="true">
+          <SelectPop ref="opnKind" v-model="nodeData.opnKind" label-key="typeName" value-key="typeId" :multiple="false"
+                     :options="[{typeId:1,typeName:'产品码'}, {typeId:2,typeName:'防伪码'},{typeId:3,typeName:'外箱码'}, {typeId:4,typeName:'登载具'},
+                                {typeId:5,typeName:'卸载具'}, {typeId:6,typeName:'换载具'},{typeId:7,typeName:'载具码'}, {typeId:8,typeName:'数量'},{typeId:9,typeName:'特殊'},]"/>
+        </DkFormItem>
+        <!--    工序标签    -->
+        <DkFormItem prop="nodeSysTags">
+          <SelectPop ref="nodeSysTags" v-model="nodeData.nodeSysTags" label-key="typeName" value-key="typeId" :multiple="true"
+                     :options="[{typeId:1,typeName:'交坯统计'}, {typeId:2,typeName:'成检统计'}]"/>
+        </DkFormItem>
+        <!--    撤销标识    -->
+        <DkFormItem prop="flgUndo" :required="true">
+          <DkRadio ref="flgUndo" v-model="nodeData.flgUndo" :options="[{value:1,label:'能撤销'}, {value:2,label:'不能撤销'},]"/>
+        </DkFormItem>
+        <!--    默认分级    -->
+        <DkFormItem prop="defGradeId">
+          <SelectPop ref="defGradeId" v-model="nodeData.defGradeId" label-key="typeName" value-key="typeId" :multiple="false"
+                     :options="[{typeId:1,typeName:'良品'}, {typeId:2,typeName:'次品'}]"/>
+        </DkFormItem>
+        <!--    成型标签    -->
+        <DkFormItem prop="moldingSysTags">
+          <SelectPop ref="moldingSysTags" v-model="nodeData.moldingSysTags" label-key="typeName" value-key="typeId" :multiple="true"
+                     :options="[{typeId:1,typeName:'高压'}, {typeId:2,typeName:'普通'}]"/>
+        </DkFormItem>
+        <!--    可判分级    -->
+        <DkFormItem prop="judgeGradeIds">
+          <SelectPop ref="judgeGradeIds" v-model="nodeData.judgeGradeIds" label-key="typeName" value-key="typeId" :multiple="true"
+                     :options="[{typeId:1,typeName:'良品'}, {typeId:2,typeName:'次品'}]"/>
         </DkFormItem>
-        <!--    必须工序    -->
-        <DkFormItem prop="necessary" :required="true">
-          <DkRadio ref="necessary" v-model="nodeData.necessary" :options="[{value:1,label:'必须'}, {value:2,label:'非必须'},]"/>
+        <!--    独立检验    -->
+        <DkFormItem prop="flgAloneJudge" :required="true">
+          <DkRadio ref="flgAloneJudge" v-model="nodeData.flgAloneJudge" :options="[{value:1,label:'是'}, {value:2,label:'否'},]"/>
         </DkFormItem>
-        <!--    商标釉料    -->
-        <DkFormItem prop="brandGlaze" :required="true">
-          <DkRadio ref="brandGlaze" v-model="nodeData.brandGlaze" :options="[{value:1,label:'可变更'}, {value:2,label:'不可变更'},]"/>
+        <!--    返回分级    -->
+        <DkFormItem prop="backGradeIds">
+          <SelectPop ref="backGradeIds" v-model="nodeData.backGradeIds" label-key="typeName" value-key="typeId" :multiple="true"
+                     :options="[{typeId:1,typeName:'良品'}, {typeId:2,typeName:'次品'}]"/>
         </DkFormItem>
-        <!--    撤销计件    -->
-        <DkFormItem prop="revokeCount" :required="true">
-          <DkRadio ref="revokeCount" v-model="nodeData.revokeCount" :options="[{value:1,label:'能撤销'}, {value:2,label:'不能撤销'},]"/>
+        <!--    返回完成工序    -->
+        <DkFormItem prop="backNodeId">
+          <SelectPop ref="backNodeId" v-model="nodeData.backNodeId" label-key="typeName" value-key="typeId" :multiple="false"
+                     :options="[{typeId:1,typeName:'干补'}, {typeId:2,typeName:'交坯'}]"/>
         </DkFormItem>
-        <!--    扫码类型    -->
-        <DkFormItem prop="scanType" :required="true">
-          <DkRadio ref="scanType" v-model="nodeData.scanType" :options="[{value:1,label:'注浆条码'}, {value:2,label:'包装条码'},]"/>
+        <!--    可回收分级    -->
+        <DkFormItem prop="recycledGradeIds">
+          <SelectPop ref="recycledGradeIds" v-model="nodeData.recycledGradeIds" label-key="typeName" value-key="typeId" :multiple="true"
+                     :options="[{typeId:1,typeName:'良品'}, {typeId:2,typeName:'次品'}]"/>
+        </DkFormItem>
+        <!--    回收后处理方式    -->
+        <DkFormItem prop="recycledKind" :auto-label-width="true">
+          <SelectPop ref="recycledKind" v-model="nodeData.recycledKind" label-key="typeName" value-key="typeId" :multiple="false"
+                     :options="[{typeId:1,typeName:'干补'}, {typeId:2,typeName:'回收'}]"/>
+        </DkFormItem>
+        <!--    验证标签    -->
+        <DkFormItem prop="flgCheckLabel" :required="true">
+          <DkRadio ref="flgCheckLabel" v-model="nodeData.flgCheckLabel" :options="[{value:1,label:'是'}, {value:2,label:'否'},]"/>
+        </DkFormItem>
+        <!--    标签类型    -->
+        <DkFormItem prop="pdtLabelKinds">
+          <SelectPop ref="pdtLabelKinds" v-model="nodeData.pdtLabelKinds" label-key="typeName" value-key="typeId" :multiple="true"
+                     :options="[{typeId:1,typeName:'水效'},{typeId:2,typeName:'合格证'}, {typeId:3,typeName:'外箱码'}]"/>
+        </DkFormItem>
+        <!--    显示顺序    -->
+        <DkFormItem prop="displayNo" :required="true" :data-type="this.$config.dataType.number">
+          <InputNumberPop v-model="nodeData.displayNo" ref="displayNo" :min="1" :digits="0"/>
+        </DkFormItem>
+        <!--    备注    -->
+        <DkFormItem prop="remarks" :span="24">
+          <InputPop ref="remarks" v-model="nodeData.remarks" maxlength=500 textareaFlag/>
         </DkFormItem>
         <Divider></Divider>
-        <div style="padding-left: 30px;">
+        <div style="padding-left: 30px; display: flex">
+          <!--    工序工号    -->
+          <EditTable ref="goodsTable" :data="nodeData.userList"
+                     :columns="userColumns"
+                     enabledRepeatId="userId"
+                     controlId="userId"
+                     :height="200"
+                     :showSeqBtnFlag="false"
+                     :enabledRepeat="false"/>
+          <!--    工序在制品    -->
           <EditTable ref="goodsTable" :data="nodeData.pdtList"
                      :columns="pdtColumns"
                      enabledRepeatId="pdtId"
                      controlId="pdtId"
-                     :height="300"
+                     :height="200"
                      :showSeqBtnFlag="false"
-                     :enabledRepeat="false"
-          ></EditTable>
+                     :enabledRepeat="false"/>
+          <!--    工序可用载具    -->
+          <EditTable ref="goodsTable" :data="nodeData.carList"
+                     :columns="carColumns"
+                     enabledRepeatId="carId"
+                     controlId="carId"
+                     :height="200"
+                     :showSeqBtnFlag="false"
+                     :enabledRepeat="false"/>
+        </div>
+        <div style="padding-left: 30px; padding-top: 10px;display: flex">
+          <!--    工序可检缺陷    -->
+          <EditTable ref="goodsTable" :data="nodeData.defectList"
+                     :columns="defectColumns"
+                     enabledRepeatId="defectId"
+                     controlId="defectId"
+                     :height="200"
+                     :showSeqBtnFlag="false"
+                     :enabledRepeat="false"/>
+          <!--    工序工种缺陷    -->
+          <EditTable ref="goodsTable" :data="nodeData.jobDefectList"
+                     :columns="jobDefectColumns"
+                     enabledRepeatId="defectId"
+                     controlId="defectId"
+                     :height="200"
+                     :showSeqBtnFlag="false"
+                     :enabledRepeat="false"/>
+          <!--    无线路由    -->
+          <EditTable ref="goodsTable" :data="nodeData.routerList"
+                     :columns="routerColumns"
+                     enabledRepeatId="defectId"
+                     controlId="defectId"
+                     :height="200"
+                     :showSeqBtnFlag="false"
+                     :enabledRepeat="false"/>
         </div>
-
       </DkForm>
     </DkModal>
   </div>
@@ -70,47 +165,88 @@
 
 <script>
 import {mapState, mapMutations} from 'vuex'
+import Process from '@/view/process/index.js'
 export default {
   name: 'NodeModal',
   props: {
-    nodeType: {
+    flowKind: {
       type: Number,
       default: undefined,
     },
-    nodeData: {
-      type: Object,
-      default: {},
-    },
   },
   computed: {
     ...mapState(['process']),
+   id(){
+      return this.process.currentNodeId
+    }
   },
-  watch: {
-
+  watch:{
+    id(n,o){
+      let graph = Process.graph;
+      let cell = graph.getCellById(this.process.currentNodeId);
+      this.nodeData=cell.data
+    }
   },
   data() {
     return {
+      nodeData: {},
+      userColumns:[
+        {field: 'userId', type: 'disabled', width: 100},
+        {field: 'userName', type: 'disabled', width: 100},
+        {field: 'userKind', type: 'disabled', width: 100},
+        {field: 'remark', type: 'disabled', width: 100},
+      ],
       pdtColumns:[
         // {type: 'seq', width: 60},
-        {field: 'pdtCode', type: 'disabled', width: 255},
-        {field: 'pdtName', type: 'disabled', width: 255},
-        {field: 'pdtType', type: 'disabled', width: 255},
-        {field: 'pdtSpec', type: 'disabled', width: 255},
-      ]
+        {field: 'pdtCode', type: 'disabled', width: 100},
+        {field: 'pdtName', type: 'disabled', width: 100},
+        {field: 'pdtType', type: 'disabled', width: 100},
+        {field: 'pdtSpec', type: 'disabled', width: 100},
+      ],
+      carColumns:[
+        {field: 'carId', type: 'disabled', width: 150},
+        {field: 'carName', type: 'disabled', width: 150},
+        {field: 'remark', type: 'disabled', width: 150},
+      ],
+      defectColumns:[
+        {field: 'defectCode', type: 'disabled', width: 100},
+        {field: 'defectName', type: 'disabled', width: 100},
+        {field: 'defectTypes', type: 'disabled', width: 100},
+        {field: 'remark', type: 'disabled', width: 100},
+      ],
+      jobDefectColumns:[
+        {field: 'jobId', type: 'disabled', width: 100},
+        {field: 'defectCode', type: 'disabled', width: 100},
+        {field: 'defectName', type: 'disabled', width: 100},
+        {field: 'remark', type: 'disabled', width: 100},
+      ],
+      routerColumns:[
+        {field: 'node1Id', type: 'disabled', width: 90},
+        {field: 'backNodeId', type: 'disabled', width: 90},
+        {field: 'productGrade', type: 'disabled', width: 90},
+        {field: 'moldingSysTags', type: 'disabled', width: 90},
+        {field: 'remark', type: 'disabled', width: 90},
+      ],
     }
   },
   created() {
   },
   methods: {
-    ...mapMutations(['setProcessNodeModalDisplay']),
+    ...mapMutations(['setProcessNodeModalDisplay','setProcessEdgeModalDisplay']),
     /**
      * @desc   : 确定
      * @author : 张潇木
      * @date   : 2023/1/5 10:38
      */
     modalOk(){
-
-      this.modalCancel();
+      this.setProcessNodeModalDisplay(false)
+      let graph = Process.graph;
+      let cell = graph.getCellById(this.process.currentNodeId);
+      cell.setData(this.nodeData)
+      cell.setAttrs({
+        label: { text: this.nodeData.nodeName },
+        text: { text: this.nodeData.nodeName },
+      });
     },
     /**
      * @desc   : 取消
@@ -129,4 +265,7 @@ export default {
 /deep/ .ivu-radio-wrapper{
   font-size: 12px!important;
 }
+.ivu-divider-horizontal{
+  margin: 12px 0!important;
+}
 </style>

+ 6 - 6
src/components/main/components/user/user.vue

@@ -457,13 +457,13 @@ export default {
      */
     getSettings(password) {
       console.log(password)
+      let params = {
+        cpId: 1,
+        sysId: 1, /* 从集团端取 */
+      }
       return new Promise((resolve => {
-        settingService.selectByCond({
-          // cpId: this.$store.state.user.cpId,
-          // sysId: this.$store.state.user.sysId,
-          cpId: 1,
-          sysId: 1, /* 从集团端取 */
-        }).then(res => {
+        this.excute(this.$service.equipThmeterService, this.$service.equipThmeterService.selectByCond, params).then(res => {
+          console.log('res',res)
           if (res.code == 200) {
             // 密码规则
             if (!password) {

+ 11 - 0
src/config/index.js

@@ -226,6 +226,17 @@ export default {
   },
 
   /**
+   * @desc   : 数据种类
+   * @author : 夏常明
+   * @date   : 2023/1/30 16:17
+   */
+  kindType:{
+    defectType:'缺陷类别',
+    productGrade:'产品等级',
+  },
+
+
+  /**
    * @desc   : 有显示顺序的表
    * @author : 周兴
    * @date   : 2023/1/6 13:09

+ 40 - 4
src/locale/lang/zh-CN.js

@@ -10,7 +10,8 @@ export default function () {
     formTitle,
     columns,
     messages,
-    others
+    others,
+    appColumns
   )
 }
 /**
@@ -151,7 +152,7 @@ export const formTitle = {
   'busobj': '业务对象',
   'busobjCategory': '业务对象类别',
   'productPlace': '产品位置',
-  'equipThmeter': '湿温度计',
+  'equipThmeter': '温湿度计',
   'carrKilnCar': '窑车',
   'productDefectType': '产品缺陷分类',
   'productBrand': '产品品牌',
@@ -165,6 +166,8 @@ export const formTitle = {
   'productGrade': '产品分级',
   'productDefect': '产品缺陷',
   'modelPdtLabel': '验证标签',
+  'productDamage': '损坯原因',
+
   //---------
   'role-add': '新建角色',
   'role-edit': '编辑角色',
@@ -303,7 +306,7 @@ export const columns = {
   thmeterCode:'温湿度计编码',
   thmeterName:'温湿度计名称',
   modelkind:'型号种类',
-  spaceId:'工区域',
+  spaceId:'工区域',
   spaceCode:'区域代码',
   spaceName:'区域名称',
   spaceKind:'模型类型',
@@ -331,6 +334,10 @@ export const columns = {
   defectTypes: '缺陷分类',
   defectTypesName: '缺陷分类',
 
+  damageCode:'损坯代码',
+  damageName: '损坯名称',
+  damageTypes: '损坯分类',
+
   brandCode: '品牌代码',
   brandName: '品牌名称',
 
@@ -369,12 +376,30 @@ export const columns = {
   collectType:'采集方式',
   necessary:'必须工序',
   brandGlaze:'商标釉料',
-  revokeCount:'撤销计件',
+  flgUndo:'撤销标识',
   scanType:'扫码类型',
   pdtCode:'在制品编码',
   pdtName:'在制品名称',
   pdtType:'在制品类别',
   pdtSpec:'在制品规格',
+  flowKind:'流程类型',
+  userKind:'工号类型',
+  pieceKind:'计件模式',
+  opnKind:'操作模式',
+  nodeSysTags:'工序标签',
+  defGradeId:'默认分级',
+  moldingSysTags:'成型标签',
+  judgeGradeIds:'可判分级',
+  flgAloneJudge:'独立检验',
+  backGradeIds:'返回分级',
+  backNodeId:'返回完成工序',
+  recycledGradeIds:'可回收分级',
+  recycledKind:'回收后处理方式',
+  flgCheckLabel:'验证标签',
+  pdtLabelKinds:'标签类型',
+  node1Id:'发出节点',
+  node2Id:'到达节点',
+
 
 
   fty:'工厂',
@@ -461,6 +486,7 @@ export const messages = {
   W_075: '所选明细不可重复',
   W_086: '当前单据状态不允许冲正',
   W_089: '第{param1}条{param2}为空',
+  W_090: '系统参数值不可以为空',
   E_001: '系统出现异常,请联系管理员。',
   Q_001: '当前页面的数据有过更改,请确认需要保存吗?',
   Q_002: '确定要进行{param}操作吗?',
@@ -599,3 +625,13 @@ export const others = {
   colPosition:'列定位',
 }
 
+/**
+ * @desc   : app字段信息
+ * @author : 于继渤
+ * @date   : 2023/1/30 9:51
+ */
+export const appColumns ={
+  moldingMoldManagementSearchPlaceholder:'请输入成型线号',
+  moldingMoldManagementActiveTitle:'成型模具管理',
+  uniqueCode:'模具条码'
+}

+ 3 - 4
src/mixins/index.js

@@ -136,11 +136,10 @@ export const indexMixin = {
     },
     /**
      * @desc   : 查询销售订单档案资料接口
-     * @author : 寇珊珊
+     * @author : 周兴
      * @date   : 2022/3/29 16:05
      */
     searchData(pageInfo = null) {
-      console.log('333',pageInfo)
       //查询条件
       this.setCondition(this.searchCond)
       // 设置查询条件
@@ -255,7 +254,7 @@ export const indexMixin = {
       })
     },
     /**
-     * @desc   : 执行数据库方法
+     * @desc   : 调用后台接口
      * @author : 周兴
      * @param  : service:那个实体,$service;method:方法名;params:参数,showMessage:是否显示错误信息; button:提示信息的button
      * @date   : 2022/12/12 13:33
@@ -284,7 +283,7 @@ export const indexMixin = {
       }
     },
     /**
-     * @desc   : 执行数据库方法
+     * @desc   : 调用后台接口(无参数)
      * @author : 周兴
      * @param  : service:那个实体,$service;method:方法名;params:参数,showMessage:是否显示错误信息
      * @date   : 2022/12/12 13:33

+ 1 - 1
src/router/index.js

@@ -60,7 +60,7 @@ const router = new Router({
 
 
 const NO_AUTH_NAME = ['error_500', 'login', 'login_hegii', 'auth', 'test', 'qv-login', 'wx-print', 'approval_waiting_for_approval', 'approval_waiting_for_approval_detail', 'log_report_export']
-const NO_APP_AUTH_NAME = ['app-login','test','main','index','report','other','mine','molding-mold-management']
+const NO_APP_AUTH_NAME = ['app-login','test','main','index','report','other','mine','molding-mold-management','die-loss-reporting','mold-management-add']
 
 router.beforeEach((to, from, next) => {
   // console.log('to', to,router,to.query)

+ 18 - 1
src/router/routers.js

@@ -112,7 +112,24 @@ let menu = [
     },
     component: () => import('@/view-app/mold-management/molding-mold-management/index.vue'),
   },
-
+  {
+    path: '/app/die-loss-reporting',
+    name: 'die-loss-reporting',
+    meta: {
+      title: '模具报损',
+      hideInMenu: true
+    },
+    component: () => import('@/view-app/mold-management/die-loss-reporting/index.vue'),
+  },
+  {
+    path: '/app/mold-management-add',
+    name: 'mold-management-add',
+    meta: {
+      title: '模具管理新建',
+      hideInMenu: true
+    },
+    component: () => import('@/view-app/mold-management/mold-management-add/index.vue'),
+  },
   {
     path: '/',
     name: '_home',

+ 18 - 3
src/store/index.js

@@ -32,11 +32,17 @@ export default new Vuex.Store({
     conditionsConfig1: {
       conditionNodes: [],
     },
-    process:{//流程图
-      nodeModal:{//节点弹窗
+    process:{       //流程图
+      nodeModal:{   //节点弹窗
         display:false,
         saveLoading:false
-      }
+      },
+      edgeModal:{   //连线弹窗
+        display:false,
+        saveLoading:false
+      },
+      currentNodeId:undefined,//当前点击节点id
+      currentEdgeId:undefined,//当前点击连线id
     }
   },
   mutations: {
@@ -78,6 +84,15 @@ export default new Vuex.Store({
     setProcessNodeModalDisplay(status, payload) {
       status.process.nodeModal.display = payload
     },
+    setProcessEdgeModalDisplay(status, payload) {
+      status.process.edgeModal.display = payload
+    },
+    setCurrentNodeId(status, payload) {
+      status.process.currentNodeId = payload
+    },
+    setCurrentEdgeId(status, payload) {
+      status.process.currentEdgeId = payload
+    },
   },
   actions: {
     //

+ 15 - 1
src/view-app/main/other.vue

@@ -61,8 +61,22 @@ export default {
           PFunctionCode: '01',
           FunctionCode: '0101'
         },
-
+        {
+          FunctionName: '模具报损',
+          FormName: '/app/die-loss-reporting',
+          ImageUri: require('@/assets/images/app-image/test01.png'),
+          PFunctionCode: '01',
+          FunctionCode: '0102'
+        },
+        {
+          FunctionName: '模具管理新建',
+          FormName: '/app/mold-management-add',
+          ImageUri: require('@/assets/images/app-image/test01.png'),
+          PFunctionCode: '01',
+          FunctionCode: '0103'
+        },
       ],
+
       functionRegions: ['模具管理'],
     }
   },

+ 15 - 0
src/view-app/mold-management/die-loss-reporting/index.vue

@@ -0,0 +1,15 @@
+<template>
+  <div>
+    die-loss-reporting
+  </div>
+</template>
+
+<script>
+export default {
+  name: "die-loss-reportingt"
+}
+</script>
+
+<style scoped>
+
+</style>

+ 202 - 0
src/view-app/mold-management/mold-management-add/index.vue

@@ -0,0 +1,202 @@
+<template>
+  <div>
+    <!--    表单检验-->
+    <van-form @submit="onSubmit">
+      <van-field
+        v-model="moldCode"
+        name="模具条码"
+        label="模具条码"
+        placeholder="请填写模具条码"
+        :rules="[{ required: true, message: '请填写模具条码' }]"
+      />
+      <!--    跳页  -->
+      <van-field
+        v-model="productCode"
+        name="产品编码"
+        label="产品编码"
+        placeholder="产品编码"
+        :rules="[{ required: true, message: '请选择产品编码' }]"
+      />
+      <van-field
+        v-model="moldType"
+        name="模具类型"
+        label="模具类型"
+        readonly="true"
+        @click="showMoldType = true"
+        placeholder="请选择模具类型" is-link arrow-direction="down"
+        :rules="[{ required: true, message: '请选择模具类型' }]"
+      />
+
+      <van-field
+        v-model="weight"
+        name="重量(kg)"
+        label="重量(kg)"
+        placeholder="重量(kg)"
+        :rules="[{ required: true, message: '请填写重量(kg)' }]"
+      />
+
+      <van-field
+        v-model="materialSupplier"
+        name="材料供应商"
+        label="材料供应商"
+        readonly="true"
+        placeholder="请选择材料供应商" is-link arrow-direction="down"
+        :rules="[{ required: true, message: '请选择材料供应商' }]"
+      />
+
+      <van-field
+        v-model="cost"
+        name="成本(元)"
+        label="成本(元)"
+        placeholder="成本(元)"
+        :rules="[{ required: true, message: '请填写成本(元)' }]"
+      />
+
+      <van-field
+        v-model="producedate"
+        name="生产日期"
+        label="生产日期"
+        readonly="true"
+        @click="showProducedate = true"
+        placeholder="请选择生产日期" is-link arrow-direction="down"
+        :rules="[{ required: true, message: '请选择生产日期' }]"
+      />
+      <!--      日期控件-->
+      <van-calendar v-model="showProducedate" @confirm="onConfirmProduceDate"/>
+      <van-field
+        v-model="outputQuantity"
+        name="产出数量"
+        label="产品编码"
+        placeholder="产品编码"
+        :rules="[{ required: true, message: '请填写产品编码' }]"
+      />
+      <van-field
+        v-model="productionjobNumber"
+        name="生产工号"
+        label="模具条码"
+        placeholder="模具条码"
+        :rules="[{ required: true, message: '请填写模具条码' }]"
+      />
+      <van-field
+        v-model="standardTimes"
+        name="标准次数"
+        label="产品编码"
+        placeholder="产品编码"
+        :rules="[{ required: true, message: '请填写产品编码' }]"
+      />
+      <van-field
+        v-model="standardsTotalNumber"
+        name="标准总数"
+        label="模具条码"
+        placeholder="模具条码"
+        :rules="[{ required: true, message: '请填写模具条码' }]"
+      />
+      <van-field
+        v-model="remarks"
+        name="备注"
+        label="产品编码"
+        placeholder="产品编码"
+        :rules="[{ required: true, message: '请填写产品编码' }]"
+      />
+      <van-field
+        v-model="mouldsNumber"
+        name="模具个数"
+        label="模具条码"
+        placeholder="模具条码"
+        :rules="[{ required: true, message: '请填写模具条码' }]"
+      />
+      <div style="display: flex">
+        <van-switch v-model="checked"></van-switch>
+        <div style=" align-self: center;">保存后直接打印</div>
+      </div>
+      <div style="margin: 16px;">
+        <van-button round block type="info" native-type="submit">保存</van-button>
+      </div>
+    </van-form>
+    <!--    模具类型弹出框-->
+    <van-popup v-model="showMoldType" position="bottom">
+      <van-picker
+        title="标题"
+        show-toolbar
+        :columns="MoldTypeData"
+        @confirm="onConfirmMoldType"
+        @cancel="onCancelMoldType"
+        @change="onChangeMoldType"
+      />
+    </van-popup>
+
+  </div>
+</template>
+
+<script>
+import {Toast} from "vant";
+
+export default {
+  name: "mold-management-add",
+  data() {
+    return {
+      moldCode: '',//模具条码
+      productCode: '',//产品条码
+      moldType: '',//模具类型
+      showMoldType: false,
+      weight: '',//重量
+      materialSupplier: '',//材料供应商
+      cost: '',//成本
+      producedate: '',//生产日期
+      showProducedate: false,
+      outputQuantity: '',//产出数量
+      productionjobNumber: '',//生产工号
+      standardTimes: '',//标准次数
+      standardsTotalNumber: '',//标准总数
+      remarks: '',//备注
+      mouldsNumber: '',//模具个数
+      MoldTypeData: ['石膏', '高压'],
+    }
+  },
+  methods: {
+    /**
+     * 日期格式返回方法
+     * @param date
+     * @returns {string}
+     */
+    formatDate(date) {
+      return `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
+    },
+    /**
+     * 生产日期确定时间
+     * @param date
+     */
+    onConfirmProduceDate(date) {
+      this.showProducedate = false;
+      this.producedate = this.formatDate(date);
+    },
+    /**
+     * 模具类型确定事件
+     * @param value
+     * @param index
+     */
+    onConfirmMoldType(value, index) {
+      Toast(`当前值:${value}, 当前索引:${index}`);
+    },
+    /**
+     * 模具类型值改变监听
+     * @param picker
+     * @param value
+     * @param index
+     */
+    onChangeMoldType(picker, value, index) {
+      Toast(`当前值:${value}, 当前索引:${index}`);
+    },
+    /**
+     * 模具类型选择取消监听
+     */
+    onCancelMoldType() {
+      Toast('取消');
+    },
+  },
+}
+</script>
+
+<style scoped>
+
+</style>

+ 98 - 3
src/view-app/mold-management/molding-mold-management/index.vue

@@ -1,15 +1,110 @@
 <template>
-  <div>
-    molding-mold-management
+  <div class="main-app">
+    <!-- 顶部导航栏 -->
+    <dk-app-nav-bar :title="$t('moldingMoldManagementActiveTitle')" :leftArrow="false" @click-left="onClickLeft"></dk-app-nav-bar>
+    <van-sticky :offset-top="46">
+      <dk-app-search :placeholder="$t('moldingMoldManagementSearchPlaceholder')"></dk-app-search>
+    </van-sticky>
+    <!--    主体-->
+    <div class="main">
+      <!--  列表-->
+      <div v-for="(item,index) in tableData" class="table-class">
+        <div class="table-foot" style="border-radius: 7px;">
+          <div class="table">
+            <div style="display: flex; padding: 7px;">
+
+              <div style="width: 10%;">
+                <div style="align-items: center;padding-top: 150px">
+                  <van-checkbox v-model="item.checked"></van-checkbox>
+                </div>
+
+              </div>
+<!--              TODO 未完成-->
+              <div style="width: 90%;">
+                <dk-app-cell title="模具编号" :value="item.name" :center="true" ></dk-app-cell>
+                <dk-app-cell :title="$t('uniqueCode')" :value="item.name" :center="true" ></dk-app-cell>
+                <dk-app-cell title="产品编码" :value="item.name" :center="true" ></dk-app-cell>
+                <dk-app-cell title="注浆次数" :value="item.name" :center="true" ></dk-app-cell>
+                <dk-app-cell title="开始日期" :value="item.name" :center="true" ></dk-app-cell>
+                <dk-app-cell title="备注" :value="item.name" :center="true" ></dk-app-cell>
+                <dk-app-cell title="操作备注" :value="item.name" :center="true" ></dk-app-cell>
+
+
+              </div>
+            </div>
+
+
+          </div>
+        </div>
+
+      </div>
+
+    </div>
   </div>
 </template>
 
 <script>
+import {appIndexMixin} from '@/mixins/appindex.js'
+
 export default {
-  name: "molding-mold-management"
+  name: "molding-mold-management",
+  mixins: [appIndexMixin],
+  data() {
+    return {
+
+      tableData: [
+        {
+          title: '模具变化',
+          checked: false,
+          name: 'A00A10-A01(正常)'
+        },
+        {
+          title: '模具名称',
+          checked: false,
+          name: 'A00A10-A01(正常)'
+        }
+      ]
+    }
+  },
+  methods:{
+    onClickLeft(){
+      this.$router.go(-1)
+    },
+
+  }
 }
 </script>
 
 <style scoped>
+.van-cell--large {
+  padding-top: 5px !important;
+  padding-bottom: 0px !important;
+}
+
+.main {
+  padding-top: 46px;
+  padding-bottom: 50px;
+}
+
+.table-class {
+  margin: 10px 10px 10px 10px;
+  margin-top: 10px;
+  border-radius: 7px;
+  box-shadow: 2px 2px 5px #e5e5e6;
+}
+
+.table-foot {
+  background: #fff;
+  width: 100%;
+  border-radius: 7px 7px 0px 0px;
+  /*background: linear-gradient(180deg, #E2ECFF 0%, #FAFCFF 100%), #fff;*/
+  background-repeat: no-repeat;
+  background-size: 100% 46px;
+}
+
+/*.table {*/
+/*  width: 94%;*/
+/*  padding: 10px 3% 10px 3%;*/
 
+/*}*/
 </style>

+ 4 - 9
src/view/core/equip-thmeter/index.vue

@@ -34,7 +34,7 @@
                :multiple="false"
                :height="this.tableHeight" primaryKey="uniqueId"
                @pageChange="pageSizeChange">
-        <DkTableColumn field="uniqueCode"></DkTableColumn>
+        <DkTableColumn field="uniqueCode" :title="$t('thmeterCode')"></DkTableColumn>
         <DkTableColumn field="thmeterName"></DkTableColumn>
         <DkTableColumn field="spaceName"></DkTableColumn>
         <DkTableColumn field="flgValid" type="switch" :title="$t('flgValid')" @on-switch-change="onSwitchChange"
@@ -51,10 +51,10 @@
       :saveFlag="true"
       :title=modalTitle
     >
-      <DkForm ref="formInline" v-model="formData" :col-count="1">
+      <DkForm ref="formInline" v-model="formData" :col-count="1" :label-max-words="6" >
         <!--    温湿度计编码    -->
-        <DkFormItem prop="uniqueCode" :required="true">
-          <InputPop v-model="formData.uniqueCode" ref="uniqueCode"/>
+        <DkFormItem prop="uniqueCode" :required="true" :label="$t('thmeterCode')">
+          <InputPop v-model="formData.uniqueCode" ref="uniqueCode" />
         </DkFormItem>
         <!--    温湿度计名称    -->
         <DkFormItem prop="thmeterName" :required="true">
@@ -125,11 +125,9 @@ export default {
     onSwitchChange(param) {
       if (param.flgValid) {
         this.excuteNoParam(this.$service.equipThmeterService, this.$service.equipThmeterService.enable, [param.uniqueId]).then(res => {
-          this.searchData();
         })
       } else {
         this.excuteNoParam(this.$service.equipThmeterService, this.$service.equipThmeterService.disable, [param.uniqueId]).then(res => {
-          this.searchData();
         })
       }
     },
@@ -178,8 +176,6 @@ export default {
      */
     setParams(arg) {
       this.params = this.formData
-      this.params.cpId = this.$store.state.user.cpId
-      this.params.sysId = this.$store.state.user.sysId
     },
     /**
      *   @desc   : 保存数据
@@ -187,7 +183,6 @@ export default {
      *   @author : 寇珊珊
      */
     saveData() {
-      console.log('this.params',this.params)
       return this.modalParams.button === this.$config.formMode.add
         ? this.excute(this.$service.equipThmeterService, this.$service.equipThmeterService.insert, this.params)
         : this.excute(this.$service.equipThmeterService, this.$service.equipThmeterService.update, this.params)

+ 1 - 1
src/view/core/job/index.vue

@@ -120,7 +120,7 @@ export default {
     },
     /**
      * @desc   : 获取数据
-     * @author : 沈博
+     * @author : 周兴
      * @date   : 2022年12月13日15:04:17
      */
     getData(params) {

+ 35 - 53
src/view/core/system-setting/index.vue

@@ -118,7 +118,8 @@ export default {
   },
 
   methods: {
-    /*************************************************界面其他相关操作start*********************************************/
+
+    // region 一览界面操作start
     /**
      * @desc   : 下拉框值变化事件
      * @author : 寇珊珊
@@ -208,39 +209,30 @@ export default {
         }
       }
     },
-    /*************************************************界面其他相关操作end***********************************************/
-    /**
-     * @desc   : 系统参数分类的参数设定
-     * @author : 寇珊珊
-     * @date   : 2022/3/24 14:29
-     */
-    setSettingClassParams() {
-      let params = {}
-      params.classType = 1 // 1:密码安全策略
-      params.lan = this.$store.state.app.local_lan
-      params.sysId = this.$store.state.user.sysId
-      return params
-    },
+    // endregion
 
+    // region 新建/编辑start
     /**
-     * @desc   : 租户系统参数列表的参数设定
-     * @author : 寇珊珊
-     * @date   : 2022/3/24 14:29
+     * @desc   : 保存参数校验
+     * @author : 夏常明
+     * @date   : 2023/1/31 9:56
      */
-    setSettingDataParams(classCode) {
-      let params = this.searchList
-      params.classType = this.$config.sysType.password_security_policy // 1:密码安全策略
-      params.classCode = classCode // 分类代码
-      params.lan = this.$store.state.app.local_lan
-      params.sysId = this.$store.state.user.sysId
-      if (this.$store.state.user.cpId != 1) {
-        params.cpId = this.$store.state.user.cpId
+    validData(){
+      let list = this.tableRightData.filter(it => it.valueChangeFlg)
+      if (list && list.length > 0) {
+        for (let i = 0; i < list.length; i++) {
+          if (!(list[i].valueKind == 'BOOL' || list[i].valueKind == 'S-CHOICE') && (list[i].settingValue == '' || list[i].settingValue === undefined) || list[i].settingValue == '') {
+            this.$Message.error(this.$t('W_090'))
+            return false;
+          }
+        }
+      }
+      else
+      {
+        return  false;
       }
-      return params
+        return true;
     },
-
-    /***************************created调用数据接口函数************************************/
-    /*************************************************给实体/组件赋值start*******************************************/
     /**
      * @desc   : 系统参数发生变化时给参数赋值
      * @author : 夏常明
@@ -290,24 +282,18 @@ export default {
       }
       this.params = params;
     },
-    /*************************************************给实体/组件赋值end*********************************************/
-    /*************************************************保存及校验start*********************************************/
-    /**
-     * @desc   : 保存-如果表里有该数据则update
-     * @author : 寇珊珊
-     * @date   : 2022/3/5 15:52
-     */
+   /**
+    * @desc   : 保存系统参数值
+    * @author : 夏常明
+    * @date   : 2023/1/30 17:21
+    */
     saveData() {
       let params = []
       // 值发生变化的保存 valueChangeFlg为true值发生变化
-      let list = this.tableRightData.filter(it => it.valueChangeFlg == true)
+      let list = this.tableRightData.filter(it => it.valueChangeFlg)
       if (list && list.length > 0) {
         let message = ''
         list.forEach(it => {
-          if (!(it.valueKind == 'BOOL' || it.valueKind == 'S-CHOICE') && (it.settingValue == '' || it.settingValue === undefined)) {
-            message += this.$t('W_001', {'param': this.$t('settingValue')})
-            return
-          }
           // 输入类型 布尔类型 下拉类型的赋值
           if (it.valueKind == 'BOOL') {
             params.push({
@@ -322,6 +308,7 @@ export default {
               ftyId: this.$store.state.user.ftyId,
             })
           } else {
+
             params.push({
               settingCode: it.settingCode,   //参数代码
               settingValue: it.settingValue, //参数值
@@ -344,16 +331,6 @@ export default {
         })
       }
     },
-    /*************************************************保存及校验end***********************************************/
-    /*************************************************查询基础数据start*********************************************/
-    /**
-     * @desc   : 加载初始数据
-     * @author : 周兴
-     * @date   : 2022/12/30 11:33
-     */
-    initData() {
-      this.getSettingClassData();   // 参数分类列表
-    },
     /**
      * @desc   : 查询系统参数分类-左侧列表
      * @author : 夏常明
@@ -388,7 +365,7 @@ export default {
      * @date   : 2022年12月13日15:04:17
      */
     getData() {
-      this.getSettingClassData(); //查询系统参数分类-左侧列表
+      this.getSettingClassData();   // 参数分类列表
     },
     /**
      * @desc   : 查询系统参数-右侧列表
@@ -425,6 +402,10 @@ export default {
             }
             // 判断是否值和原来的值发生变化
             it.settingValueBack = it.settingValue
+            if(it.valueFormat!= undefined)
+            {
+              it.valueFormat = JSON.parse(it.valueFormat.value)
+            }
             this.tableRightData.push(it)
           })
           // 参数列表的数据-右侧列表-选中第一行
@@ -434,7 +415,8 @@ export default {
         }
       })
     },
-    /*************************************************查询基础数据end***********************************************/
+    // endregion
+
   },
   /**
    * @desc   : 在实例创建完成后被立即同步调用

+ 1 - 1
src/view/mst/product-brand/index.vue

@@ -150,7 +150,7 @@ export default {
         displayNo: 0,
         remarks: ''
       }
-      this.getMaxDisplayNo();
+      this.getMaxDisplayNo();//获取最大排序
     },
     /**
      *   @desc   : 给参数赋值

+ 1 - 1
src/view/mst/product-defect-type/index.vue

@@ -180,7 +180,7 @@ export default {
      */
     getDefectKindList(){
       let params = {
-        kindType:'缺陷类别'
+        kindType:this.$config.kindType.defectType
       }
       this.excute(this.$service.commonService, this.$service.commonService.getDataKind,params, false).then(res => {//调用api查询方法
         if (res.code === this.$config.SUCCESS_CODE) {

+ 18 - 5
src/view/mst/product-defect/index.vue

@@ -100,7 +100,9 @@ export default {
   data() {
     let self = this
     return {
-
+      defectCode:'defectCode',
+      defectName:'defectName',
+      defectTypes: 'defectTypes',
       editAddModal: false,
       modalTitle: '',//新建编辑弹窗名称
       submitType: '',//新建编辑提交类型
@@ -108,7 +110,7 @@ export default {
         defectName: '',
         defectCode: '',
         defectTypes: null,
-        defectKind: '缺陷类别-质量',
+        defectKind: this.$config.defectKind.Defect,
         ftyId: null,
         displayNo: 0,
         remarks: ''
@@ -183,7 +185,7 @@ export default {
         defectName: '',
         defectCode: '',
         defectTypes: null,
-        defectKind: '缺陷类别-质量',
+        defectKind: this.$config.defectKind.Defect,
         ftyId: null,
         displayNo: 1,
         remarks: ''
@@ -214,7 +216,18 @@ export default {
      *   @author : 洪旭东
      */
     add() {
-      this.modalTitle = this.setTitle(this.$config.formMode.add, 'productDefect')
+      if(this.type === this.$config.formCode.productDamage){        // 损批原因
+        this.modalTitle = this.setTitle(this.$config.formMode.add, 'productDamage')
+        this.defectCode = 'damageCode';
+        this.defectName = 'damageName';
+        this.defectTypes  = 'damageTypes';
+      }else if(this.type === this.$config.formCode.productDefect){    // 缺陷
+        this.modalTitle = this.setTitle(this.$config.formMode.add, 'productDefect')
+        this.defectCode = 'defectCode';
+        this.defectName = 'defectName';
+        this.defectTypes  =  'defectTypes';
+      }
+
       this.modalParams = {
         button: this.$config.formMode.add,
       }
@@ -241,7 +254,7 @@ export default {
      */
     getDefectTypeList(){
       let params = {
-        defectKind:'缺陷类别-质量',
+        defectKind:this.$config.defectKind.Defect,
         ftyId: this.$store.state.user.ftyId
       }
       if(this.type === this.$config.formCode.productDamage){        // 损批原因

+ 1 - 1
src/view/mst/product-grade/index.vue

@@ -245,7 +245,7 @@ export default {
      */
     getDefectKindList(){
       let params = {
-        kindType:'产品等级'
+        kindType:this.$config.kindType.productGrade
       }
       this.excute(this.$service.commonService, this.$service.commonService.getDataKind,params, false).then(res => {//调用api查询方法
         if (res.code === this.$config.SUCCESS_CODE) {

+ 5 - 0
src/view/mst/product-logo/index.vue

@@ -238,6 +238,11 @@ export default {
         }
       })
     },
+    /**
+     * @desc   : 查询商品品牌
+     * @author : 夏常明
+     * @date   : 2023/1/30 16:37
+     */
     getBrandList(){
       let params = {
         ftyId: this.$store.state.user.ftyId

+ 931 - 0
src/view/process/index.js

@@ -0,0 +1,931 @@
+import { Graph, Shape,FunctionExt } from '@antv/x6'
+import { Stencil } from '@antv/x6-plugin-stencil'
+import { Transform } from '@antv/x6-plugin-transform'
+import { Selection } from '@antv/x6-plugin-selection'
+import { Snapline } from '@antv/x6-plugin-snapline'
+import { Keyboard } from '@antv/x6-plugin-keyboard'
+import { Clipboard } from '@antv/x6-plugin-clipboard'
+import { History } from '@antv/x6-plugin-history'
+import { Export } from "@antv/x6-plugin-export";
+import { getImg } from '../../libs/base/x6-utils'
+import {mapState, mapMutations} from 'vuex'
+import store from '@/store'
+import './NodeGroup'
+const insertCss = require('insert-css')
+const zt1 = require('./zt1.json')
+
+
+//region 插入动画样式
+insertCss(`
+        @keyframes ant-line {
+          to {
+              stroke-dashoffset: -1000
+          }
+        }
+      `)
+//endregion 不通过insertCss的方式,只写样式,动画无效
+
+/**
+ * @desc   : 工艺流程图初始化配置
+ * @author : 张潇木
+ * @date   : 2023/1/3 11:46
+ */
+export default class Process {
+  static graph = null //图形对象
+  static embedPadding = 30 // 触发群组动态调整大小的padding
+  ctrlPressed = false//ctrl键是是否按下
+
+  // region 初始化图形
+  static init(dom){
+
+    // region 画布配置
+    this.graph = new Graph({
+      container: dom,//获取节点
+      background: {color: '#F2F7FA',},//画布背景色
+      autoResize:true,//自动设置宽高
+      panning: {//开启拖拽画布
+        enabled: true,
+        eventTypes: 'rightMouseDown',//触发画布平移的交互方式为“右键按下”
+      },
+      grid: {//设置网格
+        size: 10,
+        visible: true,
+        type: "doubleMesh",
+        args: [
+          {
+            color: "#eee", // 主网格线颜色
+            thickness: 1, // 主网格线宽度
+          },
+          {
+            color: "#ddd", // 次网格线颜色
+            thickness: 1, // 次网格线宽度
+            factor: 4, // 主次网格线间隔
+          },
+        ],
+      },
+      mousewheel: {//鼠标滚轮缩放画布
+        enabled: true,
+        zoomAtMousePosition: true,
+        modifiers: 'ctrl',
+        minScale: 0.5,
+        maxScale: 3,
+        factor: 1.1,//滚动缩放因子。默认为 1.2
+      },
+      connecting: {
+        line: {
+          stroke: '#A2B1C3',
+          strokeWidth: 3,
+          strokeDasharray: 5,
+          style: {
+            animation: 'ant-line 30s infinite linear',
+          },
+        },
+        router: {
+          name: 'metro',
+        },
+        connector: {
+          name: 'jumpover',
+          args: {
+            radius: 8,
+            size:12,
+          },
+        },
+        anchor: 'center',
+        connectionPoint: 'anchor',
+        allowBlank: false,
+        snap: {
+          radius: 20,
+        },
+        createEdge() {
+          return new Shape.Edge({
+            attrs: {
+              line: {
+                stroke: '#A2B1C3',
+                strokeWidth: 3,
+                strokeDasharray: 6,
+                style: {
+                  animation: 'ant-line 30s infinite linear',
+                },
+              },
+            },
+            zIndex: 0,
+            router: {
+              name: 'metro',
+            },
+            connector: {
+              name: 'jumpover',
+              args: {
+                radius: 8,
+                size:12,
+              },
+            },
+            data:{}
+          })
+        },
+        validateConnection({ targetMagnet }) {
+          return !!targetMagnet
+        },
+      },
+      highlighting: {//高亮
+        magnetAdsorbed: {//连线过程中,自动吸附到连接桩时被使用
+          name: 'stroke',
+          args: {
+            attrs: {
+              "stroke-width": 2,
+              fill: '#5F95FF',
+              stroke: 'white',
+            },
+          },
+        },
+      },
+      embedding: {//是否开启嵌套节点
+        enabled: true,
+        findParent({ node }) {
+          const bbox = node.getBBox()
+          return this.getNodes().filter((n) => {
+            // 如果拖拽的节点本身就是一个节点组,则不允许进入另一个节点组中
+            if(node.data&&node.data.parent){
+              return false
+            }
+            // 只有 data.parent 为 true 的节点才是父节点
+            const data = n.getData()
+            if (data && data.parent) {
+              const targetBBox = n.getBBox()
+              return bbox.isIntersectWithRect(targetBBox)
+            }
+            return false
+          })
+        },
+      },
+    })
+    // endregion
+
+    // region 注册插件
+    this.graph.use(new Transform({
+      resizing: true,
+      rotating: true,
+    }))
+      .use(new Selection({
+        enabled: true,
+        multiple: true,//是否启用点击多选,启用后按住 ctrl 或 command 键点击节点实现多选
+        rubberband: true,//是否启用多选节点功能
+        showNodeSelectionBox: true,//是否显示节点的选择框
+      }))
+      .use(new Snapline({
+        enabled: true,
+      }))
+      .use(new Keyboard({
+        enabled: true,
+      }))
+      .use(new Clipboard({
+        enabled: true,
+      }))
+      .use(new History({
+        enabled: true,
+      }))
+      .use(new Export({
+          enabled:true
+        }
+      ));
+    // endregion
+
+    // region 左侧工具栏配置
+    const stencil = new Stencil({
+      title: '工艺模型',
+      target: this.graph,
+      stencilGraphWidth: 200,
+      stencilGraphHeight: 180,
+      collapsable: true,
+      groups: [
+        {
+          title: '节点组',
+          name: 'group',
+          graphHeight: 80,
+          layoutOptions: {
+            columns: 1,
+            marginX: 35,
+          },
+        },
+        {
+          title: '特殊模型',
+          name: 'c4',
+          graphHeight: 450,
+          layoutOptions: {
+            rowHeight: 70,
+          },
+        },
+        {
+          title: '计件模型',
+          name: 'c1',
+        },
+        {
+          title: '检验模型',
+          name: 'c2',
+        },
+        {
+          title: '报损模型',
+          name: 'c3',
+        },
+      ],
+      layoutOptions: {
+        columns: 2,
+        columnWidth: 80,
+        rowHeight: 55,
+      },
+      placeholder:'搜索...',
+      notFoundText:'未搜索到结果',
+      //搜索方法
+      search: (cell, keyword, groupName, stencil) => {
+        if (keyword) {
+          return cell.attr("text/text").includes(keyword);
+        }
+        return true;
+      },
+      // getDropNode(node) {
+      //   console.log(node.prop())
+      // }
+    })
+    document.getElementById('stencil').appendChild(stencil.container)
+    // endregion
+
+    // region 注册快捷键与事件
+
+    // region 复制
+    this.graph.bindKey(['meta+c', 'ctrl+c'], () => {
+      const cells = this.graph.getSelectedCells()
+      if (cells.length) {
+        this.graph.copy(cells)
+      }
+      return false
+    })
+    // endregion
+
+    // region 剪切
+    this.graph.bindKey(['meta+x', 'ctrl+x'], () => {
+      const cells = this.graph.getSelectedCells()
+      if (cells.length) {
+        this.graph.cut(cells)
+      }
+      return false
+    })
+    // endregion
+
+    // region 粘贴
+    this.graph.bindKey(['meta+v', 'ctrl+v'], () => {
+      if (!this.graph.isClipboardEmpty()) {
+        const cells = this.graph.paste({ offset: 32 })
+        this.graph.cleanSelection()
+        this.graph.select(cells)
+      }
+      return false
+    })
+    // endregion
+
+    // region 撤销
+    this.graph.bindKey(['meta+z', 'ctrl+z'], () => {
+      if (this.graph.canUndo()) {
+        this.graph.undo()
+      }
+      return false
+    })
+    // endregion
+
+    // region 撤回撤销
+    this.graph.bindKey(['meta+shift+z', 'ctrl+shift+z'], () => {
+      if (this.graph.canRedo()) {
+        this.graph.redo()
+      }
+      return false
+    })
+    // endregion
+
+    // region 全选
+    this.graph.bindKey(['meta+alt+a', 'ctrl+alt+a'], () => {
+      const nodes = this.graph.getNodes()
+      if (nodes) {
+        this.graph.select(nodes)
+      }
+    })
+    // endregion
+
+    // region 删除
+    this.graph.bindKey(['backspace','del'], () => {
+      const cells = this.graph.getSelectedCells()
+      if (cells.length) {
+        this.graph.removeCells(cells)
+      }
+    })
+    // endregion
+
+    // region 调整大小
+    this.graph.bindKey(['ctrl+alt++', 'meta++'], () => {
+      const zoom = this.graph.zoom()
+      if (zoom < 1.5) {
+        this.graph.zoom(0.1)
+      }
+    })
+    this.graph.bindKey(['ctrl+alt+-', 'meta+-'], () => {
+      const zoom = this.graph.zoom()
+      if (zoom > 0.5) {
+        this.graph.zoom(-0.1)
+      }
+    })
+    // endregion
+
+    // region 向上移动
+    this.graph.bindKey(['up'], () => {
+      const cells = this.graph.getSelectedCells()
+      if (cells.length) {
+        cells.forEach(cell=>{
+          const y = cell.prop().position.y
+          const x = cell.prop().position.x
+          cell.prop("position", { x: x, y: y-5 });
+        })
+      }
+    })
+    // endregion
+
+    // region 向下移动
+    this.graph.bindKey(['down'], () => {
+      const cells = this.graph.getSelectedCells()
+      if (cells.length) {
+        cells.forEach(cell=>{
+          const y = cell.prop().position.y
+          const x = cell.prop().position.x
+          cell.prop("position", { x: x, y: y+5 });
+        })
+      }
+    })
+    // endregion
+
+    // region 向左移动
+    this.graph.bindKey(['left'], () => {
+      const cells = this.graph.getSelectedCells()
+      if (cells.length) {
+        cells.forEach(cell=>{
+          const y = cell.prop().position.y
+          const x = cell.prop().position.x
+          cell.prop("position", { x: x-5, y: y });
+        })
+      }
+    })
+    // endregion
+
+    // region 向右移动
+    this.graph.bindKey(['right'], () => {
+      const cells = this.graph.getSelectedCells()
+      if (cells.length) {
+        cells.forEach(cell=>{
+          const y = cell.prop().position.y
+          const x = cell.prop().position.x
+          cell.prop("position", { x: x+5, y: y });
+        })
+      }
+    })
+    // endregion
+
+    // region 鼠标移入移出 连接桩显示/隐藏
+    this.graph.on('node:mouseenter', FunctionExt.debounce(() => {
+      const ports =  dom.querySelectorAll('.x6-port-body')
+      this.showPorts(ports, true)
+    }), 500,)
+
+    this.graph.on('node:mouseleave', () => {
+      const ports =  dom.querySelectorAll('.x6-port-body')
+      this.showPorts(ports, false)
+    })
+    // endregion
+
+    // region 鼠标移入移出 动态添加连接线托拽工具
+    this.graph.on('edge:mouseenter', ({ cell }) => {
+      cell.addTools([
+        {
+          name: 'vertices',
+          args: {
+            // 移动路径点过程中的吸附半径。当路径点与邻近的路径点的某个坐标 (x, y) 距离在半径范围内时,将当前路径点的对应坐标 (x, y) 吸附到邻居路径的路径点。
+            snapRadius: 5,
+            // 在边上按下鼠标时,是否可以添加新的路径点。
+            addable: true,
+            // 是否可以通过双击移除路径点。
+            removable: true,
+            // 是否自动移除冗余的路径点。
+            removeRedundancies: true,
+            // 是否阻止工具上的鼠标事件冒泡到边视图上。阻止后鼠标与工具交互时将不会触发边的 mousedown、mousemove 和 mouseup 事件。
+            stopPropagation: false
+          }
+        }
+      ])
+    })
+    this.graph.on('edge:mouseleave', ({ cell }) => {
+      cell.removeTools()
+    })
+    //endregion
+
+    // region 右键连接线进入编辑模式
+    this.graph.on('edge:contextmenu', ({ cell, e }) => {
+      // console.log("右键连线-prop",cell.prop())
+      // console.log("右键连线-attr",cell.attr())
+      // console.log("右键连线-data",cell.data)
+      //设置值
+      store.commit('setCurrentEdgeId',cell.id)
+      //显示弹窗
+      store.commit('setProcessEdgeModalDisplay',true)
+      // cell.addTools({
+      //   name: 'edge-editor',
+      //   args: {
+      //     event: e,
+      //   },
+      // })
+    })
+    // endregion
+
+    // region 双击节点进入编辑模式
+    this.graph.on('node:dblclick', ({ node, e }) => {
+      // console.log("双击节点",node)
+      // console.log("双击节点-id",node.id)
+      // console.log("双击节点-prop",node.prop())
+      // console.log("双击节点-attr",node.attr())
+      // console.log("双击节点-data",node.data)
+      //如果是节点组,不打开弹窗
+      if (node.data && node.data.parent) {
+        return;
+      }
+      //设置值
+      store.commit('setCurrentNodeId',node.id)
+      //显示弹窗
+      store.commit('setProcessNodeModalDisplay',true)
+    })
+    // endregion
+
+    // region 节点组展开/收起
+    this.graph.on('node:collapse', ({ node, e }) => {
+      e.stopPropagation()
+      node.toggleCollapse()
+      const collapsed = node.isCollapsed()
+      const cells = node.getDescendants()
+      cells.forEach(n => {
+        if (collapsed) {
+          n.hide()
+        } else {
+          n.show()
+        }
+      })
+    })
+    // endregion
+
+    // region 节点的父级发生改变
+    this.graph.on('node:change:parent', ({ node }) => {
+      // console.log('change:parent',node)
+    })
+    // endregion
+
+    // region 节点的子级发生改变
+    this.graph.on('node:change:children',({node,previous,current})=>{
+      if(previous&&current&&previous.length>current.length){
+        console.log('移出')
+        this.getSelectedCells().forEach(it=>{
+          node.unembed(it);
+        })
+      }
+    })
+    // endregion
+
+    // region 节点的移入事件(父级、嵌套关系发生改变)
+    this.graph.on('node:embedded',({node})=>{
+      // debugger
+      console.log("embedded",node.id,node.getParent())
+      //如果所选所有节点的parent都一致,直接return
+      let cells=this.getSelectedCells()
+      if(cells.some((e) => cells.filter((e1) => e1.getParent() !== e.getParent()).length >0 )){
+        console.log('存在不相同')
+        let parent=node.getParent()
+        let other =cells.filter((c) => c.id!==node.id)
+        other.forEach(it=>{
+          parent.embed(it);
+        })
+      }else{
+        console.log('都相同')
+        // return
+      }
+    })
+    // endregion
+
+    // region 根据群组内部节点位置动态调整群组宽高
+    this.graph.on('node:embedding', ({ e }) => {
+      this.ctrlPressed = e.metaKey || e.ctrlKey
+    })
+
+    this.graph.on('node:embedded', () => {
+      this.ctrlPressed = false
+    })
+
+    this.graph.on('node:change:size', ({ node, options }) => {
+      if (options.skipParentHandler) {
+        return
+      }
+
+      const children = node.getChildren()
+      if (children && children.length) {
+        node.prop('originSize', node.getSize())
+      }
+    })
+
+    this.graph.on('node:change:position', ({ node, options }) => {
+      if (options.skipParentHandler || this.ctrlPressed) {
+        return
+      }
+
+      const children = node.getChildren()
+      if (children && children.length) {
+        node.prop('originPosition', node.getPosition())
+      }
+
+      const parent = node.getParent()
+      if (parent && parent.isNode()) {
+        let originSize = parent.prop('originSize')
+        if (originSize == null) {
+          originSize = parent.getSize()
+          parent.prop('originSize', originSize)
+        }
+
+        let originPosition = parent.prop('originPosition')
+        if (originPosition == null) {
+          originPosition = parent.getPosition()
+          parent.prop('originPosition', originPosition)
+        }
+
+        let x = originPosition.x
+        let y = originPosition.y
+        let cornerX = originPosition.x + originSize.width
+        let cornerY = originPosition.y + originSize.height
+        let hasChange = false
+
+        const children = parent.getChildren()
+        if (children) {
+          children.forEach((child) => {
+            const bbox = child.getBBox().inflate(this.embedPadding)
+            const corner = bbox.getCorner()
+
+            if (bbox.x < x) {
+              x = bbox.x
+              hasChange = true
+            }
+
+            if (bbox.y < y) {
+              y = bbox.y
+              hasChange = true
+            }
+
+            if (corner.x > cornerX) {
+              cornerX = corner.x
+              hasChange = true
+            }
+
+            if (corner.y > cornerY) {
+              cornerY = corner.y
+              hasChange = true
+            }
+          })
+        }
+        // console.log('hasChange',hasChange)
+        if (hasChange) {
+          parent.prop(
+            {
+              position: { x, y },
+              size: { width: cornerX - x, height: cornerY - y },
+            },
+            { skipParentHandler: true },
+          )
+        }
+      }
+    })
+    // endregion
+
+    // region 将添加的节点组置为最底层
+    this.graph.on("node:added", ({ node }) => {
+      if (node.data && node.data.parent) {
+        node.toBack()
+      }
+    });
+    // endregion
+
+    // endregion
+
+    // region 图形配置
+
+    // region 节点上下左右的四个连接桩
+    const ports = {
+      groups: {
+        top: {
+          position: 'top',
+          attrs: {
+            circle: {
+              r: 4,
+              magnet: true,
+              stroke: '#5F95FF',
+              strokeWidth: 1,
+              fill: '#fff',
+              style: {
+                visibility: 'hidden',
+              },
+            },
+          },
+        },
+        right: {
+          position: 'right',
+          attrs: {
+            circle: {
+              r: 4,
+              magnet: true,
+              stroke: '#5F95FF',
+              strokeWidth: 1,
+              fill: '#fff',
+              style: {
+                visibility: 'hidden',
+              },
+            },
+          },
+        },
+        bottom: {
+          position: 'bottom',
+          attrs: {
+            circle: {
+              r: 4,
+              magnet: true,
+              stroke: '#5F95FF',
+              strokeWidth: 1,
+              fill: '#fff',
+              style: {
+                visibility: 'hidden',
+              },
+            },
+          },
+        },
+        left: {
+          position: 'left',
+          attrs: {
+            circle: {
+              r: 4,
+              magnet: true,
+              stroke: '#5F95FF',
+              strokeWidth: 1,
+              fill: '#fff',
+              style: {
+                visibility: 'hidden',
+              },
+            },
+          },
+        },
+      },
+      items: [
+        {
+          group: 'top',
+        },
+        {
+          group: 'right',
+        },
+        {
+          group: 'bottom',
+        },
+        {
+          group: 'left',
+        },
+      ],
+    }
+    // endregion
+
+    // region 注册自定义节点
+    Graph.registerNode(
+      'custom-rect',
+      {
+        inherit: 'rect',
+        width: 66,
+        height: 36,
+        attrs: {
+          body: {
+            strokeWidth: 1,
+            stroke: '#5F95FF',
+            fill: '#EFF4FF',
+          },
+          text: {
+            fontSize: 12,
+            fill: '#262626',
+          },
+        },
+        ports: { ...ports },
+      },
+      true,
+    )
+
+    Graph.registerNode(
+      'custom-polygon',
+      {
+        inherit: 'polygon',
+        width: 66,
+        height: 36,
+        attrs: {
+          body: {
+            strokeWidth: 1,
+            stroke: '#5F95FF',
+            fill: '#EFF4FF',
+          },
+          text: {
+            fontSize: 12,
+            fill: '#262626',
+          },
+        },
+        ports: {
+          ...ports,
+          items: [
+            {
+              group: 'top',
+            },
+            {
+              group: 'bottom',
+            },
+          ],
+        },
+      },
+      true,
+    )
+
+    Graph.registerNode(
+      'custom-circle',
+      {
+        inherit: 'circle',
+        width: 45,
+        height: 45,
+        attrs: {
+          body: {
+            strokeWidth: 1,
+            stroke: '#5F95FF',
+            fill: '#EFF4FF',
+          },
+          text: {
+            fontSize: 12,
+            fill: '#262626',
+          },
+        },
+        ports: { ...ports },
+      },
+      true,
+    )
+
+    Graph.registerNode(
+      'custom-image',
+      {
+        inherit: 'rect',
+        width: 64,
+        height: 64,
+        markup: [
+          {
+            tagName: 'rect',
+            selector: 'body',
+          },
+          {
+            tagName: 'image',
+          },
+          {
+            tagName: 'text',
+            selector: 'label',
+          },
+        ],
+        attrs: {
+          body: {
+            stroke: '#87CEFA',
+            fill: '#1E90FF',
+          },
+          image: {
+            width: 32,
+            height: 32,
+            refX: 22,
+            refY: 22,
+          },
+          label: {
+            refX:6,
+            refY:6,
+            textAnchor: 'left',
+            textVerticalAnchor: 'top',
+            fontSize: 12,
+            fill: '#fff',
+          },
+        },
+        ports: { ...ports },
+      },
+      true,
+    )
+
+
+    // region 节点组
+    const g1 = this.graph.createNode({
+      shape: 'groupNode',
+      zIndex: 0,
+      attrs: {
+        text: {
+          text: '节点组',
+        },
+      },
+      data: {
+        parent: true,
+      },
+    })
+    stencil.load([g1], 'group')
+    // endregion
+
+    // endregion
+
+    //region 创建工艺节点图元素节点
+    const imageShapes = [
+      {
+        label: '交坯',
+        image:getImg('交坯.png'),
+      },
+      {
+        label: '半检',
+        image:getImg('检查.png'),
+      },
+      {
+        label: '施釉',
+        image:getImg('喷雾.png'),
+      },
+      {
+        label: '质量登记',
+        image:getImg('登记.png'),
+      },
+      {
+        label: '入窑',
+        image:getImg('火炉.png'),
+      },
+      {
+        label: '卸窑',
+        image:getImg('装卸.png'),
+
+      },
+      {
+        label: '重烧',
+        image:getImg('火炉.png'),
+      },
+      {
+        label: '包装',
+        image:getImg('打包.png'),
+      },
+      {
+        label: '回收',
+        image:getImg('回收.png'),
+
+      },
+      {
+        label: '干补',
+        image:getImg('马桶.png'),
+      },
+      {
+        label: '烘干',
+        image:getImg('烘干.png'),
+      },
+      {
+        label: '打磨',
+        image:getImg('打磨.png'),
+      },
+    ]
+    const imageNodes = imageShapes.map((item) =>
+      //创建节点事件
+      this.graph.createNode({
+        shape: 'custom-image',
+        label: item.label,
+        attrs: {
+          image: {
+            'xlink:href': item.image,
+          },
+        },
+        data:{
+          nodeName:item.label,
+        }
+        // shape: 'image', //可选值:Rect Circle Ellipse Polygon Polyline Path Image HTML TextBlock BorderedImage EmbeddedImage InscribedImage Cylinder
+        // imageUrl: item.image,
+        // width: 52,
+        // height: 52,
+      }),
+    )
+    stencil.load(imageNodes, 'c4')
+    //endregion
+
+    // endregion
+
+    return this.graph
+  }
+  // endregion
+
+  // region 显示/隐藏连接桩事件
+  static showPorts(ports, show) {
+    for (let i = 0, len = ports.length; i < len; i = i + 1) {
+      ports[i].style.visibility = show ? 'visible' : 'hidden'
+    }
+  }
+  // endregion
+
+  // region 获取所有选中的节点
+  static getSelectedCells() {
+    return this.graph.getSelectedCells();
+  }
+  // endregion
+}

+ 13 - 915
src/view/process/process.vue

@@ -28,930 +28,41 @@
       </Layout>
     </Layout>
     <!--  节点弹窗  -->
-    <NodeModal :nodeData="{}"/>
+    <NodeModal/>
+    <!--  连线弹窗  -->
+    <EdgeModal/>
   </div>
 </template>
 <script>
-import { Graph, Shape,FunctionExt } from '@antv/x6'
-import { Stencil } from '@antv/x6-plugin-stencil'
-import { Transform } from '@antv/x6-plugin-transform'
-import { Selection } from '@antv/x6-plugin-selection'
-import { Snapline } from '@antv/x6-plugin-snapline'
-import { Keyboard } from '@antv/x6-plugin-keyboard'
-import { Clipboard } from '@antv/x6-plugin-clipboard'
-import { History } from '@antv/x6-plugin-history'
-import { Export } from "@antv/x6-plugin-export";
-import { getImg } from '../../libs/base/x6-utils'
 import {mapState, mapMutations} from 'vuex'
 import NodeModal from '_c/business/process/node-modal/node-modal'
+import EdgeModal from '_c/business/process/edge-modal/edge-modal'
 const insertCss = require('insert-css')
 const zt1 = require('./zt1.json')
-import './NodeGroup'
-
+import Process from './index'
 
 
 export default {
-  components: { NodeModal },
+  components: { NodeModal,EdgeModal },
   data() {
     return {
       graph: null,//图形对象
       exportData: undefined,
       importValue:undefined,
-      ctrlPressed : false,//ctrl键是是否按下
-      embedPadding : 30//群组padding
+      currentNode:{},
     }
   },
   created() {},
   mounted() {
-    this.init()
+    //创建流程图对象
+    this.graph=Process.init(this.$refs.container)
+  },
+  computed: {
+    ...mapState(['process']),
   },
   methods: {
-    ...mapMutations(['setProcessNodeModalDisplay']),
-    /**
-     * @desc   : 初始化工艺流程图
-     * @author : 张潇木
-     * @date   : 2023/1/3 11:46
-     */
-    init() {
-
-    //region 插入动画样式
-      insertCss(`
-        @keyframes ant-line {
-          to {
-              stroke-dashoffset: -1000
-          }
-        }
-      `)
-    //endregion 不通过insertCss的方式,只写样式,动画无效
-
-    // region 画布配置
-      this.graph = new Graph({
-        container: this.$refs.container,//获取节点
-        background: {color: '#F2F7FA',},//画布背景色
-        autoResize:true,//自动设置宽高
-        panning: {//开启拖拽画布
-          enabled: true,
-          eventTypes: 'rightMouseDown',//触发画布平移的交互方式为“右键按下”
-        },
-        grid: {//设置网格
-          size: 10,
-          visible: true,
-          type: "doubleMesh",
-          args: [
-            {
-              color: "#eee", // 主网格线颜色
-              thickness: 1, // 主网格线宽度
-            },
-            {
-              color: "#ddd", // 次网格线颜色
-              thickness: 1, // 次网格线宽度
-              factor: 4, // 主次网格线间隔
-            },
-          ],
-        },
-        mousewheel: {//鼠标滚轮缩放画布
-          enabled: true,
-          zoomAtMousePosition: true,
-          modifiers: 'ctrl',
-          minScale: 0.5,
-          maxScale: 3,
-          factor: 1.1,//滚动缩放因子。默认为 1.2
-        },
-        connecting: {
-          line: {
-            stroke: '#A2B1C3',
-            strokeWidth: 3,
-            strokeDasharray: 5,
-            style: {
-              animation: 'ant-line 30s infinite linear',
-            },
-          },
-          router: {
-            name: 'metro',
-          },
-          connector: {
-            name: 'jumpover',
-            args: {
-              radius: 8,
-              size:12,
-            },
-          },
-          anchor: 'center',
-          connectionPoint: 'anchor',
-          allowBlank: false,
-          snap: {
-            radius: 20,
-          },
-          createEdge() {
-            return new Shape.Edge({
-              attrs: {
-                line: {
-                  stroke: '#A2B1C3',
-                  strokeWidth: 3,
-                  strokeDasharray: 6,
-                  style: {
-                    animation: 'ant-line 30s infinite linear',
-                  },
-                },
-              },
-              zIndex: 0,
-              router: {
-                name: 'metro',
-              },
-              connector: {
-                name: 'jumpover',
-                args: {
-                  radius: 8,
-                  size:12,
-                },
-              },
-            })
-          },
-          validateConnection({ targetMagnet }) {
-            return !!targetMagnet
-          },
-        },
-        highlighting: {//高亮
-          magnetAdsorbed: {//连线过程中,自动吸附到连接桩时被使用
-            name: 'stroke',
-              args: {
-              attrs: {
-                "stroke-width": 2,
-                fill: '#5F95FF',
-                stroke: 'white',
-              },
-            },
-          },
-        },
-        embedding: {//是否开启嵌套节点
-          enabled: true,
-          findParent({ node }) {
-            const bbox = node.getBBox()
-            return this.getNodes().filter((n) => {
-              // 如果拖拽的节点本身就是一个节点组,则不允许进入另一个节点组中
-              if(node.data&&node.data.parent){
-                return false
-              }
-              // 只有 data.parent 为 true 的节点才是父节点
-              const data = n.getData()
-              if (data && data.parent) {
-                const targetBBox = n.getBBox()
-                return bbox.isIntersectWithRect(targetBBox)
-              }
-              return false
-            })
-          },
-        },
-      })
-    // endregion
-
-    // region 注册插件
-      this.graph.use(new Transform({
-          resizing: true,
-          rotating: true,
-        }))
-        .use(new Selection({
-          enabled: true,
-          multiple: true,//是否启用点击多选,启用后按住 ctrl 或 command 键点击节点实现多选
-          rubberband: true,//是否启用多选节点功能
-          showNodeSelectionBox: true,//是否显示节点的选择框
-        }))
-        .use(new Snapline({
-          enabled: true,
-        }))
-        .use(new Keyboard({
-          enabled: true,
-        }))
-        .use(new Clipboard({
-          enabled: true,
-        }))
-        .use(new History({
-          enabled: true,
-        }))
-        .use(new Export({
-            enabled:true
-          }
-        ));
-        // endregion
-
-    // region 左侧工具栏配置
-      const stencil = new Stencil({
-        title: '工艺模型',
-        target: this.graph,
-        stencilGraphWidth: 200,
-        stencilGraphHeight: 180,
-        collapsable: true,
-        groups: [
-          {
-            title: '节点组',
-            name: 'group',
-            graphHeight: 80,
-            layoutOptions: {
-              columns: 1,
-              marginX: 35,
-            },
-          },
-          {
-            title: '特殊模型',
-            name: 'c4',
-            graphHeight: 450,
-            layoutOptions: {
-              rowHeight: 70,
-            },
-          },
-          {
-            title: '计件模型',
-            name: 'c1',
-          },
-          {
-            title: '检验模型',
-            name: 'c2',
-          },
-          {
-            title: '报损模型',
-            name: 'c3',
-          },
-        ],
-        layoutOptions: {
-          columns: 2,
-          columnWidth: 80,
-          rowHeight: 55,
-        },
-        placeholder:'搜索...',
-        notFoundText:'未搜索到结果',
-        //搜索方法
-        search: (cell, keyword, groupName, stencil) => {
-          if (keyword) {
-            return cell.attr("text/text").includes(keyword);
-          }
-          return true;
-        },
-        // getDropNode(node) {
-        //   console.log(node.prop())
-        // }
-      })
-      document.getElementById('stencil').appendChild(stencil.container)
-    // endregion
-
-    // region 注册快捷键与事件
-
-      // region 复制
-      this.graph.bindKey(['meta+c', 'ctrl+c'], () => {
-        const cells = this.graph.getSelectedCells()
-        if (cells.length) {
-          this.graph.copy(cells)
-        }
-        return false
-      })
-      // endregion
-
-      // region 剪切
-      this.graph.bindKey(['meta+x', 'ctrl+x'], () => {
-        const cells = this.graph.getSelectedCells()
-        if (cells.length) {
-          this.graph.cut(cells)
-        }
-        return false
-      })
-      // endregion
-
-      // region 粘贴
-      this.graph.bindKey(['meta+v', 'ctrl+v'], () => {
-        if (!this.graph.isClipboardEmpty()) {
-          const cells = this.graph.paste({ offset: 32 })
-          this.graph.cleanSelection()
-          this.graph.select(cells)
-        }
-        return false
-      })
-      // endregion
-
-      // region 撤销
-      this.graph.bindKey(['meta+z', 'ctrl+z'], () => {
-        if (this.graph.canUndo()) {
-          this.graph.undo()
-        }
-        return false
-      })
-      // endregion
-
-      // region 撤回撤销
-      this.graph.bindKey(['meta+shift+z', 'ctrl+shift+z'], () => {
-        if (this.graph.canRedo()) {
-          this.graph.redo()
-        }
-        return false
-      })
-      // endregion
-
-      // region 全选
-      this.graph.bindKey(['meta+alt+a', 'ctrl+alt+a'], () => {
-        const nodes = this.graph.getNodes()
-        if (nodes) {
-          this.graph.select(nodes)
-        }
-      })
-      // endregion
-
-      // region 删除
-      this.graph.bindKey(['backspace','del'], () => {
-        const cells = this.graph.getSelectedCells()
-        if (cells.length) {
-          this.graph.removeCells(cells)
-        }
-      })
-      // endregion
-
-      // region 调整大小
-      this.graph.bindKey(['ctrl+alt++', 'meta++'], () => {
-        const zoom = this.graph.zoom()
-        if (zoom < 1.5) {
-          this.graph.zoom(0.1)
-        }
-      })
-      this.graph.bindKey(['ctrl+alt+-', 'meta+-'], () => {
-        const zoom = this.graph.zoom()
-        if (zoom > 0.5) {
-          this.graph.zoom(-0.1)
-        }
-      })
-      // endregion
-
-      // region 向上移动
-      this.graph.bindKey(['up'], () => {
-        const cells = this.graph.getSelectedCells()
-        if (cells.length) {
-          cells.forEach(cell=>{
-            const y = cell.prop().position.y
-            const x = cell.prop().position.x
-            cell.prop("position", { x: x, y: y-5 });
-          })
-        }
-      })
-      // endregion
-
-      // region 向下移动
-      this.graph.bindKey(['down'], () => {
-        const cells = this.graph.getSelectedCells()
-        if (cells.length) {
-          cells.forEach(cell=>{
-            const y = cell.prop().position.y
-            const x = cell.prop().position.x
-            cell.prop("position", { x: x, y: y+5 });
-          })
-        }
-      })
-      // endregion
-
-      // region 向左移动
-      this.graph.bindKey(['left'], () => {
-        const cells = this.graph.getSelectedCells()
-        if (cells.length) {
-          cells.forEach(cell=>{
-            const y = cell.prop().position.y
-            const x = cell.prop().position.x
-            cell.prop("position", { x: x-5, y: y });
-          })
-        }
-      })
-      // endregion
-
-      // region 向右移动
-      this.graph.bindKey(['right'], () => {
-        const cells = this.graph.getSelectedCells()
-        if (cells.length) {
-          cells.forEach(cell=>{
-            const y = cell.prop().position.y
-            const x = cell.prop().position.x
-            cell.prop("position", { x: x+5, y: y });
-          })
-        }
-      })
-      // endregion
-
-      // region 鼠标移入移出 连接桩显示/隐藏
-      this.graph.on('node:mouseenter', FunctionExt.debounce(() => {
-        const ports =  this.$refs.container.querySelectorAll('.x6-port-body')
-        this.showPorts(ports, true)
-      }), 500,)
-
-      this.graph.on('node:mouseleave', () => {
-        const ports =  this.$refs.container.querySelectorAll('.x6-port-body')
-        this.showPorts(ports, false)
-      })
-      // endregion
-
-      // region 鼠标移入移出 动态添加连接线托拽工具
-      this.graph.on('edge:mouseenter', ({ cell }) => {
-        cell.addTools([
-          {
-            name: 'vertices',
-            args: {
-              // 移动路径点过程中的吸附半径。当路径点与邻近的路径点的某个坐标 (x, y) 距离在半径范围内时,将当前路径点的对应坐标 (x, y) 吸附到邻居路径的路径点。
-              snapRadius: 5,
-              // 在边上按下鼠标时,是否可以添加新的路径点。
-              addable: true,
-              // 是否可以通过双击移除路径点。
-              removable: true,
-              // 是否自动移除冗余的路径点。
-              removeRedundancies: true,
-              // 是否阻止工具上的鼠标事件冒泡到边视图上。阻止后鼠标与工具交互时将不会触发边的 mousedown、mousemove 和 mouseup 事件。
-              stopPropagation: false
-            }
-          }
-        ])
-      })
-      this.graph.on('edge:mouseleave', ({ cell }) => {
-        cell.removeTools()
-      })
-      //endregion
-
-      // region 右键连接线进入编辑模式
-      this.graph.on('edge:contextmenu', ({ cell, e }) => {
-        console.log("右键连线-prop",cell.prop())
-        console.log("右键连线-attr",cell.attr())
-        console.log("右键连线-data",cell.data)
-        cell.addTools({
-          name: 'edge-editor',
-          args: {
-            event: e,
-          },
-        })
-      })
-      // endregion
-
-      // region 双击节点进入编辑模式
-      this.graph.on('node:dblclick', ({ node, e }) => {
-        console.log("双击节点-id",node.id)
-        console.log("双击节点-prop",node.prop())
-        // console.log("双击节点-attr",node.attr())
-        // console.log("双击节点-data",node.data)
-        //如果是节点组,不打开弹窗
-        if (node.data && node.data.parent) {
-          return;
-        }
-        // this.setProcessNodeModalDisplay(true)
-
-        // node.addTools({
-        //   name: 'node-editor',
-        //   args: {
-        //     event: e,
-        //   },
-        // })
-      })
-      // endregion
-
-      // region 节点组展开/收起
-      this.graph.on('node:collapse', ({ node, e }) => {
-        e.stopPropagation()
-        node.toggleCollapse()
-        const collapsed = node.isCollapsed()
-        const cells = node.getDescendants()
-        // console.log('collapse',node)
-        // console.log('getDescendants',cells)
-        cells.forEach(n => {
-          if (collapsed) {
-            n.hide()
-          } else {
-            n.show()
-          }
-        })
-      })
-      // endregion
-
-      // region 节点的父级发生改变
-      this.graph.on('node:change:parent', ({ node }) => {
-        // console.log('change:parent',node)
-      })
-      // endregion
-
-      // region 节点的子级发生改变
-      this.graph.on('node:change:children',({node,previous,current})=>{
-        if(previous&&current&&previous.length>current.length){
-          console.log('移出')
-          this.getSelectedCells().forEach(it=>{
-            node.unembed(it);
-          })
-        }
-      })
-      // endregion
-
-      // region 节点的移入事件(父级、嵌套关系发生改变)
-      this.graph.on('node:embedded',({node})=>{
-        // debugger
-        console.log("embedded",node.id,node.getParent())
-        //如果所选所有节点的parent都一致,直接return
-        let cells=this.getSelectedCells()
-        if(cells.some((e) => cells.filter((e1) => e1.getParent() !== e.getParent()).length >0 )){
-          console.log('存在不相同')
-          let parent=node.getParent()
-          let other =cells.filter((c) => c.id!==node.id)
-          other.forEach(it=>{
-            parent.embed(it);
-          })
-        }else{
-          console.log('都相同')
-          // return
-        }
-      })
-      // endregion
-
-      // region 根据群组内部节点位置动态调整群组宽高
-      this.graph.on('node:embedding', ({ e }) => {
-        this.ctrlPressed = e.metaKey || e.ctrlKey
-      })
-
-      this.graph.on('node:embedded', () => {
-        this.ctrlPressed = false
-      })
-
-      this.graph.on('node:change:size', ({ node, options }) => {
-        if (options.skipParentHandler) {
-          return
-        }
 
-        const children = node.getChildren()
-        if (children && children.length) {
-          node.prop('originSize', node.getSize())
-        }
-      })
-
-      this.graph.on('node:change:position', ({ node, options }) => {
-        if (options.skipParentHandler || this.ctrlPressed) {
-          return
-        }
-
-        const children = node.getChildren()
-        if (children && children.length) {
-          node.prop('originPosition', node.getPosition())
-        }
-
-        const parent = node.getParent()
-        if (parent && parent.isNode()) {
-          let originSize = parent.prop('originSize')
-          if (originSize == null) {
-            originSize = parent.getSize()
-            parent.prop('originSize', originSize)
-          }
-
-          let originPosition = parent.prop('originPosition')
-          if (originPosition == null) {
-            originPosition = parent.getPosition()
-            parent.prop('originPosition', originPosition)
-          }
-
-          let x = originPosition.x
-          let y = originPosition.y
-          let cornerX = originPosition.x + originSize.width
-          let cornerY = originPosition.y + originSize.height
-          let hasChange = false
-
-          const children = parent.getChildren()
-          if (children) {
-            children.forEach((child) => {
-              const bbox = child.getBBox().inflate(this.embedPadding)
-              const corner = bbox.getCorner()
-
-              if (bbox.x < x) {
-                x = bbox.x
-                hasChange = true
-              }
-
-              if (bbox.y < y) {
-                y = bbox.y
-                hasChange = true
-              }
-
-              if (corner.x > cornerX) {
-                cornerX = corner.x
-                hasChange = true
-              }
-
-              if (corner.y > cornerY) {
-                cornerY = corner.y
-                hasChange = true
-              }
-            })
-          }
-
-          if (hasChange) {
-            parent.prop(
-              {
-                position: { x, y },
-                size: { width: cornerX - x, height: cornerY - y },
-              },
-              { skipParentHandler: true },
-            )
-          }
-        }
-      })
-      // endregion
-
-      // region 将添加的节点组置为最底层
-      this.graph.on("node:added", ({ node }) => {
-        if (node.data && node.data.parent) {
-          node.toBack()
-        }
-      });
-      // endregion
-
-    // endregion
-
-    // region 图形配置
-
-      // region 节点上下左右的四个连接桩
-      const ports = {
-        groups: {
-          top: {
-            position: 'top',
-            attrs: {
-              circle: {
-                r: 4,
-                magnet: true,
-                stroke: '#5F95FF',
-                strokeWidth: 1,
-                fill: '#fff',
-                style: {
-                  visibility: 'hidden',
-                },
-              },
-            },
-          },
-          right: {
-            position: 'right',
-            attrs: {
-              circle: {
-                r: 4,
-                magnet: true,
-                stroke: '#5F95FF',
-                strokeWidth: 1,
-                fill: '#fff',
-                style: {
-                  visibility: 'hidden',
-                },
-              },
-            },
-          },
-          bottom: {
-            position: 'bottom',
-            attrs: {
-              circle: {
-                r: 4,
-                magnet: true,
-                stroke: '#5F95FF',
-                strokeWidth: 1,
-                fill: '#fff',
-                style: {
-                  visibility: 'hidden',
-                },
-              },
-            },
-          },
-          left: {
-            position: 'left',
-            attrs: {
-              circle: {
-                r: 4,
-                magnet: true,
-                stroke: '#5F95FF',
-                strokeWidth: 1,
-                fill: '#fff',
-                style: {
-                  visibility: 'hidden',
-                },
-              },
-            },
-          },
-        },
-        items: [
-          {
-            group: 'top',
-          },
-          {
-            group: 'right',
-          },
-          {
-            group: 'bottom',
-          },
-          {
-            group: 'left',
-          },
-        ],
-      }
-      // endregion
-
-      // region 注册自定义节点
-      Graph.registerNode(
-        'custom-rect',
-        {
-          inherit: 'rect',
-          width: 66,
-          height: 36,
-          attrs: {
-            body: {
-              strokeWidth: 1,
-              stroke: '#5F95FF',
-              fill: '#EFF4FF',
-            },
-            text: {
-              fontSize: 12,
-              fill: '#262626',
-            },
-          },
-          ports: { ...ports },
-        },
-        true,
-      )
-
-      Graph.registerNode(
-        'custom-polygon',
-        {
-          inherit: 'polygon',
-          width: 66,
-          height: 36,
-          attrs: {
-            body: {
-              strokeWidth: 1,
-              stroke: '#5F95FF',
-              fill: '#EFF4FF',
-            },
-            text: {
-              fontSize: 12,
-              fill: '#262626',
-            },
-          },
-          ports: {
-            ...ports,
-            items: [
-              {
-                group: 'top',
-              },
-              {
-                group: 'bottom',
-              },
-            ],
-          },
-        },
-        true,
-      )
-
-      Graph.registerNode(
-        'custom-circle',
-        {
-          inherit: 'circle',
-          width: 45,
-          height: 45,
-          attrs: {
-            body: {
-              strokeWidth: 1,
-              stroke: '#5F95FF',
-              fill: '#EFF4FF',
-            },
-            text: {
-              fontSize: 12,
-              fill: '#262626',
-            },
-          },
-          ports: { ...ports },
-        },
-        true,
-      )
-
-      Graph.registerNode(
-        'custom-image',
-        {
-          inherit: 'rect',
-          width: 64,
-          height: 64,
-          markup: [
-            {
-              tagName: 'rect',
-              selector: 'body',
-            },
-            {
-              tagName: 'image',
-            },
-            {
-              tagName: 'text',
-              selector: 'label',
-            },
-          ],
-          attrs: {
-            body: {
-              stroke: '#87CEFA',
-              fill: '#1E90FF',
-            },
-            image: {
-              width: 32,
-              height: 32,
-              refX: 22,
-              refY: 22,
-            },
-            label: {
-              refX:6,
-              refY:6,
-              textAnchor: 'left',
-              textVerticalAnchor: 'top',
-              fontSize: 12,
-              fill: '#fff',
-            },
-          },
-          ports: { ...ports },
-        },
-        true,
-      )
-
-
-      // region 节点组
-        const g1 = this.graph.createNode({
-          shape: 'groupNode',
-          zIndex: 0,
-          attrs: {
-            text: {
-              text: '节点组',
-            },
-          },
-          data: {
-            parent: true,
-          },
-        })
-        stencil.load([g1], 'group')
-        // endregion
-
-      // endregion
-
-      //region 创建工艺节点图元素节点
-      const imageShapes = [
-        {
-          label: '交坯',
-          image:getImg('交坯.png'),
-        },
-        {
-          label: '半检',
-          image:getImg('检查.png'),
-        },
-        {
-          label: '施釉',
-          image:getImg('喷雾.png'),
-        },
-        {
-          label: '质量登记',
-          image:getImg('登记.png'),
-        },
-        {
-          label: '入窑',
-          image:getImg('火炉.png'),
-        },
-        {
-          label: '卸窑',
-          image:getImg('装卸.png'),
-
-        },
-        {
-          label: '重烧',
-          image:getImg('火炉.png'),
-        },
-        {
-          label: '包装',
-          image:getImg('打包.png'),
-        },
-        {
-          label: '回收',
-          image:getImg('回收.png'),
-
-        },
-        {
-          label: '干补',
-          image:getImg('马桶.png'),
-        },
-        {
-          label: '烘干',
-          image:getImg('烘干.png'),
-        },
-        {
-          label: '打磨',
-          image:getImg('打磨.png'),
-        },
-      ]
-      const imageNodes = imageShapes.map((item) =>
-        this.graph.createNode({
-          shape: 'custom-image',
-          label: item.label,
-          attrs: {
-            image: {
-              'xlink:href': item.image,
-            },
-          },
-          // shape: 'image', //可选值:Rect Circle Ellipse Polygon Polyline Path Image HTML TextBlock BorderedImage EmbeddedImage InscribedImage Cylinder
-          // imageUrl: item.image,
-          // width: 52,
-          // height: 52,
-        }),
-      )
-      stencil.load(imageNodes, 'c4')
-      //endregion
-
-    // endregion
+    init() {
 
     // region 初始化数据
     //   this.graph.fromJSON(zt1)
@@ -961,19 +72,6 @@ export default {
 
     },
 
-    // region 显示/隐藏连接桩事件
-    showPorts(ports, show) {
-      for (let i = 0, len = ports.length; i < len; i = i + 1) {
-        ports[i].style.visibility = show ? 'visible' : 'hidden'
-      }
-    },
-    // endregion
-
-    // region 获取所有选中的节点
-    getSelectedCells() {
-      return this.graph.getSelectedCells();
-    },
-    // endregion
 
   }
 }

Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
src/view/process/zt2.json


Неке датотеке нису приказане због велике количине промена