|
@@ -0,0 +1,743 @@
|
|
|
+<template>
|
|
|
+ <div class="tenant">
|
|
|
+ <!-- <Banner /> -->
|
|
|
+ <div class="content">
|
|
|
+ <byTable
|
|
|
+ :source="sourceList.data"
|
|
|
+ :pagination="sourceList.pagination"
|
|
|
+ :config="config"
|
|
|
+ :loading="loading"
|
|
|
+ highlight-current-row
|
|
|
+ :selectConfig="selectConfig"
|
|
|
+ :table-events="{
|
|
|
+ //element talbe事件都能传
|
|
|
+ }"
|
|
|
+ :action-list="[
|
|
|
+ {
|
|
|
+ text: '添加售后',
|
|
|
+ disabled: false,
|
|
|
+ action: () => clickAdd(),
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ @get-list="getList"
|
|
|
+ >
|
|
|
+ <template #code="{ item }">
|
|
|
+ <div
|
|
|
+ style="cursor: pointer; color: #409eff"
|
|
|
+ @click="handleClickCode(item)"
|
|
|
+ >
|
|
|
+ {{ item.code }}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </byTable>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-dialog title="添加售后" v-model="dialogVisible" width="50%">
|
|
|
+ <byForm
|
|
|
+ :formConfig="formConfig"
|
|
|
+ :formOption="formOption"
|
|
|
+ v-model="formData.data"
|
|
|
+ :rules="rules"
|
|
|
+ ref="formDom"
|
|
|
+ v-loading="submitLoading"
|
|
|
+ >
|
|
|
+ <template #details>
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-button type="primary" plain @click="openProduct = true">
|
|
|
+ 添加商品
|
|
|
+ </el-button>
|
|
|
+ <el-table
|
|
|
+ :data="formData.data.subscribeDetailList"
|
|
|
+ style="margin-top: 10px"
|
|
|
+ >
|
|
|
+ <el-table-column prop="code" label="产品编码" />
|
|
|
+ <el-table-column prop="name" label="产品名称" min-width="150" />
|
|
|
+ <el-table-column prop="spec" label="规格型号" />
|
|
|
+ <el-table-column
|
|
|
+ prop="unit"
|
|
|
+ label="单位"
|
|
|
+ :formatter="(row) => dictValueLabel(row.unit, productUnit)"
|
|
|
+ />
|
|
|
+ <el-table-column prop="count" label="售后数量" min-width="150">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'subscribeDetailList.' + $index + '.count'"
|
|
|
+ :rules="rules.count"
|
|
|
+ :inline-message="true"
|
|
|
+ >
|
|
|
+ <el-input-number
|
|
|
+ onmousewheel="return false;"
|
|
|
+ v-model="row.count"
|
|
|
+ :precision="4"
|
|
|
+ :controls="false"
|
|
|
+ :min="1"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="remark" label="备注" min-width="150">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'subscribeDetailList.' + $index + '.remark'"
|
|
|
+ :rules="rules.remark"
|
|
|
+ :inline-message="true"
|
|
|
+ >
|
|
|
+ <el-input v-model="row.remark" placeholder="请输入" />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="zip" label="操作" width="100">
|
|
|
+ <template #default="{ $index }">
|
|
|
+ <el-button type="primary" link @click="handleRemove($index)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </byForm>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="dialogVisible = false" size="large">取 消</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="submitForm()"
|
|
|
+ size="large"
|
|
|
+ :loading="submitLoading"
|
|
|
+ >
|
|
|
+ 确 定
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ title="售后跟进"
|
|
|
+ v-model="openFollow"
|
|
|
+ width="500"
|
|
|
+ destroy-on-close
|
|
|
+ >
|
|
|
+ <byForm
|
|
|
+ :formConfig="formConfigAFollow"
|
|
|
+ :formOption="formOption"
|
|
|
+ v-model="formData.followData"
|
|
|
+ :rules="followRules"
|
|
|
+ ref="followDom"
|
|
|
+ v-loading="submitLoading"
|
|
|
+ >
|
|
|
+ <template #fileSlot>
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-upload
|
|
|
+ v-model:fileList="fileList"
|
|
|
+ action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
|
|
|
+ :data="uploadData"
|
|
|
+ multiple
|
|
|
+ :before-upload="uploadFile"
|
|
|
+ :on-preview="onPreviewFile"
|
|
|
+ >
|
|
|
+ <el-button type="primary">文件上传</el-button>
|
|
|
+ </el-upload>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </byForm>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="openFollow = false" size="large">取 消</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="submitFollow()"
|
|
|
+ size="large"
|
|
|
+ :loading="submitLoading"
|
|
|
+ >确 定</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ title="跟进记录"
|
|
|
+ v-model="openRecord"
|
|
|
+ width="500"
|
|
|
+ destroy-on-close
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ <div style="padding-top: 16px">
|
|
|
+ <div>
|
|
|
+ <el-timeline>
|
|
|
+ <el-timeline-item
|
|
|
+ v-for="(record, index) in recordList"
|
|
|
+ :key="index"
|
|
|
+ :timestamp="record.date"
|
|
|
+ hide-timestamp
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ <div
|
|
|
+ style="
|
|
|
+ padding: 0 0 8px 0;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <span>{{
|
|
|
+ dictValueLabel(record.createUser, userList)
|
|
|
+ }}</span>
|
|
|
+ <span>{{ record.date }}</span>
|
|
|
+ </div>
|
|
|
+ <div v-if="record.type == '30'">
|
|
|
+ <div
|
|
|
+ style="word-wrap: break-word; margin: 8px 0"
|
|
|
+ v-html="getStyle(record.content)"
|
|
|
+ v-if="record.content"
|
|
|
+ ></div>
|
|
|
+ <div v-else>跟进记录:</div>
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
+ <div style="word-wrap: break-word; margin: 8px 0">
|
|
|
+ {{ getContent(record) }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ style="margin: 8px 0; display: flex"
|
|
|
+ v-if="record.fileList && record.fileList.length > 0"
|
|
|
+ >
|
|
|
+ <div style="width: 36px">附件:</div>
|
|
|
+ <div style="width: calc(100% - 36px)">
|
|
|
+ <div
|
|
|
+ v-for="(file, index) in record.fileList"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ <a
|
|
|
+ style="color: #409eff; cursor: pointer"
|
|
|
+ @click="openFile(file.fileUrl)"
|
|
|
+ >{{ file.fileName }}</a
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-timeline-item>
|
|
|
+ </el-timeline>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="openRecord = false" size="large">关 闭</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ v-if="openProduct"
|
|
|
+ v-model="openProduct"
|
|
|
+ title="选择商品"
|
|
|
+ width="70%"
|
|
|
+ append-to-body
|
|
|
+ >
|
|
|
+ <SelectGoods
|
|
|
+ :selectList="acquireSelectList()"
|
|
|
+ @cancel="openProduct = false"
|
|
|
+ @pushGoods="pushGoods"
|
|
|
+ ></SelectGoods>
|
|
|
+ </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 SelectGoods from "@/components/product/SelectGoods";
|
|
|
+import { computed } from "vue";
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
+const fileList = ref([]);
|
|
|
+const uploadData = ref({});
|
|
|
+const loading = ref(false);
|
|
|
+const submitLoading = ref(false);
|
|
|
+const sourceList = ref({
|
|
|
+ data: [],
|
|
|
+ pagination: {
|
|
|
+ total: 3,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ },
|
|
|
+});
|
|
|
+const dialogVisible = ref(false);
|
|
|
+const openProduct = ref(false);
|
|
|
+const openFollow = ref(false);
|
|
|
+const openRecord = ref(false);
|
|
|
+const modalType = ref("add");
|
|
|
+const rules = ref({
|
|
|
+ name: [{ required: true, message: "请输入供应商名称", trigger: "blur" }],
|
|
|
+ qualifiedCount: [
|
|
|
+ { required: true, message: "请输入质检合格数量", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ noQualifiedCount: [
|
|
|
+ { required: true, message: "请输入质检不合格数量", trigger: "blur" },
|
|
|
+ ],
|
|
|
+});
|
|
|
+const customerData = ref([]);
|
|
|
+const productUnit = ref([]);
|
|
|
+const productType = ref([]);
|
|
|
+const recordList = ref([]);
|
|
|
+const selectConfig = computed(() => [
|
|
|
+ {
|
|
|
+ label: "客户名称",
|
|
|
+ prop: "status",
|
|
|
+ data: customerData.value,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "售后类型",
|
|
|
+ prop: "status",
|
|
|
+ data: customerData.value,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "售后状态",
|
|
|
+ prop: "status",
|
|
|
+ data: customerData.value,
|
|
|
+ },
|
|
|
+]);
|
|
|
+const config = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "客户名称",
|
|
|
+ prop: "code",
|
|
|
+ slot: "code",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "销售合同编号",
|
|
|
+ prop: "supplyName",
|
|
|
+ slot: "code",
|
|
|
+
|
|
|
+ width: 150,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "售后类型",
|
|
|
+ prop: "productDefinition",
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ render(type) {
|
|
|
+ return type == 1 ? "产品" : "物料";
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "产品编码",
|
|
|
+ prop: "productCode",
|
|
|
+ width: 150,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "产品名称",
|
|
|
+ prop: "productName",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "规格型号",
|
|
|
+ prop: "productSpec",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "单位",
|
|
|
+ prop: "productUnit",
|
|
|
+ width: 80,
|
|
|
+ },
|
|
|
+ render(unit) {
|
|
|
+ return proxy.dictValueLabel(unit, productUnit.value);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "数量",
|
|
|
+ prop: "count",
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "售后状态",
|
|
|
+ prop: "qualifiedCount",
|
|
|
+ slot: "code",
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "售后说明",
|
|
|
+ prop: "noQualifiedCount",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "操作",
|
|
|
+ width: "150",
|
|
|
+ align: "center",
|
|
|
+ fixed: "right",
|
|
|
+ },
|
|
|
+ renderHTML(row) {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "跟进",
|
|
|
+ type: "primary",
|
|
|
+ text: true,
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ el: "button",
|
|
|
+ click() {
|
|
|
+ modalType.value = "add";
|
|
|
+ formData.followData = {};
|
|
|
+ openFollow.value = true;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "关闭",
|
|
|
+ type: "primary",
|
|
|
+ text: true,
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ el: "button",
|
|
|
+ click() {},
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "退货",
|
|
|
+ type: "primary",
|
|
|
+ text: true,
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ el: "button",
|
|
|
+ click() {},
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "换货",
|
|
|
+ type: "primary",
|
|
|
+ text: true,
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ el: "button",
|
|
|
+ click() {},
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "退款",
|
|
|
+ type: "primary",
|
|
|
+ text: true,
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ el: "button",
|
|
|
+ click() {},
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "发起采购",
|
|
|
+ type: "primary",
|
|
|
+ text: true,
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ el: "button",
|
|
|
+ click() {},
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+
|
|
|
+const formData = reactive({
|
|
|
+ data: {},
|
|
|
+ followData: {},
|
|
|
+});
|
|
|
+const formOption = reactive({
|
|
|
+ inline: true,
|
|
|
+ labelWidth: 100,
|
|
|
+ itemWidth: 100,
|
|
|
+ rules: [],
|
|
|
+});
|
|
|
+const formConfig = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "customerId",
|
|
|
+ label: "客户名称",
|
|
|
+ required: true,
|
|
|
+ itemWidth: 100,
|
|
|
+ data: customerData.value,
|
|
|
+ style: {
|
|
|
+ width: "50%",
|
|
|
+ },
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "customerId",
|
|
|
+ label: "销售合同",
|
|
|
+ required: true,
|
|
|
+ itemWidth: 100,
|
|
|
+ multiple: true,
|
|
|
+ data: customerData.value,
|
|
|
+ style: {
|
|
|
+ width: "50%",
|
|
|
+ },
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "customerId",
|
|
|
+ label: "售后类型",
|
|
|
+ required: true,
|
|
|
+ itemWidth: 100,
|
|
|
+ multiple: true,
|
|
|
+ data: customerData.value,
|
|
|
+ style: {
|
|
|
+ width: "30%",
|
|
|
+ },
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ itemType: "textarea",
|
|
|
+ prop: "customerId",
|
|
|
+ label: "售后说明",
|
|
|
+ required: true,
|
|
|
+ itemWidth: 100,
|
|
|
+ style: {
|
|
|
+ width: "50%",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "title",
|
|
|
+ title: "产品明细",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "details",
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+const formConfigAFollow = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ type: "date",
|
|
|
+ itemType: "datetime",
|
|
|
+ label: "跟进时间",
|
|
|
+ prop: "date",
|
|
|
+ itemWidth: 100,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+
|
|
|
+ label: "跟进人",
|
|
|
+ prop: "aa",
|
|
|
+ itemWidth: 100,
|
|
|
+ data: [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ itemType: "textarea",
|
|
|
+ label: "跟进记录",
|
|
|
+ prop: "content",
|
|
|
+ itemWidth: 100,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ label: "上传附件",
|
|
|
+ prop: "fileList",
|
|
|
+ slotName: "fileSlot",
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+const formDom = ref(null);
|
|
|
+const getList = async (req) => {
|
|
|
+ sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
+ loading.value = true;
|
|
|
+ proxy
|
|
|
+ .post("/arrivalDetail/page", sourceList.value.pagination)
|
|
|
+ .then((message) => {
|
|
|
+ message.rows.forEach((x) => {
|
|
|
+ if (x.status < 20) {
|
|
|
+ x.isCheck = true;
|
|
|
+ } else {
|
|
|
+ x.isCheck = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ sourceList.value.data = message.rows;
|
|
|
+ sourceList.value.pagination.total = message.total;
|
|
|
+ setTimeout(() => {
|
|
|
+ loading.value = false;
|
|
|
+ }, 200);
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const submitForm = () => {
|
|
|
+ formDom.value.validate((valid) => {
|
|
|
+ const list = formData.data.qualityDetailList;
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
+ const e = list[i];
|
|
|
+ delete e.id;
|
|
|
+ if (!(e.qualifiedCount + e.noQualifiedCount > 0)) {
|
|
|
+ return ElMessage({
|
|
|
+ message: "质检数量不能为0!",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ e.qualifiedCount + e.noQualifiedCount + Number(e.sumQualityCount) >
|
|
|
+ Number(e.count)
|
|
|
+ ) {
|
|
|
+ return ElMessage({
|
|
|
+ message: "质检数量不能大于到货数量!",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ submitLoading.value = true;
|
|
|
+ proxy.post("/quality/" + modalType.value, formData.data).then(
|
|
|
+ (res) => {
|
|
|
+ ElMessage({
|
|
|
+ message: "质检成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ dialogVisible.value = false;
|
|
|
+ submitLoading.value = false;
|
|
|
+ getList();
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ submitLoading.value = false;
|
|
|
+ }
|
|
|
+ );
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const getDtl = (row) => {
|
|
|
+ modalType.value = "edit";
|
|
|
+ dialogVisible.value = true;
|
|
|
+
|
|
|
+ // proxy.post("/productionProcesses/detail", { id: row.id }).then((res) => {
|
|
|
+ // fileList.value = [
|
|
|
+ // {
|
|
|
+ // id: "",
|
|
|
+ // fileName: res.fileName,
|
|
|
+ // path: "",
|
|
|
+ // },
|
|
|
+ // ];
|
|
|
+ // formData.data = res;
|
|
|
+ // dialogVisible.value = true;
|
|
|
+ // });
|
|
|
+};
|
|
|
+const getDict = () => {
|
|
|
+ proxy.post("/customer/page", { pageNum: 1, pageSize: 9999 }).then((res) => {
|
|
|
+ customerData.value = res.rows.map((x) => ({
|
|
|
+ ...x,
|
|
|
+ label: x.name,
|
|
|
+ value: x.id,
|
|
|
+ }));
|
|
|
+ });
|
|
|
+
|
|
|
+ proxy.getDictOne(["unit", "product_type"]).then((res) => {
|
|
|
+ productUnit.value = res["unit"].map((x) => ({
|
|
|
+ label: x.dictValue,
|
|
|
+ value: x.dictKey,
|
|
|
+ }));
|
|
|
+ productType.value = res["product_type"].map((x) => ({
|
|
|
+ label: x.dictValue,
|
|
|
+ value: x.dictKey,
|
|
|
+ }));
|
|
|
+ });
|
|
|
+};
|
|
|
+getDict();
|
|
|
+getList();
|
|
|
+const clickAdd = (type) => {
|
|
|
+ modalType.value = "add";
|
|
|
+ formData.data = {};
|
|
|
+ dialogVisible.value = true;
|
|
|
+};
|
|
|
+
|
|
|
+const acquireSelectList = () => {
|
|
|
+ let data = [];
|
|
|
+ if (
|
|
|
+ formData.data.subscribeDetailList &&
|
|
|
+ formData.data.subscribeDetailList.length > 0
|
|
|
+ ) {
|
|
|
+ data = formData.data.subscribeDetailList.map((item) => {
|
|
|
+ return {
|
|
|
+ id: item.bussinessId,
|
|
|
+ name: item.productName,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return data;
|
|
|
+};
|
|
|
+
|
|
|
+const pushGoods = (goods) => {
|
|
|
+ if (goods && goods.length > 0) {
|
|
|
+ let afterFiltering = [];
|
|
|
+ if (
|
|
|
+ formData.data.subscribeDetailList &&
|
|
|
+ formData.data.subscribeDetailList.length > 0
|
|
|
+ ) {
|
|
|
+ afterFiltering = goods.filter((item) => {
|
|
|
+ let data = formData.data.subscribeDetailList.filter(
|
|
|
+ (itemProduct) => itemProduct.bussinessId === item.id
|
|
|
+ );
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ afterFiltering = goods;
|
|
|
+ }
|
|
|
+ const arr = afterFiltering.map((x) => ({
|
|
|
+ goodType: x.goodType,
|
|
|
+ code: x.code,
|
|
|
+ name: x.name,
|
|
|
+ spec: x.spec,
|
|
|
+ unit: x.unit,
|
|
|
+ bussinessId: x.id,
|
|
|
+ count: "",
|
|
|
+ remark: "",
|
|
|
+ }));
|
|
|
+ formData.data.subscribeDetailList =
|
|
|
+ formData.data.subscribeDetailList.concat(arr);
|
|
|
+ openProduct.value = false;
|
|
|
+ return ElMessage({
|
|
|
+ message: "添加成功!",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ ElMessage("请选择至少一件物品");
|
|
|
+ }
|
|
|
+};
|
|
|
+const handleRemove = (index) => {
|
|
|
+ formData.data.subscribeDetailList.splice(index, 1);
|
|
|
+ return ElMessage({
|
|
|
+ message: "删除成功!",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const uploadFile = async (file) => {
|
|
|
+ const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
|
|
|
+ uploadData.value = res.uploadBody;
|
|
|
+ file.id = res.id;
|
|
|
+ file.fileName = res.fileName;
|
|
|
+ file.fileUrl = res.fileUrl;
|
|
|
+ return true;
|
|
|
+};
|
|
|
+const onPreviewFile = (file) => {
|
|
|
+ window.open(file.raw.fileUrl, "_blank");
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.tenant {
|
|
|
+ padding: 20px;
|
|
|
+}
|
|
|
+</style>
|