Prechádzať zdrojové kódy

Merge branch 'qingban' of http://139.155.176.112:8091/project-all/mes-admin-temp into qingban

dengyu 4 mesiacov pred
rodič
commit
e05db8da60

+ 162 - 0
src/views/pro/traceability/components/materialsAccessoryCom.vue

@@ -0,0 +1,162 @@
+<!-- 已采物料 -->
+<template>
+  <div class="mainContentBox">
+    <avue-crud
+      ref="crudRef2"
+      v-model:search="search"
+      v-model="form"
+      @row-update="updateRow"
+      :data="data"
+      :option="option"
+      v-model:page="page"
+    >
+      <template #menu="{ size, row, index }">
+        <el-button
+          v-if="row.itemCode != undefined && row.itemCode != null"
+          type="primary"
+          link
+          size="small"
+          @click="doEdit(row, index)"
+          ><i-ep-edit />编辑
+        </el-button>
+      </template>
+    </avue-crud>
+    <CommonTable
+      ref="ctableRef"
+      tableTitle="物料选择"
+      tableType="MARTERIAL"
+      @selected-sure="onSelectedFinish"
+    />
+  </div>
+</template>
+<script setup>
+import { ref, getCurrentInstance } from "vue";
+import { useCrud } from "@/hooks/userCrud";
+import dictDataUtil from "@/common/configs/dictDataUtil";
+import ButtonPermKeys from "@/common/configs/buttonPermission";
+import {
+  useCommonStoreHook,
+  useDictionaryStore,
+  useUserStoreHook,
+} from "@/store";
+
+// 数据字典相关
+const { dicts } = useDictionaryStore();
+const crudRef2 = ref({});
+// 传入一个url,后面不带/
+const {
+  form,
+  data,
+  option,
+  search,
+  page,
+  toDeleteIds,
+  Methords,
+  Utils,
+  commonConfig,
+} = useCrud({
+  src: "/api/v1/process/web/traceability/accessoryMaterialRecord",
+});
+const ctableRef = ref(null);
+const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
+  Methords; //增删改查
+const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
+const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
+const userStore = useUserStoreHook();
+const crudRef = ref(null); //crudRef.value 获取avue-crud对象
+const doEdit = (row, index) => {
+  crudRef2.value && crudRef2.value.rowEdit(row, index);
+};
+const refreshTra = (row) => {
+  commonConfig.value.params = {
+    seqNo: row.seqNo,
+    workOrderCode: row.workOrderCode,
+  };
+  dataList();
+};
+defineExpose({ refreshTra });
+onMounted(() => {
+  if (userStore.user.userId === 10000) {
+    option.value.menu = true;
+  }
+});
+const onSelectedFinish = (selectedValue) => {
+  form.value.itemCode = selectedValue.materialCode;
+  form.value.itemName = selectedValue.materialName;
+  form.value.itemModel = selectedValue.spec;
+};
+option.value = Object.assign(option.value, {
+  searchEnter: true,
+  selection: false,
+  border: true,
+  index: false,
+  expandLevel: 3,
+  headerAlign: "center",
+  align: "center",
+  labelWidth: 100,
+  addBtn: false,
+  delBtn: false,
+  viewBtn: false,
+  menu: false,
+  editBtn: false,
+    header: false,
+    rowKey: "opId",
+  column: [
+    {
+      label: "工序Id",
+      prop: "opId",
+      display: false,
+      hide: true,
+    },
+    {
+      label: "工序名称",
+      prop: "opName",
+      display: false,
+    },
+
+    {
+      label: "物料名称",
+      prop: "itemName",
+      disabled: "true",
+    },
+    {
+      label: "物料规格",
+      prop: "itemModel",
+      disabled: "true",
+      search: true,
+      type: "input",
+    },
+    {
+      label: "物料编号",
+      prop: "itemCode",
+      search: false,
+      click: ({ value, column }) => {
+        ctableRef.value.startSelect();
+      },
+      change: ({ value, column }) => {
+        if (value != form.value.itemCode) {
+          ctableRef.value.startSelect();
+        }
+      },
+      rules: [
+        {
+          required: true,
+          message: "请选择物料编码",
+          trigger: "blur",
+        },
+      ],
+    },
+    {
+      label: "批次号",
+      prop: "batchNo",
+      display: false,
+    },
+      {
+          label: "管号",
+          prop: "seqNo",
+          display: false,
+      },
+
+  ],
+});
+</script>

+ 1 - 1
src/views/pro/traceability/components/materialsCom.vue

@@ -98,9 +98,9 @@ option.value = Object.assign(option.value, {
   delBtn: false,
   viewBtn: false,
   menu: false,
-  header: false,
   editBtn: false,
   rowKey: "opId",
+  header: false,
   column: [
     {
       label: "工序Id",

+ 54 - 4
src/views/pro/traceability/index.vue

@@ -85,7 +85,7 @@
             label="已采物料"
             class="tabpaneBox"
           >
-            <template #label>
+<!--            <template #label>
               <span
                 >已采物料
                 <el-badge
@@ -94,9 +94,45 @@
                   type="primary"
                 />
               </span>
-            </template>
-            <MaterialsCom ref="materialsComRef" />
+            </template>-->
+            <el-tabs type="border-card"  @tab-click="tabsEvent2"
+                     v-model="defaultTab">
+            <el-tab-pane
+                name="materialsComRef"
+                label="主料记录"
+                class="tabpaneBox"
+            >
+                <template #label>
+              <span
+              >主料记录
+                <el-badge
+                        :value="tabCount.materials"
+                        class="item"
+                        type="primary"
+                />
+              </span>
+                </template>
+            <MaterialsCom  ref="materialsComRef" />
+            </el-tab-pane>
+              <el-tab-pane
+                name="materialsAccessoryComRef"
+                label="辅料记录"
+                class="tabpaneBox"
+              ><template #label>
+                  <span
+                  >辅料记录
+                <el-badge
+                        :value="tabCount.accessoryMaterials"
+                        class="item"
+                        type="primary"
+                />
+              </span>
+              </template>
+                <MaterialsAccessoryCom  ref="materialsAccessoryComRef" />
+              </el-tab-pane>
+            </el-tabs>
           </el-tab-pane>
+
           <el-tab-pane name="recordComRef" label="记录项" class="tabpaneBox">
             <template #label>
               <span
@@ -198,6 +234,7 @@ import { useCrud } from "@/hooks/userCrud";
 import { traceabilityTabCount } from "@/api/process";
 import { getMaterialDetailsByseqNo, getOperationCompent } from "@/api/material";
 import TraceabilityCom from "@/views/pro/traceability/components/traceabilityCom.vue";
+import MaterialsAccessoryCom from "@/views/pro/traceability/components/materialsAccessoryCom.vue";
 import MaterialsCom from "@/views/pro/traceability/components/materialsCom.vue";
 import RecordCom from "@/views/pro/traceability/components/recordCom.vue";
 import CheckCom from "@/views/pro/traceability/components/checkCom.vue";
@@ -207,7 +244,6 @@ import MediaCom from "./components/mediaCom.vue";
 import ExcelCom from "./components/excelCom.vue";
 import TestData from "./components/testData.vue";
 import FileCom from "./components/fileCom.vue";
-
 // 传入一个url,后面不带/
 const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
   useCrud({
@@ -231,6 +267,7 @@ const crudRef = ref(null); //crudRef.value 获取avue-crud对象
 
 const traceabilityComRef = ref(null);
 const materialsComRef = ref(null);
+const materialsAccessoryComRef = ref(null);
 const recordComRef = ref(null);
 const checkComRef = ref(null);
 const equitComRef = ref(null);
@@ -240,11 +277,15 @@ const excelComRef = ref(null);
 const cssjComRef = ref(null);
 const fileComRef = ref(null);
 let defaultTabName = ref("traceabilityComRef");
+
+let defaultTab = ref("materialsComRef");
+
 //tab页组件
 const tabNameComRef = new Map([
   ["traceabilityComRef", traceabilityComRef],
   ["materialsComRef", materialsComRef],
   ["recordComRef", recordComRef],
+    ["materialsAccessoryComRef", materialsAccessoryComRef],
   ["checkComRef", checkComRef],
   ["equitComRef", equitComRef],
   ["faultComRef", faultComRef],
@@ -261,6 +302,13 @@ const tabsEvent = (pane, ev) => {
   }
 };
 
+const tabsEvent2 = (pane, ev) => {
+    defaultTab.value = pane.props.name;
+    if (temRow.value.seqNo) {
+        tabNameComRef.get(pane.props.name)?.value.refreshTra(temRow.value);
+    }
+};
+
 const chooseTagType = (row, type) => {
   let daynamicType = "";
   if (type == "text") {
@@ -296,6 +344,7 @@ let tabCount = reactive({
   excel: "",
   testData: "",
   file: "",
+    accessoryMaterials:"",
 });
 
 const handleCellClick = (row, column, event) => {
@@ -326,6 +375,7 @@ const handleCellClick = (row, column, event) => {
       //物料履历
       //traceabilityComRef.value.refreshTra(row);
       tabNameComRef.get(defaultTabName.value)?.value.refreshTra(temRow.value);
+        tabNameComRef.get(defaultTab.value)?.value.refreshTra(temRow.value);
     }
     //每次点击都要获取tab页面的数量
     traceabilityTabCount({