|
@@ -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,
|