Commit 19046b444874fde7d997d6235fbffc6f598eb2a7
Merge remote-tracking branch 'origin/ft-dev'
# Conflicts: # .env.development
Showing
23 changed files
with
343 additions
and
295 deletions
... | ... | @@ -6,7 +6,7 @@ VITE_PUBLIC_PATH = / |
6 | 6 | |
7 | 7 | # Cross-domain proxy, you can configure multiple |
8 | 8 | # Please note that no line breaks |
9 | -VITE_PROXY = [["/api","http://192.168.10.123:8082/api"],["/upload","http://192.168.10.116:3300/upload"]] | |
9 | +VITE_PROXY = [["/api","http://192.168.10.117:8082/api"],["/upload","http://192.168.10.116:3300/upload"]] | |
10 | 10 | # VITE_PROXY=[["/api","https://vvbin.cn/test"]] |
11 | 11 | |
12 | 12 | # Delete console | ... | ... |
1 | 1 | import { defHttp } from '/@/utils/http/axios'; |
2 | 2 | import { |
3 | - NoticeByIdParams, | |
4 | 3 | NoticeQueryParam, |
5 | 4 | NotifyAddDraftModel, |
6 | 5 | NotifyAddreLeaseModel, |
... | ... | @@ -69,7 +68,7 @@ export const notifyAddLeaseApi = (params: NotifyAddreLeaseModel) => { |
69 | 68 | * 批量删除 |
70 | 69 | * @param params pageSize page name |
71 | 70 | */ |
72 | -export const notifyDeleteApi = (ids: string) => { | |
71 | +export const notifyDeleteApi = (ids: string[]) => { | |
73 | 72 | return defHttp.delete({ |
74 | 73 | url: `${NotifyManagerApi.NOTICE_DELETE_URL}?ids=${ids}`, |
75 | 74 | }); | ... | ... |
... | ... | @@ -9,6 +9,12 @@ import { |
9 | 9 | tenantProfileDTO, |
10 | 10 | } from './tenantInfo'; |
11 | 11 | import { defHttp } from '/@/utils/http/axios'; |
12 | +import { BasicPageParams } from '/@/api/model/baseModel'; | |
13 | +export type QueryTenantProfilesParam = BasicPageParams & OtherParams; | |
14 | +export type OtherParams = { | |
15 | + sortProperty?: string; | |
16 | + sortOrder?: string; | |
17 | +}; | |
12 | 18 | |
13 | 19 | enum Api { |
14 | 20 | userPage = '/user/page', |
... | ... | @@ -21,8 +27,16 @@ enum Api { |
21 | 27 | deleteTenantAdmin = '/admin/user/deleteTenantAdmin', |
22 | 28 | getTenantRoles = '/admin/tenant/roles/', |
23 | 29 | postAddTenantProfile = '/tenantProfile', |
30 | + getTenantProfile = '/tenantProfiles', | |
24 | 31 | } |
25 | 32 | |
33 | +export const getTableTenantProfileApi = (params?: QueryTenantProfilesParam) => { | |
34 | + return defHttp.get({ | |
35 | + params: params, | |
36 | + url: Api.getTenantProfile, | |
37 | + }); | |
38 | +}; | |
39 | + | |
26 | 40 | export async function saveTenantProfileApi(params: tenantProfileDTO) { |
27 | 41 | await defHttp.post({ |
28 | 42 | params: params, | ... | ... |
src/hooks/web/useCurrentInstance.ts
0 → 100644
1 | +import { ComponentInternalInstance, getCurrentInstance } from 'vue'; | |
2 | + | |
3 | +//在ts中使用会报错:报错:...类型“ComponentInternalInstance | null” | |
4 | +// 我们在项目中一般会用到很多getCurrentInstance()方法,直接封装一下 | |
5 | +export default function useCurrentInstance() { | |
6 | + const { appContext } = getCurrentInstance() as ComponentInternalInstance; | |
7 | + const proxy = appContext.config.globalProperties; | |
8 | + return { | |
9 | + proxy, | |
10 | + }; | |
11 | +} | ... | ... |
1 | 1 | <template> |
2 | - <BasicModal v-bind="$attrs" width="55rem" @register="register" :title="getTitle"> | |
2 | + <BasicModal | |
3 | + v-bind="$attrs" | |
4 | + width="55rem" | |
5 | + @register="register" | |
6 | + :title="getTitle" | |
7 | + @ok="handleSubmit" | |
8 | + @cancel="handleCancel" | |
9 | + > | |
3 | 10 | <div class="step-form-form"> |
4 | 11 | <a-steps :current="current"> |
5 | 12 | <a-step title="设备配置" /> |
... | ... | @@ -8,9 +15,9 @@ |
8 | 15 | </a-steps> |
9 | 16 | </div> |
10 | 17 | <div class="mt-5"> |
11 | - <DeviceProfileStep1 @next="handleStep1Next" v-show="current === 0" /> | |
12 | - <DeviceProfileStep2 @prev="handleStepPrev" @next="handleStep2Next" v-show="current === 1" /> | |
13 | - <DeviceProfileStep3 @prev="handleStepPrev" @redo="handleRedo" v-show="current === 2" /> | |
18 | + <DeviceProfileStep1 @next="handleStep1Next" v-if="current === 0" /> | |
19 | + <DeviceProfileStep2 @prev="handleStepPrev" @next="handleStep2Next" v-if="current === 1" /> | |
20 | + <DeviceProfileStep3 @prev="handleStepPrev" @redo="handleRedo" v-if="current === 2" /> | |
14 | 21 | </div> |
15 | 22 | </BasicModal> |
16 | 23 | </template> |
... | ... | @@ -35,14 +42,12 @@ |
35 | 42 | userData: { type: Object }, |
36 | 43 | }, |
37 | 44 | setup(_) { |
38 | - const current = ref(2); | |
45 | + const current = ref(0); | |
39 | 46 | const isUpdate = ref(true); |
40 | 47 | const getTitle = computed(() => (!unref(isUpdate) ? '新增设备配置' : '编辑设备配置')); |
41 | - | |
42 | 48 | const [register] = useModalInner((data) => { |
43 | 49 | isUpdate.value = !!data?.isUpdate; |
44 | 50 | }); |
45 | - | |
46 | 51 | function handleStepPrev() { |
47 | 52 | current.value--; |
48 | 53 | } |
... | ... | @@ -57,8 +62,15 @@ |
57 | 62 | function handleRedo() { |
58 | 63 | current.value = 0; |
59 | 64 | } |
60 | - | |
65 | + const handleSubmit = () => { | |
66 | + console.log(1); | |
67 | + }; | |
68 | + const handleCancel = () => { | |
69 | + console.log(1); | |
70 | + }; | |
61 | 71 | return { |
72 | + handleSubmit, | |
73 | + handleCancel, | |
62 | 74 | register, |
63 | 75 | getTitle, |
64 | 76 | current, | ... | ... |
1 | 1 | <template> |
2 | - <CollapseContainer title="执行条件1" style="background-color: #eeeeee"> | |
2 | + <CollapseContainer title="执行条件" style="background-color: #eeeeee"> | |
3 | 3 | <div style="position: relative"> |
4 | 4 | <BasicForm |
5 | 5 | :labelWidth="100" |
... | ... | @@ -16,13 +16,13 @@ |
16 | 16 | type="primary" |
17 | 17 | >+新增执行条件</Button |
18 | 18 | > |
19 | - <Button | |
19 | + <!-- <Button | |
20 | 20 | @click="del(field)" |
21 | 21 | style="margin-left: 10px" |
22 | 22 | v-if="Number(field) === 0" |
23 | 23 | type="primary" |
24 | 24 | >删除</Button |
25 | - > | |
25 | + > --> | |
26 | 26 | <Button |
27 | 27 | style="margin-left: -95px; margin-top: 20px" |
28 | 28 | v-if="field > 0" |
... | ... | @@ -39,7 +39,7 @@ |
39 | 39 | </CollapseContainer> |
40 | 40 | </template> |
41 | 41 | <script lang="ts"> |
42 | - import { defineComponent, ref, reactive, watch } from 'vue'; | |
42 | + import { defineComponent, ref, watch } from 'vue'; | |
43 | 43 | import { CollapseContainer } from '/@/components/Container/index'; |
44 | 44 | import { BasicForm, useForm } from '/@/components/Form/index'; |
45 | 45 | import { Input } from 'ant-design-vue'; |
... | ... | @@ -50,8 +50,8 @@ |
50 | 50 | export default defineComponent({ |
51 | 51 | components: { CollapseContainer, BasicForm, [Input.name]: Input, Button }, |
52 | 52 | props: ['deviceInfo1'], |
53 | - setup(props, { emit }) { | |
54 | - let formData = reactive({}); | |
53 | + setup(props) { | |
54 | + const getValueData: any = ref({}); | |
55 | 55 | const [ |
56 | 56 | registerCondition, |
57 | 57 | { resetFields, updateSchema, appendSchemaByField, removeSchemaByFiled, getFieldsValue }, |
... | ... | @@ -79,26 +79,19 @@ |
79 | 79 | }); |
80 | 80 | } |
81 | 81 | ); |
82 | - // async function handleSubmit() { | |
83 | - // try { | |
84 | - // let data = getFieldsValue(); | |
85 | - // formData = data; | |
86 | - // emit('get-conditiondata', formData); | |
87 | - // isJudge.value++; | |
88 | - // } catch (e) { | |
89 | - // console.log(e); | |
90 | - // } | |
91 | - // } | |
82 | + | |
83 | + function getAllFields(getV) { | |
84 | + const values = getFieldsValue(); | |
85 | + getValueData.value = values; | |
86 | + getV = getValueData.value; | |
87 | + return getV; | |
88 | + } | |
89 | + function funcResetFields() { | |
90 | + resetFields(); | |
91 | + } | |
92 | + | |
92 | 93 | const n = ref(1); |
93 | 94 | function add() { |
94 | - try { | |
95 | - let data = getFieldsValue(); | |
96 | - formData = data; | |
97 | - emit('get-conditiondata', formData); | |
98 | - isJudge.value++; | |
99 | - } catch (e) { | |
100 | - console.log(e); | |
101 | - } | |
102 | 95 | appendSchemaByField( |
103 | 96 | { |
104 | 97 | field: `kong${n.value}`, |
... | ... | @@ -308,7 +301,7 @@ |
308 | 301 | ]); |
309 | 302 | n.value--; |
310 | 303 | } |
311 | - return { registerCondition, add, del }; | |
304 | + return { registerCondition, add, del, getAllFields, funcResetFields }; | |
312 | 305 | }, |
313 | 306 | }); |
314 | 307 | </script> | ... | ... |
1 | 1 | <template> |
2 | - <CollapseContainer title="执行动作1" style="background-color: #eeeeee"> | |
2 | + <CollapseContainer class="prefixRedDot" title="执行动作" style="background-color: #eeeeee"> | |
3 | 3 | <div style="position: relative"> |
4 | 4 | <BasicForm |
5 | 5 | :labelWidth="100" |
... | ... | @@ -10,30 +10,20 @@ |
10 | 10 | > |
11 | 11 | <template #add="{ field }"> |
12 | 12 | <Button |
13 | - style="margin-left: -99px; margin-top: 30px; display: inline-block" | |
13 | + style="margin-left: -99px; margin-top: 5px; display: inline-block" | |
14 | 14 | v-if="Number(field) === 0" |
15 | 15 | @click="add" |
16 | 16 | type="primary" |
17 | 17 | >+新增执行动作</Button |
18 | 18 | > |
19 | - <Button | |
20 | - style="margin-left: 10px" | |
21 | - v-if="Number(field) === 0" | |
22 | - @click="handleSubmit" | |
23 | - type="primary" | |
24 | - >保存</Button | |
25 | - > | |
26 | 19 | <br /> |
27 | 20 | <Button |
28 | - style="margin-left: -98px; margin-top: -15px" | |
21 | + style="margin-left: -98px; margin-top: -5px" | |
29 | 22 | v-if="field > 0" |
30 | 23 | @click="add" |
31 | 24 | type="primary" |
32 | 25 | >+新增执行动作</Button |
33 | 26 | > |
34 | - <Button style="margin-left: 10px" v-if="field > 0" @click="handleSubmit" type="primary" | |
35 | - >保存</Button | |
36 | - > | |
37 | 27 | <Button style="margin-left: 10px" v-if="field > 0" @click="del(field)" type="primary" |
38 | 28 | >删除</Button |
39 | 29 | > |
... | ... | @@ -43,7 +33,7 @@ |
43 | 33 | </CollapseContainer> |
44 | 34 | </template> |
45 | 35 | <script lang="ts"> |
46 | - import { defineComponent, ref, reactive, watch } from 'vue'; | |
36 | + import { defineComponent, ref, watch } from 'vue'; | |
47 | 37 | import { CollapseContainer } from '/@/components/Container/index'; |
48 | 38 | import { BasicForm, useForm } from '/@/components/Form/index'; |
49 | 39 | import { Input } from 'ant-design-vue'; |
... | ... | @@ -54,8 +44,8 @@ |
54 | 44 | export default defineComponent({ |
55 | 45 | components: { CollapseContainer, BasicForm, [Input.name]: Input, Button }, |
56 | 46 | props: ['deviceInfo2'], |
57 | - setup(props, { emit }) { | |
58 | - let formData = reactive({}); | |
47 | + setup(props) { | |
48 | + const getValueData: any = ref({}); | |
59 | 49 | const [ |
60 | 50 | registerAction, |
61 | 51 | { resetFields, updateSchema, appendSchemaByField, getFieldsValue, removeSchemaByFiled }, |
... | ... | @@ -83,15 +73,14 @@ |
83 | 73 | }); |
84 | 74 | } |
85 | 75 | ); |
86 | - async function handleSubmit() { | |
87 | - try { | |
88 | - let data = getFieldsValue(); | |
89 | - formData = data; | |
90 | - emit('get-actiondata', formData); | |
91 | - isJudge.value++; | |
92 | - } catch (e) { | |
93 | - console.log(e); | |
94 | - } | |
76 | + function getAllFields(getV) { | |
77 | + const values = getFieldsValue(); | |
78 | + getValueData.value = values; | |
79 | + getV = getValueData.value; | |
80 | + return getV; | |
81 | + } | |
82 | + function funcResetFields() { | |
83 | + resetFields(); | |
95 | 84 | } |
96 | 85 | const n = ref(1); |
97 | 86 | function add() { |
... | ... | @@ -236,7 +225,18 @@ |
236 | 225 | n.value--; |
237 | 226 | } |
238 | 227 | |
239 | - return { registerAction, handleSubmit, add, del }; | |
228 | + return { registerAction, add, del, getAllFields, funcResetFields }; | |
240 | 229 | }, |
241 | 230 | }); |
242 | 231 | </script> |
232 | + | |
233 | +<style lang="less"> | |
234 | + .prefixRedDot:before { | |
235 | + content: '* '; | |
236 | + color: red; | |
237 | + vertical-align: middle; | |
238 | + display: inline-block; | |
239 | + position: relative; | |
240 | + top: 33px; | |
241 | + } | |
242 | +</style> | ... | ... |
1 | 1 | <template> |
2 | 2 | <div> |
3 | - <CollapseContainer title="触发器1" style="background-color: #eeeeee"> | |
3 | + <CollapseContainer title="触发器" style="background-color: #eeeeee"> | |
4 | 4 | <div style="position: relative"> |
5 | 5 | <BasicForm |
6 | 6 | :labelWidth="100" |
... | ... | @@ -17,13 +17,13 @@ |
17 | 17 | type="primary" |
18 | 18 | >+新增触发器</Button |
19 | 19 | > |
20 | - <Button | |
20 | + <!-- <Button | |
21 | 21 | style="margin-left: 20px; margin-top: -60px" |
22 | 22 | v-if="Number(field) === 0" |
23 | 23 | type="primary" |
24 | 24 | @click="del(field)" |
25 | 25 | >删除</Button |
26 | - > | |
26 | + > --> | |
27 | 27 | <Button |
28 | 28 | style="margin-left: 5px; margin-top: 35px" |
29 | 29 | v-if="field > 0" |
... | ... | @@ -41,7 +41,7 @@ |
41 | 41 | </div> |
42 | 42 | </template> |
43 | 43 | <script lang="ts"> |
44 | - import { defineComponent, reactive, ref, watch } from 'vue'; | |
44 | + import { defineComponent, ref, watch } from 'vue'; | |
45 | 45 | import { CollapseContainer } from '/@/components/Container/index'; |
46 | 46 | import { BasicForm, useForm } from '/@/components/Form/index'; |
47 | 47 | import { Input } from 'ant-design-vue'; |
... | ... | @@ -59,7 +59,8 @@ |
59 | 59 | export default defineComponent({ |
60 | 60 | components: { CollapseContainer, BasicForm, [Input.name]: Input, Button }, |
61 | 61 | props: ['deviceInfo'], |
62 | - setup(props, { emit }) { | |
62 | + setup(props) { | |
63 | + const getValueData: any = ref({}); | |
63 | 64 | const [ |
64 | 65 | registerTrigger, |
65 | 66 | { resetFields, appendSchemaByField, removeSchemaByFiled, getFieldsValue, updateSchema }, |
... | ... | @@ -68,7 +69,6 @@ |
68 | 69 | schemas: useTriggerDrawerSchema, |
69 | 70 | actionColOptions: { span: 24 }, |
70 | 71 | }); |
71 | - let formData = reactive({}); | |
72 | 72 | let isJudge = ref(1); |
73 | 73 | if (isJudge.value == 1) { |
74 | 74 | resetFields(); |
... | ... | @@ -88,28 +88,18 @@ |
88 | 88 | }); |
89 | 89 | } |
90 | 90 | ); |
91 | + function getAllFields(getV) { | |
92 | + const values = getFieldsValue(); | |
93 | + getValueData.value = values; | |
94 | + getV = getValueData.value; | |
95 | + return getV; | |
96 | + } | |
97 | + function funcResetFields() { | |
98 | + resetFields(); | |
99 | + } | |
91 | 100 | |
92 | - // async function handleSubmit() { | |
93 | - // try { | |
94 | - // formData = getFieldsValue(); | |
95 | - // console.log(formData); | |
96 | - // emit('get-triggerdata', formData); | |
97 | - // isJudge.value++; | |
98 | - // } catch (e) { | |
99 | - // console.log(e); | |
100 | - // } | |
101 | - // } | |
102 | 101 | const n = ref(1); |
103 | 102 | function add() { |
104 | - try { | |
105 | - formData = getFieldsValue(); | |
106 | - console.log(formData); | |
107 | - emit('get-triggerdata', formData); | |
108 | - isJudge.value++; | |
109 | - } catch (e) { | |
110 | - console.log(e); | |
111 | - } | |
112 | - | |
113 | 103 | appendSchemaByField( |
114 | 104 | { |
115 | 105 | field: `kong${n.value}`, |
... | ... | @@ -345,7 +335,7 @@ |
345 | 335 | ]); |
346 | 336 | n.value--; |
347 | 337 | } |
348 | - return { registerTrigger, add, del }; | |
338 | + return { registerTrigger, add, del, getAllFields, funcResetFields }; | |
349 | 339 | }, |
350 | 340 | }); |
351 | 341 | </script> | ... | ... |
... | ... | @@ -143,7 +143,7 @@ export const formSchema: FormSchema[] = [ |
143 | 143 | { |
144 | 144 | field: 'name', |
145 | 145 | label: '场景联动名称', |
146 | - colProps: { span: 12 }, | |
146 | + colProps: { span: 24 }, | |
147 | 147 | required: true, |
148 | 148 | component: 'Input', |
149 | 149 | componentProps: { |
... | ... | @@ -154,7 +154,7 @@ export const formSchema: FormSchema[] = [ |
154 | 154 | required: true, |
155 | 155 | field: 'organizationId', |
156 | 156 | label: '所属组织', |
157 | - colProps: { span: 12 }, | |
157 | + colProps: { span: 24 }, | |
158 | 158 | component: 'ApiTreeSelect', |
159 | 159 | componentProps: ({ formModel, formActionType }) => { |
160 | 160 | return { |
... | ... | @@ -164,7 +164,6 @@ export const formSchema: FormSchema[] = [ |
164 | 164 | return data; |
165 | 165 | }, |
166 | 166 | onChange: async (v) => { |
167 | - console.log(v); | |
168 | 167 | if (v == undefined) { |
169 | 168 | formModel.deviceId = undefined; |
170 | 169 | const { updateSchema } = formActionType; |
... | ... | @@ -184,7 +183,7 @@ export const formSchema: FormSchema[] = [ |
184 | 183 | { |
185 | 184 | field: 'description', |
186 | 185 | label: '描述', |
187 | - colProps: { span: 12 }, | |
186 | + colProps: { span: 24 }, | |
188 | 187 | component: 'InputTextArea', |
189 | 188 | componentProps: { |
190 | 189 | placeholder: '请输入描述', | ... | ... |
... | ... | @@ -8,13 +8,13 @@ |
8 | 8 | @ok="handleSubmit" |
9 | 9 | > |
10 | 10 | <BasicForm @register="registerForm" /> |
11 | - <AddTriggerForm :deviceInfo="getDeviceInfo" @get-triggerdata="getTriggerData" /> | |
12 | - <AddConditiForm :deviceInfo1="getDeviceInfo1" @get-conditiondata="getFormConditiData" /> | |
13 | - <AddActionForm :deviceInfo2="getDeviceInfo2" @get-actiondata="getFormActionData" /> | |
11 | + <AddTriggerForm ref="getTriggerChildData" :deviceInfo="getDeviceInfo" /> | |
12 | + <AddConditiForm ref="getConditionChildData" :deviceInfo1="getDeviceInfo1" /> | |
13 | + <AddActionForm ref="getChildData" :deviceInfo2="getDeviceInfo2" /> | |
14 | 14 | </BasicDrawer> |
15 | 15 | </template> |
16 | 16 | <script lang="ts"> |
17 | - import { defineComponent, ref, computed, unref, reactive, watch } from 'vue'; | |
17 | + import { defineComponent, ref, computed, unref, reactive, watch, getCurrentInstance } from 'vue'; | |
18 | 18 | import { BasicForm, useForm } from '/@/components/Form'; |
19 | 19 | import { formSchema, getData } from './config.d'; |
20 | 20 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
... | ... | @@ -29,17 +29,18 @@ |
29 | 29 | components: { BasicDrawer, BasicForm, AddTriggerForm, AddActionForm, AddConditiForm }, |
30 | 30 | emits: ['success', 'register'], |
31 | 31 | setup(_, { emit }) { |
32 | + const { proxy } = getCurrentInstance(); | |
33 | + const getChildData = ref(null); | |
34 | + const getTriggerChildData = ref(null); | |
35 | + const getConditionChildData = ref(null); | |
32 | 36 | const { createMessage } = useMessage(); |
33 | 37 | const isUpdate = ref(true); |
34 | - let triggersArray: any[] = reactive([]); | |
35 | 38 | let doConditionsArray: any[] = reactive([]); |
36 | 39 | let doActionsArray: any[] = reactive([]); |
40 | + let triggersArray: any[] = reactive([]); | |
37 | 41 | let getAllFormData: any = reactive({}); |
38 | 42 | let getValuesFormData: any = reactive({}); |
39 | 43 | let getId = ref(''); |
40 | - let getTriggerFormData: any = reactive({}); | |
41 | - let getConditionFormData: any = reactive({}); | |
42 | - let getActionFormData: any = reactive({}); | |
43 | 44 | let getDeviceInfo = ref(null); |
44 | 45 | let getDeviceInfo1 = ref(null); |
45 | 46 | let getDeviceInfo2 = ref(null); |
... | ... | @@ -58,6 +59,9 @@ |
58 | 59 | }); |
59 | 60 | |
60 | 61 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
62 | + proxy.$refs.getChildData.funcResetFields(); | |
63 | + proxy.$refs.getTriggerChildData.funcResetFields(); | |
64 | + proxy.$refs.getConditionChildData.funcResetFields(); | |
61 | 65 | await resetFields(); |
62 | 66 | setDrawerProps({ confirmLoading: false }); |
63 | 67 | isUpdate.value = !!data?.isUpdate; |
... | ... | @@ -71,36 +75,18 @@ |
71 | 75 | await resetFields(); |
72 | 76 | } |
73 | 77 | }); |
74 | - // function trimNumber(str) { | |
75 | - // return str.replace(/\d+/g, ''); | |
76 | - // } | |
77 | - | |
78 | 78 | const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动')); |
79 | - let getTriggerData = (v) => { | |
80 | - getTriggerFormData = v; | |
81 | - triggersArray.push(getTriggerFormData); | |
82 | - // let retuArray = triggersArray.map((m) => { | |
83 | - // let getArrayKeys = Object.keys(m); | |
84 | - // let getArrayKeysReturn = null; | |
85 | - // getArrayKeys.forEach((f) => { | |
86 | - // getArrayKeysReturn = trimNumber(f); | |
87 | - // }); | |
88 | - // return getArrayKeysReturn; | |
89 | - // }); | |
90 | - // console.log(retuArray); | |
91 | - }; | |
92 | - let getFormConditiData = (v) => { | |
93 | - getConditionFormData = v; | |
94 | - doConditionsArray.push(getConditionFormData); | |
95 | - }; | |
96 | - let getFormActionData = (v) => { | |
97 | - getActionFormData = v; | |
98 | - doActionsArray.push(getActionFormData); | |
99 | - }; | |
79 | + | |
100 | 80 | async function handleSubmit() { |
101 | 81 | if (!unref(isUpdate)) { |
102 | 82 | let res = validateFields(); |
103 | 83 | if (!res) return; |
84 | + let getChildValues = proxy.$refs.getChildData.getAllFields(); | |
85 | + let getTriggerChildValues = proxy.$refs.getTriggerChildData.getAllFields(); | |
86 | + let getconditionChildValues = proxy.$refs.getConditionChildData.getAllFields(); | |
87 | + doActionsArray.push(getChildValues); | |
88 | + triggersArray.push(getTriggerChildValues); | |
89 | + doConditionsArray.push(getconditionChildValues); | |
104 | 90 | getValuesFormData = getFieldsValue(); |
105 | 91 | Object.assign(getAllFormData, getValuesFormData); |
106 | 92 | getAllFormData.triggers = triggersArray; |
... | ... | @@ -115,6 +101,12 @@ |
115 | 101 | } |
116 | 102 | if (unref(isUpdate)) { |
117 | 103 | getValuesFormData = getFieldsValue(); |
104 | + let getChildValues = proxy.$refs.getChildData.getAllFields(); | |
105 | + let getTriggerChildValues = proxy.$refs.getTriggerChildData.getAllFields(); | |
106 | + let getconditionChildValues = proxy.$refs.getConditionChildData.getAllFields(); | |
107 | + doActionsArray.push(getChildValues); | |
108 | + triggersArray.push(getTriggerChildValues); | |
109 | + doConditionsArray.push(getconditionChildValues); | |
118 | 110 | getValuesFormData.id = getId.value; |
119 | 111 | Object.assign(getAllFormData, getValuesFormData); |
120 | 112 | getAllFormData.triggers = triggersArray; |
... | ... | @@ -128,13 +120,13 @@ |
128 | 120 | } |
129 | 121 | } |
130 | 122 | return { |
123 | + getConditionChildData, | |
124 | + getTriggerChildData, | |
125 | + getChildData, | |
131 | 126 | getDeviceInfo, |
132 | 127 | getDeviceInfo1, |
133 | 128 | getDeviceInfo2, |
134 | 129 | getAllFormData, |
135 | - getTriggerData, | |
136 | - getFormConditiData, | |
137 | - getFormActionData, | |
138 | 130 | registerDrawer, |
139 | 131 | registerForm, |
140 | 132 | getTitle, | ... | ... |
... | ... | @@ -14,6 +14,10 @@ |
14 | 14 | label: '创建者', |
15 | 15 | }, |
16 | 16 | { |
17 | + field: 'createTime', | |
18 | + label: '创建时间', | |
19 | + }, | |
20 | + { | |
17 | 21 | field: 'title', |
18 | 22 | label: '标题', |
19 | 23 | }, |
... | ... | @@ -70,7 +74,7 @@ |
70 | 74 | } |
71 | 75 | ); |
72 | 76 | const [register1] = useDescription({ |
73 | - title: '详情', | |
77 | + title: '通知详情', | |
74 | 78 | bordered: false, |
75 | 79 | data: useDescriptionData, |
76 | 80 | schema: schema, | ... | ... |
... | ... | @@ -16,13 +16,13 @@ export const columns: BasicColumn[] = [ |
16 | 16 | dataIndex: 'type', |
17 | 17 | width: 200, |
18 | 18 | format: (text: string, record: Recordable) => { |
19 | - return record.type === 'MEETING' | |
19 | + return record.type === 'NOTICE' | |
20 | 20 | ? '公告' |
21 | - : record.type === 'MEETING1' | |
21 | + : record.type === 'MEETING' | |
22 | 22 | ? '会议' |
23 | - : record.type === 'MEETING2' | |
23 | + : record.type === 'OTHER' | |
24 | 24 | ? '其他' |
25 | - : ''; | |
25 | + : '无'; | |
26 | 26 | }, |
27 | 27 | }, |
28 | 28 | { |
... | ... | @@ -44,20 +44,11 @@ export const columns: BasicColumn[] = [ |
44 | 44 | width: 200, |
45 | 45 | customRender: ({ record }) => { |
46 | 46 | const status = record.readStatus; |
47 | - const enable = status == 0 ? '未读' : ~~status == 1 ? '已读' : '其他'; | |
47 | + const enable = status == 0 ? '未读' : status == 1 ? '已读' : '其他'; | |
48 | 48 | const color = enable == '未读' ? 'green' : enable == '已读' ? 'yellow' : 'red'; |
49 | 49 | const text = enable == '未读' ? '未读' : enable == '已读' ? '已读' : '其他'; |
50 | 50 | return h(Tag, { color: color }, () => text); |
51 | 51 | }, |
52 | - // format: (text: string, record: Recordable) => { | |
53 | - // return record.readStatus == 0 | |
54 | - // ? '未读' | |
55 | - // : record.type == 1 | |
56 | - // ? '已读' | |
57 | - // : record.type == 2 | |
58 | - // ? '其他' | |
59 | - // : '其他'; | |
60 | - // }, | |
61 | 52 | }, |
62 | 53 | ]; |
63 | 54 | ... | ... |
... | ... | @@ -21,6 +21,7 @@ |
21 | 21 | notifyMyGetDetailApi, |
22 | 22 | } from '/@/api/stationnotification/stationnotifyApi'; |
23 | 23 | import { BasicTable } from '/@/components/Table'; |
24 | + import { BasicColumn } from '/@/components/Table/src/types/table'; | |
24 | 25 | |
25 | 26 | export default defineComponent({ |
26 | 27 | name: 'ConfigDrawer', |
... | ... | @@ -39,7 +40,7 @@ |
39 | 40 | title: '阅读状态', |
40 | 41 | dataIndex: 'readStatus', |
41 | 42 | format: (_text: string, record: Recordable) => { |
42 | - return record.readStatus === 0 ? '草稿' : record.readStatus === 1 ? '已读' : '其他'; | |
43 | + return record.readStatus === '0' ? '草稿' : record.readStatus === '1' ? '已读' : '其他'; | |
43 | 44 | }, |
44 | 45 | }, |
45 | 46 | { |
... | ... | @@ -49,22 +50,31 @@ |
49 | 50 | { |
50 | 51 | title: '发送者', |
51 | 52 | dataIndex: 'senderName', |
53 | + format: (_text: string, record: Recordable) => { | |
54 | + return record.sysNoticeDTO.senderName; | |
55 | + }, | |
56 | + }, | |
57 | + { | |
58 | + title: '发送时间', | |
59 | + dataIndex: 'senderDate', | |
60 | + format: (_text: string, record: Recordable) => { | |
61 | + return record.sysNoticeDTO.senderDate; | |
62 | + }, | |
52 | 63 | }, |
53 | 64 | { |
54 | 65 | title: '类型', |
55 | 66 | dataIndex: 'type', |
56 | - render: (_, data) => { | |
57 | - return data.type === 'NOTICE' | |
67 | + format: (_text: string, record: Recordable) => { | |
68 | + return record.sysNoticeDTO.type === 'NOTICE' | |
58 | 69 | ? '公告' |
59 | - : data.type === 'MEETING' | |
70 | + : record.sysNoticeDTO.type === 'MEETING' | |
60 | 71 | ? '会议' |
61 | - : data.type === 'OTHER' | |
72 | + : record.sysNoticeDTO.type === 'OTHER' | |
62 | 73 | ? '其他' |
63 | - : ''; | |
74 | + : '无'; | |
64 | 75 | }, |
65 | 76 | }, |
66 | 77 | ]; |
67 | - // const { createMessage } = useMessage(); | |
68 | 78 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
69 | 79 | setDrawerProps({ confirmLoading: false }); |
70 | 80 | isUpdate.value = !!data?.isUpdate; | ... | ... |
... | ... | @@ -6,12 +6,8 @@ import { getOrganizationList } from '/@/api/system/system'; |
6 | 6 | import { copyTransFun } from '/@/utils/fnUtils'; |
7 | 7 | import { Tag } from 'ant-design-vue'; |
8 | 8 | |
9 | -export const selectAll = ref(null); | |
10 | -export const selectOrg = ref(null); | |
11 | -export const selectDep = ref(null); | |
12 | -export const selectPer = ref(null); | |
9 | +export const selectWhere = ref(null); | |
13 | 10 | export const isDeptId = ref(null); |
14 | - | |
15 | 11 | export const columns: BasicColumn[] = [ |
16 | 12 | { |
17 | 13 | title: '类型', |
... | ... | @@ -54,14 +50,11 @@ export const columns: BasicColumn[] = [ |
54 | 50 | width: 200, |
55 | 51 | customRender: ({ record }) => { |
56 | 52 | const status = record.status; |
57 | - const enable = status === '已发布' ? '已发布' : ~~status === '草稿' ? '草稿' : '其他'; | |
53 | + const enable = status === '已发布' ? '已发布' : status === '草稿' ? '草稿' : '其他'; | |
58 | 54 | const color = enable === '已发布' ? 'green' : enable === '草稿' ? 'yellow' : 'red'; |
59 | 55 | const text = enable === '已发布' ? '已发布' : enable === '草稿' ? '草稿' : '其他'; |
60 | 56 | return h(Tag, { color: color }, () => text); |
61 | 57 | }, |
62 | - // format: (_text: string, record: Recordable) => { | |
63 | - // return record.status; | |
64 | - // }, | |
65 | 58 | }, |
66 | 59 | ]; |
67 | 60 | |
... | ... | @@ -128,7 +121,6 @@ export const formSchema: FormSchema[] = [ |
128 | 121 | }, |
129 | 122 | onChange: (v) => { |
130 | 123 | isDeptId.value = v; |
131 | - console.log(isDeptId.value); | |
132 | 124 | }, |
133 | 125 | }, |
134 | 126 | }, |
... | ... | @@ -146,14 +138,21 @@ export const formSchema: FormSchema[] = [ |
146 | 138 | labelField: 'itemText', |
147 | 139 | valueField: 'itemValue', |
148 | 140 | onChange: (v) => { |
149 | - if (v == 0) { | |
150 | - selectAll.value = 0; | |
151 | - } else if (v == 1) { | |
152 | - selectOrg.value = 1; | |
153 | - } else if (v == 2) { | |
154 | - selectDep.value = 2; | |
155 | - } else if (v == 3) { | |
156 | - selectPer.value = 3; | |
141 | + switch (v) { | |
142 | + case '0': | |
143 | + selectWhere.value = v; | |
144 | + break; | |
145 | + case '1': | |
146 | + selectWhere.value = v; | |
147 | + break; | |
148 | + case '2': | |
149 | + selectWhere.value = v; | |
150 | + break; | |
151 | + case '3': | |
152 | + selectWhere.value = v; | |
153 | + break; | |
154 | + default: | |
155 | + selectWhere.value = v; | |
157 | 156 | } |
158 | 157 | }, |
159 | 158 | }, | ... | ... |
... | ... | @@ -65,7 +65,7 @@ |
65 | 65 | components: { BasicTable, NotifyManagerDrawer, TableAction, tableViewChild }, |
66 | 66 | setup() { |
67 | 67 | let isJudgeStatus = ref(true); |
68 | - let selectedRowKeys: Array<string> = []; | |
68 | + let selectedRowKeys: string[] = reactive([]); | |
69 | 69 | let echoEditData = reactive({}); |
70 | 70 | const [registerDrawer, { openDrawer }] = useDrawer(); |
71 | 71 | const { createMessage } = useMessage(); | ... | ... |
... | ... | @@ -11,24 +11,24 @@ |
11 | 11 | <Button style="margin-left: 30px; margin-top: 80px" type="primary" @click="handleCancel" |
12 | 12 | >取消</Button |
13 | 13 | > |
14 | - <Button style="margin-left: 30px" type="primary" @click="handleSubmit">保存草稿</Button> | |
14 | + <Button style="margin-left: 30px" type="primary" @click="handleSaveDraft">保存草稿</Button> | |
15 | 15 | <Button style="margin-left: 30px" type="primary" @click="handleSend">发布通知</Button> |
16 | 16 | </template> |
17 | 17 | </BasicForm> |
18 | 18 | </BasicDrawer> |
19 | 19 | </template> |
20 | 20 | <script lang="ts"> |
21 | - import { defineComponent, ref, computed, unref, reactive, watch, onMounted } from 'vue'; | |
21 | + import { defineComponent, ref, computed, unref, reactive, watch } from 'vue'; | |
22 | 22 | import { Button } from '/@/components/Button'; |
23 | 23 | import { BasicForm, useForm } from '/@/components/Form'; |
24 | - import { formSchema, selectAll, selectOrg, selectDep, selectPer, isDeptId } from './config.d'; | |
24 | + import { formSchema, selectWhere, isDeptId } from './config.d'; | |
25 | 25 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
26 | 26 | import { |
27 | 27 | notifyAddDraftApi, |
28 | 28 | notifyAddLeaseApi, |
29 | 29 | } from '/@/api/stationnotification/stationnotifyApi'; |
30 | 30 | import { useMessage } from '/@/hooks/web/useMessage'; |
31 | - import { getOrganizationList } from '/@/api/system/system'; | |
31 | + // import { getOrganizationList } from '/@/api/system/system'; | |
32 | 32 | |
33 | 33 | export default defineComponent({ |
34 | 34 | name: 'ConfigDrawer', |
... | ... | @@ -37,11 +37,15 @@ |
37 | 37 | setup(_, { emit }) { |
38 | 38 | const { createMessage } = useMessage(); |
39 | 39 | const isUpdate = ref(true); |
40 | - const pointArray = ref([]); | |
41 | - const isJudgeWherePoint = ref([]); | |
42 | - const newArray = ref([]); | |
40 | + const pointArray = ref([] as any); | |
41 | + const isJudgeWherePoint = ref([] as any); | |
42 | + // const newArray = ref([]); | |
43 | + let getId = ref(''); | |
44 | + let getOranAndDeptId = ref(null); | |
43 | 45 | let getAllData: any = reactive({}); |
44 | - const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | |
46 | + let getAllEditData: any = reactive({}); | |
47 | + let postAllEditData: any = reactive({}); | |
48 | + const [registerForm, { setFieldsValue, resetFields, validate, getFieldsValue }] = useForm({ | |
45 | 49 | labelWidth: 120, |
46 | 50 | schemas: formSchema, |
47 | 51 | showActionButtonGroup: false, |
... | ... | @@ -52,127 +56,146 @@ |
52 | 56 | isUpdate.value = !!data?.isUpdate; |
53 | 57 | //编辑 |
54 | 58 | if (unref(isUpdate)) { |
59 | + getId.value = data.record.id; | |
55 | 60 | await setFieldsValue({ |
56 | 61 | ...data.record, |
57 | 62 | }); |
58 | 63 | } else { |
59 | 64 | } |
60 | 65 | }); |
61 | - | |
62 | 66 | const getTitle = computed(() => (!unref(isUpdate) ? '新增通知' : '编辑通知')); |
63 | 67 | const handleCancel = () => { |
64 | 68 | closeDrawer(); |
65 | 69 | }; |
66 | - | |
67 | - watch([selectAll, selectOrg, selectDep, selectPer, isDeptId], (newV) => { | |
68 | - isJudgeWherePoint.value = newV; | |
70 | + watch(selectWhere, (nV) => { | |
71 | + isJudgeWherePoint.value = nV; | |
69 | 72 | }); |
70 | - | |
71 | - onMounted(() => { | |
72 | - getOrganizationList().then((res) => { | |
73 | - res.map((m) => { | |
74 | - if (m.children) { | |
75 | - m.children.map((m1) => { | |
76 | - newArray.value.push(m1.id); | |
77 | - }); | |
78 | - } | |
79 | - }); | |
80 | - }); | |
73 | + watch(isDeptId, (nV) => { | |
74 | + getOranAndDeptId.value = nV; | |
81 | 75 | }); |
76 | + // onMounted(() => { | |
77 | + // getOrganizationList().then((res) => { | |
78 | + // res.map((m) => { | |
79 | + // if (m.children) { | |
80 | + // m.children.map((m1) => { | |
81 | + // newArray.value.push(m1.id); | |
82 | + // }); | |
83 | + // } | |
84 | + // }); | |
85 | + // }); | |
86 | + // }); | |
82 | 87 | |
83 | 88 | async function handleSend() { |
84 | 89 | if (!unref(isUpdate)) { |
85 | 90 | const values = await validate(); |
86 | 91 | Object.assign(getAllData, values); |
87 | - isJudgeWherePoint.value.forEach((f) => { | |
88 | - if (f == 0) { | |
89 | - if (pointArray.value.length == 0) { | |
90 | - pointArray.value = []; | |
91 | - } | |
92 | - } else if (f == 1) { | |
93 | - //组织 | |
94 | - if (pointArray.value.length == 0) { | |
92 | + switch (isJudgeWherePoint.value) { | |
93 | + case '0': | |
94 | + pointArray.value = []; | |
95 | + break; | |
96 | + case '1': | |
97 | + if (pointArray.value.length === 0) { | |
95 | 98 | pointArray.value.push(getAllData.organizationId); |
96 | 99 | } |
97 | - } else if (f == 2) { | |
98 | - //部门 | |
99 | - let findDeptId = newArray.value.find((f) => { | |
100 | - return f == isJudgeWherePoint.value[4]; | |
101 | - }); | |
102 | - if (pointArray.value.length == 0) { | |
103 | - pointArray.value.push(findDeptId); | |
100 | + break; | |
101 | + case '2': | |
102 | + if (pointArray.value.length === 0) { | |
103 | + pointArray.value.push(getOranAndDeptId.value); | |
104 | 104 | } |
105 | - } else if (f == 3) { | |
106 | - //个人 | |
107 | - if (pointArray.value.length == 0) { | |
108 | - pointArray.value = [3]; | |
109 | - } | |
110 | - } | |
111 | - }); | |
105 | + break; | |
106 | + case '3': | |
107 | + pointArray.value = [3]; | |
108 | + break; | |
109 | + } | |
112 | 110 | getAllData.pointId = pointArray.value; |
113 | 111 | await notifyAddLeaseApi(getAllData); |
114 | 112 | createMessage.success('新增成功'); |
115 | 113 | closeDrawer(); |
116 | 114 | emit('success'); |
117 | 115 | resetFields(); |
118 | - setTimeout(() => { | |
119 | - pointArray.value.length = 0; | |
120 | - isJudgeWherePoint.value.length = 0; | |
121 | - }, 1000); | |
122 | 116 | } |
123 | 117 | if (unref(isUpdate)) { |
124 | - const values = await validate(); | |
125 | - // saveForm = getFieldsValue(); | |
126 | - await notifyAddLeaseApi(values); | |
118 | + getAllEditData = getFieldsValue(); | |
119 | + getAllEditData.id = getId.value; | |
120 | + switch (isJudgeWherePoint.value) { | |
121 | + case '0': | |
122 | + pointArray.value = []; | |
123 | + break; | |
124 | + case '1': | |
125 | + if (pointArray.value.length === 0) { | |
126 | + pointArray.value.push(getAllData.organizationId); | |
127 | + } | |
128 | + break; | |
129 | + case '2': | |
130 | + if (pointArray.value.length === 0) { | |
131 | + pointArray.value.push(getOranAndDeptId.value); | |
132 | + } | |
133 | + break; | |
134 | + case '3': | |
135 | + pointArray.value = [3]; | |
136 | + break; | |
137 | + } | |
138 | + getAllEditData.pointId = pointArray.value; | |
139 | + Object.assign(postAllEditData, getAllEditData); | |
140 | + await notifyAddLeaseApi(postAllEditData); | |
127 | 141 | createMessage.success('编辑成功'); |
128 | 142 | closeDrawer(); |
129 | 143 | emit('success'); |
130 | 144 | } |
131 | 145 | } |
132 | - async function handleSubmit() { | |
146 | + async function handleSaveDraft() { | |
133 | 147 | if (!unref(isUpdate)) { |
134 | 148 | const values = await validate(); |
135 | 149 | Object.assign(getAllData, values); |
136 | - isJudgeWherePoint.value.forEach((f) => { | |
137 | - if (f == 0) { | |
138 | - if (pointArray.value.length == 0) { | |
139 | - pointArray.value = []; | |
140 | - } | |
141 | - } else if (f == 1) { | |
142 | - //组织 | |
143 | - if (pointArray.value.length == 0) { | |
150 | + switch (isJudgeWherePoint.value) { | |
151 | + case '0': | |
152 | + pointArray.value = []; | |
153 | + break; | |
154 | + case '1': | |
155 | + if (pointArray.value.length === 0) { | |
144 | 156 | pointArray.value.push(getAllData.organizationId); |
145 | 157 | } |
146 | - } else if (f == 2) { | |
147 | - //部门 | |
148 | - let findDeptId = newArray.value.find((f) => { | |
149 | - return f == isJudgeWherePoint.value[4]; | |
150 | - }); | |
151 | - if (pointArray.value.length == 0) { | |
152 | - pointArray.value.push(findDeptId); | |
158 | + break; | |
159 | + case '2': | |
160 | + if (pointArray.value.length === 0) { | |
161 | + pointArray.value.push(getOranAndDeptId.value); | |
153 | 162 | } |
154 | - } else if (f == 3) { | |
155 | - //个人 | |
156 | - if (pointArray.value.length == 0) { | |
157 | - pointArray.value = [3]; | |
158 | - } | |
159 | - } | |
160 | - }); | |
163 | + break; | |
164 | + case '3': | |
165 | + pointArray.value = [3]; | |
166 | + break; | |
167 | + } | |
161 | 168 | getAllData.pointId = pointArray.value; |
162 | 169 | await notifyAddDraftApi(getAllData); |
163 | 170 | createMessage.success('新增成功'); |
164 | 171 | closeDrawer(); |
165 | 172 | emit('success'); |
166 | 173 | resetFields(); |
167 | - setTimeout(() => { | |
168 | - pointArray.value = []; | |
169 | - isJudgeWherePoint.value = []; | |
170 | - }, 1000); | |
171 | 174 | } |
172 | 175 | if (unref(isUpdate)) { |
173 | - const values = await validate(); | |
174 | - // saveForm = getFieldsValue(); | |
175 | - await notifyAddDraftApi(values); | |
176 | + getAllEditData = getFieldsValue(); | |
177 | + getAllEditData.id = getId.value; | |
178 | + switch (isJudgeWherePoint.value) { | |
179 | + case '0': | |
180 | + pointArray.value = []; | |
181 | + break; | |
182 | + case '1': | |
183 | + if (pointArray.value.length === 0) { | |
184 | + pointArray.value.push(getAllData.organizationId); | |
185 | + } | |
186 | + break; | |
187 | + case '2': | |
188 | + if (pointArray.value.length === 0) { | |
189 | + pointArray.value.push(getOranAndDeptId.value); | |
190 | + } | |
191 | + break; | |
192 | + case '3': | |
193 | + pointArray.value = [3]; | |
194 | + break; | |
195 | + } | |
196 | + getAllEditData.pointId = pointArray.value; | |
197 | + Object.assign(postAllEditData, getAllEditData); | |
198 | + await notifyAddLeaseApi(postAllEditData); | |
176 | 199 | createMessage.success('编辑成功'); |
177 | 200 | closeDrawer(); |
178 | 201 | emit('success'); |
... | ... | @@ -182,7 +205,7 @@ |
182 | 205 | handleSend, |
183 | 206 | handleCancel, |
184 | 207 | getTitle, |
185 | - handleSubmit, | |
208 | + handleSaveDraft, | |
186 | 209 | registerForm, |
187 | 210 | registerDrawer, |
188 | 211 | }; | ... | ... |
... | ... | @@ -26,6 +26,9 @@ |
26 | 26 | { |
27 | 27 | field: 'content', |
28 | 28 | label: '内容', |
29 | + render: (_, data) => { | |
30 | + return !data.content ? '' : data.content.slice(3, data.content.length - 4); | |
31 | + }, | |
29 | 32 | }, |
30 | 33 | { |
31 | 34 | field: 'senderName', |
... | ... | @@ -39,11 +42,11 @@ |
39 | 42 | field: 'type', |
40 | 43 | label: '类型', |
41 | 44 | render: (_, data) => { |
42 | - return data.type === 'MEETING' | |
45 | + return data.type === 'NOTICE' | |
43 | 46 | ? '公告' |
44 | - : data.type === 'MEETING1' | |
47 | + : data.type === 'MEETING' | |
45 | 48 | ? '会议' |
46 | - : data.type === 'MEETING2' | |
49 | + : data.type === 'OTHER' | |
47 | 50 | ? '其他' |
48 | 51 | : ''; |
49 | 52 | }, | ... | ... |
... | ... | @@ -30,24 +30,22 @@ |
30 | 30 | import { formSchema } from './role.data'; |
31 | 31 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
32 | 32 | import { BasicTree, TreeItem } from '/@/components/Tree'; |
33 | - | |
34 | 33 | const { t } = useI18n(); //加载国际化 |
35 | - | |
36 | 34 | // import { getMenuList } from '/@/api/demo/system'; |
37 | - | |
38 | 35 | // 加载菜单数据 |
39 | 36 | import { getMenuList, getMenusIdsByRoleId } from '/@/api/sys/menu'; |
40 | 37 | import { useI18n } from '/@/hooks/web/useI18n'; |
41 | 38 | import { RouteItem } from '/@/api/sys/model/menuModel'; |
42 | 39 | import { saveOrUpdateRoleInfoWithMenu } from '/@/api/system/system'; |
43 | 40 | import { RoleEnum } from '/@/enums/roleEnum'; |
41 | + // import useCurrentInstance from '/@/hooks/web/useCurrentInstance'; | |
42 | + | |
44 | 43 | export default defineComponent({ |
45 | 44 | name: 'RoleDrawer', |
46 | 45 | components: { BasicDrawer, BasicForm, BasicTree }, |
47 | 46 | emits: ['success', 'register'], |
48 | 47 | setup(_, { emit }) { |
49 | 48 | const { proxy } = getCurrentInstance(); |
50 | - | |
51 | 49 | const isUpdate = ref(true); |
52 | 50 | const treeData = ref<TreeItem[]>([]); |
53 | 51 | const roleMenus = ref<string[]>([]); |
... | ... | @@ -132,6 +130,21 @@ |
132 | 130 | // } |
133 | 131 | }); |
134 | 132 | |
133 | + // Tree check事件 | |
134 | + const handleCheckClick = (_, e) => { | |
135 | + allCheckedKeys.value = []; | |
136 | + let nodes = e.checkedNodes; | |
137 | + let halfKeys = e.halfCheckedKeys; | |
138 | + nodes.map((node) => { | |
139 | + if (node.key != halfKeys[0] && halfKeys.length == []) { | |
140 | + allCheckedKeys.value.push(node.key); | |
141 | + } else { | |
142 | + allCheckedKeys.value.push(node.key); | |
143 | + } | |
144 | + }); | |
145 | + allCheckedKeys.value.push(...halfKeys); | |
146 | + }; | |
147 | + | |
135 | 148 | const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色')); |
136 | 149 | |
137 | 150 | async function handleSubmit() { |
... | ... | @@ -147,28 +160,13 @@ |
147 | 160 | menu: allCheckedKeys.value as string[], |
148 | 161 | }; |
149 | 162 | console.log(req, '请求参数'); |
150 | - saveOrUpdateRoleInfoWithMenu(req).then(() => { | |
151 | - closeDrawer(); | |
152 | - emit('success'); | |
153 | - }); | |
163 | + await saveOrUpdateRoleInfoWithMenu(req); | |
164 | + closeDrawer(); | |
165 | + emit('success'); | |
154 | 166 | } finally { |
155 | 167 | setDrawerProps({ confirmLoading: false }); |
156 | 168 | } |
157 | 169 | } |
158 | - // Tree check事件 | |
159 | - const handleCheckClick = (_, e) => { | |
160 | - allCheckedKeys.value = []; | |
161 | - let nodes = e.checkedNodes; | |
162 | - let halfKeys = e.halfCheckedKeys; | |
163 | - nodes.map((node) => { | |
164 | - if (node.key != halfKeys[0] && halfKeys.length == []) { | |
165 | - allCheckedKeys.value.push(node.key); | |
166 | - } else { | |
167 | - allCheckedKeys.value.push(node.key); | |
168 | - } | |
169 | - }); | |
170 | - allCheckedKeys.value.push(...halfKeys); | |
171 | - }; | |
172 | 170 | |
173 | 171 | return { |
174 | 172 | allCheckedKeys, | ... | ... |
... | ... | @@ -12,10 +12,10 @@ |
12 | 12 | export default defineComponent({ |
13 | 13 | name: 'index', |
14 | 14 | components: { BasicForm, CollapseContainer }, |
15 | - emits: ['success', 'register'], | |
15 | + emits: ['success', 'register', 'funcResetFields'], | |
16 | 16 | setup() { |
17 | 17 | const getValueData: any = ref({}); |
18 | - const [registerForm, { getFieldsValue }] = useForm({ | |
18 | + const [registerForm, { getFieldsValue, resetFields }] = useForm({ | |
19 | 19 | schemas: formSchema, |
20 | 20 | showActionButtonGroup: false, |
21 | 21 | }); |
... | ... | @@ -26,7 +26,11 @@ |
26 | 26 | getV = getValueData.value; |
27 | 27 | return getV; |
28 | 28 | } |
29 | + function funcResetFields() { | |
30 | + resetFields(); | |
31 | + } | |
29 | 32 | return { |
33 | + funcResetFields, | |
30 | 34 | getAllFields, |
31 | 35 | registerForm, |
32 | 36 | }; | ... | ... |
... | ... | @@ -30,7 +30,7 @@ |
30 | 30 | /> |
31 | 31 | </template> |
32 | 32 | </BasicTable> |
33 | - <SceneLinkAgeDrawer | |
33 | + <TenantSettingDrawer | |
34 | 34 | :getChildrenData="echoEditData" |
35 | 35 | @register="registerDrawer" |
36 | 36 | @success="handleSuccess" |
... | ... | @@ -41,25 +41,24 @@ |
41 | 41 | import { defineComponent, reactive } from 'vue'; |
42 | 42 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
43 | 43 | import { useDrawer } from '/@/components/Drawer'; |
44 | - import SceneLinkAgeDrawer from './useDrawer.vue'; | |
44 | + import TenantSettingDrawer from './useDrawer.vue'; | |
45 | 45 | import { columns } from './config'; |
46 | 46 | import { useMessage } from '/@/hooks/web/useMessage'; |
47 | - import { screenLinkPageGetApi, screenLinkPageDeleteApi } from '/@/api/ruleengine/ruleengineApi'; | |
47 | + import { getTableTenantProfileApi } from '/@/api/tenant/tenantApi'; | |
48 | 48 | |
49 | 49 | export default defineComponent({ |
50 | 50 | name: 'index', |
51 | - components: { BasicTable, SceneLinkAgeDrawer, TableAction }, | |
51 | + components: { BasicTable, TenantSettingDrawer, TableAction }, | |
52 | 52 | setup() { |
53 | - let selectedRowKeys: Array<string> = []; | |
53 | + // let selectedRowKeys: Array<string> = []; | |
54 | 54 | let echoEditData = reactive({}); |
55 | 55 | const [registerDrawer, { openDrawer }] = useDrawer(); |
56 | 56 | const { createMessage } = useMessage(); |
57 | - const [registerTable, { reload, getSelectRowKeys }] = useTable({ | |
57 | + const [registerTable, { reload }] = useTable({ | |
58 | 58 | title: '', |
59 | 59 | clickToRowSelect: false, |
60 | - api: screenLinkPageGetApi, | |
60 | + api: getTableTenantProfileApi, | |
61 | 61 | columns, |
62 | - rowKey: 'id', | |
63 | 62 | useSearchForm: true, |
64 | 63 | showTableSetting: true, |
65 | 64 | bordered: true, |
... | ... | @@ -80,12 +79,13 @@ |
80 | 79 | } |
81 | 80 | |
82 | 81 | const useSelectionChange = () => { |
83 | - selectedRowKeys = getSelectRowKeys(); | |
82 | + console.log(1); | |
83 | + // selectedRowKeys = getSelectRowKeys(); | |
84 | 84 | }; |
85 | 85 | |
86 | 86 | async function handleToolbarDel() { |
87 | - await screenLinkPageDeleteApi(selectedRowKeys); | |
88 | - createMessage.success('删除成功'); | |
87 | + // await screenLinkPageDeleteApi(selectedRowKeys); | |
88 | + // createMessage.success('删除成功'); | |
89 | 89 | reload(); |
90 | 90 | } |
91 | 91 | |
... | ... | @@ -96,9 +96,9 @@ |
96 | 96 | }); |
97 | 97 | echoEditData = record; |
98 | 98 | } |
99 | - async function handleDelete(record: Recordable) { | |
100 | - let ids = [record.id]; | |
101 | - await screenLinkPageDeleteApi(ids); | |
99 | + async function handleDelete() { | |
100 | + // let ids = [record.id]; | |
101 | + // await screenLinkPageDeleteApi(ids); | |
102 | 102 | createMessage.success('删除成功'); |
103 | 103 | reload(); |
104 | 104 | } | ... | ... |
... | ... | @@ -26,17 +26,20 @@ |
26 | 26 | name: 'ConfigDrawer', |
27 | 27 | components: { BasicDrawer, BasicForm, CpnsTenantSet }, |
28 | 28 | emits: ['success', 'register'], |
29 | - setup() { | |
29 | + setup(_, { emit }) { | |
30 | 30 | const { createMessage } = useMessage(); |
31 | 31 | const isUpdate = ref(true); |
32 | 32 | let postAllData: any = reactive({}); |
33 | 33 | let getValuesFormData: any = reactive({}); |
34 | 34 | const { proxy } = getCurrentInstance(); |
35 | + const getChildData = ref(null); | |
35 | 36 | const [registerForm, { validateFields, getFieldsValue, resetFields }] = useForm({ |
36 | 37 | schemas: formSchema, |
37 | 38 | showActionButtonGroup: false, |
38 | 39 | }); |
39 | 40 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
41 | + //清除表单值 | |
42 | + proxy.$refs.getChildData.funcResetFields(); | |
40 | 43 | await resetFields(); |
41 | 44 | setDrawerProps({ confirmLoading: false }); |
42 | 45 | isUpdate.value = !!data?.isUpdate; |
... | ... | @@ -61,8 +64,11 @@ |
61 | 64 | await saveTenantProfileApi(postAllData); |
62 | 65 | createMessage.success('租户配置新增成功'); |
63 | 66 | closeDrawer(); |
67 | + emit('success'); | |
68 | + resetFields(); | |
64 | 69 | } |
65 | 70 | return { |
71 | + getChildData, | |
66 | 72 | registerDrawer, |
67 | 73 | registerForm, |
68 | 74 | getTitle, | ... | ... |