新增品牌管理、商户列表等

This commit is contained in:
gxwebsoft
2024-04-05 01:46:11 +08:00
parent cf6de932f1
commit 4ab754cfde
35 changed files with 1881 additions and 67 deletions
@@ -50,7 +50,6 @@ public class ShopGenerator {
// "shop_spec_value"
// "shop_goods",
// "shop_goods_spec",
"shop_goods_spec_rel",
// "shop_goods_sku",
// "shop_goods_category",
// "shop_goods_coupon",
@@ -59,6 +58,10 @@ public class ShopGenerator {
// "shop_goods_relation",
// "shop_goods_comment",
// "shop_goods_rule"
// "shop_brand",
// "shop_merchant",
// "shop_merchant_type",
"shop_merchant_apply"
};
// 需要去除的表前缀
private static final String[] TABLE_PREFIX = new String[]{
@@ -19,37 +19,65 @@
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
"
>
<a-form-item label="${table.comment!}名称" name="${table.entityPath}Name">
<a-input
allow-clear
:maxlength="100"
placeholder="请输入${table.comment!}"
v-model:value="form.${table.entityPath}Name"
/>
</a-form-item>
<a-form-item label="描述" name="comments">
<% for(field in table.fields) { %>
<% if(field.propertyName == 'comments'){ %>
<a-form-item label="${field.comment!}" name="${field.propertyName}">
<a-textarea
:rows="4"
:maxlength="200"
placeholder="请输入描述"
v-model:value="form.comments"
v-model:value="form.${field.propertyName}"
/>
</a-form-item>
<a-form-item label="排序号" name="sortNumber">
<% } %>
<% else if(field.propertyName == 'sortNumber'){ %>
<a-form-item label="${field.comment!}" name="${field.propertyName}">
<a-input-number
:min="0"
:max="9999"
class="ele-fluid"
placeholder="请输入排序号"
v-model:value="form.sortNumber"
v-model:value="form.${field.propertyName}"
/>
</a-form-item>
<a-form-item label="状态" name="status">
<% } %>
<% else if(field.propertyName == 'status'){ %>
<a-form-item label="${field.comment!}" name="${field.propertyName}">
<a-radio-group v-model:value="form.status">
<a-radio :value="0">显示</a-radio>
<a-radio :value="1">隐藏</a-radio>
</a-radio-group>
</a-form-item>
<% } %>
<% else if(field.propertyName == 'image'){ %>
<a-form-item
label="${field.comment!}"
name="${field.propertyName}">
<SelectFile
:placeholder="`请选择图片`"
:limit="1"
:data="images"
@done="chooseImage"
@del="onDeleteItem"
/>
</a-form-item>
<% } %>
<% else if(field.keyFlag){ %>
<% } %>
<% else if(field.propertyName == 'tenantId'){ %>
<% } %>
<% else if(field.propertyName == 'createTime'){ %>
<% } %>
<% else { %>
<a-form-item label="${field.comment!}" name="${field.propertyName}">
<a-input
allow-clear
placeholder="请输入${field.comment!}"
v-model:value="form.${field.propertyName}"
/>
</a-form-item>
<% } %>
<% } %>
</a-form>
</ele-modal>
</template>
@@ -57,12 +85,14 @@
<script lang="ts" setup>
import { ref, reactive, watch } from 'vue';
import { Form, message } from 'ant-design-vue';
import { assignObject } from 'ele-admin-pro';
import { assignObject, uuid } from 'ele-admin-pro';
import { add${entity}, update${entity} } from '@/api/${package.ModuleName}/${table.entityPath}';
import { ${entity} } from '@/api/${package.ModuleName}/${table.entityPath}/model';
import { useThemeStore } from '@/store/modules/theme';
import { storeToRefs } from 'pinia';
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
import { FormInstance } from 'ant-design-vue/es/form';
import { FileRecord } from '@/api/system/file/model';
// 是否是修改
const isUpdate = ref(false);
@@ -89,9 +119,13 @@
const maxable = ref(true);
// 表格选中数据
const formRef = ref<FormInstance | null>(null);
const images = ref<ItemType[]>([]);
// 用户信息
const form = reactive<${entity}>({
<% for(field in table.fields) { %>
${field.propertyName}: undefined,
<% } %>
${table.entityPath}Id: undefined,
${table.entityPath}Name: '',
status: 0,
@@ -116,6 +150,20 @@
]
});
const chooseImage = (data: FileRecord) => {
images.value.push({
uid: data.id,
url: data.path,
status: 'done'
});
form.image = data.path;
};
const onDeleteItem = (index: number) => {
images.value.splice(index, 1);
form.image = '';
};
const { resetFields } = useForm(form, rules);
/* 保存编辑 */
@@ -150,8 +198,16 @@
() => props.visible,
(visible) => {
if (visible) {
images.value = [];
if (props.data) {
assignObject(form, props.data);
if(props.data.image){
images.value.push({
uid: uuid(),
url: props.data.image,
status: 'done'
})
}
isUpdate.value = true;
} else {
isUpdate.value = false;
@@ -21,9 +21,12 @@
/>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'image'">
<a-image :src="record.image" :width="50" />
</template>
<template v-if="column.key === 'status'">
<a-tag v-if="record.status === 0" color="green">开启</a-tag>
<a-tag v-if="record.status === 1" color="red">关闭</a-tag>
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
</template>
<template v-if="column.key === 'action'">
<a-space>
@@ -52,6 +55,7 @@
import { message, Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro';
import { toDateString } from 'ele-admin-pro';
import type {
DatasourceFunction,
ColumnItem
@@ -96,28 +100,24 @@
// 表格列配置
const columns = ref<ColumnItem[]>([
<% for(field in table.fields) { %>
<% if(field.propertyName != 'tenantId'){ %>
{
title: 'ID',
width: 90,
dataIndex: '${table.entityPath}Id'
},
{
title: '名称',
dataIndex: '${table.entityPath}name',
key: '${table.entityPath}name'
},
{
title: '描述',
dataIndex: 'comments',
ellipsis: true
},
{
title: '状态',
dataIndex: 'status',
width: 120,
title: '${field.comment}',
dataIndex: '${field.propertyName}',
key: '${field.propertyName}',
align: 'center',
key: 'status'
<% if(field.keyFlag){ %>
width: 90,
<% } %>
<% if(field.propertyName == 'createTime'){ %>
sorter: true,
ellipsis: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
<% } %>
},
<% } %>
<% } %>
{
title: '操作',
key: 'action',
@@ -148,7 +148,7 @@
/* 删除单个 */
const remove = (row: ${entity}) => {
const hide = message.loading('请求中..', 0);
remove${entity}(row.id)
remove${entity}(row.${table.entityPath}Id)
.then((msg) => {
hide();
message.success(msg);
@@ -173,7 +173,7 @@
maskClosable: true,
onOk: () => {
const hide = message.loading('请求中..', 0);
removeBatch${entity}(selection.value.map((d) => d.id))
removeBatch${entity}(selection.value.map((d) => d.${table.entityPath}Id))
.then((msg) => {
hide();
message.success(msg);
@@ -205,7 +205,6 @@
}
};
};
query();
</script>