diff --git a/src/views/informationSub/countStatistics/countStatistics.data.ts b/src/views/informationSub/countStatistics/countStatistics.data.ts index d0156e0..b73ec8b 100644 --- a/src/views/informationSub/countStatistics/countStatistics.data.ts +++ b/src/views/informationSub/countStatistics/countStatistics.data.ts @@ -1,37 +1,8 @@ import { FormSchema } from '@/components/Form'; import { BasicColumn } from '@/components/Table'; -import { useDictStore } from '@/store/modules/dict'; -import { getDutyWorkplaceList, getadminDivisionList } from './countStatistics.api'; -import { get } from 'sortablejs'; -let dutyWorkplaceOption=[] -let adminDivisionOption=[] -async function getDutyWorkplaceOptions() { - let list = await getDutyWorkplaceList(); - let uniqueList = [...new Set(list)]; - let res= uniqueList.map(item => { - return { - label: item, - value: item - } -}) -console.log("wwres",res) -return res -} -async function getadminDivisionOptions() { - let list = await getadminDivisionList(); - let uniqueList = [...new Set(list)]; - let res= uniqueList.map(item => { - return { - label: item, - value: item - } - }) - console.log("wres",res) - return res -} export const countStatisticsColumns: BasicColumn[] = [ { @@ -82,7 +53,7 @@ export const countStatisticsFormSchema: FormSchema[] = [ required: true, component: 'Select', componentProps: { - options:await getDutyWorkplaceOptions() + options:[] }, colProps: { span:12}, }, @@ -92,7 +63,7 @@ export const countStatisticsFormSchema: FormSchema[] = [ required: true, component: 'Select', componentProps: { - options:await getadminDivisionOptions() + options:[] }, colProps: { span:12 }, }, diff --git a/src/views/informationSub/countStatistics/modifycountStatistics.vue b/src/views/informationSub/countStatistics/modifycountStatistics.vue index a23f1c0..b1fbb28 100644 --- a/src/views/informationSub/countStatistics/modifycountStatistics.vue +++ b/src/views/informationSub/countStatistics/modifycountStatistics.vue @@ -19,12 +19,30 @@ modifyPeriodicallabCount, getperiodicallabById, addPeriodicallabCount, + getDutyWorkplaceList, + getadminDivisionList, } from './countStatistics.api'; + import { useModalInner, BasicModal } from '@/components/Modal'; const [registerModal, { closeModal }] = useModalInner(init); let id = ref(''); let emit = defineEmits(['exit']); async function init(dataTo) { + let dutyWorkplaceOption = await getDutyWorkplaceOptions(); + let adminDivisionOption = await getadminDivisionOptions(); + + updateSchema({ + field: 'dutyWorkplace', + componentProps: { + options: dutyWorkplaceOption, + }, + }); + updateSchema({ + field: 'adminDivision', + componentProps: { + options: adminDivisionOption, + }, + }); id.value = dataTo.id; if (dataTo.id) { let res = await getperiodicallabById({ id: dataTo.id }); @@ -33,30 +51,31 @@ } } onMounted(async () => {}); - const [registerchangeFieldForm, { getFieldsValue, validate, setFieldsValue }] = useForm({ - //注册表单列 - schemas: countStatisticsFormSchema, - //自定义查询按钮的文本和图标 - // submitButtonOptions: { text: '提交', preIcon: '' }, - //自定义重置按钮的文本和图标 - resetButtonOptions: { text: '取消' }, - // showActionButtonGroup: false, - //回车提交 - // autoSubmitOnEnter: true, - // //不显示重置按钮 - // showResetButton: false, - //自定义提交按钮文本和图标 - submitButtonOptions: { text: '提交' }, - //查询列占比 24代表一行 取值范围 0-24 - actionColOptions: { span: 14 }, - //提交按钮的自定义事件 - // submitFunc: customSubmitFunc, - //重置按钮的自定义时间 - resetFunc: customResetFunc, - labelCol: { style: { width: '120px' } }, - wrapperCol: { style: { width: 'auto' } }, - // disabled:true - }); + const [registerchangeFieldForm, { getFieldsValue, validate, setFieldsValue, updateSchema }] = + useForm({ + //注册表单列 + schemas: countStatisticsFormSchema, + //自定义查询按钮的文本和图标 + // submitButtonOptions: { text: '提交', preIcon: '' }, + //自定义重置按钮的文本和图标 + resetButtonOptions: { text: '取消' }, + // showActionButtonGroup: false, + //回车提交 + // autoSubmitOnEnter: true, + // //不显示重置按钮 + // showResetButton: false, + //自定义提交按钮文本和图标 + submitButtonOptions: { text: '提交' }, + //查询列占比 24代表一行 取值范围 0-24 + actionColOptions: { span: 14 }, + //提交按钮的自定义事件 + // submitFunc: customSubmitFunc, + //重置按钮的自定义时间 + resetFunc: customResetFunc, + labelCol: { style: { width: '120px' } }, + wrapperCol: { style: { width: 'auto' } }, + // disabled:true + }); async function handleSubmit() { if (await validate()) { if (id.value) { @@ -68,12 +87,41 @@ } emit('exit'); - closeModal() + closeModal(); } } async function customResetFunc() { emit('exit'); - closeModal() + closeModal(); + } + async function getDutyWorkplaceOptions() { + let dutyWorkplaceOption = await getDutyWorkplaceList(); + + let uniqueList = [...new Set(dutyWorkplaceOption)]; + + let res = uniqueList.map((item) => { + return { + label: item, + value: item, + }; + }); + console.log('wwres', res); + + return res; + } + async function getadminDivisionOptions() { + let adminDivisionOption = await getadminDivisionList(); + + let uniqueList = [...new Set(adminDivisionOption)]; + + let res = uniqueList.map((item) => { + return { + label: item, + value: item, + }; + }); + console.log('wres', res); + return res; }