Browse Source

feat:产品管理分类关联

master
tanzs 1 week ago
parent
commit
a02abd2a06
3 changed files with 66 additions and 69 deletions
  1. +5
    -12
      src/views/miniapp/product/AppProduct.data.ts
  2. +21
    -15
      src/views/miniapp/productCategory/AppCategory.api.ts
  3. +40
    -42
      src/views/miniapp/productCategory/AppCategory.data.ts

+ 5
- 12
src/views/miniapp/product/AppProduct.data.ts View File

@ -4,6 +4,7 @@ import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
import {getAllTenantList} from "@/views/system/user/user.api";
import {allProductCagegoryList} from "@/views/miniapp/productCategory/AppCategory.api";
//列表数据
export const columns: BasicColumn[] = [
{
@ -11,11 +12,6 @@ export const columns: BasicColumn[] = [
align: 'center',
dataIndex: 'name',
},
{
title: '产品分类',
align: 'center',
dataIndex: 'categoryId_dictText',
},
{
title: '产品内容',
align: 'center',
@ -68,26 +64,23 @@ export const formSchema: FormSchema[] = [
{
label: '产品分类',
field: 'categoryId',
component: 'JDictSelectTag',
component: 'ApiSelect',
componentProps: {
mode: 'multiple',
api: getAllTenantList,
api: allProductCagegoryList,
numberToString: true,
labelField: 'name',
labelField: 'categoryName',
valueField: 'id',
immediate: false,
},
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入产品分类!' }];
return [{ required: true, message: '请选择产品分类!' }];
},
},
{
label: '产品内容',
field: 'content',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入产品内容!' }];
},
},
{
label: '产品合同模板',


+ 21
- 15
src/views/miniapp/productCategory/AppCategory.api.ts View File

@ -1,16 +1,17 @@
import {defHttp} from '/@/utils/http/axios';
import { useMessage } from "/@/hooks/web/useMessage";
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',
save = '/productCategory/appCategory/add',
edit = '/productCategory/appCategory/edit',
deleteOne = '/productCategory/appCategory/delete',
deleteBatch = '/productCategory/appCategory/deleteBatch',
importExcel = '/productCategory/appCategory/importExcel',
exportXls = '/productCategory/appCategory/exportXls',
allProductCagegoryList = '/productCategory/appCategory/queryList',
}
/**
* api
@ -25,17 +26,22 @@ export const getImportUrl = Api.importExcel;
*
* @param params
*/
export const list = (params) =>
defHttp.get({url: Api.list, params});
export const list = (params) => defHttp.get({ url: Api.list, params });
/**
*
* @param params
*/
export const allProductCagegoryList = (params) => defHttp.get({ url: Api.allProductCagegoryList, params });
/**
*
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
export const deleteOne = (params, handleSuccess) => {
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
handleSuccess();
});
}
};
/**
*
* @param params
@ -48,17 +54,17 @@ export const batchDelete = (params, handleSuccess) => {
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
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});
}
const url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url: url, params });
};

+ 40
- 42
src/views/miniapp/productCategory/AppCategory.data.ts View File

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

Loading…
Cancel
Save