|
@@ -7,8 +7,7 @@
|
|
|
:data="treeListData"
|
|
|
v-model="sourceList.pagination.productClassifyId"
|
|
|
@change="treeChange"
|
|
|
- @changeTreeList="getTreeList"
|
|
|
- >
|
|
|
+ @changeTreeList="getTreeList">
|
|
|
</treeList>
|
|
|
</div>
|
|
|
<div class="content">
|
|
@@ -35,42 +34,25 @@
|
|
|
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>
|
|
|
</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
|
|
@@ -80,8 +62,7 @@
|
|
|
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>
|
|
@@ -90,22 +71,11 @@
|
|
|
</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"
|
|
@@ -113,29 +83,32 @@
|
|
|
: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>
|
|
|
</template>
|
|
|
-
|
|
|
+
|
|
|
<script setup>
|
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
import byTable from "@/components/byTable/index";
|
|
|
import byForm from "@/components/byForm/index";
|
|
|
import treeList from "@/components/product/treeList";
|
|
|
import { getToken } from "@/utils/auth";
|
|
|
+
|
|
|
const headers = ref({ Authorization: "Bearer " + getToken() });
|
|
|
const actionUrl = import.meta.env.VITE_APP_BASE_API;
|
|
|
const loading = ref(false);
|
|
|
const submitLoading = ref(false);
|
|
|
+const treeListData = ref([]);
|
|
|
+const innerMethon = ref([]);
|
|
|
+const outsideMethon = ref([]);
|
|
|
+const productUnit = ref([]);
|
|
|
+const accountCurrency = ref([]);
|
|
|
const sourceList = ref({
|
|
|
data: [],
|
|
|
pagination: {
|
|
@@ -153,26 +126,14 @@ let openExcelDialog = ref(false);
|
|
|
let excelLoading = ref(false);
|
|
|
let modalType = ref("add");
|
|
|
let rules = ref({
|
|
|
- productClassifyId: [
|
|
|
- { 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 selectConfig = reactive([
|
|
@@ -235,7 +196,7 @@ const config = computed(() => {
|
|
|
prop: "costPrice",
|
|
|
},
|
|
|
render(costPrice) {
|
|
|
- return "¥" + proxy.moneyFormat(costPrice, 2);
|
|
|
+ return "¥" + proxy.moneyFormat(costPrice, 2);
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -267,15 +228,11 @@ const config = computed(() => {
|
|
|
el: "button",
|
|
|
click() {
|
|
|
// 弹窗提示是否删除
|
|
|
- ElMessageBox.confirm(
|
|
|
- "此操作将永久删除该数据, 是否继续?",
|
|
|
- "提示",
|
|
|
- {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning",
|
|
|
- }
|
|
|
- ).then(() => {
|
|
|
+ ElMessageBox.confirm("此操作将永久删除该数据, 是否继续?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
// 删除
|
|
|
proxy
|
|
|
.post("/productInfo/delete", {
|
|
@@ -311,10 +268,6 @@ const formOption = reactive({
|
|
|
rules: [],
|
|
|
});
|
|
|
const byform = ref(null);
|
|
|
-const treeListData = ref([]);
|
|
|
-const innerMethon = ref([]);
|
|
|
-const outsideMethon = ref([]);
|
|
|
-const productUnit = ref([]);
|
|
|
const formConfig = computed(() => {
|
|
|
return [
|
|
|
{
|
|
@@ -377,7 +330,7 @@ const formConfig = computed(() => {
|
|
|
style: {
|
|
|
width: "100%",
|
|
|
},
|
|
|
- disabled: false,
|
|
|
+ data: accountCurrency.value,
|
|
|
},
|
|
|
{
|
|
|
type: "selectInput",
|
|
@@ -388,6 +341,7 @@ const formConfig = computed(() => {
|
|
|
style: {
|
|
|
width: "100%",
|
|
|
},
|
|
|
+ data: accountCurrency.value,
|
|
|
},
|
|
|
{
|
|
|
type: "title",
|
|
@@ -484,42 +438,40 @@ const formConfig = computed(() => {
|
|
|
const getList = async (req) => {
|
|
|
sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
loading.value = true;
|
|
|
- proxy
|
|
|
- .post("/productInfo/getConditionProductList", sourceList.value.pagination)
|
|
|
- .then(
|
|
|
- (message) => {
|
|
|
- sourceList.value.data = message.rows.map((x) => ({
|
|
|
- ...x,
|
|
|
- fileList: [],
|
|
|
- ...JSON.parse(x.ehsdJson),
|
|
|
- }));
|
|
|
- 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/getConditionProductList", sourceList.value.pagination).then(
|
|
|
+ (message) => {
|
|
|
+ sourceList.value.data = message.rows.map((x) => ({
|
|
|
+ ...x,
|
|
|
+ fileList: [],
|
|
|
+ ...JSON.parse(x.ehsdJson),
|
|
|
+ }));
|
|
|
+ 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) => {
|
|
@@ -537,7 +489,7 @@ const openModal = () => {
|
|
|
fileList: [],
|
|
|
fileListCopy: [],
|
|
|
currency: "$",
|
|
|
- currencyOne: "¥",
|
|
|
+ currencyOne: "¥",
|
|
|
};
|
|
|
};
|
|
|
|
|
@@ -545,17 +497,7 @@ const openExcel = () => {
|
|
|
openExcelDialog.value = true;
|
|
|
};
|
|
|
|
|
|
-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) => {
|
|
@@ -595,24 +537,18 @@ 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;
|
|
|
}
|
|
|
);
|
|
|
});
|
|
|
};
|
|
|
-
|
|
|
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) => {
|
|
|
modalType.value = "edit";
|
|
|
proxy.post("/productInfo/detailByEhsd", { id: row.id }).then((res) => {
|
|
@@ -620,7 +556,7 @@ const getDtl = (row) => {
|
|
|
res = {
|
|
|
...res,
|
|
|
currency: "$",
|
|
|
- currencyOne: "¥",
|
|
|
+ currencyOne: "¥",
|
|
|
...JSON.parse(res.ehsdJson),
|
|
|
};
|
|
|
if (res.innerPackMethod) {
|
|
@@ -635,26 +571,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"];
|
|
|
watch(modalType, (val) => {
|
|
|
if (val) {
|
|
@@ -668,7 +601,6 @@ watch(modalType, (val) => {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
const handleBeforeUpload = async (file) => {
|
|
|
const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
|
|
|
uploadData.value = res.uploadBody;
|
|
@@ -680,22 +612,16 @@ const handleBeforeUpload = async (file) => {
|
|
|
uid: file.uid,
|
|
|
});
|
|
|
};
|
|
|
-
|
|
|
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);
|
|
|
};
|
|
|
-
|
|
|
const handleClickFile = (file) => {
|
|
|
window.open(file.fileUrl, "_blank");
|
|
|
};
|
|
|
-
|
|
|
const handleProgress = () => {
|
|
|
excelLoading.value = true;
|
|
|
};
|
|
|
-
|
|
|
const handleError = (err) => {
|
|
|
console.log(res);
|
|
|
ElMessage({
|
|
@@ -705,7 +631,6 @@ const handleError = (err) => {
|
|
|
openExcelDialog.value = false;
|
|
|
excelLoading.value = false;
|
|
|
};
|
|
|
-
|
|
|
const handleSuccess = (res) => {
|
|
|
if (res.code != 200) {
|
|
|
return ElMessage({
|
|
@@ -723,32 +648,30 @@ const handleSuccess = (res) => {
|
|
|
}
|
|
|
};
|
|
|
const getDict = () => {
|
|
|
- proxy
|
|
|
- .getDictOne([
|
|
|
- "inner_packaging_method_ehsd",
|
|
|
- "outside_packaging_method_ehsd",
|
|
|
- "unit",
|
|
|
- ])
|
|
|
- .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,
|
|
|
- }));
|
|
|
- });
|
|
|
+ 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,
|
|
|
+ }));
|
|
|
+ });
|
|
|
};
|
|
|
getDict();
|
|
|
getTreeList();
|
|
|
getList();
|
|
|
</script>
|
|
|
-
|
|
|
+
|
|
|
<style lang="scss" scoped>
|
|
|
.user {
|
|
|
padding: 20px;
|
|
@@ -768,4 +691,4 @@ getList();
|
|
|
cursor: pointer;
|
|
|
vertical-align: middle;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|