|  |  | 
 |  |  | <script setup> | 
 |  |  | import { ref, nextTick } from 'vue'; | 
 |  |  | import { ref, nextTick, watch } from 'vue'; | 
 |  |  | import { get, post, postBlob, postForm } from '@/utils/request.js' | 
 |  |  | import { formatMessage } from '@/utils/localeUtils.js'; | 
 |  |  | import { message } from 'ant-design-vue'; | 
 |  |  | 
 |  |  | const onFinish = values => { | 
 |  |  |     // console.log('Success:', values); | 
 |  |  |     open.value = false; | 
 |  |  |     formData.value.contain = JSON.stringify(locTypeSelected.value); | 
 |  |  |     if(locTypeSelected.value.length == 0) { | 
 |  |  |         formData.value.contain = ""; | 
 |  |  |     } | 
 |  |  |     post(isSave.value ? '/api/locType/save' : '/api/locType/update', formData.value).then((resp) => { | 
 |  |  |         let result = resp.data; | 
 |  |  |         if (result.code === 200) { | 
 |  |  | 
 |  |  |     }) | 
 |  |  | } | 
 |  |  |  | 
 |  |  | const locTypeQueryList = ref(null); | 
 |  |  | const locTypeSelected = ref([]); | 
 |  |  | locTypeQuery(); | 
 |  |  | function locTypeQuery() { | 
 |  |  |     post('/api/locType/tree', {}).then(resp => { | 
 |  |  |         let result = resp.data; | 
 |  |  |         locTypeQueryList.value = result.data; | 
 |  |  |     }) | 
 |  |  | } | 
 |  |  |  | 
 |  |  | watch(formData, (newVal, oldVal) => { | 
 |  |  |     if(formData.value.contain == null) { | 
 |  |  |         locTypeSelected.value = []; | 
 |  |  |         return | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     if(formData.value.contain.length == 0) { | 
 |  |  |         locTypeSelected.value = []; | 
 |  |  |     }else { | 
 |  |  |         let contain = JSON.parse(formData.value.contain); | 
 |  |  |         locTypeSelected.value = contain; | 
 |  |  |     } | 
 |  |  | }) | 
 |  |  |  | 
 |  |  | defineExpose({ | 
 |  |  |     open, | 
 |  |  | 
 |  |  |             <a-form :model="formData" ref="formTable" name="formTable" :label-col="{ span: 8 }" | 
 |  |  |                 :wrapper-col="{ span: 16 }" style="display: flex;justify-content: space-between;flex-wrap: wrap;" | 
 |  |  |                 autocomplete="off" @finish="onFinish" @finishFailed="onFinishFailed"> | 
 |  |  |                 <a-form-item :label="formatMessage('db.man_loc_area_type.parent_id', '上级类型')" name="parentId" style="width: 250px;" | 
 |  |  |                     :rules="[{ required: true, message: '上级区域不能为空!' }]"> | 
 |  |  |                 <a-form-item :label="formatMessage('db.man_loc_area_type.parent_id', '上级类型')" name="parentId" | 
 |  |  |                     style="width: 250px;" :rules="[{ required: true, message: '上级区域不能为空!' }]"> | 
 |  |  |                     <a-tree-select v-model:value="formData.parentId" show-search style="width: 100%" | 
 |  |  |                         :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" | 
 |  |  |                         :placeholder="formatMessage('page.input', '请输入')" allow-clea tree-data-simple-mode | 
 |  |  | 
 |  |  |                 </a-form-item> | 
 |  |  |                 <a-form-item :label="formatMessage('db.man_loc_type.contain', '包含关系')" name="contain" | 
 |  |  |                     style="width: 250px;"> | 
 |  |  |                     <a-input v-model:value="formData.contain" /> | 
 |  |  |                     <a-tree-select v-model:value="locTypeSelected" style="width: 100%" | 
 |  |  |                         :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" | 
 |  |  |                         :placeholder="formatMessage('page.input', '请输入')" tree-checkable tree-default-expand-all | 
 |  |  |                         :tree-data="locTypeQueryList" tree-node-filter-prop="name" :field-names="{ | 
 |  |  |                             children: 'children', | 
 |  |  |                             label: 'name', | 
 |  |  |                             value: 'id', | 
 |  |  |                         }"> | 
 |  |  |                         <template #title="{ value: id, name }"> | 
 |  |  |                             {{ name }} | 
 |  |  |                         </template> | 
 |  |  |                     </a-tree-select> | 
 |  |  |                 </a-form-item> | 
 |  |  |                 <a-form-item :label="formatMessage('db.man_loc_type.type', '类型')" name="type" style="width: 250px;"> | 
 |  |  |                     <a-select v-model:value="formData.type" :options="[ | 
 |  |  | 
 |  |  |                 <a-form-item :label="formatMessage('db.man_loc_type.uuid', '编号')" name="uuid" style="width: 250px;"> | 
 |  |  |                     <a-input v-model:value="formData.uuid" /> | 
 |  |  |                 </a-form-item> | 
 |  |  |                 <a-form-item :label="formatMessage('db.man_loc_type.status', '状态')" name="status" | 
 |  |  |                     style="width: 250px;"> | 
 |  |  |                 <a-form-item :label="formatMessage('db.man_loc_type.status', '状态')" name="status" style="width: 250px;"> | 
 |  |  |                     <a-select v-model:value="formData.status" :options="[ | 
 |  |  |                         { label: '正常', value: 1 }, | 
 |  |  |                         { label: '禁用', value: 0 }, |