fixed 修改全部选中导出问题

This commit is contained in:
lwh 2023-06-27 15:33:11 +08:00
parent 1622ae2880
commit dd2aa7c558
13 changed files with 76 additions and 68 deletions

View File

@ -213,11 +213,8 @@ function handleExport(row) {
const name = ref("所有") const name = ref("所有")
if (Ids.length != 0) { if (Ids.length != 0) {
let str = '' const ids = Object.values(Ids).map(value => String(value));
for (const key in Ids) { const str = ids.join(',');
str += Ids[key] + ','
}
str = str.slice(0, str.length - 1)
queryParams.value.ids = str queryParams.value.ids = str
name.value = "选中" name.value = "选中"
} }

View File

@ -236,11 +236,8 @@ function handleExport(row) {
const name = ref("所有") const name = ref("所有")
if (Ids.length != 0) { if (Ids.length != 0) {
let str = '' const ids = Object.values(Ids).map(value => String(value));
for (const key in Ids) { const str = ids.join(',');
str += Ids[key] + ','
}
str = str.slice(0, str.length - 1)
queryParams.value.ids = str queryParams.value.ids = str
name.value = "选中" name.value = "选中"
} }

View File

@ -214,11 +214,8 @@ function handleExport(row) {
const name = ref("所有") const name = ref("所有")
if (Ids.length != 0) { if (Ids.length != 0) {
let str = '' const ids = Object.values(Ids).map(value => String(value));
for (const key in Ids) { const str = ids.join(',');
str += Ids[key] + ','
}
str = str.slice(0, str.length - 1)
queryParams.value.ids = str queryParams.value.ids = str
name.value = "选中" name.value = "选中"
} }

View File

@ -261,11 +261,8 @@ function handleExport(row) {
const name = ref("所有") const name = ref("所有")
if (Ids.length != 0) { if (Ids.length != 0) {
let str = '' const ids = Object.values(Ids).map(value => String(value));
for (const key in Ids) { const str = ids.join(',');
str += Ids[key] + ','
}
str = str.slice(0, str.length - 1)
queryParams.value.ids = str queryParams.value.ids = str
name.value = "选中" name.value = "选中"
} }

View File

@ -227,11 +227,8 @@ function handleExport(row) {
const name = ref("所有") const name = ref("所有")
if (Ids.length != 0) { if (Ids.length != 0) {
let str = '' const ids = Object.values(Ids).map(value => String(value));
for (const key in Ids) { const str = ids.join(',');
str += Ids[key] + ','
}
str = str.slice(0, str.length - 1)
queryParams.value.ids = str queryParams.value.ids = str
name.value = "选中" name.value = "选中"
} }

View File

@ -29,10 +29,10 @@
<el-col :lg="12"> <el-col :lg="12">
<el-form-item :label-width="labelWidth" label="商品类目" prop="goodsCategoryGuid"> <el-form-item :label-width="labelWidth" label="商品类目" prop="shopGoodsCategoryGuid">
<el-cascader class="w100" :options="dataList" <el-cascader class="w100" :options="dataList"
:props="{ checkStrictly: true, value: 'shopGoodsCategoryGuid', label: 'shopGoodsCategoryName', emitPath: false }" :props="{ checkStrictly: true, value: 'shopGoodsCategoryGuid', label: 'shopGoodsCategoryName', emitPath: false }"
placeholder="请选择商品类目" clearable v-model="formData.goodsCategoryGuid"> placeholder="请选择商品类目" clearable v-model="formData.shopGoodsCategoryGuid">
<template #default="{ node, data }"> <template #default="{ node, data }">
<span>{{ data.shopGoodsCategoryName }}</span> <span>{{ data.shopGoodsCategoryName }}</span>
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span> <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
@ -539,7 +539,7 @@ const imgData = ref({
// //
const rules = reactive({ const rules = reactive({
shopGuid: [{ required: true, message: "店铺不能为空", trigger: "blur" }], shopGuid: [{ required: true, message: "店铺不能为空", trigger: "blur" }],
goodsCategoryGuid: [{ required: true, message: "商品类目不能为空", trigger: "blur" }], shopGoodsCategoryGuid: [{ required: true, message: "商品类目不能为空", trigger: "blur" }],
goodsSpecType: [{ required: true, message: "规格类型不能为空", trigger: "blur" }], goodsSpecType: [{ required: true, message: "规格类型不能为空", trigger: "blur" }],
deliveryGuid: [{ required: true, message: "配送模板不能为空", trigger: "blur" }], deliveryGuid: [{ required: true, message: "配送模板不能为空", trigger: "blur" }],
goodsName: [{ required: true, message: "名称不能为空", trigger: "blur" }], goodsName: [{ required: true, message: "名称不能为空", trigger: "blur" }],

View File

@ -25,10 +25,10 @@
<el-col :lg="12"> <el-col :lg="12">
<el-form-item :label-width="labelWidth" label="商品类目" prop="goodsCategoryGuid"> <el-form-item :label-width="labelWidth" label="商品类目" prop="shopGoodsCategoryGuid">
<el-cascader class="w100" :options="dataList" <el-cascader class="w100" :options="dataList"
:props="{ checkStrictly: true, value: 'shopGoodsCategoryGuid', label: 'shopGoodsCategoryName', emitPath: false }" :props="{ checkStrictly: true, value: 'shopGoodsCategoryGuid', label: 'shopGoodsCategoryName', emitPath: false }"
placeholder="请选择商品类目" clearable v-model="formData.goodsCategoryGuid"> placeholder="请选择商品类目" clearable v-model="formData.shopGoodsCategoryGuid">
<template #default="{ node, data }"> <template #default="{ node, data }">
<span>{{ data.shopGoodsCategoryName }}</span> <span>{{ data.shopGoodsCategoryName }}</span>
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span> <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
@ -524,7 +524,7 @@ const imgData = ref({
// //
const rules = reactive({ const rules = reactive({
shopGuid: [{ required: true, message: "店铺不能为空", trigger: "blur" }], shopGuid: [{ required: true, message: "店铺不能为空", trigger: "blur" }],
goodsCategoryGuid: [{ required: true, message: "商品类目不能为空", trigger: "blur" }], shopGoodsCategoryGuid: [{ required: true, message: "商品类目不能为空", trigger: "blur" }],
goodsSpecType: [{ required: true, message: "规格类型不能为空", trigger: "blur" }], goodsSpecType: [{ required: true, message: "规格类型不能为空", trigger: "blur" }],
deliveryGuid: [{ required: true, message: "配送模板不能为空", trigger: "blur" }], deliveryGuid: [{ required: true, message: "配送模板不能为空", trigger: "blur" }],
goodsName: [{ required: true, message: "名称不能为空", trigger: "blur" }], goodsName: [{ required: true, message: "名称不能为空", trigger: "blur" }],

View File

@ -15,9 +15,25 @@
<el-form-item label="店铺名称"> <el-form-item label="店铺名称">
<el-input v-model.number="queryParams.shopName" placeholder="请输入店铺名称" clearable @keyup.enter="handleQuery" /> <el-input v-model.number="queryParams.shopName" placeholder="请输入店铺名称" clearable @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item label="商品类目guid" prop="goodsCategoryGuid"> <el-form-item label="经营类目" prop="goodsCategoryGuid" v-if="userid == 1">
<el-input v-model.number="queryParams.goodsCategoryGuid" placeholder="请输入选择商品类目" clearable <el-cascader class="w100" :options="goodsCategoryTreeListData"
@keyup.enter="handleQuery" /> :props="{ checkStrictly: true, value: 'goodsCategoryGuid', label: 'goodsCategoryName', emitPath: false }"
placeholder="请选择经营类目" clearable v-model="queryParams.goodsCategoryGuid" @change="handleQuery">
<template #default="{ node, data }">
<span>{{ data.goodsCategoryName }}</span>
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
</template>
</el-cascader>
</el-form-item>
<el-form-item label="商品类目" prop="goodsCategoryGuid" v-else>
<el-cascader class="w100" :options="shopGoodsCategoryTreeListData"
:props="{ checkStrictly: true, value: 'shopGoodsCategoryGuid', label: 'shopGoodsCategoryName', emitPath: false }"
placeholder="请选择商品类目" clearable v-model="queryParams.shopGoodsCategoryGuid" @change="handleQuery">
<template #default="{ node, data }">
<span>{{ data.shopGoodsCategoryName }}</span>
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
</template>
</el-cascader>
</el-form-item> </el-form-item>
<el-form-item label="商品名称" prop="goodsName"> <el-form-item label="商品名称" prop="goodsName">
<el-input v-model="queryParams.goodsName" placeholder="请输入商品名称" clearable @keyup.enter="handleQuery" /> <el-input v-model="queryParams.goodsName" placeholder="请输入商品名称" clearable @keyup.enter="handleQuery" />
@ -64,7 +80,8 @@
<el-table-column type="selection" width="50" align="center" /> <el-table-column type="selection" width="50" align="center" />
<el-table-column prop="goodsId" width="100" label="商品ID" align="center" :show-overflow-tooltip="true" /> <el-table-column prop="goodsId" width="100" label="商品ID" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="shopName" width="150" label="店铺名称" align="center" :show-overflow-tooltip="true" v-if="userid == 1" /> <el-table-column prop="shopName" width="150" label="店铺名称" align="center" :show-overflow-tooltip="true"
v-if="userid == 1" />
<el-table-column prop="goodsPicture" label="图片" align="center"> <el-table-column prop="goodsPicture" label="图片" align="center">
<template #default="scope"> <template #default="scope">
<el-image preview-teleported :hide-on-click-modal="true" lazy class="table-td-thumb" fit="contain" <el-image preview-teleported :hide-on-click-modal="true" lazy class="table-td-thumb" fit="contain"
@ -75,7 +92,7 @@
</el-image> </el-image>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="goodsName" label="商品名称" width="500" align="center" :show-overflow-tooltip="true" /> <el-table-column prop="goodsName" label="商品名称" width="450" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="goodsPriceLowest" label="价格" align="center" /> <el-table-column prop="goodsPriceLowest" label="价格" align="center" />
<el-table-column prop="goodsSalesActual" label="实际销量" align="center" /> <el-table-column prop="goodsSalesActual" label="实际销量" align="center" />
<el-table-column prop="goodsTotalInventory" label="库存总量" align="center" /> <el-table-column prop="goodsTotalInventory" label="库存总量" align="center" />
@ -85,7 +102,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="goodsSort" label="排序" align="center" /> <el-table-column prop="goodsSort" label="排序" align="center" />
<el-table-column prop="createTime" label="添加时间" align="center" /> <el-table-column prop="createTime" label="添加时间" width="150" align="center" />
<el-table-column label="操作" width="250" fixed="right" align="center"> <el-table-column label="操作" width="250" fixed="right" align="center">
<template #default="scope"> <template #default="scope">
@ -115,6 +132,8 @@
import { ElMessageBox } from 'element-plus' import { ElMessageBox } from 'element-plus'
import modal from '@/plugins/modal.js' import modal from '@/plugins/modal.js'
import { exportGoods, goodsList, delGoods } from '@/api/business/GoodsManager/Goodss/goods.js' import { exportGoods, goodsList, delGoods } from '@/api/business/GoodsManager/Goodss/goods.js'
import { goodsCategoryTreeList } from '@/api/business/GoodsManager/GoodsCategorys/goodsCategory.js'
import { shopGoodsCategoryTreeList } from '@/api/business/GoodsManager/ShopGoodsCategorys/shopGoodsCategory.js'
import AddDialog from "./components/AddDialog.vue"; import AddDialog from "./components/AddDialog.vue";
import EditDialog from "./components/EditDialog.vue"; import EditDialog from "./components/EditDialog.vue";
import DetailDialog from "./components/DetailDialog.vue"; import DetailDialog from "./components/DetailDialog.vue";
@ -219,7 +238,27 @@ async function getshelf_status() {
getshelf_status() getshelf_status()
//
const shopGoodsCategoryTreeListData = ref([])
async function getShopGoodsCategoryTreeList() {
shopGoodsCategoryTreeList().then((res) => {
if (res.code == 200) {
shopGoodsCategoryTreeListData.value = res.data
}
})
}
getShopGoodsCategoryTreeList()
//
const goodsCategoryTreeListData = ref([])
async function getGoodsCategoryTreeList() {
goodsCategoryTreeList().then((res) => {
if (res.code == 200) {
goodsCategoryTreeListData.value = res.data
}
})
}
getGoodsCategoryTreeList()
// //
@ -240,6 +279,7 @@ function getList() {
// //
function handleSelectionChange(selection) { function handleSelectionChange(selection) {
console.log(selection,'检查 selection 中的内容'); // selection
ids.value = selection.map((item) => item.goodsId) ids.value = selection.map((item) => item.goodsId)
single.value = selection.length != 1 single.value = selection.length != 1
multiple.value = !selection.length multiple.value = !selection.length
@ -277,15 +317,13 @@ function handleDelete(row) {
function handleExport(row) { function handleExport(row) {
const Ids = row.goodsId || ids.value const Ids = row.goodsId || ids.value
const name = ref("所有") const name = ref("所有")
console.log(Ids,'ids是什么呢');
if (Ids.length != 0) { if (Ids.length != 0) {
let str = '' const ids = Object.values(Ids).map(value => String(value));
for (const key in Ids) { const str = ids.join(',');
str += Ids[key] + ','
}
str = str.slice(0, str.length - 1)
queryParams.value.ids = str queryParams.value.ids = str
name.value = "选中" name.value = "选中"
console.log(queryParams.value,'搜索内容');
} }
ElMessageBox.confirm('是否确认导出' + name.value + '数据?', '警告', { ElMessageBox.confirm('是否确认导出' + name.value + '数据?', '警告', {

View File

@ -245,11 +245,8 @@ function handleExport(row) {
const name = ref("所有") const name = ref("所有")
if (Ids.length != 0) { if (Ids.length != 0) {
let str = '' const ids = Object.values(Ids).map(value => String(value));
for (const key in Ids) { const str = ids.join(',');
str += Ids[key] + ','
}
str = str.slice(0, str.length - 1)
queryParams.value.ids = str queryParams.value.ids = str
name.value = "选中" name.value = "选中"
} }

View File

@ -205,11 +205,8 @@ function handleExport(row) {
const name = ref("所有") const name = ref("所有")
if (Ids.length != 0) { if (Ids.length != 0) {
let str = '' const ids = Object.values(Ids).map(value => String(value));
for (const key in Ids) { const str = ids.join(',');
str += Ids[key] + ','
}
str = str.slice(0, str.length - 1)
queryParams.value.ids = str queryParams.value.ids = str
name.value = "选中" name.value = "选中"
} }

View File

@ -192,11 +192,8 @@ function handleExport(row) {
const name = ref("所有") const name = ref("所有")
if (Ids.length != 0) { if (Ids.length != 0) {
let str = '' const ids = Object.values(Ids).map(value => String(value));
for (const key in Ids) { const str = ids.join(',');
str += Ids[key] + ','
}
str = str.slice(0, str.length - 1)
queryParams.value.ids = str queryParams.value.ids = str
name.value = "选中" name.value = "选中"
} }

View File

@ -203,11 +203,8 @@ function handleExport(row) {
const name = ref("所有") const name = ref("所有")
if (Ids.length != 0) { if (Ids.length != 0) {
let str = '' const ids = Object.values(Ids).map(value => String(value));
for (const key in Ids) { const str = ids.join(',');
str += Ids[key] + ','
}
str = str.slice(0, str.length - 1)
queryParams.value.ids = str queryParams.value.ids = str
name.value = "选中" name.value = "选中"
} }

View File

@ -230,11 +230,8 @@ function handleExport(row) {
const name = ref("所有") const name = ref("所有")
if (Ids.length != 0) { if (Ids.length != 0) {
let str = '' const ids = Object.values(Ids).map(value => String(value));
for (const key in Ids) { const str = ids.join(',');
str += Ids[key] + ','
}
str = str.slice(0, str.length - 1)
queryParams.value.ids = str queryParams.value.ids = str
name.value = "选中" name.value = "选中"
} }