初始化项目
This commit is contained in:
40
web-vue/packages/biz/api/biz/myAreaSource.ts
Normal file
40
web-vue/packages/biz/api/biz/myAreaSource.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
*/
|
||||
import { defHttp } from '@jeesite/core/utils/http/axios';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { BasicModel, Page, TreeDataModel } from '@jeesite/core/api/model/baseModel';
|
||||
|
||||
const { adminPath } = useGlobSetting();
|
||||
|
||||
export interface MyAreaSource extends BasicModel<MyAreaSource> {
|
||||
createTime: string; // 记录时间
|
||||
areaId: string; // 区域标识
|
||||
areaCode?: string; // 区域编号
|
||||
areaName?: string; // 区域名称
|
||||
pareaCode?: string; // 上级编号
|
||||
areaLevel: number; // 区域级别
|
||||
treeName?: string; // 区域地址
|
||||
updateTime?: string; // 更新时间
|
||||
areaStatus?: string; // 区域状态
|
||||
}
|
||||
|
||||
export const MyAreaSourceList = (params?: MyAreaSource | any) =>
|
||||
defHttp.get<MyAreaSource>({ url: adminPath + '/biz/myAreaSource/list', params });
|
||||
|
||||
export const MyAreaSourceListData = (params?: MyAreaSource | any) =>
|
||||
defHttp.post<Page<MyAreaSource>>({ url: adminPath + '/biz/myAreaSource/listData', params });
|
||||
|
||||
export const MyAreaSourceForm = (params?: MyAreaSource | any) =>
|
||||
defHttp.get<MyAreaSource>({ url: adminPath + '/biz/myAreaSource/form', params });
|
||||
|
||||
export const MyAreaSourceSave = (params?: any, data?: MyAreaSource | any) =>
|
||||
defHttp.postJson<MyAreaSource>({ url: adminPath + '/biz/myAreaSource/save', params, data });
|
||||
|
||||
export const MyAreaSourceDelete = (params?: MyAreaSource | any) =>
|
||||
defHttp.get<MyAreaSource>({ url: adminPath + '/biz/myAreaSource/delete', params });
|
||||
|
||||
export const MyAreaSourceTreeData = (params?: any) =>
|
||||
defHttp.get<TreeDataModel[]>({ url: adminPath + '/biz/myAreaSource/treeData', params });
|
||||
52
web-vue/packages/biz/api/biz/myCities.ts
Normal file
52
web-vue/packages/biz/api/biz/myCities.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now https://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
*/
|
||||
import { defHttp } from '@jeesite/core/utils/http/axios';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { BasicModel, Page } from '@jeesite/core/api/model/baseModel';
|
||||
import { UploadApiResult } from '@jeesite/core/api/sys/upload';
|
||||
import { UploadFileParams } from '@jeesite/types/axios';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const { ctxPath, adminPath } = useGlobSetting();
|
||||
|
||||
export interface MyCities extends BasicModel<MyCities> {
|
||||
cityId?: string; // 唯一主键
|
||||
createTime?: string; // 记录时间
|
||||
provinceCode: string; // 省份编码
|
||||
cityCode: string; // 市区编码
|
||||
cityName: string; // 市区名称
|
||||
areaCode: string; // 市区区号
|
||||
areaType: string; // 市区级别
|
||||
updateTime?: string; // 更新时间
|
||||
ustatus: string; // 状态
|
||||
}
|
||||
|
||||
export const myCitiesList = (params?: MyCities | any) =>
|
||||
defHttp.get<MyCities>({ url: adminPath + '/biz/myCities/list', params });
|
||||
|
||||
export const myCitiesListData = (params?: MyCities | any) =>
|
||||
defHttp.post<Page<MyCities>>({ url: adminPath + '/biz/myCities/listData', params });
|
||||
|
||||
export const myCitiesForm = (params?: MyCities | any) =>
|
||||
defHttp.get<MyCities>({ url: adminPath + '/biz/myCities/form', params });
|
||||
|
||||
export const myCitiesSave = (params?: any, data?: MyCities | any) =>
|
||||
defHttp.postJson<MyCities>({ url: adminPath + '/biz/myCities/save', params, data });
|
||||
|
||||
export const myCitiesImportData = (
|
||||
params: UploadFileParams,
|
||||
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
|
||||
) =>
|
||||
defHttp.uploadFile<UploadApiResult>(
|
||||
{
|
||||
url: ctxPath + adminPath + '/biz/myCities/importData',
|
||||
onUploadProgress,
|
||||
},
|
||||
params,
|
||||
);
|
||||
|
||||
export const myCitiesDelete = (params?: MyCities | any) =>
|
||||
defHttp.get<MyCities>({ url: adminPath + '/biz/myCities/delete', params });
|
||||
53
web-vue/packages/biz/api/biz/myProvince.ts
Normal file
53
web-vue/packages/biz/api/biz/myProvince.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now https://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
*/
|
||||
import { defHttp } from '@jeesite/core/utils/http/axios';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { BasicModel, Page } from '@jeesite/core/api/model/baseModel';
|
||||
import { UploadApiResult } from '@jeesite/core/api/sys/upload';
|
||||
import { UploadFileParams } from '@jeesite/types/axios';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const { ctxPath, adminPath } = useGlobSetting();
|
||||
|
||||
export interface MyProvince extends BasicModel<MyProvince> {
|
||||
provinceId?: string; // 唯一主键
|
||||
createTime?: string; // 记录时间
|
||||
provinceName: string; // 省份名称
|
||||
provinceCode: string; // 省份编码
|
||||
sorting: number; // 省份序号
|
||||
ustatus: string; // 状态
|
||||
updateTime?: string; // 更新时间
|
||||
}
|
||||
|
||||
export const myProvinceList = (params?: MyProvince | any) =>
|
||||
defHttp.get<MyProvince>({ url: adminPath + '/biz/myProvince/list', params });
|
||||
|
||||
export const myProvinceListAll = (params?: MyProvince | any) =>
|
||||
defHttp.get<MyProvince[]>({ url: adminPath + '/biz/myProvince/listAll', params });
|
||||
|
||||
export const myProvinceListData = (params?: MyProvince | any) =>
|
||||
defHttp.post<Page<MyProvince>>({ url: adminPath + '/biz/myProvince/listData', params });
|
||||
|
||||
export const myProvinceForm = (params?: MyProvince | any) =>
|
||||
defHttp.get<MyProvince>({ url: adminPath + '/biz/myProvince/form', params });
|
||||
|
||||
export const myProvinceSave = (params?: any, data?: MyProvince | any) =>
|
||||
defHttp.postJson<MyProvince>({ url: adminPath + '/biz/myProvince/save', params, data });
|
||||
|
||||
export const myProvinceImportData = (
|
||||
params: UploadFileParams,
|
||||
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
|
||||
) =>
|
||||
defHttp.uploadFile<UploadApiResult>(
|
||||
{
|
||||
url: ctxPath + adminPath + '/biz/myProvince/importData',
|
||||
onUploadProgress,
|
||||
},
|
||||
params,
|
||||
);
|
||||
|
||||
export const myProvinceDelete = (params?: MyProvince | any) =>
|
||||
defHttp.get<MyProvince>({ url: adminPath + '/biz/myProvince/delete', params });
|
||||
151
web-vue/packages/biz/views/biz/myCities/form.vue
Normal file
151
web-vue/packages/biz/views/biz/myCities/form.vue
Normal file
@@ -0,0 +1,151 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now https://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<BasicDrawer
|
||||
v-bind="$attrs"
|
||||
:showFooter="true"
|
||||
:okAuth="'biz:myCities:edit'"
|
||||
@register="registerDrawer"
|
||||
@ok="handleSubmit"
|
||||
width="70%"
|
||||
>
|
||||
<template #title>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsBizMyCitiesForm">
|
||||
import { ref, unref, computed } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicForm, FormSchema, useForm } from '@jeesite/core/components/Form';
|
||||
import { BasicDrawer, useDrawerInner } from '@jeesite/core/components/Drawer';
|
||||
import { MyCities, myCitiesSave, myCitiesForm } from '@jeesite/biz/api/biz/myCities';
|
||||
import { formatToDateTime } from '@jeesite/core/utils/dateUtil';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { t } = useI18n('biz.myCities');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<MyCities>({} as MyCities);
|
||||
|
||||
const getTitle = computed(() => ({
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: record.value.isNewRecord ? t('新增城市') : t('编辑城市'),
|
||||
}));
|
||||
|
||||
const inputFormSchemas: FormSchema<MyCities>[] = [
|
||||
{
|
||||
label: t('基本信息'),
|
||||
field: 'basicInfo',
|
||||
component: 'FormGroup',
|
||||
colProps: { md: 24, lg: 24 },
|
||||
},
|
||||
{
|
||||
label: t('省份编码'),
|
||||
field: 'provinceCode',
|
||||
fieldLabel: 'provinceName',
|
||||
component: 'ListSelect',
|
||||
componentProps: {
|
||||
selectType: 'bizProvinceSelect',
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('市区编码'),
|
||||
field: 'cityCode',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 24,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('市区名称'),
|
||||
field: 'cityName',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 125,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('市区区号'),
|
||||
field: 'areaCode',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 12,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('市区级别'),
|
||||
field: 'areaType',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 4,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('状态'),
|
||||
field: 'ustatus',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'biz_status',
|
||||
allowClear: true,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
];
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<MyCities>({
|
||||
labelWidth: 120,
|
||||
schemas: inputFormSchemas,
|
||||
baseColProps: { md: 24, lg: 12 },
|
||||
});
|
||||
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
setDrawerProps({ loading: true });
|
||||
await resetFields();
|
||||
const res = await myCitiesForm(data);
|
||||
record.value = (res.myCities || {}) as MyCities;
|
||||
record.value.__t = new Date().getTime();
|
||||
await setFieldsValue(record.value);
|
||||
setDrawerProps({ loading: false });
|
||||
});
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const data = await validate();
|
||||
setDrawerProps({ confirmLoading: true });
|
||||
const params: any = {
|
||||
isNewRecord: record.value.isNewRecord,
|
||||
cityId: record.value.cityId || data.cityId,
|
||||
};
|
||||
|
||||
data[record.value.isNewRecord ? 'createTime' : 'updateTime'] = formatToDateTime(new Date());
|
||||
|
||||
// console.log('submit', params, data, record);
|
||||
const res = await myCitiesSave(params, data);
|
||||
showMessage(res.message);
|
||||
setTimeout(closeDrawer);
|
||||
emit('success', data);
|
||||
} catch (error: any) {
|
||||
if (error && error.errorFields) {
|
||||
showMessage(error.message || t('common.validateError'));
|
||||
}
|
||||
console.log('error', error);
|
||||
} finally {
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
261
web-vue/packages/biz/views/biz/myCities/list.vue
Normal file
261
web-vue/packages/biz/views/biz/myCities/list.vue
Normal file
@@ -0,0 +1,261 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now https://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #tableTitle>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<template #toolbar>
|
||||
<a-button type="default" :loading="loading" @click="handleExport()">
|
||||
<Icon icon="i-ant-design:download-outlined" /> {{ t('导出') }}
|
||||
</a-button>
|
||||
<a-button type="primary" @click="handleForm({})" v-auth="'biz:myCities:edit'">
|
||||
<Icon icon="i-fluent:add-12-filled" /> {{ t('新增') }}
|
||||
</a-button>
|
||||
</template>
|
||||
<template #bizScopeKey="{ record, text, value }">
|
||||
<a @click="handleForm({ cityId: record.cityId })" :title="value">
|
||||
{{ text }}
|
||||
</a>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<InputForm @register="registerDrawer" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsBizMyCitiesList">
|
||||
import { onMounted, ref, unref } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
|
||||
import { MyCities, myCitiesList } from '@jeesite/biz/api/biz/myCities';
|
||||
import { myCitiesDelete, myCitiesListData } from '@jeesite/biz/api/biz/myCities';
|
||||
import { useDrawer } from '@jeesite/core/components/Drawer';
|
||||
import { useModal } from '@jeesite/core/components/Modal';
|
||||
import { FormProps } from '@jeesite/core/components/Form';
|
||||
import InputForm from './form.vue';
|
||||
|
||||
const { t } = useI18n('biz.myCities');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<MyCities>({} as MyCities);
|
||||
|
||||
const getTitle = {
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: meta.title || t('城市管理'),
|
||||
};
|
||||
const loading = ref(false);
|
||||
|
||||
const searchForm: FormProps<MyCities> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{
|
||||
label: t('记录时间起'),
|
||||
field: 'createTime_gte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('记录时间止'),
|
||||
field: 'createTime_lte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('省份编码'),
|
||||
field: 'provinceCode',
|
||||
fieldLabel: 'provinceName',
|
||||
component: 'ListSelect',
|
||||
componentProps: {
|
||||
selectType: 'bizProvinceSelect',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('市区名称'),
|
||||
field: 'cityName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('市区区号'),
|
||||
field: 'areaCode',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('市区级别'),
|
||||
field: 'areaType',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('状态'),
|
||||
field: 'ustatus',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'biz_status',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn<MyCities>[] = [
|
||||
{
|
||||
title: t('记录时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
width: 150,
|
||||
align: 'center',
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
title: t('省份编码'),
|
||||
dataIndex: 'provinceCode',
|
||||
key: 'a.province_code',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('省份名称'),
|
||||
dataIndex: 'provinceName',
|
||||
key: 'a.province_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('市区编码'),
|
||||
dataIndex: 'cityCode',
|
||||
key: 'a.city_code',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('市区名称'),
|
||||
dataIndex: 'cityName',
|
||||
key: 'a.city_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
slot: 'bizScopeKey',
|
||||
},
|
||||
{
|
||||
title: t('市区区号'),
|
||||
dataIndex: 'areaCode',
|
||||
key: 'a.area_code',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('市区级别'),
|
||||
dataIndex: 'areaType',
|
||||
key: 'a.area_type',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('更新时间'),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'a.update_time',
|
||||
sorter: true,
|
||||
width: 150,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('状态'),
|
||||
dataIndex: 'ustatus',
|
||||
key: 'a.ustatus',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
dictType: 'biz_status',
|
||||
},
|
||||
];
|
||||
|
||||
const actionColumn: BasicColumn<MyCities> = {
|
||||
width: 160,
|
||||
align: 'center',
|
||||
actions: (record: MyCities) => [
|
||||
{
|
||||
icon: 'i-clarity:note-edit-line',
|
||||
title: t('编辑城市'),
|
||||
onClick: handleForm.bind(this, { cityId: record.cityId }),
|
||||
auth: 'biz:myCities:edit',
|
||||
},
|
||||
{
|
||||
icon: 'i-ant-design:delete-outlined',
|
||||
color: 'error',
|
||||
title: t('删除城市'),
|
||||
popConfirm: {
|
||||
title: t('是否确认删除城市'),
|
||||
confirm: handleDelete.bind(this, record),
|
||||
},
|
||||
auth: 'biz:myCities:edit',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const [registerTable, { reload, getForm }] = useTable<MyCities>({
|
||||
api: myCitiesListData,
|
||||
beforeFetch: (params) => {
|
||||
return params;
|
||||
},
|
||||
columns: tableColumns,
|
||||
actionColumn: actionColumn,
|
||||
formConfig: searchForm,
|
||||
showTableSetting: true,
|
||||
useSearchForm: true,
|
||||
canResize: true,
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
const res = await myCitiesList();
|
||||
record.value = (res.myCities || {}) as MyCities;
|
||||
await getForm().setFieldsValue(record.value);
|
||||
});
|
||||
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
|
||||
function handleForm(record: Recordable) {
|
||||
openDrawer(true, record);
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
loading.value = true;
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
await downloadByUrl({
|
||||
url: ctxAdminPath + '/biz/myCities/exportData',
|
||||
params: getForm().getFieldsValue(),
|
||||
});
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
async function handleDelete(record: Recordable) {
|
||||
const params = { cityId: record.cityId };
|
||||
const res = await myCitiesDelete(params);
|
||||
showMessage(res.message);
|
||||
await handleSuccess(record);
|
||||
}
|
||||
|
||||
async function handleSuccess(record: Recordable) {
|
||||
await reload({ record });
|
||||
}
|
||||
</script>
|
||||
151
web-vue/packages/biz/views/biz/myCities/select.ts
Normal file
151
web-vue/packages/biz/views/biz/myCities/select.ts
Normal file
@@ -0,0 +1,151 @@
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { BasicColumn, BasicTableProps, FormProps } from '@jeesite/core/components/Table';
|
||||
import { MyCities, myCitiesListData } from '@jeesite/biz/api/biz/myCities';
|
||||
|
||||
const { t } = useI18n('biz.myCities');
|
||||
|
||||
const modalProps = {
|
||||
title: t('城市选择'),
|
||||
};
|
||||
|
||||
const searchForm: FormProps<MyCities> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{
|
||||
label: t('记录时间起'),
|
||||
field: 'createTime_gte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('记录时间止'),
|
||||
field: 'createTime_lte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('省份编码'),
|
||||
field: 'provinceCode',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('市区名称'),
|
||||
field: 'cityName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('市区区号'),
|
||||
field: 'areaCode',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('市区级别'),
|
||||
field: 'areaType',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('状态'),
|
||||
field: 'ustatus',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'biz_status',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn<MyCities>[] = [
|
||||
{
|
||||
title: t('记录时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
width: 230,
|
||||
align: 'left',
|
||||
slot: 'firstColumn',
|
||||
},
|
||||
{
|
||||
title: t('省份编码'),
|
||||
dataIndex: 'provinceCode',
|
||||
key: 'a.province_code',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('市区编码'),
|
||||
dataIndex: 'cityCode',
|
||||
key: 'a.city_code',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('市区名称'),
|
||||
dataIndex: 'cityName',
|
||||
key: 'a.city_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('市区区号'),
|
||||
dataIndex: 'areaCode',
|
||||
key: 'a.area_code',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('市区级别'),
|
||||
dataIndex: 'areaType',
|
||||
key: 'a.area_type',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('更新时间'),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'a.update_time',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('状态'),
|
||||
dataIndex: 'ustatus',
|
||||
key: 'a.ustatus',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
dictType: 'biz_status',
|
||||
},
|
||||
];
|
||||
|
||||
const tableProps: BasicTableProps = {
|
||||
api: myCitiesListData,
|
||||
beforeFetch: (params) => {
|
||||
params['isAll'] = true;
|
||||
return params;
|
||||
},
|
||||
columns: tableColumns,
|
||||
formConfig: searchForm,
|
||||
rowKey: 'cityId',
|
||||
};
|
||||
|
||||
export default {
|
||||
modalProps,
|
||||
tableProps,
|
||||
itemCode: 'cityId',
|
||||
itemName: 'cityId',
|
||||
isShowCode: false,
|
||||
};
|
||||
132
web-vue/packages/biz/views/biz/myProvince/form.vue
Normal file
132
web-vue/packages/biz/views/biz/myProvince/form.vue
Normal file
@@ -0,0 +1,132 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now https://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<BasicDrawer
|
||||
v-bind="$attrs"
|
||||
:showFooter="true"
|
||||
:okAuth="'biz:myProvince:edit'"
|
||||
@register="registerDrawer"
|
||||
@ok="handleSubmit"
|
||||
width="70%"
|
||||
>
|
||||
<template #title>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsBizMyProvinceForm">
|
||||
import { ref, unref, computed } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicForm, FormSchema, useForm } from '@jeesite/core/components/Form';
|
||||
import { BasicDrawer, useDrawerInner } from '@jeesite/core/components/Drawer';
|
||||
import { MyProvince, myProvinceSave, myProvinceForm } from '@jeesite/biz/api/biz/myProvince';
|
||||
import { formatToDateTime } from '@jeesite/core/utils/dateUtil';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { t } = useI18n('biz.myProvince');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<MyProvince>({} as MyProvince);
|
||||
|
||||
const getTitle = computed(() => ({
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: record.value.isNewRecord ? t('新增省份') : t('编辑省份'),
|
||||
}));
|
||||
|
||||
const inputFormSchemas: FormSchema<MyProvince>[] = [
|
||||
{
|
||||
label: t('基本信息'),
|
||||
field: 'basicInfo',
|
||||
component: 'FormGroup',
|
||||
colProps: { md: 24, lg: 24 },
|
||||
},
|
||||
{
|
||||
label: t('省份名称'),
|
||||
field: 'provinceName',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 52,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('省份编码'),
|
||||
field: 'provinceCode',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 12,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('省份序号'),
|
||||
field: 'sorting',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
maxlength: 9,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('状态'),
|
||||
field: 'ustatus',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'biz_status',
|
||||
allowClear: true,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
];
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<MyProvince>({
|
||||
labelWidth: 120,
|
||||
schemas: inputFormSchemas,
|
||||
baseColProps: { md: 24, lg: 12 },
|
||||
});
|
||||
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
setDrawerProps({ loading: true });
|
||||
await resetFields();
|
||||
const res = await myProvinceForm(data);
|
||||
record.value = (res.myProvince || {}) as MyProvince;
|
||||
record.value.__t = new Date().getTime();
|
||||
await setFieldsValue(record.value);
|
||||
setDrawerProps({ loading: false });
|
||||
});
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const data = await validate();
|
||||
setDrawerProps({ confirmLoading: true });
|
||||
const params: any = {
|
||||
isNewRecord: record.value.isNewRecord,
|
||||
provinceId: record.value.provinceId || data.provinceId,
|
||||
};
|
||||
|
||||
data[record.value.isNewRecord ? 'createTime' : 'updateTime'] = formatToDateTime(new Date());
|
||||
|
||||
// console.log('submit', params, data, record);
|
||||
const res = await myProvinceSave(params, data);
|
||||
showMessage(res.message);
|
||||
setTimeout(closeDrawer);
|
||||
emit('success', data);
|
||||
} catch (error: any) {
|
||||
if (error && error.errorFields) {
|
||||
showMessage(error.message || t('common.validateError'));
|
||||
}
|
||||
console.log('error', error);
|
||||
} finally {
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
205
web-vue/packages/biz/views/biz/myProvince/list.vue
Normal file
205
web-vue/packages/biz/views/biz/myProvince/list.vue
Normal file
@@ -0,0 +1,205 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now https://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #tableTitle>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<template #toolbar>
|
||||
<a-button type="default" :loading="loading" @click="handleExport()">
|
||||
<Icon icon="i-ant-design:download-outlined" /> {{ t('导出') }}
|
||||
</a-button>
|
||||
<a-button type="primary" @click="handleForm({})" v-auth="'biz:myProvince:edit'">
|
||||
<Icon icon="i-fluent:add-12-filled" /> {{ t('新增') }}
|
||||
</a-button>
|
||||
</template>
|
||||
<template #bizScopeKey="{ record, text, value }">
|
||||
<a @click="handleForm({ provinceId: record.provinceId })" :title="value">
|
||||
{{ text }}
|
||||
</a>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<InputForm @register="registerDrawer" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsBizMyProvinceList">
|
||||
import { onMounted, ref, unref } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
|
||||
import { MyProvince, myProvinceList } from '@jeesite/biz/api/biz/myProvince';
|
||||
import { myProvinceDelete, myProvinceListData } from '@jeesite/biz/api/biz/myProvince';
|
||||
import { useDrawer } from '@jeesite/core/components/Drawer';
|
||||
import { useModal } from '@jeesite/core/components/Modal';
|
||||
import { FormProps } from '@jeesite/core/components/Form';
|
||||
import InputForm from './form.vue';
|
||||
|
||||
const { t } = useI18n('biz.myProvince');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<MyProvince>({} as MyProvince);
|
||||
|
||||
const getTitle = {
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: meta.title || t('省份管理'),
|
||||
};
|
||||
const loading = ref(false);
|
||||
|
||||
const searchForm: FormProps<MyProvince> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{
|
||||
label: t('省份名称'),
|
||||
field: 'provinceName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('省份编码'),
|
||||
field: 'provinceCode',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('状态'),
|
||||
field: 'ustatus',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'biz_status',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn<MyProvince>[] = [
|
||||
{
|
||||
title: t('记录时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
width: 150,
|
||||
align: 'center',
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
title: t('省份名称'),
|
||||
dataIndex: 'provinceName',
|
||||
key: 'a.province_name',
|
||||
sorter: true,
|
||||
width: 200,
|
||||
align: 'left',
|
||||
slot: 'bizScopeKey',
|
||||
},
|
||||
{
|
||||
title: t('省份编码'),
|
||||
dataIndex: 'provinceCode',
|
||||
key: 'a.province_code',
|
||||
sorter: true,
|
||||
width: 200,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('省份序号'),
|
||||
dataIndex: 'sorting',
|
||||
key: 'a.sorting',
|
||||
sorter: true,
|
||||
width: 180,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('状态'),
|
||||
dataIndex: 'ustatus',
|
||||
key: 'a.ustatus',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
dictType: 'biz_status',
|
||||
},
|
||||
{
|
||||
title: t('更新时间'),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'a.update_time',
|
||||
sorter: true,
|
||||
width: 150,
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
|
||||
const actionColumn: BasicColumn<MyProvince> = {
|
||||
width: 160,
|
||||
align: 'center',
|
||||
actions: (record: MyProvince) => [
|
||||
{
|
||||
icon: 'i-clarity:note-edit-line',
|
||||
title: t('编辑'),
|
||||
onClick: handleForm.bind(this, { provinceId: record.provinceId }),
|
||||
auth: 'biz:myProvince:edit',
|
||||
},
|
||||
{
|
||||
icon: 'i-ant-design:delete-outlined',
|
||||
color: 'error',
|
||||
title: t('删除'),
|
||||
popConfirm: {
|
||||
title: t('是否确认删除省份?'),
|
||||
confirm: handleDelete.bind(this, record),
|
||||
},
|
||||
auth: 'biz:myProvince:edit',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const [registerTable, { reload, getForm }] = useTable<MyProvince>({
|
||||
api: myProvinceListData,
|
||||
beforeFetch: (params) => {
|
||||
return params;
|
||||
},
|
||||
columns: tableColumns,
|
||||
actionColumn: actionColumn,
|
||||
formConfig: searchForm,
|
||||
showTableSetting: true,
|
||||
useSearchForm: true,
|
||||
canResize: true,
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
const res = await myProvinceList();
|
||||
record.value = (res.myProvince || {}) as MyProvince;
|
||||
await getForm().setFieldsValue(record.value);
|
||||
});
|
||||
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
|
||||
function handleForm(record: Recordable) {
|
||||
openDrawer(true, record);
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
loading.value = true;
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
await downloadByUrl({
|
||||
url: ctxAdminPath + '/biz/myProvince/exportData',
|
||||
params: getForm().getFieldsValue(),
|
||||
});
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
async function handleDelete(record: Recordable) {
|
||||
const params = { provinceId: record.provinceId };
|
||||
const res = await myProvinceDelete(params);
|
||||
showMessage(res.message);
|
||||
await handleSuccess(record);
|
||||
}
|
||||
|
||||
async function handleSuccess(record: Recordable) {
|
||||
await reload({ record });
|
||||
}
|
||||
</script>
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { BasicColumn, BasicTableProps, FormProps } from '@jeesite/core/components/Table';
|
||||
import { myScreenInfoListData } from '@jeesite/biz/api/biz/myScreenInfo';
|
||||
import { MyScreenInfo, myScreenInfoListData } from '@jeesite/biz/api/biz/myScreenInfo';
|
||||
|
||||
const { t } = useI18n('biz.myScreenInfo');
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
|
||||
const tableColumns: BasicColumn<MyWebsiteStorage>[] = [
|
||||
{
|
||||
title: t('记录日期'),
|
||||
title: t('记录时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { BasicColumn, BasicTableProps, FormProps } from '@jeesite/core/components/Table';
|
||||
import { MyProvince, myProvinceListData } from '@jeesite/biz/api/biz/myProvince';
|
||||
|
||||
const { t } = useI18n('biz.myProvince');
|
||||
|
||||
const modalProps = {
|
||||
title: t('省份选择'),
|
||||
};
|
||||
|
||||
const searchForm: FormProps<MyProvince> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{
|
||||
label: t('省份名称'),
|
||||
field: 'provinceName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('省份编码'),
|
||||
field: 'provinceCode',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('状态'),
|
||||
field: 'ustatus',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'biz_status',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn<MyProvince>[] = [
|
||||
{
|
||||
title: t('记录时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
width: 150,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('省份名称'),
|
||||
dataIndex: 'provinceName',
|
||||
key: 'a.province_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('省份编码'),
|
||||
dataIndex: 'provinceCode',
|
||||
key: 'a.province_code',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('省份序号'),
|
||||
dataIndex: 'sorting',
|
||||
key: 'a.sorting',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('状态'),
|
||||
dataIndex: 'ustatus',
|
||||
key: 'a.ustatus',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
dictType: 'biz_status',
|
||||
},
|
||||
{
|
||||
title: t('更新时间'),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'a.update_time',
|
||||
sorter: true,
|
||||
width: 150,
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
|
||||
const tableProps: BasicTableProps = {
|
||||
api: myProvinceListData,
|
||||
beforeFetch: (params) => {
|
||||
params['isAll'] = true;
|
||||
return params;
|
||||
},
|
||||
columns: tableColumns,
|
||||
formConfig: searchForm,
|
||||
rowKey: 'provinceCode',
|
||||
};
|
||||
|
||||
export default {
|
||||
modalProps,
|
||||
tableProps,
|
||||
itemCode: 'provinceCode',
|
||||
itemName: 'provinceName',
|
||||
isShowCode: true,
|
||||
};
|
||||
Reference in New Issue
Block a user