|
@@ -13,23 +13,28 @@
|
|
|
},
|
|
|
]" @get-list="getList">
|
|
|
<template #line="{ item }">
|
|
|
- <span v-for="(x, i) in item.processRouteNameList" :key="i">
|
|
|
- {{ x }}
|
|
|
- <span style="margin: 0 3px" v-if="i + 1 < item.processRouteNameList.length"> ,
|
|
|
+ <div style="width:100%">
|
|
|
+ <span v-for="(x, i) in item.processRouteNameList" :key="i">
|
|
|
+ {{ x }}
|
|
|
+ <span style="margin: 0 3px" v-if="i + 1 < item.processRouteNameList.length"> ,
|
|
|
+ </span>
|
|
|
</span>
|
|
|
- </span>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<template #product="{ item }">
|
|
|
- <span v-for="(x, i) in item.applicableProductsNameList" :key="i">
|
|
|
- {{ x }}
|
|
|
- <span v-if="i + 1 < item.applicableProductsNameList.length">,
|
|
|
+ <div style="width:100%">
|
|
|
+ <span v-for="(x, i) in item.applicableProductsNameList" :key="i">
|
|
|
+ {{ x }}
|
|
|
+ <span v-if="i + 1 < item.applicableProductsNameList.length">,
|
|
|
+ </span>
|
|
|
</span>
|
|
|
- </span>
|
|
|
+ </div>
|
|
|
+
|
|
|
</template>
|
|
|
</byTable>
|
|
|
</div>
|
|
|
- <el-dialog :title="modalType == 'add' ? '添加工艺' : '编辑工艺'" v-model="dialogVisible" width="90%" v-loading="loading" destroy-on-close>
|
|
|
- <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
|
|
|
+ <el-dialog :title="modalType == 'add' ? '添加工艺' : '编辑工艺'" v-model="dialogVisible" width="90%" destroy-on-close>
|
|
|
+ <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform" v-loading="submitLoading">
|
|
|
<!-- <template #lineSlot>
|
|
|
<el-transfer v-model="selectLine" filterable filter-placeholder="搜索" :data="lineData" :titles="['可选', '已选']" target-order="push">
|
|
|
<template #default="{ option }">
|
|
@@ -62,6 +67,27 @@
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
+
|
|
|
+ </byForm>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="dialogVisible = false" size="large">取 消</el-button>
|
|
|
+ <el-button type="primary" v-no-double-click="submitForm" size="large" :loading="submitLoading">
|
|
|
+ 确 定
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog v-model="openProduct" title="选择产品" width="70%" append-to-body>
|
|
|
+ <SelectProduct @handleSelect="handleSelect" :isTechnology="'0'"></SelectProduct>
|
|
|
+ <template #footer>
|
|
|
+ <span class="dialog-footer">
|
|
|
+ <el-button @click="openProduct = false">取消</el-button>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog :title=" '工艺适用产品'" v-model="dialogVisibleOne" width="50%" destroy-on-close>
|
|
|
+ <byForm :formConfig="formConfigOne" :formOption="formOption" v-model="formData.dataOne" ref="byformOne" v-loading="submitLoading">
|
|
|
<template #productSlot>
|
|
|
<div>
|
|
|
<el-button type="primary" @click="openProduct = true">
|
|
@@ -73,22 +99,16 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
+
|
|
|
</byForm>
|
|
|
<template #footer>
|
|
|
- <el-button @click="dialogVisible = false" size="large">取 消</el-button>
|
|
|
- <el-button type="primary" v-no-double-click="submitForm" size="large" :loading="submitLoading">
|
|
|
+ <el-button @click="dialogVisibleOne = false" size="large">取 消</el-button>
|
|
|
+ <el-button type="primary" v-no-double-click="submitFormOne" size="large" :loading="submitLoading">
|
|
|
确 定
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
- <el-dialog v-model="openProduct" title="选择产品" width="70%" append-to-body>
|
|
|
- <SelectProduct @handleSelect="handleSelect" :isTechnology="'0'"></SelectProduct>
|
|
|
- <template #footer>
|
|
|
- <span class="dialog-footer">
|
|
|
- <el-button @click="openProduct = false">取消</el-button>
|
|
|
- </span>
|
|
|
- </template>
|
|
|
- </el-dialog>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -174,14 +194,12 @@ const config = computed(() => {
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "工艺路线",
|
|
|
-
|
|
|
slot: "line",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "适用产品",
|
|
|
-
|
|
|
slot: "product",
|
|
|
},
|
|
|
},
|
|
@@ -194,21 +212,21 @@ const config = computed(() => {
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "操作",
|
|
|
- width: "200",
|
|
|
- align: "right",
|
|
|
+ width: "160",
|
|
|
+ align: "center",
|
|
|
},
|
|
|
// 渲染 el-button,一般用在最后一列。
|
|
|
renderHTML(row) {
|
|
|
return [
|
|
|
{
|
|
|
attrs: {
|
|
|
- label: "修改",
|
|
|
+ label: "产品",
|
|
|
type: "primary",
|
|
|
text: true,
|
|
|
},
|
|
|
el: "button",
|
|
|
click() {
|
|
|
- getDtl(row);
|
|
|
+ updateProduct(row);
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -255,8 +273,8 @@ let formData = reactive({
|
|
|
name: "",
|
|
|
processRouteList: [],
|
|
|
remarks: "",
|
|
|
- productList: [],
|
|
|
},
|
|
|
+ dataOne: {},
|
|
|
});
|
|
|
const formOption = reactive({
|
|
|
inline: true,
|
|
@@ -278,11 +296,11 @@ const formConfig = computed(() => {
|
|
|
slotName: "lineSlot",
|
|
|
label: "工艺路线",
|
|
|
},
|
|
|
- {
|
|
|
- type: "slot",
|
|
|
- slotName: "productSlot",
|
|
|
- label: "适用产品",
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // type: "slot",
|
|
|
+ // slotName: "productSlot",
|
|
|
+ // label: "适用产品",
|
|
|
+ // },
|
|
|
{
|
|
|
type: "input",
|
|
|
prop: "remarks",
|
|
@@ -291,6 +309,15 @@ const formConfig = computed(() => {
|
|
|
},
|
|
|
];
|
|
|
});
|
|
|
+const formConfigOne = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "productSlot",
|
|
|
+ label: "适用产品",
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
const getList = async (req) => {
|
|
|
sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
loading.value = true;
|
|
@@ -323,33 +350,17 @@ const openModal = () => {
|
|
|
modalType.value = "add";
|
|
|
formData.data = {};
|
|
|
selectLine.value = [];
|
|
|
- productList.value = [];
|
|
|
};
|
|
|
const vueFlowDom = ref(null);
|
|
|
const nodeObject = ref("");
|
|
|
const submitForm = () => {
|
|
|
byform.value.handleSubmit((valid) => {
|
|
|
- // if (!selectLine.value.length > 0)
|
|
|
- // return ElMessage({
|
|
|
- // message: "请添加工艺路线",
|
|
|
- // type: "info",
|
|
|
- // });
|
|
|
-
|
|
|
- if (!productList.value.length > 0)
|
|
|
- return ElMessage({
|
|
|
- message: "请添加适用产品",
|
|
|
- type: "info",
|
|
|
- });
|
|
|
const data = vueFlowDom.value.submitAll();
|
|
|
if (!data) {
|
|
|
return;
|
|
|
}
|
|
|
formData.data.nodeObject = data.nodeObject;
|
|
|
submitLoading.value = true;
|
|
|
- // formData.data.processRouteList = selectLine.value; //选择的工序数据
|
|
|
- formData.data.productList = productList.value.map((x) => ({
|
|
|
- productId: x.id,
|
|
|
- })); //选择的产品数据
|
|
|
proxy.post("/technology/" + modalType.value, formData.data).then(
|
|
|
(res) => {
|
|
|
ElMessage({
|
|
@@ -358,17 +369,42 @@ const submitForm = () => {
|
|
|
});
|
|
|
dialogVisible.value = false;
|
|
|
submitLoading.value = false;
|
|
|
-
|
|
|
getList();
|
|
|
},
|
|
|
(err) => {
|
|
|
- console.log(err, "aswwwww");
|
|
|
submitLoading.value = false;
|
|
|
}
|
|
|
);
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+const submitFormOne = () => {
|
|
|
+ if (!productList.value.length > 0)
|
|
|
+ return ElMessage({
|
|
|
+ message: "请添加适用产品",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ formData.dataOne.productList = productList.value.map((x) => ({
|
|
|
+ productId: x.id,
|
|
|
+ }));
|
|
|
+ //选择的产品数据
|
|
|
+ submitLoading.value = true;
|
|
|
+ proxy.post("/technology/editProduct", formData.dataOne).then(
|
|
|
+ (res) => {
|
|
|
+ ElMessage({
|
|
|
+ message: "操作成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ dialogVisibleOne.value = false;
|
|
|
+ submitLoading.value = false;
|
|
|
+ getList();
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ submitLoading.value = false;
|
|
|
+ }
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
const getDtl = (row) => {
|
|
|
modalType.value = "edit";
|
|
|
proxy.post("/technology/detail", { id: row.id }).then((res) => {
|
|
@@ -380,6 +416,18 @@ const getDtl = (row) => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+const dialogVisibleOne = ref(false);
|
|
|
+const updateProduct = (row) => {
|
|
|
+ proxy.post("/technology/detail", { id: row.id }).then((res) => {
|
|
|
+ productList.value = res.applicableProductsList;
|
|
|
+ formData.dataOne = {
|
|
|
+ id: row.id,
|
|
|
+ productList: [],
|
|
|
+ };
|
|
|
+ dialogVisibleOne.value = true;
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
const productList = ref([]);
|
|
|
|
|
|
const handleSelect = (row) => {
|