Переглянути джерело

工序列表和新增窗口增加方法、试验规程编号字段,工序增加动态按钮,自定义工序项目字段名称并且能给一个true或false的标识/启用禁用按钮,产品工艺和通用工艺工序编辑中体现自定义项目字段名称并修改启用禁用。更新avue到最新版本。

jiaxiaoqiang 7 місяців тому
батько
коміт
79adcccf9a

+ 1 - 1
package.json

@@ -41,7 +41,7 @@
   },
   "dependencies": {
     "@element-plus/icons-vue": "^2.3.1",
-    "@smallwei/avue": "^3.3.3",
+    "@smallwei/avue": "^3.5.2",
     "@types/smallwei__avue": "^3.0.5",
     "@vue-flow/background": "^1.3.0",
     "@vue-flow/core": "^1.37.1",

+ 87 - 0
src/views/base/craftManagement/process/index.vue

@@ -15,6 +15,7 @@
       @size-change="dataList"
       @current-change="dataList"
       @selection-change="selectionChange"
+      :before-open="beforeOpenDialog"
     >
       <template #menu-left="{ size }">
         <el-button
@@ -26,6 +27,27 @@
           >删除</el-button
         >
       </template>
+
+      <template #customFieldName-form="scope">
+        <el-select
+          v-model="customFieldNameValues"
+          multiple
+          filterable
+          allow-create
+          default-first-option
+          :reserve-keyword="false"
+          placeholder="请输入名称,按回车创建"
+          @change="customFieldChange"
+        >
+          <el-option
+            v-for="item in customFieldOptions"
+            :key="item.value"
+            :label="item.value"
+            :value="item.value"
+          />
+        </el-select>
+      </template>
+
       <template #menu-right="{}">
         <el-dropdown split-button
           >导入
@@ -113,6 +135,29 @@ const switchOp = [
     value: 1,
   },
 ];
+
+// 自定义工序项目字段名称相关方法
+const customFieldNameValues = ref([]);
+const customFieldOptions = [];
+const customFieldChange = (val) => {
+  let result = Array.from(val);
+  result = result.map((item) => {
+    return {
+      value: item,
+      isSelected: true,
+    };
+  });
+
+  form.value.customFieldName = JSON.stringify(result);
+};
+const beforeOpenDialog = (done, type, loading) => {
+  customFieldOptions.value = JSON.parse(form.value.customFieldName);
+  customFieldNameValues.value = customFieldOptions.value.map(
+    (item) => item.value
+  );
+  done();
+};
+
 option.value = Object.assign(option.value, {
   selection: true,
   labelWidth: 120,
@@ -289,6 +334,16 @@ option.value = Object.assign(option.value, {
       ],
     },
     {
+      label: "方法",
+      prop: "method",
+      span: 12,
+    },
+    {
+      label: "试验规程编号",
+      prop: "testPlanCode",
+      span: 12,
+    },
+    {
       label: "是否可跳过",
       prop: "skipped",
       span: 8,
@@ -306,6 +361,14 @@ option.value = Object.assign(option.value, {
       value: 0,
     },
     {
+      label: "是否特殊工序",
+      prop: "isSpecial",
+      span: 8,
+      type: "switch",
+      dicData: switchOp,
+      value: 0,
+    },
+    {
       label: "是否禁用",
       prop: "enabled",
       hide: true,
@@ -394,6 +457,30 @@ option.value = Object.assign(option.value, {
         };
       },
     },
+    {
+      label: "是否自定义名称",
+      prop: "customEnable",
+      span: 8,
+      hide: true,
+      type: "switch",
+      dicData: switchOp,
+      value: 0,
+      //联动隐藏
+      control: (val, form) => {
+        return {
+          customFieldName: {
+            display: val == 1 ? true : false,
+          },
+        };
+      },
+    },
+    {
+      label: "自定义工序项目字段名称",
+      prop: "customFieldName",
+      hide: true,
+      span: 24,
+    },
+
     /*{
       label: "是否委外",
       prop: "outsourcing",

+ 31 - 0
src/views/base/craftManagement/route/bindConfig.ts

@@ -179,6 +179,14 @@ export const formOption = {
       value: 0,
     },
     {
+      label: "是否特殊工序",
+      prop: "isSpecial",
+      span: 24,
+      type: "switch",
+      dicData: switchOp,
+      value: 0,
+    },
+    {
       label: "工艺条件",
       prop: "processAsk",
       span: 24,
@@ -189,6 +197,29 @@ export const formOption = {
       span: 24,
       type: "textarea",
     },
+    {
+      label: "是否自定义名称",
+      prop: "customEnable",
+      span: 8,
+      hide: true,
+      type: "switch",
+      dicData: switchOp,
+      value: 0,
+      //联动隐藏
+      control: (val, form) => {
+        return {
+          customFieldName: {
+            display: val == 1 ? true : false,
+          },
+        };
+      },
+    },
+    {
+      label: "自定义工序项目字段名称",
+      prop: "customFieldName",
+      hide: true,
+      span: 24,
+    },
     /*{
       label: "tbom文件",
       prop: "tbomUrl",

+ 43 - 0
src/views/base/craftManagement/route/bindProcess.vue

@@ -121,6 +121,22 @@
                     :show-tip="false"
                   />
                 </template>
+                <template #customFieldName>
+                  <el-select
+                    v-model="customFieldNameValues"
+                    multiple
+                    default-first-option
+                    :reserve-keyword="false"
+                    placeholder="请选择名称"
+                  >
+                    <el-option
+                      v-for="item in customFieldOptions"
+                      :key="item.value"
+                      :label="item.value"
+                      :value="item.value"
+                    />
+                  </el-select>
+                </template>
               </avue-form>
               <div class="btns">
                 <el-tooltip
@@ -207,12 +223,25 @@ const edgeClick = (event) => {
     selectNode.value = null;
   }
 };
+
+// 自定义工序项目字段名称相关方法
+const customFieldNameValues = ref([]);
+const customFieldOptions = ref([]);
 const nodeClick = (event) => {
   if (usableStatus.value == false && !editStatus.value) return;
   if (!editStatus.value) {
     selectNode.value = event.node;
   } else {
     currentProcess.value = event.node;
+
+    // 设置自定义字段名称的选项内容等
+
+    customFieldOptions.value = JSON.parse(event.node.customFieldName);
+    customFieldNameValues.value = customFieldOptions.value
+      .filter((item) => {
+        return item.isSelected;
+      })
+      .map((item) => item.value);
   }
 };
 //当使用回退时清空选择的node
@@ -306,7 +335,21 @@ const deleteFlow = () => {
   selectLine.value = null;
   ElMessage.success("删除成功");
 };
+
 const saveInfo = async () => {
+  // 处理currentProcess的自定义对象名称字段,如果customFieldNameValues在customFieldOptions中存在,则设置isSelected为true,否则设置为false,最后转为json
+  const customFieldArr = [];
+  customFieldOptions.value.forEach((item) => {
+    let obj = {
+      value: item.value,
+      isSelected: customFieldNameValues.value.includes(item.value),
+    };
+    customFieldArr.push(obj);
+  });
+
+  console.log(customFieldArr);
+  currentProcess.value.customFieldName = JSON.stringify(customFieldArr);
+
   flowData.value.nodes.forEach((item, index) => {
     if (item.id == currentProcess.value.id) {
       flowData.value.nodes[index] = currentProcess.value;