|
@@ -7,7 +7,8 @@
|
|
|
:data="treeListData"
|
|
|
v-model="sourceList.pagination.productClassifyId"
|
|
|
@change="treeChange"
|
|
|
- @changeTreeList="getTreeList">
|
|
|
+ @changeTreeList="getTreeList"
|
|
|
+ >
|
|
|
</treeList>
|
|
|
</div>
|
|
|
<div class="content">
|
|
@@ -38,16 +39,22 @@
|
|
|
disabled: false,
|
|
|
},
|
|
|
]"
|
|
|
- @get-list="getList">
|
|
|
+ @get-list="getList"
|
|
|
+ >
|
|
|
<template #pic="{ item }">
|
|
|
<div v-if="item.fileList.length > 0">
|
|
|
- <img :src="item.fileList[0].fileUrl" class="pic" @click="handleClickFile(item.fileList[0])" />
|
|
|
+ <img
|
|
|
+ :src="item.fileList[0].fileUrl"
|
|
|
+ class="pic"
|
|
|
+ @click="handleClickFile(item.fileList[0])"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div v-else></div>
|
|
|
</template>
|
|
|
<template #size="{ item }">
|
|
|
<div>
|
|
|
- <span>{{ item.productLong }}cm</span>* <span>{{ item.productWide }}cm</span>*
|
|
|
+ <span>{{ item.productLong }}cm</span>*
|
|
|
+ <span>{{ item.productWide }}cm</span>*
|
|
|
<span>{{ item.productHigh }}cm</span>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -63,9 +70,21 @@
|
|
|
</template>
|
|
|
</byTable>
|
|
|
</div>
|
|
|
- <el-dialog :title="modalType == 'add' ? '添加产品' : '编辑产品'" v-model="dialogVisible" width="600" v-loading="submitLoading" destroy-on-close>
|
|
|
+ <el-dialog
|
|
|
+ :title="modalType == 'add' ? '添加产品' : '编辑产品'"
|
|
|
+ v-model="dialogVisible"
|
|
|
+ width="600"
|
|
|
+ v-loading="submitLoading"
|
|
|
+ destroy-on-close
|
|
|
+ >
|
|
|
<div class="public_height_dialog">
|
|
|
- <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
|
|
|
+ <byForm
|
|
|
+ :formConfig="formConfig"
|
|
|
+ :formOption="formOption"
|
|
|
+ v-model="formData.data"
|
|
|
+ :rules="rules"
|
|
|
+ ref="byform"
|
|
|
+ >
|
|
|
<template #productPic>
|
|
|
<div>
|
|
|
<el-upload
|
|
@@ -75,7 +94,8 @@
|
|
|
list-type="picture-card"
|
|
|
:on-remove="handleRemove"
|
|
|
:before-upload="handleBeforeUpload"
|
|
|
- accept=".gif, .jpeg, .jpg, .png">
|
|
|
+ accept=".gif, .jpeg, .jpg, .png"
|
|
|
+ >
|
|
|
<el-icon><Plus /></el-icon>
|
|
|
</el-upload>
|
|
|
</div>
|
|
@@ -84,10 +104,21 @@
|
|
|
</div>
|
|
|
<template #footer>
|
|
|
<el-button @click="dialogVisible = false" size="large">取 消</el-button>
|
|
|
- <el-button type="primary" @click="submitForm('byform')" size="large" :loading="submitLoading">确 定</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="submitForm('byform')"
|
|
|
+ size="large"
|
|
|
+ :loading="submitLoading"
|
|
|
+ >确 定</el-button
|
|
|
+ >
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
- <el-dialog title="导入产品" v-model="openExcelDialog" width="400" v-loading="excelLoading">
|
|
|
+ <el-dialog
|
|
|
+ title="导入产品"
|
|
|
+ v-model="openExcelDialog"
|
|
|
+ width="400"
|
|
|
+ v-loading="excelLoading"
|
|
|
+ >
|
|
|
<el-upload
|
|
|
:action="actionUrl + '/productInfo/excelImportByEhsd'"
|
|
|
:headers="headers"
|
|
@@ -95,11 +126,14 @@
|
|
|
:on-progress="handleProgress"
|
|
|
:show-file-list="false"
|
|
|
:on-error="handleError"
|
|
|
- accept=".xlsx">
|
|
|
+ accept=".xlsx"
|
|
|
+ >
|
|
|
<el-button type="primary">点击导入</el-button>
|
|
|
</el-upload>
|
|
|
<template #footer>
|
|
|
- <el-button @click="openExcelDialog = false" size="large">取 消</el-button>
|
|
|
+ <el-button @click="openExcelDialog = false" size="large"
|
|
|
+ >取 消</el-button
|
|
|
+ >
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
@@ -138,15 +172,29 @@ let openExcelDialog = ref(false);
|
|
|
let excelLoading = ref(false);
|
|
|
let modalType = ref("add");
|
|
|
let rules = ref({
|
|
|
- customerId: [{ required: true, message: "请选择客户名称", trigger: "change" }],
|
|
|
- productClassifyId: [{ required: true, message: "请选择产品分类", trigger: "change" }],
|
|
|
+ customerId: [
|
|
|
+ { required: true, message: "请选择客户名称", trigger: "change" },
|
|
|
+ ],
|
|
|
+ productClassifyId: [
|
|
|
+ { required: true, message: "请选择产品分类", trigger: "change" },
|
|
|
+ ],
|
|
|
name: [{ required: true, message: "请输入产品名称", trigger: "blur" }],
|
|
|
unit: [{ required: true, message: "请选择产品单位", trigger: "change" }],
|
|
|
- productLong: [{ required: true, message: "请输入长 (cm)", trigger: "blur" }],
|
|
|
- productWide: [{ required: true, message: "请输入宽 (cm)", trigger: "blur" }],
|
|
|
- productHigh: [{ required: true, message: "请输入高 (cm)", trigger: "blur" }],
|
|
|
- innerPackMethod: [{ required: true, message: "请选择内包装方式", trigger: "change" }],
|
|
|
- outerPackMethod: [{ required: true, message: "请选择外包装方式", trigger: "change" }],
|
|
|
+ productLong: [
|
|
|
+ { required: true, message: "请输入长 (cm)", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ productWide: [
|
|
|
+ { required: true, message: "请输入宽 (cm)", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ productHigh: [
|
|
|
+ { required: true, message: "请输入高 (cm)", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ innerPackMethod: [
|
|
|
+ { required: true, message: "请选择内包装方式", trigger: "change" },
|
|
|
+ ],
|
|
|
+ outerPackMethod: [
|
|
|
+ { required: true, message: "请选择外包装方式", trigger: "change" },
|
|
|
+ ],
|
|
|
});
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
const props = defineProps({
|
|
@@ -254,11 +302,15 @@ const config = computed(() => {
|
|
|
el: "button",
|
|
|
click() {
|
|
|
// 弹窗提示是否删除
|
|
|
- ElMessageBox.confirm("此操作将永久删除该数据, 是否继续?", "提示", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning",
|
|
|
- }).then(() => {
|
|
|
+ ElMessageBox.confirm(
|
|
|
+ "此操作将永久删除该数据, 是否继续?",
|
|
|
+ "提示",
|
|
|
+ {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }
|
|
|
+ ).then(() => {
|
|
|
// 删除
|
|
|
proxy
|
|
|
.post("/productInfo/delete", {
|
|
@@ -484,42 +536,44 @@ const getList = async (req) => {
|
|
|
sourceList.value.pagination.customerId = props.buyCorporationId;
|
|
|
}
|
|
|
loading.value = true;
|
|
|
- proxy.post("/productInfo/getCustomerProductList", sourceList.value.pagination).then(
|
|
|
- (message) => {
|
|
|
- message.rows = message.rows.map((x) => ({
|
|
|
- ...x,
|
|
|
- fileList: [],
|
|
|
- ...JSON.parse(x.ehsdJson),
|
|
|
- }));
|
|
|
- console.log(message.rows);
|
|
|
- sourceList.value.data = message.rows;
|
|
|
- sourceList.value.pagination.total = message.total;
|
|
|
- setTimeout(() => {
|
|
|
- loading.value = false;
|
|
|
- }, 200);
|
|
|
- const productIdList = message.rows.map((x) => x.id);
|
|
|
- // 请求文件数据并回显
|
|
|
- if (productIdList.length > 0) {
|
|
|
- proxy
|
|
|
- .post("/fileInfo/getList", {
|
|
|
- businessIdList: productIdList,
|
|
|
- })
|
|
|
- .then((fileObj) => {
|
|
|
- for (let i = 0; i < sourceList.value.data.length; i++) {
|
|
|
- const e = sourceList.value.data[i];
|
|
|
- for (const key in fileObj) {
|
|
|
- if (e.id === key) {
|
|
|
- e.fileList = fileObj[key];
|
|
|
+ proxy
|
|
|
+ .post("/productInfo/getCustomerProductList", sourceList.value.pagination)
|
|
|
+ .then(
|
|
|
+ (message) => {
|
|
|
+ message.rows = message.rows.map((x) => ({
|
|
|
+ ...x,
|
|
|
+ fileList: [],
|
|
|
+ ...JSON.parse(x.ehsdJson),
|
|
|
+ }));
|
|
|
+ console.log(message.rows);
|
|
|
+ sourceList.value.data = message.rows;
|
|
|
+ sourceList.value.pagination.total = message.total;
|
|
|
+ setTimeout(() => {
|
|
|
+ loading.value = false;
|
|
|
+ }, 200);
|
|
|
+ const productIdList = message.rows.map((x) => x.id);
|
|
|
+ // 请求文件数据并回显
|
|
|
+ if (productIdList.length > 0) {
|
|
|
+ proxy
|
|
|
+ .post("/fileInfo/getList", {
|
|
|
+ businessIdList: productIdList,
|
|
|
+ })
|
|
|
+ .then((fileObj) => {
|
|
|
+ for (let i = 0; i < sourceList.value.data.length; i++) {
|
|
|
+ const e = sourceList.value.data[i];
|
|
|
+ for (const key in fileObj) {
|
|
|
+ if (e.id === key) {
|
|
|
+ e.fileList = fileObj[key];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ loading.value = false;
|
|
|
}
|
|
|
- },
|
|
|
- (err) => {
|
|
|
- loading.value = false;
|
|
|
- }
|
|
|
- );
|
|
|
+ );
|
|
|
};
|
|
|
|
|
|
const treeChange = (e) => {
|
|
@@ -549,16 +603,25 @@ const openExcel = () => {
|
|
|
};
|
|
|
|
|
|
const tree = ref(null);
|
|
|
-const needAtt = ["productClassifyId", "name", "spec", "remark", "fileList", "id", "unit", "definition"];
|
|
|
+const needAtt = [
|
|
|
+ "productClassifyId",
|
|
|
+ "name",
|
|
|
+ "spec",
|
|
|
+ "remark",
|
|
|
+ "fileList",
|
|
|
+ "id",
|
|
|
+ "unit",
|
|
|
+ "definition",
|
|
|
+];
|
|
|
let jsonObj = {};
|
|
|
const submitForm = () => {
|
|
|
byform.value.handleSubmit((valid) => {
|
|
|
- if (!fileListCopy.value.length > 0) {
|
|
|
- return ElMessage({
|
|
|
- message: "请上传产品图片",
|
|
|
- type: "info",
|
|
|
- });
|
|
|
- }
|
|
|
+ // if (!fileListCopy.value.length > 0) {
|
|
|
+ // return ElMessage({
|
|
|
+ // message: "请上传产品图片",
|
|
|
+ // type: "info",
|
|
|
+ // });
|
|
|
+ // }
|
|
|
formData.data.fileList = fileListCopy.value.map((x) => ({
|
|
|
id: x.id,
|
|
|
fileName: x.fileName,
|
|
@@ -590,8 +653,10 @@ const submitForm = () => {
|
|
|
for (const key in jsonObj) {
|
|
|
formData.data[key] = jsonObj[key];
|
|
|
}
|
|
|
- formData.data.innerPackMethod = formData.data.innerPackMethod.split(",");
|
|
|
- formData.data.outerPackMethod = formData.data.outerPackMethod.split(",");
|
|
|
+ formData.data.innerPackMethod =
|
|
|
+ formData.data.innerPackMethod.split(",");
|
|
|
+ formData.data.outerPackMethod =
|
|
|
+ formData.data.outerPackMethod.split(",");
|
|
|
submitLoading.value = false;
|
|
|
}
|
|
|
);
|
|
@@ -599,9 +664,11 @@ const submitForm = () => {
|
|
|
};
|
|
|
|
|
|
const getTreeList = () => {
|
|
|
- proxy.post("/productClassify/tree", { parentId: "", name: "", definition: "1" }).then((message) => {
|
|
|
- treeListData.value = message;
|
|
|
- });
|
|
|
+ proxy
|
|
|
+ .post("/productClassify/tree", { parentId: "", name: "", definition: "1" })
|
|
|
+ .then((message) => {
|
|
|
+ treeListData.value = message;
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
const getDtl = (row) => {
|
|
@@ -627,21 +694,23 @@ const getDtl = (row) => {
|
|
|
}
|
|
|
formData.data = res;
|
|
|
dialogVisible.value = true;
|
|
|
- proxy.post("/fileInfo/getList", { businessIdList: [row.id] }).then((fileObj) => {
|
|
|
- if (fileObj[row.id]) {
|
|
|
- fileList.value = fileObj[row.id].map((x) => ({
|
|
|
- ...x,
|
|
|
- url: x.fileUrl,
|
|
|
- }));
|
|
|
- fileListCopy.value = fileObj[row.id].map((x) => ({
|
|
|
- ...x,
|
|
|
- url: x.fileUrl,
|
|
|
- }));
|
|
|
- } else {
|
|
|
- fileList.value = [];
|
|
|
- fileListCopy.value = [];
|
|
|
- }
|
|
|
- });
|
|
|
+ proxy
|
|
|
+ .post("/fileInfo/getList", { businessIdList: [row.id] })
|
|
|
+ .then((fileObj) => {
|
|
|
+ if (fileObj[row.id]) {
|
|
|
+ fileList.value = fileObj[row.id].map((x) => ({
|
|
|
+ ...x,
|
|
|
+ url: x.fileUrl,
|
|
|
+ }));
|
|
|
+ fileListCopy.value = fileObj[row.id].map((x) => ({
|
|
|
+ ...x,
|
|
|
+ url: x.fileUrl,
|
|
|
+ }));
|
|
|
+ } else {
|
|
|
+ fileList.value = [];
|
|
|
+ fileListCopy.value = [];
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
};
|
|
|
const isdisabled = ["price", "costPrice", "remark", "netWeight"];
|
|
@@ -671,7 +740,9 @@ const handleBeforeUpload = async (file) => {
|
|
|
};
|
|
|
|
|
|
const handleRemove = (file) => {
|
|
|
- const index = fileListCopy.value.findIndex((x) => x.uid === file.uid || x.id === file.id);
|
|
|
+ const index = fileListCopy.value.findIndex(
|
|
|
+ (x) => x.uid === file.uid || x.id === file.id
|
|
|
+ );
|
|
|
fileListCopy.value.splice(index, 1);
|
|
|
};
|
|
|
|
|
@@ -710,24 +781,31 @@ const handleSuccess = (res) => {
|
|
|
}
|
|
|
};
|
|
|
const getDict = () => {
|
|
|
- proxy.getDictOne(["inner_packaging_method_ehsd", "outside_packaging_method_ehsd", "unit", "account_currency"]).then((res) => {
|
|
|
- innerMethon.value = res["inner_packaging_method_ehsd"].map((x) => ({
|
|
|
- label: x.dictValue,
|
|
|
- value: x.dictKey,
|
|
|
- }));
|
|
|
- outsideMethon.value = res["outside_packaging_method_ehsd"].map((x) => ({
|
|
|
- label: x.dictValue,
|
|
|
- value: x.dictKey,
|
|
|
- }));
|
|
|
- productUnit.value = res["unit"].map((x) => ({
|
|
|
- label: x.dictValue,
|
|
|
- value: x.dictKey,
|
|
|
- }));
|
|
|
- accountCurrency.value = res["account_currency"].map((x) => ({
|
|
|
- label: x.dictKey,
|
|
|
- value: x.dictValue,
|
|
|
- }));
|
|
|
- });
|
|
|
+ proxy
|
|
|
+ .getDictOne([
|
|
|
+ "inner_packaging_method_ehsd",
|
|
|
+ "outside_packaging_method_ehsd",
|
|
|
+ "unit",
|
|
|
+ "account_currency",
|
|
|
+ ])
|
|
|
+ .then((res) => {
|
|
|
+ innerMethon.value = res["inner_packaging_method_ehsd"].map((x) => ({
|
|
|
+ label: x.dictValue,
|
|
|
+ value: x.dictKey,
|
|
|
+ }));
|
|
|
+ outsideMethon.value = res["outside_packaging_method_ehsd"].map((x) => ({
|
|
|
+ label: x.dictValue,
|
|
|
+ value: x.dictKey,
|
|
|
+ }));
|
|
|
+ productUnit.value = res["unit"].map((x) => ({
|
|
|
+ label: x.dictValue,
|
|
|
+ value: x.dictKey,
|
|
|
+ }));
|
|
|
+ accountCurrency.value = res["account_currency"].map((x) => ({
|
|
|
+ label: x.dictKey,
|
|
|
+ value: x.dictValue,
|
|
|
+ }));
|
|
|
+ });
|
|
|
proxy.post("/customer/page", { pageNum: 1, pageSize: 9999 }).then(
|
|
|
(res) => {
|
|
|
customerData.value = res.rows.map((x) => ({
|