Commit c71924564dc755cbb768e0c995484e689f453d55

Authored by fengwotao
2 parents 9365c432 07cfb735

Merge branch 'main' into local_dev_ft

1 -import BasicForm from './src/BasicForm.vue'; 1 +export { default as BasicForm } from './src/BasicForm.vue';
2 2
3 export * from './src/types/form'; 3 export * from './src/types/form';
4 export * from './src/types/formItem'; 4 export * from './src/types/formItem';
@@ -22,4 +22,4 @@ export { @@ -22,4 +22,4 @@ export {
22 } from '/@/components/Form/src/externalCompns/components/JEasyCron'; 22 } from '/@/components/Form/src/externalCompns/components/JEasyCron';
23 // Jeecg自定义校验 23 // Jeecg自定义校验
24 export { JCronValidator } from '/@/components/Form/src/externalCompns/components/JEasyCron'; 24 export { JCronValidator } from '/@/components/Form/src/externalCompns/components/JEasyCron';
25 -export { BasicForm }; 25 +// export { BasicForm };
@@ -38,9 +38,6 @@ import ApiSearchSelect from './components/ApiSearchSelect.vue'; @@ -38,9 +38,6 @@ import ApiSearchSelect from './components/ApiSearchSelect.vue';
38 import CustomMinMaxInput from './externalCompns/components/CustomMinMaxInput.vue'; 38 import CustomMinMaxInput from './externalCompns/components/CustomMinMaxInput.vue';
39 import StructForm from './externalCompns/components/StructForm/StructForm.vue'; 39 import StructForm from './externalCompns/components/StructForm/StructForm.vue';
40 import ApiSelectScrollLoad from './components/ApiSelectScrollLoad.vue'; 40 import ApiSelectScrollLoad from './components/ApiSelectScrollLoad.vue';
41 -import TransferModal from './components/TransferModal.vue';  
42 -import TransferTableModal from './components/TransferTableModal.vue';  
43 -import ObjectModelValidateForm from './externalCompns/components/ObjectModelValidateForm/ObjectModelValidateForm.vue';  
44 41
45 const componentMap = new Map<ComponentType, Component>(); 42 const componentMap = new Map<ComponentType, Component>();
46 43
@@ -86,9 +83,6 @@ componentMap.set('ApiSearchSelect', ApiSearchSelect); @@ -86,9 +83,6 @@ componentMap.set('ApiSearchSelect', ApiSearchSelect);
86 componentMap.set('CustomMinMaxInput', CustomMinMaxInput); 83 componentMap.set('CustomMinMaxInput', CustomMinMaxInput);
87 componentMap.set('StructForm', StructForm); 84 componentMap.set('StructForm', StructForm);
88 componentMap.set('ApiSelectScrollLoad', ApiSelectScrollLoad); 85 componentMap.set('ApiSelectScrollLoad', ApiSelectScrollLoad);
89 -componentMap.set('TransferModal', TransferModal);  
90 -componentMap.set('TransferTableModal', TransferTableModal);  
91 -componentMap.set('ObjectModelValidateForm', ObjectModelValidateForm);  
92 86
93 export function add(compName: ComponentType, component: Component) { 87 export function add(compName: ComponentType, component: Component) {
94 componentMap.set(compName, component); 88 componentMap.set(compName, component);
@@ -150,7 +150,7 @@ @@ -150,7 +150,7 @@
150 150
151 const getIsFixed = computed(() => { 151 const getIsFixed = computed(() => {
152 /* eslint-disable-next-line */ 152 /* eslint-disable-next-line */
153 - mixSideHasChildren.value = unref(childrenMenus).length > 0;interfaceDisplay 153 + mixSideHasChildren.value = unref(childrenMenus).length > 0;
154 const isFixed = unref(getMixSideFixed) && unref(mixSideHasChildren); 154 const isFixed = unref(getMixSideFixed) && unref(mixSideHasChildren);
155 if (isFixed) { 155 if (isFixed) {
156 /* eslint-disable-next-line */ 156 /* eslint-disable-next-line */
@@ -120,7 +120,7 @@ export class VAxios { @@ -120,7 +120,7 @@ export class VAxios {
120 if (userStore && userStore.jwtToken) { 120 if (userStore && userStore.jwtToken) {
121 try { 121 try {
122 const res = jwt_decode(userStore.jwtToken) as JwtModel; 122 const res = jwt_decode(userStore.jwtToken) as JwtModel;
123 - const currentTime = new Date().getTime() / 1000; 123 + const currentTime = (new Date().getTime() + (config.timeout || 0)) / 1000;
124 if (currentTime >= res.exp && this.isNeedTokenURL(config.url)) { 124 if (currentTime >= res.exp && this.isNeedTokenURL(config.url)) {
125 await this.refreshTokenBeforeReq(userStore.doRefresh); 125 await this.refreshTokenBeforeReq(userStore.doRefresh);
126 } 126 }
@@ -182,7 +182,7 @@ @@ -182,7 +182,7 @@
182 </div> 182 </div>
183 </template> 183 </template>
184 <script lang="ts"> 184 <script lang="ts">
185 - import { defineComponent, reactive, unref, nextTick, h, onUnmounted, ref } from 'vue'; 185 + import { defineComponent, reactive, unref, h, onMounted } from 'vue';
186 import { 186 import {
187 DeviceModel, 187 DeviceModel,
188 DeviceRecord, 188 DeviceRecord,
@@ -216,7 +216,7 @@ @@ -216,7 +216,7 @@
216 import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; 216 import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
217 import { QuestionCircleOutlined } from '@ant-design/icons-vue'; 217 import { QuestionCircleOutlined } from '@ant-design/icons-vue';
218 import { Authority } from '/@/components/Authority'; 218 import { Authority } from '/@/components/Authority';
219 - import { useRouter } from 'vue-router'; 219 + import { useRoute, useRouter } from 'vue-router';
220 import { useBatchOperation } from '/@/utils/useBatchOperation'; 220 import { useBatchOperation } from '/@/utils/useBatchOperation';
221 221
222 export default defineComponent({ 222 export default defineComponent({
@@ -243,7 +243,7 @@ @@ -243,7 +243,7 @@
243 const { createMessage } = useMessage(); 243 const { createMessage } = useMessage();
244 const go = useGo(); 244 const go = useGo();
245 const ROUTER = useRouter(); 245 const ROUTER = useRouter();
246 - const immediateStatus = ref(false); 246 + const ROUTE = useRoute();
247 const searchInfo = reactive<Recordable>({}); 247 const searchInfo = reactive<Recordable>({});
248 const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); 248 const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo);
249 const [registerModal, { openModal }] = useModal(); 249 const [registerModal, { openModal }] = useModal();
@@ -259,9 +259,7 @@ @@ -259,9 +259,7 @@
259 reload, 259 reload,
260 setLoading, 260 setLoading,
261 setSelectedRowKeys, 261 setSelectedRowKeys,
262 - setTableData,  
263 getForm, 262 getForm,
264 - setPagination,  
265 getSelectRowKeys, 263 getSelectRowKeys,
266 getSelectRows, 264 getSelectRows,
267 getRowSelection, 265 getRowSelection,
@@ -269,17 +267,13 @@ @@ -269,17 +267,13 @@
269 ] = useTable({ 267 ] = useTable({
270 title: '设备列表', 268 title: '设备列表',
271 api: devicePage, 269 api: devicePage,
272 - immediate: immediateStatus.value,  
273 columns, 270 columns,
274 beforeFetch: (params) => { 271 beforeFetch: (params) => {
275 const { deviceProfileId } = params; 272 const { deviceProfileId } = params;
276 const obj = { 273 const obj = {
277 ...params, 274 ...params,
278 ...{ 275 ...{
279 - deviceProfileIds:  
280 - deviceProfileId === undefined || deviceProfileId === null || deviceProfileId == ''  
281 - ? null  
282 - : [deviceProfileId], 276 + deviceProfileIds: deviceProfileId ? [deviceProfileId] : null,
283 }, 277 },
284 }; 278 };
285 delete obj.deviceProfileId; 279 delete obj.deviceProfileId;
@@ -313,54 +307,6 @@ @@ -313,54 +307,6 @@
313 307
314 const { isExistOption } = useBatchOperation(getRowSelection, setSelectedRowKeys); 308 const { isExistOption } = useBatchOperation(getRowSelection, setSelectedRowKeys);
315 309
316 - function getParams(keyword) {  
317 - const reg = new RegExp('(^|&)' + keyword + '=([^&]*)(&|$)', 'i');  
318 - const r = window.location.search.substr(1).match(reg);  
319 - if (r != null) return unescape(r[2]);  
320 - return null; //注意此处参数是中文,解码使用的方法是unescape ,那么在传值的时候如果是中文,需要使用escape('曲浩')方法来编码。  
321 - }  
322 -  
323 - const count = ref(0);  
324 - const onCloseVal = ref(0);  
325 - const deviceProfileId = ref('');  
326 - count.value = Number(getParams('count'));  
327 - deviceProfileId.value = getParams('deviceProfileId') || '';  
328 - const setRowClassName = async () => {  
329 - if (deviceProfileId.value !== undefined) {  
330 - const { items, total } = await devicePage({  
331 - page: 1,  
332 - pageSize: count.value === 0 ? 10 : count.value,  
333 - deviceProfileIds:  
334 - deviceProfileId.value === undefined ||  
335 - deviceProfileId.value === null ||  
336 - deviceProfileId.value == ''  
337 - ? null  
338 - : [deviceProfileId.value],  
339 - });  
340 - setPagination({ total });  
341 - nextTick(() => {  
342 - setTableData(items);  
343 - const { setFieldsValue, resetFields } = getForm();  
344 - setFieldsValue({  
345 - deviceProfileId: deviceProfileId.value || null,  
346 - });  
347 - if (onCloseVal.value == 1) {  
348 - resetFields();  
349 - }  
350 - });  
351 - } else {  
352 - setTimeout(() => {  
353 - reload();  
354 - }, 80);  
355 - }  
356 - };  
357 - setRowClassName();  
358 - onUnmounted(() => {  
359 - deviceProfileId.value = '';  
360 - count.value = 10;  
361 - onCloseVal.value = 1;  
362 - });  
363 -  
364 const userInfo: any = getAuthCache(USER_INFO_KEY); 310 const userInfo: any = getAuthCache(USER_INFO_KEY);
365 const role: string = userInfo.roles[0]; 311 const role: string = userInfo.roles[0];
366 312
@@ -494,6 +440,11 @@ @@ -494,6 +440,11 @@
494 reload(); 440 reload();
495 }; 441 };
496 442
  443 + onMounted(() => {
  444 + const queryParams = ROUTE.query as Record<'deviceProfileId', undefined | string>;
  445 + const { setFieldsValue } = getForm();
  446 + setFieldsValue({ deviceProfileId: queryParams.deviceProfileId });
  447 + });
497 return { 448 return {
498 registerTable, 449 registerTable,
499 handleCreate, 450 handleCreate,
@@ -50,6 +50,12 @@ @@ -50,6 +50,12 @@
50 import { postAddConvertApi } from '/@/api/datamanager/dataManagerApi'; 50 import { postAddConvertApi } from '/@/api/datamanager/dataManagerApi';
51 import { useMessage } from '/@/hooks/web/useMessage'; 51 import { useMessage } from '/@/hooks/web/useMessage';
52 import { Button } from '/@/components/Button'; 52 import { Button } from '/@/components/Button';
  53 + import { add } from '/@/components/Form/src/componentMap';
  54 + import TransferModal from '/@/components/Form/src/components/TransferModal.vue';
  55 + import TransferTableModal from '/@/components/Form/src/components/TransferTableModal.vue';
  56 +
  57 + add('TransferModal', TransferModal);
  58 + add('TransferTableModal', TransferTableModal);
53 59
54 export default defineComponent({ 60 export default defineComponent({
55 name: 'ConfigDrawer', 61 name: 'ConfigDrawer',
@@ -127,6 +127,10 @@ @@ -127,6 +127,10 @@
127 import Action from './cpns/Action.vue'; 127 import Action from './cpns/Action.vue';
128 import { findOperation } from './config/formatData'; 128 import { findOperation } from './config/formatData';
129 import { formatToDateTime } from '/@/utils/dateUtil'; 129 import { formatToDateTime } from '/@/utils/dateUtil';
  130 + import ObjectModelValidateForm from '/@/components/Form/src/externalCompns/components/ObjectModelValidateForm/ObjectModelValidateForm.vue';
  131 + import { add } from '/@/components/Form/src/componentMap';
  132 +
  133 + add('ObjectModelValidateForm', ObjectModelValidateForm);
130 134
131 const emit = defineEmits(['register', 'success']); 135 const emit = defineEmits(['register', 'success']);
132 const provideOrgid = ref(''); 136 const provideOrgid = ref('');
@@ -2,6 +2,13 @@ import type { FormSchema } from '/@/components/Form/index'; @@ -2,6 +2,13 @@ import type { FormSchema } from '/@/components/Form/index';
2 import { getAreaList } from '/@/api/oem/index'; 2 import { getAreaList } from '/@/api/oem/index';
3 import { emailRule, phoneRule } from '/@/utils/rules'; 3 import { emailRule, phoneRule } from '/@/utils/rules';
4 4
  5 +export enum Level {
  6 + PROVINCE = 'PROVINCE',
  7 + CITY = 'CITY',
  8 + COUNTY = 'COUNTY',
  9 + TOWN = 'TOWN',
  10 +}
  11 +
5 export const schemas: FormSchema[] = [ 12 export const schemas: FormSchema[] = [
6 { 13 {
7 field: 'name', 14 field: 'name',
@@ -201,150 +208,104 @@ export const provSchemas: FormSchema[] = [ @@ -201,150 +208,104 @@ export const provSchemas: FormSchema[] = [
201 colProps: { 208 colProps: {
202 span: 6, 209 span: 6,
203 }, 210 },
204 - componentProps({ formModel, formActionType }) {  
205 - const { updateSchema } = formActionType; 211 + componentProps({ formActionType }) {
  212 + const { setFieldsValue } = formActionType;
206 return { 213 return {
207 api: getAreaList, 214 api: getAreaList,
208 labelField: 'name', 215 labelField: 'name',
209 valueField: 'code', 216 valueField: 'code',
210 placeholder: '省份', 217 placeholder: '省份',
211 - params: { parentId: 1 },  
212 - async onChange(value) {  
213 - if (value === undefined) {  
214 - formModel.nameCity = undefined; // reset city value  
215 - formModel.nameCoun = undefined;  
216 - formModel.nameTown = undefined;  
217 - updateSchema([  
218 - {  
219 - field: 'nameCity',  
220 - componentProps: {  
221 - options: [],  
222 - placeholder: '城市',  
223 - },  
224 - },  
225 - {  
226 - field: 'nameCoun',  
227 - componentProps: {  
228 - options: [],  
229 - placeholder: '区/县',  
230 - },  
231 - },  
232 - {  
233 - field: 'nameTown',  
234 - componentProps: {  
235 - options: [],  
236 - placeholder: '城镇/街道',  
237 - },  
238 - },  
239 - ]);  
240 - } else {  
241 - const nameCity = await getAreaList({ parentId: value });  
242 - nameCity.forEach((item) => {  
243 - item.label = item.name;  
244 - item.value = item.code;  
245 - });  
246 - formModel.nameCity = undefined; // reset city value  
247 - formModel.nameCoun = undefined;  
248 - formModel.nameTown = undefined;  
249 - updateSchema({  
250 - field: 'nameCity',  
251 - componentProps: {  
252 - options: nameCity,  
253 - placeholder: '城市',  
254 - async onChange(value) {  
255 - if (value === undefined) {  
256 - formModel.nameCoun = undefined; // reset city value  
257 - formModel.nameTown = undefined;  
258 - updateSchema([  
259 - {  
260 - field: 'nameCoun',  
261 - componentProps: {  
262 - options: [],  
263 - },  
264 - },  
265 - {  
266 - field: 'nameTown',  
267 - componentProps: {  
268 - options: [],  
269 - },  
270 - },  
271 - ]);  
272 - } else {  
273 - // 获取区数据  
274 - const nameCoun = await getAreaList({ parentId: value });  
275 - nameCoun.forEach((item) => {  
276 - item.label = item.name;  
277 - item.value = item.code;  
278 - });  
279 - updateSchema({  
280 - field: 'nameCoun',  
281 - componentProps: {  
282 - // 请选择区  
283 - options: nameCoun,  
284 - async onChange(value) {  
285 - if (value === undefined) {  
286 - formModel.nameTown = undefined;  
287 - updateSchema({  
288 - field: 'nameTown',  
289 - componentProps: {  
290 - placeholder: '城镇/街道',  
291 - options: [],  
292 - },  
293 - });  
294 - } else {  
295 - const nameTown = await getAreaList({ parentId: value });  
296 - nameTown.forEach((item) => {  
297 - item.label = item.name;  
298 - item.value = item.code;  
299 - });  
300 - updateSchema({  
301 - field: 'nameTown',  
302 - componentProps: {  
303 - placeholder: '城镇/街道',  
304 - options: nameTown,  
305 - },  
306 - });  
307 - }  
308 - },  
309 - },  
310 - });  
311 - }  
312 - },  
313 - },  
314 - });  
315 - } 218 + params: { parentId: 1, level: Level.PROVINCE },
  219 + onChange: () => {
  220 + setFieldsValue({ nameCity: null, nameCoun: null, nameTown: null });
316 }, 221 },
317 }; 222 };
318 }, 223 },
319 }, 224 },
320 { 225 {
321 field: 'nameCity', 226 field: 'nameCity',
322 - component: 'Select', 227 + component: 'ApiSelect',
323 label: '', 228 label: '',
324 colProps: { 229 colProps: {
325 span: 6, 230 span: 6,
326 }, 231 },
  232 + componentProps: ({ formActionType, formModel }) => {
  233 + const nameProv = Reflect.get(formModel, 'nameProv');
  234 + const { setFieldsValue } = formActionType;
  235 + return {
  236 + api: async (params: Recordable) => {
  237 + try {
  238 + if (!nameProv) return;
  239 + const result = await getAreaList(params);
  240 + return result;
  241 + } catch (error) {
  242 + return [];
  243 + }
  244 + },
  245 + labelField: 'name',
  246 + valueField: 'code',
  247 + placeholder: '城市',
  248 + params: { parentId: nameProv, level: Level.CITY },
  249 + onChange: () => {
  250 + setFieldsValue({ nameCoun: null, nameTown: null });
  251 + },
  252 + };
  253 + },
327 }, 254 },
328 { 255 {
329 field: 'nameCoun', 256 field: 'nameCoun',
330 - component: 'Select', 257 + component: 'ApiSelect',
331 label: '', 258 label: '',
332 colProps: { 259 colProps: {
333 span: 6, 260 span: 6,
334 }, 261 },
335 - componentProps: {  
336 - placeholder: '区/县', 262 + componentProps: ({ formActionType, formModel }) => {
  263 + const nameCity = Reflect.get(formModel, 'nameCity');
  264 + const { setFieldsValue } = formActionType;
  265 + return {
  266 + api: async (params: Recordable) => {
  267 + try {
  268 + if (!nameCity) return;
  269 + const result = await getAreaList(params);
  270 + return result;
  271 + } catch (error) {
  272 + return [];
  273 + }
  274 + },
  275 + labelField: 'name',
  276 + valueField: 'code',
  277 + placeholder: '区/县',
  278 + params: { parentId: nameCity, level: Level.COUNTY },
  279 + onChange: () => {
  280 + setFieldsValue({ nameTown: null });
  281 + },
  282 + };
337 }, 283 },
338 }, 284 },
339 { 285 {
340 field: 'nameTown', 286 field: 'nameTown',
341 - component: 'Select', 287 + component: 'ApiSelect',
342 label: '', 288 label: '',
343 colProps: { 289 colProps: {
344 span: 6, 290 span: 6,
345 }, 291 },
346 - componentProps: {  
347 - placeholder: '城镇/街道', 292 + componentProps: ({ formModel }) => {
  293 + const nameCoun = Reflect.get(formModel, 'nameCoun');
  294 + return {
  295 + api: async (params: Recordable) => {
  296 + try {
  297 + if (!nameCoun) return;
  298 + const result = await getAreaList(params);
  299 + return result;
  300 + } catch (error) {
  301 + return [];
  302 + }
  303 + },
  304 + labelField: 'name',
  305 + valueField: 'code',
  306 + placeholder: '城镇/街道',
  307 + params: { parentId: nameCoun, level: Level.TOWN },
  308 + };
348 }, 309 },
349 }, 310 },
350 ]; 311 ];
@@ -66,6 +66,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { @@ -66,6 +66,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
66 build: { 66 build: {
67 target: 'es2015', 67 target: 'es2015',
68 outDir: OUTPUT_DIR, 68 outDir: OUTPUT_DIR,
  69 + // minify: 'terser', // The minify mode is set to use terser to remove console
69 terserOptions: { 70 terserOptions: {
70 compress: { 71 compress: {
71 keep_infinity: true, 72 keep_infinity: true,