Browse Source

feat:新增小程序信息配置,优化订单状态回显

master
tanzhisong 5 days ago
parent
commit
4b784953bf
9 changed files with 577 additions and 1 deletions
  1. +28
    -0
      .env.test
  2. +1
    -0
      package.json
  3. +64
    -0
      src/views/miniapp/miniappInfo/AppMiniappInfo.api.ts
  4. +109
    -0
      src/views/miniapp/miniappInfo/AppMiniappInfo.data.ts
  5. +202
    -0
      src/views/miniapp/miniappInfo/AppMiniappInfoList.vue
  6. +26
    -0
      src/views/miniapp/miniappInfo/V20250224_1__menu_insert_AppMiniappInfo.sql
  7. +70
    -0
      src/views/miniapp/miniappInfo/components/AppMiniappInfoForm.vue
  8. +76
    -0
      src/views/miniapp/miniappInfo/components/AppMiniappInfoModal.vue
  9. +1
    -1
      src/views/miniapp/order/AppOrder.data.ts

+ 28
- 0
.env.test View File

@ -0,0 +1,28 @@
# 是否启用mock
VITE_USE_MOCK = false
# 发布路径
VITE_PUBLIC_PATH = /
# 是否启用gzip或brotli压缩
# 选项值: gzip | brotli | none
# 如果需要多个可以使用“,”分隔
VITE_BUILD_COMPRESS = 'gzip'
# 使用压缩时是否删除原始文件,默认为false
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
#后台接口父地址(必填)
VITE_GLOB_API_URL=/contract
#后台接口全路径地址(必填)
VITE_GLOB_DOMAIN_URL=https://shengchuangyunkong.com/contract
# 接口父路径前缀
VITE_GLOB_API_URL_PREFIX=
# 填写后将作为乾坤子应用启动,主应用注册时AppName需保持一致(放开 VITE_GLOB_QIANKUN_MICRO_APP_NAME 参数表示jeecg-vue3将以乾坤子应用模式启动)
#VITE_GLOB_QIANKUN_MICRO_APP_NAME=jeecg-vue3
# 作为乾坤子应用启动时必填,需与qiankun主应用注册子应用时填写的 entry 保持一致
#VITE_GLOB_QIANKUN_MICRO_APP_ENTRY=//qiankun.boot3.jeecg.com/jeecg-vue3

+ 1
- 0
package.json View File

@ -10,6 +10,7 @@
"pinstall": "pnpm install",
"clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite",
"dev": "vite",
"build:test": "cross-env NODE_ENV=test NODE_OPTIONS=--max-old-space-size=8192 vite build && esno ./build/script/postBuild.ts",
"build": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=8192 vite build && esno ./build/script/postBuild.ts",
"build:report": "pnpm clean:cache && cross-env REPORT=true npm run build",
"preview": "npm run build && vite preview",


+ 64
- 0
src/views/miniapp/miniappInfo/AppMiniappInfo.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 = '/miniappInfo/appMiniappInfo/list',
save='/miniappInfo/appMiniappInfo/add',
edit='/miniappInfo/appMiniappInfo/edit',
deleteOne = '/miniappInfo/appMiniappInfo/delete',
deleteBatch = '/miniappInfo/appMiniappInfo/deleteBatch',
importExcel = '/miniappInfo/appMiniappInfo/importExcel',
exportXls = '/miniappInfo/appMiniappInfo/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});
}

+ 109
- 0
src/views/miniapp/miniappInfo/AppMiniappInfo.data.ts View File

@ -0,0 +1,109 @@
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: 'name'
},
{
title: 'logo',
align:"center",
dataIndex: 'logo',
customRender:render.renderImage,
},
{
title: '用户协议',
align:"center",
dataIndex: 'agreement',
},
{
title: '隐私协议',
align:"center",
dataIndex: 'privacy',
},
{
title: '关于我们',
align:"center",
dataIndex: 'aboutUs',
},
{
title: '客服电话',
align:"center",
dataIndex: 'serviceNumer'
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
{
label: "小程序名称",
field: "name",
component: 'JInput',
},
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '小程序名称',
field: 'name',
component: 'Input',
},
{
label: 'logo',
field: 'logo',
component: 'JImageUpload',
componentProps:{
fileMax: 0
},
},
{
label: '用户协议',
field: 'agreement',
component: 'JEditor',
},
{
label: '隐私协议',
field: 'privacy',
component: 'JEditor',
},
{
label: '关于我们',
field: 'aboutUs',
component: 'JEditor',
},
{
label: '客服电话',
field: 'serviceNumer',
component: 'Input',
},
// TODO 主键隐藏字段,目前写死为ID
{
label: '',
field: 'id',
component: 'Input',
show: false
},
];
// 高级查询数据
export const superQuerySchema = {
name: {title: '小程序名称',order: 0,view: 'text', type: 'string',},
logo: {title: 'logo',order: 1,view: 'image', type: 'string',},
agreement: {title: '用户协议',order: 2,view: 'umeditor', type: 'string',},
privacy: {title: '隐私协议',order: 3,view: 'umeditor', type: 'string',},
aboutUs: {title: '关于我们',order: 4,view: 'umeditor', type: 'string',},
serviceNumer: {title: '客服电话',order: 5,view: 'text', type: 'string',},
};
/**
* formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
return formSchema;
}

+ 202
- 0
src/views/miniapp/miniappInfo/AppMiniappInfoList.vue View File

@ -0,0 +1,202 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" v-auth="'miniappInfo:app_miniapp_info:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'miniappInfo:app_miniapp_info:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'miniappInfo:app_miniapp_info: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="'miniappInfo:app_miniapp_info: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 v-if="column.dataIndex==='agreement'">
<!--富文本件字段回显插槽-->
<div v-html="text"></div>
</template>
<template v-if="column.dataIndex==='privacy'">
<!--富文本件字段回显插槽-->
<div v-html="text"></div>
</template>
<template v-if="column.dataIndex==='aboutUs'">
<!--富文本件字段回显插槽-->
<div v-html="text"></div>
</template>
</template>
</BasicTable>
<!-- 表单区域 -->
<AppMiniappInfoModal @register="registerModal" @success="handleSuccess"></AppMiniappInfoModal>
</div>
</template>
<script lang="ts" name="miniappInfo-appMiniappInfo" 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 AppMiniappInfoModal from './components/AppMiniappInfoModal.vue'
import {columns, searchFormSchema, superQuerySchema} from './AppMiniappInfo.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './AppMiniappInfo.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: 'miniappInfo:app_miniapp_info:edit'
}
]
}
/**
* 下拉操作栏
*/
function getDropDownAction(record){
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
},
auth: 'miniappInfo:app_miniapp_info:delete'
}
]
}
</script>
<style lang="less" scoped>
:deep(.ant-picker),:deep(.ant-input-number){
width: 100%;
}
</style>

+ 26
- 0
src/views/miniapp/miniappInfo/V20250224_1__menu_insert_AppMiniappInfo.sql View File

@ -0,0 +1,26 @@
-- 注意:该页面对应的前台目录为views/miniappInfo文件夹下
-- 如果你想更改到其他目录,请修改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 ('2025022403579150100', NULL, '小程序信息管理', '/miniappInfo/appMiniappInfoList', '/miniapp/miniappInfo/AppMiniappInfoList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2025-02-24 15:57:10', 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 ('2025022403579150101', '2025022403579150100', '添加小程序信息管理', NULL, NULL, 0, NULL, NULL, 2, 'miniappInfo:app_miniapp_info:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-24 15:57:10', 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 ('2025022403579150102', '2025022403579150100', '编辑小程序信息管理', NULL, NULL, 0, NULL, NULL, 2, 'miniappInfo:app_miniapp_info:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-24 15:57:10', 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 ('2025022403579150103', '2025022403579150100', '删除小程序信息管理', NULL, NULL, 0, NULL, NULL, 2, 'miniappInfo:app_miniapp_info:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-24 15:57:10', 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 ('2025022403579150104', '2025022403579150100', '批量删除小程序信息管理', NULL, NULL, 0, NULL, NULL, 2, 'miniappInfo:app_miniapp_info:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-24 15:57:10', 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 ('2025022403579150105', '2025022403579150100', '导出excel_小程序信息管理', NULL, NULL, 0, NULL, NULL, 2, 'miniappInfo:app_miniapp_info:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-24 15:57:10', 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 ('2025022403579150106', '2025022403579150100', '导入excel_小程序信息管理', NULL, NULL, 0, NULL, NULL, 2, 'miniappInfo:app_miniapp_info:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-24 15:57:10', NULL, NULL, 0, 0, '1', 0);

+ 70
- 0
src/views/miniapp/miniappInfo/components/AppMiniappInfoForm.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 '../AppMiniappInfo.data';
import {saveOrUpdate} from '../AppMiniappInfo.api';
export default defineComponent({
name: "AppMiniappInfoForm",
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 = '/miniappInfo/appMiniappInfo/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/miniappInfo/components/AppMiniappInfoModal.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="AppMiniappInfoForm" />
</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 '../AppMiniappInfo.data';
import {saveOrUpdate} from '../AppMiniappInfo.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>

+ 1
- 1
src/views/miniapp/order/AppOrder.data.ts View File

@ -364,7 +364,7 @@ export const formSchema: FormSchema[] = [
componentProps: {
dictCode: 'order_status',
type: 'radio',
stringToNumer: true,
stringToNumber: true,
},
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入订单状态!' }];


Loading…
Cancel
Save