提交 b271fba6 authored 作者: 袁伟伟's avatar 袁伟伟

fix: 状态展示修改

上级 862ee661
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
<a-table :columns="columns" :data-source="data" :pagination="false" :loading="tableLoading" rowKey="id"> <a-table :columns="columns" :data-source="data" :pagination="false" :loading="tableLoading" rowKey="id">
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'status'"> <template v-if="column.key === 'status'">
<span v-if="record.status === 'YES'">启用</span> <span v-if="record.status === 'YES'"><a-tag color="green">启用</a-tag></span>
<span v-else>禁用</span> <span v-else><a-tag color="red">禁用</a-tag></span>
</template> </template>
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<a-button <a-button
......
...@@ -50,8 +50,8 @@ ...@@ -50,8 +50,8 @@
<span>{{ record.discountStartTime + ' - ' + record.discountEndTime }} </span> <span>{{ record.discountStartTime + ' - ' + record.discountEndTime }} </span>
</template> </template>
<template v-if="column.key === 'status'"> <template v-if="column.key === 'status'">
<span v-if="record.status === 'YES'">启用</span> <span v-if="record.status === 'YES'"><a-tag color="green">启用</a-tag></span>
<span v-else>禁用</span> <span v-else><a-tag color="red">禁用</a-tag></span>
</template> </template>
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<a-button type="link" @click="handleEdit(record.id)">编辑</a-button> <a-button type="link" @click="handleEdit(record.id)">编辑</a-button>
......
...@@ -42,30 +42,38 @@ ...@@ -42,30 +42,38 @@
<a-table :dataSource="dataSource" :columns="columns" :pagination="pagination" :loading="tableLoading"> <a-table :dataSource="dataSource" :columns="columns" :pagination="pagination" :loading="tableLoading">
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'status'"> <template v-if="column.key === 'status'">
<span v-if="record.status === 'YES'"></span> <span v-if="record.status === 'YES'"><a-tag color="green"></a-tag></span>
<span v-else></span> <span v-else><a-tag color="red"></a-tag></span>
</template> </template>
<template v-if="column.key === 'isImport'"> <template v-if="column.key === 'isImport'">
<span v-if="record.isImport === 'YES'"></span> <span v-if="record.isImport === 'YES'"><a-tag color="green"></a-tag></span>
<span v-else></span> <span v-else><a-tag color="red"></a-tag></span>
</template> </template>
<template v-if="column.key === 'isNews'"> <template v-if="column.key === 'isNews'">
<span v-if="record.isNews === 'YES'"></span> <span v-if="record.isNews === 'YES'"><a-tag color="green"></a-tag></span>
<span v-else></span> <span v-else><a-tag color="red"></a-tag></span>
</template> </template>
<template v-if="column.key === 'isUnconventional'"> <template v-if="column.key === 'isUnconventional'">
<span v-if="record.isUnconventional === 'YES'"></span> <span v-if="record.isUnconventional === 'YES'"><a-tag color="green"></a-tag></span>
<span v-else></span> <span v-else><a-tag color="red"></a-tag></span>
</template> </template>
<template v-if="column.key === 'isPromotion'"> <template v-if="column.key === 'isPromotion'">
<span v-if="record.isPromotion === 'YES'"></span> <span v-if="record.isPromotion === 'YES'"><a-tag color="green"></a-tag></span>
<span v-else></span> <span v-else><a-tag color="red"></a-tag></span>
</template> </template>
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<a-button type="link" @click="handleAdd(record.id)" v-if="hasPermission('AUTH_PRODUCT_GOODS:EDIT')" <a-button type="link" @click="handleAdd(record.id)" v-if="hasPermission('AUTH_PRODUCT_GOODS:EDIT')"
>编辑</a-button >编辑</a-button
> >
<a-button type="link" v-if="hasPermission('AUTH_PRODUCT_GOODS:DELETE')">删除</a-button> <a-popconfirm
title="是否确认删除?"
ok-text="是"
cancel-text="否"
@confirm="handleDelete(record.id)"
v-if="hasPermission('AUTH_PRODUCT_GOODS:DELETE')"
>
<a-button type="link">删除</a-button>
</a-popconfirm>
</template> </template>
</template> </template>
</a-table> </a-table>
...@@ -81,6 +89,7 @@ ...@@ -81,6 +89,7 @@
import * as GoodsApi from '/@/api/product/goodsApi'; import * as GoodsApi from '/@/api/product/goodsApi';
import { Goods } from '/@/api/model/goods'; import { Goods } from '/@/api/model/goods';
import { usePagination } from '/@/hooks/myhooks/index'; import { usePagination } from '/@/hooks/myhooks/index';
import { message } from 'ant-design-vue';
const { hasPermission } = usePermission(); const { hasPermission } = usePermission();
const go = useGo(); const go = useGo();
...@@ -131,6 +140,13 @@ ...@@ -131,6 +140,13 @@
} }
}; };
const handleDelete = (id) => {
GoodsApi.remove(id).then((res) => {
message.success('删除成功');
getData();
});
};
onMounted(() => { onMounted(() => {
getData(); getData();
}); });
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<div class="productList"> <div class="productList">
<a-table <a-table
:dataSource="productList" :dataSource="productList"
:columns="columns" :columns="productColumns"
:pagination="false" :pagination="false"
childrenColumnName="cartProductDetailList" childrenColumnName="cartProductDetailList"
rowKey="uuid" rowKey="uuid"
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
import Search from '../components/search.vue'; import Search from '../components/search.vue';
import Nav from '../components/nav.vue'; import Nav from '../components/nav.vue';
import { DataItem } from '/@/views/product/goods-category/type'; import { DataItem } from '/@/views/product/goods-category/type';
import { toNumber } from 'lodash'; import { cloneDeep, toNumber } from 'lodash';
import { columns } from './schema'; import { columns } from './schema';
import { ShoppingCartOutlined } from '@ant-design/icons-vue'; import { ShoppingCartOutlined } from '@ant-design/icons-vue';
import { useGo } from '/@/hooks/web/usePage'; import { useGo } from '/@/hooks/web/usePage';
...@@ -92,7 +92,9 @@ ...@@ -92,7 +92,9 @@
const route = useRoute(); const route = useRoute();
const getCartList = useCartList(); const getCartList = useCartList();
columns.push({ const productColumns = cloneDeep(columns);
productColumns.push({
title: '操作', title: '操作',
key: 'active', key: 'active',
width: '100px', width: '100px',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论