From 7c03401de9dc6e4237bfbee19df5bfaa1b6f700a Mon Sep 17 00:00:00 2001 From: TimSpan Date: Thu, 19 Dec 2024 16:23:17 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8A=A0=E4=BA=86=E4=B8=AA=E6=90=9C?= =?UTF-8?q?=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/form/FormProMax.vue | 13 +++++- .../src/views/query/publicUnit.vue | 42 +++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/policeManagement/src/components/form/FormProMax.vue b/policeManagement/src/components/form/FormProMax.vue index 63361fe..756c79a 100644 --- a/policeManagement/src/components/form/FormProMax.vue +++ b/policeManagement/src/components/form/FormProMax.vue @@ -40,12 +40,15 @@ /> + + + @@ -162,7 +165,13 @@ const getResponsive = (item: FormProMaxItemProps): Grid => { } //优先级: 组件本身=》formItem=》label -const getPlaceholder = (item: FormProMaxItemProps) => item.componentsProps?.placeholder ?? item.placeholder ?? (item.type.includes('input') ? `请输入${item.label}` : `请选择${item.label}`) +const getPlaceholder = function (item: FormProMaxItemProps) { + // console.log('getPlaceholder____________________________', item) + console.log('getPlaceholder_______________________placeholder', item.placeholder) + console.log(item.componentsProps?.placeholder ?? item.placeholder ?? (item.type.includes('input') ? `请输入${item.label}` : `请选择${item.label}`)) + + return item.componentsProps?.placeholder ?? item.placeholder ?? (item.type.includes('input') ? `请输入${item.label}` : `请选择${item.label}`) +} defineExpose({ validate: (nameList, options) => formProMaxRef.value?.validate(nameList, options), diff --git a/policeManagement/src/views/query/publicUnit.vue b/policeManagement/src/views/query/publicUnit.vue index db20764..da78032 100644 --- a/policeManagement/src/views/query/publicUnit.vue +++ b/policeManagement/src/views/query/publicUnit.vue @@ -31,6 +31,7 @@ import { AutoComplete, Button, Input, message, Modal, Space } from 'ant-design-v import { debounce } from 'lodash-es' import FormProMax from '@/components/form/FormProMax.vue' import api from '@/axios' +// createVNode import { ref, reactive, computed, onMounted } from 'vue' import TableProMax from '@/components/table/TableProMax.vue' import { TableProMaxProps } from '@/types/components/table/index.ts' @@ -238,6 +239,7 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => { type: 'select', label: '单位类型', required: true, + placeholder: '请选择单位类型', // @ts-ignore options: dictSelectNodes('EnterprisesUnitType'), }, @@ -387,6 +389,18 @@ const formItemOptions = ref { + // if (option.label.toLowerCase().includes(input?.toLowerCase())) { + // console.log(111111111111111) + // } + return option.label.toLowerCase().includes(input?.toLowerCase()) + }, + }, }, type: { type: 'radioGroup', @@ -635,6 +649,21 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => formParams.value.houseTotal = record.houseTotal //户数 formParams.value.staffTotal = record.staffTotal //工作人员数量 formParams.value.securityUserTotal = record.securityUserTotal //保安人员数量 + { + /* Modal.confirm({ + title: serviceTitle.value, + icon: createVNode('div'), + width: 600, + centered: true, + content: () => , + onOk: async () => { + await submit() + }, + onCancel: async () => { + await closeModal() + }, + }) */ + } }} > 编辑 @@ -713,5 +742,18 @@ onMounted(async () => { const addService = function (record) { formParams.value.enterprisesUnitId = record.snowFlakeId //企事业单位Id visible.value = true + //Modal.confirm({ + // title: serviceTitle.value, + // icon: createVNode('div'), + // width: 600, + // centered: true, + // content: () => , + // onOk: async () => { + // await submit() + // }, + // onCancel: async () => { + // await closeModal() + // }, + //}) } From 9df3582913bf27ce66d6af28c87c2bd7203cdb5f Mon Sep 17 00:00:00 2001 From: TimSpan Date: Thu, 19 Dec 2024 16:52:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=98=BE=E7=A4=BA=20placeholder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/form/FormProMax.vue | 6 +- .../src/views/query/publicUnit.vue | 59 ++++++++++--------- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/policeManagement/src/components/form/FormProMax.vue b/policeManagement/src/components/form/FormProMax.vue index 756c79a..07e95f5 100644 --- a/policeManagement/src/components/form/FormProMax.vue +++ b/policeManagement/src/components/form/FormProMax.vue @@ -47,7 +47,7 @@ v-else-if="item.type === 'select'" v-model:value="modelValue[field]" style="width: 100%" - :placeholder="getPlaceholder(item)" + :placeholder="item.placeholder" v-bind="item.componentsProps" :allowClear="item.componentsProps?.allowClear ?? true" :options="item.options" @@ -167,8 +167,8 @@ const getResponsive = (item: FormProMaxItemProps): Grid => { //优先级: 组件本身=》formItem=》label const getPlaceholder = function (item: FormProMaxItemProps) { // console.log('getPlaceholder____________________________', item) - console.log('getPlaceholder_______________________placeholder', item.placeholder) - console.log(item.componentsProps?.placeholder ?? item.placeholder ?? (item.type.includes('input') ? `请输入${item.label}` : `请选择${item.label}`)) + // console.log('getPlaceholder_______________________placeholder', item.placeholder) + // console.log(item.componentsProps?.placeholder ?? item.placeholder ?? (item.type.includes('input') ? `请输入${item.label}` : `请选择${item.label}`)) return item.componentsProps?.placeholder ?? item.placeholder ?? (item.type.includes('input') ? `请输入${item.label}` : `请选择${item.label}`) } diff --git a/policeManagement/src/views/query/publicUnit.vue b/policeManagement/src/views/query/publicUnit.vue index da78032..2964559 100644 --- a/policeManagement/src/views/query/publicUnit.vue +++ b/policeManagement/src/views/query/publicUnit.vue @@ -17,9 +17,9 @@ - + @@ -32,7 +32,7 @@ import { debounce } from 'lodash-es' import FormProMax from '@/components/form/FormProMax.vue' import api from '@/axios' // createVNode -import { ref, reactive, computed, onMounted } from 'vue' +import { ref, reactive, computed, onMounted, createVNode } from 'vue' import TableProMax from '@/components/table/TableProMax.vue' import { TableProMaxProps } from '@/types/components/table/index.ts' import { ComponentExposed } from 'vue-component-type-helpers' @@ -42,6 +42,7 @@ import { FormProMaxItemOptions } from '@/types/components/form//index.ts' import { FormExpose } from 'ant-design-vue/es/form/Form' import { serviceProjectSaveOrUpdateParams_ } from '@/types/views/serviceManagement' import { showEnterprisesUnit } from './index.tsx' +var modal: any type _FormType = EnterprisesUnitSaveOrUpdateParams & { contactPersonInfoName?: string contactPersonInfoTelephone?: string @@ -354,7 +355,7 @@ const netType = computed(() => { const formParams = ref<{ snowFlakeId?: string enterprisesUnitId: string - securityUnitId: string + securityUnitId: string | null administrativeDivisionCodes?: null projectManagerMiniProgramUserId?: string projectManagerMiniProgramUserName?: string @@ -374,7 +375,7 @@ const formParams = ref<{ name: '', enterprisesUnitId: '', type: 'security', - securityUnitId: '', + securityUnitId: null, // 初始值得设置为null,不然 placeholder 显示不出来 }) const securityUnitIdList = ref([]) const formItemOptions = ref>({ @@ -395,9 +396,6 @@ const formItemOptions = ref { - // if (option.label.toLowerCase().includes(input?.toLowerCase())) { - // console.log(111111111111111) - // } return option.label.toLowerCase().includes(input?.toLowerCase()) }, }, @@ -630,7 +628,7 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => { - visible.value = true + // visible.value = true serviceTitle.value = '编辑服务项目' idNumberDisabled.value = record.twoType.value !== 'outsource' formParams.value.securityUnitId = record.securityUnitId //企事业单位id @@ -649,8 +647,8 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => formParams.value.houseTotal = record.houseTotal //户数 formParams.value.staffTotal = record.staffTotal //工作人员数量 formParams.value.securityUserTotal = record.securityUserTotal //保安人员数量 - { - /* Modal.confirm({ + + modal = Modal.confirm({ title: serviceTitle.value, icon: createVNode('div'), width: 600, @@ -662,8 +660,7 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => onCancel: async () => { await closeModal() }, - }) */ - } + }) }} > 编辑 @@ -705,9 +702,10 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => } const closeModal = async () => { + console.log(modal) visible.value = false formParams.value = { - securityUnitId: '', + securityUnitId: null, enterprisesUnitId: '', administrativeDivisionCodes: '', name: '', @@ -724,6 +722,9 @@ const closeModal = async () => { enterprisesUnitId.value = '' serviceTitle.value = '新增服务项目' idNumberDisabled.value = false + modal.destroy() + // console.log(modal) + Modal.destroyAll() } const submit = async () => { @@ -733,6 +734,7 @@ const submit = async () => { message.success(resp.message) await _tableRef.value.requestGetTableData() await closeModal() + // modal.destroy() } onMounted(async () => { @@ -740,20 +742,21 @@ onMounted(async () => { securityUnitIdList.value = res.data }) const addService = function (record) { + // modal.destroy() formParams.value.enterprisesUnitId = record.snowFlakeId //企事业单位Id - visible.value = true - //Modal.confirm({ - // title: serviceTitle.value, - // icon: createVNode('div'), - // width: 600, - // centered: true, - // content: () => , - // onOk: async () => { - // await submit() - // }, - // onCancel: async () => { - // await closeModal() - // }, - //}) + // visible.value = true + modal = Modal.confirm({ + title: serviceTitle.value, + icon: createVNode('div'), + width: 600, + centered: true, + content: () => , + onOk: async () => { + await submit() + }, + onCancel: async () => { + await closeModal() + }, + }) }