Browse Source

feat:新增后台用户、banner、公告、门店、产品管理

master
tanzs 1 week ago
parent
commit
2d4566d49e
31 changed files with 2791 additions and 300 deletions
  1. +3
    -3
      .env.development
  2. +2
    -2
      .env.production
  3. +1
    -1
      mock/_util.ts
  4. +63
    -0
      src/views/miniapp/appbanner/AppBanner.api.ts
  5. +197
    -0
      src/views/miniapp/appbanner/AppBanner.data.ts
  6. +190
    -0
      src/views/miniapp/appbanner/AppBannerList.vue
  7. +70
    -0
      src/views/miniapp/appbanner/components/AppBannerForm.vue
  8. +76
    -0
      src/views/miniapp/appbanner/components/AppBannerModal.vue
  9. +29
    -130
      src/views/miniapp/appuser/AppUser.data.ts
  10. +139
    -138
      src/views/miniapp/appuser/AppUserList.vue
  11. +0
    -26
      src/views/miniapp/appuser/V20250210_1__menu_insert_AppUser.sql
  12. +63
    -0
      src/views/miniapp/notice/AppNotice.api.ts
  13. +122
    -0
      src/views/miniapp/notice/AppNotice.data.ts
  14. +190
    -0
      src/views/miniapp/notice/AppNoticeList.vue
  15. +70
    -0
      src/views/miniapp/notice/components/AppNoticeForm.vue
  16. +76
    -0
      src/views/miniapp/notice/components/AppNoticeModal.vue
  17. +63
    -0
      src/views/miniapp/product/AppProduct.api.ts
  18. +123
    -0
      src/views/miniapp/product/AppProduct.data.ts
  19. +198
    -0
      src/views/miniapp/product/AppProductList.vue
  20. +70
    -0
      src/views/miniapp/product/components/AppProductForm.vue
  21. +76
    -0
      src/views/miniapp/product/components/AppProductModal.vue
  22. +64
    -0
      src/views/miniapp/productCategory/AppCategory.api.ts
  23. +71
    -0
      src/views/miniapp/productCategory/AppCategory.data.ts
  24. +191
    -0
      src/views/miniapp/productCategory/AppCategoryList.vue
  25. +70
    -0
      src/views/miniapp/productCategory/components/AppCategoryForm.vue
  26. +76
    -0
      src/views/miniapp/productCategory/components/AppCategoryModal.vue
  27. +63
    -0
      src/views/miniapp/store/AppStore.api.ts
  28. +99
    -0
      src/views/miniapp/store/AppStore.data.ts
  29. +190
    -0
      src/views/miniapp/store/AppStoreList.vue
  30. +70
    -0
      src/views/miniapp/store/components/AppStoreForm.vue
  31. +76
    -0
      src/views/miniapp/store/components/AppStoreModal.vue

+ 3
- 3
.env.development View File

@ -6,13 +6,13 @@ VITE_PUBLIC_PATH = /
# 跨域代理,您可以配置多个 ,请注意,没有换行符 # 跨域代理,您可以配置多个 ,请注意,没有换行符
VITE_PROXY = [["/jeecgboot","http://localhost:8080/jeecg-boot"],["/upload","http://localhost:3300/upload"]]
VITE_PROXY = [["/contract","http://localhost:8080/contract"],["/upload","http://localhost:3300/upload"]]
#后台接口全路径地址(必填) #后台接口全路径地址(必填)
VITE_GLOB_DOMAIN_URL=http://localhost:8080/jeecg-boot
VITE_GLOB_DOMAIN_URL=http://localhost:8080/contract
#后台接口父地址(必填) #后台接口父地址(必填)
VITE_GLOB_API_URL=/jeecgboot
VITE_GLOB_API_URL=/contract
# 接口前缀 # 接口前缀
VITE_GLOB_API_URL_PREFIX= VITE_GLOB_API_URL_PREFIX=


+ 2
- 2
.env.production View File

@ -13,10 +13,10 @@ VITE_BUILD_COMPRESS = 'gzip'
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
#后台接口父地址(必填) #后台接口父地址(必填)
VITE_GLOB_API_URL=/jeecgboot
VITE_GLOB_API_URL=/contract
#后台接口全路径地址(必填) #后台接口全路径地址(必填)
VITE_GLOB_DOMAIN_URL=http://jeecg-boot-system:8080/jeecg-boot
VITE_GLOB_DOMAIN_URL=https://gpt.aiym.run/contract
# 接口父路径前缀 # 接口父路径前缀
VITE_GLOB_API_URL_PREFIX= VITE_GLOB_API_URL_PREFIX=


+ 1
- 1
mock/_util.ts View File

@ -60,4 +60,4 @@ export function getRequestToken({ headers }: requestParams): string | undefined
} }
//TODO 接口父路径(写死不够灵活) //TODO 接口父路径(写死不够灵活)
export const baseUrl = '/jeecgboot/mock';
export const baseUrl = '/contract/mock';

+ 63
- 0
src/views/miniapp/appbanner/AppBanner.api.ts View File

@ -0,0 +1,63 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
const { createConfirm } = useMessage();
enum Api {
list = '/appbanner/appBanner/list',
save = '/appbanner/appBanner/add',
edit = '/appbanner/appBanner/edit',
deleteOne = '/appbanner/appBanner/delete',
deleteBatch = '/appbanner/appBanner/deleteBatch',
importExcel = '/appbanner/appBanner/importExcel',
exportXls = '/appbanner/appBanner/exportXls',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) => defHttp.get({ url: Api.list, params });
/**
*
*/
export const deleteOne = (params, handleSuccess) => {
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
handleSuccess();
});
};
/**
*
* @param params
*/
export const batchDelete = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
handleSuccess();
});
},
});
};
/**
*
* @param params
*/
export const saveOrUpdate = (params, isUpdate) => {
const url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url: url, params });
};

+ 197
- 0
src/views/miniapp/appbanner/AppBanner.data.ts View File

@ -0,0 +1,197 @@
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '图片地址',
align: 'center',
dataIndex: 'image',
customRender: render.renderImage,
},
{
title: '跳转地址',
align: 'center',
dataIndex: 'jumpUrl',
},
{
title: '跳转类型',
align: 'center',
dataIndex: 'jumpType_dictText',
},
{
title: '广告位置',
align: 'center',
dataIndex: 'position_dictText',
},
{
title: '状态',
align: 'center',
dataIndex: 'status_dictText',
},
{
title: '分享名称',
align: 'center',
dataIndex: 'shareName',
},
{
title: '分享图',
align: 'center',
dataIndex: 'shareImage',
customRender: render.renderImage,
},
{
title: '创建日期',
align: 'center',
dataIndex: 'createTime',
},
{
title: '更新日期',
align: 'center',
dataIndex: 'updateTime',
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
{
label: '跳转类型',
field: 'jumpType',
component: 'JSelectMultiple',
componentProps: {
dictCode: 'app_banner_jump_type',
},
//colProps: {span: 6},
},
{
label: '广告位置',
field: 'position',
component: 'JSelectMultiple',
componentProps: {
dictCode: 'app_banner_position',
},
//colProps: {span: 6},
},
{
label: '状态',
field: 'status',
component: 'JSelectMultiple',
componentProps: {
dictCode: 'dict_item_status',
},
//colProps: {span: 6},
},
{
label: '创建日期',
field: 'createTime',
component: 'RangePicker',
componentProps: {
valueType: 'Date',
showTime: true,
},
//colProps: {span: 6},
},
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '图片地址',
field: 'image',
component: 'JImageUpload',
componentProps: {
fileMax: 0,
},
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入图片地址!' }];
},
},
{
label: '跳转地址',
field: 'jumpUrl',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入跳转地址!' }];
},
},
{
label: '跳转类型',
field: 'jumpType',
component: 'JDictSelectTag',
componentProps: {
dictCode: 'app_banner_jump_type',
stringToNumber: true,
},
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入跳转类型!' }];
},
},
{
label: '广告位置',
field: 'position',
component: 'JDictSelectTag',
componentProps: {
dictCode: 'app_banner_position',
stringToNumber: true,
},
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入广告位置!' }];
},
},
{
label: '状态',
field: 'status',
defaultValue: 1,
component: 'JDictSelectTag',
componentProps: {
dictCode: 'dict_item_status',
type: 'radio',
stringToNumber: true,
},
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入状态!' }];
},
},
{
label: '分享名称',
field: 'shareName',
component: 'Input',
},
{
label: '分享图',
field: 'shareImage',
component: 'JImageUpload',
componentProps: {
fileMax: 0,
},
},
// TODO 主键隐藏字段,目前写死为ID
{
label: '',
field: 'id',
component: 'Input',
show: false,
},
];
// 高级查询数据
export const superQuerySchema = {
image: { title: '图片地址', order: 0, view: 'image', type: 'string' },
jumpUrl: { title: '跳转地址', order: 1, view: 'text', type: 'string' },
jumpType: { title: '跳转类型', order: 2, view: 'number', type: 'number', dictCode: 'app_banner_jump_type' },
position: { title: '广告位置', order: 3, view: 'number', type: 'number', dictCode: 'app_banner_position' },
status: { title: '状态', order: 4, view: 'number', type: 'number', dictCode: 'dict_item_status' },
shareName: { title: '分享名称', order: 5, view: 'text', type: 'string' },
shareImage: { title: '分享图', order: 6, view: 'image', type: 'string' },
createTime: { title: '创建日期', order: 7, view: 'datetime', type: 'string' },
updateTime: { title: '更新日期', order: 8, view: 'datetime', type: 'string' },
};
/**
* formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
return formSchema;
}

+ 190
- 0
src/views/miniapp/appbanner/AppBannerList.vue View File

@ -0,0 +1,190 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" v-auth="'appbanner:app_banner:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'appbanner:app_banner:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'appbanner:app_banner:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls"
>导入</j-upload-button
>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined" />
删除
</a-menu-item>
</a-menu>
</template>
<a-button v-auth="'appbanner:app_banner:deleteBatch'"
>批量操作
<Icon icon="mdi:chevron-down" />
</a-button>
</a-dropdown>
<!-- 高级查询 -->
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</template>
<!--字段回显插槽-->
<template #bodyCell="{ column, record, index, text }"> </template>
</BasicTable>
<!-- 表单区域 -->
<AppBannerModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" name="appbanner-appBanner" setup>
import { ref, reactive, computed, unref } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import AppBannerModal from './components/AppBannerModal.vue';
import { columns, searchFormSchema, superQuerySchema } from './AppBanner.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './AppBanner.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import { useUserStore } from '/@/store/modules/user';
const queryParam = reactive<any>({});
const checkedKeys = ref<Array<string | number>>([]);
const userStore = useUserStore();
//model
const [registerModal, { openModal }] = useModal();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '应用广告配置',
api: list,
columns,
canResize: false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToNumber: [],
fieldMapToTime: [['createTime', ['createTime_begin', 'createTime_end'], 'YYYY-MM-DD HH:mm:ss']],
},
actionColumn: {
width: 120,
fixed: 'right',
},
beforeFetch: (params) => {
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: '应用广告配置',
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess,
},
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
//
const superQueryConfig = reactive(superQuerySchema);
/**
* 高级查询事件
*/
function handleSuperQuery(params) {
Object.keys(params).map((k) => {
queryParam[k] = params[k];
});
reload();
}
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: 'appbanner:app_banner:edit',
},
];
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
},
auth: 'appbanner:app_banner:delete',
},
];
}
</script>
<style lang="less" scoped>
:deep(.ant-picker),
:deep(.ant-input-number) {
width: 100%;
}
</style>

+ 70
- 0
src/views/miniapp/appbanner/components/AppBannerForm.vue View File

@ -0,0 +1,70 @@
<template>
<div style="min-height: 400px">
<BasicForm @register="registerForm" />
<div style="width: 100%; text-align: center" v-if="!formDisabled">
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary"> </a-button>
</div>
</div>
</template>
<script lang="ts">
import { BasicForm, useForm } from '/@/components/Form/index';
import { computed, defineComponent } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { propTypes } from '/@/utils/propTypes';
import { getBpmFormSchema } from '../AppBanner.data';
import { saveOrUpdate } from '../AppBanner.api';
export default defineComponent({
name: 'AppBannerForm',
components: {
BasicForm,
},
props: {
formData: propTypes.object.def({}),
formBpm: propTypes.bool.def(true),
},
setup(props) {
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({
labelWidth: 150,
schemas: getBpmFormSchema(props.formData),
showActionButtonGroup: false,
baseColProps: { span: 24 },
});
const formDisabled = computed(() => {
if (props.formData.disabled === false) {
return false;
}
return true;
});
let formData = {};
const queryByIdUrl = '/appbanner/appBanner/queryById';
async function initFormData() {
let params = { id: props.formData.dataId };
const data = await defHttp.get({ url: queryByIdUrl, params });
formData = { ...data };
//
await setFieldsValue(formData);
//
await setProps({ disabled: formDisabled.value });
}
async function submitForm() {
let data = getFieldsValue();
let params = Object.assign({}, formData, data);
console.log('表单数据', params);
await saveOrUpdate(params, true);
}
initFormData();
return {
registerForm,
formDisabled,
submitForm,
};
},
});
</script>

+ 76
- 0
src/views/miniapp/appbanner/components/AppBannerModal.vue View File

@ -0,0 +1,76 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
<BasicForm @register="registerForm" name="AppBannerForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, unref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { formSchema } from '../AppBanner.data';
import { saveOrUpdate } from '../AppBanner.api';
// Emits
const emit = defineEmits(['register', 'success']);
const isUpdate = ref(true);
const isDetail = ref(false);
//
const [registerForm, { setProps, resetFields, setFieldsValue, validate, scrollToField }] = useForm({
labelWidth: 150,
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: { span: 24 },
});
//
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
//
await resetFields();
setModalProps({ confirmLoading: false, showCancelBtn: !!data?.showFooter, showOkBtn: !!data?.showFooter });
isUpdate.value = !!data?.isUpdate;
isDetail.value = !!data?.showFooter;
if (unref(isUpdate)) {
//
await setFieldsValue({
...data.record,
});
}
//
setProps({ disabled: !data?.showFooter });
});
//
const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑'));
//
async function handleSubmit(v) {
try {
let values = await validate();
setModalProps({ confirmLoading: true });
//
await saveOrUpdate(values, isUpdate.value);
//
closeModal();
//
emit('success');
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>
<style lang="less" scoped>
/** 时间和数字输入框样式 */
:deep(.ant-input-number) {
width: 100%;
}
:deep(.ant-calendar-picker) {
width: 100%;
}
</style>

+ 29
- 130
src/views/miniapp/appuser/AppUser.data.ts View File

@ -6,7 +6,7 @@ import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据 //列表数据
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
{ {
title: '昵称',
title: '用户名',
align: 'center', align: 'center',
dataIndex: 'nickName', dataIndex: 'nickName',
}, },
@ -14,32 +14,18 @@ export const columns: BasicColumn[] = [
title: '头像', title: '头像',
align: 'center', align: 'center',
dataIndex: 'avatar', dataIndex: 'avatar',
customRender: render.renderImage,
}, },
{ {
title: '手机号', title: '手机号',
align: 'center', align: 'center',
dataIndex: 'phone', dataIndex: 'phone',
}, },
{
title: '小程序 openid',
align: 'center',
dataIndex: 'openid',
},
{
title: '小程序 unionid',
align: 'center',
dataIndex: 'unionid',
},
{ {
title: '状态', title: '状态',
align: 'center', align: 'center',
dataIndex: 'status_dictText', dataIndex: 'status_dictText',
}, },
{
title: '邮箱',
align: 'center',
dataIndex: 'email',
},
{ {
title: '最后登录时间', title: '最后登录时间',
align: 'center', align: 'center',
@ -50,11 +36,6 @@ export const columns: BasicColumn[] = [
align: 'center', align: 'center',
dataIndex: 'lastLoginIp', dataIndex: 'lastLoginIp',
}, },
{
title: '邀请人',
align: 'center',
dataIndex: 'inviterId',
},
{ {
title: '创建日期', title: '创建日期',
align: 'center', align: 'center',
@ -69,7 +50,7 @@ export const columns: BasicColumn[] = [
//查询数据 //查询数据
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
{ {
label: '昵称',
label: '用户名',
field: 'nickName', field: 'nickName',
component: 'JInput', component: 'JInput',
}, },
@ -79,29 +60,13 @@ export const searchFormSchema: FormSchema[] = [
component: 'Input', component: 'Input',
//colProps: {span: 6}, //colProps: {span: 6},
}, },
{
label: '小程序 openid',
field: 'openid',
component: 'Input',
//colProps: {span: 6},
},
{
label: '小程序 unionid',
field: 'unionid',
component: 'Input',
//colProps: {span: 6},
},
{ {
label: '状态', label: '状态',
field: 'status', field: 'status',
component: 'JSelectMultiple', component: 'JSelectMultiple',
componentProps: {},
//colProps: {span: 6},
},
{
label: '邮箱',
field: 'email',
component: 'Input',
componentProps: {
dictCode: 'dict_item_status',
},
//colProps: {span: 6}, //colProps: {span: 6},
}, },
{ {
@ -118,110 +83,48 @@ export const searchFormSchema: FormSchema[] = [
//表单数据 //表单数据
export const formSchema: FormSchema[] = [ export const formSchema: FormSchema[] = [
{ {
label: '昵称',
label: '用户名',
field: 'nickName', field: 'nickName',
component: 'Input', component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入用户名!' }];
},
}, },
{ {
label: '头像', label: '头像',
field: 'avatar', field: 'avatar',
component: 'Input',
component: 'JImageUpload',
componentProps: {
fileMax: 0,
},
}, },
{ {
label: '手机号', label: '手机号',
field: 'phone', field: 'phone',
component: 'Input', component: 'Input',
}, },
{
label: '小程序 openid',
field: 'openid',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入小程序 openid!' }];
},
},
{
label: '小程序 unionid',
field: 'unionid',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入小程序 unionid!' }];
},
},
{ {
label: '密码', label: '密码',
field: 'password', field: 'password',
component: 'Input',
component: 'InputPassword',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入密码!' }];
},
}, },
{ {
label: '状态', label: '状态',
field: 'status', field: 'status',
component: 'JDictSelectTag', component: 'JDictSelectTag',
defaultValue: 1,
componentProps: { componentProps: {
dictCode: '',
dictCode: 'dict_item_status',
type: 'radio',
stringToNumber: true,
}, },
dynamicRules: ({ model, schema }) => { dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入状态!' }]; return [{ required: true, message: '请输入状态!' }];
}, },
}, },
{
label: '邮箱',
field: 'email',
component: 'Input',
},
{
label: '最后登录时间',
field: 'lastLoginAt',
component: 'DatePicker',
componentProps: {
showTime: true,
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
{
label: '最后登录 IP',
field: 'lastLoginIp',
component: 'Input',
},
{
label: '密码盐值',
field: 'passwordSalt',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入密码盐值!' }];
},
},
{
label: '邀请人',
field: 'inviterId',
component: 'InputNumber',
},
{
label: '创建日期',
field: 'createTime',
component: 'DatePicker',
componentProps: {
showTime: true,
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入创建日期!' }];
},
},
{
label: '更新日期',
field: 'updateTime',
component: 'DatePicker',
componentProps: {
showTime: true,
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
{
label: '所属部门',
field: 'sysOrgCode',
component: 'Input',
},
// TODO 主键隐藏字段,目前写死为ID // TODO 主键隐藏字段,目前写死为ID
{ {
label: '', label: '',
@ -233,18 +136,14 @@ export const formSchema: FormSchema[] = [
// 高级查询数据 // 高级查询数据
export const superQuerySchema = { export const superQuerySchema = {
nickName: { title: '昵称', order: 0, view: 'text', type: 'string' },
avatar: { title: '头像', order: 1, view: 'text', type: 'string' },
nickName: { title: '用户名', order: 0, view: 'text', type: 'string' },
avatar: { title: '头像', order: 1, view: 'image', type: 'string' },
phone: { title: '手机号', order: 2, view: 'text', type: 'string' }, phone: { title: '手机号', order: 2, view: 'text', type: 'string' },
openid: { title: '小程序 openid', order: 3, view: 'text', type: 'string' },
unionid: { title: '小程序 unionid', order: 4, view: 'text', type: 'string' },
status: { title: '状态', order: 6, view: 'number', type: 'number', dictCode: '' },
email: { title: '邮箱', order: 7, view: 'text', type: 'string' },
lastLoginAt: { title: '最后登录时间', order: 8, view: 'datetime', type: 'string' },
lastLoginIp: { title: '最后登录 IP', order: 9, view: 'text', type: 'string' },
inviterId: { title: '邀请人', order: 11, view: 'number', type: 'number' },
createTime: { title: '创建日期', order: 12, view: 'datetime', type: 'string' },
updateTime: { title: '更新日期', order: 13, view: 'datetime', type: 'string' },
status: { title: '状态', order: 4, view: 'number', type: 'number', dictCode: 'dict_item_status' },
lastLoginAt: { title: '最后登录时间', order: 5, view: 'datetime', type: 'string' },
lastLoginIp: { title: '最后登录 IP', order: 6, view: 'text', type: 'string' },
createTime: { title: '创建日期', order: 7, view: 'datetime', type: 'string' },
updateTime: { title: '更新日期', order: 8, view: 'datetime', type: 'string' },
}; };
/** /**


+ 139
- 138
src/views/miniapp/appuser/AppUserList.vue View File

@ -1,93 +1,94 @@
<template> <template>
<div> <div>
<!--引用表格--> <!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle> <template #tableTitle>
<a-button type="primary" v-auth="'appuser:app_user:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'appuser:app_user:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'appuser:app_user:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls"
>导入</j-upload-button
>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined" />
删除
</a-menu-item>
</a-menu>
</template>
<a-button v-auth="'appuser:app_user:deleteBatch'"
>批量操作
<Icon icon="mdi:chevron-down" />
</a-button>
<a-button type="primary" v-auth="'appuser:app_user:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'appuser:app_user:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'appuser:app_user:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined"></Icon>
删除
</a-menu-item>
</a-menu>
</template>
<a-button v-auth="'appuser:app_user:deleteBatch'">批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown> </a-dropdown>
<!-- 高级查询 --> <!-- 高级查询 -->
<super-query :config="superQueryConfig" @search="handleSuperQuery" /> <super-query :config="superQueryConfig" @search="handleSuperQuery" />
</template> </template>
<!--操作栏-->
<!--操作栏-->
<template #action="{ record }"> <template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
</template> </template>
<!--字段回显插槽--> <!--字段回显插槽-->
<template #bodyCell="{ column, record, index, text }"> </template>
<template v-slot:bodyCell="{ column, record, index, text }">
</template>
</BasicTable> </BasicTable>
<!-- 表单区域 --> <!-- 表单区域 -->
<AppUserModal @register="registerModal" @success="handleSuccess" />
<AppUserModal @register="registerModal" @success="handleSuccess"></AppUserModal>
</div> </div>
</template> </template>
<script lang="ts" name="appuser-appUser" setup> <script lang="ts" name="appuser-appUser" setup>
import { ref, reactive, computed, unref } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import AppUserModal from './components/AppUserModal.vue';
import { columns, searchFormSchema, superQuerySchema } from './AppUser.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './AppUser.api';
import {ref, reactive, computed, unref} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import AppUserModal from './components/AppUserModal.vue'
import {columns, searchFormSchema, superQuerySchema} from './AppUser.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './AppUser.api';
import { downloadFile } from '/@/utils/common/renderUtils'; import { downloadFile } from '/@/utils/common/renderUtils';
import { useUserStore } from '/@/store/modules/user'; import { useUserStore } from '/@/store/modules/user';
const queryParam = reactive<any>({}); const queryParam = reactive<any>({});
const checkedKeys = ref<Array<string | number>>([]); const checkedKeys = ref<Array<string | number>>([]);
const userStore = useUserStore(); const userStore = useUserStore();
//model //model
const [registerModal, { openModal }] = useModal();
const [registerModal, {openModal}] = useModal();
//table //table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '应用用户表',
api: list,
columns,
canResize: false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToNumber: [],
fieldMapToTime: [['createTime', ['createTime_begin', 'createTime_end'], 'YYYY-MM-DD HH:mm:ss']],
},
actionColumn: {
width: 120,
fixed: 'right',
},
beforeFetch: (params) => {
return Object.assign(params, queryParam);
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
tableProps:{
title: '应用用户表',
api: list,
columns,
canResize:false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter:true,
showAdvancedButton:true,
fieldMapToNumber: [
],
fieldMapToTime: [
['createTime', ['createTime_begin', 'createTime_end'], 'YYYY-MM-DD HH:mm:ss'],
],
},
actionColumn: {
width: 120,
fixed:'right'
},
beforeFetch: (params) => {
return Object.assign(params, queryParam);
},
}, },
},
exportConfig: {
name: '应用用户表',
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess,
},
});
exportConfig: {
name:"应用用户表",
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
})
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
// //
const superQueryConfig = reactive(superQuerySchema); const superQueryConfig = reactive(superQuerySchema);
@ -101,90 +102,90 @@
}); });
reload(); reload();
} }
/**
* 新增事件
*/
/**
* 新增事件
*/
function handleAdd() { function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
openModal(true, {
isUpdate: false,
showFooter: true,
});
} }
/**
* 编辑事件
*/
/**
* 编辑事件
*/
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/ */
function handleDetail(record: Recordable) { function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) { async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
await deleteOne({id: record.id}, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() { async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
/**
* 成功回调
*/
await batchDelete({ids: selectedRowKeys.value}, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() { function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: 'appuser:app_user:edit',
},
];
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
},
auth: 'appuser:app_user:delete',
},
];
}
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record){
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: 'appuser:app_user:edit'
}
]
}
/**
* 下拉操作栏
*/
function getDropDownAction(record){
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
},
auth: 'appuser:app_user:delete'
}
]
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
:deep(.ant-picker),
:deep(.ant-input-number) {
:deep(.ant-picker),:deep(.ant-input-number){
width: 100%; width: 100%;
} }
</style>
</style>

+ 0
- 26
src/views/miniapp/appuser/V20250210_1__menu_insert_AppUser.sql View File

@ -1,26 +0,0 @@
-- 注意:该页面对应的前台目录为views/appuser文件夹下
-- 如果你想更改到其他目录,请修改sql中component字段对应的值
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external)
VALUES ('2025021011269440530', NULL, '应用用户表', '/appuser/appUserList', 'appuser/AppUserList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2025-02-10 11:26:53', NULL, NULL, 0);
-- 权限控制sql
-- 新增
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('2025021011269440531', '2025021011269440530', '添加应用用户表', NULL, NULL, 0, NULL, NULL, 2, 'appuser:app_user:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-10 11:26:53', NULL, NULL, 0, 0, '1', 0);
-- 编辑
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('2025021011269440532', '2025021011269440530', '编辑应用用户表', NULL, NULL, 0, NULL, NULL, 2, 'appuser:app_user:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-10 11:26:53', NULL, NULL, 0, 0, '1', 0);
-- 删除
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('2025021011269440533', '2025021011269440530', '删除应用用户表', NULL, NULL, 0, NULL, NULL, 2, 'appuser:app_user:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-10 11:26:53', NULL, NULL, 0, 0, '1', 0);
-- 批量删除
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('2025021011269440534', '2025021011269440530', '批量删除应用用户表', NULL, NULL, 0, NULL, NULL, 2, 'appuser:app_user:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-10 11:26:53', NULL, NULL, 0, 0, '1', 0);
-- 导出excel
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('2025021011269440535', '2025021011269440530', '导出excel_应用用户表', NULL, NULL, 0, NULL, NULL, 2, 'appuser:app_user:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-10 11:26:53', NULL, NULL, 0, 0, '1', 0);
-- 导入excel
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('2025021011269440536', '2025021011269440530', '导入excel_应用用户表', NULL, NULL, 0, NULL, NULL, 2, 'appuser:app_user:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-10 11:26:53', NULL, NULL, 0, 0, '1', 0);

+ 63
- 0
src/views/miniapp/notice/AppNotice.api.ts View File

@ -0,0 +1,63 @@
import { defHttp } from '/src/utils/http/axios';
import { useMessage } from '/src/hooks/web/useMessage';
const { createConfirm } = useMessage();
enum Api {
list = '/notice/appNotice/list',
save = '/notice/appNotice/add',
edit = '/notice/appNotice/edit',
deleteOne = '/notice/appNotice/delete',
deleteBatch = '/notice/appNotice/deleteBatch',
importExcel = '/notice/appNotice/importExcel',
exportXls = '/notice/appNotice/exportXls',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) => defHttp.get({ url: Api.list, params });
/**
*
*/
export const deleteOne = (params, handleSuccess) => {
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
handleSuccess();
});
};
/**
*
* @param params
*/
export const batchDelete = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
handleSuccess();
});
},
});
};
/**
*
* @param params
*/
export const saveOrUpdate = (params, isUpdate) => {
const url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url: url, params });
};

+ 122
- 0
src/views/miniapp/notice/AppNotice.data.ts View File

@ -0,0 +1,122 @@
import { BasicColumn } from '/src/components/Table';
import { FormSchema } from '/src/components/Table';
import { rules } from '/src/utils/helper/validator';
import { render } from '/src/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/src/utils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '标题',
align: 'center',
dataIndex: 'title',
},
{
title: '状态',
align: 'center',
dataIndex: 'status_dictText',
},
{
title: '排序',
align: 'center',
sorter: true,
dataIndex: 'sort',
},
{
title: '创建日期',
align: 'center',
sorter: true,
dataIndex: 'createTime',
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
{
label: '标题',
field: 'title',
component: 'JInput',
},
{
label: '状态',
field: 'status',
component: 'JSelectMultiple',
componentProps: {
dictCode: 'dict_item_status',
},
//colProps: {span: 6},
},
{
label: '创建日期',
field: 'createTime',
component: 'RangePicker',
componentProps: {
valueType: 'Date',
showTime: true,
},
//colProps: {span: 6},
},
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '标题',
field: 'title',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入标题!' }];
},
},
{
label: '内容',
field: 'content',
component: 'JEditor',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入内容!' }];
},
},
{
label: '状态',
field: 'status',
defaultValue: 1,
component: 'JDictSelectTag',
componentProps: {
dictCode: 'dict_item_status',
type: 'radio',
stringToNumber: true,
},
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入状态!' }];
},
},
{
label: '排序',
field: 'sort',
component: 'InputNumber',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入排序!' }];
},
},
// TODO 主键隐藏字段,目前写死为ID
{
label: '',
field: 'id',
component: 'Input',
show: false,
},
];
// 高级查询数据
export const superQuerySchema = {
title: { title: '标题', order: 0, view: 'text', type: 'string' },
status: { title: '状态', order: 2, view: 'number', type: 'number', dictCode: 'dict_item_status' },
sort: { title: '排序', order: 3, view: 'number', type: 'number' },
createTime: { title: '创建日期', order: 4, view: 'datetime', type: 'string' },
};
/**
* formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
return formSchema;
}

+ 190
- 0
src/views/miniapp/notice/AppNoticeList.vue View File

@ -0,0 +1,190 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" v-auth="'notice:app_notice:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'notice:app_notice:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'notice:app_notice:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls"
>导入</j-upload-button
>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined" />
删除
</a-menu-item>
</a-menu>
</template>
<a-button v-auth="'notice:app_notice:deleteBatch'"
>批量操作
<Icon icon="mdi:chevron-down" />
</a-button>
</a-dropdown>
<!-- 高级查询 -->
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</template>
<!--字段回显插槽-->
<template #bodyCell="{ column, record, index, text }"> </template>
</BasicTable>
<!-- 表单区域 -->
<AppNoticeModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" name="notice-appNotice" setup>
import { ref, reactive, computed, unref } from 'vue';
import { BasicTable, useTable, TableAction } from '/src/components/Table';
import { useModal } from '/src/components/Modal';
import { useListPage } from '/src/hooks/system/useListPage';
import AppNoticeModal from './components/AppNoticeModal.vue';
import { columns, searchFormSchema, superQuerySchema } from './AppNotice.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './AppNotice.api';
import { downloadFile } from '/src/utils/common/renderUtils';
import { useUserStore } from '/src/store/modules/user';
const queryParam = reactive<any>({});
const checkedKeys = ref<Array<string | number>>([]);
const userStore = useUserStore();
//model
const [registerModal, { openModal }] = useModal();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '公告管理',
api: list,
columns,
canResize: false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToNumber: [],
fieldMapToTime: [['createTime', ['createTime_begin', 'createTime_end'], 'YYYY-MM-DD HH:mm:ss']],
},
actionColumn: {
width: 120,
fixed: 'right',
},
beforeFetch: (params) => {
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: '公告管理',
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess,
},
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
//
const superQueryConfig = reactive(superQuerySchema);
/**
* 高级查询事件
*/
function handleSuperQuery(params) {
Object.keys(params).map((k) => {
queryParam[k] = params[k];
});
reload();
}
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: 'notice:app_notice:edit',
},
];
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
},
auth: 'notice:app_notice:delete',
},
];
}
</script>
<style lang="less" scoped>
:deep(.ant-picker),
:deep(.ant-input-number) {
width: 100%;
}
</style>

+ 70
- 0
src/views/miniapp/notice/components/AppNoticeForm.vue View File

@ -0,0 +1,70 @@
<template>
<div style="min-height: 400px">
<BasicForm @register="registerForm"></BasicForm>
<div style="width: 100%;text-align: center" v-if="!formDisabled">
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary"> </a-button>
</div>
</div>
</template>
<script lang="ts">
import {BasicForm, useForm} from '/src/components/Form';
import {computed, defineComponent} from 'vue';
import {defHttp} from '/src/utils/http/axios';
import { propTypes } from '/src/utils/propTypes';
import {getBpmFormSchema} from '../AppNotice.data';
import {saveOrUpdate} from '../AppNotice.api';
export default defineComponent({
name: "AppNoticeForm",
components:{
BasicForm
},
props:{
formData: propTypes.object.def({}),
formBpm: propTypes.bool.def(true),
},
setup(props){
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({
labelWidth: 150,
schemas: getBpmFormSchema(props.formData),
showActionButtonGroup: false,
baseColProps: {span: 24}
});
const formDisabled = computed(()=>{
if(props.formData.disabled === false){
return false;
}
return true;
});
let formData = {};
const queryByIdUrl = '/notice/appNotice/queryById';
async function initFormData(){
let params = {id: props.formData.dataId};
const data = await defHttp.get({url: queryByIdUrl, params});
formData = {...data}
//
await setFieldsValue(formData);
//
await setProps({disabled: formDisabled.value})
}
async function submitForm() {
let data = getFieldsValue();
let params = Object.assign({}, formData, data);
console.log('表单数据', params)
await saveOrUpdate(params, true)
}
initFormData();
return {
registerForm,
formDisabled,
submitForm,
}
}
});
</script>

+ 76
- 0
src/views/miniapp/notice/components/AppNoticeModal.vue View File

@ -0,0 +1,76 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
<BasicForm @register="registerForm" name="AppNoticeForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import {ref, computed, unref} from 'vue';
import {BasicModal, useModalInner} from '/src/components/Modal';
import {BasicForm, useForm} from '/src/components/Form';
import {formSchema} from '../AppNotice.data';
import {saveOrUpdate} from '../AppNotice.api';
// Emits
const emit = defineEmits(['register','success']);
const isUpdate = ref(true);
const isDetail = ref(false);
//
const [registerForm, { setProps,resetFields, setFieldsValue, validate, scrollToField }] = useForm({
labelWidth: 150,
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: {span: 24}
});
//
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
//
await resetFields();
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
isUpdate.value = !!data?.isUpdate;
isDetail.value = !!data?.showFooter;
if (unref(isUpdate)) {
//
await setFieldsValue({
...data.record,
});
}
//
setProps({ disabled: !data?.showFooter })
});
//
const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑'));
//
async function handleSubmit(v) {
try {
let values = await validate();
setModalProps({confirmLoading: true});
//
await saveOrUpdate(values, isUpdate.value);
//
closeModal();
//
emit('success');
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
} finally {
setModalProps({confirmLoading: false});
}
}
</script>
<style lang="less" scoped>
/** 时间和数字输入框样式 */
:deep(.ant-input-number) {
width: 100%;
}
:deep(.ant-calendar-picker) {
width: 100%;
}
</style>

+ 63
- 0
src/views/miniapp/product/AppProduct.api.ts View File

@ -0,0 +1,63 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
const { createConfirm } = useMessage();
enum Api {
list = '/product/appProduct/list',
save = '/product/appProduct/add',
edit = '/product/appProduct/edit',
deleteOne = '/product/appProduct/delete',
deleteBatch = '/product/appProduct/deleteBatch',
importExcel = '/product/appProduct/importExcel',
exportXls = '/product/appProduct/exportXls',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) => defHttp.get({ url: Api.list, params });
/**
*
*/
export const deleteOne = (params, handleSuccess) => {
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
handleSuccess();
});
};
/**
*
* @param params
*/
export const batchDelete = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
handleSuccess();
});
},
});
};
/**
*
* @param params
*/
export const saveOrUpdate = (params, isUpdate) => {
const url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url: url, params });
};

+ 123
- 0
src/views/miniapp/product/AppProduct.data.ts View File

@ -0,0 +1,123 @@
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
import {getAllTenantList} from "@/views/system/user/user.api";
//列表数据
export const columns: BasicColumn[] = [
{
title: '产品名称',
align: 'center',
dataIndex: 'name',
},
{
title: '产品分类',
align: 'center',
dataIndex: 'categoryId_dictText',
},
{
title: '产品内容',
align: 'center',
dataIndex: 'content',
},
{
title: '产品合同模板',
align: 'center',
dataIndex: 'pdf',
},
{
title: '创建日期',
align: 'center',
dataIndex: 'createTime',
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
{
label: '产品名称',
field: 'name',
component: 'JInput',
},
{
label: '产品内容',
field: 'content',
component: 'JInput',
},
{
label: '创建日期',
field: 'createTime',
component: 'RangePicker',
componentProps: {
valueType: 'Date',
showTime: true,
},
//colProps: {span: 6},
},
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '产品名称',
field: 'name',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入产品名称!' }];
},
},
{
label: '产品分类',
field: 'categoryId',
component: 'JDictSelectTag',
componentProps: {
mode: 'multiple',
api: getAllTenantList,
numberToString: true,
labelField: 'name',
valueField: 'id',
immediate: false,
},
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入产品分类!' }];
},
},
{
label: '产品内容',
field: 'content',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入产品内容!' }];
},
},
{
label: '产品合同模板',
field: 'pdf',
component: 'JUpload',
componentProps: {},
},
// TODO 主键隐藏字段,目前写死为ID
{
label: '',
field: 'id',
component: 'Input',
show: false,
},
];
// 高级查询数据
export const superQuerySchema = {
name: { title: '产品名称', order: 0, view: 'text', type: 'string' },
categoryId: { title: '产品分类', order: 1, view: 'number', type: 'number', dictCode: '' },
content: { title: '产品内容', order: 2, view: 'text', type: 'string' },
pdf: { title: '产品合同模板', order: 3, view: 'file', type: 'string' },
createTime: { title: '创建日期', order: 4, view: 'datetime', type: 'string' },
};
/**
* formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
return formSchema;
}

+ 198
- 0
src/views/miniapp/product/AppProductList.vue View File

@ -0,0 +1,198 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" v-auth="'product:app_product:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'product:app_product:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'product:app_product:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls"
>导入</j-upload-button
>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined" />
删除
</a-menu-item>
</a-menu>
</template>
<a-button v-auth="'product:app_product:deleteBatch'"
>批量操作
<Icon icon="mdi:chevron-down" />
</a-button>
</a-dropdown>
<!-- 高级查询 -->
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</template>
<!--字段回显插槽-->
<template #bodyCell="{ column, record, index, text }">
<template v-if="column.dataIndex === 'pdf'">
<!--文件字段回显插槽-->
<span v-if="!text" style="font-size: 12px; font-style: italic">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)"
>下载</a-button
>
</template>
</template>
</BasicTable>
<!-- 表单区域 -->
<AppProductModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" name="product-appProduct" setup>
import { ref, reactive, computed, unref } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import AppProductModal from './components/AppProductModal.vue';
import { columns, searchFormSchema, superQuerySchema } from './AppProduct.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './AppProduct.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import { useUserStore } from '/@/store/modules/user';
const queryParam = reactive<any>({});
const checkedKeys = ref<Array<string | number>>([]);
const userStore = useUserStore();
//model
const [registerModal, { openModal }] = useModal();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '产品管理',
api: list,
columns,
canResize: false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToNumber: [],
fieldMapToTime: [['createTime', ['createTime_begin', 'createTime_end'], 'YYYY-MM-DD HH:mm:ss']],
},
actionColumn: {
width: 120,
fixed: 'right',
},
beforeFetch: (params) => {
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: '产品管理',
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess,
},
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
//
const superQueryConfig = reactive(superQuerySchema);
/**
* 高级查询事件
*/
function handleSuperQuery(params) {
Object.keys(params).map((k) => {
queryParam[k] = params[k];
});
reload();
}
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: 'product:app_product:edit',
},
];
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
},
auth: 'product:app_product:delete',
},
];
}
</script>
<style lang="less" scoped>
:deep(.ant-picker),
:deep(.ant-input-number) {
width: 100%;
}
</style>

+ 70
- 0
src/views/miniapp/product/components/AppProductForm.vue View File

@ -0,0 +1,70 @@
<template>
<div style="min-height: 400px">
<BasicForm @register="registerForm"></BasicForm>
<div style="width: 100%;text-align: center" v-if="!formDisabled">
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary"> </a-button>
</div>
</div>
</template>
<script lang="ts">
import {BasicForm, useForm} from '/@/components/Form/index';
import {computed, defineComponent} from 'vue';
import {defHttp} from '/@/utils/http/axios';
import { propTypes } from '/@/utils/propTypes';
import {getBpmFormSchema} from '../AppProduct.data';
import {saveOrUpdate} from '../AppProduct.api';
export default defineComponent({
name: "AppProductForm",
components:{
BasicForm
},
props:{
formData: propTypes.object.def({}),
formBpm: propTypes.bool.def(true),
},
setup(props){
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({
labelWidth: 150,
schemas: getBpmFormSchema(props.formData),
showActionButtonGroup: false,
baseColProps: {span: 24}
});
const formDisabled = computed(()=>{
if(props.formData.disabled === false){
return false;
}
return true;
});
let formData = {};
const queryByIdUrl = '/product/appProduct/queryById';
async function initFormData(){
let params = {id: props.formData.dataId};
const data = await defHttp.get({url: queryByIdUrl, params});
formData = {...data}
//
await setFieldsValue(formData);
//
await setProps({disabled: formDisabled.value})
}
async function submitForm() {
let data = getFieldsValue();
let params = Object.assign({}, formData, data);
console.log('表单数据', params)
await saveOrUpdate(params, true)
}
initFormData();
return {
registerForm,
formDisabled,
submitForm,
}
}
});
</script>

+ 76
- 0
src/views/miniapp/product/components/AppProductModal.vue View File

@ -0,0 +1,76 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
<BasicForm @register="registerForm" name="AppProductForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import {ref, computed, unref} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index';
import {formSchema} from '../AppProduct.data';
import {saveOrUpdate} from '../AppProduct.api';
// Emits
const emit = defineEmits(['register','success']);
const isUpdate = ref(true);
const isDetail = ref(false);
//
const [registerForm, { setProps,resetFields, setFieldsValue, validate, scrollToField }] = useForm({
labelWidth: 150,
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: {span: 24}
});
//
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
//
await resetFields();
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
isUpdate.value = !!data?.isUpdate;
isDetail.value = !!data?.showFooter;
if (unref(isUpdate)) {
//
await setFieldsValue({
...data.record,
});
}
//
setProps({ disabled: !data?.showFooter })
});
//
const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑'));
//
async function handleSubmit(v) {
try {
let values = await validate();
setModalProps({confirmLoading: true});
//
await saveOrUpdate(values, isUpdate.value);
//
closeModal();
//
emit('success');
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
} finally {
setModalProps({confirmLoading: false});
}
}
</script>
<style lang="less" scoped>
/** 时间和数字输入框样式 */
:deep(.ant-input-number) {
width: 100%;
}
:deep(.ant-calendar-picker) {
width: 100%;
}
</style>

+ 64
- 0
src/views/miniapp/productCategory/AppCategory.api.ts View File

@ -0,0 +1,64 @@
import {defHttp} from '/@/utils/http/axios';
import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/productCategory/appCategory/list',
save='/productCategory/appCategory/add',
edit='/productCategory/appCategory/edit',
deleteOne = '/productCategory/appCategory/delete',
deleteBatch = '/productCategory/appCategory/deleteBatch',
importExcel = '/productCategory/appCategory/importExcel',
exportXls = '/productCategory/appCategory/exportXls',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) =>
defHttp.get({url: Api.list, params});
/**
*
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
/**
*
* @param params
*/
export const batchDelete = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
});
}
/**
*
* @param params
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({url: url, params});
}

+ 71
- 0
src/views/miniapp/productCategory/AppCategory.data.ts View File

@ -0,0 +1,71 @@
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '名称',
align:"center",
dataIndex: 'categoryName'
},
{
title: '创建日期',
align:"center",
dataIndex: 'createTime'
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
{
label: "名称",
field: "categoryName",
component: 'JInput',
},
{
label: "创建日期",
field: "createTime",
component: 'RangePicker',
componentProps: {
valueType: 'Date',
showTime:true
},
//colProps: {span: 6},
},
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '名称',
field: 'categoryName',
component: 'Input',
dynamicRules: ({model,schema}) => {
return [
{ required: true, message: '请输入名称!'},
];
},
},
// TODO 主键隐藏字段,目前写死为ID
{
label: '',
field: 'id',
component: 'Input',
show: false
},
];
// 高级查询数据
export const superQuerySchema = {
categoryName: {title: '名称',order: 0,view: 'text', type: 'string',},
createTime: {title: '创建日期',order: 1,view: 'datetime', type: 'string',},
};
/**
* formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
return formSchema;
}

+ 191
- 0
src/views/miniapp/productCategory/AppCategoryList.vue View File

@ -0,0 +1,191 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" v-auth="'productCategory:app_category:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'productCategory:app_category:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'productCategory:app_category:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined"></Icon>
删除
</a-menu-item>
</a-menu>
</template>
<a-button v-auth="'productCategory:app_category:deleteBatch'">批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
<!-- 高级查询 -->
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
</template>
<!--字段回显插槽-->
<template v-slot:bodyCell="{ column, record, index, text }">
</template>
</BasicTable>
<!-- 表单区域 -->
<AppCategoryModal @register="registerModal" @success="handleSuccess"></AppCategoryModal>
</div>
</template>
<script lang="ts" name="productCategory-appCategory" setup>
import {ref, reactive, computed, unref} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import AppCategoryModal from './components/AppCategoryModal.vue'
import {columns, searchFormSchema, superQuerySchema} from './AppCategory.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './AppCategory.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import { useUserStore } from '/@/store/modules/user';
const queryParam = reactive<any>({});
const checkedKeys = ref<Array<string | number>>([]);
const userStore = useUserStore();
//model
const [registerModal, {openModal}] = useModal();
//table
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
tableProps:{
title: '产品分类管理',
api: list,
columns,
canResize:false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter:true,
showAdvancedButton:true,
fieldMapToNumber: [
],
fieldMapToTime: [
['createTime', ['createTime_begin', 'createTime_end'], 'YYYY-MM-DD HH:mm:ss'],
],
},
actionColumn: {
width: 120,
fixed:'right'
},
beforeFetch: (params) => {
return Object.assign(params, queryParam);
},
},
exportConfig: {
name:"产品分类管理",
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
})
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
//
const superQueryConfig = reactive(superQuerySchema);
/**
* 高级查询事件
*/
function handleSuperQuery(params) {
Object.keys(params).map((k) => {
queryParam[k] = params[k];
});
reload();
}
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({id: record.id}, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ids: selectedRowKeys.value}, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record){
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: 'productCategory:app_category:edit'
}
]
}
/**
* 下拉操作栏
*/
function getDropDownAction(record){
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
},
auth: 'productCategory:app_category:delete'
}
]
}
</script>
<style lang="less" scoped>
:deep(.ant-picker),:deep(.ant-input-number){
width: 100%;
}
</style>

+ 70
- 0
src/views/miniapp/productCategory/components/AppCategoryForm.vue View File

@ -0,0 +1,70 @@
<template>
<div style="min-height: 400px">
<BasicForm @register="registerForm"></BasicForm>
<div style="width: 100%;text-align: center" v-if="!formDisabled">
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary"> </a-button>
</div>
</div>
</template>
<script lang="ts">
import {BasicForm, useForm} from '/@/components/Form/index';
import {computed, defineComponent} from 'vue';
import {defHttp} from '/@/utils/http/axios';
import { propTypes } from '/@/utils/propTypes';
import {getBpmFormSchema} from '../AppCategory.data';
import {saveOrUpdate} from '../AppCategory.api';
export default defineComponent({
name: "AppCategoryForm",
components:{
BasicForm
},
props:{
formData: propTypes.object.def({}),
formBpm: propTypes.bool.def(true),
},
setup(props){
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({
labelWidth: 150,
schemas: getBpmFormSchema(props.formData),
showActionButtonGroup: false,
baseColProps: {span: 24}
});
const formDisabled = computed(()=>{
if(props.formData.disabled === false){
return false;
}
return true;
});
let formData = {};
const queryByIdUrl = '/productCategory/appCategory/queryById';
async function initFormData(){
let params = {id: props.formData.dataId};
const data = await defHttp.get({url: queryByIdUrl, params});
formData = {...data}
//
await setFieldsValue(formData);
//
await setProps({disabled: formDisabled.value})
}
async function submitForm() {
let data = getFieldsValue();
let params = Object.assign({}, formData, data);
console.log('表单数据', params)
await saveOrUpdate(params, true)
}
initFormData();
return {
registerForm,
formDisabled,
submitForm,
}
}
});
</script>

+ 76
- 0
src/views/miniapp/productCategory/components/AppCategoryModal.vue View File

@ -0,0 +1,76 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
<BasicForm @register="registerForm" name="AppCategoryForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import {ref, computed, unref} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index';
import {formSchema} from '../AppCategory.data';
import {saveOrUpdate} from '../AppCategory.api';
// Emits
const emit = defineEmits(['register','success']);
const isUpdate = ref(true);
const isDetail = ref(false);
//
const [registerForm, { setProps,resetFields, setFieldsValue, validate, scrollToField }] = useForm({
labelWidth: 150,
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: {span: 24}
});
//
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
//
await resetFields();
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
isUpdate.value = !!data?.isUpdate;
isDetail.value = !!data?.showFooter;
if (unref(isUpdate)) {
//
await setFieldsValue({
...data.record,
});
}
//
setProps({ disabled: !data?.showFooter })
});
//
const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑'));
//
async function handleSubmit(v) {
try {
let values = await validate();
setModalProps({confirmLoading: true});
//
await saveOrUpdate(values, isUpdate.value);
//
closeModal();
//
emit('success');
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
} finally {
setModalProps({confirmLoading: false});
}
}
</script>
<style lang="less" scoped>
/** 时间和数字输入框样式 */
:deep(.ant-input-number) {
width: 100%;
}
:deep(.ant-calendar-picker) {
width: 100%;
}
</style>

+ 63
- 0
src/views/miniapp/store/AppStore.api.ts View File

@ -0,0 +1,63 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
const { createConfirm } = useMessage();
enum Api {
list = '/store/appStore/list',
save = '/store/appStore/add',
edit = '/store/appStore/edit',
deleteOne = '/store/appStore/delete',
deleteBatch = '/store/appStore/deleteBatch',
importExcel = '/store/appStore/importExcel',
exportXls = '/store/appStore/exportXls',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) => defHttp.get({ url: Api.list, params });
/**
*
*/
export const deleteOne = (params, handleSuccess) => {
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
handleSuccess();
});
};
/**
*
* @param params
*/
export const batchDelete = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
handleSuccess();
});
},
});
};
/**
*
* @param params
*/
export const saveOrUpdate = (params, isUpdate) => {
const url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url: url, params });
};

+ 99
- 0
src/views/miniapp/store/AppStore.data.ts View File

@ -0,0 +1,99 @@
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '门店名称',
align: 'center',
dataIndex: 'storeName',
},
{
title: '状态',
align: 'center',
dataIndex: 'status_dictText',
},
{
title: '备注',
align: 'center',
dataIndex: 'remark',
},
{
title: '创建日期',
align: 'center',
dataIndex: 'createTime',
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
{
label: '门店名称',
field: 'storeName',
component: 'JInput',
},
{
label: '状态',
field: 'status',
component: 'JSelectMultiple',
componentProps: {
dictCode: 'dict_item_status',
},
//colProps: {span: 6},
},
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '门店名称',
field: 'storeName',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入门店名称!' }];
},
},
{
label: '状态',
field: 'status',
defaultValue: 1,
component: 'JDictSelectTag',
componentProps: {
dictCode: 'dict_item_status',
type: 'radio',
stringToNumber: true,
},
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入状态!' }];
},
},
{
label: '备注',
field: 'remark',
component: 'Input',
},
// TODO 主键隐藏字段,目前写死为ID
{
label: '',
field: 'id',
component: 'Input',
show: false,
},
];
// 高级查询数据
export const superQuerySchema = {
storeName: { title: '门店名称', order: 0, view: 'text', type: 'string' },
status: { title: '状态', order: 1, view: 'number', type: 'number', dictCode: 'dict_item_status' },
remark: { title: '备注', order: 2, view: 'text', type: 'string' },
createTime: { title: '创建日期', order: 3, view: 'datetime', type: 'string' },
};
/**
* formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
return formSchema;
}

+ 190
- 0
src/views/miniapp/store/AppStoreList.vue View File

@ -0,0 +1,190 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" v-auth="'store:app_store:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'store:app_store:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'store:app_store:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls"
>导入</j-upload-button
>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined" />
删除
</a-menu-item>
</a-menu>
</template>
<a-button v-auth="'store:app_store:deleteBatch'"
>批量操作
<Icon icon="mdi:chevron-down" />
</a-button>
</a-dropdown>
<!-- 高级查询 -->
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</template>
<!--字段回显插槽-->
<template #bodyCell="{ column, record, index, text }"> </template>
</BasicTable>
<!-- 表单区域 -->
<AppStoreModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" name="store-appStore" setup>
import { ref, reactive, computed, unref } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import AppStoreModal from './components/AppStoreModal.vue';
import { columns, searchFormSchema, superQuerySchema } from './AppStore.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './AppStore.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import { useUserStore } from '/@/store/modules/user';
const queryParam = reactive<any>({});
const checkedKeys = ref<Array<string | number>>([]);
const userStore = useUserStore();
//model
const [registerModal, { openModal }] = useModal();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '门店管理',
api: list,
columns,
canResize: false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToNumber: [],
fieldMapToTime: [],
},
actionColumn: {
width: 120,
fixed: 'right',
},
beforeFetch: (params) => {
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: '门店管理',
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess,
},
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
//
const superQueryConfig = reactive(superQuerySchema);
/**
* 高级查询事件
*/
function handleSuperQuery(params) {
Object.keys(params).map((k) => {
queryParam[k] = params[k];
});
reload();
}
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: 'store:app_store:edit',
},
];
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
},
auth: 'store:app_store:delete',
},
];
}
</script>
<style lang="less" scoped>
:deep(.ant-picker),
:deep(.ant-input-number) {
width: 100%;
}
</style>

+ 70
- 0
src/views/miniapp/store/components/AppStoreForm.vue View File

@ -0,0 +1,70 @@
<template>
<div style="min-height: 400px">
<BasicForm @register="registerForm" />
<div style="width: 100%; text-align: center" v-if="!formDisabled">
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary"> </a-button>
</div>
</div>
</template>
<script lang="ts">
import { BasicForm, useForm } from '/@/components/Form/index';
import { computed, defineComponent } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { propTypes } from '/@/utils/propTypes';
import { getBpmFormSchema } from '../AppStore.data';
import { saveOrUpdate } from '../AppStore.api';
export default defineComponent({
name: 'AppStoreForm',
components: {
BasicForm,
},
props: {
formData: propTypes.object.def({}),
formBpm: propTypes.bool.def(true),
},
setup(props) {
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({
labelWidth: 150,
schemas: getBpmFormSchema(props.formData),
showActionButtonGroup: false,
baseColProps: { span: 24 },
});
const formDisabled = computed(() => {
if (props.formData.disabled === false) {
return false;
}
return true;
});
let formData = {};
const queryByIdUrl = '/store/appStore/queryById';
async function initFormData() {
let params = { id: props.formData.dataId };
const data = await defHttp.get({ url: queryByIdUrl, params });
formData = { ...data };
//
await setFieldsValue(formData);
//
await setProps({ disabled: formDisabled.value });
}
async function submitForm() {
let data = getFieldsValue();
let params = Object.assign({}, formData, data);
console.log('表单数据', params);
await saveOrUpdate(params, true);
}
initFormData();
return {
registerForm,
formDisabled,
submitForm,
};
},
});
</script>

+ 76
- 0
src/views/miniapp/store/components/AppStoreModal.vue View File

@ -0,0 +1,76 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
<BasicForm @register="registerForm" name="AppStoreForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, unref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { formSchema } from '../AppStore.data';
import { saveOrUpdate } from '../AppStore.api';
// Emits
const emit = defineEmits(['register', 'success']);
const isUpdate = ref(true);
const isDetail = ref(false);
//
const [registerForm, { setProps, resetFields, setFieldsValue, validate, scrollToField }] = useForm({
labelWidth: 150,
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: { span: 24 },
});
//
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
//
await resetFields();
setModalProps({ confirmLoading: false, showCancelBtn: !!data?.showFooter, showOkBtn: !!data?.showFooter });
isUpdate.value = !!data?.isUpdate;
isDetail.value = !!data?.showFooter;
if (unref(isUpdate)) {
//
await setFieldsValue({
...data.record,
});
}
//
setProps({ disabled: !data?.showFooter });
});
//
const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑'));
//
async function handleSubmit(v) {
try {
let values = await validate();
setModalProps({ confirmLoading: true });
//
await saveOrUpdate(values, isUpdate.value);
//
closeModal();
//
emit('success');
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>
<style lang="less" scoped>
/** 时间和数字输入框样式 */
:deep(.ant-input-number) {
width: 100%;
}
:deep(.ant-calendar-picker) {
width: 100%;
}
</style>

Loading…
Cancel
Save