Commit d4825a8abd2e4b06f807c032ad84fb0add2c2f4a
Merge branch 'sqy_dev' into 'main'
'feat:统一为table组件添加批量删除,fix:找回之前覆盖代码,style:修改一些样式待完成' See merge request huang/yun-teng-iot-front!111
Showing
24 changed files
with
394 additions
and
283 deletions
@@ -34,7 +34,7 @@ export const useBatchDelete = ( | @@ -34,7 +34,7 @@ export const useBatchDelete = ( | ||
34 | if (record) { | 34 | if (record) { |
35 | try { | 35 | try { |
36 | await deleteFn([record.id]); | 36 | await deleteFn([record.id]); |
37 | - createMessage.success('删除联系人成功'); | 37 | + createMessage.success('删除成功'); |
38 | handleSuccess(); | 38 | handleSuccess(); |
39 | } catch (e) { | 39 | } catch (e) { |
40 | createMessage.error('删除失败'); | 40 | createMessage.error('删除失败'); |
@@ -42,11 +42,12 @@ export const useBatchDelete = ( | @@ -42,11 +42,12 @@ export const useBatchDelete = ( | ||
42 | } else { | 42 | } else { |
43 | try { | 43 | try { |
44 | await deleteFn(selectedRowIds.value); | 44 | await deleteFn(selectedRowIds.value); |
45 | - createMessage.success('批量删除联系人成功'); | 45 | + createMessage.success('批量删除成功'); |
46 | selectedRowIds.value = []; | 46 | selectedRowIds.value = []; |
47 | handleSuccess(); | 47 | handleSuccess(); |
48 | } catch (e) { | 48 | } catch (e) { |
49 | - createMessage.info('删除失败'); | 49 | + createMessage.error('删除失败'); |
50 | + selectedRowIds.value = []; | ||
50 | } | 51 | } |
51 | } | 52 | } |
52 | }; | 53 | }; |
@@ -23,6 +23,7 @@ | @@ -23,6 +23,7 @@ | ||
23 | import { getDeviceAlarm } from '/@/api/device/deviceManager'; | 23 | import { getDeviceAlarm } from '/@/api/device/deviceManager'; |
24 | import { useDrawer } from '/@/components/Drawer'; | 24 | import { useDrawer } from '/@/components/Drawer'; |
25 | import AlarmDetailDrawer from './cpns/AlarmDetailDrawer.vue'; | 25 | import AlarmDetailDrawer from './cpns/AlarmDetailDrawer.vue'; |
26 | + | ||
26 | export default defineComponent({ | 27 | export default defineComponent({ |
27 | name: 'AlarmCenter', | 28 | name: 'AlarmCenter', |
28 | components: { | 29 | components: { |
@@ -3,27 +3,30 @@ import { FormSchema } from '/@/components/Form'; | @@ -3,27 +3,30 @@ import { FormSchema } from '/@/components/Form'; | ||
3 | import { BasicColumn } from '/@/components/Table'; | 3 | import { BasicColumn } from '/@/components/Table'; |
4 | import { DeviceTypeEnum } from '/@/api/device/model/deviceModel'; | 4 | import { DeviceTypeEnum } from '/@/api/device/model/deviceModel'; |
5 | import { getCustomerList } from '/@/api/device/deviceManager'; | 5 | import { getCustomerList } from '/@/api/device/deviceManager'; |
6 | -import dayjs from 'moment'; | ||
7 | -export const columns: BasicColumn[] = [ | 6 | +import { DescItem } from '/@/components/Description/index'; |
7 | +import moment from 'moment'; | ||
8 | +// 设备详情的描述 | ||
9 | +export const descSchema: DescItem[] = [ | ||
8 | { | 10 | { |
9 | - title: '设备名称', | ||
10 | - dataIndex: 'name', | ||
11 | - width: 120, | 11 | + field: 'createTime', |
12 | + label: '创建时间', | ||
12 | }, | 13 | }, |
13 | { | 14 | { |
14 | - title: '设备标签', | ||
15 | - dataIndex: 'label', | ||
16 | - width: 100, | 15 | + field: 'name', |
16 | + label: '设备名称', | ||
17 | }, | 17 | }, |
18 | { | 18 | { |
19 | - title: '设备配置', | ||
20 | - dataIndex: 'deviceProfile.name', | ||
21 | - width: 160, | 19 | + field: 'label', |
20 | + label: '设备标签', | ||
21 | + }, | ||
22 | + { | ||
23 | + field: 'deviceProfile.name', | ||
24 | + label: '设备配置', | ||
22 | }, | 25 | }, |
23 | { | 26 | { |
24 | - title: '设备类型', | ||
25 | - dataIndex: 'deviceType', | ||
26 | - customRender({ text }) { | 27 | + field: 'deviceType', |
28 | + label: '设备类型', | ||
29 | + render: (text) => { | ||
27 | return text === DeviceTypeEnum.GATEWAY | 30 | return text === DeviceTypeEnum.GATEWAY |
28 | ? '网关设备' | 31 | ? '网关设备' |
29 | : text == DeviceTypeEnum.DIRECT_CONNECTION | 32 | : text == DeviceTypeEnum.DIRECT_CONNECTION |
@@ -32,11 +35,11 @@ export const columns: BasicColumn[] = [ | @@ -32,11 +35,11 @@ export const columns: BasicColumn[] = [ | ||
32 | }, | 35 | }, |
33 | }, | 36 | }, |
34 | { | 37 | { |
35 | - title: '描述', | ||
36 | - dataIndex: 'description', | ||
37 | - width: 180, | 38 | + field: 'description', |
39 | + label: '描述', | ||
38 | }, | 40 | }, |
39 | ]; | 41 | ]; |
42 | + | ||
40 | // 实时数据表格 | 43 | // 实时数据表格 |
41 | export const realTimeDataColumns: BasicColumn[] = [ | 44 | export const realTimeDataColumns: BasicColumn[] = [ |
42 | { | 45 | { |
@@ -100,7 +103,7 @@ export const alarmSearchSchemas: FormSchema[] = [ | @@ -100,7 +103,7 @@ export const alarmSearchSchemas: FormSchema[] = [ | ||
100 | component: 'DatePicker', | 103 | component: 'DatePicker', |
101 | componentProps: { | 104 | componentProps: { |
102 | valueFormat: 'x', | 105 | valueFormat: 'x', |
103 | - showTime: { defaultValue: dayjs('23:59:59', 'HH:mm:ss') }, | 106 | + showTime: { defaultValue: moment('23:59:59', 'HH:mm:ss') }, |
104 | }, | 107 | }, |
105 | colProps: { span: 6 }, | 108 | colProps: { span: 6 }, |
106 | }, | 109 | }, |
@@ -212,20 +215,25 @@ export const alarmSchemasForm: FormSchema[] = [ | @@ -212,20 +215,25 @@ export const alarmSchemasForm: FormSchema[] = [ | ||
212 | }, | 215 | }, |
213 | }, | 216 | }, |
214 | ]; | 217 | ]; |
215 | - | ||
216 | // 子设备 | 218 | // 子设备 |
217 | export const childDeviceSchemas: FormSchema[] = [ | 219 | export const childDeviceSchemas: FormSchema[] = [ |
218 | { | 220 | { |
219 | - field: 'icon', | ||
220 | - label: '设备配置', | ||
221 | - component: 'Select', | 221 | + field: 'deviceState', |
222 | + label: '设备状态', | ||
222 | colProps: { span: 6 }, | 223 | colProps: { span: 6 }, |
224 | + component: 'Select', | ||
223 | componentProps: { | 225 | componentProps: { |
226 | + size: 'small', | ||
224 | maxLength: 255, | 227 | maxLength: 255, |
228 | + options: [ | ||
229 | + { label: '待激活', value: 'INACTIVE' }, | ||
230 | + { label: '在线', value: 'ONLINE' }, | ||
231 | + { label: '离线', value: 'OFFLINE' }, | ||
232 | + ], | ||
225 | }, | 233 | }, |
226 | }, | 234 | }, |
227 | { | 235 | { |
228 | - field: 'icon', | 236 | + field: 'name', |
229 | label: '设备名称', | 237 | label: '设备名称', |
230 | component: 'Input', | 238 | component: 'Input', |
231 | colProps: { span: 6 }, | 239 | colProps: { span: 6 }, |
@@ -238,32 +246,30 @@ export const childDeviceSchemas: FormSchema[] = [ | @@ -238,32 +246,30 @@ export const childDeviceSchemas: FormSchema[] = [ | ||
238 | export const childDeviceColumns: BasicColumn[] = [ | 246 | export const childDeviceColumns: BasicColumn[] = [ |
239 | { | 247 | { |
240 | title: '名称', | 248 | title: '名称', |
241 | - dataIndex: 'name', | 249 | + dataIndex: 'tbDeviceName', |
242 | width: 120, | 250 | width: 120, |
243 | }, | 251 | }, |
244 | { | 252 | { |
245 | - title: '设备配置', | ||
246 | - dataIndex: 'label', | ||
247 | - width: 100, | ||
248 | - }, | ||
249 | - { | ||
250 | title: '标签', | 253 | title: '标签', |
251 | - dataIndex: 'aaa', | 254 | + dataIndex: 'label', |
252 | width: 160, | 255 | width: 160, |
253 | }, | 256 | }, |
254 | { | 257 | { |
255 | title: '状态', | 258 | title: '状态', |
256 | - dataIndex: 'bbb', | 259 | + dataIndex: 'deviceState', |
260 | + slots: { customRender: 'deviceState' }, | ||
257 | width: 160, | 261 | width: 160, |
258 | }, | 262 | }, |
259 | { | 263 | { |
260 | title: '最后连接时间', | 264 | title: '最后连接时间', |
261 | - dataIndex: 'ccc', | 265 | + dataIndex: 'lastOnlineTime', |
266 | + format: (text) => formatToDateTime(text, 'YYYY-MM-DD HH:mm:ss'), | ||
262 | width: 160, | 267 | width: 160, |
263 | }, | 268 | }, |
264 | { | 269 | { |
265 | - title: '创建时间', | ||
266 | - dataIndex: 'ddd', | 270 | + title: '更新时间', |
271 | + dataIndex: 'createdTime', | ||
272 | + format: (text) => formatToDateTime(text, 'YYYY-MM-DD HH:mm:ss'), | ||
267 | width: 160, | 273 | width: 160, |
268 | }, | 274 | }, |
269 | ]; | 275 | ]; |
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | centered | 7 | centered |
8 | @ok="dispatchCustomer" | 8 | @ok="dispatchCustomer" |
9 | @cancel="resetFields" | 9 | @cancel="resetFields" |
10 | - :minHeight="150" | 10 | + :minHeight="100" |
11 | okText="分配" | 11 | okText="分配" |
12 | > | 12 | > |
13 | <BasicForm @register="registerForm" /> | 13 | <BasicForm @register="registerForm" /> |
@@ -3,22 +3,22 @@ | @@ -3,22 +3,22 @@ | ||
3 | v-bind="$attrs" | 3 | v-bind="$attrs" |
4 | isDetail | 4 | isDetail |
5 | @register="register" | 5 | @register="register" |
6 | - :destroyOnClose="true" | 6 | + destroyOnClose |
7 | @close="closeDrawer" | 7 | @close="closeDrawer" |
8 | :title="deviceDetail.name" | 8 | :title="deviceDetail.name" |
9 | - width="70%" | 9 | + width="80%" |
10 | > | 10 | > |
11 | - <Tabs v-model:activeKey="activeKey" :size="size" type="card"> | ||
12 | - <TabPane key="1" tab="详情" | ||
13 | - ><Detail ref="deviceDetailRef" :deviceDetail="deviceDetail" | ||
14 | - /></TabPane> | ||
15 | - <TabPane key="2" tab="实时数据" v-if="deviceDetail?.deviceType !== 'GATEWAY'" | ||
16 | - ><RealTimeData :deviceDetail="deviceDetail" | ||
17 | - /></TabPane> | 11 | + <Tabs v-model:activeKey="activeKey" :size="size"> |
12 | + <TabPane key="1" tab="详情"> | ||
13 | + <Detail ref="deviceDetailRef" :deviceDetail="deviceDetail" /> | ||
14 | + </TabPane> | ||
15 | + <TabPane key="2" tab="实时数据" v-if="deviceDetail?.deviceType !== 'GATEWAY'"> | ||
16 | + <RealTimeData :deviceDetail="deviceDetail" /> | ||
17 | + </TabPane> | ||
18 | <TabPane key="3" tab="告警"><Alarm :id="deviceDetail.id" /></TabPane> | 18 | <TabPane key="3" tab="告警"><Alarm :id="deviceDetail.id" /></TabPane> |
19 | - <TabPane key="4" tab="子设备" v-if="deviceDetail?.deviceType === 'GATEWAY'" | ||
20 | - ><ChildDevice | ||
21 | - /></TabPane> | 19 | + <TabPane key="4" tab="子设备" v-if="deviceDetail?.deviceType === 'GATEWAY'"> |
20 | + <ChildDevice :fromId="deviceDetail?.tbDeviceId" /> | ||
21 | + </TabPane> | ||
22 | </Tabs> | 22 | </Tabs> |
23 | </BasicDrawer> | 23 | </BasicDrawer> |
24 | </template> | 24 | </template> |
@@ -10,9 +10,9 @@ | @@ -10,9 +10,9 @@ | ||
10 | centered | 10 | centered |
11 | > | 11 | > |
12 | <div class="step-form-form"> | 12 | <div class="step-form-form"> |
13 | - <Steps :current="current"> | ||
14 | - <Step title="填写设备信息" v-if="!isUpdate" /> | ||
15 | - <Step title="添加设备凭证" v-if="!isUpdate" /> | 13 | + <Steps :current="current" v-if="!isUpdate"> |
14 | + <Step title="填写设备信息" /> | ||
15 | + <Step title="添加设备凭证" /> | ||
16 | </Steps> | 16 | </Steps> |
17 | </div> | 17 | </div> |
18 | <div class="mt-5"> | 18 | <div class="mt-5"> |
1 | <template> | 1 | <template> |
2 | - <div> | 2 | + <div style="background-color: #f0f2f5"> |
3 | <BasicTable @register="registerTable"> | 3 | <BasicTable @register="registerTable"> |
4 | <template #action="{ record }"> | 4 | <template #action="{ record }"> |
5 | <TableAction | 5 | <TableAction |
@@ -40,13 +40,12 @@ | @@ -40,13 +40,12 @@ | ||
40 | const [registerTable, { reload }] = useTable({ | 40 | const [registerTable, { reload }] = useTable({ |
41 | api: getDeviceAlarm, | 41 | api: getDeviceAlarm, |
42 | columns: alarmColumns, | 42 | columns: alarmColumns, |
43 | + useSearchForm: true, | ||
43 | formConfig: { | 44 | formConfig: { |
44 | labelWidth: 120, | 45 | labelWidth: 120, |
45 | schemas: alarmSearchSchemas, | 46 | schemas: alarmSearchSchemas, |
46 | }, | 47 | }, |
47 | showTableSetting: true, | 48 | showTableSetting: true, |
48 | - | ||
49 | - useSearchForm: true, | ||
50 | bordered: true, | 49 | bordered: true, |
51 | showIndexColumn: false, | 50 | showIndexColumn: false, |
52 | beforeFetch: (data) => { | 51 | beforeFetch: (data) => { |
1 | <template> | 1 | <template> |
2 | - <BasicTable @register="registerTable" /> | 2 | + <div style="background-color: #f0f2f5"> |
3 | + <BasicTable @register="registerTable"> | ||
4 | + <template #deviceState="{ record }"> | ||
5 | + <Tag | ||
6 | + :color=" | ||
7 | + record.deviceState == DeviceState.INACTIVE | ||
8 | + ? 'warning' | ||
9 | + : record.deviceState == DeviceState.ONLINE | ||
10 | + ? 'success' | ||
11 | + : 'error' | ||
12 | + " | ||
13 | + class="ml-2" | ||
14 | + > | ||
15 | + {{ | ||
16 | + record.deviceState == DeviceState.INACTIVE | ||
17 | + ? '待激活' | ||
18 | + : record.deviceState == DeviceState.ONLINE | ||
19 | + ? '在线' | ||
20 | + : '离线' | ||
21 | + }} | ||
22 | + </Tag> | ||
23 | + </template> | ||
24 | + </BasicTable> | ||
25 | + </div> | ||
3 | </template> | 26 | </template> |
4 | <script lang="ts"> | 27 | <script lang="ts"> |
5 | - import { defineComponent } from 'vue'; | 28 | + import { defineComponent, onMounted } from 'vue'; |
29 | + import { Tag } from 'ant-design-vue'; | ||
30 | + import { DeviceState } from '/@/api/device/model/deviceModel'; | ||
6 | import { BasicTable, useTable } from '/@/components/Table'; | 31 | import { BasicTable, useTable } from '/@/components/Table'; |
7 | import { childDeviceColumns, childDeviceSchemas } from '../../config/detail.config'; | 32 | import { childDeviceColumns, childDeviceSchemas } from '../../config/detail.config'; |
8 | - | 33 | + import { getChildDevicePage } from '/@/api/device/deviceManager.ts'; |
9 | export default defineComponent({ | 34 | export default defineComponent({ |
10 | name: 'DeviceManagement', | 35 | name: 'DeviceManagement', |
11 | components: { | 36 | components: { |
12 | BasicTable, | 37 | BasicTable, |
38 | + Tag, | ||
39 | + }, | ||
40 | + props: { | ||
41 | + fromId: { | ||
42 | + type: String, | ||
43 | + required: true, | ||
44 | + }, | ||
13 | }, | 45 | }, |
14 | - setup(_) { | 46 | + setup(props) { |
47 | + console.log(123); | ||
48 | + onMounted(() => { | ||
49 | + console.log(props.fromId); | ||
50 | + }); | ||
15 | const [registerTable] = useTable({ | 51 | const [registerTable] = useTable({ |
52 | + api: getChildDevicePage, | ||
16 | columns: childDeviceColumns, | 53 | columns: childDeviceColumns, |
17 | formConfig: { | 54 | formConfig: { |
18 | labelWidth: 120, | 55 | labelWidth: 120, |
19 | schemas: childDeviceSchemas, | 56 | schemas: childDeviceSchemas, |
20 | }, | 57 | }, |
58 | + beforeFetch: (data) => { | ||
59 | + console.log(props.fromId); | ||
60 | + Reflect.set(data, 'fromId', props.fromId); | ||
61 | + }, | ||
21 | useSearchForm: true, | 62 | useSearchForm: true, |
22 | showTableSetting: true, | 63 | showTableSetting: true, |
23 | bordered: true, | 64 | bordered: true, |
@@ -26,6 +67,7 @@ | @@ -26,6 +67,7 @@ | ||
26 | 67 | ||
27 | return { | 68 | return { |
28 | registerTable, | 69 | registerTable, |
70 | + DeviceState, | ||
29 | }; | 71 | }; |
30 | }, | 72 | }, |
31 | }); | 73 | }); |
@@ -6,14 +6,7 @@ | @@ -6,14 +6,7 @@ | ||
6 | </div> | 6 | </div> |
7 | <div> | 7 | <div> |
8 | <p>设备信息</p> | 8 | <p>设备信息</p> |
9 | - <Table | ||
10 | - bordered | ||
11 | - :columns="columns" | ||
12 | - :data-source="[deviceDetail]" | ||
13 | - :rowKey="(_, index) => index" | ||
14 | - :pagination="false" | ||
15 | - style="width: 800px" | ||
16 | - /> | 9 | + <Description @register="register" class="mt-4" :data="deviceDetail" /> |
17 | </div> | 10 | </div> |
18 | <div class="mt-4"> | 11 | <div class="mt-4"> |
19 | <a-button type="primary" class="mr-4" @click="copyTbDeviceId">复制设备ID</a-button> | 12 | <a-button type="primary" class="mr-4" @click="copyTbDeviceId">复制设备ID</a-button> |
@@ -23,14 +16,14 @@ | @@ -23,14 +16,14 @@ | ||
23 | </div> | 16 | </div> |
24 | <div v-if="deviceDetail?.deviceInfo?.address" class="mt-4"> | 17 | <div v-if="deviceDetail?.deviceInfo?.address" class="mt-4"> |
25 | <p>设备位置</p> | 18 | <p>设备位置</p> |
26 | - <div ref="wrapRef" style="height: 400px; width: 100%"></div> | 19 | + <div ref="wrapRef" style="height: 550px; width: 100%"></div> |
27 | </div> | 20 | </div> |
28 | </div> | 21 | </div> |
29 | </template> | 22 | </template> |
30 | <script lang="ts"> | 23 | <script lang="ts"> |
31 | import { defineComponent, ref, unref, nextTick } from 'vue'; | 24 | import { defineComponent, ref, unref, nextTick } from 'vue'; |
32 | - import { Image, Table } from 'ant-design-vue'; | ||
33 | - import { columns } from '../../config/detail.config'; | 25 | + import { Image } from 'ant-design-vue'; |
26 | + import { descSchema } from '../../config/detail.config'; | ||
34 | import { useScript } from '/@/hooks/web/useScript'; | 27 | import { useScript } from '/@/hooks/web/useScript'; |
35 | import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; | 28 | import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; |
36 | import { useMessage } from '/@/hooks/web/useMessage'; | 29 | import { useMessage } from '/@/hooks/web/useMessage'; |
@@ -38,10 +31,13 @@ | @@ -38,10 +31,13 @@ | ||
38 | import { useModal } from '/@/components/Modal'; | 31 | import { useModal } from '/@/components/Modal'; |
39 | import ManageDeviceTokenModal from '../modal/ManageDeviceTokenModal.vue'; | 32 | import ManageDeviceTokenModal from '../modal/ManageDeviceTokenModal.vue'; |
40 | import { getDeviceToken } from '/@/api/device/deviceManager'; | 33 | import { getDeviceToken } from '/@/api/device/deviceManager'; |
34 | + import { Description, useDescription } from '/@/components/Description'; | ||
35 | + import wz from '/@/assets/images/wz.png'; | ||
36 | + | ||
41 | export default defineComponent({ | 37 | export default defineComponent({ |
42 | components: { | 38 | components: { |
43 | Image, | 39 | Image, |
44 | - Table, | 40 | + Description, |
45 | ManageDeviceTokenModal, | 41 | ManageDeviceTokenModal, |
46 | }, | 42 | }, |
47 | props: { | 43 | props: { |
@@ -51,6 +47,13 @@ | @@ -51,6 +47,13 @@ | ||
51 | }, | 47 | }, |
52 | }, | 48 | }, |
53 | setup(props) { | 49 | setup(props) { |
50 | + console.log(props.deviceDetail); | ||
51 | + const [register] = useDescription({ | ||
52 | + layout: 'vertical', | ||
53 | + schema: descSchema, | ||
54 | + column: 2, | ||
55 | + }); | ||
56 | + | ||
54 | // 地图 | 57 | // 地图 |
55 | const wrapRef = ref<HTMLDivElement | null>(null); | 58 | const wrapRef = ref<HTMLDivElement | null>(null); |
56 | const { toPromise } = useScript({ src: BAI_DU_MAP_URL }); | 59 | const { toPromise } = useScript({ src: BAI_DU_MAP_URL }); |
@@ -62,7 +65,7 @@ | @@ -62,7 +65,7 @@ | ||
62 | const BMap = (window as any).BMap; | 65 | const BMap = (window as any).BMap; |
63 | if (!wrapEl) return; | 66 | if (!wrapEl) return; |
64 | const map = new BMap.Map(wrapEl); | 67 | const map = new BMap.Map(wrapEl); |
65 | - let myIcon = new BMap.Icon('/src/assets/images/wz.png', new BMap.Size(20, 30)); | 68 | + let myIcon = new BMap.Icon(wz, new BMap.Size(20, 30)); |
66 | 69 | ||
67 | const point = new BMap.Point(Number(longitude), Number(latitude)); | 70 | const point = new BMap.Point(Number(longitude), Number(latitude)); |
68 | var content = `我在 ${address}`; | 71 | var content = `我在 ${address}`; |
@@ -107,13 +110,13 @@ | @@ -107,13 +110,13 @@ | ||
107 | }; | 110 | }; |
108 | 111 | ||
109 | return { | 112 | return { |
110 | - columns, | ||
111 | wrapRef, | 113 | wrapRef, |
112 | copyTbDeviceId, | 114 | copyTbDeviceId, |
113 | copyDeviceToken, | 115 | copyDeviceToken, |
114 | initMap, | 116 | initMap, |
115 | manageDeviceToken, | 117 | manageDeviceToken, |
116 | registerModal, | 118 | registerModal, |
119 | + register, | ||
117 | }; | 120 | }; |
118 | }, | 121 | }, |
119 | }); | 122 | }); |
1 | <template> | 1 | <template> |
2 | - <BasicTable @register="registerTable" /> | 2 | + <div style="background-color: #f0f2f5"> |
3 | + <BasicTable @register="registerTable" /> | ||
4 | + </div> | ||
3 | </template> | 5 | </template> |
4 | <script lang="ts"> | 6 | <script lang="ts"> |
5 | import { defineComponent, reactive } from 'vue'; | 7 | import { defineComponent, reactive } from 'vue'; |
@@ -52,6 +54,21 @@ | @@ -52,6 +54,21 @@ | ||
52 | bordered: true, | 54 | bordered: true, |
53 | showIndexColumn: false, | 55 | showIndexColumn: false, |
54 | dataSource: state.recordList, | 56 | dataSource: state.recordList, |
57 | + useSearchForm: true, | ||
58 | + formConfig: { | ||
59 | + labelWidth: 120, | ||
60 | + schemas: [ | ||
61 | + { | ||
62 | + field: 'icon', | ||
63 | + label: '设备配置', | ||
64 | + component: 'Select', | ||
65 | + colProps: { span: 6 }, | ||
66 | + componentProps: { | ||
67 | + maxLength: 255, | ||
68 | + }, | ||
69 | + }, | ||
70 | + ], | ||
71 | + }, | ||
55 | }); | 72 | }); |
56 | 73 | ||
57 | const { send, close } = useWebSocket(state.server, { | 74 | const { send, close } = useWebSocket(state.server, { |
@@ -9,6 +9,14 @@ | @@ -9,6 +9,14 @@ | ||
9 | <BasicTable @register="registerTable" class="w-5/6 xl:w-4/5"> | 9 | <BasicTable @register="registerTable" class="w-5/6 xl:w-4/5"> |
10 | <template #toolbar> | 10 | <template #toolbar> |
11 | <a-button type="primary" @click="handleCreate" v-if="authBtn(role)"> 新增设备 </a-button> | 11 | <a-button type="primary" @click="handleCreate" v-if="authBtn(role)"> 新增设备 </a-button> |
12 | + <a-button | ||
13 | + color="error" | ||
14 | + v-if="authBtn(role)" | ||
15 | + @click="handleDeleteOrBatchDelete(null)" | ||
16 | + :disabled="hasBatchDelete" | ||
17 | + > | ||
18 | + 批量删除 | ||
19 | + </a-button> | ||
12 | </template> | 20 | </template> |
13 | <template #deviceProfile="{ record }"> | 21 | <template #deviceProfile="{ record }"> |
14 | <a-button type="link" class="ml-2" @click="goDeviceProfile(record.deviceProfile.name)"> | 22 | <a-button type="link" class="ml-2" @click="goDeviceProfile(record.deviceProfile.name)"> |
@@ -85,7 +93,7 @@ | @@ -85,7 +93,7 @@ | ||
85 | color: 'error', | 93 | color: 'error', |
86 | popConfirm: { | 94 | popConfirm: { |
87 | title: '是否确认删除', | 95 | title: '是否确认删除', |
88 | - confirm: handleDelete.bind(null, record), | 96 | + confirm: handleDeleteOrBatchDelete.bind(null, record), |
89 | }, | 97 | }, |
90 | }, | 98 | }, |
91 | ]" | 99 | ]" |
@@ -104,7 +112,6 @@ | @@ -104,7 +112,6 @@ | ||
104 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 112 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
105 | import { columns, searchFormSchema } from './config/device.data'; | 113 | import { columns, searchFormSchema } from './config/device.data'; |
106 | import { Tag } from 'ant-design-vue'; | 114 | import { Tag } from 'ant-design-vue'; |
107 | - import { useMessage } from '/@/hooks/web/useMessage'; | ||
108 | import { | 115 | import { |
109 | deleteDevice, | 116 | deleteDevice, |
110 | devicePage, | 117 | devicePage, |
@@ -125,6 +132,8 @@ | @@ -125,6 +132,8 @@ | ||
125 | import { USER_INFO_KEY } from '/@/enums/cacheEnum'; | 132 | import { USER_INFO_KEY } from '/@/enums/cacheEnum'; |
126 | import { getAuthCache } from '/@/utils/auth'; | 133 | import { getAuthCache } from '/@/utils/auth'; |
127 | import { authBtn } from '/@/enums/roleEnum'; | 134 | import { authBtn } from '/@/enums/roleEnum'; |
135 | + import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | ||
136 | + | ||
128 | export default defineComponent({ | 137 | export default defineComponent({ |
129 | name: 'DeviceManagement', | 138 | name: 'DeviceManagement', |
130 | components: { | 139 | components: { |
@@ -138,9 +147,11 @@ | @@ -138,9 +147,11 @@ | ||
138 | CustomerModal, | 147 | CustomerModal, |
139 | }, | 148 | }, |
140 | setup(_) { | 149 | setup(_) { |
141 | - const { createMessage } = useMessage(); | ||
142 | const go = useGo(); | 150 | const go = useGo(); |
143 | - | 151 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( |
152 | + deleteDevice, | ||
153 | + handleSuccess | ||
154 | + ); | ||
144 | const searchInfo = reactive<Recordable>({}); | 155 | const searchInfo = reactive<Recordable>({}); |
145 | const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); | 156 | const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); |
146 | const [registerModal, { openModal }] = useModal(); | 157 | const [registerModal, { openModal }] = useModal(); |
@@ -166,6 +177,7 @@ | @@ -166,6 +177,7 @@ | ||
166 | slots: { customRender: 'action' }, | 177 | slots: { customRender: 'action' }, |
167 | fixed: 'right', | 178 | fixed: 'right', |
168 | }, | 179 | }, |
180 | + ...selectionOptions, | ||
169 | }); | 181 | }); |
170 | 182 | ||
171 | const userInfo: any = getAuthCache(USER_INFO_KEY); | 183 | const userInfo: any = getAuthCache(USER_INFO_KEY); |
@@ -206,14 +218,6 @@ | @@ -206,14 +218,6 @@ | ||
206 | }); | 218 | }); |
207 | } | 219 | } |
208 | 220 | ||
209 | - function handleDelete(record: Recordable) { | ||
210 | - let ids = [record.id]; | ||
211 | - deleteDevice(ids).then(() => { | ||
212 | - createMessage.success('删除设备成功'); | ||
213 | - handleSuccess(); | ||
214 | - }); | ||
215 | - } | ||
216 | - | ||
217 | function handleSuccess() { | 221 | function handleSuccess() { |
218 | reload(); | 222 | reload(); |
219 | } | 223 | } |
@@ -230,7 +234,6 @@ | @@ -230,7 +234,6 @@ | ||
230 | handleCreate, | 234 | handleCreate, |
231 | handleDetail, | 235 | handleDetail, |
232 | handleEdit, | 236 | handleEdit, |
233 | - handleDelete, | ||
234 | handleSuccess, | 237 | handleSuccess, |
235 | goDeviceProfile, | 238 | goDeviceProfile, |
236 | handleSelect, | 239 | handleSelect, |
@@ -245,6 +248,8 @@ | @@ -245,6 +248,8 @@ | ||
245 | registerCustomerModal, | 248 | registerCustomerModal, |
246 | authBtn, | 249 | authBtn, |
247 | role, | 250 | role, |
251 | + handleDeleteOrBatchDelete, | ||
252 | + hasBatchDelete, | ||
248 | }; | 253 | }; |
249 | }, | 254 | }, |
250 | }); | 255 | }); |
@@ -3,6 +3,9 @@ | @@ -3,6 +3,9 @@ | ||
3 | <BasicTable @register="registerTable"> | 3 | <BasicTable @register="registerTable"> |
4 | <template #toolbar> | 4 | <template #toolbar> |
5 | <a-button type="primary" @click="handleCreate"> 新增消息配置 </a-button> | 5 | <a-button type="primary" @click="handleCreate"> 新增消息配置 </a-button> |
6 | + <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete"> | ||
7 | + 批量删除 | ||
8 | + </a-button> | ||
6 | </template> | 9 | </template> |
7 | <template #config="{ record }"> | 10 | <template #config="{ record }"> |
8 | <a-button type="link" class="ml-2" @click="showData(record)"> 查看配置 </a-button> | 11 | <a-button type="link" class="ml-2" @click="showData(record)"> 查看配置 </a-button> |
@@ -21,7 +24,7 @@ | @@ -21,7 +24,7 @@ | ||
21 | color: 'error', | 24 | color: 'error', |
22 | popConfirm: { | 25 | popConfirm: { |
23 | title: '是否确认删除', | 26 | title: '是否确认删除', |
24 | - confirm: handleDelete.bind(null, record), | 27 | + confirm: handleDeleteOrBatchDelete.bind(null, record), |
25 | }, | 28 | }, |
26 | ifShow: record.status == 0, | 29 | ifShow: record.status == 0, |
27 | }, | 30 | }, |
@@ -42,13 +45,16 @@ | @@ -42,13 +45,16 @@ | ||
42 | import { columns, searchFormSchema } from './config.data'; | 45 | import { columns, searchFormSchema } from './config.data'; |
43 | import { Modal } from 'ant-design-vue'; | 46 | import { Modal } from 'ant-design-vue'; |
44 | import { JsonPreview } from '/@/components/CodeEditor'; | 47 | import { JsonPreview } from '/@/components/CodeEditor'; |
45 | - import { useMessage } from '/@/hooks/web/useMessage'; | 48 | + import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
46 | export default defineComponent({ | 49 | export default defineComponent({ |
47 | name: 'MessageConfigManagement', | 50 | name: 'MessageConfigManagement', |
48 | components: { BasicTable, ConfigDrawer, TableAction }, | 51 | components: { BasicTable, ConfigDrawer, TableAction }, |
49 | setup() { | 52 | setup() { |
50 | const [registerDrawer, { openDrawer }] = useDrawer(); | 53 | const [registerDrawer, { openDrawer }] = useDrawer(); |
51 | - const { createMessage } = useMessage(); | 54 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( |
55 | + deleteMessageConfig, | ||
56 | + handleSuccess | ||
57 | + ); | ||
52 | const [registerTable, { reload }] = useTable({ | 58 | const [registerTable, { reload }] = useTable({ |
53 | title: '消息配置列表', | 59 | title: '消息配置列表', |
54 | api: messageConfigPage, | 60 | api: messageConfigPage, |
@@ -68,6 +74,7 @@ | @@ -68,6 +74,7 @@ | ||
68 | slots: { customRender: 'action' }, | 74 | slots: { customRender: 'action' }, |
69 | fixed: 'right', | 75 | fixed: 'right', |
70 | }, | 76 | }, |
77 | + ...selectionOptions, | ||
71 | }); | 78 | }); |
72 | 79 | ||
73 | function handleCreate() { | 80 | function handleCreate() { |
@@ -83,14 +90,6 @@ | @@ -83,14 +90,6 @@ | ||
83 | }); | 90 | }); |
84 | } | 91 | } |
85 | 92 | ||
86 | - function handleDelete(record: Recordable) { | ||
87 | - let ids = [record.id]; | ||
88 | - deleteMessageConfig(ids).then((result) => { | ||
89 | - createMessage.success(result.message); | ||
90 | - handleSuccess(); | ||
91 | - }); | ||
92 | - } | ||
93 | - | ||
94 | function handleSuccess() { | 93 | function handleSuccess() { |
95 | reload(); | 94 | reload(); |
96 | } | 95 | } |
@@ -107,8 +106,9 @@ | @@ -107,8 +106,9 @@ | ||
107 | showData, | 106 | showData, |
108 | handleCreate, | 107 | handleCreate, |
109 | handleEdit, | 108 | handleEdit, |
110 | - handleDelete, | ||
111 | handleSuccess, | 109 | handleSuccess, |
110 | + hasBatchDelete, | ||
111 | + handleDeleteOrBatchDelete, | ||
112 | }; | 112 | }; |
113 | }, | 113 | }, |
114 | }); | 114 | }); |
@@ -3,6 +3,9 @@ | @@ -3,6 +3,9 @@ | ||
3 | <BasicTable @register="registerTable"> | 3 | <BasicTable @register="registerTable"> |
4 | <template #toolbar> | 4 | <template #toolbar> |
5 | <a-button type="primary" @click="handleCreate"> 新增消息模板 </a-button> | 5 | <a-button type="primary" @click="handleCreate"> 新增消息模板 </a-button> |
6 | + <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete"> | ||
7 | + 批量删除 | ||
8 | + </a-button> | ||
6 | </template> | 9 | </template> |
7 | <template #config="{ record }"> | 10 | <template #config="{ record }"> |
8 | <a-button type="link" class="ml-2" @click="goConfig"> | 11 | <a-button type="link" class="ml-2" @click="goConfig"> |
@@ -28,7 +31,7 @@ | @@ -28,7 +31,7 @@ | ||
28 | color: 'error', | 31 | color: 'error', |
29 | popConfirm: { | 32 | popConfirm: { |
30 | title: '是否确认删除', | 33 | title: '是否确认删除', |
31 | - confirm: handleDelete.bind(null, record), | 34 | + confirm: handleDeleteOrBatchDelete.bind(null, record), |
32 | }, | 35 | }, |
33 | }, | 36 | }, |
34 | ]" | 37 | ]" |
@@ -47,7 +50,6 @@ | @@ -47,7 +50,6 @@ | ||
47 | import { useDrawer } from '/@/components/Drawer'; | 50 | import { useDrawer } from '/@/components/Drawer'; |
48 | import TemplateDrawer from './TemplateDrawer.vue'; | 51 | import TemplateDrawer from './TemplateDrawer.vue'; |
49 | import { columns, searchFormSchema } from './template.data'; | 52 | import { columns, searchFormSchema } from './template.data'; |
50 | - import { useMessage } from '/@/hooks/web/useMessage'; | ||
51 | import { deleteMessageTemplate, messageTemplatePage } from '/@/api/message/template'; | 53 | import { deleteMessageTemplate, messageTemplatePage } from '/@/api/message/template'; |
52 | import { useGo } from '/@/hooks/web/usePage'; | 54 | import { useGo } from '/@/hooks/web/usePage'; |
53 | import { PageEnum } from '/@/enums/pageEnum'; | 55 | import { PageEnum } from '/@/enums/pageEnum'; |
@@ -55,6 +57,7 @@ | @@ -55,6 +57,7 @@ | ||
55 | import SendSms from '/@/views/message/template/SendSms.vue'; | 57 | import SendSms from '/@/views/message/template/SendSms.vue'; |
56 | import { MessageEnum } from '/@/enums/messageEnum'; | 58 | import { MessageEnum } from '/@/enums/messageEnum'; |
57 | import SendEmail from '/@/views/message/template/SendEmail.vue'; | 59 | import SendEmail from '/@/views/message/template/SendEmail.vue'; |
60 | + import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | ||
58 | 61 | ||
59 | export default defineComponent({ | 62 | export default defineComponent({ |
60 | name: 'MessageTemplateManagement', | 63 | name: 'MessageTemplateManagement', |
@@ -64,7 +67,10 @@ | @@ -64,7 +67,10 @@ | ||
64 | const [registerMailModal, { openModal: openMailModal }] = useModal(); | 67 | const [registerMailModal, { openModal: openMailModal }] = useModal(); |
65 | const go = useGo(); | 68 | const go = useGo(); |
66 | const [registerDrawer, { openDrawer }] = useDrawer(); | 69 | const [registerDrawer, { openDrawer }] = useDrawer(); |
67 | - const { createMessage } = useMessage(); | 70 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( |
71 | + deleteMessageTemplate, | ||
72 | + handleSuccess | ||
73 | + ); | ||
68 | const [registerTable, { reload }] = useTable({ | 74 | const [registerTable, { reload }] = useTable({ |
69 | title: '消息模板列表', | 75 | title: '消息模板列表', |
70 | api: messageTemplatePage, | 76 | api: messageTemplatePage, |
@@ -84,6 +90,7 @@ | @@ -84,6 +90,7 @@ | ||
84 | slots: { customRender: 'action' }, | 90 | slots: { customRender: 'action' }, |
85 | fixed: 'right', | 91 | fixed: 'right', |
86 | }, | 92 | }, |
93 | + ...selectionOptions, | ||
87 | }); | 94 | }); |
88 | 95 | ||
89 | function handleCreate() { | 96 | function handleCreate() { |
@@ -119,15 +126,6 @@ | @@ -119,15 +126,6 @@ | ||
119 | }); | 126 | }); |
120 | } | 127 | } |
121 | } | 128 | } |
122 | - | ||
123 | - function handleDelete(record: Recordable) { | ||
124 | - let ids = [record.id]; | ||
125 | - deleteMessageTemplate(ids).then((result) => { | ||
126 | - createMessage.success(result.message); | ||
127 | - handleSuccess(); | ||
128 | - }); | ||
129 | - } | ||
130 | - | ||
131 | function handleSuccess() { | 129 | function handleSuccess() { |
132 | reload(); | 130 | reload(); |
133 | } | 131 | } |
@@ -141,10 +139,11 @@ | @@ -141,10 +139,11 @@ | ||
141 | registerMailModal, | 139 | registerMailModal, |
142 | handleCreate, | 140 | handleCreate, |
143 | handleEdit, | 141 | handleEdit, |
144 | - handleDelete, | ||
145 | handleSuccess, | 142 | handleSuccess, |
146 | handleModal, | 143 | handleModal, |
147 | goConfig, | 144 | goConfig, |
145 | + hasBatchDelete, | ||
146 | + handleDeleteOrBatchDelete, | ||
148 | }; | 147 | }; |
149 | }, | 148 | }, |
150 | }); | 149 | }); |
@@ -7,12 +7,8 @@ | @@ -7,12 +7,8 @@ | ||
7 | > | 7 | > |
8 | <template #toolbar> | 8 | <template #toolbar> |
9 | <a-button type="primary" @click="handleAdd"> 新增场景联动 </a-button> | 9 | <a-button type="primary" @click="handleAdd"> 新增场景联动 </a-button> |
10 | - <a-button | ||
11 | - style="background-color: rgba(237, 111, 111, 1)" | ||
12 | - type="default" | ||
13 | - @click="handleToolbarDel" | ||
14 | - > | ||
15 | - <span style="color: white">删除</span> | 10 | + <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete"> |
11 | + 批量删除 | ||
16 | </a-button> | 12 | </a-button> |
17 | </template> | 13 | </template> |
18 | <template #action="{ record }"> | 14 | <template #action="{ record }"> |
@@ -29,7 +25,7 @@ | @@ -29,7 +25,7 @@ | ||
29 | color: 'error', | 25 | color: 'error', |
30 | popConfirm: { | 26 | popConfirm: { |
31 | title: '是否确认删除', | 27 | title: '是否确认删除', |
32 | - confirm: handleDelete.bind(null, record), | 28 | + confirm: handleDeleteOrBatchDelete.bind(null, record), |
33 | }, | 29 | }, |
34 | }, | 30 | }, |
35 | ]" | 31 | ]" |
@@ -52,6 +48,7 @@ | @@ -52,6 +48,7 @@ | ||
52 | import { columns, searchFormSchema } from './config'; | 48 | import { columns, searchFormSchema } from './config'; |
53 | import { useMessage } from '/@/hooks/web/useMessage'; | 49 | import { useMessage } from '/@/hooks/web/useMessage'; |
54 | import { screenLinkPageGetApi, screenLinkPageDeleteApi } from '/@/api/ruleengine/ruleengineApi'; | 50 | import { screenLinkPageGetApi, screenLinkPageDeleteApi } from '/@/api/ruleengine/ruleengineApi'; |
51 | + import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | ||
55 | 52 | ||
56 | export default defineComponent({ | 53 | export default defineComponent({ |
57 | name: 'Index', | 54 | name: 'Index', |
@@ -60,20 +57,22 @@ | @@ -60,20 +57,22 @@ | ||
60 | setup() { | 57 | setup() { |
61 | const { proxy } = getCurrentInstance(); | 58 | const { proxy } = getCurrentInstance(); |
62 | const sceneLinkAgeDrawerRef: any = ref(null); | 59 | const sceneLinkAgeDrawerRef: any = ref(null); |
60 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | ||
61 | + screenLinkPageDeleteApi, | ||
62 | + handleSuccess | ||
63 | + ); | ||
63 | let selectedRowKeys: Array<string> = []; | 64 | let selectedRowKeys: Array<string> = []; |
64 | let echoEditData = reactive({}); | 65 | let echoEditData = reactive({}); |
65 | const [registerDrawer, { openDrawer }] = useDrawer(); | 66 | const [registerDrawer, { openDrawer }] = useDrawer(); |
66 | const { createMessage } = useMessage(); | 67 | const { createMessage } = useMessage(); |
67 | const [registerTable, { reload, getSelectRowKeys }] = useTable({ | 68 | const [registerTable, { reload, getSelectRowKeys }] = useTable({ |
68 | title: '场景联动列表', | 69 | title: '场景联动列表', |
69 | - clickToRowSelect: false, | ||
70 | api: screenLinkPageGetApi, | 70 | api: screenLinkPageGetApi, |
71 | columns, | 71 | columns, |
72 | formConfig: { | 72 | formConfig: { |
73 | labelWidth: 120, | 73 | labelWidth: 120, |
74 | schemas: searchFormSchema, | 74 | schemas: searchFormSchema, |
75 | }, | 75 | }, |
76 | - rowKey: 'id', | ||
77 | useSearchForm: true, | 76 | useSearchForm: true, |
78 | showTableSetting: true, | 77 | showTableSetting: true, |
79 | bordered: true, | 78 | bordered: true, |
@@ -85,6 +84,7 @@ | @@ -85,6 +84,7 @@ | ||
85 | slots: { customRender: 'action' }, | 84 | slots: { customRender: 'action' }, |
86 | fixed: 'right', | 85 | fixed: 'right', |
87 | }, | 86 | }, |
87 | + ...selectionOptions, | ||
88 | }); | 88 | }); |
89 | 89 | ||
90 | function handleAdd() { | 90 | function handleAdd() { |
@@ -146,6 +146,8 @@ | @@ -146,6 +146,8 @@ | ||
146 | handleEdit, | 146 | handleEdit, |
147 | handleDelete, | 147 | handleDelete, |
148 | handleSuccess, | 148 | handleSuccess, |
149 | + hasBatchDelete, | ||
150 | + handleDeleteOrBatchDelete, | ||
149 | }; | 151 | }; |
150 | }, | 152 | }, |
151 | }); | 153 | }); |
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <BasicTable @register="registerTable"> | 3 | <BasicTable @register="registerTable"> |
4 | <template #toolbar> | 4 | <template #toolbar> |
5 | <a-button type="primary" @click="handleAdd">新增通知</a-button> | 5 | <a-button type="primary" @click="handleAdd">新增通知</a-button> |
6 | - <a-button color="error" @click="handleToolbarDel" :disabled="hasBatchDelete"> | 6 | + <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete"> |
7 | 批量删除 | 7 | 批量删除 |
8 | </a-button> | 8 | </a-button> |
9 | </template> | 9 | </template> |
@@ -32,7 +32,7 @@ | @@ -32,7 +32,7 @@ | ||
32 | color: 'error', | 32 | color: 'error', |
33 | popConfirm: { | 33 | popConfirm: { |
34 | title: '是否确认删除', | 34 | title: '是否确认删除', |
35 | - confirm: handleDelete.bind(null, record), | 35 | + confirm: handleDeleteOrBatchDelete.bind(null, record), |
36 | }, | 36 | }, |
37 | }, | 37 | }, |
38 | ]" | 38 | ]" |
@@ -44,14 +44,14 @@ | @@ -44,14 +44,14 @@ | ||
44 | </div> | 44 | </div> |
45 | </template> | 45 | </template> |
46 | <script lang="ts"> | 46 | <script lang="ts"> |
47 | - import { defineComponent, computed, unref, ref } from 'vue'; | 47 | + import { defineComponent } from 'vue'; |
48 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 48 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
49 | import { useDrawer } from '/@/components/Drawer'; | 49 | import { useDrawer } from '/@/components/Drawer'; |
50 | import NotifyManagerDrawer from './useDrawer.vue'; | 50 | import NotifyManagerDrawer from './useDrawer.vue'; |
51 | import tableViewChild from './viewDetailDrawer.vue'; | 51 | import tableViewChild from './viewDetailDrawer.vue'; |
52 | import { columns, searchFormSchema } from './config.d'; | 52 | import { columns, searchFormSchema } from './config.d'; |
53 | - import { useMessage } from '/@/hooks/web/useMessage'; | ||
54 | import { notifyGetTableApi, notifyDeleteApi } from '/@/api/stationnotification/stationnotifyApi'; | 53 | import { notifyGetTableApi, notifyDeleteApi } from '/@/api/stationnotification/stationnotifyApi'; |
54 | + import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | ||
55 | 55 | ||
56 | export default defineComponent({ | 56 | export default defineComponent({ |
57 | name: 'Notificationmannager', | 57 | name: 'Notificationmannager', |
@@ -59,34 +59,19 @@ | @@ -59,34 +59,19 @@ | ||
59 | setup() { | 59 | setup() { |
60 | const [registerDrawer, { openDrawer }] = useDrawer(); | 60 | const [registerDrawer, { openDrawer }] = useDrawer(); |
61 | const [registerAdd, { openDrawer: openDrawerAdd }] = useDrawer(); | 61 | const [registerAdd, { openDrawer: openDrawerAdd }] = useDrawer(); |
62 | - const { createMessage } = useMessage(); | ||
63 | - // 批量删除 | ||
64 | - const selectedRowIds = ref<string[]>([]); | ||
65 | - const hasBatchDelete = computed(() => unref(selectedRowIds).length <= 0); | ||
66 | - const onSelectRowChange = (selectedRowKeys: string[]) => { | ||
67 | - selectedRowIds.value = selectedRowKeys; | ||
68 | - console.log(selectedRowKeys); | ||
69 | - }; | ||
70 | - async function handleToolbarDel() { | ||
71 | - await notifyDeleteApi(selectedRowIds.value); | ||
72 | - createMessage.success('批量删除成功'); | ||
73 | - selectedRowIds.value = []; | ||
74 | - reload(); | ||
75 | - } | ||
76 | 62 | ||
63 | + // 批量删除 | ||
64 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | ||
65 | + notifyDeleteApi, | ||
66 | + handleSuccess | ||
67 | + ); | ||
77 | const [registerTable, { reload }] = useTable({ | 68 | const [registerTable, { reload }] = useTable({ |
78 | - clickToRowSelect: false, | ||
79 | api: notifyGetTableApi, | 69 | api: notifyGetTableApi, |
80 | columns, | 70 | columns, |
81 | formConfig: { | 71 | formConfig: { |
82 | labelWidth: 120, | 72 | labelWidth: 120, |
83 | schemas: searchFormSchema, | 73 | schemas: searchFormSchema, |
84 | }, | 74 | }, |
85 | - rowSelection: { | ||
86 | - onChange: onSelectRowChange, | ||
87 | - type: 'checkbox', | ||
88 | - }, | ||
89 | - rowKey: 'id', | ||
90 | useSearchForm: true, | 75 | useSearchForm: true, |
91 | showTableSetting: true, | 76 | showTableSetting: true, |
92 | bordered: true, | 77 | bordered: true, |
@@ -98,6 +83,7 @@ | @@ -98,6 +83,7 @@ | ||
98 | slots: { customRender: 'action' }, | 83 | slots: { customRender: 'action' }, |
99 | fixed: 'right', | 84 | fixed: 'right', |
100 | }, | 85 | }, |
86 | + ...selectionOptions, | ||
101 | }); | 87 | }); |
102 | 88 | ||
103 | function handleAdd() { | 89 | function handleAdd() { |
@@ -117,12 +103,6 @@ | @@ -117,12 +103,6 @@ | ||
117 | isUpdate: true, | 103 | isUpdate: true, |
118 | }); | 104 | }); |
119 | } | 105 | } |
120 | - async function handleDelete(record: Recordable) { | ||
121 | - let ids = [record.id]; | ||
122 | - await notifyDeleteApi(ids); | ||
123 | - createMessage.success('删除成功'); | ||
124 | - reload(); | ||
125 | - } | ||
126 | function handleSuccess() { | 106 | function handleSuccess() { |
127 | reload(); | 107 | reload(); |
128 | } | 108 | } |
@@ -133,11 +113,9 @@ | @@ -133,11 +113,9 @@ | ||
133 | registerTable, | 113 | registerTable, |
134 | registerDrawer, | 114 | registerDrawer, |
135 | handleAdd, | 115 | handleAdd, |
136 | - handleToolbarDel, | ||
137 | handleEdit, | 116 | handleEdit, |
138 | - handleDelete, | ||
139 | handleSuccess, | 117 | handleSuccess, |
140 | - onSelectRowChange, | 118 | + handleDeleteOrBatchDelete, |
141 | }; | 119 | }; |
142 | }, | 120 | }, |
143 | }); | 121 | }); |
@@ -3,27 +3,21 @@ | @@ -3,27 +3,21 @@ | ||
3 | <BasicDrawer | 3 | <BasicDrawer |
4 | v-bind="$attrs" | 4 | v-bind="$attrs" |
5 | @register="registerDrawer" | 5 | @register="registerDrawer" |
6 | - :showFooter="false" | ||
7 | :title="getTitle" | 6 | :title="getTitle" |
8 | width="800px" | 7 | width="800px" |
8 | + showFooter | ||
9 | > | 9 | > |
10 | - <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm"> | ||
11 | - <template #add> | ||
12 | - <Button style="margin-left: 30px; margin-top: 80px" type="primary" @click="handleCancel" | ||
13 | - >取消</Button | ||
14 | - > | ||
15 | - <Button style="margin-left: 30px" type="primary" @click="handleSaveDraft" | ||
16 | - >保存草稿</Button | ||
17 | - > | ||
18 | - <Button style="margin-left: 30px" type="primary" @click="handleSend">发布通知</Button> | ||
19 | - </template> | ||
20 | - </BasicForm> | 10 | + <BasicForm @register="registerForm" /> |
11 | + <template #footer> | ||
12 | + <a-button @click="handleCancel">取消</a-button> | ||
13 | + <a-button @click="handleSaveDraft">保存草稿</a-button> | ||
14 | + <a-button type="primary" @click="handleSend">发布通知</a-button> | ||
15 | + </template> | ||
21 | </BasicDrawer> | 16 | </BasicDrawer> |
22 | </div> | 17 | </div> |
23 | </template> | 18 | </template> |
24 | <script lang="ts"> | 19 | <script lang="ts"> |
25 | import { defineComponent, computed, unref, ref } from 'vue'; | 20 | import { defineComponent, computed, unref, ref } from 'vue'; |
26 | - import { Button } from '/@/components/Button'; | ||
27 | import { BasicForm, useForm } from '/@/components/Form'; | 21 | import { BasicForm, useForm } from '/@/components/Form'; |
28 | import { formSchema } from './config.d'; | 22 | import { formSchema } from './config.d'; |
29 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 23 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
@@ -34,7 +28,7 @@ | @@ -34,7 +28,7 @@ | ||
34 | import { useMessage } from '/@/hooks/web/useMessage'; | 28 | import { useMessage } from '/@/hooks/web/useMessage'; |
35 | export default defineComponent({ | 29 | export default defineComponent({ |
36 | name: 'ConfigDrawer', | 30 | name: 'ConfigDrawer', |
37 | - components: { BasicDrawer, BasicForm, Button }, | 31 | + components: { BasicDrawer, BasicForm }, |
38 | emits: ['success', 'register'], | 32 | emits: ['success', 'register'], |
39 | setup(_, { emit }) { | 33 | setup(_, { emit }) { |
40 | const { createMessage } = useMessage(); | 34 | const { createMessage } = useMessage(); |
@@ -54,6 +48,7 @@ | @@ -54,6 +48,7 @@ | ||
54 | noticeId.value = data.record.id; | 48 | noticeId.value = data.record.id; |
55 | Reflect.set(data.record, 'receiverType', data.record.receiverType === '全部' ? '0' : '1'); | 49 | Reflect.set(data.record, 'receiverType', data.record.receiverType === '全部' ? '0' : '1'); |
56 | if (data.record.receiverType === '1') { | 50 | if (data.record.receiverType === '1') { |
51 | + if (!data.record.pointId.length) return; | ||
57 | const organizationId = data.record.pointId.split(','); | 52 | const organizationId = data.record.pointId.split(','); |
58 | Reflect.set(data.record, 'organizationId', organizationId); | 53 | Reflect.set(data.record, 'organizationId', organizationId); |
59 | } | 54 | } |
@@ -108,7 +103,7 @@ | @@ -108,7 +103,7 @@ | ||
108 | createMessage.success('保存草稿成功'); | 103 | createMessage.success('保存草稿成功'); |
109 | }; | 104 | }; |
110 | const handleCancel = () => { | 105 | const handleCancel = () => { |
111 | - resetFields(); | 106 | + // resetFields(); |
112 | closeDrawer(); | 107 | closeDrawer(); |
113 | }; | 108 | }; |
114 | return { | 109 | return { |
@@ -9,6 +9,13 @@ | @@ -9,6 +9,13 @@ | ||
9 | <BasicTable @register="registerTable" class="w-3/4 xl:w-4/5"> | 9 | <BasicTable @register="registerTable" class="w-3/4 xl:w-4/5"> |
10 | <template #toolbar> | 10 | <template #toolbar> |
11 | <a-button type="primary" @click="handleCreate">新增账号</a-button> | 11 | <a-button type="primary" @click="handleCreate">新增账号</a-button> |
12 | + <a-button | ||
13 | + color="error" | ||
14 | + @click="handleDeleteOrBatchDelete(null)" | ||
15 | + :disabled="hasBatchDelete" | ||
16 | + > | ||
17 | + 批量删除 | ||
18 | + </a-button> | ||
12 | </template> | 19 | </template> |
13 | <template #status="{ record }"> | 20 | <template #status="{ record }"> |
14 | <Tag | 21 | <Tag |
@@ -54,7 +61,7 @@ | @@ -54,7 +61,7 @@ | ||
54 | ifShow: record.level != 0, | 61 | ifShow: record.level != 0, |
55 | popConfirm: { | 62 | popConfirm: { |
56 | title: '是否确认删除', | 63 | title: '是否确认删除', |
57 | - confirm: handleDelete.bind(null, record), | 64 | + confirm: handleDeleteOrBatchDelete.bind(null, record), |
58 | }, | 65 | }, |
59 | }, | 66 | }, |
60 | ]" | 67 | ]" |
@@ -74,18 +81,19 @@ | @@ -74,18 +81,19 @@ | ||
74 | import { Tag } from 'ant-design-vue'; | 81 | import { Tag } from 'ant-design-vue'; |
75 | import { useModal } from '/@/components/Modal'; | 82 | import { useModal } from '/@/components/Modal'; |
76 | import AccountModal from './AccountModal.vue'; | 83 | import AccountModal from './AccountModal.vue'; |
77 | - | ||
78 | import { columns, searchFormSchema } from './account.data'; | 84 | import { columns, searchFormSchema } from './account.data'; |
79 | import { useGo } from '/@/hooks/web/usePage'; | 85 | import { useGo } from '/@/hooks/web/usePage'; |
80 | - import { useMessage } from '/@/hooks/web/useMessage'; | ||
81 | - | 86 | + import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
82 | export default defineComponent({ | 87 | export default defineComponent({ |
83 | name: 'AccountManagement', | 88 | name: 'AccountManagement', |
84 | components: { BasicTable, PageWrapper, OrganizationIdTree, AccountModal, TableAction, Tag }, | 89 | components: { BasicTable, PageWrapper, OrganizationIdTree, AccountModal, TableAction, Tag }, |
85 | setup() { | 90 | setup() { |
86 | const go = useGo(); | 91 | const go = useGo(); |
92 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | ||
93 | + deleteUser, | ||
94 | + handleSuccess | ||
95 | + ); | ||
87 | const [registerModal, { openModal }] = useModal(); | 96 | const [registerModal, { openModal }] = useModal(); |
88 | - const { createMessage } = useMessage(); | ||
89 | let searchInfo = reactive<Recordable>({}); | 97 | let searchInfo = reactive<Recordable>({}); |
90 | const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); | 98 | const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); |
91 | const [registerTable, { reload }] = useTable({ | 99 | const [registerTable, { reload }] = useTable({ |
@@ -109,6 +117,7 @@ | @@ -109,6 +117,7 @@ | ||
109 | dataIndex: 'action', | 117 | dataIndex: 'action', |
110 | slots: { customRender: 'action' }, | 118 | slots: { customRender: 'action' }, |
111 | }, | 119 | }, |
120 | + ...selectionOptions, | ||
112 | }); | 121 | }); |
113 | 122 | ||
114 | function handleCreate() { | 123 | function handleCreate() { |
@@ -122,15 +131,6 @@ | @@ -122,15 +131,6 @@ | ||
122 | isUpdate: true, | 131 | isUpdate: true, |
123 | }); | 132 | }); |
124 | } | 133 | } |
125 | - | ||
126 | - function handleDelete(record: Recordable) { | ||
127 | - let ids = [record.id]; | ||
128 | - deleteUser(ids).then(() => { | ||
129 | - createMessage.success('删除成功'); | ||
130 | - reload(); | ||
131 | - }); | ||
132 | - } | ||
133 | - | ||
134 | function handleSuccess() { | 134 | function handleSuccess() { |
135 | reload(); | 135 | reload(); |
136 | } | 136 | } |
@@ -149,11 +149,12 @@ | @@ -149,11 +149,12 @@ | ||
149 | registerModal, | 149 | registerModal, |
150 | handleCreate, | 150 | handleCreate, |
151 | handleEdit, | 151 | handleEdit, |
152 | - handleDelete, | ||
153 | handleSuccess, | 152 | handleSuccess, |
154 | handleSelect, | 153 | handleSelect, |
155 | handleView, | 154 | handleView, |
156 | organizationIdTreeRef, | 155 | organizationIdTreeRef, |
156 | + hasBatchDelete, | ||
157 | + handleDeleteOrBatchDelete, | ||
157 | }; | 158 | }; |
158 | }, | 159 | }, |
159 | }); | 160 | }); |
@@ -3,6 +3,9 @@ | @@ -3,6 +3,9 @@ | ||
3 | <BasicTable @register="registerTable"> | 3 | <BasicTable @register="registerTable"> |
4 | <template #toolbar> | 4 | <template #toolbar> |
5 | <a-button type="primary" @click="handleCreate"> 新增字典 </a-button> | 5 | <a-button type="primary" @click="handleCreate"> 新增字典 </a-button> |
6 | + <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete"> | ||
7 | + 批量删除 | ||
8 | + </a-button> | ||
6 | </template> | 9 | </template> |
7 | <template #action="{ record }"> | 10 | <template #action="{ record }"> |
8 | <TableAction | 11 | <TableAction |
@@ -23,7 +26,7 @@ | @@ -23,7 +26,7 @@ | ||
23 | color: 'error', | 26 | color: 'error', |
24 | popConfirm: { | 27 | popConfirm: { |
25 | title: '是否确认删除', | 28 | title: '是否确认删除', |
26 | - confirm: handleDelete.bind(null, record), | 29 | + confirm: handleDeleteOrBatchDelete.bind(null, record), |
27 | }, | 30 | }, |
28 | }, | 31 | }, |
29 | ]" | 32 | ]" |
@@ -51,15 +54,19 @@ | @@ -51,15 +54,19 @@ | ||
51 | 54 | ||
52 | import { columns, searchFormSchema } from './dict.data'; | 55 | import { columns, searchFormSchema } from './dict.data'; |
53 | import { Tag } from 'ant-design-vue'; | 56 | import { Tag } from 'ant-design-vue'; |
54 | - import { useMessage } from '/@/hooks/web/useMessage'; | 57 | + |
58 | + import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | ||
55 | 59 | ||
56 | export default defineComponent({ | 60 | export default defineComponent({ |
57 | name: 'DictManagement', | 61 | name: 'DictManagement', |
58 | components: { BasicTable, DictDrawer, ItemIndex, TableAction, Tag }, | 62 | components: { BasicTable, DictDrawer, ItemIndex, TableAction, Tag }, |
59 | setup() { | 63 | setup() { |
60 | - const { createMessage } = useMessage(); | ||
61 | const [registerDrawer, { openDrawer: openDrawer }] = useDrawer(); | 64 | const [registerDrawer, { openDrawer: openDrawer }] = useDrawer(); |
62 | const [registerItemDrawer, { openDrawer: openItemDrawer }] = useDrawer(); | 65 | const [registerItemDrawer, { openDrawer: openItemDrawer }] = useDrawer(); |
66 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | ||
67 | + deleteDict, | ||
68 | + handleSuccess | ||
69 | + ); | ||
63 | const [registerTable, { reload }] = useTable({ | 70 | const [registerTable, { reload }] = useTable({ |
64 | title: '字典配置列表', | 71 | title: '字典配置列表', |
65 | api: sysDictPage, | 72 | api: sysDictPage, |
@@ -79,6 +86,7 @@ | @@ -79,6 +86,7 @@ | ||
79 | slots: { customRender: 'action' }, | 86 | slots: { customRender: 'action' }, |
80 | fixed: 'right', | 87 | fixed: 'right', |
81 | }, | 88 | }, |
89 | + ...selectionOptions, | ||
82 | }); | 90 | }); |
83 | 91 | ||
84 | function handleCreate() { | 92 | function handleCreate() { |
@@ -100,14 +108,6 @@ | @@ -100,14 +108,6 @@ | ||
100 | }); | 108 | }); |
101 | } | 109 | } |
102 | 110 | ||
103 | - function handleDelete(record: Recordable) { | ||
104 | - let ids = [record.id]; | ||
105 | - deleteDict(ids).then((result) => { | ||
106 | - createMessage.success(result.message); | ||
107 | - handleSuccess(); | ||
108 | - }); | ||
109 | - } | ||
110 | - | ||
111 | function handleSuccess() { | 111 | function handleSuccess() { |
112 | reload(); | 112 | reload(); |
113 | } | 113 | } |
@@ -119,8 +119,10 @@ | @@ -119,8 +119,10 @@ | ||
119 | handleCreate, | 119 | handleCreate, |
120 | handleEdit, | 120 | handleEdit, |
121 | handleItem, | 121 | handleItem, |
122 | - handleDelete, | 122 | + |
123 | handleSuccess, | 123 | handleSuccess, |
124 | + hasBatchDelete, | ||
125 | + handleDeleteOrBatchDelete, | ||
124 | }; | 126 | }; |
125 | }, | 127 | }, |
126 | }); | 128 | }); |
@@ -5,6 +5,9 @@ | @@ -5,6 +5,9 @@ | ||
5 | <a-button type="primary" @click="handleCreate"> | 5 | <a-button type="primary" @click="handleCreate"> |
6 | {{ getI18nCreateMenu }} | 6 | {{ getI18nCreateMenu }} |
7 | </a-button> | 7 | </a-button> |
8 | + <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete"> | ||
9 | + 批量删除 | ||
10 | + </a-button> | ||
8 | </template> | 11 | </template> |
9 | <template #action="{ record }"> | 12 | <template #action="{ record }"> |
10 | <TableAction | 13 | <TableAction |
@@ -53,6 +56,7 @@ | @@ -53,6 +56,7 @@ | ||
53 | import { columns } from './menu.data'; | 56 | import { columns } from './menu.data'; |
54 | import { useI18n } from '/@/hooks/web/useI18n'; | 57 | import { useI18n } from '/@/hooks/web/useI18n'; |
55 | import { notification } from 'ant-design-vue'; | 58 | import { notification } from 'ant-design-vue'; |
59 | + import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | ||
56 | 60 | ||
57 | // 自定义表格组件和属性 | 61 | // 自定义表格组件和属性 |
58 | export default defineComponent({ | 62 | export default defineComponent({ |
@@ -63,18 +67,17 @@ | @@ -63,18 +67,17 @@ | ||
63 | const { t } = useI18n(); //加载国际化 | 67 | const { t } = useI18n(); //加载国际化 |
64 | // 新增菜单 | 68 | // 新增菜单 |
65 | const getI18nCreateMenu = computed(() => t('routes.common.system.pageSystemTitleCreateMenu')); | 69 | const getI18nCreateMenu = computed(() => t('routes.common.system.pageSystemTitleCreateMenu')); |
70 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | ||
71 | + delMenu, | ||
72 | + handleSuccess | ||
73 | + ); | ||
66 | const [registerTable, { reload, expandAll }] = useTable({ | 74 | const [registerTable, { reload, expandAll }] = useTable({ |
67 | title: t('routes.common.system.pageSystemTitleMenuList'), //'菜单列表' | 75 | title: t('routes.common.system.pageSystemTitleMenuList'), //'菜单列表' |
68 | api: getMenuList, //加载数据 | 76 | api: getMenuList, //加载数据 |
69 | columns, //加载列 | 77 | columns, //加载列 |
70 | - // formConfig: { | ||
71 | - // labelWidth: 120, | ||
72 | - // schemas: searchFormSchema, | ||
73 | - // }, | ||
74 | isTreeTable: true, | 78 | isTreeTable: true, |
75 | pagination: false, | 79 | pagination: false, |
76 | striped: false, | 80 | striped: false, |
77 | - // useSearchForm: true, | ||
78 | showTableSetting: true, | 81 | showTableSetting: true, |
79 | bordered: true, | 82 | bordered: true, |
80 | showIndexColumn: false, | 83 | showIndexColumn: false, |
@@ -86,6 +89,7 @@ | @@ -86,6 +89,7 @@ | ||
86 | slots: { customRender: 'action' }, | 89 | slots: { customRender: 'action' }, |
87 | fixed: 'right', | 90 | fixed: 'right', |
88 | }, | 91 | }, |
92 | + ...selectionOptions, | ||
89 | }); | 93 | }); |
90 | 94 | ||
91 | /** | 95 | /** |
@@ -157,6 +161,8 @@ | @@ -157,6 +161,8 @@ | ||
157 | handleDelete, | 161 | handleDelete, |
158 | handleSuccess, | 162 | handleSuccess, |
159 | onFetchSuccess, | 163 | onFetchSuccess, |
164 | + hasBatchDelete, | ||
165 | + handleDeleteOrBatchDelete, | ||
160 | }; | 166 | }; |
161 | }, | 167 | }, |
162 | }); | 168 | }); |
@@ -5,6 +5,9 @@ | @@ -5,6 +5,9 @@ | ||
5 | <a-button type="primary" @click="handleCreate"> | 5 | <a-button type="primary" @click="handleCreate"> |
6 | {{ getI18n }} | 6 | {{ getI18n }} |
7 | </a-button> | 7 | </a-button> |
8 | + <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete"> | ||
9 | + 批量删除 | ||
10 | + </a-button> | ||
8 | </template> | 11 | </template> |
9 | <template #action="{ record }"> | 12 | <template #action="{ record }"> |
10 | <TableAction | 13 | <TableAction |
@@ -20,7 +23,7 @@ | @@ -20,7 +23,7 @@ | ||
20 | color: 'error', | 23 | color: 'error', |
21 | popConfirm: { | 24 | popConfirm: { |
22 | title: getDeleteTitle(), //是否确认删除//getDeleteTitle() | 25 | title: getDeleteTitle(), //是否确认删除//getDeleteTitle() |
23 | - confirm: handleDelete.bind(null, record), | 26 | + confirm: handleDeleteOrBatchDelete.bind(null, record), |
24 | }, | 27 | }, |
25 | }, | 28 | }, |
26 | ]" | 29 | ]" |
@@ -32,18 +35,14 @@ | @@ -32,18 +35,14 @@ | ||
32 | </template> | 35 | </template> |
33 | <script lang="ts"> | 36 | <script lang="ts"> |
34 | import { computed, defineComponent, nextTick } from 'vue'; | 37 | import { computed, defineComponent, nextTick } from 'vue'; |
35 | - | ||
36 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 38 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
37 | - | ||
38 | // 加载自定义侧边弹出框 组件 | 39 | // 加载自定义侧边弹出框 组件 |
39 | - | ||
40 | import { useDrawer } from '/@/components/Drawer'; | 40 | import { useDrawer } from '/@/components/Drawer'; |
41 | import DeptDrawer from './OrganizationDrawer.vue'; | 41 | import DeptDrawer from './OrganizationDrawer.vue'; |
42 | import { columns } from './organization.data'; | 42 | import { columns } from './organization.data'; |
43 | import { useI18n } from '/@/hooks/web/useI18n'; | 43 | import { useI18n } from '/@/hooks/web/useI18n'; |
44 | import { delOrganization, getOrganizationList } from '/@/api/system/system'; | 44 | import { delOrganization, getOrganizationList } from '/@/api/system/system'; |
45 | - import { useMessage } from '/@/hooks/web/useMessage'; | ||
46 | - | 45 | + import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
47 | export default defineComponent({ | 46 | export default defineComponent({ |
48 | name: 'DeptManagement', | 47 | name: 'DeptManagement', |
49 | components: { BasicTable, DeptDrawer, TableAction }, | 48 | components: { BasicTable, DeptDrawer, TableAction }, |
@@ -51,7 +50,10 @@ | @@ -51,7 +50,10 @@ | ||
51 | const [registerModal, { openDrawer }] = useDrawer(); | 50 | const [registerModal, { openDrawer }] = useDrawer(); |
52 | const { t } = useI18n(); //加载国际化 | 51 | const { t } = useI18n(); //加载国际化 |
53 | const getI18n = computed(() => t('routes.common.organization.toolCreateOrganization')); | 52 | const getI18n = computed(() => t('routes.common.organization.toolCreateOrganization')); |
54 | - const { createMessage } = useMessage(); | 53 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( |
54 | + delOrganization, | ||
55 | + handleSuccess | ||
56 | + ); | ||
55 | const [registerTable, { reload, expandAll }] = useTable({ | 57 | const [registerTable, { reload, expandAll }] = useTable({ |
56 | title: t('routes.common.organization.toolOrganizationList'), | 58 | title: t('routes.common.organization.toolOrganizationList'), |
57 | api: getOrganizationList, | 59 | api: getOrganizationList, |
@@ -71,6 +73,7 @@ | @@ -71,6 +73,7 @@ | ||
71 | slots: { customRender: 'action' }, | 73 | slots: { customRender: 'action' }, |
72 | fixed: 'right', | 74 | fixed: 'right', |
73 | }, | 75 | }, |
76 | + ...selectionOptions, | ||
74 | }); | 77 | }); |
75 | /** | 78 | /** |
76 | * 获得删除提示框的文字 | 79 | * 获得删除提示框的文字 |
@@ -93,17 +96,6 @@ | @@ -93,17 +96,6 @@ | ||
93 | }); | 96 | }); |
94 | } | 97 | } |
95 | 98 | ||
96 | - async function handleDelete(record: Recordable) { | ||
97 | - try { | ||
98 | - let ids = [record.id]; | ||
99 | - await delOrganization(ids); | ||
100 | - createMessage.success('删除组织成功'); | ||
101 | - handleSuccess(); | ||
102 | - } catch (e) { | ||
103 | - return e; | ||
104 | - } | ||
105 | - } | ||
106 | - | ||
107 | function handleSuccess() { | 99 | function handleSuccess() { |
108 | reload(); | 100 | reload(); |
109 | } | 101 | } |
@@ -120,9 +112,10 @@ | @@ -120,9 +112,10 @@ | ||
120 | getDeleteTitle, | 112 | getDeleteTitle, |
121 | handleCreate, | 113 | handleCreate, |
122 | handleEdit, | 114 | handleEdit, |
123 | - handleDelete, | ||
124 | handleSuccess, | 115 | handleSuccess, |
125 | onFetchSuccess, | 116 | onFetchSuccess, |
117 | + hasBatchDelete, | ||
118 | + handleDeleteOrBatchDelete, | ||
126 | }; | 119 | }; |
127 | }, | 120 | }, |
128 | }); | 121 | }); |
@@ -3,6 +3,9 @@ | @@ -3,6 +3,9 @@ | ||
3 | <BasicTable @register="registerTable"> | 3 | <BasicTable @register="registerTable"> |
4 | <template #toolbar> | 4 | <template #toolbar> |
5 | <a-button type="primary" @click="handleCreate">新增角色</a-button> | 5 | <a-button type="primary" @click="handleCreate">新增角色</a-button> |
6 | + <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete"> | ||
7 | + 批量删除 | ||
8 | + </a-button> | ||
6 | </template> | 9 | </template> |
7 | <template #action="{ record }"> | 10 | <template #action="{ record }"> |
8 | <TableAction | 11 | <TableAction |
@@ -19,7 +22,7 @@ | @@ -19,7 +22,7 @@ | ||
19 | ifShow: record.roleType != RoleEnum.SYS_ADMIN, | 22 | ifShow: record.roleType != RoleEnum.SYS_ADMIN, |
20 | popConfirm: { | 23 | popConfirm: { |
21 | title: '是否确认删除', | 24 | title: '是否确认删除', |
22 | - confirm: handleDelete.bind(null, record), | 25 | + confirm: handleDeleteOrBatchDelete.bind(null, record), |
23 | }, | 26 | }, |
24 | }, | 27 | }, |
25 | ]" | 28 | ]" |
@@ -39,12 +42,16 @@ | @@ -39,12 +42,16 @@ | ||
39 | import RoleDrawer from './RoleDrawer.vue'; | 42 | import RoleDrawer from './RoleDrawer.vue'; |
40 | import { columns, searchFormSchema } from './role.data'; | 43 | import { columns, searchFormSchema } from './role.data'; |
41 | import { RoleEnum } from '/@/enums/roleEnum'; | 44 | import { RoleEnum } from '/@/enums/roleEnum'; |
42 | - | 45 | + import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
43 | export default defineComponent({ | 46 | export default defineComponent({ |
44 | name: 'RoleManagement', | 47 | name: 'RoleManagement', |
45 | components: { BasicTable, RoleDrawer, TableAction }, | 48 | components: { BasicTable, RoleDrawer, TableAction }, |
46 | setup() { | 49 | setup() { |
47 | const [registerDrawer, { openDrawer }] = useDrawer(); | 50 | const [registerDrawer, { openDrawer }] = useDrawer(); |
51 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | ||
52 | + delRole, | ||
53 | + handleSuccess | ||
54 | + ); | ||
48 | const [registerTable, { reload }] = useTable({ | 55 | const [registerTable, { reload }] = useTable({ |
49 | title: '角色列表', | 56 | title: '角色列表', |
50 | api: getRoleListByPage, | 57 | api: getRoleListByPage, |
@@ -64,6 +71,7 @@ | @@ -64,6 +71,7 @@ | ||
64 | slots: { customRender: 'action' }, | 71 | slots: { customRender: 'action' }, |
65 | fixed: 'right', | 72 | fixed: 'right', |
66 | }, | 73 | }, |
74 | + ...selectionOptions, | ||
67 | }); | 75 | }); |
68 | 76 | ||
69 | function handleCreate() { | 77 | function handleCreate() { |
@@ -78,13 +86,6 @@ | @@ -78,13 +86,6 @@ | ||
78 | isUpdate: true, | 86 | isUpdate: true, |
79 | }); | 87 | }); |
80 | } | 88 | } |
81 | - | ||
82 | - async function handleDelete(record: Recordable) { | ||
83 | - const roleIds = [record.id]; | ||
84 | - delRole(roleIds).then(() => { | ||
85 | - reload(); | ||
86 | - }); | ||
87 | - } | ||
88 | function handleSuccess() { | 89 | function handleSuccess() { |
89 | reload(); | 90 | reload(); |
90 | } | 91 | } |
@@ -94,9 +95,10 @@ | @@ -94,9 +95,10 @@ | ||
94 | registerDrawer, | 95 | registerDrawer, |
95 | handleCreate, | 96 | handleCreate, |
96 | handleEdit, | 97 | handleEdit, |
97 | - handleDelete, | ||
98 | handleSuccess, | 98 | handleSuccess, |
99 | RoleEnum, | 99 | RoleEnum, |
100 | + hasBatchDelete, | ||
101 | + handleDeleteOrBatchDelete, | ||
100 | }; | 102 | }; |
101 | }, | 103 | }, |
102 | }); | 104 | }); |
@@ -14,6 +14,19 @@ export const schemas: FormSchema[] = [ | @@ -14,6 +14,19 @@ export const schemas: FormSchema[] = [ | ||
14 | maxLength: 100, | 14 | maxLength: 100, |
15 | placeholder: '请输入公司名称', | 15 | placeholder: '请输入公司名称', |
16 | }, | 16 | }, |
17 | + dynamicRules: () => { | ||
18 | + return [ | ||
19 | + { | ||
20 | + required: false, | ||
21 | + validator: (_, value) => { | ||
22 | + if (String(value).length > 100) { | ||
23 | + return Promise.reject('字数不超过100个字'); | ||
24 | + } | ||
25 | + return Promise.resolve(); | ||
26 | + }, | ||
27 | + }, | ||
28 | + ]; | ||
29 | + }, | ||
17 | }, | 30 | }, |
18 | { | 31 | { |
19 | field: 'abbreviation', | 32 | field: 'abbreviation', |
@@ -26,6 +39,19 @@ export const schemas: FormSchema[] = [ | @@ -26,6 +39,19 @@ export const schemas: FormSchema[] = [ | ||
26 | maxLength: 100, | 39 | maxLength: 100, |
27 | placeholder: '请输入公司简称', | 40 | placeholder: '请输入公司简称', |
28 | }, | 41 | }, |
42 | + dynamicRules: () => { | ||
43 | + return [ | ||
44 | + { | ||
45 | + required: false, | ||
46 | + validator: (_, value) => { | ||
47 | + if (String(value).length > 100) { | ||
48 | + return Promise.reject('字数不超过100个字'); | ||
49 | + } | ||
50 | + return Promise.resolve(); | ||
51 | + }, | ||
52 | + }, | ||
53 | + ]; | ||
54 | + }, | ||
29 | }, | 55 | }, |
30 | { | 56 | { |
31 | field: 'officialWebsite', | 57 | field: 'officialWebsite', |
@@ -38,6 +64,19 @@ export const schemas: FormSchema[] = [ | @@ -38,6 +64,19 @@ export const schemas: FormSchema[] = [ | ||
38 | maxLength: 255, | 64 | maxLength: 255, |
39 | placeholder: '请输入公司官网', | 65 | placeholder: '请输入公司官网', |
40 | }, | 66 | }, |
67 | + dynamicRules: () => { | ||
68 | + return [ | ||
69 | + { | ||
70 | + required: false, | ||
71 | + validator: (_, value) => { | ||
72 | + if (String(value).length > 255) { | ||
73 | + return Promise.reject('字数不超过255个字'); | ||
74 | + } | ||
75 | + return Promise.resolve(); | ||
76 | + }, | ||
77 | + }, | ||
78 | + ]; | ||
79 | + }, | ||
41 | }, | 80 | }, |
42 | { | 81 | { |
43 | field: 'email', | 82 | field: 'email', |
@@ -63,6 +102,20 @@ export const schemas: FormSchema[] = [ | @@ -63,6 +102,20 @@ export const schemas: FormSchema[] = [ | ||
63 | maxLength: 500, | 102 | maxLength: 500, |
64 | placeholder: '请输入公司简介', | 103 | placeholder: '请输入公司简介', |
65 | autoSize: { minRows: 8, maxRows: 12 }, | 104 | autoSize: { minRows: 8, maxRows: 12 }, |
105 | + showCount: true, | ||
106 | + }, | ||
107 | + dynamicRules: () => { | ||
108 | + return [ | ||
109 | + { | ||
110 | + required: false, | ||
111 | + validator: (_, value) => { | ||
112 | + if (String(value).length > 500) { | ||
113 | + return Promise.reject('字数不超过500个字'); | ||
114 | + } | ||
115 | + return Promise.resolve(); | ||
116 | + }, | ||
117 | + }, | ||
118 | + ]; | ||
66 | }, | 119 | }, |
67 | }, | 120 | }, |
68 | { | 121 | { |
@@ -77,7 +130,7 @@ export const schemas: FormSchema[] = [ | @@ -77,7 +130,7 @@ export const schemas: FormSchema[] = [ | ||
77 | params: { parentId: 0 }, | 130 | params: { parentId: 0 }, |
78 | labelField: 'name', | 131 | labelField: 'name', |
79 | valueField: 'code', | 132 | valueField: 'code', |
80 | - placeholder: '请选择国家/地区', | 133 | + placeholder: '国家/地区', |
81 | }, | 134 | }, |
82 | }, | 135 | }, |
83 | { | 136 | { |
@@ -105,18 +158,21 @@ export const schemas: FormSchema[] = [ | @@ -105,18 +158,21 @@ export const schemas: FormSchema[] = [ | ||
105 | field: 'nameCity', | 158 | field: 'nameCity', |
106 | componentProps: { | 159 | componentProps: { |
107 | options: [], | 160 | options: [], |
161 | + placeholder: '城市', | ||
108 | }, | 162 | }, |
109 | }, | 163 | }, |
110 | { | 164 | { |
111 | field: 'nameCoun', | 165 | field: 'nameCoun', |
112 | componentProps: { | 166 | componentProps: { |
113 | options: [], | 167 | options: [], |
168 | + placeholder: '区/县', | ||
114 | }, | 169 | }, |
115 | }, | 170 | }, |
116 | { | 171 | { |
117 | field: 'nameTown', | 172 | field: 'nameTown', |
118 | componentProps: { | 173 | componentProps: { |
119 | options: [], | 174 | options: [], |
175 | + placeholder: '城镇/街道', | ||
120 | }, | 176 | }, |
121 | }, | 177 | }, |
122 | ]); | 178 | ]); |
@@ -204,11 +260,12 @@ export const schemas: FormSchema[] = [ | @@ -204,11 +260,12 @@ export const schemas: FormSchema[] = [ | ||
204 | field: 'nameCity', | 260 | field: 'nameCity', |
205 | component: 'Select', | 261 | component: 'Select', |
206 | label: '', | 262 | label: '', |
207 | - componentProps: { | ||
208 | - placeholder: '城市', | ||
209 | - }, | 263 | + labelWidth: 0, |
210 | colProps: { | 264 | colProps: { |
211 | span: 5, | 265 | span: 5, |
266 | + style: { | ||
267 | + marginLeft: '-5rem', | ||
268 | + }, | ||
212 | }, | 269 | }, |
213 | }, | 270 | }, |
214 | { | 271 | { |
@@ -216,7 +273,10 @@ export const schemas: FormSchema[] = [ | @@ -216,7 +273,10 @@ export const schemas: FormSchema[] = [ | ||
216 | component: 'Select', | 273 | component: 'Select', |
217 | label: '', | 274 | label: '', |
218 | colProps: { | 275 | colProps: { |
219 | - span: 3, | 276 | + span: 5, |
277 | + style: { | ||
278 | + marginLeft: '-10rem', | ||
279 | + }, | ||
220 | }, | 280 | }, |
221 | componentProps: { | 281 | componentProps: { |
222 | placeholder: '区/县', | 282 | placeholder: '区/县', |
@@ -228,6 +288,9 @@ export const schemas: FormSchema[] = [ | @@ -228,6 +288,9 @@ export const schemas: FormSchema[] = [ | ||
228 | label: '', | 288 | label: '', |
229 | colProps: { | 289 | colProps: { |
230 | span: 6, | 290 | span: 6, |
291 | + style: { | ||
292 | + marginLeft: '-10rem', | ||
293 | + }, | ||
231 | }, | 294 | }, |
232 | componentProps: { | 295 | componentProps: { |
233 | placeholder: '城镇/街道', | 296 | placeholder: '城镇/街道', |
@@ -137,21 +137,18 @@ | @@ -137,21 +137,18 @@ | ||
137 | 137 | ||
138 | // 地区显示回显和数据联动 | 138 | // 地区显示回显和数据联动 |
139 | async function updateCityData( | 139 | async function updateCityData( |
140 | - provs: CityItem[], | ||
141 | cities: CityItem[], | 140 | cities: CityItem[], |
142 | couns: CityItem[], | 141 | couns: CityItem[], |
143 | towns: CityItem[], | 142 | towns: CityItem[], |
144 | code: Code | 143 | code: Code |
145 | ) { | 144 | ) { |
146 | // 加工后端返回字段 | 145 | // 加工后端返回字段 |
147 | - provs.forEach((item) => { | ||
148 | - item.label = item.name; | ||
149 | - item.value = item.code; | ||
150 | - }); | 146 | + |
151 | cities.forEach((item) => { | 147 | cities.forEach((item) => { |
152 | item.label = item.name; | 148 | item.label = item.name; |
153 | item.value = item.code; | 149 | item.value = item.code; |
154 | }); | 150 | }); |
151 | + | ||
155 | couns.forEach((item) => { | 152 | couns.forEach((item) => { |
156 | item.label = item.name; | 153 | item.label = item.name; |
157 | item.value = item.code; | 154 | item.value = item.code; |
@@ -161,13 +158,6 @@ | @@ -161,13 +158,6 @@ | ||
161 | item.value = item.code; | 158 | item.value = item.code; |
162 | }); | 159 | }); |
163 | const { codeCountry, codeProv, codeCity, codeCoun, codeTown } = code; | 160 | const { codeCountry, codeProv, codeCity, codeCoun, codeTown } = code; |
164 | - setFieldsValue({ | ||
165 | - nameCountry: codeCountry, | ||
166 | - nameProv: codeProv, | ||
167 | - nameCity: codeCity, | ||
168 | - nameCoun: codeCoun, | ||
169 | - nameTown: codeTown, | ||
170 | - }); | ||
171 | updateSchema([ | 161 | updateSchema([ |
172 | { | 162 | { |
173 | field: 'nameCity', | 163 | field: 'nameCity', |
@@ -175,17 +165,25 @@ | @@ -175,17 +165,25 @@ | ||
175 | return { | 165 | return { |
176 | options: cities, | 166 | options: cities, |
177 | async onChange(value) { | 167 | async onChange(value) { |
178 | - let couns: CityItem[] = await getAreaList({ parentId: value }); | ||
179 | if (value === undefined) { | 168 | if (value === undefined) { |
180 | formModel.nameCoun = undefined; // reset city value | 169 | formModel.nameCoun = undefined; // reset city value |
181 | formModel.nameTown = undefined; | 170 | formModel.nameTown = undefined; |
182 | - updateSchema({ | ||
183 | - field: 'nameTown', | ||
184 | - componentProps: { | ||
185 | - options: [], | 171 | + updateSchema([ |
172 | + { | ||
173 | + field: 'nameCoun', | ||
174 | + componentProps: { | ||
175 | + options: [], | ||
176 | + }, | ||
186 | }, | 177 | }, |
187 | - }); | 178 | + { |
179 | + field: 'nameTown', | ||
180 | + componentProps: { | ||
181 | + options: [], | ||
182 | + }, | ||
183 | + }, | ||
184 | + ]); | ||
188 | } else { | 185 | } else { |
186 | + let couns: CityItem[] = await getAreaList({ parentId: value }); | ||
189 | couns.forEach((item) => { | 187 | couns.forEach((item) => { |
190 | item.label = item.name; | 188 | item.label = item.name; |
191 | item.value = item.code; | 189 | item.value = item.code; |
@@ -198,23 +196,23 @@ | @@ -198,23 +196,23 @@ | ||
198 | // 请选择区 | 196 | // 请选择区 |
199 | options: couns, | 197 | options: couns, |
200 | async onChange(value) { | 198 | async onChange(value) { |
201 | - let towns: CityItem[] = await getAreaList({ parentId: value }); | ||
202 | if (value === undefined) { | 199 | if (value === undefined) { |
203 | formModel.nameTown = undefined; | 200 | formModel.nameTown = undefined; |
201 | + } else { | ||
202 | + let towns: CityItem[] = await getAreaList({ parentId: value }); | ||
203 | + towns.forEach((item) => { | ||
204 | + item.label = item.name; | ||
205 | + item.value = item.code; | ||
206 | + }); | ||
207 | + formModel.nameTown = undefined; | ||
208 | + updateSchema({ | ||
209 | + field: 'nameTown', | ||
210 | + componentProps: { | ||
211 | + placeholder: '城镇/街道', | ||
212 | + options: towns, | ||
213 | + }, | ||
214 | + }); | ||
204 | } | 215 | } |
205 | - towns.forEach((item) => { | ||
206 | - item.label = item.name; | ||
207 | - item.value = item.code; | ||
208 | - }); | ||
209 | - | ||
210 | - formModel.nameTown = undefined; | ||
211 | - updateSchema({ | ||
212 | - field: 'nameTown', | ||
213 | - componentProps: { | ||
214 | - placeholder: '请选择街道/城镇', | ||
215 | - options: towns, | ||
216 | - }, | ||
217 | - }); | ||
218 | }, | 216 | }, |
219 | }, | 217 | }, |
220 | }); | 218 | }); |
@@ -235,6 +233,7 @@ | @@ -235,6 +233,7 @@ | ||
235 | updateSchema({ | 233 | updateSchema({ |
236 | field: 'nameTown', | 234 | field: 'nameTown', |
237 | componentProps: { | 235 | componentProps: { |
236 | + placeholder: '城镇/街道', | ||
238 | options: [], | 237 | options: [], |
239 | }, | 238 | }, |
240 | }); | 239 | }); |
@@ -250,7 +249,7 @@ | @@ -250,7 +249,7 @@ | ||
250 | updateSchema({ | 249 | updateSchema({ |
251 | field: 'nameTown', | 250 | field: 'nameTown', |
252 | componentProps: { | 251 | componentProps: { |
253 | - placeholder: '请选择街道/城镇', | 252 | + placeholder: '城镇/街道', |
254 | options: towns, | 253 | options: towns, |
255 | }, | 254 | }, |
256 | }); | 255 | }); |
@@ -265,22 +264,20 @@ | @@ -265,22 +264,20 @@ | ||
265 | }, | 264 | }, |
266 | }, | 265 | }, |
267 | ]); | 266 | ]); |
267 | + setFieldsValue({ | ||
268 | + nameCountry: codeCountry, | ||
269 | + nameProv: codeProv, | ||
270 | + nameCity: codeCity, | ||
271 | + nameCoun: codeCoun, | ||
272 | + nameTown: codeTown, | ||
273 | + }); | ||
268 | } | 274 | } |
269 | 275 | ||
270 | onMounted(async () => { | 276 | onMounted(async () => { |
271 | const res = await getEnterPriseDetail(); | 277 | const res = await getEnterPriseDetail(); |
272 | if (res.sysTown) { | 278 | if (res.sysTown) { |
273 | - const { | ||
274 | - provs, | ||
275 | - cities, | ||
276 | - couns, | ||
277 | - towns, | ||
278 | - codeCountry, | ||
279 | - codeProv, | ||
280 | - codeCity, | ||
281 | - codeCoun, | ||
282 | - codeTown, | ||
283 | - } = res.sysTown; | 279 | + const { cities, couns, towns, codeCountry, codeProv, codeCity, codeCoun, codeTown } = |
280 | + res.sysTown; | ||
284 | const code = { | 281 | const code = { |
285 | codeCountry, | 282 | codeCountry, |
286 | codeProv, | 283 | codeProv, |
@@ -288,7 +285,7 @@ | @@ -288,7 +285,7 @@ | ||
288 | codeCoun, | 285 | codeCoun, |
289 | codeTown, | 286 | codeTown, |
290 | }; | 287 | }; |
291 | - updateCityData(provs, cities, couns, towns, code); | 288 | + updateCityData(cities, couns, towns, code); |
292 | setFieldsValue(res); | 289 | setFieldsValue(res); |
293 | qrcodePic.value = res.qrCode; | 290 | qrcodePic.value = res.qrCode; |
294 | } else { | 291 | } else { |
@@ -308,5 +305,3 @@ | @@ -308,5 +305,3 @@ | ||
308 | }, | 305 | }, |
309 | }); | 306 | }); |
310 | </script> | 307 | </script> |
311 | - | ||
312 | -<style lang="less" scoped></style> |