|
@@ -7,7 +7,8 @@
|
|
|
:data="treeListData"
|
|
|
v-model="sourceList.pagination.productClassifyId"
|
|
|
@change="treeChange"
|
|
|
- @changeTreeList="getTreeList">
|
|
|
+ @changeTreeList="getTreeList"
|
|
|
+ >
|
|
|
</treeList>
|
|
|
</div>
|
|
|
<div class="content">
|
|
@@ -38,18 +39,35 @@
|
|
|
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>
|
|
|
</byTable>
|
|
|
</div>
|
|
|
- <el-dialog :title="modalType == 'add' ? '添加' : '编辑'" v-model="dialogVisible" width="500" v-loading="loading" destroy-on-close>
|
|
|
+ <el-dialog
|
|
|
+ :title="modalType == 'add' ? '添加' : '编辑'"
|
|
|
+ v-model="dialogVisible"
|
|
|
+ width="500"
|
|
|
+ v-loading="loading"
|
|
|
+ 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
|
|
@@ -59,7 +77,8 @@
|
|
|
list-type="picture-card"
|
|
|
:on-remove="handleRemove"
|
|
|
:on-success="handleSuccess"
|
|
|
- :before-upload="handleBeforeUpload">
|
|
|
+ :before-upload="handleBeforeUpload"
|
|
|
+ >
|
|
|
<el-icon><Plus /></el-icon>
|
|
|
</el-upload>
|
|
|
</div>
|
|
@@ -69,13 +88,34 @@
|
|
|
|
|
|
<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="Excel导入" v-model="openExcelDialog" width="400" v-loading="loading">
|
|
|
+ <el-dialog
|
|
|
+ title="Excel导入"
|
|
|
+ v-model="openExcelDialog"
|
|
|
+ width="400"
|
|
|
+ v-loading="loading"
|
|
|
+ >
|
|
|
<template #footer>
|
|
|
- <el-button @click="openExcelDialog = false" size="large">取 消</el-button>
|
|
|
- <el-button type="primary" @click="submitExcel()" size="large" :loading="submitLoading"> 确 定 </el-button>
|
|
|
+ <el-button @click="openExcelDialog = false" size="large"
|
|
|
+ >取 消</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="submitExcel()"
|
|
|
+ size="large"
|
|
|
+ :loading="submitLoading"
|
|
|
+ >
|
|
|
+ 确 定
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
@@ -110,7 +150,9 @@ const materialUnit = ref([]);
|
|
|
const materialType = ref([]);
|
|
|
const treeData = ref([]);
|
|
|
let rules = ref({
|
|
|
- productClassifyId: [{ required: true, message: "请选择物料分类", trigger: "change" }],
|
|
|
+ productClassifyId: [
|
|
|
+ { required: true, message: "请选择物料分类", trigger: "change" },
|
|
|
+ ],
|
|
|
type: [{ required: true, message: "请选择物料类型", trigger: "change" }],
|
|
|
name: [{ required: true, message: "请输入物料名称", trigger: "blur" }],
|
|
|
unit: [{ required: true, message: "请选择单位", trigger: "change" }],
|
|
@@ -145,15 +187,21 @@ const config = computed(() => {
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
+ label: "图片",
|
|
|
+ prop: "unit",
|
|
|
+ slot: "pic",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
label: "物料名称",
|
|
|
prop: "name",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
- label: "图片",
|
|
|
- prop: "unit",
|
|
|
- slot: "pic",
|
|
|
+ label: "规格型号",
|
|
|
+ prop: "spec",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -167,12 +215,6 @@ const config = computed(() => {
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
- label: "规格型号",
|
|
|
- prop: "spec",
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- attrs: {
|
|
|
label: "物料备注",
|
|
|
prop: "remark",
|
|
|
},
|
|
@@ -180,12 +222,26 @@ const config = computed(() => {
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "操作",
|
|
|
- width: "200",
|
|
|
- align: "right",
|
|
|
+ width: "160",
|
|
|
+ align: "center",
|
|
|
+ fixed: "right",
|
|
|
},
|
|
|
renderHTML(row) {
|
|
|
return [
|
|
|
props.selectStatus
|
|
|
+ ? {}
|
|
|
+ : {
|
|
|
+ attrs: {
|
|
|
+ label: "复制",
|
|
|
+ type: "primary",
|
|
|
+ text: true,
|
|
|
+ },
|
|
|
+ el: "button",
|
|
|
+ click() {
|
|
|
+ getDtlOne(row);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ props.selectStatus
|
|
|
? {
|
|
|
attrs: {
|
|
|
label: "选择",
|
|
@@ -218,11 +274,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", {
|
|
|
id: row.id,
|
|
@@ -322,29 +382,33 @@ const generatePassword = () => {
|
|
|
const getList = async (req) => {
|
|
|
sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
loading.value = true;
|
|
|
- proxy.post("/productInfo/page", sourceList.value.pagination).then((message) => {
|
|
|
- console.log(message);
|
|
|
- sourceList.value.data = message.rows.map((x) => ({ ...x, fileList: [] }));
|
|
|
- sourceList.value.pagination.total = message.total;
|
|
|
- setTimeout(() => {
|
|
|
- loading.value = false;
|
|
|
- }, 200);
|
|
|
+ proxy
|
|
|
+ .post("/productInfo/page", sourceList.value.pagination)
|
|
|
+ .then((message) => {
|
|
|
+ console.log(message);
|
|
|
+ sourceList.value.data = message.rows.map((x) => ({ ...x, fileList: [] }));
|
|
|
+ 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];
|
|
|
+ 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];
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
};
|
|
|
const uploadData = ref({});
|
|
|
const fileList = ref([]);
|
|
@@ -410,10 +474,12 @@ const submitForm = () => {
|
|
|
};
|
|
|
|
|
|
const getTreeList = () => {
|
|
|
- proxy.post("/productClassify/tree", { parentId: "", name: "", definition: "2" }).then((message) => {
|
|
|
- treeListData.value = message;
|
|
|
- treeData.value = message;
|
|
|
- });
|
|
|
+ proxy
|
|
|
+ .post("/productClassify/tree", { parentId: "", name: "", definition: "2" })
|
|
|
+ .then((message) => {
|
|
|
+ treeListData.value = message;
|
|
|
+ treeData.value = message;
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
const getDtl = (row) => {
|
|
@@ -427,6 +493,20 @@ const getDtl = (row) => {
|
|
|
dialogVisible.value = true;
|
|
|
});
|
|
|
};
|
|
|
+
|
|
|
+const getDtlOne = (row) => {
|
|
|
+ modalType.value = "add";
|
|
|
+ proxy.post("/productInfo/detail", { id: row.id }).then((res) => {
|
|
|
+ fileList.value = [];
|
|
|
+ fileListCopy.value = [];
|
|
|
+ res.type = res.type + "";
|
|
|
+ res.definition = "2";
|
|
|
+ delete res.id;
|
|
|
+ formData.data = res;
|
|
|
+ dialogVisible.value = true;
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
getTreeList();
|
|
|
getList();
|
|
|
const handleBeforeUpload = async (file) => {
|
|
@@ -449,7 +529,9 @@ const handleSuccess = (res, file, files) => {
|
|
|
};
|
|
|
|
|
|
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);
|
|
|
};
|
|
|
|