Commit b16b7e2b1a6afbaf6c0bde983eec256226a69d9d
Merge branch 'sqy_dev' into 'main'
修改问题 See merge request huang/yun-teng-iot-front!191
Showing
11 changed files
with
144 additions
and
189 deletions
| @@ -52,9 +52,6 @@ | @@ -52,9 +52,6 @@ | ||
| 52 | slots: { customRender: 'action' }, | 52 | slots: { customRender: 'action' }, |
| 53 | fixed: 'right', | 53 | fixed: 'right', |
| 54 | }, | 54 | }, |
| 55 | - // beforeFetch: (data) => { | ||
| 56 | - // Reflect.set(data, 'startTime', null); | ||
| 57 | - // }, | ||
| 58 | }); | 55 | }); |
| 59 | const [registerDetailDrawer, { openDrawer }] = useDrawer(); | 56 | const [registerDetailDrawer, { openDrawer }] = useDrawer(); |
| 60 | const handleDetail = (record: Recordable) => { | 57 | const handleDetail = (record: Recordable) => { |
| @@ -102,6 +102,8 @@ | @@ -102,6 +102,8 @@ | ||
| 102 | Modal.info({ | 102 | Modal.info({ |
| 103 | title: '当前配置', | 103 | title: '当前配置', |
| 104 | width: 600, | 104 | width: 600, |
| 105 | + centered: true, | ||
| 106 | + maskClosable: true, | ||
| 105 | content: h(JsonPreview, { data: JSON.parse(JSON.stringify(record.config)) }), | 107 | content: h(JsonPreview, { data: JSON.parse(JSON.stringify(record.config)) }), |
| 106 | }); | 108 | }); |
| 107 | } | 109 | } |
| @@ -3,9 +3,10 @@ | @@ -3,9 +3,10 @@ | ||
| 3 | v-bind="$attrs" | 3 | v-bind="$attrs" |
| 4 | @register="register" | 4 | @register="register" |
| 5 | title="邮件发送参数" | 5 | title="邮件发送参数" |
| 6 | + centered | ||
| 6 | :okButtonProps="{ disabled: true }" | 7 | :okButtonProps="{ disabled: true }" |
| 7 | @ok="handleOK" | 8 | @ok="handleOK" |
| 8 | - width="700px" | 9 | + :width="700" |
| 9 | > | 10 | > |
| 10 | <div class="pt-6px pr-6px"> | 11 | <div class="pt-6px pr-6px"> |
| 11 | <BasicForm @register="registerForm" /> | 12 | <BasicForm @register="registerForm" /> |
| @@ -79,6 +79,8 @@ | @@ -79,6 +79,8 @@ | ||
| 79 | Modal.info({ | 79 | Modal.info({ |
| 80 | title: '当前配置', | 80 | title: '当前配置', |
| 81 | width: 480, | 81 | width: 480, |
| 82 | + centered: true, | ||
| 83 | + maskClosable: true, | ||
| 82 | content: h(JsonPreview, { data: JSON.parse(JSON.stringify(record.templateParam)) }), | 84 | content: h(JsonPreview, { data: JSON.parse(JSON.stringify(record.templateParam)) }), |
| 83 | }); | 85 | }); |
| 84 | } | 86 | } |
| @@ -14,12 +14,12 @@ export const columns: BasicColumn[] = [ | @@ -14,12 +14,12 @@ export const columns: BasicColumn[] = [ | ||
| 14 | { | 14 | { |
| 15 | title: '短信平台', | 15 | title: '短信平台', |
| 16 | dataIndex: 'typeDictText', | 16 | dataIndex: 'typeDictText', |
| 17 | - width: 180, | 17 | + width: 160, |
| 18 | }, | 18 | }, |
| 19 | { | 19 | { |
| 20 | title: '用途', | 20 | title: '用途', |
| 21 | dataIndex: 'templatePurposeDictText', | 21 | dataIndex: 'templatePurposeDictText', |
| 22 | - width: 180, | 22 | + width: 160, |
| 23 | }, | 23 | }, |
| 24 | { | 24 | { |
| 25 | title: '状态', | 25 | title: '状态', |
| @@ -38,12 +38,12 @@ export const columns: BasicColumn[] = [ | @@ -38,12 +38,12 @@ export const columns: BasicColumn[] = [ | ||
| 38 | { | 38 | { |
| 39 | title: '备注', | 39 | title: '备注', |
| 40 | dataIndex: 'remark', | 40 | dataIndex: 'remark', |
| 41 | - width: 180, | 41 | + width: 160, |
| 42 | }, | 42 | }, |
| 43 | { | 43 | { |
| 44 | title: '发送时间', | 44 | title: '发送时间', |
| 45 | dataIndex: 'sendTime', | 45 | dataIndex: 'sendTime', |
| 46 | - width: 180, | 46 | + width: 160, |
| 47 | }, | 47 | }, |
| 48 | ]; | 48 | ]; |
| 49 | 49 |
| @@ -48,8 +48,7 @@ | @@ -48,8 +48,7 @@ | ||
| 48 | <SceneLinkAgeDrawer @register="registerDrawer" @success="handleSuccess" /> | 48 | <SceneLinkAgeDrawer @register="registerDrawer" @success="handleSuccess" /> |
| 49 | </div> | 49 | </div> |
| 50 | </template> | 50 | </template> |
| 51 | -<script lang="ts"> | ||
| 52 | - import { defineComponent } from 'vue'; | 51 | +<script lang="ts" setup> |
| 53 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 52 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 54 | import { useDrawer } from '/@/components/Drawer'; | 53 | import { useDrawer } from '/@/components/Drawer'; |
| 55 | import { | 54 | import { |
| @@ -62,110 +61,88 @@ | @@ -62,110 +61,88 @@ | ||
| 62 | import { columns, searchFormSchema } from './config/config.data.ts'; | 61 | import { columns, searchFormSchema } from './config/config.data.ts'; |
| 63 | import { USER_INFO_KEY } from '/@/enums/cacheEnum'; | 62 | import { USER_INFO_KEY } from '/@/enums/cacheEnum'; |
| 64 | import { getAuthCache } from '/@/utils/auth'; | 63 | import { getAuthCache } from '/@/utils/auth'; |
| 65 | - import { authBtn } from '/@/enums/roleEnum'; | ||
| 66 | import SceneLinkAgeDrawer from './SceneLinkAgeDrawer.vue'; | 64 | import SceneLinkAgeDrawer from './SceneLinkAgeDrawer.vue'; |
| 67 | import { useMessage } from '/@/hooks/web/useMessage'; | 65 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 68 | 66 | ||
| 69 | - export default defineComponent({ | ||
| 70 | - name: 'LinkEdge', | ||
| 71 | - components: { BasicTable, SceneLinkAgeDrawer, TableAction, Switch }, | ||
| 72 | - setup() { | ||
| 73 | - const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } = | ||
| 74 | - useBatchDelete(screenLinkPageDeleteApi, handleSuccess); | ||
| 75 | - selectionOptions.rowSelection.getCheckboxProps = (record: Recordable) => { | ||
| 76 | - // Demo:status为1的选择框禁用 | ||
| 77 | - if (record.status === 1) { | ||
| 78 | - return { disabled: true }; | ||
| 79 | - } else { | ||
| 80 | - return { disabled: false }; | ||
| 81 | - } | ||
| 82 | - }; | 67 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } = |
| 68 | + useBatchDelete(screenLinkPageDeleteApi, handleSuccess); | ||
| 69 | + selectionOptions.rowSelection.getCheckboxProps = (record: Recordable) => { | ||
| 70 | + // Demo:status为1的选择框禁用 | ||
| 71 | + if (record.status === 1) { | ||
| 72 | + return { disabled: true }; | ||
| 73 | + } else { | ||
| 74 | + return { disabled: false }; | ||
| 75 | + } | ||
| 76 | + }; | ||
| 83 | 77 | ||
| 84 | - const userInfo: any = getAuthCache(USER_INFO_KEY); | ||
| 85 | - const userId = userInfo.userId; | ||
| 86 | - const role: string = userInfo.roles[0]; | ||
| 87 | - const [registerDrawer, { openDrawer }] = useDrawer(); | ||
| 88 | - const [registerTable, { reload, setProps, setSelectedRowKeys }] = useTable({ | ||
| 89 | - title: '场景联动列表', | ||
| 90 | - api: screenLinkPageGetApi, | ||
| 91 | - columns, | ||
| 92 | - formConfig: { | ||
| 93 | - labelWidth: 120, | ||
| 94 | - schemas: searchFormSchema, | ||
| 95 | - }, | ||
| 96 | - useSearchForm: true, | ||
| 97 | - showTableSetting: true, | ||
| 98 | - bordered: true, | ||
| 99 | - showIndexColumn: false, | ||
| 100 | - actionColumn: { | ||
| 101 | - width: 200, | ||
| 102 | - title: '操作', | ||
| 103 | - dataIndex: 'action', | ||
| 104 | - slots: { customRender: 'action' }, | ||
| 105 | - fixed: 'right', | ||
| 106 | - }, | ||
| 107 | - ...selectionOptions, | ||
| 108 | - }); | ||
| 109 | - | ||
| 110 | - function handleAdd() { | ||
| 111 | - openDrawer(true, { | ||
| 112 | - isUpdate: false, | ||
| 113 | - }); | ||
| 114 | - } | ||
| 115 | - | ||
| 116 | - function handleEdit(record: Recordable) { | ||
| 117 | - openDrawer(true, { | ||
| 118 | - record, | ||
| 119 | - isUpdate: true, | ||
| 120 | - }); | ||
| 121 | - } | ||
| 122 | - function handleView(record: Recordable) { | ||
| 123 | - openDrawer(true, { | ||
| 124 | - record, | ||
| 125 | - isUpdate: 3, | ||
| 126 | - }); | ||
| 127 | - } | ||
| 128 | - function handleSuccess() { | ||
| 129 | - reload(); | ||
| 130 | - } | 78 | + const userInfo: any = getAuthCache(USER_INFO_KEY); |
| 79 | + const userId = userInfo.userId; | ||
| 131 | 80 | ||
| 132 | - const statusChange = async (checked, record) => { | ||
| 133 | - // record.pendingStatus = true; | ||
| 134 | - setProps({ | ||
| 135 | - loading: true, | ||
| 136 | - }); | ||
| 137 | - setSelectedRowKeys([]); | ||
| 138 | - resetSelectedRowKeys(); | ||
| 139 | - const newStatus = checked ? 1 : 0; | ||
| 140 | - const { createMessage } = useMessage(); | ||
| 141 | - try { | ||
| 142 | - await screenLinkPagePutApi({ id: record.id, status: newStatus }); | ||
| 143 | - if (newStatus) { | ||
| 144 | - createMessage.success(`启用成功`); | ||
| 145 | - } else { | ||
| 146 | - createMessage.success('禁用成功'); | ||
| 147 | - } | ||
| 148 | - } finally { | ||
| 149 | - setProps({ | ||
| 150 | - loading: false, | ||
| 151 | - }); | ||
| 152 | - reload(); | ||
| 153 | - } | ||
| 154 | - }; | ||
| 155 | - return { | ||
| 156 | - registerTable, | ||
| 157 | - registerDrawer, | ||
| 158 | - handleAdd, | ||
| 159 | - handleEdit, | ||
| 160 | - handleSuccess, | ||
| 161 | - hasBatchDelete, | ||
| 162 | - handleDeleteOrBatchDelete, | ||
| 163 | - handleView, | ||
| 164 | - authBtn, | ||
| 165 | - role, | ||
| 166 | - userId, | ||
| 167 | - statusChange, | ||
| 168 | - }; | 81 | + const [registerDrawer, { openDrawer }] = useDrawer(); |
| 82 | + const [registerTable, { reload, setProps, setSelectedRowKeys }] = useTable({ | ||
| 83 | + title: '场景联动列表', | ||
| 84 | + api: screenLinkPageGetApi, | ||
| 85 | + columns, | ||
| 86 | + formConfig: { | ||
| 87 | + labelWidth: 120, | ||
| 88 | + schemas: searchFormSchema, | ||
| 169 | }, | 89 | }, |
| 90 | + useSearchForm: true, | ||
| 91 | + showTableSetting: true, | ||
| 92 | + bordered: true, | ||
| 93 | + showIndexColumn: false, | ||
| 94 | + actionColumn: { | ||
| 95 | + width: 200, | ||
| 96 | + title: '操作', | ||
| 97 | + dataIndex: 'action', | ||
| 98 | + slots: { customRender: 'action' }, | ||
| 99 | + fixed: 'right', | ||
| 100 | + }, | ||
| 101 | + ...selectionOptions, | ||
| 170 | }); | 102 | }); |
| 103 | + | ||
| 104 | + function handleAdd() { | ||
| 105 | + openDrawer(true, { | ||
| 106 | + isUpdate: false, | ||
| 107 | + }); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + function handleEdit(record: Recordable) { | ||
| 111 | + openDrawer(true, { | ||
| 112 | + record, | ||
| 113 | + isUpdate: true, | ||
| 114 | + }); | ||
| 115 | + } | ||
| 116 | + function handleView(record: Recordable) { | ||
| 117 | + openDrawer(true, { | ||
| 118 | + record, | ||
| 119 | + isUpdate: 3, | ||
| 120 | + }); | ||
| 121 | + } | ||
| 122 | + function handleSuccess() { | ||
| 123 | + reload(); | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + const statusChange = async (checked, record) => { | ||
| 127 | + setProps({ | ||
| 128 | + loading: true, | ||
| 129 | + }); | ||
| 130 | + setSelectedRowKeys([]); | ||
| 131 | + resetSelectedRowKeys(); | ||
| 132 | + const newStatus = checked ? 1 : 0; | ||
| 133 | + const { createMessage } = useMessage(); | ||
| 134 | + try { | ||
| 135 | + await screenLinkPagePutApi({ id: record.id, status: newStatus }); | ||
| 136 | + if (newStatus) { | ||
| 137 | + createMessage.success(`启用成功`); | ||
| 138 | + } else { | ||
| 139 | + createMessage.success('禁用成功'); | ||
| 140 | + } | ||
| 141 | + } finally { | ||
| 142 | + setProps({ | ||
| 143 | + loading: false, | ||
| 144 | + }); | ||
| 145 | + reload(); | ||
| 146 | + } | ||
| 147 | + }; | ||
| 171 | </script> | 148 | </script> |
| 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; | 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; |
| 2 | import { h } from 'vue'; | 2 | import { h } from 'vue'; |
| 3 | -import { Tag, Switch } from 'ant-design-vue'; | ||
| 4 | -import { useMessage } from '/@/hooks/web/useMessage'; | ||
| 5 | -import { updateTransformScriptStatusApi } from '/@/api/device/TransformScriptApi'; | 3 | +import { Tag } from 'ant-design-vue'; |
| 6 | export const columns: BasicColumn[] = [ | 4 | export const columns: BasicColumn[] = [ |
| 7 | { | 5 | { |
| 8 | title: '名称', | 6 | title: '名称', |
| @@ -19,30 +17,7 @@ export const columns: BasicColumn[] = [ | @@ -19,30 +17,7 @@ export const columns: BasicColumn[] = [ | ||
| 19 | title: '状态', | 17 | title: '状态', |
| 20 | dataIndex: 'status', | 18 | dataIndex: 'status', |
| 21 | width: 120, | 19 | width: 120, |
| 22 | - customRender: ({ record }) => { | ||
| 23 | - if (!Reflect.has(record, 'pendingStatus')) { | ||
| 24 | - record.pendingStatus = false; | ||
| 25 | - } | ||
| 26 | - return h(Switch, { | ||
| 27 | - checked: record.status === 1, | ||
| 28 | - checkedChildren: '已启用', | ||
| 29 | - unCheckedChildren: '已禁用', | ||
| 30 | - loading: record.pendingStatus, | ||
| 31 | - onChange(checked: boolean) { | ||
| 32 | - record.pendingStatus = true; | ||
| 33 | - const newStatus = checked ? 1 : 0; | ||
| 34 | - const { createMessage } = useMessage(); | ||
| 35 | - updateTransformScriptStatusApi(newStatus, record.id) | ||
| 36 | - .then(() => { | ||
| 37 | - record.status = newStatus; | ||
| 38 | - createMessage.success(`${record.status ? '启用' : '禁用'}成功`); | ||
| 39 | - }) | ||
| 40 | - .finally(() => { | ||
| 41 | - record.pendingStatus = false; | ||
| 42 | - }); | ||
| 43 | - }, | ||
| 44 | - }); | ||
| 45 | - }, | 20 | + slots: { customRender: 'status' }, |
| 46 | }, | 21 | }, |
| 47 | { | 22 | { |
| 48 | title: '创建时间', | 23 | title: '创建时间', |
| 1 | <template> | 1 | <template> |
| 2 | <div> | 2 | <div> |
| 3 | - <BasicTable | ||
| 4 | - @selection-change="useSelectionChange" | ||
| 5 | - :rowSelection="{ type: 'checkbox' }" | ||
| 6 | - @register="registerTable" | ||
| 7 | - v-show="isStatus === 0" | ||
| 8 | - :clickToRowSelect="false" | ||
| 9 | - > | 3 | + <BasicTable @register="registerTable" v-show="isStatus === 0"> |
| 10 | <template #toolbar> | 4 | <template #toolbar> |
| 11 | <a-button type="primary" @click="handleCreate"> 新增转换脚本 </a-button> | 5 | <a-button type="primary" @click="handleCreate"> 新增转换脚本 </a-button> |
| 12 | - <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="disabled"> | 6 | + <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete"> |
| 13 | 批量删除 | 7 | 批量删除 |
| 14 | </a-button> | 8 | </a-button> |
| 15 | </template> | 9 | </template> |
| 10 | + <template #status="{ record }"> | ||
| 11 | + <Switch | ||
| 12 | + :checked="record.status === 1" | ||
| 13 | + :loading="record.pendingStatus" | ||
| 14 | + checkedChildren="启用" | ||
| 15 | + unCheckedChildren="禁用" | ||
| 16 | + @change="(checked:boolean)=>statusChange(checked,record)" | ||
| 17 | + /> | ||
| 18 | + </template> | ||
| 16 | <template #action="{ record }"> | 19 | <template #action="{ record }"> |
| 17 | <TableAction | 20 | <TableAction |
| 18 | :actions="[ | 21 | :actions="[ |
| @@ -48,6 +51,7 @@ | @@ -48,6 +51,7 @@ | ||
| 48 | 51 | ||
| 49 | <script lang="ts" setup> | 52 | <script lang="ts" setup> |
| 50 | import { ref } from 'vue'; | 53 | import { ref } from 'vue'; |
| 54 | + import { Switch } from 'ant-design-vue'; | ||
| 51 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 55 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 52 | import { columns, searchFormSchema } from './config/config.data'; | 56 | import { columns, searchFormSchema } from './config/config.data'; |
| 53 | import { getConvertApi, deleteTransformApi } from '/@/api/device/TransformScriptApi'; | 57 | import { getConvertApi, deleteTransformApi } from '/@/api/device/TransformScriptApi'; |
| @@ -55,14 +59,24 @@ | @@ -55,14 +59,24 @@ | ||
| 55 | import ScriptDrawer from './cpns/ScriptDrawer.vue'; | 59 | import ScriptDrawer from './cpns/ScriptDrawer.vue'; |
| 56 | import TestScript from './cpns/TestScript.vue'; | 60 | import TestScript from './cpns/TestScript.vue'; |
| 57 | import { useMessage } from '/@/hooks/web/useMessage'; | 61 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 62 | + import { updateTransformScriptStatusApi } from '/@/api/device/TransformScriptApi'; | ||
| 63 | + import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | ||
| 58 | 64 | ||
| 59 | const handleSuccess = () => { | 65 | const handleSuccess = () => { |
| 60 | reload(); | 66 | reload(); |
| 61 | }; | 67 | }; |
| 62 | - const { createMessage } = useMessage(); | ||
| 63 | - let selectedRowKeys: any = []; | ||
| 64 | - const disabled = ref(true); | ||
| 65 | - const [registerTable, { reload, getSelectRowKeys, getSelectRows }] = useTable({ | 68 | + |
| 69 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } = | ||
| 70 | + useBatchDelete(deleteTransformApi, handleSuccess); | ||
| 71 | + selectionOptions.rowSelection.getCheckboxProps = (record: Recordable) => { | ||
| 72 | + // Demo:status为1的选择框禁用 | ||
| 73 | + if (record.status === 1) { | ||
| 74 | + return { disabled: true }; | ||
| 75 | + } else { | ||
| 76 | + return { disabled: false }; | ||
| 77 | + } | ||
| 78 | + }; | ||
| 79 | + const [registerTable, { reload, setProps, setSelectedRowKeys }] = useTable({ | ||
| 66 | api: getConvertApi, | 80 | api: getConvertApi, |
| 67 | title: '转换脚本列表', | 81 | title: '转换脚本列表', |
| 68 | columns, | 82 | columns, |
| @@ -74,6 +88,7 @@ | @@ -74,6 +88,7 @@ | ||
| 74 | labelWidth: 100, | 88 | labelWidth: 100, |
| 75 | schemas: searchFormSchema, | 89 | schemas: searchFormSchema, |
| 76 | }, | 90 | }, |
| 91 | + clickToRowSelect: 'false', | ||
| 77 | rowKey: 'id', | 92 | rowKey: 'id', |
| 78 | actionColumn: { | 93 | actionColumn: { |
| 79 | width: 180, | 94 | width: 180, |
| @@ -82,6 +97,7 @@ | @@ -82,6 +97,7 @@ | ||
| 82 | slots: { customRender: 'action' }, | 97 | slots: { customRender: 'action' }, |
| 83 | fixed: 'right', | 98 | fixed: 'right', |
| 84 | }, | 99 | }, |
| 100 | + ...selectionOptions, | ||
| 85 | }); | 101 | }); |
| 86 | const [registerDrawer, { openDrawer }] = useDrawer(); | 102 | const [registerDrawer, { openDrawer }] = useDrawer(); |
| 87 | 103 | ||
| @@ -108,39 +124,26 @@ | @@ -108,39 +124,26 @@ | ||
| 108 | const handleEdit = (record: Recordable) => { | 124 | const handleEdit = (record: Recordable) => { |
| 109 | openDrawer(true, { isUpdate: true, record }); | 125 | openDrawer(true, { isUpdate: true, record }); |
| 110 | }; | 126 | }; |
| 111 | - const useSelectionChange = () => { | ||
| 112 | - selectedRowKeys = getSelectRowKeys(); | ||
| 113 | - if (selectedRowKeys.length > 0) { | ||
| 114 | - disabled.value = false; | ||
| 115 | - } | ||
| 116 | - let getRows = getSelectRows(); | ||
| 117 | - const isJudge = getRows.map((m) => m.status); | ||
| 118 | - if (isJudge.length === 0) { | ||
| 119 | - disabled.value = true; | ||
| 120 | - } | ||
| 121 | - if (isJudge.includes(1)) { | ||
| 122 | - disabled.value = true; | ||
| 123 | - } | ||
| 124 | - }; | ||
| 125 | - // 删除或批量删除 | ||
| 126 | - const handleDeleteOrBatchDelete = async (record: Recordable | null) => { | ||
| 127 | - if (record) { | ||
| 128 | - try { | ||
| 129 | - await deleteTransformApi([record.id]); | ||
| 130 | - createMessage.success('删除成功'); | ||
| 131 | - handleSuccess(); | ||
| 132 | - } catch (e: any) {} | ||
| 133 | - } else { | ||
| 134 | - try { | ||
| 135 | - await deleteTransformApi(selectedRowKeys); | ||
| 136 | - createMessage.success('批量删除成功'); | ||
| 137 | - handleSuccess(); | ||
| 138 | - selectedRowKeys.length = 0; | ||
| 139 | - } catch (e: any) { | ||
| 140 | - selectedRowKeys.length = 0; | ||
| 141 | - } finally { | ||
| 142 | - selectedRowKeys.length = 0; | 127 | + const statusChange = async (checked, record) => { |
| 128 | + setProps({ | ||
| 129 | + loading: true, | ||
| 130 | + }); | ||
| 131 | + setSelectedRowKeys([]); | ||
| 132 | + resetSelectedRowKeys(); | ||
| 133 | + const newStatus = checked ? 1 : 0; | ||
| 134 | + const { createMessage } = useMessage(); | ||
| 135 | + try { | ||
| 136 | + await updateTransformScriptStatusApi(newStatus, record.id); | ||
| 137 | + if (newStatus) { | ||
| 138 | + createMessage.success(`启用成功`); | ||
| 139 | + } else { | ||
| 140 | + createMessage.success('禁用成功'); | ||
| 143 | } | 141 | } |
| 142 | + } finally { | ||
| 143 | + setProps({ | ||
| 144 | + loading: false, | ||
| 145 | + }); | ||
| 146 | + reload(); | ||
| 144 | } | 147 | } |
| 145 | }; | 148 | }; |
| 146 | </script> | 149 | </script> |
| @@ -112,7 +112,7 @@ | @@ -112,7 +112,7 @@ | ||
| 112 | showTableSetting: true, | 112 | showTableSetting: true, |
| 113 | bordered: true, | 113 | bordered: true, |
| 114 | actionColumn: { | 114 | actionColumn: { |
| 115 | - width: 200, | 115 | + width: 240, |
| 116 | title: '操作', | 116 | title: '操作', |
| 117 | dataIndex: 'action', | 117 | dataIndex: 'action', |
| 118 | slots: { customRender: 'action' }, | 118 | slots: { customRender: 'action' }, |
| @@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
| 44 | class="ant-upload-text flex" | 44 | class="ant-upload-text flex" |
| 45 | style="width: 280px; height: 100px; align-items: center; font-size: 0.5625rem" | 45 | style="width: 280px; height: 100px; align-items: center; font-size: 0.5625rem" |
| 46 | > | 46 | > |
| 47 | - 支持.PNG、.JPG格式,建议尺寸为1080*1620px,大小不超过5M</div | 47 | + 支持.PNG、.JPG格式,建议尺寸为1920*1080px,大小不超过2M</div |
| 48 | > | 48 | > |
| 49 | </div> | 49 | </div> |
| 50 | </Upload> | 50 | </Upload> |
| @@ -187,9 +187,9 @@ | @@ -187,9 +187,9 @@ | ||
| 187 | if (!isJpgOrPng) { | 187 | if (!isJpgOrPng) { |
| 188 | createMessage.error('只能上传图片文件!'); | 188 | createMessage.error('只能上传图片文件!'); |
| 189 | } | 189 | } |
| 190 | - const isLt2M = (file.size as number) / 1024 / 1024 < 5; | 190 | + const isLt2M = (file.size as number) / 1024 / 1024 < 2; |
| 191 | if (!isLt2M) { | 191 | if (!isLt2M) { |
| 192 | - createMessage.error('图片大小不能超过5MB!'); | 192 | + createMessage.error('图片大小不能超过2MB!'); |
| 193 | } | 193 | } |
| 194 | return isJpgOrPng && isLt2M; | 194 | return isJpgOrPng && isLt2M; |
| 195 | }; | 195 | }; |
| @@ -69,7 +69,7 @@ | @@ -69,7 +69,7 @@ | ||
| 69 | class="ant-upload-text flex" | 69 | class="ant-upload-text flex" |
| 70 | style="width: 280px; height: 130px; align-items: center; font-size: 0.5625rem" | 70 | style="width: 280px; height: 130px; align-items: center; font-size: 0.5625rem" |
| 71 | > | 71 | > |
| 72 | - 支持.PNG、.JPG格式,建议尺寸为1920*1080px以上,大小不超过5M</div | 72 | + 支持.PNG、.JPG格式,建议尺寸为1920*1080px以上,大小不超过2M</div |
| 73 | > | 73 | > |
| 74 | </div> | 74 | </div> |
| 75 | </Upload> | 75 | </Upload> |
| @@ -99,8 +99,6 @@ | @@ -99,8 +99,6 @@ | ||
| 99 | import { PlusOutlined } from '@ant-design/icons-vue'; | 99 | import { PlusOutlined } from '@ant-design/icons-vue'; |
| 100 | import { useUserStore } from '/@/store/modules/user'; | 100 | import { useUserStore } from '/@/store/modules/user'; |
| 101 | import { createLocalStorage } from '/@/utils/cache/index'; | 101 | import { createLocalStorage } from '/@/utils/cache/index'; |
| 102 | - import { useTitle } from '@vueuse/core'; | ||
| 103 | - import { useGlobSetting } from '/@/hooks/setting'; | ||
| 104 | export default defineComponent({ | 102 | export default defineComponent({ |
| 105 | components: { | 103 | components: { |
| 106 | BasicForm, | 104 | BasicForm, |
| @@ -192,9 +190,9 @@ | @@ -192,9 +190,9 @@ | ||
| 192 | if (!isJpgOrPng) { | 190 | if (!isJpgOrPng) { |
| 193 | createMessage.error('只能上传图片文件!'); | 191 | createMessage.error('只能上传图片文件!'); |
| 194 | } | 192 | } |
| 195 | - const isLt2M = (file.size as number) / 1024 / 1024 < 5; | 193 | + const isLt2M = (file.size as number) / 1024 / 1024 < 2; |
| 196 | if (!isLt2M) { | 194 | if (!isLt2M) { |
| 197 | - createMessage.error('图片大小不能超过5MB!'); | 195 | + createMessage.error('图片大小不能超过2MB!'); |
| 198 | } | 196 | } |
| 199 | return isJpgOrPng && isLt2M; | 197 | return isJpgOrPng && isLt2M; |
| 200 | }; | 198 | }; |