Browse Source

检验批号管理。

jxq 2 ngày trước cách đây
mục cha
commit
493d9ff74d

+ 108 - 4
src/components/CommonTable/configs/tableConfig.ts

@@ -491,7 +491,7 @@ export const tableConfig = {
         type: "number",
         precision: 2,
       },
-      { label: "物料规格", prop: "spec",search: true },
+      { label: "物料规格", prop: "spec", search: true },
     ],
   },
 
@@ -920,7 +920,6 @@ export const tableConfig = {
         prop: "id",
         display: false,
         hide: true,
-
       },
       {
         label: "物料名称",
@@ -974,8 +973,113 @@ export const tableConfig = {
       // },
     ],
   },
+  WORK_ORDERS: {
+    url: "/api/v1/plan/workOrder",
+    column: [
+      {
+        label: "工单编号",
+        prop: "workOrderCode",
+        search: true,
+        display: false,
+        width: 125,
+        overHidden: true,
+      },
+      {
+        label: "订单编号",
+        prop: "orderCode",
+        search: true,
+        width: 125,
+        overHidden: true,
+      },
+      {
+        label: "订单名称",
+        prop: "orderName",
+        search: true,
+        disabled: true,
+        width: 125,
+        overHidden: true,
+      },
+      {
+        label: "产品编号",
+        width: 125,
+        overHidden: true,
+        search: true,
+        disabled: true,
+        prop: "materialCode",
+      },
+      {
+        label: "产品名称",
+        width: 125,
+        overHidden: true,
+        search: true,
+        disabled: true,
+        prop: "materialName",
+      },
+      {
+        label: "产品规格",
+        width: 125,
+        search: true,
+        overHidden: true,
+        disabled: true,
+        prop: "materialModel",
+      },
 
+      {
+        label: "状态",
+        prop: "workOrderState",
+        width: "80",
+        display: false,
+        type: "select", //类型为下拉选择框
+        dicUrl:
+          dictDataUtil.request_url +
+          dictDataUtil.TYPE_CODE.plan_work_order_state,
+        props: {
+          label: "dictLabel",
+          value: "dictValue",
+        },
+      },
+      {
+        label: "工艺路线",
+        prop: "processRouteName",
+        width: 125,
+        overHidden: true,
+      },
+      {
+        label: "工序分组",
+        prop: "opType",
+        width: "100",
+        type: "select", //类型为下拉选择框
+        dicUrl: dictDataUtil.request_url + dictDataUtil.TYPE_CODE.op_group,
+        props: {
+          label: "dictLabel",
+          value: "dictValue",
+        },
+      },
+      {
+        label: "分组标识",
+        prop: "opGroup",
+        width: "100",
+      },
+      {
+        label: "前置工单",
+        prop: "frontWorkOrderCode",
+        width: "100",
+      },
+      {
+        label: "生产车间",
+        prop: "workshopName",
+        width: 120,
+        overHidden: true,
+      },
 
-
-
+      {
+        label: "工单数量",
+        prop: "planNum",
+        width: 85,
+        type: "number",
+        min: 1,
+        max: 99999,
+      },
+    ],
+  },
 };

+ 161 - 0
src/views/plan/checkingNumber/index.vue

@@ -0,0 +1,161 @@
+<template>
+  <div class="mainContentBox">
+    <avue-crud
+      ref="crudRef"
+      v-model:search="search"
+      v-model="form"
+      :data="data"
+      :option="option"
+      v-model:page="page"
+      @row-save="createRow"
+      @row-update="updateRow"
+      @search-change="searchChange"
+      @search-reset="resetChange"
+      @size-change="dataList"
+      @current-change="dataList"
+      @selection-change="selectionChange"
+      @before-open="onBeforeOpen"
+    >
+      <template #checkBatch-form="scope">
+        <div
+          style="
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            gap: 20px;
+          "
+        >
+          <el-input
+            v-model="form.checkBatch"
+            placeholder="请输入批号"
+          ></el-input>
+          <el-button type="primary" @click="addNumbers">新增单号</el-button>
+        </div>
+        <el-table
+          v-show="tableData.length > 0"
+          :data="tableData"
+          style="width: 100%; margin-top: 20px"
+        >
+          <el-table-column prop="workOrderCode" label="工单编号" width="120" />
+          <el-table-column prop="state" label="State" width="120" />
+          <el-table-column prop="city" label="City" width="120" />
+          <el-table-column prop="zip" label="Zip" width="120" />
+          <el-table-column fixed="right" label="Operations" min-width="120">
+            <template #default="scope">
+              <el-button
+                link
+                type="danger"
+                size="small"
+                @click.prevent="deleteTableRow(scope.$index)"
+              >
+                删除
+              </el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </template>
+    </avue-crud>
+    <CommonTable
+      ref="productionLineRef"
+      :multipleRow="multipleRow"
+      tableTitle="选择工单"
+      tableType="WORK_ORDERS"
+      @selected-sure="onSelectedFinish"
+    />
+  </div>
+</template>
+<script setup lang="ts">
+import { ref, getCurrentInstance } from "vue";
+import { useCrud } from "@/hooks/userCrud";
+
+// 传入一个url,后面不带/
+const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
+  useCrud({
+    src: "/api/v1/plan/batchNumber",
+  });
+const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
+  Methords; //增删改查
+const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
+const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
+
+const crudRef = ref(null); //crudRef.value 获取avue-crud对象
+
+onMounted(() => {
+  // console.log("crudRef", crudRef)
+  dataList();
+});
+
+const multipleRow = ref(true);
+const productionLineRef = ref(null);
+const startCreat = () => {
+  productionLineRef.value?.mergeOption({
+    selection: true,
+    reserveSelection: true,
+  });
+};
+const addNumbers = () => {
+  nextTick(() => {
+    if (productionLineRef.value) {
+      productionLineRef.value?.mergeOption({
+        selection: true,
+        reserveSelection: true,
+      });
+      productionLineRef.value.startSelect();
+    }
+  });
+};
+
+// 设置表格列或者其他自定义的option
+option.value = Object.assign(option.value, {
+  searchEnter: false,
+  selection: false,
+  menuWidth: 200,
+  border: true,
+  index: true,
+  delBtn: true,
+  viewBtn: false,
+  editBtn: false,
+  rowKey: "id",
+  column: [
+    {
+      label: "批号",
+      prop: "checkBatch",
+      search: true,
+      overHidden: true,
+      span: 24,
+      rules: [
+        {
+          required: true,
+          message: "请输入工厂批号",
+          trigger: "blur",
+        },
+      ],
+    },
+    {
+      label: "创建时间",
+      prop: "created",
+      display: false,
+    },
+  ],
+});
+
+const tableData = ref<any[]>([]); //选中的行
+const onBeforeOpen = (done) => {
+  tableData.value = [];
+  form.value.dtos = [];
+  done();
+};
+const onSelectedFinish = (selectedValue) => {
+  let toAddRow = JSON.parse(JSON.stringify(selectedValue));
+  let tableData_ids = tableData.value.map((item) => item.id);
+  toAddRow = toAddRow.filter((item) => {
+    return tableData_ids.indexOf(item.id) === -1;
+  });
+  tableData.value.push(...toAddRow);
+  form.value.dtos = tableData.value;
+};
+const deleteTableRow = (index: number) => {
+  tableData.value.splice(index, 1);
+  form.value.dtos = tableData.value;
+};
+</script>