Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 6m9s
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 6m9s
This commit is contained in:
@@ -7,7 +7,7 @@ VITE_COMPRESS=gzip
|
||||
VITE_PWA=false
|
||||
|
||||
# vue-router 的模式
|
||||
VITE_ROUTER_HISTORY=history
|
||||
VITE_ROUTER_HISTORY=hash
|
||||
|
||||
# 是否注入全局loading
|
||||
VITE_INJECT_APP_LOADING=true
|
||||
|
@@ -10,7 +10,7 @@ VITE_COMPRESS=gzip
|
||||
VITE_PWA=false
|
||||
|
||||
# vue-router 的模式
|
||||
VITE_ROUTER_HISTORY=history
|
||||
VITE_ROUTER_HISTORY=hash
|
||||
|
||||
# 是否注入全局loading
|
||||
VITE_INJECT_APP_LOADING=true
|
||||
|
@@ -15,6 +15,10 @@ export function assetTypeList(params?: AssetTypeQuery) {
|
||||
return requestClient.get<PageResult<AssetTypeVO>>('/property/assetType/list', { params });
|
||||
}
|
||||
|
||||
export function assetTypeselect() {
|
||||
return requestClient.get<AssetTypeVO[]>('/property/assetType/list');
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出资产类型列表
|
||||
* @param params
|
61
apps/web-antd/src/api/sis/personLib/index.ts
Normal file
61
apps/web-antd/src/api/sis/personLib/index.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import type { PersonLibVO, PersonLibForm, PersonLibQuery } from './model';
|
||||
|
||||
import type { ID, IDS } from '#/api/common';
|
||||
import type { PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 查询人像库列表
|
||||
* @param params
|
||||
* @returns 人像库列表
|
||||
*/
|
||||
export function personLibList(params?: PersonLibQuery) {
|
||||
return requestClient.get<PageResult<PersonLibVO>>('/sis/personLib/list', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出人像库列表
|
||||
* @param params
|
||||
* @returns 人像库列表
|
||||
*/
|
||||
export function personLibExport(params?: PersonLibQuery) {
|
||||
return commonExport('/sis/personLib/export', params ?? {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询人像库详情
|
||||
* @param id id
|
||||
* @returns 人像库详情
|
||||
*/
|
||||
export function personLibInfo(id: ID) {
|
||||
return requestClient.get<PersonLibVO>(`/sis/personLib/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增人像库
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function personLibAdd(data: PersonLibForm) {
|
||||
return requestClient.postWithMsg<void>('/sis/personLib', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新人像库
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function personLibUpdate(data: PersonLibForm) {
|
||||
return requestClient.putWithMsg<void>('/sis/personLib', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除人像库
|
||||
* @param id id
|
||||
* @returns void
|
||||
*/
|
||||
export function personLibRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/sis/personLib/${id}`);
|
||||
}
|
144
apps/web-antd/src/api/sis/personLib/model.d.ts
vendored
Normal file
144
apps/web-antd/src/api/sis/personLib/model.d.ts
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||
|
||||
export interface PersonLibVO {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 人员库编码
|
||||
*/
|
||||
libCode: string;
|
||||
|
||||
/**
|
||||
* 人员库名称
|
||||
*/
|
||||
libName: string;
|
||||
|
||||
/**
|
||||
* 人员库描述
|
||||
*/
|
||||
libDesc: string;
|
||||
|
||||
/**
|
||||
* 库类型,1:人员库,2:工服库
|
||||
*/
|
||||
libType: number;
|
||||
|
||||
/**
|
||||
* 库的业务类型 1: 门禁库,2: 黑名单库
|
||||
*/
|
||||
busiType: number;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
createById: string | number;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
updateById: string | number;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue: string;
|
||||
|
||||
}
|
||||
|
||||
export interface PersonLibForm extends BaseEntity {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 人员库编码
|
||||
*/
|
||||
libCode?: string;
|
||||
|
||||
/**
|
||||
* 人员库名称
|
||||
*/
|
||||
libName?: string;
|
||||
|
||||
/**
|
||||
* 人员库描述
|
||||
*/
|
||||
libDesc?: string;
|
||||
|
||||
/**
|
||||
* 库类型,1:人员库,2:工服库
|
||||
*/
|
||||
libType?: number;
|
||||
|
||||
/**
|
||||
* 库的业务类型 1: 门禁库,2: 黑名单库
|
||||
*/
|
||||
busiType?: number;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
createById?: string | number;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
updateById?: string | number;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface PersonLibQuery extends PageQuery {
|
||||
/**
|
||||
* 人员库编码
|
||||
*/
|
||||
libCode?: string;
|
||||
|
||||
/**
|
||||
* 人员库名称
|
||||
*/
|
||||
libName?: string;
|
||||
|
||||
/**
|
||||
* 人员库描述
|
||||
*/
|
||||
libDesc?: string;
|
||||
|
||||
/**
|
||||
* 库类型,1:人员库,2:工服库
|
||||
*/
|
||||
libType?: number;
|
||||
|
||||
/**
|
||||
* 库的业务类型 1: 门禁库,2: 黑名单库
|
||||
*/
|
||||
busiType?: number;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
createById?: string | number;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
updateById?: string | number;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
61
apps/web-antd/src/api/sis/personLibImg/index.ts
Normal file
61
apps/web-antd/src/api/sis/personLibImg/index.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import type { PersonLibImgVO, PersonLibImgForm, PersonLibImgQuery } from './model';
|
||||
|
||||
import type { ID, IDS } from '#/api/common';
|
||||
import type { PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 查询人像信息列表
|
||||
* @param params
|
||||
* @returns 人像信息列表
|
||||
*/
|
||||
export function personLibImgList(params?: PersonLibImgQuery) {
|
||||
return requestClient.get<PageResult<PersonLibImgVO>>('/sis/personLibImg/list', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出人像信息列表
|
||||
* @param params
|
||||
* @returns 人像信息列表
|
||||
*/
|
||||
export function personLibImgExport(params?: PersonLibImgQuery) {
|
||||
return commonExport('/sis/personLibImg/export', params ?? {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询人像信息详情
|
||||
* @param id id
|
||||
* @returns 人像信息详情
|
||||
*/
|
||||
export function personLibImgInfo(id: ID) {
|
||||
return requestClient.get<PersonLibImgVO>(`/sis/personLibImg/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增人像信息
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function personLibImgAdd(data: PersonLibImgForm) {
|
||||
return requestClient.postWithMsg<void>('/sis/personLibImg', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新人像信息
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function personLibImgUpdate(data: PersonLibImgForm) {
|
||||
return requestClient.putWithMsg<void>('/sis/personLibImg', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除人像信息
|
||||
* @param id id
|
||||
* @returns void
|
||||
*/
|
||||
export function personLibImgRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/sis/personLibImg/${id}`);
|
||||
}
|
228
apps/web-antd/src/api/sis/personLibImg/model.d.ts
vendored
Normal file
228
apps/web-antd/src/api/sis/personLibImg/model.d.ts
vendored
Normal file
@@ -0,0 +1,228 @@
|
||||
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||
|
||||
export interface PersonLibImgVO {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 人员库编码
|
||||
*/
|
||||
libCode: string;
|
||||
|
||||
/**
|
||||
* 人像名称
|
||||
*/
|
||||
imgName: string;
|
||||
|
||||
/**
|
||||
* 图片编码
|
||||
*/
|
||||
imgCode: string;
|
||||
|
||||
/**
|
||||
* 图片的存储地址
|
||||
*/
|
||||
imgUrl: string;
|
||||
|
||||
/**
|
||||
* 性别 1:男
|
||||
2:女 99:未说明
|
||||
*/
|
||||
sex: number;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
email: string;
|
||||
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
tel: string;
|
||||
|
||||
/**
|
||||
* 证件类型
|
||||
1:身份证 2:护照
|
||||
3:行驶证 99:其它
|
||||
*/
|
||||
certificateType: number;
|
||||
|
||||
/**
|
||||
* 证件号码
|
||||
*/
|
||||
certificateNo: string;
|
||||
|
||||
/**
|
||||
* 出生日期
|
||||
*/
|
||||
birthDate: string;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
createById: string | number;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
updateById: string | number;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue: string;
|
||||
|
||||
}
|
||||
|
||||
export interface PersonLibImgForm extends BaseEntity {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 人员库编码
|
||||
*/
|
||||
libCode?: string;
|
||||
|
||||
/**
|
||||
* 人像名称
|
||||
*/
|
||||
imgName?: string;
|
||||
|
||||
/**
|
||||
* 图片编码
|
||||
*/
|
||||
imgCode?: string;
|
||||
|
||||
/**
|
||||
* 图片的存储地址
|
||||
*/
|
||||
imgUrl?: string;
|
||||
|
||||
/**
|
||||
* 性别 1:男
|
||||
2:女 99:未说明
|
||||
*/
|
||||
sex?: number;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
email?: string;
|
||||
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
tel?: string;
|
||||
|
||||
/**
|
||||
* 证件类型
|
||||
1:身份证 2:护照
|
||||
3:行驶证 99:其它
|
||||
*/
|
||||
certificateType?: number;
|
||||
|
||||
/**
|
||||
* 证件号码
|
||||
*/
|
||||
certificateNo?: string;
|
||||
|
||||
/**
|
||||
* 出生日期
|
||||
*/
|
||||
birthDate?: string;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
createById?: string | number;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
updateById?: string | number;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface PersonLibImgQuery extends PageQuery {
|
||||
/**
|
||||
* 人员库编码
|
||||
*/
|
||||
libCode?: string;
|
||||
|
||||
/**
|
||||
* 人像名称
|
||||
*/
|
||||
imgName?: string;
|
||||
|
||||
/**
|
||||
* 图片编码
|
||||
*/
|
||||
imgCode?: string;
|
||||
|
||||
/**
|
||||
* 图片的存储地址
|
||||
*/
|
||||
imgUrl?: string;
|
||||
|
||||
/**
|
||||
* 性别 1:男
|
||||
2:女 99:未说明
|
||||
*/
|
||||
sex?: number;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
email?: string;
|
||||
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
tel?: string;
|
||||
|
||||
/**
|
||||
* 证件类型
|
||||
1:身份证 2:护照
|
||||
3:行驶证 99:其它
|
||||
*/
|
||||
certificateType?: number;
|
||||
|
||||
/**
|
||||
* 证件号码
|
||||
*/
|
||||
certificateNo?: string;
|
||||
|
||||
/**
|
||||
* 出生日期
|
||||
*/
|
||||
birthDate?: string;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
createById?: string | number;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
updateById?: string | number;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
@@ -5,11 +5,16 @@ import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { type FormSchemaGetter, useVbenForm } from "#/adapter/form";
|
||||
import { applicationAdd, applicationInfo, applicationUpdate } from '#/api/property/assetManage/application';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import { modalSchema } from './data';
|
||||
import { assetTypeselect } from "#/api/property/assetType";
|
||||
import { depotList } from "#/api/property/assetManage/depot";
|
||||
import { suppliersList } from "#/api/property/assetManage/suppliers";
|
||||
import { assetList } from "#/api/property/assetManage/asset";
|
||||
import { userList } from "#/api/system/user";
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@@ -41,6 +46,103 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
},
|
||||
);
|
||||
|
||||
formApi.getValues().then(setupPackageSelect);
|
||||
|
||||
async function upSelectUser(nickName: string){
|
||||
const list=await userList({
|
||||
nickName:nickName,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
const options=list.map(item=>{
|
||||
item.label=item.userName;
|
||||
item.value=item.id;
|
||||
})
|
||||
fromApi.updateSchema([
|
||||
{
|
||||
componentProps: {
|
||||
optionFilterProp: 'label',
|
||||
optionLabelProp: 'label',
|
||||
options,
|
||||
showSearch: true,
|
||||
},
|
||||
fieldName: 'userId',
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
async function upSelectAssets(assetsName: string){
|
||||
const list=await assetList({
|
||||
assetsName:assetsName,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
const options=list.map(item=>{
|
||||
item.label=item.assetsName;
|
||||
item.value=item.id;
|
||||
})
|
||||
fromApi.updateSchema([
|
||||
{
|
||||
componentProps: {
|
||||
optionFilterProp: 'label',
|
||||
optionLabelProp: 'label',
|
||||
options,
|
||||
showSearch: true,
|
||||
},
|
||||
fieldName: 'assetsId',
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
async function setupPackageSelect() {
|
||||
const users = await userList({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
const assets = await assetList({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
const options = users.rows.map((item) => ({
|
||||
label: item.nickName,
|
||||
value: item.userId,
|
||||
}));
|
||||
const assetOptions = assets.rows.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: {
|
||||
optionFilterProp: 'label',
|
||||
optionLabelProp: 'label',
|
||||
options,
|
||||
showSearch: true,
|
||||
},
|
||||
async select(userId) {
|
||||
await upSelectUser(userId);
|
||||
userId=""
|
||||
},
|
||||
fieldName: 'userId',
|
||||
},
|
||||
{
|
||||
componentProps: {
|
||||
optionFilterProp: 'label',
|
||||
optionLabelProp: 'label',
|
||||
options: assetOptions,
|
||||
showSearch: true,
|
||||
},
|
||||
async select(assetsId) {
|
||||
await upSelectAssets(assetsId);
|
||||
assetsId=""
|
||||
},
|
||||
fieldName: 'assetId',
|
||||
},
|
||||
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[550px]',
|
||||
@@ -62,7 +164,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
|
||||
await setupPackageSelect();
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
});
|
||||
|
@@ -112,46 +112,46 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '资产id',
|
||||
fieldName: 'assetId',
|
||||
component: 'Input',
|
||||
component: 'Select',
|
||||
},
|
||||
{
|
||||
label: '领用人id',
|
||||
fieldName: 'userId',
|
||||
component: 'Input',
|
||||
component: 'Select',
|
||||
},
|
||||
{
|
||||
label: '数量',
|
||||
fieldName: 'number',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
fieldName: 'state',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '审批人id',
|
||||
fieldName: 'acceptanceUserId',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '审批时间',
|
||||
fieldName: 'acceptanceTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '申请时间',
|
||||
fieldName: 'applicationTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},
|
||||
// {
|
||||
// label: '状态',
|
||||
// fieldName: 'state',
|
||||
// component: 'Input',
|
||||
// },
|
||||
// {
|
||||
// label: '审批人id',
|
||||
// fieldName: 'acceptanceUserId',
|
||||
// component: 'Input',
|
||||
// },
|
||||
// {
|
||||
// label: '审批时间',
|
||||
// fieldName: 'acceptanceTime',
|
||||
// component: 'DatePicker',
|
||||
// componentProps: {
|
||||
// showTime: true,
|
||||
// format: 'YYYY-MM-DD HH:mm:ss',
|
||||
// valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// label: '申请时间',
|
||||
// fieldName: 'applicationTime',
|
||||
// component: 'DatePicker',
|
||||
// componentProps: {
|
||||
// showTime: true,
|
||||
// format: 'YYYY-MM-DD HH:mm:ss',
|
||||
// valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
// },
|
||||
// },
|
||||
];
|
||||
|
@@ -10,6 +10,9 @@ import { assetAdd, assetInfo, assetUpdate } from '#/api/property/assetManage/ass
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import { modalSchema } from './data';
|
||||
import { assetTypeselect } from "#/api/property/assetManage/assetType";
|
||||
import { depotList } from "#/api/property/assetManage/depot";
|
||||
import { suppliersList } from "#/api/property/assetManage/suppliers";
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@@ -41,6 +44,55 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
},
|
||||
);
|
||||
|
||||
async function setupPackageSelect() {
|
||||
const tenantPackageList = await assetTypeselect();
|
||||
const depot = await depotList();
|
||||
const suppliers =await suppliersList();
|
||||
const options = tenantPackageList.rows.map((item) => ({
|
||||
label: item.assetTypeName,
|
||||
value: item.id,
|
||||
}));
|
||||
const depotoptions = depot.rows.map((item) => ({
|
||||
label: item.depotName,
|
||||
value: item.id,
|
||||
}));
|
||||
const supplieroptions = suppliers.rows.map((item) => ({
|
||||
label: item.suppliersName,
|
||||
value: item.id,
|
||||
}));
|
||||
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: {
|
||||
optionFilterProp: 'label',
|
||||
optionLabelProp: 'label',
|
||||
options,
|
||||
showSearch: true,
|
||||
},
|
||||
fieldName: 'model',
|
||||
},
|
||||
{
|
||||
componentProps: {
|
||||
optionFilterProp: 'label',
|
||||
optionLabelProp: 'label',
|
||||
options: depotoptions,
|
||||
showSearch: true,
|
||||
},
|
||||
fieldName: 'depotId',
|
||||
},
|
||||
{
|
||||
componentProps: {
|
||||
optionFilterProp: 'label',
|
||||
optionLabelProp: 'label',
|
||||
options: supplieroptions,
|
||||
showSearch: true,
|
||||
},
|
||||
fieldName: 'suppliersId',
|
||||
},
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[550px]',
|
||||
@@ -52,6 +104,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
@@ -62,7 +115,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
|
||||
await setupPackageSelect();
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
});
|
||||
|
@@ -1,6 +1,8 @@
|
||||
import type {FormSchemaGetter} from '#/adapter/form';
|
||||
import type {VxeGridProps} from '#/adapter/vxe-table';
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
import {assetTypeList} from "#/api/property/assetManage/assetType";
|
||||
import type {AssetTypeVO} from "#/api/property/assetManage/assetType/model";
|
||||
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
@@ -13,6 +15,13 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
component: 'Select',
|
||||
fieldName: 'model',
|
||||
label: '资产类型',
|
||||
componentProps: {
|
||||
showSearch:true,
|
||||
placeholder:'根据类型名称搜索...',
|
||||
onSearch:handleSearch,
|
||||
onChange:handleChange,
|
||||
options:typeData
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
@@ -25,8 +34,6 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{type: 'checkbox', width: 60},
|
||||
{
|
||||
@@ -167,3 +174,31 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
componentProps: {},
|
||||
},
|
||||
];
|
||||
let typeData:AssetTypeVO[]=[]
|
||||
const handleSearch = (val: string) => {
|
||||
queryAssetsType(val, (d: any[]) => (typeData = d));
|
||||
};
|
||||
const handleChange = (val: string) => {
|
||||
queryAssetsType(val, (d: any[]) => (typeData = d));
|
||||
};
|
||||
|
||||
|
||||
|
||||
function queryAssetsType(value: string, callback: any) {
|
||||
let queryParam={
|
||||
pageNum:100,
|
||||
pageSize:1,
|
||||
assetTypeName:value
|
||||
}
|
||||
assetTypeList(queryParam).then(res=>{
|
||||
const data: any[] = [];
|
||||
res.rows.forEach((r: any) => {
|
||||
data.push({
|
||||
value: r.assetTypeName,
|
||||
label: r.id,
|
||||
});
|
||||
});
|
||||
callback(data);
|
||||
})
|
||||
}
|
||||
|
||||
|
@@ -110,6 +110,7 @@ function handleDownloadExcel() {
|
||||
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
|
||||
<BasicTable table-title="资产列表">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
|
@@ -6,7 +6,7 @@ import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { assetTypeAdd, assetTypeInfo, assetTypeUpdate } from '#/api/property/assetType';
|
||||
import { assetTypeAdd, assetTypeInfo, assetTypeUpdate } from '#/api/property/assetManage/assetType';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import { modalSchema } from './data';
|
@@ -8,20 +8,17 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
fieldName: 'assetTypeName',
|
||||
label: '分类名称',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'sort',
|
||||
label: '排序',
|
||||
},
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '主键',
|
||||
title: '序号',
|
||||
field: 'id',
|
||||
slots: {
|
||||
default: ({rowIndex}) => {
|
||||
return (rowIndex+1).toString()
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '分类名称',
|
||||
@@ -35,10 +32,6 @@ export const columns: VxeGridProps['columns'] = [
|
||||
title: '创建时间',
|
||||
field: 'createTime',
|
||||
},
|
||||
{
|
||||
title: '创建人',
|
||||
field: 'createBy',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
@@ -62,10 +55,11 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
label: '分类名称',
|
||||
fieldName: 'assetTypeName',
|
||||
component: 'Input',
|
||||
rules:'required'
|
||||
},
|
||||
{
|
||||
label: '排序',
|
||||
fieldName: 'sort',
|
||||
component: 'Input',
|
||||
component: 'InputNumber',
|
||||
},
|
||||
];
|
@@ -1,26 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import {
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
vxeCheckboxChecked,
|
||||
type VxeGridProps
|
||||
type VxeGridProps
|
||||
} from '#/adapter/vxe-table';
|
||||
|
||||
import {
|
||||
assetTypeExport,
|
||||
assetTypeList,
|
||||
assetTypeRemove,
|
||||
} from '#/api/property/assetType';
|
||||
import type { AssetTypeForm } from '#/api/property/assetType/model';
|
||||
} from '#/api/property/assetManage/assetType';
|
||||
import type { AssetTypeForm } from '#/api/property/assetManage/assetType/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import assetTypeModal from './assetType-modal.vue';
|
||||
@@ -35,15 +30,6 @@ const formOptions: VbenFormProps = {
|
||||
},
|
||||
schema: querySchema(),
|
||||
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||
// 处理区间选择器RangePicker时间格式 将一个字段映射为两个字段 搜索/导出会用到
|
||||
// 不需要直接删除
|
||||
// fieldMappingTime: [
|
||||
// [
|
||||
// 'createTime',
|
||||
// ['params[beginTime]', 'params[endTime]'],
|
||||
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
|
||||
// ],
|
||||
// ],
|
||||
};
|
||||
|
||||
const gridOptions: VxeGridProps = {
|
||||
@@ -55,8 +41,6 @@ const gridOptions: VxeGridProps = {
|
||||
// 点击行选中
|
||||
// trigger: 'row',
|
||||
},
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// columns: columns(),
|
||||
columns,
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
@@ -138,8 +122,8 @@ function handleDownloadExcel() {
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:assetType:remove']"
|
||||
type="primary"
|
||||
v-access:code="['property:assetType:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
@@ -1,18 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import {
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
vxeCheckboxChecked,
|
||||
type VxeGridProps
|
||||
type VxeGridProps
|
||||
} from '#/adapter/vxe-table';
|
||||
|
||||
import {
|
||||
@@ -138,8 +131,8 @@ function handleDownloadExcel() {
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:floor:remove']"
|
||||
type="primary"
|
||||
v-access:code="['property:floor:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
import {renderDict} from "#/utils/render";
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
@@ -49,6 +50,11 @@ export const columns: VxeGridProps['columns'] = [
|
||||
{
|
||||
title: '性别',
|
||||
field: 'gender',
|
||||
slots:{
|
||||
default: ({row})=>{
|
||||
return renderDict(row.gender,'sys_user_sex')
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'img',
|
||||
@@ -75,7 +81,9 @@ export const columns: VxeGridProps['columns'] = [
|
||||
{
|
||||
title: '状态',
|
||||
field: 'state',
|
||||
// slots: { default: 'state' },
|
||||
slots:{
|
||||
default: 'state'
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
|
@@ -14,7 +14,7 @@ import {
|
||||
import {
|
||||
personExport,
|
||||
personList,
|
||||
personRemove,
|
||||
personRemove, personUpdate,
|
||||
} from '#/api/property/resident/person';
|
||||
import type { PersonForm } from '#/api/property/resident/person/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
@@ -22,7 +22,8 @@ import { commonDownloadExcel } from '#/utils/file/download';
|
||||
import personModal from './person-modal.vue';
|
||||
import personDetail from './person-detail.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
// import {TableSwitch} from "#/components/table";
|
||||
import {useAccess} from "@vben/access";
|
||||
import {TableSwitch} from "#/components/table";
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
@@ -44,8 +45,6 @@ const gridOptions: VxeGridProps = {
|
||||
// 点击行选中
|
||||
// trigger: 'row',
|
||||
},
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// columns: columns(),
|
||||
columns,
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
@@ -80,6 +79,7 @@ const [PersonDetail, personDetailApi] = useVbenModal({
|
||||
connectedComponent: personDetail,
|
||||
});
|
||||
|
||||
const { hasAccessByCodes } = useAccess();
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
@@ -120,7 +120,6 @@ function handleInfo(row: Required<PersonForm>) {
|
||||
personDetailApi.setData({ id: row.id });
|
||||
personDetailApi.open();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -154,16 +153,16 @@ function handleInfo(row: Required<PersonForm>) {
|
||||
<template #img="{ row }">
|
||||
<Avatar :src="row.img" />
|
||||
</template>
|
||||
<!-- <template #state="{ row }">-->
|
||||
<!-- <TableSwitch-->
|
||||
<!-- v-model:value="row.status"-->
|
||||
<!-- :api="() => personStatusChange(row)"-->
|
||||
<!-- :disabled="-->
|
||||
<!-- row.userId === 1 || !hasAccessByCodes(['system:user:edit'])-->
|
||||
<!-- "-->
|
||||
<!-- @reload="() => tableApi.query()"-->
|
||||
<!-- />-->
|
||||
<!-- </template>-->
|
||||
<template #state="{ row }">
|
||||
<TableSwitch
|
||||
:checkedValue="1"
|
||||
:unCheckedValue="0"
|
||||
v-model:value="row.state"
|
||||
:api="() => personUpdate(row)"
|
||||
:disabled="!hasAccessByCodes(['property:person:edit'])"
|
||||
@reload="() => tableApi.query()"
|
||||
/>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
|
@@ -8,11 +8,10 @@ import dayjs from 'dayjs';
|
||||
import duration from 'dayjs/plugin/duration';
|
||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
|
||||
// import {personInfo} from '#/api/property/resident/person';
|
||||
import {personInfo} from '#/api/property/resident/person';
|
||||
import type {Person} from "#/api/property/resident/person/model";
|
||||
import {accessControlColumns,carColumns} from "#/views/property/resident/person/data";
|
||||
// import {personList} from "#/api/property/resident/person";
|
||||
// import {renderDict} from "#/utils/render";
|
||||
import { renderDictValue} from "#/utils/render";
|
||||
|
||||
|
||||
dayjs.extend(duration);
|
||||
@@ -36,11 +35,9 @@ async function handleOpenChange(open: boolean) {
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
// const {id} = modalApi.getData() as { id: number | string };
|
||||
// const response = await personInfo(id);
|
||||
const response = {id:1};
|
||||
const {id} = modalApi.getData() as { id: number | string };
|
||||
// 赋值
|
||||
personDetail.value = response;
|
||||
personDetail.value = await personInfo(id);
|
||||
|
||||
modalApi.modalLoading(false);
|
||||
}
|
||||
@@ -52,25 +49,25 @@ async function handleOpenChange(open: boolean) {
|
||||
<BasicModal :footer="false" :fullscreen-button="false" title="入驻人员信息" class="w-[70%]">
|
||||
<Descriptions v-if="personDetail" size="small" :column="1" bordered :labelStyle="{width:'100px'}">
|
||||
<DescriptionsItem label="入驻人员">
|
||||
{{ '入驻人员' }}
|
||||
{{ personDetail.userName+'-'+renderDictValue(personDetail.gender,'sys_user_sex')+'-'+personDetail.phone}}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="所属单位">
|
||||
{{ '单位名称' }}
|
||||
{{personDetail.unitName+'-'+personDetail.unitId }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="入驻位置">
|
||||
{{ '单位名称' }}
|
||||
{{ personDetail.locathon }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="人脸图片">
|
||||
{{ '单位名称' }}
|
||||
{{ personDetail.img }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="入驻时间">
|
||||
{{ '单位名称' }}
|
||||
{{ personDetail.time}}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="车牌号码">
|
||||
{{ '单位名称' }}
|
||||
{{personDetail.carNumber}}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="备注">
|
||||
{{ '单位名称' }}
|
||||
{{ personDetail.remark }}
|
||||
</DescriptionsItem>
|
||||
|
||||
</Descriptions>
|
||||
@@ -85,7 +82,7 @@ async function handleOpenChange(open: boolean) {
|
||||
</template>
|
||||
</Table>
|
||||
</TabPane>
|
||||
<TabPane key="2" tab="车辆记录">
|
||||
<TabPane key="2" tab="车辆记录" v-if="personDetail?.carNumber">
|
||||
<Table :dataSource="[]" :columns="carColumns" :pagination="false" >
|
||||
<template #bodyCell="{ column, index }">
|
||||
<template v-if="column.field === 'id'">
|
||||
|
@@ -27,6 +27,7 @@ let userInfo = reactive({
|
||||
});
|
||||
let unitName = ref('');
|
||||
const userId = ref<number | string>(0);
|
||||
const unitId = ref<number | string>(0);
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
// 默认占满两列
|
||||
@@ -69,7 +70,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
if (isUpdate.value && id) {
|
||||
const record = await personInfo(id);
|
||||
userId.value = record.userId;
|
||||
console.log(userId.value,'====================1111')
|
||||
unitId.value = record.unitId;
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
@@ -87,10 +88,12 @@ async function handleConfirm() {
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
let data = cloneDeep(await formApi.getValues());
|
||||
if (!isUpdate.value) {
|
||||
if (userInfo) {
|
||||
data.userName = userInfo.userName
|
||||
data.phone = userInfo.phone
|
||||
data.gender = userInfo.gender
|
||||
}
|
||||
if(unitName.value){
|
||||
data.unitName = unitName.value
|
||||
}
|
||||
await (isUpdate.value ? personUpdate(data) : personAdd(data));
|
||||
@@ -125,7 +128,7 @@ function getUnitInfo(unit: { name: string }) {
|
||||
<QueryUserList @update:userInfo="getUserInfo" v-bind="slotProps" :isUpdate="isUpdate" :userId="userId"/>
|
||||
</template>
|
||||
<template #unitId="slotProps">
|
||||
<QueryUnitList @update:unitInfo="getUnitInfo" v-bind="slotProps" :disabled="isUpdate"/>
|
||||
<QueryUnitList @update:unitInfo="getUnitInfo" v-bind="slotProps" :isUpdate="isUpdate" :unitId="unitId"/>
|
||||
</template>
|
||||
</BasicForm>
|
||||
</BasicModal>
|
||||
|
@@ -1,13 +1,20 @@
|
||||
<script lang="ts" setup>
|
||||
import {ref} from 'vue';
|
||||
import {ref, watch} from 'vue';
|
||||
import {Select} from 'ant-design-vue';
|
||||
import {resident_unitList} from "#/api/property/resident/unit";
|
||||
import {resident_unitList,resident_unitInfo} from "#/api/property/resident/unit";
|
||||
|
||||
defineOptions({name: 'QueryUnitList'});
|
||||
|
||||
withDefaults(defineProps<{ disabled?: boolean; placeholder?: string }>(), {
|
||||
const props= withDefaults(defineProps<{
|
||||
disabled?: boolean;
|
||||
placeholder?: string;
|
||||
isUpdate?:boolean;
|
||||
unitId?:string;
|
||||
}>(), {
|
||||
disabled: false,
|
||||
placeholder: '可根据单位名称进行搜索...',
|
||||
isUpdate:false,
|
||||
unitId:'',
|
||||
});
|
||||
|
||||
async function queryUnit(value: string, callback: any) {
|
||||
@@ -15,11 +22,14 @@ async function queryUnit(value: string, callback: any) {
|
||||
name: value,
|
||||
pageSize: 100,
|
||||
pageNum: 1,
|
||||
state:1,
|
||||
}
|
||||
const res = await resident_unitList(queryData);
|
||||
const options = res.rows.map((unit) => ({
|
||||
label: unit.name+'-'+unit.id,
|
||||
value: unit.id,
|
||||
name:unit.name,
|
||||
unitNumber:unit.unitNumber,
|
||||
}));
|
||||
callback(options);
|
||||
}
|
||||
@@ -32,19 +42,33 @@ const handleSearch = (val: string) => {
|
||||
const emit = defineEmits(['update:unitInfo']);
|
||||
const handleChange = (val: string) => {
|
||||
value.value = val;
|
||||
const unitInfoStr = data.value.find(option => option.value === val)?.label;
|
||||
let arr = unitInfoStr.split('-')
|
||||
let unitInfo = {
|
||||
name: arr[0],
|
||||
unitNumber: arr[1],
|
||||
}
|
||||
const unitInfo = data.value.find(option => option.value === val);
|
||||
emit('update:unitInfo', unitInfo);
|
||||
};
|
||||
|
||||
async function getUnitInfo(val) {
|
||||
const unit = await resident_unitInfo(val)
|
||||
if (unit) {
|
||||
data.value = [{
|
||||
label: unit.name+'-'+unit.id,
|
||||
value: unit.id,
|
||||
name:unit.name,
|
||||
unitNumber:unit.id,
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
watch(() => props.unitId,
|
||||
(newX) => {
|
||||
if (props.isUpdate) {
|
||||
getUnitInfo(newX)
|
||||
}
|
||||
}, {immediate: true})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- v-model:value="value"-->
|
||||
<Select
|
||||
v-model="value"
|
||||
show-search
|
||||
:placeholder="placeholder"
|
||||
style="width: 100%"
|
||||
|
@@ -17,10 +17,10 @@ const props = withDefaults(defineProps<{
|
||||
isUpdate: false,
|
||||
userId: 0
|
||||
});
|
||||
watch(() => props.isUpdate,
|
||||
watch(() => props.userId,
|
||||
(newX) => {
|
||||
if (newX) {
|
||||
getUserInfo()
|
||||
if (props.isUpdate) {
|
||||
getUserInfo(newX)
|
||||
}
|
||||
}, {immediate: true})
|
||||
|
||||
@@ -50,30 +50,33 @@ const handleSearch = (val: string) => {
|
||||
};
|
||||
const emit = defineEmits(['update:userInfo']);
|
||||
const handleChange = (val: string) => {
|
||||
// value.value = val;
|
||||
value.value = val;
|
||||
const userInfo = data.value.find(option => option.value === val);
|
||||
queryUser(val, (d: any[]) => (data.value = d));
|
||||
emit('update:userInfo', userInfo);
|
||||
};
|
||||
|
||||
async function getUserInfo() {
|
||||
console.log(value.value, '=============value')
|
||||
const user = await (await findUserInfo(value.value)).user
|
||||
console.log(user, '=================ss')
|
||||
if(user){
|
||||
data.value=[{
|
||||
label: user.nickName + '-' + renderDictValue(user.sex, 'sys_user_sex') + '-' + user.phonenumber,
|
||||
async function getUserInfo(val) {
|
||||
if (!val) return;
|
||||
const res = await findUserInfo(val)
|
||||
const user = res.user
|
||||
if (user) {
|
||||
data.value = [{
|
||||
// label: user.nickName + '-' + renderDictValue(user.sex, 'sys_user_sex') + '-' + user.phonenumber,
|
||||
label: user.nickName + '-' + user.phonenumber,
|
||||
value: user.userId,
|
||||
userName: user.userName,
|
||||
gender: user.sex,
|
||||
phone: user.phonenumber,
|
||||
}]
|
||||
emit('update:userInfo', data.value[0]);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Select
|
||||
:disabled="isUpdate"
|
||||
v-model="value"
|
||||
show-search
|
||||
:placeholder="placeholder"
|
||||
|
122
apps/web-antd/src/views/sis/personLib/data.ts
Normal file
122
apps/web-antd/src/views/sis/personLib/data.ts
Normal file
@@ -0,0 +1,122 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'libCode',
|
||||
label: '人员库编码',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'libName',
|
||||
label: '人员库名称',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'libDesc',
|
||||
label: '人员库描述',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {},
|
||||
fieldName: 'libType',
|
||||
label: '库类型',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {},
|
||||
fieldName: 'busiType',
|
||||
label: '业务类型',
|
||||
},
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '主键id',
|
||||
field: 'id',
|
||||
},
|
||||
{
|
||||
title: '人员库编码',
|
||||
field: 'libCode',
|
||||
},
|
||||
{
|
||||
title: '人员库名称',
|
||||
field: 'libName',
|
||||
},
|
||||
{
|
||||
title: '人员库描述',
|
||||
field: 'libDesc',
|
||||
},
|
||||
{
|
||||
title: '库类型,1:人员库,2:工服库',
|
||||
field: 'libType',
|
||||
},
|
||||
{
|
||||
title: '库的业务类型 1: 门禁库,2: 黑名单库',
|
||||
field: 'busiType',
|
||||
},
|
||||
{
|
||||
title: '创建人id',
|
||||
field: 'createById',
|
||||
},
|
||||
{
|
||||
title: '更新人id',
|
||||
field: 'updateById',
|
||||
},
|
||||
{
|
||||
title: '搜索值',
|
||||
field: 'searchValue',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
title: '操作',
|
||||
width: 180,
|
||||
},
|
||||
];
|
||||
|
||||
export const modalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '主键id',
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '人员库编码',
|
||||
fieldName: 'libCode',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '人员库名称',
|
||||
fieldName: 'libName',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '人员库描述',
|
||||
fieldName: 'libDesc',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '库类型',
|
||||
fieldName: 'libType',
|
||||
component: 'Select',
|
||||
componentProps: {},
|
||||
},
|
||||
{
|
||||
label: '业务类型',
|
||||
fieldName: 'busiType',
|
||||
component: 'Select',
|
||||
componentProps: {},
|
||||
},
|
||||
];
|
182
apps/web-antd/src/views/sis/personLib/index.vue
Normal file
182
apps/web-antd/src/views/sis/personLib/index.vue
Normal file
@@ -0,0 +1,182 @@
|
||||
<script setup lang="ts">
|
||||
import type { VbenFormProps } from '@vben/common-ui';
|
||||
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import type { PersonLibForm } from '#/api/sis/personLib/model';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
|
||||
import {
|
||||
personLibExport,
|
||||
personLibList,
|
||||
personLibRemove,
|
||||
} from '#/api/sis/personLib';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import { columns, querySchema } from './data';
|
||||
import personLibModal from './personLib-modal.vue';
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
labelWidth: 80,
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
schema: querySchema(),
|
||||
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||
// 处理区间选择器RangePicker时间格式 将一个字段映射为两个字段 搜索/导出会用到
|
||||
// 不需要直接删除
|
||||
// fieldMappingTime: [
|
||||
// [
|
||||
// 'createTime',
|
||||
// ['params[beginTime]', 'params[endTime]'],
|
||||
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
|
||||
// ],
|
||||
// ],
|
||||
};
|
||||
|
||||
const gridOptions: VxeGridProps = {
|
||||
checkboxConfig: {
|
||||
// 高亮
|
||||
highlight: true,
|
||||
// 翻页时保留选中状态
|
||||
reserve: true,
|
||||
// 点击行选中
|
||||
// trigger: 'row',
|
||||
},
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// columns: columns(),
|
||||
columns,
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
return await personLibList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'sis-personLib-index',
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
const [PersonLibModal, modalApi] = useVbenModal({
|
||||
connectedComponent: personLibModal,
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<PersonLibForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleDelete(row: Required<PersonLibForm>) {
|
||||
await personLibRemove(row.id);
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
function handleMultiDelete() {
|
||||
const rows = tableApi.grid.getCheckboxRecords();
|
||||
const ids = rows.map((row: Required<PersonLibForm>) => row.id);
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
okType: 'danger',
|
||||
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||
onOk: async () => {
|
||||
await personLibRemove(ids);
|
||||
await tableApi.query();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleDownloadExcel() {
|
||||
commonDownloadExcel(
|
||||
personLibExport,
|
||||
'人像库数据',
|
||||
tableApi.formApi.form.values,
|
||||
{
|
||||
fieldMappingTime: formOptions.fieldMappingTime,
|
||||
},
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
<BasicTable table-title="人像库列表">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button
|
||||
v-access:code="['sis:personLib:export']"
|
||||
@click="handleDownloadExcel"
|
||||
>
|
||||
{{ $t('pages.common.export') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['sis:personLib:remove']"
|
||||
@click="handleMultiDelete"
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['sis:personLib:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['sis:personLib:edit']"
|
||||
@click.stop="handleEdit(row)"
|
||||
>
|
||||
{{ $t('pages.common.edit') }}
|
||||
</ghost-button>
|
||||
<Popconfirm
|
||||
:get-popup-container="getVxePopupContainer"
|
||||
placement="left"
|
||||
title="确认删除?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<ghost-button
|
||||
danger
|
||||
v-access:code="['sis:personLib:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<PersonLibModal @reload="tableApi.query()" />
|
||||
</Page>
|
||||
</template>
|
101
apps/web-antd/src/views/sis/personLib/personLib-modal.vue
Normal file
101
apps/web-antd/src/views/sis/personLib/personLib-modal.vue
Normal file
@@ -0,0 +1,101 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { personLibAdd, personLibInfo, personLibUpdate } from '#/api/sis/personLib';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import { modalSchema } from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
const isUpdate = ref(false);
|
||||
const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||
});
|
||||
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
// 默认占满两列
|
||||
formItemClass: 'col-span-2',
|
||||
// 默认label宽度 px
|
||||
labelWidth: 80,
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
schema: modalSchema(),
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
},
|
||||
);
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[550px]',
|
||||
fullscreenButton: false,
|
||||
onBeforeClose,
|
||||
onClosed: handleClosed,
|
||||
onConfirm: handleConfirm,
|
||||
onOpenChange: async (isOpen) => {
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await personLibInfo(id);
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
});
|
||||
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? personLibUpdate(data) : personLibAdd(data));
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
modalApi.lock(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleClosed() {
|
||||
await formApi.resetForm();
|
||||
resetInitialized();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
224
apps/web-antd/src/views/sis/personLibImg/data.ts
Normal file
224
apps/web-antd/src/views/sis/personLibImg/data.ts
Normal file
@@ -0,0 +1,224 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'libCode',
|
||||
label: '人员库编码',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'imgName',
|
||||
label: '人像名称',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'imgCode',
|
||||
label: '图片编码',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'imgUrl',
|
||||
label: '图片的存储地址',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {},
|
||||
fieldName: 'sex',
|
||||
label: '性别',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'email',
|
||||
label: '邮箱',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'tel',
|
||||
label: '联系方式',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {},
|
||||
fieldName: 'certificateType',
|
||||
label: '证件类型',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'certificateNo',
|
||||
label: '证件号码',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'birthDate',
|
||||
label: '出生日期',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'createById',
|
||||
label: '创建人id',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'updateById',
|
||||
label: '更新人id',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'searchValue',
|
||||
label: '搜索值',
|
||||
},
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '主键id',
|
||||
field: 'id',
|
||||
},
|
||||
{
|
||||
title: '人员库编码',
|
||||
field: 'libCode',
|
||||
},
|
||||
{
|
||||
title: '人像名称',
|
||||
field: 'imgName',
|
||||
},
|
||||
{
|
||||
title: '图片编码',
|
||||
field: 'imgCode',
|
||||
},
|
||||
{
|
||||
title: '图片的存储地址',
|
||||
field: 'imgUrl',
|
||||
},
|
||||
{
|
||||
title: '性别',
|
||||
},
|
||||
{
|
||||
title: '邮箱',
|
||||
field: 'email',
|
||||
},
|
||||
{
|
||||
title: '联系方式',
|
||||
field: 'tel',
|
||||
},
|
||||
{
|
||||
title: '证件类型',
|
||||
field: 'certificateType',
|
||||
},
|
||||
{
|
||||
title: '证件号码',
|
||||
field: 'certificateNo',
|
||||
},
|
||||
{
|
||||
title: '出生日期',
|
||||
field: 'birthDate',
|
||||
},
|
||||
{
|
||||
title: '创建人id',
|
||||
field: 'createById',
|
||||
},
|
||||
{
|
||||
title: '更新人id',
|
||||
field: 'updateById',
|
||||
},
|
||||
{
|
||||
title: '搜索值',
|
||||
field: 'searchValue',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
slots: {
|
||||
default: 'action',
|
||||
},
|
||||
title: '操作',
|
||||
width: 180,
|
||||
},
|
||||
];
|
||||
|
||||
export const modalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '主键id',
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '人员库编码',
|
||||
fieldName: 'libCode',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '人像名称',
|
||||
fieldName: 'imgName',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '图片编码',
|
||||
fieldName: 'imgCode',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '图片的存储地址',
|
||||
fieldName: 'imgUrl',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '性别 1:男',
|
||||
fieldName: 'sex',
|
||||
component: 'Select',
|
||||
componentProps: {},
|
||||
},
|
||||
{
|
||||
label: '邮箱',
|
||||
fieldName: 'email',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '联系方式',
|
||||
fieldName: 'tel',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '证件类型',
|
||||
fieldName: 'certificateType',
|
||||
component: 'Select',
|
||||
componentProps: {},
|
||||
},
|
||||
{
|
||||
label: '证件号码',
|
||||
fieldName: 'certificateNo',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '出生日期',
|
||||
fieldName: 'birthDate',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '创建人id',
|
||||
fieldName: 'createById',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '更新人id',
|
||||
fieldName: 'updateById',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '搜索值',
|
||||
fieldName: 'searchValue',
|
||||
component: 'Input',
|
||||
},
|
||||
];
|
182
apps/web-antd/src/views/sis/personLibImg/index.vue
Normal file
182
apps/web-antd/src/views/sis/personLibImg/index.vue
Normal file
@@ -0,0 +1,182 @@
|
||||
<script setup lang="ts">
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
vxeCheckboxChecked,
|
||||
type VxeGridProps
|
||||
} from '#/adapter/vxe-table';
|
||||
|
||||
import {
|
||||
personLibImgExport,
|
||||
personLibImgList,
|
||||
personLibImgRemove,
|
||||
} from '#/api/sis/personLibImg';
|
||||
import type { PersonLibImgForm } from '#/api/sis/personLibImg/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import personLibImgModal from './personLibImg-modal.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
labelWidth: 80,
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
schema: querySchema(),
|
||||
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||
// 处理区间选择器RangePicker时间格式 将一个字段映射为两个字段 搜索/导出会用到
|
||||
// 不需要直接删除
|
||||
// fieldMappingTime: [
|
||||
// [
|
||||
// 'createTime',
|
||||
// ['params[beginTime]', 'params[endTime]'],
|
||||
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
|
||||
// ],
|
||||
// ],
|
||||
};
|
||||
|
||||
const gridOptions: VxeGridProps = {
|
||||
checkboxConfig: {
|
||||
// 高亮
|
||||
highlight: true,
|
||||
// 翻页时保留选中状态
|
||||
reserve: true,
|
||||
// 点击行选中
|
||||
// trigger: 'row',
|
||||
},
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// columns: columns(),
|
||||
columns,
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
return await personLibImgList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'sis-personLibImg-index'
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
const [PersonLibImgModal, modalApi] = useVbenModal({
|
||||
connectedComponent: personLibImgModal,
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<PersonLibImgForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleDelete(row: Required<PersonLibImgForm>) {
|
||||
await personLibImgRemove(row.id);
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
function handleMultiDelete() {
|
||||
const rows = tableApi.grid.getCheckboxRecords();
|
||||
const ids = rows.map((row: Required<PersonLibImgForm>) => row.id);
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
okType: 'danger',
|
||||
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||
onOk: async () => {
|
||||
await personLibImgRemove(ids);
|
||||
await tableApi.query();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleDownloadExcel() {
|
||||
commonDownloadExcel(personLibImgExport, '人像信息数据', tableApi.formApi.form.values, {
|
||||
fieldMappingTime: formOptions.fieldMappingTime,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
<BasicTable table-title="人像信息列表">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button
|
||||
v-access:code="['sis:personLibImg:export']"
|
||||
@click="handleDownloadExcel"
|
||||
>
|
||||
{{ $t('pages.common.export') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['sis:personLibImg:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['sis:personLibImg:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['sis:personLibImg:edit']"
|
||||
@click.stop="handleEdit(row)"
|
||||
>
|
||||
{{ $t('pages.common.edit') }}
|
||||
</ghost-button>
|
||||
<Popconfirm
|
||||
:get-popup-container="getVxePopupContainer"
|
||||
placement="left"
|
||||
title="确认删除?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<ghost-button
|
||||
danger
|
||||
v-access:code="['sis:personLibImg:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<PersonLibImgModal @reload="tableApi.query()" />
|
||||
</Page>
|
||||
</template>
|
101
apps/web-antd/src/views/sis/personLibImg/personLibImg-modal.vue
Normal file
101
apps/web-antd/src/views/sis/personLibImg/personLibImg-modal.vue
Normal file
@@ -0,0 +1,101 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { personLibImgAdd, personLibImgInfo, personLibImgUpdate } from '#/api/sis/personLibImg';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import { modalSchema } from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
const isUpdate = ref(false);
|
||||
const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||
});
|
||||
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
// 默认占满两列
|
||||
formItemClass: 'col-span-2',
|
||||
// 默认label宽度 px
|
||||
labelWidth: 80,
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
schema: modalSchema(),
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
},
|
||||
);
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[550px]',
|
||||
fullscreenButton: false,
|
||||
onBeforeClose,
|
||||
onClosed: handleClosed,
|
||||
onConfirm: handleConfirm,
|
||||
onOpenChange: async (isOpen) => {
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await personLibImgInfo(id);
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
});
|
||||
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? personLibImgUpdate(data) : personLibImgAdd(data));
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
modalApi.lock(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleClosed() {
|
||||
await formApi.resetForm();
|
||||
resetInitialized();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
@@ -27,7 +27,8 @@ export default defineConfig(async () => {
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
// mock代理目标地址
|
||||
target: 'http://47.109.37.87:3010/',
|
||||
// target: 'http://by.missmoc.top:3010/',
|
||||
target: 'http://127.0.0.1:8080/',
|
||||
ws: true,
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user