|
@@ -0,0 +1,632 @@
|
|
|
+<template>
|
|
|
+ <div style="width: 100%; padding: 0px 15px">
|
|
|
+ <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="formDom">
|
|
|
+ <template #detail>
|
|
|
+ <div style="width:100%">
|
|
|
+ <el-button type="primary" @click="openProductCompany = true" plain style="margin-bottom: 16px" v-if="!judgeStatus()">产品库</el-button>
|
|
|
+ <el-table :data="formData.data.activityPriceInventoryDetailList" style="width: 100%;">
|
|
|
+ <!-- <el-table-column label="产品图片" width="80">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <div v-if="row.fileUrl">
|
|
|
+ <img :src="row.fileUrl" class="pic" @click="onPicture(row.fileUrl)" />
|
|
|
+ </div>
|
|
|
+ <div v-else></div>
|
|
|
+ </template>
|
|
|
+ </el-table-column> -->
|
|
|
+ <el-table-column prop="productName" label="产品名称" />
|
|
|
+ <!-- <el-table-column prop="productCode" label="产品编码" /> -->
|
|
|
+ <el-table-column prop="productColor" label="颜色" width="140" />
|
|
|
+ <el-table-column label="规格尺寸 (cm)" width="130">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <div style="width: 100%">
|
|
|
+ {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="产品分销价" prop="distributionPrice" width="130">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-form-item :prop="'activityPriceInventoryDetailList.' + $index + '.distributionPrice'" :rules="rules.distributionPrice"
|
|
|
+ :inline-message="true" class="margin-b-0 wid100">
|
|
|
+ <el-input-number onmousewheel="return false;" v-model="row.distributionPrice" placeholder="请输入" style="width: 100%" :precision="2"
|
|
|
+ :controls="false" :min="0" />
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="原销售价格" prop="salesPrice" width="100" />
|
|
|
+ <el-table-column label="活动价格" width="130">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-form-item :prop="'activityPriceInventoryDetailList.' + $index + '.activityPrice'" :rules="rules.activityPrice"
|
|
|
+ :inline-message="true" class="margin-b-0 wid100">
|
|
|
+ <el-input-number onmousewheel="return false;" v-model="row.activityPrice" placeholder="请输入" style="width: 100%" :precision="2"
|
|
|
+ :controls="false" :min="0" />
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="60" align="center" fixed="right" v-if="!judgeStatus()">
|
|
|
+ <template #default="{ $index }">
|
|
|
+ <el-button type="primary" link @click="handleRemove($index)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </byForm>
|
|
|
+ <el-dialog v-if="openProductCompany" v-model="openProductCompany" title="产品库" width="90%" append-to-body>
|
|
|
+ <SelectProduct @selectProduct="selectProduct" :isRawMaterial="'1'" :disablePerm="'1'"></SelectProduct>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="openProductCompany = false" size="defualt" v-debounce>关 闭</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import byForm from "@/components/byForm/index";
|
|
|
+import SelectProduct from "@/components/product/SelectProduct.vue";
|
|
|
+import { useRoute } from "vue-router";
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
+const route = useRoute();
|
|
|
+// 接收父组件的传值
|
|
|
+const props = defineProps({
|
|
|
+ queryData: Object,
|
|
|
+});
|
|
|
+const openProductCompany = ref(false);
|
|
|
+const selectData = ref([]);
|
|
|
+const userList = ref([]);
|
|
|
+const deptData = ref([]);
|
|
|
+const isData = ref([
|
|
|
+ {
|
|
|
+ label: "是",
|
|
|
+ value: 1,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "否",
|
|
|
+ value: 0,
|
|
|
+ },
|
|
|
+]);
|
|
|
+const formData = reactive({
|
|
|
+ data: {
|
|
|
+ supporterFileList: [],
|
|
|
+ activityPriceInventoryDetailList: [],
|
|
|
+ stockFileList: [],
|
|
|
+ },
|
|
|
+});
|
|
|
+const formDom = ref(null);
|
|
|
+const judgeStatus = () => {
|
|
|
+ if (route.query.processType == 20 || route.query.processType == 10) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (props.queryData.recordList && props.queryData.recordList.length > 0) {
|
|
|
+ let data = props.queryData.recordList.filter(
|
|
|
+ (item) => item.status === 2 && item.nodeType !== 1
|
|
|
+ );
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+};
|
|
|
+const formOption = reactive({
|
|
|
+ inline: true,
|
|
|
+ labelWidth: 130,
|
|
|
+ itemWidth: 100,
|
|
|
+ disabled: false,
|
|
|
+});
|
|
|
+const formConfig = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ type: "title",
|
|
|
+ title: "基本信息",
|
|
|
+ haveLine: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "code",
|
|
|
+ label: "流水号",
|
|
|
+ placeholder: " ",
|
|
|
+ itemWidth: 50,
|
|
|
+ disabled: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "date",
|
|
|
+ prop: "applyTime",
|
|
|
+ itemType: "date",
|
|
|
+ label: "申请日期",
|
|
|
+ itemWidth: 50,
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "createUser",
|
|
|
+ label: "申请人",
|
|
|
+ required: true,
|
|
|
+ filterable: true,
|
|
|
+ data: userList.value,
|
|
|
+ itemWidth: 50,
|
|
|
+ disabled: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "treeSelect",
|
|
|
+ prop: "companyId",
|
|
|
+ label: "所属公司",
|
|
|
+ data: proxy.useUserStore().allDict["tree_all_company_data"],
|
|
|
+ propsTreeLabel: "deptName",
|
|
|
+ propsTreeValue: "deptId",
|
|
|
+ itemWidth: 50,
|
|
|
+ fn: (val) => {},
|
|
|
+ disabled: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "treeSelect",
|
|
|
+ prop: "deptId",
|
|
|
+ label: "所属部门",
|
|
|
+ data: deptData.value,
|
|
|
+ propsTreeLabel: "deptName",
|
|
|
+ propsTreeValue: "deptId",
|
|
|
+ itemWidth: 50,
|
|
|
+ disabled: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "title",
|
|
|
+ title: "店铺信息",
|
|
|
+ haveLine: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "shopId",
|
|
|
+ label: "店铺名称",
|
|
|
+ filterable: true,
|
|
|
+ multiple: false,
|
|
|
+ data: selectData.value,
|
|
|
+ itemWidth: 33.33,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "shopPlatform",
|
|
|
+ itemType: "text",
|
|
|
+ label: "店铺平台",
|
|
|
+ itemWidth: 33.33,
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "shopBrand",
|
|
|
+ itemType: "text",
|
|
|
+ label: "店铺品牌",
|
|
|
+ itemWidth: 33.33,
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "title",
|
|
|
+ title: "申请内容",
|
|
|
+ haveLine: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "isPlatformActivity",
|
|
|
+ label: "是否平台活动",
|
|
|
+ filterable: false,
|
|
|
+ multiple: false,
|
|
|
+ data: isData.value,
|
|
|
+ itemWidth: 33.33,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "isProductSupport",
|
|
|
+ label: "是否需要产品价格支持",
|
|
|
+ filterable: false,
|
|
|
+ multiple: false,
|
|
|
+ data: isData.value,
|
|
|
+ itemWidth: 33.33,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "isInventorySupport",
|
|
|
+ label: "是否需要库存支持",
|
|
|
+ filterable: false,
|
|
|
+ multiple: false,
|
|
|
+ data: isData.value,
|
|
|
+ itemWidth: 33.33,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "title",
|
|
|
+ title: "平台活动信息",
|
|
|
+ haveLine: true,
|
|
|
+ isShow: formData.data.isPlatformActivity ? true : false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "activityName",
|
|
|
+ itemType: "text",
|
|
|
+ label: "活动名称",
|
|
|
+ itemWidth: 50,
|
|
|
+ disabled: false,
|
|
|
+ isShow: formData.data.isPlatformActivity ? true : false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "activityDays",
|
|
|
+ itemType: "text",
|
|
|
+ label: "活动天数",
|
|
|
+ itemWidth: 50,
|
|
|
+ disabled: false,
|
|
|
+ isShow: formData.data.isPlatformActivity ? true : false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "date",
|
|
|
+ prop: "activityStartTime",
|
|
|
+ itemType: "date",
|
|
|
+ label: "活动开始日期",
|
|
|
+ itemWidth: 50,
|
|
|
+ disabled: false,
|
|
|
+ isShow: formData.data.isPlatformActivity ? true : false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "date",
|
|
|
+ prop: "activityEndTime",
|
|
|
+ itemType: "date",
|
|
|
+ label: "活动结束日期",
|
|
|
+ itemWidth: 50,
|
|
|
+ disabled: false,
|
|
|
+ isShow: formData.data.isPlatformActivity ? true : false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "detail",
|
|
|
+ prop: "",
|
|
|
+ label: "活动明细",
|
|
|
+ isShow: formData.data.isPlatformActivity ? true : false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "title",
|
|
|
+ title: "产品价格支持信息",
|
|
|
+ haveLine: true,
|
|
|
+ isShow: formData.data.isProductSupport ? true : false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "treeSelect",
|
|
|
+ prop: "supporterId",
|
|
|
+ label: "支持方",
|
|
|
+ data: proxy.useUserStore().allDict["tree_all_company_data"],
|
|
|
+ propsTreeLabel: "deptName",
|
|
|
+ propsTreeValue: "deptId",
|
|
|
+ itemWidth: 50,
|
|
|
+ fn: (val) => {},
|
|
|
+ disabled: false,
|
|
|
+ isShow: formData.data.isProductSupport ? true : false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "supportCycle",
|
|
|
+ itemType: "text",
|
|
|
+ label: "支持周期",
|
|
|
+ itemWidth: 50,
|
|
|
+ disabled: false,
|
|
|
+ isShow: formData.data.isProductSupport ? true : false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "date",
|
|
|
+ prop: "supporterStartTime",
|
|
|
+ itemType: "date",
|
|
|
+ label: "支持起始日期",
|
|
|
+ itemWidth: 50,
|
|
|
+ disabled: false,
|
|
|
+ isShow: formData.data.isProductSupport ? true : false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "date",
|
|
|
+ prop: "supporterEndTime",
|
|
|
+ itemType: "date",
|
|
|
+ label: "支持结束日期",
|
|
|
+ itemWidth: 50,
|
|
|
+ disabled: false,
|
|
|
+ isShow: formData.data.isProductSupport ? true : false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "upload",
|
|
|
+ listType: "text",
|
|
|
+ aisInventorySupportept: "",
|
|
|
+ prop: "supporterFileList",
|
|
|
+ label: "附件",
|
|
|
+ isShow: formData.data.isProductSupport ? true : false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "productQuotationUser",
|
|
|
+ itemType: "text",
|
|
|
+ label: "商品报价人",
|
|
|
+ itemWidth: 50,
|
|
|
+ disabled: false,
|
|
|
+ isShow: formData.data.isProductSupport ? true : false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "isReportGm",
|
|
|
+ label: "是否提报总经理",
|
|
|
+ filterable: false,
|
|
|
+ multiple: false,
|
|
|
+ data: isData.value,
|
|
|
+ itemWidth: 50,
|
|
|
+ isShow: formData.data.isProductSupport ? true : false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "title",
|
|
|
+ title: "库存支持信息",
|
|
|
+ haveLine: true,
|
|
|
+ isShow: formData.data.isInventorySupport ? true : false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "isNewProduct",
|
|
|
+ label: "是否新品",
|
|
|
+ filterable: false,
|
|
|
+ multiple: false,
|
|
|
+ data: isData.value,
|
|
|
+ itemWidth: 50,
|
|
|
+ isShow: formData.data.isInventorySupport ? true : false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "upload",
|
|
|
+ listType: "text",
|
|
|
+ aisInventorySupportept: "",
|
|
|
+ prop: "stockFileList",
|
|
|
+ label: "库存明细附件",
|
|
|
+ isShow: formData.data.isInventorySupport ? true : false,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+
|
|
|
+const rules = ref({
|
|
|
+ applyTime: [{ required: true, message: "请选择申请日期", trigger: "change" }],
|
|
|
+ companyId: [{ required: true, message: "请选择所属公司", trigger: "change" }],
|
|
|
+ deptId: [{ required: true, message: "请选择所属部门", trigger: "change" }],
|
|
|
+ createUser: [{ required: true, message: "请选择申请人", trigger: "change" }],
|
|
|
+ shopId: [{ required: true, message: "请选择店铺", trigger: "change" }],
|
|
|
+ shopPlatform: [
|
|
|
+ { required: true, message: "请输入店铺平台", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ shopBrand: [{ required: true, message: "请输入店铺品牌", trigger: "blur" }],
|
|
|
+ isPlatformActivity: [
|
|
|
+ { required: true, message: "请选择是否平台活动", trigger: "change" },
|
|
|
+ ],
|
|
|
+ isProductSupport: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请选择是否需要产品价格支持",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ isInventorySupport: [
|
|
|
+ { required: true, message: "请选择是否需要库存支持", trigger: "change" },
|
|
|
+ ],
|
|
|
+ activityName: [
|
|
|
+ { required: true, message: "请输入活动名称", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ activityDays: [
|
|
|
+ { required: true, message: "请输入活动天数", trigger: "blur" },
|
|
|
+ ],
|
|
|
+
|
|
|
+ activityStartTime: [
|
|
|
+ { required: true, message: "请选择活动开始日期", trigger: "change" },
|
|
|
+ ],
|
|
|
+ activityEndTime: [
|
|
|
+ { required: true, message: "请选择活动结束日期", trigger: "change" },
|
|
|
+ ],
|
|
|
+ supporterId: [{ required: true, message: "请选择支持方", trigger: "change" }],
|
|
|
+ supportCycle: [
|
|
|
+ { required: true, message: "请输入支持周期", trigger: "blur" },
|
|
|
+ ],
|
|
|
+
|
|
|
+ supporterStartTime: [
|
|
|
+ { required: true, message: "请选择支持起始日期", trigger: "change" },
|
|
|
+ ],
|
|
|
+ supporterEndTime: [
|
|
|
+ { required: true, message: "请选择支持结束日期", trigger: "change" },
|
|
|
+ ],
|
|
|
+ isReportGm: [
|
|
|
+ { required: true, message: "请选择是否提报总经理", trigger: "change" },
|
|
|
+ ],
|
|
|
+ isNewProduct: [
|
|
|
+ { required: true, message: "请选择是否新品", trigger: "change" },
|
|
|
+ ],
|
|
|
+ distributionPrice: [
|
|
|
+ { required: true, message: "请输入产品分销价", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ activityPrice: [
|
|
|
+ { required: true, message: "请输入活动价格", trigger: "blur" },
|
|
|
+ ],
|
|
|
+
|
|
|
+ // supporterFileList: [{ required: true, message: "请上传申请附件", trigger: "change" }],
|
|
|
+});
|
|
|
+const isFormDetail = ref(false);
|
|
|
+if (route.query && route.query.processType && route.query.processType == 20) {
|
|
|
+ isFormDetail.value = true;
|
|
|
+}
|
|
|
+const getDeptData = () => {
|
|
|
+ proxy
|
|
|
+ .get(isFormDetail.value ? "/tenantUser/listAll" : "/tenantUser/list", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10000,
|
|
|
+ tenantId: proxy.useUserStore().user.tenantId,
|
|
|
+ // companyId: proxy.useUserStore().user.companyId,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ userList.value = res.rows.map((item) => {
|
|
|
+ return {
|
|
|
+ label: item.nickName,
|
|
|
+ value: item.userId,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ proxy
|
|
|
+ .get("/tenantDept/list", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 9999,
|
|
|
+ keyword: "",
|
|
|
+ // ancestors: proxy.useUserStore().user.companyId,
|
|
|
+ tenantId: proxy.useUserStore().user.tenantId,
|
|
|
+ // type: 2,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ deptData.value = proxy.handleTree(res.data, "deptId");
|
|
|
+ });
|
|
|
+};
|
|
|
+getDeptData();
|
|
|
+
|
|
|
+const getDict = () => {
|
|
|
+ proxy
|
|
|
+ .post("shopInfo/page", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 999,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ selectData.value = res.rows.map((x) => ({
|
|
|
+ ...x,
|
|
|
+ label: x.name,
|
|
|
+ value: x.id,
|
|
|
+ }));
|
|
|
+ });
|
|
|
+};
|
|
|
+getDict();
|
|
|
+
|
|
|
+const selectProduct = async (row) => {
|
|
|
+ let fileUrl = "";
|
|
|
+ if (row.fileList && row.fileList.length > 0) {
|
|
|
+ fileUrl = row.fileList[0].fileUrl;
|
|
|
+ }
|
|
|
+ let flag = formData.data.activityPriceInventoryDetailList.some(
|
|
|
+ (x) => x.productId == row.id
|
|
|
+ );
|
|
|
+ if (!flag) {
|
|
|
+ formData.data.activityPriceInventoryDetailList.push({
|
|
|
+ fileUrl: fileUrl,
|
|
|
+ productId: row.id,
|
|
|
+ productClassifyName: row.classifyName,
|
|
|
+ productName: row.name,
|
|
|
+ productCode: row.customCode,
|
|
|
+ productLength: row["length"],
|
|
|
+ productWidth: row.width,
|
|
|
+ productHeight: row.height,
|
|
|
+ productColor: row.color,
|
|
|
+ productNetWeight: row.netWeight,
|
|
|
+ productUnit: row.unit,
|
|
|
+ distributionPrice: null,
|
|
|
+ salesPrice: row.price,
|
|
|
+ activityPrice: null,
|
|
|
+ });
|
|
|
+ return proxy.msgTip("添加成功", 1);
|
|
|
+ } else {
|
|
|
+ return proxy.msgTip("该产品已选择", 2);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const handleRemove = (index) => {
|
|
|
+ formData.data.activityPriceInventoryDetailList.splice(index, 1);
|
|
|
+};
|
|
|
+
|
|
|
+const handleSubmit = async (isStag = false) => {
|
|
|
+ if (isStag) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ let flag = await formDom.value.handleSubmit(() => {});
|
|
|
+ if (flag) {
|
|
|
+ if (formData.data.isPlatformActivity) {
|
|
|
+ if (
|
|
|
+ !(
|
|
|
+ formData.data.activityPriceInventoryDetailList &&
|
|
|
+ formData.data.activityPriceInventoryDetailList.length > 0
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ proxy.msgTip("请添加活动明细", 2);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ setTimeout(() => {
|
|
|
+ const errorDiv = document.getElementsByClassName("is-error");
|
|
|
+ errorDiv[0].scrollIntoView();
|
|
|
+ }, 0);
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
+};
|
|
|
+
|
|
|
+const getFormData = () => {
|
|
|
+ return proxy.deepClone(formData.data);
|
|
|
+};
|
|
|
+// 向父组件暴露
|
|
|
+defineExpose({
|
|
|
+ getFormData,
|
|
|
+ handleSubmit,
|
|
|
+});
|
|
|
+
|
|
|
+const getAllData = (businessId) => {
|
|
|
+ if (businessId) {
|
|
|
+ proxy
|
|
|
+ .post("/activityPriceInventory/detail", { id: businessId })
|
|
|
+ .then((res) => {
|
|
|
+ res.isNewProduct = Number(res.isNewProduct);
|
|
|
+ formData.data = res;
|
|
|
+ proxy
|
|
|
+ .post("/fileInfo/getList", { businessIdList: [businessId] })
|
|
|
+ .then((fileObj) => {
|
|
|
+ if (fileObj[businessId] && fileObj[businessId].length > 0) {
|
|
|
+ formData.data.supporterFileList = fileObj[businessId]
|
|
|
+ .filter((x) => x.businessType == "10")
|
|
|
+ .map((item) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ name: item.fileName,
|
|
|
+ url: item.fileUrl,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ formData.data.stockFileList = fileObj[businessId]
|
|
|
+ .filter((x) => x.businessType == "20")
|
|
|
+ .map((item) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ name: item.fileName,
|
|
|
+ url: item.fileUrl,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ formData.data.supporterFileList = [];
|
|
|
+ formData.data.stockFileList = [];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ formOption.disabled = judgeStatus();
|
|
|
+ formData.data.applyTime = proxy.parseTime(new Date());
|
|
|
+ formData.data.companyId = proxy.useUserStore().user.companyId;
|
|
|
+ formData.data.deptId = proxy.useUserStore().user.dept.deptId;
|
|
|
+ formData.data.createUser = proxy.useUserStore().user.userId;
|
|
|
+ if (route.query.businessId) {
|
|
|
+ getAllData(route.query.businessId);
|
|
|
+ }
|
|
|
+ // 删除莫名多出的一个textarea
|
|
|
+ nextTick(() => {
|
|
|
+ setTimeout(() => {
|
|
|
+ let dom = document.getElementsByTagName("textarea");
|
|
|
+ if (dom && dom.length > 0) {
|
|
|
+ for (let i = 0; i < dom.length; i++) {
|
|
|
+ if (!dom[i].className) {
|
|
|
+ dom[i].style.display = "none";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 100);
|
|
|
+ });
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+</style>
|