Commit e57839398e415c9b445d13de6d187d842e3a1346

Authored by xp.Huang
2 parents e307339e 382ad6f3

Merge branch 'f-dev' into 'main'

fix:修改teambition上的问题

See merge request huang/yun-teng-iot-front!233
1 node_modules 1 node_modules
  2 +.history
2 .DS_Store 3 .DS_Store
3 dist 4 dist
4 .npmrc 5 .npmrc
@@ -17,7 +17,7 @@ enum ScreenManagerApi { @@ -17,7 +17,7 @@ enum ScreenManagerApi {
17 SCREEN_UPDATE_URL = '/sceneLinkage/update', 17 SCREEN_UPDATE_URL = '/sceneLinkage/update',
18 SCREEN_ORGANIZATION_URL = '/organization/me/list', 18 SCREEN_ORGANIZATION_URL = '/organization/me/list',
19 SCREEN_CHANGE_STATUS = '/convert/update/scene', 19 SCREEN_CHANGE_STATUS = '/convert/update/scene',
20 - SCREEN_GET_BY_DEPTID = '/sceneLinkage/device', 20 + SCREEN_GET_BY_DEPTID = '/sceneLinkage/device/',
21 GET_ATTRBUTELIST = '/device/keys', 21 GET_ATTRBUTELIST = '/device/keys',
22 ALARM_PROFILE = '/alarm/profile/', 22 ALARM_PROFILE = '/alarm/profile/',
23 MASTER_GET_DEVICE = '/device/list/master', 23 MASTER_GET_DEVICE = '/device/list/master',
1 import { FormSchema } from '/@/components/Table'; 1 import { FormSchema } from '/@/components/Table';
2 -import { phoneRule, emailRule } from '/@/utils/rules'; 2 +import { phoneRule, emailRule, chineseAndEnlishRule } from '/@/utils/rules';
3 3
4 export const formSchema: FormSchema[] = [ 4 export const formSchema: FormSchema[] = [
5 { 5 {
@@ -12,6 +12,7 @@ export const formSchema: FormSchema[] = [ @@ -12,6 +12,7 @@ export const formSchema: FormSchema[] = [
12 maxLength: 10, 12 maxLength: 10,
13 placeholder: '请输入用户昵称', 13 placeholder: '请输入用户昵称',
14 }, 14 },
  15 + rules: chineseAndEnlishRule,
15 }, 16 },
16 { 17 {
17 field: 'phoneNumber', 18 field: 'phoneNumber',
@@ -20,6 +20,23 @@ export const numberRule: Rule[] = [ @@ -20,6 +20,23 @@ export const numberRule: Rule[] = [
20 ]; 20 ];
21 export const phoneRegexp = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; 21 export const phoneRegexp = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
22 22
  23 +//中英文正则
  24 +export const chineseAndEnlishRule: Rule[] = [
  25 + {
  26 + required: true,
  27 + validator: (_, value: string) => {
  28 + const reg = /^[a-zA-Z\u4e00-\u9fa5]+$/;
  29 + if (value === '') {
  30 + return Promise.reject('请输入');
  31 + } else if (!reg.test(value)) {
  32 + return Promise.reject('格式不正确');
  33 + }
  34 + return Promise.resolve();
  35 + },
  36 + validateTrigger: 'blur',
  37 + },
  38 +];
  39 +
23 // 手机号验证 40 // 手机号验证
24 export const phoneRule: Rule[] = [ 41 export const phoneRule: Rule[] = [
25 { 42 {
@@ -41,7 +58,7 @@ export const phoneRule: Rule[] = [ @@ -41,7 +58,7 @@ export const phoneRule: Rule[] = [
41 export const emailRule: Rule[] = [ 58 export const emailRule: Rule[] = [
42 { 59 {
43 validator: (_, value: string) => { 60 validator: (_, value: string) => {
44 - const reg = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/; 61 + const reg = /^[a-zA-Z0-9]+([-_.][A-Za-zd]+)*@([a-zA-Z0-9]+[-.])+[A-Za-zd]{2,5}$/;
45 if (!value) { 62 if (!value) {
46 return Promise.resolve(); 63 return Promise.resolve();
47 } else if (!reg.test(value)) { 64 } else if (!reg.test(value)) {
@@ -165,6 +165,7 @@ @@ -165,6 +165,7 @@
165 if (record.status === 1) { 165 if (record.status === 1) {
166 return { disabled: true }; 166 return { disabled: true };
167 } else { 167 } else {
  168 + singleStopDeleteStatus.value = false;
168 return { disabled: false }; 169 return { disabled: false };
169 } 170 }
170 }; 171 };
@@ -96,7 +96,7 @@ @@ -96,7 +96,7 @@
96 import { useMessage } from '/@/hooks/web/useMessage'; 96 import { useMessage } from '/@/hooks/web/useMessage';
97 import { 97 import {
98 screenLinkPageAddApi, 98 screenLinkPageAddApi,
99 - // screenLinkPageByDeptIdGetDevice, 99 + screenLinkPageByDeptIdGetDevice,
100 getOrganizationAlarmConfig, 100 getOrganizationAlarmConfig,
101 byOganizationIdGetMasterDevice, 101 byOganizationIdGetMasterDevice,
102 getAttribute, 102 getAttribute,
@@ -125,6 +125,7 @@ @@ -125,6 +125,7 @@
125 let getConditionFormValue = ref([]); 125 let getConditionFormValue = ref([]);
126 let getActionFormValue = ref([]); 126 let getActionFormValue = ref([]);
127 const editEntryIdData = ref([]); 127 const editEntryIdData = ref([]);
  128 + const editEntryIdExcludeDoActionData = ref([]);
128 let editAttrIdData = []; 129 let editAttrIdData = [];
129 const editAlarmConfigData = ref([]); 130 const editAlarmConfigData = ref([]);
130 const isUpdate = ref(false); 131 const isUpdate = ref(false);
@@ -160,6 +161,7 @@ @@ -160,6 +161,7 @@
160 provideOrgid.value = organizationId; 161 provideOrgid.value = organizationId;
161 // 获取当前组织下的设备列表 162 // 获取当前组织下的设备列表
162 const options = await byOganizationIdGetMasterDevice(organizationId); 163 const options = await byOganizationIdGetMasterDevice(organizationId);
  164 + const optionsExcludeDoAction = await screenLinkPageByDeptIdGetDevice({ organizationId });
163 // 获取当前组织下的告警配置 165 // 获取当前组织下的告警配置
164 const alarmConfig = await getOrganizationAlarmConfig({ organizationId }); 166 const alarmConfig = await getOrganizationAlarmConfig({ organizationId });
165 // 获取当前组织下的属性列表 167 // 获取当前组织下的属性列表
@@ -179,6 +181,12 @@ @@ -179,6 +181,12 @@
179 label: item.name, 181 label: item.name,
180 }; 182 };
181 }); 183 });
  184 + editEntryIdExcludeDoActionData.value = optionsExcludeDoAction.items.map((item) => {
  185 + return {
  186 + value: item.tbDeviceId,
  187 + label: item.name,
  188 + };
  189 + });
182 editAlarmConfigData.value = alarmConfig.map((item) => { 190 editAlarmConfigData.value = alarmConfig.map((item) => {
183 return { 191 return {
184 value: item.id, 192 value: item.id,
@@ -189,8 +197,8 @@ @@ -189,8 +197,8 @@
189 //回显属性列表 197 //回显属性列表
190 editAttrIdData = attrList; 198 editAttrIdData = attrList;
191 nextTick(() => { 199 nextTick(() => {
192 - setEditFields(skipUnwrap.triggerItemRefs, editEntryIdData);  
193 - setEditFields(skipUnwrap.conditionItemRefs, editEntryIdData); 200 + setEditFields(skipUnwrap.triggerItemRefs, editEntryIdExcludeDoActionData);
  201 + setEditFields(skipUnwrap.conditionItemRefs, editEntryIdExcludeDoActionData);
194 setEditFields(skipUnwrap.actionItemRefs, editEntryIdData); 202 setEditFields(skipUnwrap.actionItemRefs, editEntryIdData);
195 setEditAlarmConfig(skipUnwrap.actionItemRefs, editAlarmConfigData); 203 setEditAlarmConfig(skipUnwrap.actionItemRefs, editAlarmConfigData);
196 setEditAttr(skipUnwrap.triggerItemRefs, editAttrIdData); 204 setEditAttr(skipUnwrap.triggerItemRefs, editAttrIdData);
@@ -482,7 +490,11 @@ @@ -482,7 +490,11 @@
482 // 设置设备的options 490 // 设置设备的options
483 const setEditFields = (linkAge, deviceList) => { 491 const setEditFields = (linkAge, deviceList) => {
484 unref(linkAge).map((item) => { 492 unref(linkAge).map((item) => {
485 - item.updateFieldDeviceId(deviceList); 493 + if (item.isTriggerAndConditionFlag == 'isTriggerAndConditionFlag') {
  494 + item.updateExcludeActionFieldDeviceId(deviceList);
  495 + } else {
  496 + item.updateFieldDeviceId(deviceList);
  497 + }
486 }); 498 });
487 }; 499 };
488 // 设置告警配置options 500 // 设置告警配置options
@@ -502,10 +514,16 @@ @@ -502,10 +514,16 @@
502 const deviceList = ref([]); 514 const deviceList = ref([]);
503 const alarmConfigList = ref([]); 515 const alarmConfigList = ref([]);
504 let watchAttrList = []; 516 let watchAttrList = [];
  517 + const deviceExcludeDoAction = ref([]);
505 watch(organizationId, async (newValue: string) => { 518 watch(organizationId, async (newValue: string) => {
506 if (!newValue) return; 519 if (!newValue) return;
507 provideOrgid.value = newValue; 520 provideOrgid.value = newValue;
508 const items = await byOganizationIdGetMasterDevice(newValue); 521 const items = await byOganizationIdGetMasterDevice(newValue);
  522 + const itemExcludeDoAction = await screenLinkPageByDeptIdGetDevice({ organizationId: newValue });
  523 + deviceExcludeDoAction.value = itemExcludeDoAction.items.map((item) => ({
  524 + label: item.name,
  525 + value: item.tbDeviceId,
  526 + }));
509 deviceList.value = items.map((item) => ({ label: item.name, value: item.id })); 527 deviceList.value = items.map((item) => ({ label: item.name, value: item.id }));
510 watchAttrList = await getAttribute(newValue, null); 528 watchAttrList = await getAttribute(newValue, null);
511 setFields(skipUnwrap.triggerItemRefs, true); 529 setFields(skipUnwrap.triggerItemRefs, true);
@@ -520,7 +538,12 @@ @@ -520,7 +538,12 @@
520 function setFields(linkAge, isOrganizationChange = false) { 538 function setFields(linkAge, isOrganizationChange = false) {
521 unref(linkAge).map((item) => { 539 unref(linkAge).map((item) => {
522 isOrganizationChange && item.resetFieldsValueFunc(); 540 isOrganizationChange && item.resetFieldsValueFunc();
523 - item.updateFieldDeviceId(deviceList); 541 + console.log(item);
  542 + if (item.isTriggerAndConditionFlag == 'isTriggerAndConditionFlag') {
  543 + item.updateExcludeActionFieldDeviceId(deviceExcludeDoAction);
  544 + } else {
  545 + item.updateFieldDeviceId(deviceList);
  546 + }
524 // item.updateFieldAttr(watchAttrList); 547 // item.updateFieldAttr(watchAttrList);
525 }); 548 });
526 } 549 }
@@ -98,7 +98,7 @@ @@ -98,7 +98,7 @@
98 ); 98 );
99 return { ...getFieldsValue(), predicate, schedule: alarmScheduleRef.value.scheduleData }; 99 return { ...getFieldsValue(), predicate, schedule: alarmScheduleRef.value.scheduleData };
100 }; 100 };
101 - const updateFieldDeviceId = (deviceList: any[]) => { 101 + const updateExcludeActionFieldDeviceId = (deviceList: any[]) => {
102 updateSchema({ 102 updateSchema({
103 field: 'entityId', 103 field: 'entityId',
104 componentProps: { 104 componentProps: {
@@ -195,9 +195,11 @@ @@ -195,9 +195,11 @@
195 currentIndex.value = index; 195 currentIndex.value = index;
196 }; 196 };
197 const scheduleData = ref(null); 197 const scheduleData = ref(null);
  198 + const isTriggerAndConditionFlag = 'isTriggerAndConditionFlag';
198 defineExpose({ 199 defineExpose({
  200 + isTriggerAndConditionFlag,
199 getFieldsValueFunc, 201 getFieldsValueFunc,
200 - updateFieldDeviceId, 202 + updateExcludeActionFieldDeviceId,
201 updateFieldAttr, 203 updateFieldAttr,
202 resetFieldsValueFunc, 204 resetFieldsValueFunc,
203 setFieldsFormValueFun, 205 setFieldsFormValueFun,
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 formConfig: { 45 formConfig: {
46 labelWidth: 120, 46 labelWidth: 120,
47 schemas: searchFormSchema, 47 schemas: searchFormSchema,
48 - fieldMapToTime: [['queryTime', ['startTime', 'endTime'], 'YYYY-MM-DD HH:mm:ss']], 48 + fieldMapToTime: [['queryTime', ['startTime', 'endTime'], 'x']],
49 }, 49 },
50 useSearchForm: true, 50 useSearchForm: true,
51 showTableSetting: true, 51 showTableSetting: true,
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 formConfig: { 45 formConfig: {
46 labelWidth: 120, 46 labelWidth: 120,
47 schemas: searchFormSchema, 47 schemas: searchFormSchema,
48 - fieldMapToTime: [['queryTime', ['startTime', 'endTime'], 'YYYY-MM-DD HH:mm:ss']], 48 + fieldMapToTime: [['queryTime', ['startTime', 'endTime'], 'x']],
49 }, 49 },
50 useSearchForm: true, 50 useSearchForm: true,
51 showTableSetting: true, 51 showTableSetting: true,
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 formConfig: { 45 formConfig: {
46 labelWidth: 120, 46 labelWidth: 120,
47 schemas: searchFormSchema, 47 schemas: searchFormSchema,
48 - fieldMapToTime: [['queryTime', ['startTime', 'endTime'], 'YYYY-MM-DD HH:mm:ss']], 48 + fieldMapToTime: [['queryTime', ['startTime', 'endTime'], 'x']],
49 }, 49 },
50 useSearchForm: true, 50 useSearchForm: true,
51 showTableSetting: true, 51 showTableSetting: true,
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 v-if="treeData.length" 13 v-if="treeData.length"
14 checkable 14 checkable
15 toolbar 15 toolbar
16 - autoExpandParent 16 + :expandedKeys="treeExpandData"
17 ref="treeRef" 17 ref="treeRef"
18 :treeData="treeData" 18 :treeData="treeData"
19 :replaceFields="{ title: 'menuName' }" 19 :replaceFields="{ title: 'menuName' }"
@@ -43,6 +43,7 @@ @@ -43,6 +43,7 @@
43 components: { BasicDrawer, BasicForm, BasicTree }, 43 components: { BasicDrawer, BasicForm, BasicTree },
44 emits: ['success', 'register'], 44 emits: ['success', 'register'],
45 setup(_, { emit }) { 45 setup(_, { emit }) {
  46 + const treeExpandData = ref([]);
46 const isUpdate = ref<boolean>(true); 47 const isUpdate = ref<boolean>(true);
47 const treeData = ref<TreeItem[]>([]); 48 const treeData = ref<TreeItem[]>([]);
48 const roleMenus = ref<string[]>([]); 49 const roleMenus = ref<string[]>([]);
@@ -69,13 +70,12 @@ @@ -69,13 +70,12 @@
69 } 70 }
70 }); 71 });
71 } 72 }
72 - // function lookForAllId(data = [], arr = []) {  
73 - // for (const item of data) {  
74 - // arr.push(item.parentId);  
75 - // if (item.children && item.children.length > 0) lookForAllId(item.children, arr);  
76 - // }  
77 - // return arr;  
78 - // } 73 + function lookForAllId(data = [], arr = []) {
  74 + for (const item of data) {
  75 + arr.push(item.id);
  76 + }
  77 + return arr;
  78 + }
79 const originMenus = ref(); 79 const originMenus = ref();
80 const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { 80 const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
81 allCheckedKeys.value = []; 81 allCheckedKeys.value = [];
@@ -98,6 +98,9 @@ @@ -98,6 +98,9 @@
98 //通过角色id去获取角色对应的菜单的ids 98 //通过角色id去获取角色对应的菜单的ids
99 roleMenus.value = await getMenusIdsByRoleId(data.record.id); 99 roleMenus.value = await getMenusIdsByRoleId(data.record.id);
100 originMenus.value = [...roleMenus.value]; 100 originMenus.value = [...roleMenus.value];
  101 +
  102 + const getAllIds = lookForAllId(treeData.value, []);
  103 + treeExpandData.value = getAllIds;
101 for (let item of treeData.value) { 104 for (let item of treeData.value) {
102 if (item?.children != 0) { 105 if (item?.children != 0) {
103 pidArr.value.push(item.key); 106 pidArr.value.push(item.key);
@@ -138,7 +141,6 @@ @@ -138,7 +141,6 @@
138 status: values.status, 141 status: values.status,
139 menu: allCheckedKeys.value.length ? allCheckedKeys.value : originMenus.value, 142 menu: allCheckedKeys.value.length ? allCheckedKeys.value : originMenus.value,
140 }; 143 };
141 - console.log(allCheckedKeys.value);  
142 if (allCheckedKeys.value.length == 0) return createMessage.error('请勾选权限菜单'); 144 if (allCheckedKeys.value.length == 0) return createMessage.error('请勾选权限菜单');
143 if (req.menu == undefined) return createMessage.error('请勾选权限菜单'); 145 if (req.menu == undefined) return createMessage.error('请勾选权限菜单');
144 saveOrUpdateRoleInfoWithMenu(req).then(() => { 146 saveOrUpdateRoleInfoWithMenu(req).then(() => {
@@ -165,6 +167,7 @@ @@ -165,6 +167,7 @@
165 treeRef, 167 treeRef,
166 handleCheckClick, 168 handleCheckClick,
167 allCheckedKeys, 169 allCheckedKeys,
  170 + treeExpandData,
168 }; 171 };
169 }, 172 },
170 }); 173 });
@@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
18 import { UserDTO } from '/@/api/tenant/tenantInfo'; 18 import { UserDTO } from '/@/api/tenant/tenantInfo';
19 import { ChineseRegexp, EmailRegexp, emailRule, phoneRule } from '/@/utils/rules'; 19 import { ChineseRegexp, EmailRegexp, emailRule, phoneRule } from '/@/utils/rules';
20 // import { isAccountExist } from '/@/api/system/system'; 20 // import { isAccountExist } from '/@/api/system/system';
  21 + import { chineseAndEnlishRule } from '/@/utils/rules';
21 22
22 export default defineComponent({ 23 export default defineComponent({
23 name: 'TenantAdminFormDrawer', 24 name: 'TenantAdminFormDrawer',
@@ -88,6 +89,7 @@ @@ -88,6 +89,7 @@
88 componentProps: { 89 componentProps: {
89 maxLength: 255, 90 maxLength: 255,
90 }, 91 },
  92 + rules: chineseAndEnlishRule,
91 }, 93 },
92 { 94 {
93 field: 'phoneNumber', 95 field: 'phoneNumber',
@@ -12,6 +12,7 @@ @@ -12,6 +12,7 @@
12 <BasicTree 12 <BasicTree
13 v-if="treeData.length > 0" 13 v-if="treeData.length > 0"
14 :treeData="treeData" 14 :treeData="treeData"
  15 + :expandedKeys="treeExpandData"
15 autoExpandParent 16 autoExpandParent
16 :replaceFields="{ title: 'menuName' }" 17 :replaceFields="{ title: 'menuName' }"
17 :checkedKeys="roleMenus" 18 :checkedKeys="roleMenus"
@@ -46,6 +47,8 @@ @@ -46,6 +47,8 @@
46 components: { BasicDrawer, BasicForm, BasicTree }, 47 components: { BasicDrawer, BasicForm, BasicTree },
47 emits: ['success', 'register'], 48 emits: ['success', 'register'],
48 setup(_, { emit }) { 49 setup(_, { emit }) {
  50 + const treeExpandData = ref([]);
  51 +
49 const isUpdate = ref(true); 52 const isUpdate = ref(true);
50 const treeData = ref<TreeItem[]>([]); 53 const treeData = ref<TreeItem[]>([]);
51 const roleMenus = ref<string[]>([]); 54 const roleMenus = ref<string[]>([]);
@@ -71,6 +74,12 @@ @@ -71,6 +74,12 @@
71 } 74 }
72 }); 75 });
73 } 76 }
  77 + function lookForAllId(data = [], arr = []) {
  78 + for (const item of data) {
  79 + arr.push(item.id);
  80 + }
  81 + return arr;
  82 + }
74 83
75 const originMenus = ref(); 84 const originMenus = ref();
76 const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { 85 const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
@@ -95,6 +104,8 @@ @@ -95,6 +104,8 @@
95 //通过角色id去获取角色对应的菜单的ids 104 //通过角色id去获取角色对应的菜单的ids
96 roleMenus.value = await getMenusIdsByRoleId(data.record.id); 105 roleMenus.value = await getMenusIdsByRoleId(data.record.id);
97 originMenus.value = [...roleMenus.value]; 106 originMenus.value = [...roleMenus.value];
  107 + const getAllIds = lookForAllId(treeData.value, []);
  108 + treeExpandData.value = getAllIds;
98 for (let item of treeData.value) { 109 for (let item of treeData.value) {
99 if (item?.children != 0) { 110 if (item?.children != 0) {
100 pidArr.value.push(item.key); 111 pidArr.value.push(item.key);
@@ -160,6 +171,7 @@ @@ -160,6 +171,7 @@
160 roleMenus, 171 roleMenus,
161 treeRef, 172 treeRef,
162 handleCheckClick, 173 handleCheckClick,
  174 + treeExpandData,
163 }; 175 };
164 }, 176 },
165 }); 177 });