Ver Fonte

定制工单页面,table拖拽插件

cz há 1 ano atrás
pai
commit
93eb533efd

+ 1 - 0
package.json

@@ -42,6 +42,7 @@
     "moment": "^2.29.4",
     "nprogress": "0.2.0",
     "pinia": "2.0.22",
+    "sortablejs": "^1.15.0",
     "typescript": "^5.0.4",
     "vue": "3.2.45",
     "vue-cropper": "1.0.3",

+ 10 - 3
src/components/WDLY/process/SendPurchaseWDLY.vue

@@ -106,11 +106,18 @@
         </el-button>
         <el-table :data="formData.data.purchaseDetailList">
           <el-table-column
-            prop="goodType"
+            prop="productDefinition"
             label="物品类型"
-            :formatter="(row) => (row.goodType == 1 ? '产品' : '物料')"
+            :formatter="
+              (row) =>
+                row.productDefinition == 1
+                  ? '产品'
+                  : row.productDefinition == 1
+                  ? '物料'
+                  : ''
+            "
           />
-          <el-table-column prop="productCode" label="物品编码" />
+          <el-table-column prop="productCustomCode" label="物品编码" />
           <el-table-column prop="productName" label="物品名称" />
           <!-- <el-table-column prop="productSpec" label="规格型号" /> -->
           <el-table-column

+ 17 - 1
src/views/JXSK/production/bom/index.vue

@@ -88,7 +88,13 @@
               <el-table :data="formData.data.bomDetailList">
                 <el-table-column prop="productCode" label="物料编码" />
                 <el-table-column prop="productName" label="物料名称" />
-                <el-table-column prop="productUnit" label="单位" />
+                <el-table-column
+                  prop="productUnit"
+                  label="单位"
+                  :formatter="
+                    (row) => dictValueLabel(row.productUnit, materialUnit)
+                  "
+                />
                 <el-table-column prop="quantity" label="数量" width="150">
                   <template #default="{ row, $index }">
                     <el-form-item
@@ -726,6 +732,16 @@ const handleBeforeUpload = async (file) => {
   ];
 };
 
+const materialUnit = ref([]);
+const getDict = () => {
+  proxy.getDictOne(["material_unit"]).then((res) => {
+    materialUnit.value = res["material_unit"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+  });
+};
+getDict();
 getList();
 </script>
   

+ 215 - 127
src/views/JXSK/production/workOrder/index.vue

@@ -48,14 +48,20 @@
               label-width="0px"
               style="margin-top: 15px"
             >
-              <el-table :data="formData.data.bomDetailList">
+              <el-table :data="formData.data.workOrderBomList">
                 <el-table-column prop="productCode" label="物料编码" />
                 <el-table-column prop="productName" label="物料名称" />
-                <el-table-column prop="productUnit" label="单位" />
+                <el-table-column
+                  prop="productUnit"
+                  label="单位"
+                  :formatter="
+                    (row) => dictValueLabel(row.productUnit, materialUnit)
+                  "
+                />
                 <el-table-column prop="quantity" label="数量" width="150">
                   <template #default="{ row, $index }">
                     <el-form-item
-                      :prop="'bomDetailList.' + $index + '.quantity'"
+                      :prop="'workOrderBomList.' + $index + '.quantity'"
                       :rules="rules.quantity"
                       :inline-message="true"
                     >
@@ -68,22 +74,6 @@
                     </el-form-item>
                   </template>
                 </el-table-column>
-                <el-table-column prop="zip" label="成本" width="150">
-                  <template #default="{ row, $index }">
-                    <el-form-item
-                      :prop="'bomDetailList.' + $index + '.cost'"
-                      :rules="rules.cost"
-                      :inline-message="true"
-                    >
-                      <el-input-number
-                        v-model="row.cost"
-                        :precision="2"
-                        :controls="false"
-                        :min="1"
-                      />
-                    </el-form-item>
-                  </template>
-                </el-table-column>
                 <el-table-column prop="zip" label="操作" width="100">
                   <template #default="{ $index }">
                     <el-button type="primary" link @click="handleRemove($index)"
@@ -124,37 +114,44 @@
         ref="byformOne"
       >
         <template #slot>
-          <div style="width: 100%">
+          <div style="width: 100%" class="tableDrop">
             <el-button type="primary" plain @click="clickAdd"
               >添加工序</el-button
             >
             <el-table
-              :data="formData.dataOne.list"
+              :data="formData.dataOne.workOrderProductionProcessesList"
               style="width: 100%; margin-top: 16px"
+              row-key="id"
             >
               <el-table-column label="工序名称" width="150">
                 <template #default="{ row, $index }">
                   <div style="width: 100%">
                     <el-form-item
-                      :prop="'list.' + $index + '.contactNo'"
-                      :rules="rulesOne.contactNo"
+                      :prop="
+                        'workOrderProductionProcessesList.' + $index + '.name'
+                      "
+                      :rules="rulesOne.name"
                       :inline-message="true"
                     >
-                      <el-input v-model="row.contactNo" placeholder="请输入" />
+                      <el-input v-model="row.name" placeholder="请输入" />
                     </el-form-item>
                   </div>
                 </template>
               </el-table-column>
-              <el-table-column label="工艺说明">
+              <el-table-column label="工艺说明" width="300">
                 <template #default="{ row, $index }">
                   <div style="width: 100%">
                     <el-form-item
-                      :prop="'list.' + $index + '.contactNo'"
-                      :rules="rulesOne.contactNo"
+                      :prop="
+                        'workOrderProductionProcessesList.' +
+                        $index +
+                        '.remarks'
+                      "
+                      :rules="rulesOne.remarks"
                       :inline-message="true"
                     >
                       <el-input
-                        v-model="row.contactNo"
+                        v-model="row.remarks"
                         type="textarea"
                         placeholder="请输入"
                       />
@@ -162,24 +159,31 @@
                   </div>
                 </template>
               </el-table-column>
-              <el-table-column label="图纸" width="150">
+              <el-table-column label="图纸">
                 <template #default="{ row, $index }">
                   <div style="width: 100%">
                     <el-form-item
-                      :prop="'list.' + $index + '.contactNo'"
-                      :rules="rulesOne.contactNo"
+                      :prop="
+                        'workOrderProductionProcessesList.' + $index + '.name'
+                      "
+                      :rules="rulesOne.name"
                       :inline-message="true"
                     >
                       <el-upload
-                        v-model:fileList="fileList"
+                        v-model:fileList="row.fileList"
                         :show-file-list="false"
                         class="upload-demo"
                         action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
                         :data="uploadData"
-                        :before-upload="handleBeforeUpload"
+                        :before-upload="
+                          (file) => handleBeforeUpload(file, $index)
+                        "
                         accept=".pdf"
                       >
-                        <el-icon :size="17" style="margin-top: 12px">
+                        <el-icon
+                          :size="17"
+                          style="margin-top: 12px; cursor: pointer"
+                        >
                           <Edit />
                         </el-icon>
                       </el-upload>
@@ -189,7 +193,7 @@
                             style="margin-left: 10px"
                             class="ml-2"
                             type="info"
-                            v-for="(item, index) in fileListCopy"
+                            v-for="(item, index) in row.fileListCopy"
                             :key="index"
                             >{{ item.fileName }}</el-tag
                           >
@@ -203,7 +207,7 @@
               <el-table-column
                 align="center"
                 label="操作"
-                width="80"
+                width="60"
                 fixed="right"
               >
                 <template #default="{ $index }">
@@ -252,14 +256,17 @@
 import { ElMessage, ElMessageBox } from "element-plus";
 import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
-import { computed, defineComponent, ref } from "vue";
+import { computed, defineComponent, nextTick, ref } from "vue";
 import useUserStore from "@/store/modules/user";
 import SelectMaterial from "@/components/product/SelectMaterial";
+import Sortable from "sortablejs";
+
 const uploadData = ref({});
 let fileList = ref([]);
 let fileListCopy = ref([]);
 const loading = ref(false);
 const submitLoading = ref(false);
+const loadingOne = ref(false);
 const sourceList = ref({
   data: [],
   pagination: {
@@ -274,23 +281,20 @@ let openMaterial = ref(false);
 let roomDialogVisible = ref(false);
 let modalType = ref("add");
 let rules = ref({
-  type: [
-    { required: true, message: "请选择仓库类型", trigger: ["blur", "change"] },
-  ],
-  name: [{ required: true, message: "请输入仓库名称", trigger: "blur" }],
+  quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
 });
 let rulesOne = ref({
-  type: [
-    { required: true, message: "请选择仓库类型", trigger: ["blur", "change"] },
-  ],
-  name: [{ required: true, message: "请输入仓库名称", trigger: "blur" }],
+  name: [{ required: true, message: "请输入工序名称", trigger: "blur" }],
+  remarks: [{ required: true, message: "请输入工艺说明", trigger: "blur" }],
 });
 const { proxy } = getCurrentInstance();
-const selectConfig = reactive([
+const materialUnit = ref([]);
+const workOrderSource = ref([]);
+const selectConfig = computed(() => [
   {
     label: "工单来源",
     prop: "type",
-    data: [],
+    data: workOrderSource.value,
   },
 ]);
 
@@ -299,34 +303,31 @@ const config = computed(() => {
     {
       attrs: {
         label: "工单来源",
-        prop: "name",
+        prop: "source",
+      },
+      render(source) {
+        return proxy.dictValueLabel(source, workOrderSource.value);
       },
     },
-    // {
-    //   attrs: {
-    //     label: "仓库类型",
-    //     prop: "type",
-    //   },
-    //   render(type) {
-    //     return proxy.dictDataEcho(type, warehouseType.value);
-    //   },
-    // },
     {
       attrs: {
         label: "产品名称",
-        prop: "keeperName",
+        prop: "productName",
       },
     },
     {
       attrs: {
         label: "是否定制",
-        prop: "remark",
+        prop: "isCustomized",
+      },
+      render(isCustomized) {
+        return isCustomized == 1 ? "是" : "否";
       },
     },
     {
       attrs: {
         label: "工单数量",
-        prop: "remark",
+        prop: "quantity",
       },
     },
     {
@@ -338,7 +339,7 @@ const config = computed(() => {
     {
       attrs: {
         label: "完成率",
-        prop: "remark",
+        prop: "aa",
       },
     },
     {
@@ -350,28 +351,32 @@ const config = computed(() => {
       // 渲染 el-button,一般用在最后一列。
       renderHTML(row) {
         return [
-          {
-            attrs: {
-              label: "调整BOM",
-              type: "primary",
-              text: true,
-            },
-            el: "button",
-            click() {
-              getDtl(row);
-            },
-          },
-          {
-            attrs: {
-              label: "调整工艺",
-              type: "primary",
-              text: true,
-            },
-            el: "button",
-            click() {
-              getDtlOne(row);
-            },
-          },
+          row.isCustomized == 1
+            ? {
+                attrs: {
+                  label: "调整BOM",
+                  type: "primary",
+                  text: true,
+                },
+                el: "button",
+                click() {
+                  getDtl(row);
+                },
+              }
+            : {},
+          row.isCustomized == 1
+            ? {
+                attrs: {
+                  label: "调整工艺",
+                  type: "primary",
+                  text: true,
+                },
+                el: "button",
+                click() {
+                  getDtlOne(row);
+                },
+              }
+            : {},
         ];
       },
     },
@@ -409,7 +414,7 @@ const formConfigOne = reactive([
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
-  proxy.post("/warehouse/page", sourceList.value.pagination).then((message) => {
+  proxy.post("/workOrder/page", sourceList.value.pagination).then((message) => {
     console.log(message);
     sourceList.value.data = message.rows;
     sourceList.value.pagination.total = message.total;
@@ -425,13 +430,12 @@ const openModal = () => {
 };
 
 const submitForm = () => {
-  console.log(byform.value);
   byform.value.handleSubmit((valid) => {
     submitLoading.value = true;
-    proxy.post("/warehouse/" + modalType.value, formData.data).then(
+    proxy.post("/workOrderBom/edit", formData.data).then(
       (res) => {
         ElMessage({
-          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          message: "操作成功",
           type: "success",
         });
         dialogVisible.value = false;
@@ -444,79 +448,163 @@ const submitForm = () => {
 };
 
 const submitFormOne = () => {
-  console.log(byform.value);
   byformOne.value.handleSubmit((valid) => {
-    submitLoading.value = true;
-    proxy.post("/warehouse/" + modalType.value, formData.data).then(
+    for (
+      let i = 0;
+      i < formData.dataOne.workOrderProductionProcessesList.length;
+      i++
+    ) {
+      const e = formData.dataOne.workOrderProductionProcessesList[i];
+      if (!e.fileListCopy.length > 0) {
+        return ElMessage({
+          message: "请上传图纸",
+          type: "info",
+        });
+      }
+    }
+    for (
+      let i = 0;
+      i < formData.dataOne.workOrderProductionProcessesList.length;
+      i++
+    ) {
+      const e = formData.dataOne.workOrderProductionProcessesList[i];
+      e.fileList = e.fileListCopy;
+    }
+    loadingOne.value = true;
+    proxy.post("/workOrderProductionProcesses/edit", formData.dataOne).then(
       (res) => {
         ElMessage({
-          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          message: "操作成功",
           type: "success",
         });
-        dialogVisible.value = false;
-        submitLoading.value = false;
+        dialogVisibleOne.value = false;
+        loadingOne.value = false;
         getList();
       },
-      (err) => (submitLoading.value = false)
+      (err) => (loadingOne.value = false)
     );
   });
 };
+
 const getDtl = (row) => {
   modalType.value = "edit";
-  proxy.post("/warehouse/detail", { id: row.id }).then((res) => {
-    res.type = res.type + "";
+  proxy.post("/workOrderBom/list", { workOrderId: row.id }).then((res) => {
+    formData.data = {
+      workOrderBomList: res,
+      workOrderId: row.id,
+    };
     dialogVisible.value = true;
-    formData.data = res;
+  });
+};
+
+const handleRemove = (index) => {
+  formData.data.workOrderBomList.splice(index, 1);
+};
+// 对el-table进行拖拽排序
+const initSort = () => {
+  const tbody = document.querySelector(
+    ".tableDrop .el-table__body-wrapper tbody"
+  );
+  Sortable.create(tbody, {
+    onEnd({ newIndex, oldIndex }) {
+      if (newIndex == oldIndex) return;
+      formData.dataOne.workOrderProductionProcessesList.splice(
+        newIndex,
+        0,
+        formData.dataOne.workOrderProductionProcessesList.splice(oldIndex, 1)[0]
+      );
+      var newArray = formData.dataOne.workOrderProductionProcessesList.slice(0);
+      formData.dataOne.workOrderProductionProcessesList = [];
+      nextTick(() => {
+        formData.dataOne.workOrderProductionProcessesList = newArray;
+      });
+    },
   });
 };
 const getDtlOne = (row) => {
   modalType.value = "edit";
-  formData.dataOne = {
-    name: row.name,
-    keeperId: row.keeperId,
-    list: [],
-  };
-  dialogVisibleOne.value = true;
-};
-
-const warehouseType = ref([]);
-const getDict = () => {
-  // // 币种数据
   proxy
-    .post("/dictTenantData/page", {
-      pageNum: 1,
-      pageSize: 999,
-      tenantId: useUserStore().user.tenantId,
-      dictCode: "warehouse_type",
-    })
+    .post("/workOrderProductionProcesses/list", { workOrderId: row.id })
     .then((res) => {
-      warehouseType.value = res.rows;
-      selectConfig[0].data = res.rows.map((x) => ({
-        label: x.dictValue,
-        value: x.dictKey,
-      }));
-      formConfig[0].data = res.rows.map((x) => ({
-        label: x.dictValue,
-        value: x.dictKey,
+      dialogVisibleOne.value = true;
+      res = res.map((x) => ({
+        ...x,
+        fileList: [
+          {
+            fileName: x.fileName,
+            id: x.oldId,
+          },
+        ],
+        fileListCopy: [
+          {
+            fileName: x.fileName,
+            id: x.oldId,
+          },
+        ],
       }));
+      formData.dataOne = {
+        workOrderId: row.id,
+        workOrderProductionProcessesList: res,
+      };
+      nextTick(() => {
+        initSort();
+      });
     });
 };
+
+const getDict = () => {
+  proxy.getDictOne(["material_unit", "work_order_source"]).then((res) => {
+    materialUnit.value = res["material_unit"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+    workOrderSource.value = res["work_order_source"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+  });
+};
 getList();
 getDict();
 
+const handleSelect = (row) => {
+  const flag = formData.data.workOrderBomList.some(
+    (x) => x.productId === row.id
+  );
+  if (flag)
+    return ElMessage({
+      message: "该物料已选择",
+      type: "info",
+    });
+  formData.data.workOrderBomList.push({
+    productId: row.id,
+    productCode: row.code,
+    productName: row.name,
+    productUnit: row.unit,
+    quantity: null,
+  });
+  return ElMessage({
+    message: "选择成功",
+    type: "success",
+  });
+};
+
 const clickAdd = () => {
-  formData.dataOne.list.push({
-    type: [],
+  formData.dataOne.workOrderProductionProcessesList.push({
+    fileList: [],
+    fileListCopy: [],
+    name: "",
+    remarks: "",
   });
 };
 const clickDelete = (index) => {
-  formData.dataOne.list.splice(index, 1);
+  formData.dataOne.workOrderProductionProcessesList.splice(index, 1);
 };
 
-const handleBeforeUpload = async (file) => {
+const handleBeforeUpload = async (file, index) => {
   const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
   uploadData.value = res.uploadBody;
-  fileListCopy.value = [
+  formData.dataOne.workOrderProductionProcessesList[index].fileListCopy = [
     {
       id: res.id,
       fileName: res.fileName,

+ 45 - 53
src/views/WDLY/purchaseManage/alreadyPurchase/index.vue

@@ -31,6 +31,45 @@
             {{ item.contractCode }}
           </div>
         </template>
+
+        <template #btn="{ item }">
+          <div>
+            <el-button
+              type="primary"
+              link
+              v-if="
+                (item.purchaseStatus == 20 || item.purchaseStatus == 30) &&
+                item.arrivalStatus != 20
+              "
+              @click="handleArrival(item, 'add')"
+              >发货登记</el-button
+            >
+            <el-button
+              type="primary"
+              link
+              v-if="
+                (item.purchaseStatus == 20 || item.purchaseStatus == 30) &&
+                item.arrivalStatus != 20
+              "
+              @click="handleArrival(item, 'edit')"
+              >到货通知</el-button
+            >
+            <el-button
+              type="primary"
+              link
+              v-if="item.purchaseStatus == 30 && item.arrivalStatus == 10"
+              @click="handleEdit(item, 88)"
+              >作废</el-button
+            >
+            <el-button
+              type="primary"
+              link
+              v-if="item.purchaseStatus == 30 && item.arrivalStatus == 0"
+              @click="handleEdit(item, 99)"
+              >终止</el-button
+            >
+          </div>
+        </template>
       </byTable>
     </div>
     <el-dialog
@@ -315,6 +354,7 @@ const config = computed(() => {
       attrs: {
         label: "供应商",
         prop: "supplyName",
+        width: 180,
       },
     },
     {
@@ -336,6 +376,7 @@ const config = computed(() => {
       attrs: {
         label: "采购人",
         prop: "purchaseName",
+        width: 150,
       },
     },
     {
@@ -374,59 +415,10 @@ const config = computed(() => {
     {
       attrs: {
         label: "操作",
-        width: "240",
-        align: "right",
-      },
-      renderHTML(row) {
-        return [
-          //  (row.purchaseStatus == 20 || row.purchaseStatus == 30) &&
-          // row.arrivalStatus != 2
-          //   ?
-          {
-            attrs: {
-              label: "发货登记",
-              type: "primary",
-              text: true,
-            },
-            el: "button",
-            click() {
-              handleArrival(row, "add");
-            },
-          },
-          {
-            attrs: {
-              label: "到货通知",
-              type: "primary",
-              text: true,
-            },
-            el: "button",
-            click() {
-              handleArrival(row, "edit");
-            },
-          },
-          {
-            attrs: {
-              label: "作废",
-              type: "primary",
-              text: true,
-            },
-            el: "button",
-            click() {
-              handleEdit(row, 88);
-            },
-          },
-          {
-            attrs: {
-              label: "终止",
-              type: "primary",
-              text: true,
-            },
-            el: "button",
-            click() {
-              handleEdit(row, 99);
-            },
-          },
-        ];
+        slot: "btn",
+        width: "260",
+        align: "center",
+        fixed: "right",
       },
     },
   ];

+ 1 - 1
src/views/WDLY/purchaseManage/purchase/index.vue

@@ -213,7 +213,7 @@ const config = computed(() => {
     {
       attrs: {
         label: "物品编码",
-        prop: "productCode",
+        prop: "productCustomCode",
       },
     },
     {

+ 1 - 1
src/views/WDLY/purchaseManage/subscribe/index.vue

@@ -211,7 +211,7 @@ const config = computed(() => {
     {
       attrs: {
         label: "货品编码",
-        prop: "productCode",
+        prop: "productCustomCode",
       },
     },
     {

+ 1 - 1
src/views/product/product/index.vue

@@ -369,7 +369,7 @@ const formConfig = computed(() => {
         },
         {
           type: "input",
-          prop: "customhouse",
+          prop: "customsCode",
           label: "海关编码",
         },
       ],

+ 18 - 1
src/views/production/project/bom/index.vue

@@ -60,7 +60,13 @@
               <el-table :data="formData.data.bomDetailList">
                 <el-table-column prop="productCode" label="物料编码" />
                 <el-table-column prop="productName" label="物料名称" />
-                <el-table-column prop="productUnit" label="单位" />
+                <el-table-column
+                  prop="productUnit"
+                  label="单位"
+                  :formatter="
+                    (row) => dictValueLabel(row.productUnit, materialUnit)
+                  "
+                />
                 <el-table-column prop="quantity" label="数量" width="150">
                   <template #default="{ row, $index }">
                     <el-form-item
@@ -651,6 +657,17 @@ const changeRowData = (val) => {
   const data = versionData.value.find((x) => x.versionNumber === val);
   rowData.value = data ? data : {};
 };
+
+const materialUnit = ref([]);
+const getDict = () => {
+  proxy.getDictOne(["material_unit"]).then((res) => {
+    materialUnit.value = res["material_unit"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+  });
+};
+getDict();
 getList();
 </script>
   

+ 3 - 2
src/views/purchaseSales/outAndInWarehouse/inventoryInquiry/index.vue

@@ -36,7 +36,7 @@
           </div>
         </template>
       </byTable>
-      <!-- <div>
+      <div v-if="goodList && goodList.length > 0">
         <div>已选择货品</div>
         <div style="margin: 10px 0px">
           <el-tag
@@ -55,7 +55,7 @@
             确 定
           </el-button>
         </div>
-      </div> -->
+      </div>
     </div>
   </div>
 </template>
@@ -270,6 +270,7 @@ const clickSelect = (row) => {
     message: "选择成功",
     type: "success",
   });
+  proxy.$emit("select", item);
 };
 const handleRemove = (index) => {
   goodList.value.splice(index, 1);