Commit 50ca4ee0 authored by limengyang's avatar limengyang

fix(lmy):eslint修复

parent 2c097084
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { import { Input, Button } from 'ant-design-vue';
Input, import { RightOutlined, LeftOutlined } from '@ant-design/icons-vue';
Button, const emit = defineEmits(['close']);
} from 'ant-design-vue'; import {
import { RightOutlined, LeftOutlined } from '@ant-design/icons-vue'; regionalSpotManageBrandListApi,
const emit = defineEmits(['close']) regionalSpotManageGetAreaListApi,
import { regionalSpotManageOpsAddProductApi,
regionalSpotManageBrandListApi, } from '/@/api/regionalSpotManage';
regionalSpotManageGetAreaListApi, import { getAuthCache } from '/@/utils/auth';
regionalSpotManageOpsAddProductApi const userInfo: any = getAuthCache('USER__INFO__');
} from '/@/api/regionalSpotManage'; const ghsCode = userInfo.supplier.ghsCode;
import { getAuthCache } from '/@/utils/auth'; let searchBrand = ref('');
const userInfo: any = getAuthCache('USER__INFO__') let searchItemNo = ref('');
const ghsCode = userInfo.supplier.ghsCode let searchBrandList = ref<any[]>([]);
let searchBrand = ref('') const handleSearch = async (value) => {
let searchItemNo = ref('') const res = await regionalSpotManageBrandListApi({ brand: value });
let searchBrandList = ref<any[]>([]) if (res.code === 20000) {
const handleSearch = async (value) => { searchBrandList.value = res.data;
const res = await regionalSpotManageBrandListApi({brand: value}); } else {
if (res.code === 20000) { searchBrandList.value = [];
searchBrandList.value = res.data }
} else { };
searchBrandList.value = [] const closeModal = () => {
} emit('close', false);
} };
const closeModal = () => { const leftData = ref<any[]>([]);
emit('close', false) const leftColumns = [
}
const leftData = ref<any[]>([])
const leftColumns = [
{ title: '商品名称', dataIndex: 'productName', key: 'productName', width: '25%', align: 'center'},
{ title: '品牌', dataIndex: 'brand', key: 'brand', width: '25%', align: 'center'},
{ title: '货号', dataIndex: 'goodsNo', key: 'goodsNo', width: '20%', align: 'center'},
{ title: '规格', dataIndex: 'spec', key: 'spec', width: '20%', align: 'center'},
]
const pagination = ref({
size: 'small',
pageSize: 10,
current: 1,
total: 0,
showTotal: total => `共 ${total} 条`,
hideOnSinglePage: false,
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: ['10', '20', '30', '50', '100'],
onChange: (current) => {
pagination.value.current = current
getLeftData()
},
onShowSizeChange: (size) => {
pagination.value.pageSize = size
getLeftData()
}
})
const getLeftData = () => {
leftData.value = [
{ {
productName: '测试产品1', title: '商品名称',
brand: '测试品牌1', dataIndex: 'productName',
goodsNo: '213651', key: 'productName',
spec: '100ml', width: '25%',
sysid: '1' align: 'center',
}, },
{ { title: '品牌', dataIndex: 'brand', key: 'brand', width: '25%', align: 'center' },
productName: '测试产品2', { title: '货号', dataIndex: 'goodsNo', key: 'goodsNo', width: '20%', align: 'center' },
brand: '测试品牌2', { title: '规格', dataIndex: 'spec', key: 'spec', width: '20%', align: 'center' },
goodsNo: '213652', ];
spec: '100ml', const pagination = ref({
sysid: '2' size: 'small',
pageSize: 10,
current: 1,
total: 0,
showTotal: (total) => `共 ${total} 条`,
hideOnSinglePage: false,
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: ['10', '20', '30', '50', '100'],
onChange: (current) => {
pagination.value.current = current;
getLeftData();
},
onShowSizeChange: (size) => {
pagination.value.pageSize = size;
getLeftData();
}, },
});
const getLeftData = () => {
leftData.value = [
{
productName: '测试产品1',
brand: '测试品牌1',
goodsNo: '213651',
spec: '100ml',
sysid: '1',
},
{
productName: '测试产品2',
brand: '测试品牌2',
goodsNo: '213652',
spec: '100ml',
sysid: '2',
},
{
productName: '测试产品3',
brand: '测试品牌3',
goodsNo: '213653',
spec: '100ml',
sysid: '3',
},
{
productName: '测试产品4',
brand: '测试品牌4',
goodsNo: '213654',
spec: '100ml',
sysid: '4',
},
{
productName: '测试产品5',
brand: '测试品牌5',
goodsNo: '213655',
spec: '100ml',
sysid: '5',
choice: true,
},
{
productName: '测试产品6',
brand: '测试品牌6',
goodsNo: '213656',
spec: '100ml',
sysid: '6',
choice: true,
},
];
if (rightData.value.length > 0) {
for (let i = 0; i < rightData.value.length; i++) {
if (
leftData.value.findIndex(
(v) =>
v.brand + v.goodsNo + v.spec ===
rightData.value[i].brand + rightData.value[i].goodsNo + rightData.value[i].spec,
) !== -1
) {
leftData.value.find(
(v) =>
v.brand + v.goodsNo + v.spec ===
rightData.value[i].brand + rightData.value[i].goodsNo + rightData.value[i].spec,
).choice = true;
}
}
}
leftData.value = [...leftData.value];
pagination.value.total = leftData.value.length;
};
let selectedRowKeys = ref<any[]>([]);
let selectedRows = ref<any[]>([]);
const rowSelection = computed(() => {
return {
selectedRowKeys: selectedRowKeys.value,
onChange: (RowKeys, Rows) => {
selectedRowKeys.value = RowKeys;
selectedRows.value = Rows;
},
getCheckboxProps: (record) => ({
disabled: record.choice === true,
}),
};
});
const toRight = () => {
console.log(selectedRows.value);
let arr = JSON.parse(JSON.stringify(selectedRows.value));
rightData.value = [...arr, ...rightData.value];
for (let i = 0; i < selectedRows.value.length; i++) {
if (
leftData.value.findIndex(
(v) =>
v.brand + v.goodsNo + v.spec ===
selectedRows.value[i].brand +
selectedRows.value[i].goodsNo +
selectedRows.value[i].spec,
) !== -1
) {
leftData.value.find(
(v) =>
v.brand + v.goodsNo + v.spec ===
selectedRows.value[i].brand +
selectedRows.value[i].goodsNo +
selectedRows.value[i].spec,
).choice = true;
}
}
leftData.value = [...leftData.value];
selectedRowKeys.value = [];
selectedRows.value = [];
};
const rightData = ref<any[]>([]);
const rightSelectedRowKeys = ref<any[]>([]);
const rightSelectedRows = ref<any[]>([]);
const rightRowSelection = computed(() => {
return {
selectedRowKeys: rightSelectedRowKeys.value,
onChange: (RowKeys, Rows) => {
rightSelectedRowKeys.value = RowKeys;
rightSelectedRows.value = Rows;
},
};
});
const toLeft = () => {
for (let i = 0; i < rightSelectedRows.value.length; i++) {
if (
leftData.value.findIndex(
(v) =>
v.brand + v.goodsNo + v.spec ===
rightSelectedRows.value[i].brand +
rightSelectedRows.value[i].goodsNo +
rightSelectedRows.value[i].spec,
) !== -1
) {
leftData.value.find(
(v) =>
v.brand + v.goodsNo + v.spec ===
rightSelectedRows.value[i].brand +
rightSelectedRows.value[i].goodsNo +
rightSelectedRows.value[i].spec,
).choice = false;
rightData.value.splice(
rightData.value.findIndex(
(v) =>
v.brand + v.goodsNo + v.spec ==
rightSelectedRows.value[i].brand +
rightSelectedRows.value[i].goodsNo +
rightSelectedRows.value[i].spec,
),
1,
);
} else {
rightData.value.splice(
rightData.value.findIndex(
(v) =>
v.brand + v.goodsNo + v.spec ==
rightSelectedRows.value[i].brand +
rightSelectedRows.value[i].goodsNo +
rightSelectedRows.value[i].spec,
),
1,
);
}
}
leftData.value = [...leftData.value];
rightData.value = [...rightData.value];
rightSelectedRowKeys.value = [];
rightSelectedRows.value = [];
};
const rowClassName = () => {
return 'table-back';
};
let loading = ref(false);
let addressLoading = ref(false);
const goNext = async () => {
if (!rightData.value.length) return message.error('请先选择商品');
addressVisible.value = true;
addressLoading.value = true;
const res = await regionalSpotManageGetAreaListApi({});
if (res.code === 20000) {
areaList.value = res.data;
} else {
areaList.value = [];
}
addressLoading.value = false;
};
// ==================================================
const confirmLoading = ref(false);
const addressVisible = ref(false);
const checkboxValue = ref([]);
const areaList = ref<any[]>([
{ {
productName: '测试产品3', id: '0',
brand: '测试品牌3', provinceId: '0',
goodsNo: '213653', province: '北京市',
spec: '100ml', cityId: 0,
sysid: '3' city: '市辖区',
creator: '',
creationTime: '',
}, },
{ {
productName: '测试产品4', id: '1',
brand: '测试品牌4', provinceId: '1',
goodsNo: '213654', province: '河北省',
spec: '100ml', cityId: 1,
sysid: '4' city: '保定市',
creator: '',
creationTime: '',
}, },
{ {
productName: '测试产品5', id: '2',
brand: '测试品牌5', provinceId: '2',
goodsNo: '213655', province: '河北省',
spec: '100ml', cityId: 2,
sysid: '5', city: '石家庄市',
choice: true creator: '',
creationTime: '',
}, },
{ {
productName: '测试产品6', id: '3',
brand: '测试品牌6', provinceId: '3',
goodsNo: '213656', province: '河北省',
spec: '100ml', cityId: 3,
sysid: '6', city: '秦皇岛市',
choice: true creator: '',
} creationTime: '',
]
if (rightData.value.length > 0) {
for (let i = 0; i < rightData.value.length; i++) {
if (leftData.value.findIndex((v) => v.brand + v.goodsNo + v.spec === rightData.value[i].brand + rightData.value[i].goodsNo + rightData.value[i].spec) !== -1) {
leftData.value.find((v) => v.brand + v.goodsNo + v.spec === rightData.value[i].brand + rightData.value[i].goodsNo + rightData.value[i].spec).choice = true
}
}
}
leftData.value = [...leftData.value]
pagination.value.total = leftData.value.length
}
let selectedRowKeys = ref<any[]>([])
let selectedRows = ref<any[]>([])
const rowSelection = computed(() => {
return {
selectedRowKeys: selectedRowKeys.value,
onChange: (RowKeys, Rows) => {
selectedRowKeys.value = RowKeys
selectedRows.value = Rows
}, },
getCheckboxProps: (record) => ({ {
disabled: record.choice === true, id: '4',
}), provinceId: '4',
} province: '河北省',
}) cityId: 3,
const toRight = () => { city: '承德市',
console.log(selectedRows.value); creator: '',
let arr = JSON.parse(JSON.stringify(selectedRows.value)) creationTime: '',
rightData.value = [...arr, ...rightData.value]
for (let i = 0; i < selectedRows.value.length; i++) {
if (leftData.value.findIndex((v) => v.brand + v.goodsNo + v.spec === selectedRows.value[i].brand + selectedRows.value[i].goodsNo + selectedRows.value[i].spec) !== -1) {
leftData.value.find((v) => v.brand + v.goodsNo + v.spec === selectedRows.value[i].brand + selectedRows.value[i].goodsNo + selectedRows.value[i].spec).choice = true
}
}
leftData.value = [...leftData.value]
selectedRowKeys.value = []
selectedRows.value = []
}
const rightData = ref<any[]>([])
const rightSelectedRowKeys = ref<any[]>([])
const rightSelectedRows = ref<any[]>([])
const rightRowSelection = computed(() => {
return {
selectedRowKeys: rightSelectedRowKeys.value,
onChange: (RowKeys, Rows) => {
rightSelectedRowKeys.value = RowKeys
rightSelectedRows.value = Rows
}, },
} ]);
}) const handleCancel = () => {
const toLeft = () => { addressVisibleClose();
for (let i = 0; i < rightSelectedRows.value.length; i++) { };
if (leftData.value.findIndex((v) => v.brand + v.goodsNo + v.spec === rightSelectedRows.value[i].brand + rightSelectedRows.value[i].goodsNo + rightSelectedRows.value[i].spec) !== -1) { const goPrevious = () => {
leftData.value.find((v) => v.brand + v.goodsNo + v.spec === rightSelectedRows.value[i].brand + rightSelectedRows.value[i].goodsNo + rightSelectedRows.value[i].spec).choice = false addressVisibleClose();
rightData.value.splice( };
rightData.value.findIndex((v) => v.brand + v.goodsNo + v.spec == rightSelectedRows.value[i].brand + rightSelectedRows.value[i].goodsNo + rightSelectedRows.value[i].spec), const addressVisibleClose = () => {
1 addressVisible.value = false;
) checkboxValue.value = [];
};
const confirm = async () => {
if (!checkboxValue.value.length) return message.error('请选择现货区域');
const param = ref<{ [key: string]: any }>({
products: [],
areas: '',
});
param.value.products = rightData.value.map((v) => {
return {
goodsNo: v.goodsNo,
brand: v.brand,
spec: v.spec,
ghscode: ghsCode,
};
});
param.value.areas = checkboxValue.value.join;
console.log(param.value);
confirmLoading.value = true;
const res = await regionalSpotManageOpsAddProductApi(param.value);
if (res.code === 20000) {
message.success('新增成功');
addressVisibleClose();
emit('close', false);
} else { } else {
rightData.value.splice( message.error(res.message);
rightData.value.findIndex((v) => v.brand + v.goodsNo + v.spec == rightSelectedRows.value[i].brand + rightSelectedRows.value[i].goodsNo + rightSelectedRows.value[i].spec),
1
)
} }
} confirmLoading.value = false;
leftData.value = [...leftData.value] };
rightData.value = [...rightData.value]
rightSelectedRowKeys.value = []
rightSelectedRows.value = []
}
const rowClassName = () => {
return 'table-back'
}
let loading = ref(false)
let addressLoading = ref(false)
const goNext = async () => {
if(!rightData.value.length) return message.error('请先选择商品');
addressVisible.value = true
addressLoading.value = true
const res = await regionalSpotManageGetAreaListApi({});
if (res.code === 20000) {
areaList.value = res.data
} else {
areaList.value = []
}
addressLoading.value = false
}
// ==================================================
const confirmLoading = ref(false)
const addressVisible = ref(false)
const checkboxValue = ref([])
const areaList = ref<any[]>([
{
"id": "0",
"provinceId": "0",
"province": '北京市',
"cityId": 0,
"city": '市辖区',
"creator": '',
"creationTime": ''
},
{
"id": "1",
"provinceId": "1",
"province": '河北省',
"cityId": 1,
"city": '保定市',
"creator": '',
"creationTime": ''
},
{
"id": "2",
"provinceId": "2",
"province": '河北省',
"cityId": 2,
"city": '石家庄市',
"creator": '',
"creationTime": ''
},
{
"id": "3",
"provinceId": "3",
"province": '河北省',
"cityId": 3,
"city": '秦皇岛市',
"creator": '',
"creationTime": ''
},
{
"id": "4",
"provinceId": "4",
"province": '河北省',
"cityId": 3,
"city": '承德市',
"creator": '',
"creationTime": ''
}
])
const handleCancel = () => {
addressVisibleClose()
}
const goPrevious = () => {
addressVisibleClose()
}
const addressVisibleClose = () => {
addressVisible.value = false
checkboxValue.value = []
}
const confirm = async () => {
if(!checkboxValue.value.length) return message.error('请选择现货区域')
const param = ref<{ [key: string]: any }>({
products: [],
areas: ''
})
param.value.products = rightData.value.map(v => {
return {
goodsNo: v.goodsNo,
brand: v.brand,
spec: v.spec,
ghscode: ghsCode
}
})
param.value.areas = checkboxValue.value.join
console.log(param.value);
confirmLoading.value = true
const res = await regionalSpotManageOpsAddProductApi(param.value);
if (res.code === 20000) {
message.success('新增成功')
addressVisibleClose()
emit('close', false)
} else {
message.error(res.message)
}
confirmLoading.value = false
}
</script> </script>
<template> <template>
<a-modal :visible="true" title="新增区域现货商品" :width="1200" @cancel="closeModal" :maskClosable="false" :keyboard="false"> <a-modal
:visible="true"
title="新增区域现货商品"
:width="1200"
@cancel="closeModal"
:maskClosable="false"
:keyboard="false"
>
<template #footer> <template #footer>
<a-button key="back" @click="closeModal">取消</a-button> <a-button key="back" @click="closeModal">取消</a-button>
<a-button key="submit" type="primary" :loading="loading" @click="goNext">下一步</a-button> <a-button key="submit" type="primary" :loading="loading" @click="goNext">下一步</a-button>
...@@ -297,14 +357,24 @@ const confirm = async () => { ...@@ -297,14 +357,24 @@ const confirm = async () => {
:not-found-content="null" :not-found-content="null"
@search="handleSearch" @search="handleSearch"
> >
<a-select-option v-for="item in searchBrandList" :key="item.value" :label="item.label" :value="item.value"> <a-select-option
v-for="item in searchBrandList"
:key="item.value"
:label="item.label"
:value="item.value"
>
{{ item.label }} {{ item.label }}
</a-select-option> </a-select-option>
</a-select> </a-select>
<span style="margin-left: 15px">货号:</span> <span style="margin-left: 15px">货号:</span>
<Input v-model:value="searchItemNo" allow-clear placeholder="请输入货号" style="width: 200px" /> <Input
<Button style="margin-left:10px">重置</Button> v-model:value="searchItemNo"
<Button @click="getLeftData" type="primary" style="margin-left:10px">查询</Button> allow-clear
placeholder="请输入货号"
style="width: 200px"
/>
<Button style="margin-left: 10px">重置</Button>
<Button @click="getLeftData" type="primary" style="margin-left: 10px">查询</Button>
</div> </div>
<div class="main"> <div class="main">
<div class="left"> <div class="left">
...@@ -333,16 +403,16 @@ const confirm = async () => { ...@@ -333,16 +403,16 @@ const confirm = async () => {
</div> </div>
</div> </div>
<div class="operate"> <div class="operate">
<div style="margin-top: 200px;display:flex"> <div style="margin-top: 200px; display: flex">
<a-button <a-button
@click="toLeft" @click="toLeft"
type="primary" type="primary"
:disabled="rightSelectedRowKeys.length === 0" :disabled="rightSelectedRowKeys.length === 0"
style="display: block; margin-bottom: 10px;margin-right:10px" style="display: block; margin-bottom: 10px; margin-right: 10px"
> >
<template #icon> <template #icon>
<LeftOutlined /> <LeftOutlined />
</template> </template>
</a-button> </a-button>
<a-button <a-button
@click="toRight" @click="toRight"
...@@ -370,13 +440,20 @@ const confirm = async () => { ...@@ -370,13 +440,20 @@ const confirm = async () => {
:scroll="{ x: false, y: 280 }" :scroll="{ x: false, y: 280 }"
:rowClassName="rowClassName" :rowClassName="rowClassName"
:row-selection="rightRowSelection" :row-selection="rightRowSelection"
> />
</a-table>
</div> </div>
</div> </div>
</div> </div>
</a-modal> </a-modal>
<a-modal v-model:visible="addressVisible" title="新增区域现货商品" @cancel="handleCancel" @ok="confirm" :width="1200" :maskClosable="false" :keyboard="false"> <a-modal
v-model:visible="addressVisible"
title="新增区域现货商品"
@cancel="handleCancel"
@ok="confirm"
:width="1200"
:maskClosable="false"
:keyboard="false"
>
<template #footer> <template #footer>
<a-button :loading="confirmLoading" @click="handleCancel">取消</a-button> <a-button :loading="confirmLoading" @click="handleCancel">取消</a-button>
<a-button :loading="confirmLoading" @click="goPrevious">上一步</a-button> <a-button :loading="confirmLoading" @click="goPrevious">上一步</a-button>
...@@ -384,10 +461,12 @@ const confirm = async () => { ...@@ -384,10 +461,12 @@ const confirm = async () => {
</template> </template>
<a-alert type="warning"> <a-alert type="warning">
<template #message> <template #message>
<span style="color: red">特别提醒:</span>北京市-直辖市;天津市-直辖市。本次设置为,北京市-直辖市;四川省-成都市。提交后,商品现货区域将更新为 北京市-直辖市;天津市-直辖市;四川省-成都市。 <span style="color: red">特别提醒:</span
>北京市-直辖市;天津市-直辖市。本次设置为,北京市-直辖市;四川省-成都市。提交后,商品现货区域将更新为
北京市-直辖市;天津市-直辖市;四川省-成都市。
</template> </template>
</a-alert> </a-alert>
<a-spin v-if="addressLoading" style="height: 150px;width: 100%;line-height: 150px" /> <a-spin v-if="addressLoading" style="height: 150px; width: 100%; line-height: 150px" />
<div v-else> <div v-else>
<p style="margin-top: 15px">选择现货区域:</p> <p style="margin-top: 15px">选择现货区域:</p>
<a-checkbox-group v-model:value="checkboxValue" style="width: 100%"> <a-checkbox-group v-model:value="checkboxValue" style="width: 100%">
...@@ -402,46 +481,46 @@ const confirm = async () => { ...@@ -402,46 +481,46 @@ const confirm = async () => {
</template> </template>
<style lang="less" scoped> <style lang="less" scoped>
.main { .main {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
width: 100%; width: 100%;
margin-top: 15px; margin-top: 15px;
.left { .left {
width: 45%; width: 45%;
border: 1px solid #ddd; border: 1px solid #ddd;
height: 450px; height: 450px;
.header { .header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 0 10px; padding: 0 10px;
height: 60px; height: 60px;
background: #F3F6F9 background: #f3f6f9;
}
} }
} .right {
.right { width: 45%;
width: 45%; border: 1px solid #ddd;
border: 1px solid #ddd; height: 450px;
height: 450px; .header {
.header { display: flex;
justify-content: space-between;
align-items: center;
padding: 0 10px;
height: 60px;
background: #f3f6f9;
}
}
.operate {
width: 10%;
height: 450px;
display: flex; display: flex;
justify-content: space-between; justify-content: center;
align-items: center; align-content: center;
padding: 0 10px;
height: 60px;
background: #F3F6F9
} }
} }
.operate { /deep/.table-back {
width: 10%; background-color: #fff;
height: 450px;
display: flex;
justify-content: center;
align-content: center;
} }
} </style>
/deep/.table-back {
background-color: #fff;
}
</style>
\ No newline at end of file
<script lang="ts" setup> <script lang="ts" setup>
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
import { import {
Form, Form,
FormItem, FormItem,
Input, Input,
Button, Button,
Select, Select,
SelectOption, SelectOption,
Row, Row,
Col, Col,
message, message,
} from 'ant-design-vue'; } from 'ant-design-vue';
import { UploadOutlined } from '@ant-design/icons-vue'; import { UploadOutlined } from '@ant-design/icons-vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { getAuthCache } from '/@/utils/auth'; import { getAuthCache } from '/@/utils/auth';
import { import {
regionalSpotManageBrandListApi, regionalSpotManageBrandListApi,
regionalSpotManageListApi, regionalSpotManageListApi,
regionalSpotManageGetAreaListApi, regionalSpotManageGetAreaListApi,
regionalSpotManageGetGhsAreaListApi, regionalSpotManageGetGhsAreaListApi,
regionalSpotManageOpsDeleteProductApi, regionalSpotManageOpsDeleteProductApi,
regionalSpotManageOpsEditProductApi, regionalSpotManageOpsEditProductApi,
regionalSpotManageUploadOpsProductApi regionalSpotManageUploadOpsProductApi,
} from '/@/api/regionalSpotManage'; } from '/@/api/regionalSpotManage';
import addProductModal from './addProduct.vue' import addProductModal from './addProduct.vue';
const config = import.meta.env const config = import.meta.env;
const userInfo: any = getAuthCache('USER__INFO__') const userInfo: any = getAuthCache('USER__INFO__');
const ghsCode = userInfo.supplier.ghsCode const ghsCode = userInfo.supplier.ghsCode;
const router = useRouter(); const router = useRouter();
const list = ref<any[]>([]) const list = ref<any[]>([]);
onMounted(async () => { onMounted(async () => {
getList() getList();
getAllAreaList() getAllAreaList();
}); });
const searchForm = ref<{ const searchForm = ref<{
brandList: any; brandList: any;
goodsNo: any; goodsNo: any;
areaIds: any; areaIds: any;
types: any; types: any;
}>({ }>({
brandList: [], brandList: [],
goodsNo: '', goodsNo: '',
areaIds: [], areaIds: [],
types: [] types: [],
}); });
const areaIdsOption = ref([ const areaIdsOption = ref([
{ label: '区域1', value: '区域1' }, { label: '区域1', value: '区域1' },
{ label: '区域2', value: '区域2' }, { label: '区域2', value: '区域2' },
]) ]);
const typesOption = ref([ const typesOption = ref([
{ label: '组1', value: '组1' }, { label: '组1', value: '组1' },
{ label: '组2', value: '组2' }, { label: '组2', value: '组2' },
]) ]);
let searchBrandList = ref<any[]>([]) let searchBrandList = ref<any[]>([]);
const handleSearch = async (value) => { const handleSearch = async (value) => {
const res = await regionalSpotManageBrandListApi({brand: value}); const res = await regionalSpotManageBrandListApi({ brand: value });
if (res.code === 20000) { if (res.code === 20000) {
searchBrandList.value = res.data searchBrandList.value = res.data;
} else { } else {
searchBrandList.value = [] searchBrandList.value = [];
} }
} };
let listLoading = ref(false) let listLoading = ref(false);
const pagination = ref({ const pagination = ref({
pageSize: 10, pageSize: 10,
current: 1, current: 1,
total: 0, total: 0,
showTotal: total => `共 ${total} 条`, showTotal: (total) => `共 ${total} 条`,
hideOnSinglePage: false, hideOnSinglePage: false,
showQuickJumper: true, showQuickJumper: true,
showSizeChanger: true, showSizeChanger: true,
pageSizeOptions: ['10', '20', '30', '50', '100'], pageSizeOptions: ['10', '20', '30', '50', '100'],
onChange: (current) => { onChange: (current) => {
pagination.value.current = current pagination.value.current = current;
getList() getList();
},
onShowSizeChange: (size) => {
pagination.value.pageSize = size
getList()
}
})
const getList = async () => {
const pager = ref({
pageIndex: 1,
pageSize: 10
})
const param = ref({
...searchForm.value,
...pager.value
})
param.value.areaIds = param.value.areaIds ? param.value.areaIds : []
param.value.types = param.value.types ? param.value.types : []
listLoading.value = true
const res = await regionalSpotManageListApi(param.value);
if (res.code === 20000) {
list.value = res.data
pagination.value.total = res.data[0].total
} else {
list.value = []
pagination.value.total = 0
}
listLoading.value = false
list.value = [
{
productName: '测试商品',
brand: '测试品牌',
goodsNo: '45641',
spec: '100ml',
productStatus: '上架',
sysid: '1'
}, },
{ onShowSizeChange: (size) => {
productName: 'ffff', pagination.value.pageSize = size;
brand: 'fff', getList();
goodsNo: 'fff', },
spec: 'ff', });
productStatus: '上架', const getList = async () => {
sysid: '2' const pager = ref({
pageIndex: 1,
pageSize: 10,
});
const param = ref({
...searchForm.value,
...pager.value,
});
param.value.areaIds = param.value.areaIds ? param.value.areaIds : [];
param.value.types = param.value.types ? param.value.types : [];
listLoading.value = true;
const res = await regionalSpotManageListApi(param.value);
if (res.code === 20000) {
list.value = res.data;
pagination.value.total = res.data[0].total;
} else {
list.value = [];
pagination.value.total = 0;
} }
] listLoading.value = false;
} list.value = [
const onRset = () => { {
searchForm.value.brandList = [] productName: '测试商品',
searchForm.value.goodsNo = '' brand: '测试品牌',
searchForm.value.areaIds = [] goodsNo: '45641',
searchForm.value.types = [] spec: '100ml',
getList() productStatus: '上架',
} sysid: '1',
const onSearch = () => { },
pagination.value.pageSize = 1 {
getList() productName: 'ffff',
} brand: 'fff',
goodsNo: 'fff',
spec: 'ff',
productStatus: '上架',
sysid: '2',
},
];
};
const onRset = () => {
searchForm.value.brandList = [];
searchForm.value.goodsNo = '';
searchForm.value.areaIds = [];
searchForm.value.types = [];
getList();
};
const onSearch = () => {
pagination.value.pageSize = 1;
getList();
};
let showModal = ref(false) let showModal = ref(false);
const addProduct = () => { const addProduct = () => {
showModal.value = true showModal.value = true;
} };
// 关闭新增商品弹窗 // 关闭新增商品弹窗
const closeVisible = (val) => { const closeVisible = (val) => {
showModal.value = val showModal.value = val;
} };
let curItem = ref<{ [key: string]: any }>({}); let curItem = ref<{ [key: string]: any }>({});
// =========查看区域现货 statr =========== // =========查看区域现货 statr ===========
const loading1 = ref(false) const loading1 = ref(false);
const visible = ref(false) const visible = ref(false);
const regionalSpotGoods = ref([]) const regionalSpotGoods = ref([]);
const viewCurrent = async (val) => { const viewCurrent = async (val) => {
curItem.value = val curItem.value = val;
visible.value = true visible.value = true;
const param = ref<{ [key: string]: any }>({ const param = ref<{ [key: string]: any }>({
products: [{ products: [
goodsNo: val.goodsNo, {
brand: val.brand, goodsNo: val.goodsNo,
spec: val.spec, brand: val.brand,
ghscode: ghsCode spec: val.spec,
}], ghscode: ghsCode,
}) },
console.log(param.value); ],
loading1.value = true });
const result = await getAreaList(param.value) console.log(param.value);
regionalSpotGoods.value = result loading1.value = true;
loading1.value = false const result = await getAreaList(param.value);
} regionalSpotGoods.value = result;
const getAreaList = async (param) => { loading1.value = false;
const res = await regionalSpotManageGetGhsAreaListApi(param); };
if (res.code === 20000) { const getAreaList = async (param) => {
return res.data const res = await regionalSpotManageGetGhsAreaListApi(param);
} else { if (res.code === 20000) {
return [] return res.data;
} } else {
} return [];
// ==========查看区域现货 end ============= }
};
// ==========查看区域现货 end =============
let selectedRowKeys = ref([]) let selectedRowKeys = ref([]);
let selectedRows = ref<any[]>([]) let selectedRows = ref<any[]>([]);
const onSelectChange = (Keys, Rows) => { const onSelectChange = (Keys, Rows) => {
selectedRowKeys.value = Keys selectedRowKeys.value = Keys;
selectedRows.value = Rows selectedRows.value = Rows;
} };
// ===============增加区域 start======================= // ===============增加区域 start=======================
let addVisible = ref(false) let addVisible = ref(false);
let addAreaLoading = ref(false) let addAreaLoading = ref(false);
let addCheckboxValue = ref(['0']) let addCheckboxValue = ref(['0']);
const addArea = async (row) => { const addArea = async (row) => {
curItem.value = row curItem.value = row;
addVisible.value = true addVisible.value = true;
addAreaLoading.value = true addAreaLoading.value = true;
const param = ref<{ [key: string]: any }>({ const param = ref<{ [key: string]: any }>({
products: [{ products: [
goodsNo: row.goodsNo, {
brand: row.brand, goodsNo: row.goodsNo,
spec: row.spec, brand: row.brand,
ghscode: ghsCode spec: row.spec,
}], ghscode: ghsCode,
}) },
const result = await getAreaList(param.value) ],
delAreaList.value = result });
const curArr = delAreaList.value.map(it => it.id) const result = await getAreaList(param.value);
for (const k of allAreaList.value) { delAreaList.value = result;
if (curArr.includes(k.id)) { const curArr = delAreaList.value.map((it) => it.id);
addCheckboxValue.value.push(k.id) for (const k of allAreaList.value) {
k.disabled = true if (curArr.includes(k.id)) {
addCheckboxValue.value.push(k.id);
k.disabled = true;
}
} }
} addAreaLoading.value = false;
addAreaLoading.value = false };
} const addVisibleCancel = () => {
const addVisibleCancel = () => { addVisible.value = false;
addVisible.value = false addCheckboxValue.value = [];
addCheckboxValue.value = [] };
} let confirmAddLoading = ref(false);
let confirmAddLoading = ref(false) const confirmAddArea = async () => {
const confirmAddArea = async () => { const param = ref<{ [key: string]: any }>({
const param = ref<{ [key: string]: any }>({ products: [
products: [{ {
goodsNo: curItem.value.goodsNo, goodsNo: curItem.value.goodsNo,
brand: curItem.value.brand, brand: curItem.value.brand,
spec: curItem.value.spec, spec: curItem.value.spec,
ghscode: ghsCode ghscode: ghsCode,
}], },
areas: addCheckboxValue.value.join ],
}) areas: addCheckboxValue.value.join,
confirmAddLoading.value = true });
const res = await regionalSpotManageOpsEditProductApi(param.value); confirmAddLoading.value = true;
if (res.success) { const res = await regionalSpotManageOpsEditProductApi(param.value);
message.success('添加区域成功') if (res.success) {
} else { message.success('添加区域成功');
message.error(res.message) } else {
} message.error(res.message);
confirmAddLoading.value = false }
} confirmAddLoading.value = false;
// ===============增加区域 end======================= };
// ===============增加区域 end=======================
// ================区域现货商品删除 start===================== // ================区域现货商品删除 start=====================
let delVisible = ref(false) let delVisible = ref(false);
let delLoading = ref(false) let delLoading = ref(false);
let deleteNum = ref(0) let deleteNum = ref(0);
let radioValue = ref(1) let radioValue = ref(1);
let delAreaList = ref<any[]>([ let delAreaList = ref<any[]>([
{ {
"id": "0", id: '0',
"provinceId": "0", provinceId: '0',
"province": '北京市', province: '北京市',
"cityId": 0, cityId: 0,
"city": '市辖区', city: '市辖区',
"creator": '', creator: '',
"creationTime": '' creationTime: '',
}, },
{ {
"id": "1", id: '1',
"provinceId": "1", provinceId: '1',
"province": '河北省', province: '河北省',
"cityId": 1, cityId: 1,
"city": '保定市', city: '保定市',
"creator": '', creator: '',
"creationTime": '' creationTime: '',
}, },
])//已添加的区域 ]); //已添加的区域
let delCheckboxValue = ref([]) let delCheckboxValue = ref([]);
const del = async (val) => { const del = async (val) => {
curItem.value = val curItem.value = val;
deleteNum.value = 1 deleteNum.value = 1;
delVisible.value = true delVisible.value = true;
const param = ref<{ [key: string]: any }>({ const param = ref<{ [key: string]: any }>({
products: [{ products: [
goodsNo: val.goodsNo, {
brand: val.brand, goodsNo: val.goodsNo,
spec: val.spec, brand: val.brand,
ghscode: ghsCode spec: val.spec,
}], ghscode: ghsCode,
}) },
console.log(param.value); ],
// delLoading.value = true });
// const result = await getAreaList(param.value) console.log(param.value);
// delAreaList.value = result // delLoading.value = true
// delLoading.value = false // const result = await getAreaList(param.value)
} // delAreaList.value = result
const delVisibleCancel = () => { // delLoading.value = false
delVisible.value = false };
deleteNum.value = 0 const delVisibleCancel = () => {
radioValue.value = 1 delVisible.value = false;
delCheckboxValue.value = [] deleteNum.value = 0;
isBatchDel.value = false radioValue.value = 1;
} delCheckboxValue.value = [];
let delConfirLoading = ref(false) isBatchDel.value = false;
const confirmDel = async () => { };
if(radioValue.value === 2 && !delCheckboxValue.value.length) return message.error('请选择需要删除的现货区域') let delConfirLoading = ref(false);
const param = ref<{ [key: string]: any }>({ const confirmDel = async () => {
products: [], if (radioValue.value === 2 && !delCheckboxValue.value.length)
areas: '', return message.error('请选择需要删除的现货区域');
isAll: false const param = ref<{ [key: string]: any }>({
}) products: [],
if (isBatchDel.value) { areas: '',
param.value.products = selectedRows.value.map(v => { isAll: false,
});
if (isBatchDel.value) {
param.value.products = selectedRows.value.map((v) => {
return {
goodsNo: v.goodsNo,
brand: v.brand,
spec: v.spec,
ghscode: ghsCode,
};
});
} else {
param.value.products = [
{
goodsNo: curItem.value.goodsNo,
brand: curItem.value.brand,
spec: curItem.value.spec,
ghscode: ghsCode,
},
];
}
if (radioValue.value === 1) {
param.value.isAll = true;
param.value.areas = delAreaList.value.map((v) => v.id);
} else if (radioValue.value === 2) {
param.value.areas = delCheckboxValue.value;
}
delConfirLoading.value = true;
const res = await regionalSpotManageOpsDeleteProductApi(param.value);
if (res.success) {
message.success('删除成功');
} else {
message.success(res.message);
}
delConfirLoading.value = false;
};
// 批量删除
let isBatchDel = ref(false);
const batchDel = () => {
if (!selectedRowKeys.value.length) return message.error('请勾选商品');
isBatchDel.value = true;
deleteNum.value = selectedRows.value.length;
delVisible.value = true;
const param = ref<{ [key: string]: any }>({
products: [],
});
param.value.products = selectedRows.value.map((v) => {
return { return {
goodsNo: v.goodsNo, goodsNo: v.goodsNo,
brand: v.brand, brand: v.brand,
spec: v.spec, spec: v.spec,
ghscode: ghsCode ghscode: ghsCode,
} };
}) });
} else { // delLoading.value = true
param.value.products = [{ // const result = await getAreaList(param.value)
goodsNo: curItem.value.goodsNo, // delAreaList.value = result
brand: curItem.value.brand, // delLoading.value = false
spec: curItem.value.spec, };
ghscode: ghsCode // ================区域现货商品删除 end=====================
}]
}
if (radioValue.value === 1) {
param.value.isAll = true
param.value.areas = delAreaList.value.map(v => v.id)
} else if (radioValue.value === 2) {
param.value.areas = delCheckboxValue.value
}
delConfirLoading.value = true
const res = await regionalSpotManageOpsDeleteProductApi(param.value);
if (res.success) {
message.success('删除成功')
} else {
message.success(res.message)
}
delConfirLoading.value = false
}
// 批量删除
let isBatchDel = ref(false)
const batchDel = () => {
if(!selectedRowKeys.value.length) return message.error('请勾选商品')
isBatchDel.value = true
deleteNum.value = selectedRows.value.length
delVisible.value = true
const param = ref<{ [key: string]: any }>({
products: []
})
param.value.products = selectedRows.value.map(v => {
return {
goodsNo: v.goodsNo,
brand: v.brand,
spec: v.spec,
ghscode: ghsCode
}
})
// delLoading.value = true
// const result = await getAreaList(param.value)
// delAreaList.value = result
// delLoading.value = false
}
// ================区域现货商品删除 end=====================
let allAreaList = ref<any[]>([ let allAreaList = ref<any[]>([
{ {
"id": "0", id: '0',
"provinceId": "0", provinceId: '0',
"province": '北京市', province: '北京市',
"cityId": 0, cityId: 0,
"city": '市辖区', city: '市辖区',
"creator": '', creator: '',
"creationTime": '', creationTime: '',
disabled: true, disabled: true,
}, },
{ {
"id": "1", id: '1',
"provinceId": "1", provinceId: '1',
"province": '河北省', province: '河北省',
"cityId": 1, cityId: 1,
"city": '保定市', city: '保定市',
"creator": '', creator: '',
"creationTime": '' creationTime: '',
}, },
{ {
"id": "2", id: '2',
"provinceId": "2", provinceId: '2',
"province": '河北省', province: '河北省',
"cityId": 2, cityId: 2,
"city": '石家庄市', city: '石家庄市',
"creator": '', creator: '',
"creationTime": '' creationTime: '',
}, },
{ {
"id": "3", id: '3',
"provinceId": "3", provinceId: '3',
"province": '河北省', province: '河北省',
"cityId": 3, cityId: 3,
"city": '秦皇岛市', city: '秦皇岛市',
"creator": '', creator: '',
"creationTime": '' creationTime: '',
}, },
{ {
"id": "4", id: '4',
"provinceId": "4", provinceId: '4',
"province": '河北省', province: '河北省',
"cityId": 3, cityId: 3,
"city": '承德市', city: '承德市',
"creator": '', creator: '',
"creationTime": '' creationTime: '',
} },
]) ]);
const getAllAreaList = async () => { const getAllAreaList = async () => {
const res = await regionalSpotManageGetAreaListApi({}); const res = await regionalSpotManageGetAreaListApi({});
if (res.success) { if (res.success) {
allAreaList.value = res.data allAreaList.value = res.data;
} else { } else {
allAreaList.value = [] allAreaList.value = [];
} }
} };
// =====================批量导入 start======================= // =====================批量导入 start=======================
let productExcelList = ref<any[]>([]) let productExcelList = ref<any[]>([]);
let importVisible = ref(false) let importVisible = ref(false);
const impotrCheckboxValue = ref([]) const impotrCheckboxValue = ref([]);
const batchImport = () => { const batchImport = () => {
importVisible.value = true importVisible.value = true;
allAreaList.value.forEach(v => { allAreaList.value.forEach((v) => {
v.disabled = false v.disabled = false;
}) });
} };
const productExcelBeforeUpload = (file, fileList) => { const productExcelBeforeUpload = (file, fileList) => {
const isLt8M = file.size / 1024 / 1024 <= 8 const isLt8M = file.size / 1024 / 1024 <= 8;
const extension = file.name.substring(file.name.lastIndexOf('.') + 1) const extension = file.name.substring(file.name.lastIndexOf('.') + 1);
if (!isLt8M) { if (!isLt8M) {
message.error('上传文件大小不能超过 8MB!') message.error('上传文件大小不能超过 8MB!');
return false return false;
} }
if (extension !== 'xls' && extension !== 'xlsx') { if (extension !== 'xls' && extension !== 'xlsx') {
message.error('只能上传excel的文件') message.error('只能上传excel的文件');
return false return false;
} }
let curFileList = [...fileList] let curFileList = [...fileList];
curFileList = curFileList.slice(-1) curFileList = curFileList.slice(-1);
productExcelList.value = curFileList productExcelList.value = curFileList;
return false return false;
} };
const productExcelRemove = () => { const productExcelRemove = () => {
productExcelList.value = [] productExcelList.value = [];
} };
const downLoad = () => { const downLoad = () => {
window.open(config.VITE_GLOB_API_URL, '_blank') window.open(config.VITE_GLOB_API_URL, '_blank');
} };
let importLoading = ref(false) let importLoading = ref(false);
const confirmImport = async () => { const confirmImport = async () => {
if(!productExcelList.value.length) return message.error('请上传文件') if (!productExcelList.value.length) return message.error('请上传文件');
if(!impotrCheckboxValue.value.length) return message.error('请选择现货区域') if (!impotrCheckboxValue.value.length) return message.error('请选择现货区域');
const param: FormData = new FormData(); const param: FormData = new FormData();
param.append('ghsCode', ghsCode) param.append('ghsCode', ghsCode);
param.append('file', productExcelList.value[0]) param.append('file', productExcelList.value[0]);
param.append('areaIds', impotrCheckboxValue.value.join(',')) param.append('areaIds', impotrCheckboxValue.value.join(','));
importLoading.value = true importLoading.value = true;
const res = await regionalSpotManageUploadOpsProductApi(param); const res = await regionalSpotManageUploadOpsProductApi(param);
if (res.code === 20000) { if (res.code === 20000) {
message.success('批量导入成功') message.success('批量导入成功');
} else { } else {
message.error(res.message) message.error(res.message);
} }
importLoading.value = false importLoading.value = false;
} };
const importCancel = () => { const importCancel = () => {
importVisible.value = false importVisible.value = false;
impotrCheckboxValue.value = [] impotrCheckboxValue.value = [];
productExcelList.value = [] productExcelList.value = [];
} };
// =====================批量导入 end======================= // =====================批量导入 end=======================
const goTaskCenter = () => { const goTaskCenter = () => {
router.push({ router.push({
path: '/taskCenter' path: '/taskCenter',
}) });
} };
</script> </script>
<template> <template>
<div> <div>
<div class="body-box"> <div class="body-box">
<Form :model="searchForm" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }" class="top-search"> <Form
:model="searchForm"
:label-col="{ span: 6 }"
:wrapper-col="{ span: 18 }"
class="top-search"
>
<Row :gutter="20"> <Row :gutter="20">
<Col :xxl="4" :xl="6" :lg="8" :sm="12" :xs="24"> <Col :xxl="4" :xl="6" :lg="8" :sm="12" :xs="24">
<FormItem label="品牌名称" name="brandList"> <FormItem label="品牌名称" name="brandList">
<!-- <Input v-model:value="searchForm.brandList" allow-clear placeholder="请输入品牌名称" /> --> <!-- <Input v-model:value="searchForm.brandList" allow-clear placeholder="请输入品牌名称" /> -->
<a-select <a-select
v-model:value="searchForm.brandList" v-model:value="searchForm.brandList"
show-search show-search
mode="multiple" mode="multiple"
placeholder="请输入品牌名称" placeholder="请输入品牌名称"
style="width: 100%" style="width: 100%"
:default-active-first-option="false" :default-active-first-option="false"
:show-arrow="false" :show-arrow="false"
:filter-option="false" :filter-option="false"
:not-found-content="null" :not-found-content="null"
@search="handleSearch" @search="handleSearch"
> >
<a-select-option v-for="item in searchBrandList" :key="item.value" :label="item.label" :value="item.value"> <a-select-option
{{ item.label }} v-for="item in searchBrandList"
</a-select-option> :key="item.value"
</a-select> :label="item.label"
</FormItem> :value="item.value"
>
{{ item.label }}
</a-select-option>
</a-select>
</FormItem>
</Col> </Col>
<Col :xxl="4" :xl="6" :lg="8" :sm="12" :xs="24"> <Col :xxl="4" :xl="6" :lg="8" :sm="12" :xs="24">
<FormItem label="货号" name="goodsNo"> <FormItem label="货号" name="goodsNo">
<Input v-model:value="searchForm.goodsNo" allow-clear placeholder="请输入货号" /> <Input v-model:value="searchForm.goodsNo" allow-clear placeholder="请输入货号" />
</FormItem> </FormItem>
</Col> </Col>
<Col :xxl="4" :xl="6" :lg="8" :sm="12" :xs="24"> <Col :xxl="4" :xl="6" :lg="8" :sm="12" :xs="24">
<FormItem label="现货区域" name="areaIds"> <FormItem label="现货区域" name="areaIds">
<Select v-model:value="searchForm.areaIds" allowClear mode="multiple" placeholder="请选择现货区域" style="width: 100%"> <Select
<SelectOption v-for="(item, index) in areaIdsOption" :key="index" :value="item.value">{{ item.label }}</SelectOption> v-model:value="searchForm.areaIds"
</Select> allowClear
</FormItem> mode="multiple"
placeholder="请选择现货区域"
style="width: 100%"
>
<SelectOption
v-for="(item, index) in areaIdsOption"
:key="index"
:value="item.value"
>{{ item.label }}</SelectOption
>
</Select>
</FormItem>
</Col> </Col>
<Col :xxl="4" :xl="6" :lg="8" :sm="12" :xs="24"> <Col :xxl="4" :xl="6" :lg="8" :sm="12" :xs="24">
<FormItem label="商品分组" name="types"> <FormItem label="商品分组" name="types">
<Select v-model:value="searchForm.types" allowClear mode="multiple" placeholder="请选择商品分组" style="width: 100%"> <Select
<SelectOption v-for="(item, index) in typesOption" :key="index" :value="item.value">{{ item.label }}</SelectOption> v-model:value="searchForm.types"
</Select> allowClear
</FormItem> mode="multiple"
placeholder="请选择商品分组"
style="width: 100%"
>
<SelectOption
v-for="(item, index) in typesOption"
:key="index"
:value="item.value"
>{{ item.label }}</SelectOption
>
</Select>
</FormItem>
</Col> </Col>
<Col :span="24" style="display: flex;justify-content: space-between;"> <Col :span="24" style="display: flex; justify-content: space-between">
<div> <div>
<Button type="primary" style="margin: 0 5px" @click="onSearch">查询</Button> <Button type="primary" style="margin: 0 5px" @click="onSearch">查询</Button>
<Button style="margin: 0 5px" @click="onRset">重置</Button> <Button style="margin: 0 5px" @click="onRset">重置</Button>
...@@ -525,94 +568,121 @@ const goTaskCenter = () => { ...@@ -525,94 +568,121 @@ const goTaskCenter = () => {
</Col> </Col>
</Row> </Row>
</Form> </Form>
<a-table <a-table
:data-source="list" :data-source="list"
:loading="listLoading" :loading="listLoading"
bordered bordered
:pagination="pagination" :pagination="pagination"
:rowKey="(record) => record.sysid" :rowKey="(record) => record.sysid"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange, columnWidth: 65 }" :row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: onSelectChange,
columnWidth: 65,
}"
style="margin-top: 15px" style="margin-top: 15px"
> >
<a-table-column title="商品名称" align="center" :width="100"> <a-table-column title="商品名称" align="center" :width="100">
<template v-slot="{record}"> <template v-slot="{ record }">
{{ record.productName }} {{ record.productName }}
</template> </template>
</a-table-column> </a-table-column>
<a-table-column title="品牌" align="center" :width="100"> <a-table-column title="品牌" align="center" :width="100">
<template v-slot="{record}"> <template v-slot="{ record }">
{{ record.brand }} {{ record.brand }}
</template> </template>
</a-table-column> </a-table-column>
<a-table-column title="货号" align="center" :width="100"> <a-table-column title="货号" align="center" :width="100">
<template v-slot="{record}"> <template v-slot="{ record }">
{{ record.goodsNo }} {{ record.goodsNo }}
</template> </template>
</a-table-column> </a-table-column>
<a-table-column title="规格" align="center" :width="100"> <a-table-column title="规格" align="center" :width="100">
<template v-slot="{record}"> <template v-slot="{ record }">
{{ record.spec }} {{ record.spec }}
</template> </template>
</a-table-column> </a-table-column>
<a-table-column title="当前现货区域" align="center" :width="100"> <a-table-column title="当前现货区域" align="center" :width="100">
<template v-slot="{record}"> <template v-slot="{ record }">
<Button type="link" @click="viewCurrent(record)">查看区域现货</Button> <Button type="link" @click="viewCurrent(record)">查看区域现货</Button>
</template> </template>
</a-table-column> </a-table-column>
<a-table-column title="上架状态" align="center" :width="100"> <a-table-column title="上架状态" align="center" :width="100">
<template v-slot="{record}"> <template v-slot="{ record }">
{{ record.productStatus }} {{ record.productStatus }}
</template> </template>
</a-table-column> </a-table-column>
<a-table-column title="操作" align="center" :width="200"> <a-table-column title="操作" align="center" :width="200">
<template v-slot="{record}"> <template #default="{ record }">
<Button type="link" @click="addArea(record)">增加区域</Button> <Button type="link" @click="addArea(record)">增加区域</Button>
<Button type="link" style="margin-left: 5px" @click="del(record)">删除</Button> <Button type="link" style="margin-left: 5px" @click="del(record)">删除</Button>
</template> </template>
</a-table-column> </a-table-column>
</a-table> </a-table>
</div> </div>
<addProductModal v-if="showModal" @close="closeVisible"></addProductModal> <addProductModal v-if="showModal" @close="closeVisible" />
<a-modal v-model:visible="visible" title="商品可提供现货区域查看" :width="600" @ok="visible = false" :footer="null" :maskClosable="false" okText="提交"> <a-modal
v-model:visible="visible"
title="商品可提供现货区域查看"
:width="600"
@ok="visible = false"
:footer="null"
:maskClosable="false"
okText="提交"
>
<div style="margin-top: -35px">商品名称:{{ curItem.productName }}</div> <div style="margin-top: -35px">商品名称:{{ curItem.productName }}</div>
<div>商品品牌:{{ curItem.brand }}</div> <div>商品品牌:{{ curItem.brand }}</div>
<div>商品货号:{{ curItem.goodsNo }}</div> <div>商品货号:{{ curItem.goodsNo }}</div>
<div>商品规格:{{ curItem.spec }}</div> <div>商品规格:{{ curItem.spec }}</div>
<a-table <a-table
:data-source="regionalSpotGoods" :data-source="regionalSpotGoods"
bordered bordered
:loading="loading1" :loading="loading1"
:pagination="false" :pagination="false"
:rowKey="(record) => record.sysid" :rowKey="(record) => record.sysid"
style="margin-top: 15px" style="margin-top: 15px"
> >
<a-table-column title="区域" align="center" :width="100"> <a-table-column title="区域" align="center" :width="100">
<template v-slot="{record}"> <template v-slot="{ record }"> {{ record.provinceName }}-{{ record.cityName }} </template>
{{ record.provinceName }}-{{ record.cityName }}
</template>
</a-table-column> </a-table-column>
<a-table-column title="添加时间" align="center" :width="100"> <a-table-column title="添加时间" align="center" :width="100">
<template v-slot="{record}"> <template v-slot="{ record }">
{{ record.createTime }} {{ record.createTime }}
</template> </template>
</a-table-column> </a-table-column>
<a-table-column title="添加人" align="center" :width="100"> <a-table-column title="添加人" align="center" :width="100">
<template v-slot="{record}"> <template v-slot="{ record }">
{{ record.createName }} {{ record.createName }}
</template> </template>
</a-table-column> </a-table-column>
</a-table> </a-table>
</a-modal> </a-modal>
<!-- 删除 --> <!-- 删除 -->
<a-modal v-model:visible="delVisible" title="区域现货商品删除" :width="650" :maskClosable="false" :keyboard="false" @cancel="delVisibleCancel" @ok="confirmDel" :confirmLoading="delConfirLoading" okText="提交"> <a-modal
<p>您已选中 <span style="color: #1684FC">{{ deleteNum }}条</span> 商品</p> v-model:visible="delVisible"
<a-spin v-if="delLoading" style="height: 150px;width: 100%;line-height: 150px" /> title="区域现货商品删除"
<p v-else>选择需要删除的现货区域: :width="650"
:maskClosable="false"
:keyboard="false"
@cancel="delVisibleCancel"
@ok="confirmDel"
:confirmLoading="delConfirLoading"
okText="提交"
>
<p
>您已选中 <span style="color: #1684fc">{{ deleteNum }}条</span> 商品</p
>
<a-spin v-if="delLoading" style="height: 150px; width: 100%; line-height: 150px" />
<p v-else
>选择需要删除的现货区域:
<a-radio-group v-model:value="radioValue"> <a-radio-group v-model:value="radioValue">
<a-radio :value="1">全部区域</a-radio> <a-radio :value="1">全部区域</a-radio>
<a-radio :value="2">部分区域</a-radio> <a-radio :value="2">部分区域</a-radio>
</a-radio-group> </a-radio-group>
<a-checkbox-group v-model:value="delCheckboxValue" :disabled="radioValue === 1" style="width: 100%;margin-top: 15px"> <a-checkbox-group
v-model:value="delCheckboxValue"
:disabled="radioValue === 1"
style="width: 100%; margin-top: 15px"
>
<a-row> <a-row>
<a-col :span="6" v-for="(item, index) in delAreaList" :key="index"> <a-col :span="6" v-for="(item, index) in delAreaList" :key="index">
<a-checkbox :value="item.id">{{ item.province }}-{{ item.city }}</a-checkbox> <a-checkbox :value="item.id">{{ item.province }}-{{ item.city }}</a-checkbox>
...@@ -622,7 +692,16 @@ const goTaskCenter = () => { ...@@ -622,7 +692,16 @@ const goTaskCenter = () => {
</p> </p>
</a-modal> </a-modal>
<!-- 增加区域 --> <!-- 增加区域 -->
<a-modal v-model:visible="addVisible" title="现货商品增加区域" :width="700" :maskClosable="false" @cancel="addVisibleCancel" @ok="confirmAddArea" okText="提交" :confirmLoading="confirmAddLoading"> <a-modal
v-model:visible="addVisible"
title="现货商品增加区域"
:width="700"
:maskClosable="false"
@cancel="addVisibleCancel"
@ok="confirmAddArea"
okText="提交"
:confirmLoading="confirmAddLoading"
>
<div style="margin-top: -35px">商品名称:{{ curItem.productName }}</div> <div style="margin-top: -35px">商品名称:{{ curItem.productName }}</div>
<div>商品品牌:{{ curItem.brand }}</div> <div>商品品牌:{{ curItem.brand }}</div>
<div>商品货号:{{ curItem.goodsNo }}</div> <div>商品货号:{{ curItem.goodsNo }}</div>
...@@ -631,19 +710,33 @@ const goTaskCenter = () => { ...@@ -631,19 +710,33 @@ const goTaskCenter = () => {
<a-checkbox-group v-model:value="addCheckboxValue" style="width: 100%"> <a-checkbox-group v-model:value="addCheckboxValue" style="width: 100%">
<a-row> <a-row>
<a-col :span="6" v-for="(item, index) in allAreaList" :key="index"> <a-col :span="6" v-for="(item, index) in allAreaList" :key="index">
<a-checkbox :value="item.id" :disabled="item.disabled">{{ item.province }}-{{ item.city }}</a-checkbox> <a-checkbox :value="item.id" :disabled="item.disabled"
>{{ item.province }}-{{ item.city }}</a-checkbox
>
</a-col> </a-col>
</a-row> </a-row>
</a-checkbox-group> </a-checkbox-group>
</a-modal> </a-modal>
<!-- 批量导入 --> <!-- 批量导入 -->
<a-modal v-model:visible="importVisible" title="区域现货商品批量导入" :width="700" :maskClosable="false" okText="提交" @ok="confirmImport" @cancel="importCancel" :confirmLoading="importLoading"> <a-modal
v-model:visible="importVisible"
title="区域现货商品批量导入"
:width="700"
:maskClosable="false"
okText="提交"
@ok="confirmImport"
@cancel="importCancel"
:confirmLoading="importLoading"
>
<a-alert type="warning"> <a-alert type="warning">
<template #message> <template #message>
<span style="color: red">特别提醒:</span>若商品之前已设置现货区域,则本次设置为在之前设置基础上新增。例如,原来商品设置为 北京市-直辖市;天津市-直辖市。本次设置为,北京市-直辖市;四川省-成都市。提交后,商品现货区域将更新为 北京市-直辖市;天津市-直辖市;四川省-成都市。 <span style="color: red">特别提醒:</span
>若商品之前已设置现货区域,则本次设置为在之前设置基础上新增。例如,原来商品设置为
北京市-直辖市;天津市-直辖市。本次设置为,北京市-直辖市;四川省-成都市。提交后,商品现货区域将更新为
北京市-直辖市;天津市-直辖市;四川省-成都市。
</template> </template>
</a-alert> </a-alert>
<div style="margin-top: 15px;display: flex;align-items: center"> <div style="margin-top: 15px; display: flex; align-items: center">
<span>上传商品文件:</span> <span>上传商品文件:</span>
<a-upload <a-upload
accept=".xls,.xlsx" accept=".xls,.xlsx"
...@@ -651,7 +744,7 @@ const goTaskCenter = () => { ...@@ -651,7 +744,7 @@ const goTaskCenter = () => {
:before-upload="productExcelBeforeUpload" :before-upload="productExcelBeforeUpload"
@remove="productExcelRemove" @remove="productExcelRemove"
> >
<a-button><upload-outlined></upload-outlined>上传文件</a-button> <a-button><upload-outlined />上传文件</a-button>
</a-upload> </a-upload>
<span style="margin-left: 15px"> <span style="margin-left: 15px">
下载 下载
...@@ -659,10 +752,12 @@ const goTaskCenter = () => { ...@@ -659,10 +752,12 @@ const goTaskCenter = () => {
</span> </span>
</div> </div>
<p style="margin-top: 15px">选择现货区域:</p> <p style="margin-top: 15px">选择现货区域:</p>
<a-checkbox-group v-model:value="impotrCheckboxValue" style="width: 100%;"> <a-checkbox-group v-model:value="impotrCheckboxValue" style="width: 100%">
<a-row> <a-row>
<a-col :span="6" v-for="(item, index) in allAreaList" :key="index"> <a-col :span="6" v-for="(item, index) in allAreaList" :key="index">
<a-checkbox :value="item.id" :disabled="item.disabled">{{ item.province }}-{{ item.city }}</a-checkbox> <a-checkbox :value="item.id" :disabled="item.disabled"
>{{ item.province }}-{{ item.city }}</a-checkbox
>
</a-col> </a-col>
</a-row> </a-row>
</a-checkbox-group> </a-checkbox-group>
...@@ -671,9 +766,9 @@ const goTaskCenter = () => { ...@@ -671,9 +766,9 @@ const goTaskCenter = () => {
</template> </template>
<style lang="less" scoped> <style lang="less" scoped>
.body-box { .body-box {
.top-search { .top-search {
margin-top: 15px; margin-top: 15px;
}
} }
}
</style> </style>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
import { import { message } from 'ant-design-vue';
message, const config = import.meta.env;
} from 'ant-design-vue'; import {
const config = import.meta.env taskCenterQueryListApi,
import { taskCenterRevokeExcelUploadApi,
taskCenterQueryListApi, } from '/@/api/regionalSpotManage';
taskCenterRevokeExcelUploadApi, onMounted(async () => {
} from '/@/api/regionalSpotManage'; getList();
onMounted(async () => { });
getList() let list = ref<any[]>([]);
}); let listLoading = ref(false);
let list = ref<any[]>([]) const downLoad = (url) => {
let listLoading = ref(false) window.open(config.VITE_GLOB_API_URL + '/system/excelFile/' + url, '_blank');
const downLoad = (url) => { };
window.open(config.VITE_GLOB_API_URL + '/system/excelFile/' + url, '_blank') const downloadFail = (record) => {
} if (record.failNum === 0) return;
const downloadFail = (record) => { let href =
if(record.failNum === 0) return config.VITE_GLOB_API_URL +
let href = config.VITE_GLOB_API_URL + '/excel/excelNew/fail/download?sysid=' + record.sysid+'&type='+record.type.slice(2,6) '/excel/excelNew/fail/download?sysid=' +
window.open(href,'blank') record.sysid +
} '&type=' +
const cancel = async (record) => { record.type.slice(2, 6);
const param = ref<{ [key: string]: any }>({ window.open(href, 'blank');
sysid: record.sysid };
}) const cancel = async (record) => {
const res = await taskCenterRevokeExcelUploadApi(param.value) const param = ref<{ [key: string]: any }>({
if (res.code === 20000) { sysid: record.sysid,
message.success('操作成功') });
getList() const res = await taskCenterRevokeExcelUploadApi(param.value);
} else { if (res.code === 20000) {
message.error(res.message) message.success('操作成功');
} getList();
} } else {
const getList = async () => { message.error(res.message);
listLoading.value = true }
const res = await taskCenterQueryListApi({type:0}) };
if (res.code === 20000) { const getList = async () => {
list.value = res.data listLoading.value = true;
} else { const res = await taskCenterQueryListApi({ type: 0 });
list.value = [] if (res.code === 20000) {
} list.value = res.data;
listLoading.value = false } else {
} list.value = [];
}
listLoading.value = false;
};
</script> </script>
<template> <template>
<div> <div>
<a-button @click="getList" type="primary">刷新数据</a-button> <a-button @click="getList" type="primary">刷新数据</a-button>
</div> </div>
<a-table <a-table
:data-source="list" :data-source="list"
:loading="listLoading" :loading="listLoading"
bordered bordered
:rowKey="(record) => record.sysid" :rowKey="(record) => record.sysid"
style="margin-top: 15px" style="margin-top: 15px"
> >
<a-table-column title="操作时间" align="center" :width="100"> <a-table-column title="操作时间" align="center" :width="100">
<template v-slot="{record}"> <template #default="{ record }">
{{ record.createTime }} {{ record.createTime }}
</template> </template>
</a-table-column> </a-table-column>
<a-table-column title="类型" align="center" :width="100"> <a-table-column title="类型" align="center" :width="100">
<template v-slot="{record}"> <template #default="{ record }">
{{ record.type }} {{ record.type }}
</template> </template>
</a-table-column> </a-table-column>
<a-table-column title="状态" align="center" :width="100"> <a-table-column title="状态" align="center" :width="100">
<template v-slot="{record}"> <template #default="{ record }">
<p>{{ record.isRevoke ? '已撤销' : record.status == 0 ? '待进行':(record.status == 1 ? '进行中':'已完成') }}</p> <p>{{
record.isRevoke
? '已撤销'
: record.status == 0
? '待进行'
: record.status == 1
? '进行中'
: '已完成'
}}</p>
</template> </template>
</a-table-column> </a-table-column>
<a-table-column title="操作数据" align="center" :width="100"> <a-table-column title="操作数据" align="center" :width="100">
<template v-slot="{record}"> <template #default="{ record }">
{{ record.sproductNumpec }} {{ record.sproductNumpec }}
</template> </template>
</a-table-column> </a-table-column>
<a-table-column title="成功数据" align="center" :width="100"> <a-table-column title="成功数据" align="center" :width="100">
<template v-slot="{record}"> <template #default="{ record }">
{{ record.successNum }} {{ record.successNum }}
</template> </template>
</a-table-column> </a-table-column>
<a-table-column title="错误数据" align="center" :width="100"> <a-table-column title="错误数据" align="center" :width="100">
<template v-slot="{record}"> <template #default="{ record }">
{{ record.failNum }} {{ record.failNum }}
</template> </template>
</a-table-column> </a-table-column>
<a-table-column title="操作人" align="center" :width="100"> <a-table-column title="操作人" align="center" :width="100">
<template v-slot="{record}"> <template #default="{ record }">
{{ record.createName }} {{ record.createName }}
</template> </template>
</a-table-column> </a-table-column>
<a-table-column title="操作" align="center" :width="200"> <a-table-column title="操作" align="center" :width="200">
<template v-slot="{record}"> <template #default="{ record }">
<Button type="link" @click="downLoad(record.fileUrl)">下载源文件</Button> <Button type="link" @click="downLoad(record.fileUrl)">下载源文件</Button>
<Button type="link" v-if="record.failNum" @click="downloadFail(record)">下载错误数据</Button> <Button type="link" v-if="record.failNum" @click="downloadFail(record)"
<Button type="link" v-if="record.status == 0 && !record.isRevoke" @click="cancel(record)">撤销</Button> >下载错误数据</Button
>
<Button type="link" v-if="record.status == 0 && !record.isRevoke" @click="cancel(record)"
>撤销</Button
>
</template> </template>
</a-table-column> </a-table-column>
</a-table> </a-table>
</template> </template>
<style lang="less" scoped> <style lang="less" scoped></style>
</style>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue'; import { ref } from 'vue';
import uploadTask from './components/upLoadTask.vue' import uploadTask from './components/upLoadTask.vue';
import downLoadTask from './components/downLoadTask.vue' import downLoadTask from './components/downLoadTask.vue';
import platformProBatch from './components/platformProBatch.vue' import platformProBatch from './components/platformProBatch.vue';
const activeKey = ref('1') const activeKey = ref('1');
const callback = (val) => { const callback = (val) => {
activeKey.value = val activeKey.value = val;
} };
</script> </script>
<template> <template>
<a-tabs @change="callback" v-model:activeKey="activeKey"> <a-tabs @change="callback" v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="上传任务数据"> <a-tab-pane key="1" tab="上传任务数据">
<uploadTask v-if="activeKey === '1'"></uploadTask> <uploadTask v-if="activeKey === '1'" />
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="2" tab="下载任务数据" force-render> <a-tab-pane key="2" tab="下载任务数据" force-render>
<downLoadTask v-if="activeKey === '2'"></downLoadTask> <downLoadTask v-if="activeKey === '2'" />
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="3" tab="平台商品批量"> <a-tab-pane key="3" tab="平台商品批量">
<platformProBatch v-if="activeKey === '3'"></platformProBatch> <platformProBatch v-if="activeKey === '3'" />
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
</template> </template>
<style lang="less" scoped> <style lang="less" scoped></style>
</style>
...@@ -52,6 +52,13 @@ declare global { ...@@ -52,6 +52,13 @@ declare global {
declare interface WheelEvent { declare interface WheelEvent {
path?: EventTarget[]; path?: EventTarget[];
} }
interface ImportMeta {
env: {
VITE_GLOB_API_URL?: string;
};
}
interface ImportMetaEnv extends ViteEnv { interface ImportMetaEnv extends ViteEnv {
__: unknown; __: unknown;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment