部门管理增加省、市、区选择

This commit is contained in:
1378012178@qq.com 2025-05-30 16:49:16 +08:00
parent 53b7241cfb
commit 345b51130f
9 changed files with 407 additions and 330 deletions

View File

@ -138,8 +138,10 @@
<a-col :span="selectedScreenSpan"> <a-col :span="selectedScreenSpan">
<div style="height: 31px;margin-left: 4px;"> <div style="height: 31px;margin-left: 4px;">
<a-tag color="#2db7f5"> <a-tag color="#2db7f5">
已选择<span style="font-size: 13px;font-weight: bold;">{{ ' ' + 已选择
Array.from(selectedItems.values()).length + ' ' }}</span> <span style="font-size: 13px;font-weight: bold;">
{{ ' ' + selectedSize + ' ' }}
</span>
</a-tag> </a-tag>
</div> </div>
<a-card size="small" :bordered="false" class="selected-list-container"> <a-card size="small" :bordered="false" class="selected-list-container">
@ -207,17 +209,18 @@
<script lang="ts" name="synchronization-directive" setup> <script lang="ts" name="synchronization-directive" setup>
import { ref, onMounted, computed, onBeforeMount, reactive } from 'vue'; import { ref, onMounted, computed, onBeforeMount, reactive } from 'vue';
import { initDictOptions } from '/@/utils/dict'; import { initDictOptions } from '/@/utils/dict';
import { list, asyncFunc } from '@/views/services/serviceDirective/ConfigServiceDirective.api';
import { queryDepartTreeSync } from '/@/api/common/api'; import { queryDepartTreeSync } from '/@/api/common/api';
import { Empty } from 'ant-design-vue'; import { Empty } from 'ant-design-vue';
import { Modal } from 'ant-design-vue'; import { Modal } from 'ant-design-vue';
import { useMessage } from "/@/hooks/web/useMessage"; import { useMessage } from "/@/hooks/web/useMessage";
import AsyncListComponent from '@/components/dataAsync/AsyncMainList.vue' import AsyncListComponent from '@/components/dataAsync/AsyncMainList.vue'
import { number } from 'vue-types';
const props = defineProps({ const props = defineProps({
// showJMCom: { type: Boolean, default: false }, selectedSize: 0
}); });
const emit = defineEmits(['changeShowJMCom', 'viewTypeChanged','sourceOrgCodeChanged']); const emit = defineEmits(['changeShowJMCom', 'viewTypeChanged', 'sourceOrgCodeChanged', 'orgChanged']);
interface OrganizationData { interface OrganizationData {
id?: string; id?: string;
@ -234,7 +237,7 @@ interface OrganizationData {
onBeforeMount(async () => { onBeforeMount(async () => {
const dictData = await initDictOptions('org_code') const dictData = await initDictOptions('org_code')
emit('sourceOrgCodeChanged',dictData.filter(d => d.text == 'shi_yan_tian')[0].value) emit('sourceOrgCodeChanged', dictData.filter(d => d.text == 'shi_yan_tian')[0].value)
emit('changeShowJMCom', true) emit('changeShowJMCom', true)
}) })
const initialDataIds = ref<Array<string | number>>([]); const initialDataIds = ref<Array<string | number>>([]);
@ -300,45 +303,10 @@ const handleOrgSelected = async (org) => {
}; };
const loadOrgData = async (org) => { const loadOrgData = async (org) => {
try { //
// orgData.value = org;
selectedItems.value.clear();
//
initialDataIds.value = [];
// emit('orgChanged', org)
const res = await list({ dataSourceCode: org.orgCode, pageNo: 1, pageSize: -1 });
//
orgData.value = org;
//
if (res.records && res.records.length > 0) {
const newRecords = res.records;
newRecords.forEach(record => {
selectedItems.value.set(record.id, record);
if (!orgData.value?.operationStartTime || new Date() >= new Date(orgData.value?.operationStartTime)) {
initialDataIds.value.push(record.id);
}
});
//
listComRef.value?.updateSelection?.(newRecords);
} else {
//
selectedItems.value.clear();
listComRef.value?.updateSelection?.([]);
}
//
orgSelectedCon.value = false;
} catch (err) {
console.error('机构数据查询失败:', err);
createMessage.error('机构数据查询失败');
//
selectedItems.value.clear();
listComRef.value?.updateSelection?.([]);
}
}; };
@ -346,6 +314,10 @@ const handleResetOrg = () => {
orgSelectedCon.value = true orgSelectedCon.value = true
} }
const resetOrgSelectedCon = (v_) => {
orgSelectedCon.value = v_
}
// //
const handleAsync = () => { const handleAsync = () => {
Modal.confirm({ Modal.confirm({
@ -509,6 +481,8 @@ onMounted(() => {
}); });
defineExpose({ defineExpose({
orgData,
resetOrgSelectedCon
}); });
</script> </script>

View File

@ -1,6 +1,7 @@
<template> <template>
<SyncComponent ref="syncComRef" @changeShowJMCom="changeShowJMCom" @sourceOrgCodeChanged="sourceOrgCodeChanged" <SyncComponent ref="syncComRef" :selectedSize="Array.from(selectedItems.values()).length"
@viewTypeChanged="viewTypeChanged"> @changeShowJMCom="changeShowJMCom" @sourceOrgCodeChanged="sourceOrgCodeChanged"
@viewTypeChanged="viewTypeChanged" @orgChanged="orgChanged">
<!-- 表单 --> <!-- 表单 -->
<template #searchFormSlot> <template #searchFormSlot>
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" <a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol"
@ -143,85 +144,26 @@
</template> </template>
<script setup name="synchronization-directive2" lang="ts"> <script setup name="synchronization-directive2" lang="ts">
//
import { ref, reactive } from 'vue' import { ref, reactive } from 'vue'
import SyncComponent from '/@/components/Sync/SyncComponent.vue' import SyncComponent from '/@/components/Sync/SyncComponent.vue'
import ConfigServiceDirectiveList from '@/views/services/serviceDirective/ConfigServiceDirectiveList.vue'
import { getFileAccessHttpUrl } from '/@/utils/common/compUtils'
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue"; import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue'; import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue'; import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue';
import { useMessage } from "/@/hooks/web/useMessage";
//
//
import { list, asyncFunc } from '@/views/services/serviceDirective/ConfigServiceDirective.api';
import ConfigServiceDirectiveList from '@/views/services/serviceDirective/ConfigServiceDirectiveList.vue'
import { getFileAccessHttpUrl } from '/@/utils/common/compUtils'
import { selectedColumns } from './org.data';
//
// // >>>>>>>>>>>>>
const selectedColumns = [ const { createMessage } = useMessage();
{ const syncComRef = ref(null)
title: '服务指令', const sourceOrgCode = ref('')
dataIndex: 'directiveName', const showJMCom = ref(false)
key: 'directiveName',
width: 150
},
{
title: '服务类别',
dataIndex: 'categoryName',
key: 'categoryName',
width: 120
},
{
title: '服务类型',
dataIndex: 'typeName',
key: 'typeName',
width: 120
},
{
title: '分类标签',
dataIndex: 'instructionTagName',
key: 'instructionTagName',
width: 120
},
{
title: '体型标签',
dataIndex: 'bodyTagList',
key: 'bodyTagList',
width: 150
},
{
title: '情绪标签',
dataIndex: 'emotionTagList',
key: 'emotionTagList',
width: 150
},
{
title: '预览图',
dataIndex: 'previewFile',
key: 'previewFile',
width: 120
},
{
title: '即时图',
dataIndex: 'immediateFile',
key: 'immediateFile',
width: 120
},
{
title: '音频',
dataIndex: 'mp3File',
key: 'mp3File',
width: 150
},
{
title: '视频',
dataIndex: 'mp4File',
key: 'mp4File',
width: 120
},
{
title: '操作',
dataIndex: 'action',
key: 'action',
width: 80,
fixed: 'right'
}
]
const labelCol = reactive({ const labelCol = reactive({
xs: 24, xs: 24,
sm: 4, sm: 4,
@ -232,13 +174,6 @@ const wrapperCol = reactive({
xs: 24, xs: 24,
sm: 20, sm: 20,
}); });
const sourceOrgCode = ref('')
const syncComRef = ref(null)
const listComRef = ref();
const selectedItems = ref(new Map<string | number, any>());
const queryParam = ref({ viewType: 'all' })//
const initialDataIds = ref<string[]>([]);
const showJMCom = ref(false)
/** /**
* 获取到了试验田的机构编码 * 获取到了试验田的机构编码
@ -255,19 +190,59 @@ const sourceOrgCodeChanged = (v_) => {
const changeShowJMCom = (v_) => { const changeShowJMCom = (v_) => {
showJMCom.value = v_ showJMCom.value = v_
} }
// <<<<<<<<<<<<<
/** /**
* 源数据的全部已选择未选择变更时触发 * 机构变更
* @param v_ allselectedunselected
*/ */
const viewTypeChanged = (v_) => { const orgChanged = async (org) => {
queryParam.value.viewType = v_ //
//queryParam selectedItems.value.clear();
//
initialDataIds.value = [];
try {
//
const res = await list({ dataSourceCode: org.orgCode, pageNo: 1, pageSize: -1 });
//
if (res.records && res.records.length > 0) {
const newRecords = res.records;
newRecords.forEach(record => {
selectedItems.value.set(record.id, record);
if (!syncComRef.value.orgData.value?.operationStartTime || new Date() >= new Date(syncComRef.value.orgData.value?.operationStartTime)) {
initialDataIds.value.push(record.id);
}
});
//
listComRef.value?.updateSelection?.(newRecords);
} else {
//
selectedItems.value.clear();
listComRef.value?.updateSelection?.([]);
}
//
syncComRef.value.resetOrgSelectedCon(false);
console.log("🌊 ~ orgChanged ~ selectedItems.value:", selectedItems.value)
} catch (err) {
console.error('机构数据查询失败:', err);
createMessage.error('机构数据查询失败');
//
selectedItems.value.clear();
listComRef.value?.updateSelection?.([]);
}
} }
// >>>>>>>>>>>>>
// <<<<<<<<<<<<<
// >>>>>>>>>>>>>
const listComRef = ref();
const selectedItems = ref(new Map<string | number, any>());
const queryParam = ref({ viewType: 'all' })//
const initialDataIds = ref<string[]>([]);
const showVideoModal = ref(false); const showVideoModal = ref(false);
const videoUrl = ref(''); const videoUrl = ref('');
/** /**
* 查询 * 查询
*/ */
@ -283,6 +258,14 @@ function searchReset() {
listComRef.value?.reload(); listComRef.value?.reload();
} }
/**
* 源数据的全部已选择未选择变更时触发
* @param v_ allselectedunselected
*/
const viewTypeChanged = (v_) => {
queryParam.value.viewType = v_
//queryParam
}
const handleSelectChange = (items: Map<string | number, any>) => { const handleSelectChange = (items: Map<string | number, any>) => {
selectedItems.value = new Map(items); selectedItems.value = new Map(items);
}; };
@ -301,6 +284,7 @@ const closeVideoModal = () => {
showVideoModal.value = false; showVideoModal.value = false;
videoUrl.value = ''; videoUrl.value = '';
}; };
// <<<<<<<<<<<<<
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -65,7 +65,7 @@ export const saveOrUpdateDict = (params, isUpdate) => {
* *
* @param params * @param params
*/ */
export const loadTreeData = (params) => defHttp.get({ url: Api.loadTreeData, params }); export const loadTreeData = (params) => defHttp.get({ url: Api.loadTreeData,timeout:100*1000, params });
/** /**
* *
* @param params * @param params

View File

@ -64,4 +64,10 @@ export const formSchema: FormSchema[] = [
required: true, required: true,
component: 'Input', component: 'Input',
}, },
{
label: '编码(非必要无需填写)',
field: 'code',
required: false,
component: 'Input',
},
]; ];

View File

@ -1,5 +1,5 @@
<template> <template>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose width="550px" :title="getTitle" @ok="handleSubmit"> <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose width="50vw" :title="getTitle" @ok="handleSubmit">
<BasicForm @register="registerForm" /> <BasicForm @register="registerForm" />
</BasicModal> </BasicModal>
</template> </template>
@ -21,11 +21,11 @@
showActionButtonGroup: false, showActionButtonGroup: false,
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 4 }, sm: { span: 5 },
}, },
wrapperCol: { wrapperCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 18 }, sm: { span: 15 },
}, },
}); });
// //

View File

@ -147,6 +147,9 @@
* 成功回调 * 成功回调
*/ */
async function handleSuccess({ isUpdate,isSubAdd, values, expandedArr }) { async function handleSuccess({ isUpdate,isSubAdd, values, expandedArr }) {
reload();
return
// 🤡
if (isUpdate) { if (isUpdate) {
// //
updateTableDataRecord(values.id, values); updateTableDataRecord(values.id, values);

View File

@ -1,96 +1,142 @@
<template> <template>
<BasicModal :title="title" :width="800" v-bind="$attrs" @ok="handleOk" @register="registerModal"> <BasicModal :title="title" :width="800" v-bind="$attrs" @ok="handleOk" @register="registerModal">
<BasicForm @register="registerForm" /> <BasicForm @register="registerForm">
<!-- 省份 -->
<template #province="{ model, field }">
<j-dict-select-tag @change="provinceChanged(model)" v-model:value="model[field]"
:dictCode="getProvinceDictCode()" placeholder="请选择所在省份" :disabled="model.orgCategory != '1'" />
</template>
<!-- 城市 -->
<template #city="{ model, field }">
<j-dict-select-tag @change="cityChanged(model)" v-model:value="model[field]" :dictCode="getCityDictCode(model)"
placeholder="请选择所在城市" :disabled="model.orgCategory != '1' && !model.province" />
</template>
<!-- 区县 -->
<template #district="{ model, field }">
<j-dict-select-tag v-model:value="model[field]" :dictCode="getDistrictDictCode(model)" placeholder="请选择所在区县"
:disabled="model.orgCategory != '1' && (!model.province || !model.city)" />
</template>
</BasicForm>
</BasicModal> </BasicModal>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { watch, computed, inject, ref, unref, onMounted } from 'vue'; import { watch, computed, inject, ref, unref, onMounted } from 'vue';
import { BasicForm, useForm } from '/@/components/Form/index'; import { BasicForm, useForm } from '/@/components/Form/index';
import { BasicModal, useModalInner } from '/@/components/Modal'; import { BasicModal, useModalInner } from '/@/components/Modal';
import { saveOrUpdateDepart } from '../depart.api'; import { saveOrUpdateDepart } from '../depart.api';
import { useBasicFormSchema, orgCategoryOptions } from '../depart.data'; import { useBasicFormSchema, orgCategoryOptions } from '../depart.data';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
const emit = defineEmits(['success', 'register']);
const props = defineProps({
rootTreeData: { type: Array, default: () => [] },
});
const prefixCls = inject('prefixCls');
//
const isUpdate = ref<boolean>(false);
//
const model = ref<object>({});
const title = computed(() => (isUpdate.value ? '编辑' : '新增'));
// const emit = defineEmits(['success', 'register']);
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({ const props = defineProps({
schemas: useBasicFormSchema().basicFormSchema, rootTreeData: { type: Array, default: () => [] },
showActionButtonGroup: false, });
}); const prefixCls = inject('prefixCls');
//
const isUpdate = ref<boolean>(false);
//
const model = ref<object>({});
const title = computed(() => (isUpdate.value ? '编辑' : '新增'));
// //
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => { const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({
await resetFields(); schemas: useBasicFormSchema().basicFormSchema,
isUpdate.value = unref(data?.isUpdate); showActionButtonGroup: false,
// });
let isChild = unref(data?.isChild);
let categoryOptions = isChild ? orgCategoryOptions.child : orgCategoryOptions.root; //
// const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
updateSchema([ await resetFields();
{ isUpdate.value = unref(data?.isUpdate);
field: 'parentId', //
show: isChild, let isChild = unref(data?.isChild);
componentProps: { let categoryOptions = isChild ? orgCategoryOptions.child : orgCategoryOptions.root;
// //
disabled: isChild, updateSchema([
treeData: props.rootTreeData, {
}, field: 'parentId',
show: isChild,
componentProps: {
//
disabled: isChild,
treeData: props.rootTreeData,
}, },
{ },
field: 'platType', {
show: !isChild field: 'platType',
}, show: !isChild
{ },
field: 'orgCode', {
show: false, field: 'orgCode',
}, show: false,
{ },
field: 'orgCategory', {
componentProps: { options: categoryOptions }, field: 'orgCategory',
}, componentProps: { options: categoryOptions },
]); },
]);
let record = unref(data?.record); let record = unref(data?.record);
if (typeof record !== 'object') { if (typeof record !== 'object') {
record = {}; record = {};
}
//
record = Object.assign(
{
departOrder: 0,
orgCategory: categoryOptions[0].value,
},
record
);
model.value = record;
await setFieldsValue({ ...record });
});
//
async function handleOk() {
try {
setModalProps({ confirmLoading: true });
let values = await validate();
//
await saveOrUpdateDepart(values, isUpdate.value);
//
closeModal();
//
emit('success');
} finally {
setModalProps({ confirmLoading: false });
}
} }
//
record = Object.assign(
{
departOrder: 0,
orgCategory: categoryOptions[0].value,
},
record
);
model.value = record;
await setFieldsValue({ ...record });
});
//
async function handleOk() {
try {
setModalProps({ confirmLoading: true });
let values = await validate();
//
await saveOrUpdateDepart(values, isUpdate.value);
//
closeModal();
//
emit('success');
} finally {
setModalProps({ confirmLoading: false });
}
}
/**
* 省份字典
*/
function getProvinceDictCode() {
return 'sys_category,name,id,pid = \'xzqhdm\' order by code asc'
}
function provinceChanged(model) {
model.city = null
model.district = null
}
/**
* 城市字典
* @param v_
*/
function getCityDictCode(v_) {
return 'sys_category,name,id,pid = \'' + v_.province + '\' order by code asc'
}
function cityChanged(model) {
model.district = null
}
/**
* 区县字典
* @param v_
*/
function getDistrictDictCode(v_) {
return 'sys_category,name,id,pid = \'' + v_.city + '\' order by code asc'
}
</script> </script>

View File

@ -1,6 +1,22 @@
<template> <template>
<a-spin :spinning="loading"> <a-spin :spinning="loading">
<BasicForm @register="registerForm" /> <BasicForm @register="registerForm">
<!-- 省份 -->
<template #province="{ model, field }">
<j-dict-select-tag @change="provinceChanged(model)" v-model:value="model[field]"
:dictCode="getProvinceDictCode()" placeholder="请选择所在省份" :disabled="model.orgCategory != '1'" />
</template>
<!-- 城市 -->
<template #city="{ model, field }">
<j-dict-select-tag @change="cityChanged(model)" v-model:value="model[field]" :dictCode="getCityDictCode(model)"
placeholder="请选择所在城市" :disabled="model.orgCategory != '1' && !model.province" />
</template>
<!-- 区县 -->
<template #district="{ model, field }">
<j-dict-select-tag v-model:value="model[field]" :dictCode="getDistrictDictCode(model)" placeholder="请选择所在区县"
:disabled="model.orgCategory != '1' && (!model.province || !model.city)" />
</template>
</BasicForm>
<div class="j-box-bottom-button offset-20" style="margin-top: 30px"> <div class="j-box-bottom-button offset-20" style="margin-top: 30px">
<div class="j-box-bottom-button-float" :class="[`${prefixCls}`]"> <div class="j-box-bottom-button-float" :class="[`${prefixCls}`]">
<a-button preIcon="ant-design:sync-outlined" @click="onReset">重置</a-button> <a-button preIcon="ant-design:sync-outlined" @click="onReset">重置</a-button>
@ -11,118 +27,148 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { watch, computed, inject, ref, unref, onMounted } from 'vue'; import { watch, computed, inject, ref, unref, onMounted } from 'vue';
import { BasicForm, useForm } from '/@/components/Form/index'; import { BasicForm, useForm } from '/@/components/Form/index';
import { saveOrUpdateDepart } from '../depart.api'; import { saveOrUpdateDepart } from '../depart.api';
import { useBasicFormSchema, orgCategoryOptions } from '../depart.data'; import { useBasicFormSchema, orgCategoryOptions } from '../depart.data';
import { useDesign } from '/@/hooks/web/useDesign'; import { useDesign } from '/@/hooks/web/useDesign';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
const { prefixCls } = useDesign('j-depart-form-content'); const { prefixCls } = useDesign('j-depart-form-content');
const emit = defineEmits(['success']); const emit = defineEmits(['success']);
const props = defineProps({ const props = defineProps({
data: { type: Object, default: () => ({}) }, data: { type: Object, default: () => ({}) },
rootTreeData: { type: Array, default: () => [] }, rootTreeData: { type: Array, default: () => [] },
}); });
const loading = ref<boolean>(false); const loading = ref<boolean>(false);
// //
const isUpdate = ref<boolean>(true); const isUpdate = ref<boolean>(true);
// //
const model = ref<object>({}); const model = ref<object>({});
// //
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({ const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({
schemas: useBasicFormSchema().basicFormSchema, schemas: useBasicFormSchema().basicFormSchema,
showActionButtonGroup: false, showActionButtonGroup: false,
}); });
const categoryOptions = computed(() => { const categoryOptions = computed(() => {
if (!!props?.data?.parentId) { if (!!props?.data?.parentId) {
return orgCategoryOptions.child; return orgCategoryOptions.child;
} else { } else {
return orgCategoryOptions.root; return orgCategoryOptions.root;
}
});
onMounted(() => {
//
updateSchema([
{ field: 'parentId', componentProps: { disabled: true } },
{ field: 'orgCode', componentProps: { disabled: true } },
]);
// data
watch(
() => props.data,
async () => {
let record = unref(props.data);
if (typeof record !== 'object') {
record = {};
}
model.value = record;
await resetFields();
await setFieldsValue({ ...record });
},
{ deep: true, immediate: true }
);
//
watch(
() => props.rootTreeData,
async () => {
updateSchema([
{
field: 'parentId',
componentProps: { treeData: props.rootTreeData },
},
]);
},
{ deep: true, immediate: true }
);
// orgCategory options
watch(
categoryOptions,
async () => {
updateSchema([
{
field: 'orgCategory',
componentProps: { options: categoryOptions.value },
},
]);
},
{ immediate: true }
);
});
//
async function onReset() {
await resetFields();
await setFieldsValue({ ...model.value });
} }
});
// onMounted(() => {
async function onSubmit() { //
try { updateSchema([
loading.value = true; { field: 'parentId', componentProps: { disabled: true } },
let values = await validate(); { field: 'orgCode', componentProps: { disabled: true } },
values = Object.assign({}, model.value, values); ]);
// // data
await saveOrUpdateDepart(values, isUpdate.value); watch(
// () => props.data,
emit('success'); async () => {
Object.assign(model.value, values); let record = unref(props.data);
} finally { if (typeof record !== 'object') {
loading.value = false; record = {};
} }
model.value = record;
await resetFields();
await setFieldsValue({ ...record });
},
{ deep: true, immediate: true }
);
//
watch(
() => props.rootTreeData,
async () => {
updateSchema([
{
field: 'parentId',
componentProps: { treeData: props.rootTreeData },
},
]);
},
{ deep: true, immediate: true }
);
// orgCategory options
watch(
categoryOptions,
async () => {
updateSchema([
{
field: 'orgCategory',
componentProps: { options: categoryOptions.value },
},
]);
},
{ immediate: true }
);
});
//
async function onReset() {
await resetFields();
await setFieldsValue({ ...model.value });
}
//
async function onSubmit() {
try {
loading.value = true;
let values = await validate();
values = Object.assign({}, model.value, values);
//
await saveOrUpdateDepart(values, isUpdate.value);
//
emit('success');
Object.assign(model.value, values);
} finally {
loading.value = false;
} }
}
/**
* 省份字典
*/
function getProvinceDictCode() {
return 'sys_category,name,id,pid = \'xzqhdm\' order by code asc'
}
function provinceChanged(model) {
model.city = null
model.district = null
}
/**
* 城市字典
* @param v_
*/
function getCityDictCode(v_) {
return 'sys_category,name,id,pid = \'' + v_.province + '\' order by code asc'
}
function cityChanged(model) {
model.district = null
}
/**
* 区县字典
* @param v_
*/
function getDistrictDictCode(v_) {
return 'sys_category,name,id,pid = \'' + v_.city + '\' order by code asc'
}
</script> </script>
<style lang="less"> <style lang="less">
// update-begin-author:liusq date:20230625 for: [issues/563] // update-begin-author:liusq date:20230625 for: [issues/563]
@prefix-cls: ~'@{namespace}-j-depart-form-content'; @prefix-cls: ~'@{namespace}-j-depart-form-content';
/*begin 兼容暗夜模式*/
.@{prefix-cls} { /*begin 兼容暗夜模式*/
background: @component-background; .@{prefix-cls} {
border-top: 1px solid @border-color-base; background: @component-background;
} border-top: 1px solid @border-color-base;
/*end 兼容暗夜模式*/ }
// update-end-author:liusq date:20230625 for: [issues/563]
</style> /*end 兼容暗夜模式*/
// update-end-author:liusq date:20230625 for: [issues/563]</style>

View File

@ -36,6 +36,24 @@ export function useBasicFormSchema() {
component: 'RadioButtonGroup', component: 'RadioButtonGroup',
componentProps: { options: [] }, componentProps: { options: [] },
}, },
{
field: 'province',
label: '省份',
component: 'Input',
slot: 'province',
},
{
field: 'city',
label: '城市',
component: 'Input',
slot: 'city',
},
{
field: 'district',
label: '区县',
component: 'Input',
slot: 'district',
},
{ {
field: 'platType', field: 'platType',
label: '业务平台类型', label: '业务平台类型',
@ -49,12 +67,6 @@ export function useBasicFormSchema() {
message: '请选择平台类型' message: '请选择平台类型'
}] }]
}, },
{
field: 'departOrder',
label: '排序',
component: 'InputNumber',
componentProps: {},
},
{ {
field: 'operationStartTime', field: 'operationStartTime',
label: '运营开始时间', label: '运营开始时间',
@ -131,6 +143,12 @@ export function useBasicFormSchema() {
placeholder: '请输入备注', placeholder: '请输入备注',
}, },
}, },
{
field: 'departOrder',
label: '排序',
component: 'InputNumber',
componentProps: {},
},
{ {
field: 'picUrl', field: 'picUrl',
label: '机构图片', label: '机构图片',