|
@@ -47,13 +47,21 @@
|
|
|
</div>
|
|
|
<div v-else></div>
|
|
|
</template>
|
|
|
+ <template #size="{ item }">
|
|
|
+ <div>
|
|
|
+ <span>{{ item.productLong }}</span
|
|
|
+ >* <span>{{ item.packagWide }}</span
|
|
|
+ >*
|
|
|
+ <span>{{ item.packagHigh }}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</byTable>
|
|
|
</div>
|
|
|
<el-dialog
|
|
|
:title="modalType == 'add' ? '添加产品' : '编辑产品'"
|
|
|
v-model="dialogVisible"
|
|
|
- width="90%"
|
|
|
- v-loading="loading"
|
|
|
+ width="60%"
|
|
|
+ v-loading="submitLoading"
|
|
|
destroy-on-close
|
|
|
>
|
|
|
<div class="public_height_dialog">
|
|
@@ -67,13 +75,29 @@
|
|
|
<template #productPic>
|
|
|
<div>
|
|
|
<el-upload
|
|
|
- v-model:fileList="fileList"
|
|
|
+ v-model:formData.data.imgList="formData.data.imgList"
|
|
|
+ action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
|
|
|
+ :data="uploadData"
|
|
|
+ list-type="picture-card"
|
|
|
+ :on-remove="(file) => handleRemove(file, 'imgList')"
|
|
|
+ :before-upload="(file) => handleBeforeUpload(file, 'imgList')"
|
|
|
+ accept=".gif, .jpeg, .jpg, .png"
|
|
|
+ >
|
|
|
+ <el-icon><Plus /></el-icon>
|
|
|
+ </el-upload>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #productPicOne>
|
|
|
+ <div>
|
|
|
+ <el-upload
|
|
|
+ v-model:formData.data.minorImgList="formData.data.minorImgList"
|
|
|
action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
|
|
|
:data="uploadData"
|
|
|
list-type="picture-card"
|
|
|
- :on-remove="handleRemove"
|
|
|
- :on-success="handleSuccess"
|
|
|
- :before-upload="handleBeforeUpload"
|
|
|
+ :on-remove="(file) => handleRemove(file, 'minorImgList')"
|
|
|
+ :before-upload="
|
|
|
+ (file) => handleBeforeUpload(file, 'minorImgList')
|
|
|
+ "
|
|
|
accept=".gif, .jpeg, .jpg, .png"
|
|
|
>
|
|
|
<el-icon><Plus /></el-icon>
|
|
@@ -81,10 +105,39 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
+ <template #productPicTwo>
|
|
|
+ <div>
|
|
|
+ <el-upload
|
|
|
+ v-model:formData.data.fileList="formData.data.fileList"
|
|
|
+ :show-file-list="false"
|
|
|
+ class="upload-demo"
|
|
|
+ action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
|
|
|
+ :data="uploadData"
|
|
|
+ :before-upload="(file) => handleBeforeUpload(file, 'fileList')"
|
|
|
+ >
|
|
|
+ <el-button type="primary">选择</el-button>
|
|
|
+ </el-upload>
|
|
|
+ <div>
|
|
|
+ <div style="margin-top: 15px">
|
|
|
+ <el-tag
|
|
|
+ style="margin-right: 10px"
|
|
|
+ class="ml-2"
|
|
|
+ type="info"
|
|
|
+ v-for="(item, index) in formData.data.fileListCopy"
|
|
|
+ :key="index"
|
|
|
+ closable
|
|
|
+ @close="handleClose(index)"
|
|
|
+ >{{ item.fileName }}</el-tag
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
<template #detailDec>
|
|
|
<div style="width: 100%">
|
|
|
<Editor
|
|
|
- :value="formData.data.content"
|
|
|
+ :value="formData.data.remark"
|
|
|
@updateValue="updateContent"
|
|
|
/>
|
|
|
</div>
|
|
@@ -128,15 +181,11 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-/* eslint-disable vue/no-unused-components */
|
|
|
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 useUserStore from "@/store/modules/user";
|
|
|
-import { computed, defineComponent, ref } from "vue";
|
|
|
import Editor from "@/components/Editor/index.vue";
|
|
|
-
|
|
|
const loading = ref(false);
|
|
|
const submitLoading = ref(false);
|
|
|
const sourceList = ref({
|
|
@@ -153,39 +202,62 @@ const sourceList = ref({
|
|
|
});
|
|
|
let dialogVisible = ref(false);
|
|
|
let openExcelDialog = ref(false);
|
|
|
-
|
|
|
let modalType = ref("add");
|
|
|
let rules = ref({
|
|
|
productClassifyId: [
|
|
|
- { required: true, message: "请选择产品分类", trigger: "change" },
|
|
|
+ { required: true, message: "请选择类目", trigger: "change" },
|
|
|
+ ],
|
|
|
+ name: [{ required: true, message: "请输入名称(中文)", trigger: "blur" }],
|
|
|
+ nameEnglish: [
|
|
|
+ { required: true, message: "请输入名称(英文)", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ 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" },
|
|
|
+ ],
|
|
|
+ netWeight: [{ required: true, message: "请输入净重(kg)", trigger: "blur" }],
|
|
|
+ salesUnit: [
|
|
|
+ { required: true, message: "请输入采购/销售单位", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ issueReceiptUnit: [
|
|
|
+ { required: true, message: "请输入出入库单位", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ conversionScale: [
|
|
|
+ { required: true, message: "请输入换算比列", trigger: "blur" },
|
|
|
],
|
|
|
- type: [{ required: true, message: "请选择产品类型", trigger: "change" }],
|
|
|
- name: [{ required: true, message: "请输入产品名称", trigger: "blur" }],
|
|
|
- unit: [{ required: true, message: "请选择单位", trigger: "change" }],
|
|
|
});
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
const selectConfig = reactive([
|
|
|
- {
|
|
|
- label: "产品类型",
|
|
|
- prop: "type",
|
|
|
- data: [],
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // label: "产品类型",
|
|
|
+ // prop: "type",
|
|
|
+ // data: [],
|
|
|
+ // },
|
|
|
]);
|
|
|
const config = computed(() => {
|
|
|
return [
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "图片",
|
|
|
- prop: "type",
|
|
|
- },
|
|
|
- render(type) {
|
|
|
- return proxy.dictDataEcho(type, productType.value);
|
|
|
+ slot: "pic",
|
|
|
+ width: 80,
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "编号",
|
|
|
- prop: "code",
|
|
|
+ prop: "customCode",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -197,34 +269,34 @@ const config = computed(() => {
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "尺寸",
|
|
|
- prop: "unit",
|
|
|
+ slot: "size",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "成本价(¥)",
|
|
|
- prop: "unit",
|
|
|
+ prop: "costPrice",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
- label: "销售指导价(¥)",
|
|
|
- prop: "spec",
|
|
|
+ label: "销售指导价($)",
|
|
|
+ prop: "price",
|
|
|
+ width: 150,
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "型号",
|
|
|
- prop: "remark",
|
|
|
+ prop: "spec",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "创建人",
|
|
|
- prop: "remark",
|
|
|
+ prop: "createUserName",
|
|
|
},
|
|
|
},
|
|
|
-
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "操作",
|
|
@@ -287,7 +359,8 @@ const config = computed(() => {
|
|
|
const uploadData = ref({});
|
|
|
const fileList = ref([]);
|
|
|
const fileListCopy = ref([]);
|
|
|
-
|
|
|
+const fileListOne = ref([]);
|
|
|
+const fileListCopyOne = ref([]);
|
|
|
let formData = reactive({
|
|
|
data: {},
|
|
|
});
|
|
@@ -299,6 +372,8 @@ const formOption = reactive({
|
|
|
});
|
|
|
const byform = ref(null);
|
|
|
const treeListData = ref([]);
|
|
|
+const innerMethon = ref([]);
|
|
|
+const outsideMethon = ref([]);
|
|
|
const formConfig = computed(() => {
|
|
|
return [
|
|
|
{
|
|
@@ -309,7 +384,7 @@ const formConfig = computed(() => {
|
|
|
type: "treeSelect",
|
|
|
prop: "productClassifyId",
|
|
|
label: "类目",
|
|
|
- data: [],
|
|
|
+ data: treeListData.value,
|
|
|
itemWidth: 50,
|
|
|
style: {
|
|
|
width: "100%",
|
|
@@ -317,7 +392,7 @@ const formConfig = computed(() => {
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "customCode",
|
|
|
label: "编码",
|
|
|
itemWidth: 50,
|
|
|
},
|
|
@@ -326,12 +401,14 @@ const formConfig = computed(() => {
|
|
|
prop: "name",
|
|
|
label: "名称(中文)",
|
|
|
itemWidth: 100,
|
|
|
+ placeholder: "请输入名称(中文)",
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "nameEnglish",
|
|
|
label: "名称(英文)",
|
|
|
itemWidth: 100,
|
|
|
+ placeholder: "请输入名称(英文)",
|
|
|
},
|
|
|
{
|
|
|
type: "title",
|
|
@@ -339,24 +416,27 @@ const formConfig = computed(() => {
|
|
|
},
|
|
|
{
|
|
|
type: "number",
|
|
|
- prop: "returnPeriod",
|
|
|
- label: "销售指导价(¥)",
|
|
|
+ prop: "price",
|
|
|
+ label: "销售指导价($)",
|
|
|
itemWidth: 50,
|
|
|
controls: false,
|
|
|
precision: 2,
|
|
|
min: 0,
|
|
|
+ placeholder: "请输入销售指导价($)",
|
|
|
style: {
|
|
|
width: "100%",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
type: "number",
|
|
|
- prop: "returnPeriod",
|
|
|
+ prop: "costPrice",
|
|
|
label: "成本价(¥)",
|
|
|
itemWidth: 50,
|
|
|
controls: false,
|
|
|
precision: 2,
|
|
|
min: 0,
|
|
|
+ placeholder: "请输入成本价(¥)",
|
|
|
+
|
|
|
style: {
|
|
|
width: "100%",
|
|
|
},
|
|
@@ -367,127 +447,150 @@ const formConfig = computed(() => {
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "materialChinese",
|
|
|
label: "材质(中文)",
|
|
|
itemWidth: 50,
|
|
|
+ placeholder: "请输入材质(中文)",
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "material",
|
|
|
label: "材质(英文)",
|
|
|
itemWidth: 50,
|
|
|
+ placeholder: "请输入材质(英文)",
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "spec",
|
|
|
label: "型号(中文)",
|
|
|
itemWidth: 50,
|
|
|
+ placeholder: "请输入型号(中文)",
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "productModelEn",
|
|
|
label: "型号(英文)",
|
|
|
itemWidth: 50,
|
|
|
+ placeholder: "请输入型号(英文)",
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "productLong",
|
|
|
label: "样品尺寸",
|
|
|
itemWidth: 33.33,
|
|
|
+ placeholder: "请输入长(cm)",
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "productWide",
|
|
|
label: " ",
|
|
|
itemWidth: 33.33,
|
|
|
+ placeholder: "请输入宽(cm)",
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "productHigh",
|
|
|
label: " ",
|
|
|
itemWidth: 33.33,
|
|
|
+ placeholder: "请输入高(cm)",
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "packagLong",
|
|
|
label: "装箱尺寸",
|
|
|
itemWidth: 33.33,
|
|
|
+ placeholder: "请输入长(cm)",
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "packagWide",
|
|
|
label: " ",
|
|
|
itemWidth: 33.33,
|
|
|
+ placeholder: "请输入宽(cm)",
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "packagHigh",
|
|
|
label: " ",
|
|
|
itemWidth: 33.33,
|
|
|
+ placeholder: "请输入高(cm)",
|
|
|
},
|
|
|
{
|
|
|
type: "select",
|
|
|
- prop: "type",
|
|
|
+ prop: "innerPackMethod",
|
|
|
label: "内包装方式",
|
|
|
required: true,
|
|
|
itemWidth: 50,
|
|
|
- data: [],
|
|
|
+ multiple: true,
|
|
|
+ data: innerMethon.value,
|
|
|
+ placeholder: "请选择内包装方式",
|
|
|
+
|
|
|
style: {
|
|
|
width: "100%",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
type: "select",
|
|
|
- prop: "type",
|
|
|
+ prop: "outerPackMethod",
|
|
|
label: "外包装方式",
|
|
|
required: true,
|
|
|
itemWidth: 50,
|
|
|
- data: [],
|
|
|
+ multiple: true,
|
|
|
+ data: outsideMethon.value,
|
|
|
+ placeholder: "请选择外包装方式",
|
|
|
+
|
|
|
style: {
|
|
|
width: "100%",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "netWeight",
|
|
|
label: "净重(kg)",
|
|
|
itemWidth: 50,
|
|
|
+ placeholder: "请输入净重(kg)",
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "grossWeight",
|
|
|
label: "毛重(kg)",
|
|
|
itemWidth: 50,
|
|
|
+ placeholder: "请输入毛重(kg)",
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "customsCode",
|
|
|
label: "海关编码",
|
|
|
itemWidth: 50,
|
|
|
+ placeholder: "请输入海关编码",
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "moq",
|
|
|
label: "MOQ",
|
|
|
itemWidth: 50,
|
|
|
+ placeholder: "请输入MOQ",
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "salesUnit",
|
|
|
label: "采购/销售单位",
|
|
|
itemWidth: 50,
|
|
|
+ placeholder: "请输入采购/销售单位",
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "issueReceiptUnit",
|
|
|
label: "出入库单位",
|
|
|
itemWidth: 50,
|
|
|
+ placeholder: "请输入出入库单位",
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "conversionScale",
|
|
|
label: "换算比例",
|
|
|
itemWidth: 50,
|
|
|
+ placeholder: "换算比例 = 1 采购单位/1出入库单位",
|
|
|
},
|
|
|
{
|
|
|
type: "title",
|
|
@@ -495,43 +598,46 @@ const formConfig = computed(() => {
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "safetyStock",
|
|
|
label: "安全库存",
|
|
|
itemWidth: 50,
|
|
|
+ placeholder: "请输入安全库存",
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "procurementCycle",
|
|
|
label: "采购周期",
|
|
|
itemWidth: 50,
|
|
|
+ placeholder: "请输入采购周期",
|
|
|
},
|
|
|
{
|
|
|
type: "radio",
|
|
|
- prop: "type",
|
|
|
+ prop: "firstInFirstOut",
|
|
|
label: "先入先出",
|
|
|
required: true,
|
|
|
border: true,
|
|
|
- itemWidth: 50,
|
|
|
+ itemWidth: 70,
|
|
|
data: [
|
|
|
{
|
|
|
label: "不启用",
|
|
|
- value: "1",
|
|
|
+ value: "0",
|
|
|
},
|
|
|
{
|
|
|
label: "一物一码",
|
|
|
- value: "2",
|
|
|
+ value: "1",
|
|
|
},
|
|
|
{
|
|
|
label: "一物一码 & 先入先出",
|
|
|
- value: "3",
|
|
|
+ value: "2",
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "qualityQualifiedRate",
|
|
|
label: "质检合格率",
|
|
|
- itemWidth: 50,
|
|
|
+ itemWidth: 30,
|
|
|
+ placeholder: "请输入质检合格率",
|
|
|
},
|
|
|
{
|
|
|
type: "title",
|
|
@@ -540,43 +646,45 @@ const formConfig = computed(() => {
|
|
|
{
|
|
|
type: "slot",
|
|
|
slotName: "productPic",
|
|
|
+ prop: "imgList",
|
|
|
+ label: "产品主图",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "productPicOne",
|
|
|
+ prop: "minorImgList",
|
|
|
+ label: "产品副图",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "productPicTwo",
|
|
|
prop: "fileList",
|
|
|
- label: "产品图片",
|
|
|
+ label: "制作图纸",
|
|
|
},
|
|
|
{
|
|
|
type: "slot",
|
|
|
slotName: "detailDec",
|
|
|
- prop: "fileList",
|
|
|
+ prop: "remark",
|
|
|
label: "详情描述",
|
|
|
},
|
|
|
];
|
|
|
});
|
|
|
-const newPassword = () => {
|
|
|
- formData.data.password = generatePassword();
|
|
|
-};
|
|
|
-const generatePassword = () => {
|
|
|
- var length = 12,
|
|
|
- charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
|
|
|
- password = "";
|
|
|
- for (var i = 0, n = charset.length; i < length; ++i) {
|
|
|
- password += charset.charAt(Math.floor(Math.random() * n));
|
|
|
- }
|
|
|
- return password;
|
|
|
-};
|
|
|
|
|
|
const getList = async (req) => {
|
|
|
sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
loading.value = true;
|
|
|
proxy
|
|
|
- .post("/productInfo/page", sourceList.value.pagination)
|
|
|
+ .post("/productInfo/getConditionProductList", sourceList.value.pagination)
|
|
|
.then((message) => {
|
|
|
- console.log(message);
|
|
|
- sourceList.value.data = message.rows.map((x) => ({ ...x, fileList: [] }));
|
|
|
+ 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) {
|
|
@@ -597,7 +705,6 @@ const getList = async (req) => {
|
|
|
};
|
|
|
|
|
|
const treeChange = (e) => {
|
|
|
- console.log(e);
|
|
|
sourceList.value.pagination.productClassifyId = e.id;
|
|
|
getList({ productClassifyId: e.id });
|
|
|
};
|
|
@@ -607,14 +714,20 @@ const openModal = () => {
|
|
|
modalType.value = "add";
|
|
|
formData.data = {
|
|
|
definition: "1",
|
|
|
- content:"",
|
|
|
- // type: "1",
|
|
|
+ outerPackMethod: [],
|
|
|
+ innerPackMethod: [],
|
|
|
+ remark: "",
|
|
|
+ imgList: [],
|
|
|
+ imgListCopy: [],
|
|
|
+ minorImgList: [],
|
|
|
+ minorImgListCopy: [],
|
|
|
fileList: [],
|
|
|
- standardJson: {},
|
|
|
+ fileListCopy: [],
|
|
|
};
|
|
|
-
|
|
|
- fileList.value = [];
|
|
|
- fileListCopy.value = [];
|
|
|
+ // fileList.value = [];
|
|
|
+ // fileListCopy.value = [];
|
|
|
+ // fileListOne.value = [];
|
|
|
+ // fileListCopyOne.value = [];
|
|
|
};
|
|
|
|
|
|
const openExcel = () => {
|
|
@@ -623,25 +736,56 @@ const openExcel = () => {
|
|
|
const submitExcel = () => {
|
|
|
openExcelDialog.value = false;
|
|
|
};
|
|
|
-const TreetenantId = ref("");
|
|
|
-const selection = ref({
|
|
|
- data: [],
|
|
|
-});
|
|
|
-const select = (_selection, row) => {
|
|
|
- selection.value.data = _selection;
|
|
|
- console.log(_selection.length);
|
|
|
-};
|
|
|
|
|
|
const tree = ref(null);
|
|
|
+const needAtt = [
|
|
|
+ "productClassifyId",
|
|
|
+ "customCode",
|
|
|
+ "name",
|
|
|
+ "spec",
|
|
|
+ "remark",
|
|
|
+ "fileList",
|
|
|
+ "imgList",
|
|
|
+ "minorImgList",
|
|
|
+ "fileListCopy",
|
|
|
+ "imgListCopy",
|
|
|
+ "minorImgListCopy",
|
|
|
+ "id",
|
|
|
+];
|
|
|
const submitForm = () => {
|
|
|
- console.log(byform.value);
|
|
|
byform.value.handleSubmit((valid) => {
|
|
|
- formData.data.fileList = fileListCopy.value.map((x) => ({
|
|
|
+ if (!formData.data.imgListCopy.length > 0) {
|
|
|
+ return ElMessage({
|
|
|
+ message: "请上传产品主图",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ formData.data.imgList = formData.data.imgListCopy.map((x) => ({
|
|
|
+ id: x.id,
|
|
|
+ fileName: x.fileName,
|
|
|
+ }));
|
|
|
+ formData.data.minorImgList = formData.data.minorImgListCopy.map((x) => ({
|
|
|
+ id: x.id,
|
|
|
+ fileName: x.fileName,
|
|
|
+ }));
|
|
|
+ formData.data.fileList = formData.data.fileListCopy.map((x) => ({
|
|
|
id: x.id,
|
|
|
fileName: x.fileName,
|
|
|
}));
|
|
|
+ let jsonObj = {};
|
|
|
+ for (const key in formData.data) {
|
|
|
+ if (needAtt.includes(key)) {
|
|
|
+ } else {
|
|
|
+ jsonObj[key] = formData.data[key];
|
|
|
+ delete formData.data[key];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ jsonObj.innerPackMethod = jsonObj.innerPackMethod.join(",");
|
|
|
+ jsonObj.outerPackMethod = jsonObj.outerPackMethod.join(",");
|
|
|
+ jsonObj.type = "1"; //1为公司产品库
|
|
|
+ formData.data.ehsdJson = JSON.stringify(jsonObj);
|
|
|
submitLoading.value = true;
|
|
|
- proxy.post("/productInfo/" + modalType.value, formData.data).then(
|
|
|
+ proxy.post(`/productInfo/${modalType.value}ByEhsd`, formData.data).then(
|
|
|
(res) => {
|
|
|
ElMessage({
|
|
|
message: modalType.value == "add" ? "添加成功" : "编辑成功",
|
|
@@ -663,28 +807,24 @@ const getTreeList = () => {
|
|
|
.post("/productClassify/tree", { parentId: "", name: "", definition: "1" })
|
|
|
.then((message) => {
|
|
|
treeListData.value = message;
|
|
|
- formConfig.value[0].data = message;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const getDtl = (row) => {
|
|
|
modalType.value = "edit";
|
|
|
- proxy.post("/productInfo/detail", { id: row.id }).then((res) => {
|
|
|
+ proxy.post("/productInfo/detailByEhsd", { id: row.id }).then((res) => {
|
|
|
fileList.value = row.fileList.map((x) => ({ ...x, url: x.fileUrl }));
|
|
|
fileListCopy.value = [...fileList.value];
|
|
|
- res.type = res.type + ""; //type回显
|
|
|
res.definition = "1"; //产品
|
|
|
res.standardJson = res.standardJson ? JSON.parse(res.standardJson) : {};
|
|
|
formData.data = res;
|
|
|
dialogVisible.value = true;
|
|
|
});
|
|
|
};
|
|
|
-getTreeList();
|
|
|
-getList();
|
|
|
-const handleBeforeUpload = async (file) => {
|
|
|
+const handleBeforeUpload = async (file, att) => {
|
|
|
const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
|
|
|
uploadData.value = res.uploadBody;
|
|
|
- fileListCopy.value.push({
|
|
|
+ formData.data[att + "Copy"].push({
|
|
|
id: res.id,
|
|
|
fileName: res.fileName,
|
|
|
path: res.fileUrl,
|
|
@@ -692,42 +832,42 @@ const handleBeforeUpload = async (file) => {
|
|
|
uid: file.uid,
|
|
|
});
|
|
|
};
|
|
|
-
|
|
|
-const handleSuccess = (res, file, files) => {
|
|
|
- // 查当前file的index值去赋值对应的copy变量的值
|
|
|
- // let uid = file.uid;
|
|
|
- // const index = fileList.value.findIndex((x) => x.uid === uid);
|
|
|
- // fileListCopy.value[index].uid = uid;
|
|
|
-};
|
|
|
-
|
|
|
-const handleRemove = (file) => {
|
|
|
- const index = fileListCopy.value.findIndex(
|
|
|
+const handleRemove = (file, att) => {
|
|
|
+ const index = formData.data[att + "Copy"].findIndex(
|
|
|
(x) => x.uid === file.uid || x.id === file.id
|
|
|
);
|
|
|
- fileListCopy.value.splice(index, 1);
|
|
|
+ formData.data[att + "Copy"].splice(index, 1);
|
|
|
+};
|
|
|
+const handleClose = (index) => {
|
|
|
+ formData.data.fileList.splice(index, 1);
|
|
|
+ formData.data.fileListCopy.splice(index, 1);
|
|
|
};
|
|
|
-
|
|
|
const handleClickFile = (file) => {
|
|
|
window.open(file.fileUrl, "_blank");
|
|
|
};
|
|
|
-const productType = ref([]);
|
|
|
+const updateContent = (val) => {
|
|
|
+ formData.data.remark = val;
|
|
|
+};
|
|
|
const getDict = () => {
|
|
|
- proxy.getDictOne(["product_type"]).then((res) => {
|
|
|
- productType.value = res["product_type"];
|
|
|
- formConfig.value[1].data = productType.value.map((x) => ({
|
|
|
- label: x.dictValue,
|
|
|
- value: x.dictKey,
|
|
|
- }));
|
|
|
- selectConfig[0].data = productType.value.map((x) => ({
|
|
|
- label: x.dictValue,
|
|
|
- value: x.dictKey,
|
|
|
- }));
|
|
|
- });
|
|
|
+ proxy
|
|
|
+ .getDictOne([
|
|
|
+ "inner_packaging_method_ehsd",
|
|
|
+ "outside_packaging_method_ehsd",
|
|
|
+ ])
|
|
|
+ .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,
|
|
|
+ }));
|
|
|
+ });
|
|
|
};
|
|
|
getDict();
|
|
|
-const updateContent = (val) => {
|
|
|
- formData.data.content = val;
|
|
|
-};
|
|
|
+getTreeList();
|
|
|
+getList();
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|