|
@@ -1,8 +1,8 @@
|
|
<!--
|
|
<!--
|
|
* @Author: PoJun
|
|
* @Author: PoJun
|
|
* @Date: 2023-12-22 15:47:43
|
|
* @Date: 2023-12-22 15:47:43
|
|
- * @LastEditors: PoJun
|
|
|
|
- * @LastEditTime: 2023-12-22 16:42:49
|
|
|
|
|
|
+ * @LastEditors: XuanJi
|
|
|
|
+ * @LastEditTime: 2024-05-19 15:49:51
|
|
* @Message: Nothing
|
|
* @Message: Nothing
|
|
-->
|
|
-->
|
|
<template>
|
|
<template>
|
|
@@ -45,6 +45,18 @@
|
|
<a-form-model-item label="时间" prop="time">
|
|
<a-form-model-item label="时间" prop="time">
|
|
<a-date-picker valueFormat="YYYY-MM-DD" v-model="form.time" style="width: 100%" />
|
|
<a-date-picker valueFormat="YYYY-MM-DD" v-model="form.time" style="width: 100%" />
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
|
|
+ <a-form-model-item label="关联产品" prop="product">
|
|
|
|
+ <a-tree-select
|
|
|
|
+ :maxTagCount="4"
|
|
|
|
+ v-model="form.product"
|
|
|
|
+ style="width: 100%"
|
|
|
|
+ :tree-data="treeData"
|
|
|
|
+ tree-checkable
|
|
|
|
+ search-placeholder="请选择..."
|
|
|
|
+ :replaceFields="{ title: 'name', key: 'id', value: 'id' }"
|
|
|
|
+ :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
|
|
|
+ />
|
|
|
|
+ </a-form-model-item>
|
|
</a-form-model>
|
|
</a-form-model>
|
|
</a-modal>
|
|
</a-modal>
|
|
</CommonDrawer>
|
|
</CommonDrawer>
|
|
@@ -53,7 +65,13 @@
|
|
<script>
|
|
<script>
|
|
import CommonDrawer from "@/components/table/CommonDrawer.vue";
|
|
import CommonDrawer from "@/components/table/CommonDrawer.vue";
|
|
import CommonTable from "@/components/table/CommonTable.vue";
|
|
import CommonTable from "@/components/table/CommonTable.vue";
|
|
-import { addCooperates, updateCooperates, deleteCooperates, batchDeleteCooperates } from "@/api/index.js";
|
|
|
|
|
|
+import {
|
|
|
|
+ addCooperates,
|
|
|
|
+ updateCooperates,
|
|
|
|
+ deleteCooperates,
|
|
|
|
+ batchDeleteCooperates,
|
|
|
|
+ getProductsTreeNoAuth,
|
|
|
|
+} from "@/api/index.js";
|
|
export default {
|
|
export default {
|
|
name: "SupplierDetail",
|
|
name: "SupplierDetail",
|
|
components: { CommonDrawer, CommonTable },
|
|
components: { CommonDrawer, CommonTable },
|
|
@@ -76,7 +94,9 @@ export default {
|
|
time: null,
|
|
time: null,
|
|
content: "",
|
|
content: "",
|
|
supplierId: this.detailId,
|
|
supplierId: this.detailId,
|
|
|
|
+ product: [],
|
|
},
|
|
},
|
|
|
|
+ formId: "",
|
|
rules: {
|
|
rules: {
|
|
time: [{ required: true, message: "必填项不能为空", trigger: ["change", "blur"] }],
|
|
time: [{ required: true, message: "必填项不能为空", trigger: ["change", "blur"] }],
|
|
content: [{ required: true, message: "必填项不能为空", trigger: ["change", "blur"] }],
|
|
content: [{ required: true, message: "必填项不能为空", trigger: ["change", "blur"] }],
|
|
@@ -105,6 +125,7 @@ export default {
|
|
},
|
|
},
|
|
],
|
|
],
|
|
detaiType: "",
|
|
detaiType: "",
|
|
|
|
+ treeData: [],
|
|
};
|
|
};
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -114,6 +135,8 @@ export default {
|
|
this.showModal = true;
|
|
this.showModal = true;
|
|
this.form.content = row?.content;
|
|
this.form.content = row?.content;
|
|
this.form.time = row?.time;
|
|
this.form.time = row?.time;
|
|
|
|
+ this.formId = row?.id;
|
|
|
|
+ this.form.product = row?.product;
|
|
},
|
|
},
|
|
onClose() {
|
|
onClose() {
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
@@ -145,8 +168,10 @@ export default {
|
|
hideModal() {
|
|
hideModal() {
|
|
this.$refs.authForm.validate(isValid => {
|
|
this.$refs.authForm.validate(isValid => {
|
|
if (isValid) {
|
|
if (isValid) {
|
|
|
|
+ const formData = Object.assign({}, this.form, { id: this.formId });
|
|
|
|
+ console.log(formData);
|
|
const doAjax =
|
|
const doAjax =
|
|
- this.detaiType == "new" ? addCooperates(this.form) : updateCooperates(this.form, this.detailId);
|
|
|
|
|
|
+ this.detaiType == "new" ? addCooperates(this.form) : updateCooperates(formData, this.formId);
|
|
doAjax.then(() => {
|
|
doAjax.then(() => {
|
|
this.$refs.recordsTable.refresh();
|
|
this.$refs.recordsTable.refresh();
|
|
this.showModal = false;
|
|
this.showModal = false;
|
|
@@ -154,8 +179,18 @@ export default {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ async getTreeData() {
|
|
|
|
+ try {
|
|
|
|
+ const data = await getProductsTreeNoAuth();
|
|
|
|
+ this.treeData = data;
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log(error);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ created() {
|
|
|
|
+ this.getTreeData();
|
|
},
|
|
},
|
|
- created() {},
|
|
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
|
|
|