|
@@ -38,6 +38,7 @@ import type { PickerIdFieldProps } from '@/components/dynamic/wrappers/PickerIdF
|
|
|
import type { RadioValueProps } from '@/components/dynamic/wrappers/RadioValue';
|
|
import type { RadioValueProps } from '@/components/dynamic/wrappers/RadioValue';
|
|
|
import type { CheckBoxListItem, CheckBoxListProps } from '@/components/dynamic/wrappers/CheckBoxList.vue';
|
|
import type { CheckBoxListItem, CheckBoxListProps } from '@/components/dynamic/wrappers/CheckBoxList.vue';
|
|
|
import type { FormProps } from '@/components/form/Form.vue';
|
|
import type { FormProps } from '@/components/form/Form.vue';
|
|
|
|
|
+import type { CheckBoxTreeListProps } from '@/components/dynamic/wrappers/CheckBoxTreeList.vue';
|
|
|
|
|
|
|
|
const loading = ref(false);
|
|
const loading = ref(false);
|
|
|
|
|
|
|
@@ -101,13 +102,14 @@ const formDefine : IDynamicFormOptions = {
|
|
|
rules: [{ required: true, message: '请选择区域' }],
|
|
rules: [{ required: true, message: '请选择区域' }],
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- label: '所属村庄', name: 'villageId', type: 'select-id',
|
|
|
|
|
|
|
+ label: '所属村社', name: 'villageId', type: 'select-id',
|
|
|
additionalProps: {
|
|
additionalProps: {
|
|
|
- placeholder: '请选择所属村庄',
|
|
|
|
|
|
|
+ placeholder: '请选择所属村社',
|
|
|
disabled: { callback: () => !isNew.value },
|
|
disabled: { callback: () => !isNew.value },
|
|
|
loadData: async () => (await VillageApi.getClaimedVallageList()).map(p => ({ text: p.title, value: p.id, raw: p })),
|
|
loadData: async () => (await VillageApi.getClaimedVallageList()).map(p => ({ text: p.title, value: p.id, raw: p })),
|
|
|
} as IDynamicFormItemCallbackAdditionalProps<PickerIdFieldProps>,
|
|
} as IDynamicFormItemCallbackAdditionalProps<PickerIdFieldProps>,
|
|
|
- rules: [{ required: true, message: '请选择所属村庄' }],
|
|
|
|
|
|
|
+ rules: [{ required: true, message: '请选择所属村社' }],
|
|
|
|
|
+ show: { callback: () => isNew.value },
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: '性别', name: 'sex', type: 'radio-value',
|
|
label: '性别', name: 'sex', type: 'radio-value',
|
|
@@ -138,27 +140,17 @@ const formDefine : IDynamicFormOptions = {
|
|
|
} as FieldProps,
|
|
} as FieldProps,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- label: '采集版块', name: 'catalogIds', type: 'check-box-list',
|
|
|
|
|
|
|
+ label: '采集版块', name: 'catalogIds', type: 'check-box-tree',
|
|
|
additionalProps: {
|
|
additionalProps: {
|
|
|
placeholder: '请选择采集版块',
|
|
placeholder: '请选择采集版块',
|
|
|
vertical: true,
|
|
vertical: true,
|
|
|
multiple: true,
|
|
multiple: true,
|
|
|
- loadData: async () => {
|
|
|
|
|
- async function getCatalogChildren(pid?: number, prefix?: string) {
|
|
|
|
|
- const catalog = (await VillageApi.getCatalogList(querys.value.villageId, pid));
|
|
|
|
|
- const res = [] as CheckBoxListItem[];
|
|
|
|
|
- for (let p of catalog) {
|
|
|
|
|
- res.push({
|
|
|
|
|
- text: (prefix || '') + p.title,
|
|
|
|
|
- value: p.id,
|
|
|
|
|
- });
|
|
|
|
|
- res.push(...(await getCatalogChildren(p.id, (prefix || '') + ' - ')));
|
|
|
|
|
- }
|
|
|
|
|
- return res;
|
|
|
|
|
- }
|
|
|
|
|
- return getCatalogChildren();
|
|
|
|
|
- },
|
|
|
|
|
- } as CheckBoxListProps,
|
|
|
|
|
|
|
+ loadData: async (pid) => (await VillageApi.getCatalogList(querys.value.villageId, pid)).map((p) => ({
|
|
|
|
|
+ text: p.title,
|
|
|
|
|
+ value: p.id,
|
|
|
|
|
+ hasChildren: p.haschild,
|
|
|
|
|
+ })),
|
|
|
|
|
+ } as CheckBoxTreeListProps,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: '村落认领说明', name: 'claimReason', type: 'text',
|
|
label: '村落认领说明', name: 'claimReason', type: 'text',
|
|
@@ -226,7 +218,7 @@ const { querys } = useLoadQuerys({
|
|
|
try {
|
|
try {
|
|
|
formModel.value = new VolunteerInfo();
|
|
formModel.value = new VolunteerInfo();
|
|
|
if (querys.id >= 0)
|
|
if (querys.id >= 0)
|
|
|
- formData = await VillageApi.getVolunteerInfoById(querys.id);
|
|
|
|
|
|
|
+ formData = await VillageApi.getVolunteerInfoByIdAdmin(querys.id);
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
if (!(e instanceof RequestApiError && e.errorMessage.startsWith('请完成')))
|
|
if (!(e instanceof RequestApiError && e.errorMessage.startsWith('请完成')))
|
|
|
showError(e, undefined, () => backPrev(false));
|
|
showError(e, undefined, () => backPrev(false));
|