|
@@ -0,0 +1,763 @@
|
|
|
+<template>
|
|
|
+ <div class="user">
|
|
|
+ <!-- <div class="tree">
|
|
|
+ <treeList title="产品分类" submitType="1" :hiddenBtn="true" :data="treeListData" v-model="sourceList.pagination.productClassifyId"
|
|
|
+ @change="treeChange" @changeTreeList="getTreeList">
|
|
|
+ </treeList>
|
|
|
+ </div> -->
|
|
|
+ <div class="content">
|
|
|
+ <byTable :source="sourceList.data" :tableHeight="tableHeight" :pagination="sourceList.pagination" :config="config" :loading="loading"
|
|
|
+ highlight-current-row :selectConfig="selectConfig" :table-events="{
|
|
|
+ //element talbe事件都能传
|
|
|
+ select: select,
|
|
|
+ }" :action-list="[]" @get-list="getList">
|
|
|
+
|
|
|
+ <template #pic="{ item }">
|
|
|
+ <div style="width:100%">
|
|
|
+ <img v-if="item.fileUrl" :src="item.fileUrl" class="pic" @click="openImg(item.fileUrl)" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template #size="{ item }">
|
|
|
+ <div v-if="item.productLength && item.productWidth && item.productHeight">
|
|
|
+ <span>{{ item.productLength}}</span>*
|
|
|
+ <span>{{ item.productWidth }}</span>*
|
|
|
+ <span>{{ item.productHeight }}</span>
|
|
|
+ </div>
|
|
|
+ <div v-else></div>
|
|
|
+ </template>
|
|
|
+ <template #price="{ item }">
|
|
|
+ <div v-if="item.price">
|
|
|
+ <span>{{ item.currency }} {{ moneyFormat(item.price ,2)}}</span>
|
|
|
+ </div>
|
|
|
+ <div v-else></div>
|
|
|
+ </template>
|
|
|
+ </byTable>
|
|
|
+ </div>
|
|
|
+ <!-- <div class="right">
|
|
|
+ <div style="margin-bottom:30px">
|
|
|
+ <TitleInfo :content="'已选择商品'"></TitleInfo>
|
|
|
+ </div>
|
|
|
+ <el-tag style="margin-right: 10px; margin-bottom: 10px" type="info" v-for="(good, index) in goodList" :key="good.productId">
|
|
|
+ {{ good.productCnName || good.productName }}
|
|
|
+ </el-tag>
|
|
|
+ </div> -->
|
|
|
+
|
|
|
+ <el-dialog :title="modalType == 'add' ? '添加产品' : '编辑产品'" v-model="dialogVisible" width="700" v-loading="submitLoading" destroy-on-close>
|
|
|
+ <div class="public_height_dialog">
|
|
|
+ <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
|
|
|
+ <template #nameEnglish>
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-form-item label="英文名" prop="nameEnglish">
|
|
|
+ <el-input v-model="formData.data.nameEnglish" placeholder="请输入" onkeyup="value=value.replace(/[^\x00-\xff]/g, '')"></el-input>
|
|
|
+ <!-- @input="(val) => handleKeyup(val)" -->
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #productPic>
|
|
|
+ <div>
|
|
|
+ <el-upload v-model:fileList="fileList" :action="uploadUrl" :data="uploadData" list-type="picture-card" :on-remove="handleRemove"
|
|
|
+ :before-upload="handleBeforeUpload" :on-preview="handlePreview" accept=".gif, .jpeg, .jpg, .png">
|
|
|
+ <el-icon>
|
|
|
+ <Plus />
|
|
|
+ </el-icon>
|
|
|
+ </el-upload>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </byForm>
|
|
|
+ </div>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="dialogVisible = false" size="default">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm('byform')" size="default" :loading="submitLoading">确 定</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog title="导入产品" v-model="openExcelDialog" width="400" v-loading="excelLoading">
|
|
|
+ <el-upload :action="actionUrl + '/productInfo/excelImportByEhsd'" :headers="headers" :on-success="handleSuccess" :on-progress="handleProgress"
|
|
|
+ :show-file-list="false" :on-error="handleError" accept=".xlsx">
|
|
|
+ <el-button type="primary">点击导入</el-button>
|
|
|
+ </el-upload>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="openExcelDialog = false" size="default">取 消</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog v-if="productContractDialog" v-model="productContractDialog" :title="'外销合同'" width="80%" append-to-body>
|
|
|
+ <ProductContract :currentProductId="currentProductId"></ProductContract>
|
|
|
+ </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";
|
|
|
+import ProductContract from "@/components/contractCom/productContract.vue";
|
|
|
+import TitleInfo from "@/components/TitleInfo/index.vue";
|
|
|
+import { watch } from "vue";
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
+const props = defineProps({
|
|
|
+ alreadySelectData: Array,
|
|
|
+ companyId: {
|
|
|
+ type: String,
|
|
|
+ default: "",
|
|
|
+ },
|
|
|
+ // 过滤是否配置过bom
|
|
|
+ isRawMaterial: {
|
|
|
+ type: String,
|
|
|
+ default: "",
|
|
|
+ },
|
|
|
+});
|
|
|
+const tableHeight = ref(0);
|
|
|
+const getTableHeight = () => {
|
|
|
+ tableHeight.value = window.innerHeight - 245;
|
|
|
+};
|
|
|
+getTableHeight();
|
|
|
+window.addEventListener("resize", () => {
|
|
|
+ getTableHeight();
|
|
|
+});
|
|
|
+const goodList = ref([]);
|
|
|
+onMounted(() => {
|
|
|
+ // goodList.value = proxy.deepClone(props.alreadySelectData);
|
|
|
+});
|
|
|
+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 companyData = ref([]);
|
|
|
+const accountCurrency = ref([]);
|
|
|
+const sourceList = ref({
|
|
|
+ data: [],
|
|
|
+ pagination: {
|
|
|
+ total: 3,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ keyword: "",
|
|
|
+ },
|
|
|
+});
|
|
|
+let dialogVisible = ref(false);
|
|
|
+let openExcelDialog = ref(false);
|
|
|
+let excelLoading = ref(false);
|
|
|
+let modalType = ref("add");
|
|
|
+let rules = ref({
|
|
|
+ productClassifyId: [
|
|
|
+ { 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" },
|
|
|
+ ],
|
|
|
+});
|
|
|
+
|
|
|
+const selectConfig = computed(() => [
|
|
|
+ // {
|
|
|
+ // label: "归属公司",
|
|
|
+ // prop: "companyId",
|
|
|
+ // data: companyData.value,
|
|
|
+ // },
|
|
|
+]);
|
|
|
+const config = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "生产公司",
|
|
|
+ prop: "corporationName",
|
|
|
+ width: 110,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "订单号",
|
|
|
+ prop: "contractCode",
|
|
|
+ width: 150,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "图片",
|
|
|
+ slot: "pic",
|
|
|
+ align: "center",
|
|
|
+ width: 80,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "产品分类",
|
|
|
+ prop: "productCategory",
|
|
|
+ width: 140,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "产品编码",
|
|
|
+ prop: "productCode",
|
|
|
+ width: 180,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "产品名称",
|
|
|
+ prop: "productName",
|
|
|
+ "min-width": 200,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "尺寸 (cm)",
|
|
|
+ slot: "size",
|
|
|
+ width: 130,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // attrs: {
|
|
|
+ // label: "颜色",
|
|
|
+ // prop: "productColor",
|
|
|
+ // width: 120,
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "订单数量",
|
|
|
+ prop: "quantity",
|
|
|
+ width: 120,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "操作",
|
|
|
+ width: "80",
|
|
|
+ align: "center",
|
|
|
+ fixed: "right",
|
|
|
+ },
|
|
|
+ // 渲染 el-button,一般用在最后一列。
|
|
|
+ renderHTML(row) {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "选择",
|
|
|
+ type: "primary",
|
|
|
+ text: true,
|
|
|
+ },
|
|
|
+ el: "button",
|
|
|
+ click() {
|
|
|
+ clickSelect(row);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+
|
|
|
+const uploadData = ref({});
|
|
|
+const fileList = ref([]);
|
|
|
+const fileListCopy = ref([]);
|
|
|
+let formData = reactive({
|
|
|
+ data: {},
|
|
|
+});
|
|
|
+const formOption = reactive({
|
|
|
+ disabled: false,
|
|
|
+ inline: true,
|
|
|
+ labelWidth: 100,
|
|
|
+ itemWidth: 100,
|
|
|
+ rules: [],
|
|
|
+});
|
|
|
+const byform = ref(null);
|
|
|
+const formConfig = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ type: "title",
|
|
|
+ title: "基本信息",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "treeSelect",
|
|
|
+ prop: "productClassifyId",
|
|
|
+ label: "产品分类",
|
|
|
+ data: treeListData.value,
|
|
|
+ itemWidth: 100,
|
|
|
+ disabled: false,
|
|
|
+ style: {
|
|
|
+ width: "100%",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "name",
|
|
|
+ label: "产品名称",
|
|
|
+ itemWidth: 100,
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "nameEnglish",
|
|
|
+ label: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "productPic",
|
|
|
+ prop: "fileList",
|
|
|
+ label: "产品图片",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "title",
|
|
|
+ title: "价格信息",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "selectInput",
|
|
|
+ prop: "price",
|
|
|
+ selectProp: "currency",
|
|
|
+ label: "销售指导价",
|
|
|
+ itemWidth: 50,
|
|
|
+ style: {
|
|
|
+ width: "100%",
|
|
|
+ },
|
|
|
+ data: accountCurrency.value,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "selectInput",
|
|
|
+ prop: "costPrice",
|
|
|
+ selectProp: "costCurrency",
|
|
|
+ label: "成本价",
|
|
|
+ itemWidth: 50,
|
|
|
+ style: {
|
|
|
+ width: "100%",
|
|
|
+ },
|
|
|
+ data: accountCurrency.value,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "title",
|
|
|
+ title: "属性信息",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "spec",
|
|
|
+ label: "规格型号",
|
|
|
+ itemWidth: 100,
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "productLong",
|
|
|
+ label: "尺寸",
|
|
|
+ itemWidth: 33.33,
|
|
|
+ placeholder: "长(cm)",
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "productWide",
|
|
|
+ label: " ",
|
|
|
+ itemWidth: 33.33,
|
|
|
+ placeholder: "宽(cm)",
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "productHigh",
|
|
|
+ label: " ",
|
|
|
+ itemWidth: 33.33,
|
|
|
+ placeholder: "高(cm)",
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "innerPackMethod",
|
|
|
+ label: "内包装方式",
|
|
|
+ required: true,
|
|
|
+ itemWidth: 50,
|
|
|
+ multiple: true,
|
|
|
+ data: innerMethon.value,
|
|
|
+ filterable: true,
|
|
|
+ placeholder: "内包装方式",
|
|
|
+ style: {
|
|
|
+ width: "100%",
|
|
|
+ },
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "outerPackMethod",
|
|
|
+ label: "外包装方式",
|
|
|
+ required: true,
|
|
|
+ itemWidth: 50,
|
|
|
+ multiple: true,
|
|
|
+ data: outsideMethon.value,
|
|
|
+ filterable: true,
|
|
|
+ placeholder: "外包装方式",
|
|
|
+ style: {
|
|
|
+ width: "100%",
|
|
|
+ },
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "netWeight",
|
|
|
+ label: "净重(kg)",
|
|
|
+ itemWidth: 100,
|
|
|
+ style: {
|
|
|
+ width: "30%",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "hsCode",
|
|
|
+ label: "海关编码",
|
|
|
+ itemWidth: 100,
|
|
|
+ style: {
|
|
|
+ width: "30%",
|
|
|
+ },
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ itemType: "textarea",
|
|
|
+ prop: "remark",
|
|
|
+ label: "备注",
|
|
|
+ itemWidth: 100,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+
|
|
|
+const getList = async (req) => {
|
|
|
+ sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
+ loading.value = true;
|
|
|
+ proxy.post("/contractProduct/page", sourceList.value.pagination).then(
|
|
|
+ (message) => {
|
|
|
+ sourceList.value.data = message.rows;
|
|
|
+ sourceList.value.pagination.total = message.total;
|
|
|
+ setTimeout(() => {
|
|
|
+ loading.value = false;
|
|
|
+ }, 200);
|
|
|
+ const productIdList = message.rows.map((x) => x.productId);
|
|
|
+ // 请求文件数据并回显
|
|
|
+ if (productIdList && productIdList.length > 0) {
|
|
|
+ proxy.getFileData({
|
|
|
+ businessIdList: productIdList,
|
|
|
+ data: sourceList.value.data,
|
|
|
+ att: "productId",
|
|
|
+ businessType: "0",
|
|
|
+ fileAtt: "fileList",
|
|
|
+ filePathAtt: "fileUrl",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ loading.value = false;
|
|
|
+ }
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
+const treeChange = (e) => {
|
|
|
+ sourceList.value.pagination.productClassifyId = e.id;
|
|
|
+ getList({ productClassifyId: e.id });
|
|
|
+};
|
|
|
+
|
|
|
+const openModal = () => {
|
|
|
+ dialogVisible.value = true;
|
|
|
+ modalType.value = "add";
|
|
|
+ formData.data = {
|
|
|
+ definition: "1",
|
|
|
+ outerPackMethod: [],
|
|
|
+ innerPackMethod: [],
|
|
|
+ fileList: [],
|
|
|
+ fileListCopy: [],
|
|
|
+ currency: "",
|
|
|
+ costCurrency: "",
|
|
|
+ };
|
|
|
+ if (accountCurrency.value && accountCurrency.value.length > 0) {
|
|
|
+ formData.data.currency = accountCurrency.value[0].value;
|
|
|
+ formData.data.costCurrency = accountCurrency.value[0].value;
|
|
|
+ }
|
|
|
+ fileList.value = [];
|
|
|
+ fileListCopy.value = [];
|
|
|
+};
|
|
|
+
|
|
|
+const openExcel = () => {
|
|
|
+ openExcelDialog.value = true;
|
|
|
+};
|
|
|
+
|
|
|
+const needAtt = [
|
|
|
+ "productClassifyId",
|
|
|
+ "name",
|
|
|
+ "spec",
|
|
|
+ "remark",
|
|
|
+ "fileList",
|
|
|
+ "id",
|
|
|
+ "unit",
|
|
|
+ "definition",
|
|
|
+];
|
|
|
+const submitForm = () => {
|
|
|
+ byform.value.handleSubmit((valid) => {
|
|
|
+ // if (!fileListCopy.value.length > 0) {
|
|
|
+ // return ElMessage({
|
|
|
+ // message: "请上传产品图片",
|
|
|
+ // type: "info",
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ let jsonObj = {};
|
|
|
+ formData.data.fileList = fileListCopy.value.map((x) => ({
|
|
|
+ id: x.id,
|
|
|
+ fileName: x.fileName,
|
|
|
+ }));
|
|
|
+ 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}ByEhsd`, formData.data).then(
|
|
|
+ (res) => {
|
|
|
+ ElMessage({
|
|
|
+ message: modalType.value == "add" ? "添加成功" : "编辑成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ dialogVisible.value = false;
|
|
|
+ submitLoading.value = false;
|
|
|
+ getList();
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ for (const key in jsonObj) {
|
|
|
+ formData.data[key] = jsonObj[key];
|
|
|
+ }
|
|
|
+ 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;
|
|
|
+ });
|
|
|
+};
|
|
|
+const getDtl = (row) => {
|
|
|
+ modalType.value = "edit";
|
|
|
+ proxy.post("/productInfo/detailByEhsd", { id: row.id }).then((res) => {
|
|
|
+ res.definition = "1"; //产品
|
|
|
+ let jsonObj = JSON.parse(res.ehsdJson);
|
|
|
+ res = {
|
|
|
+ ...res,
|
|
|
+ currency: jsonObj.currency
|
|
|
+ ? jsonObj.currency
|
|
|
+ : accountCurrency.value[0].value,
|
|
|
+ costCurrency: jsonObj.costCurrency
|
|
|
+ ? jsonObj.costCurrency
|
|
|
+ : accountCurrency.value[0].value,
|
|
|
+ ...jsonObj,
|
|
|
+ };
|
|
|
+ if (res.innerPackMethod) {
|
|
|
+ res.innerPackMethod = res.innerPackMethod.split(",");
|
|
|
+ } else {
|
|
|
+ res.innerPackMethod = [];
|
|
|
+ }
|
|
|
+ if (res.outerPackMethod) {
|
|
|
+ res.outerPackMethod = res.outerPackMethod.split(",");
|
|
|
+ } else {
|
|
|
+ res.outerPackMethod = [];
|
|
|
+ }
|
|
|
+ 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 = [];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+};
|
|
|
+const isdisabled = ["price", "costPrice", "remark", "netWeight"];
|
|
|
+// watch(modalType, (val) => {
|
|
|
+// if (val) {
|
|
|
+// for (let i = 0; i < formConfig.value.length; i++) {
|
|
|
+// const element = formConfig.value[i];
|
|
|
+// if (element.type != "title" || element.type != "slot") {
|
|
|
+// if (!isdisabled.includes(element.prop)) {
|
|
|
+// element.disabled = val == "edit" ? true : false;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// });
|
|
|
+const handleBeforeUpload = async (file) => {
|
|
|
+ const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
|
|
|
+ uploadData.value = res.uploadBody;
|
|
|
+ fileListCopy.value.push({
|
|
|
+ id: res.id,
|
|
|
+ fileName: res.fileName,
|
|
|
+ path: res.fileUrl,
|
|
|
+ url: res.fileUrl,
|
|
|
+ uid: file.uid,
|
|
|
+ });
|
|
|
+};
|
|
|
+const handleRemove = (file) => {
|
|
|
+ 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) => {
|
|
|
+ ElMessage({
|
|
|
+ message: `${err},请重试!`,
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ openExcelDialog.value = false;
|
|
|
+ excelLoading.value = false;
|
|
|
+};
|
|
|
+const handleSuccess = (res) => {
|
|
|
+ if (res.code != 200) {
|
|
|
+ return ElMessage({
|
|
|
+ message: `${res.msg},请重试!`,
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ ElMessage({
|
|
|
+ message: "导入成功!",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ openExcelDialog.value = false;
|
|
|
+ excelLoading.value = false;
|
|
|
+ getList();
|
|
|
+ }
|
|
|
+};
|
|
|
+const getDict = () => {
|
|
|
+ proxy
|
|
|
+ .get("/tenantDept/list", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 9999,
|
|
|
+ keyword: "",
|
|
|
+ tenantId: proxy.useUserStore().user.tenantId,
|
|
|
+ type: 0,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ companyData.value = res.data.map((x) => ({
|
|
|
+ ...x,
|
|
|
+ label: x.deptName,
|
|
|
+ value: x.deptId,
|
|
|
+ }));
|
|
|
+ // treeDataOne.value = proxy.handleTree(res.data, "deptId");
|
|
|
+ });
|
|
|
+};
|
|
|
+// getDict();
|
|
|
+// getTreeList();
|
|
|
+
|
|
|
+if (props && props.companyId) {
|
|
|
+ sourceList.value.pagination.companyId = props.companyId;
|
|
|
+}
|
|
|
+if (props && props.isRawMaterial) {
|
|
|
+ sourceList.value.pagination.isRawMaterial = props.isRawMaterial;
|
|
|
+}
|
|
|
+
|
|
|
+getList();
|
|
|
+const clickSelect = (item) => {
|
|
|
+ // item.selectType = "1";
|
|
|
+ // goodList.value.push({
|
|
|
+ // ...item,
|
|
|
+ // productName: item.name,
|
|
|
+ // });
|
|
|
+ proxy.$emit("selectProduct", item);
|
|
|
+};
|
|
|
+
|
|
|
+const handleKeypress = (event) => {
|
|
|
+ // 判断输入字符是否为中文字符
|
|
|
+ if (event.key.match(/[\u4e00-\u9fa5]/)) {
|
|
|
+ // 阻止输入
|
|
|
+ event.preventDefault();
|
|
|
+ }
|
|
|
+};
|
|
|
+const handleKeyup = (val) => {
|
|
|
+ // 过滤掉中文字符
|
|
|
+ formData.data.nameEnglish = formData.data.nameEnglish.replace(
|
|
|
+ /[\u4e00-\u9fa5]/g,
|
|
|
+ ""
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
+const handlePreview = (file) => {
|
|
|
+ if (file && file.fileUrl) {
|
|
|
+ window.open(file.fileUrl, "_black");
|
|
|
+ }
|
|
|
+};
|
|
|
+const productContractDialog = ref(false);
|
|
|
+const currentProductId = ref("");
|
|
|
+const handleOpenProductContract = (row) => {
|
|
|
+ currentProductId.value = row.id;
|
|
|
+ productContractDialog.value = true;
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.user {
|
|
|
+ // padding: 10px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ // .tree {
|
|
|
+ // width: 300px;
|
|
|
+ // border-right: 1px solid rgb(223, 221, 221);
|
|
|
+ // }
|
|
|
+ .content {
|
|
|
+ width: 100%;
|
|
|
+ // width: calc(100% - 310px);
|
|
|
+ }
|
|
|
+ .right {
|
|
|
+ padding-left: 10px;
|
|
|
+ width: 170px;
|
|
|
+ border-left: 1px solid #eee;
|
|
|
+ }
|
|
|
+}
|
|
|
+.pic {
|
|
|
+ object-fit: contain;
|
|
|
+ width: 50px;
|
|
|
+ height: 50px;
|
|
|
+ cursor: pointer;
|
|
|
+ vertical-align: middle;
|
|
|
+}
|
|
|
+</style>
|