diff --git a/web/.eslintrc.js b/web/.eslintrc.js index ca360bb..631fc67 100644 --- a/web/.eslintrc.js +++ b/web/.eslintrc.js @@ -15,6 +15,7 @@ module.exports = { }, plugins: ['react', '@typescript-eslint', 'prettier'], // 添加 prettier 插件 rules: { + camelcase: 'off', 'vue/require-explicit-emits': 'off', // 关闭 emits 声明检查 'vue/v-on-event-hyphenation': 'off', 'prettier/prettier': 'off', diff --git a/web/src/components/ComTable.vue b/web/src/components/ComTable.vue index cc316ef..9b1ff53 100644 --- a/web/src/components/ComTable.vue +++ b/web/src/components/ComTable.vue @@ -152,7 +152,7 @@ const data = reactive({ newPageOption: {}, newTableOpt: {}, - pageSizeOptions: ['15', '20', '30', '40', '50', '100'], + pageSizeOptions: ['10', '20', '30', '40', '50', '100'], mountedScroll }) const loading = ref(false) diff --git a/web/src/components/system/policyForm.vue b/web/src/components/system/policyForm.vue index fd40b22..e548deb 100644 --- a/web/src/components/system/policyForm.vue +++ b/web/src/components/system/policyForm.vue @@ -6,7 +6,7 @@ {{ item.label @@ -69,39 +69,44 @@ - @@ -66,8 +75,8 @@ export default { return { formModal: false, btnOptionList: [ - { label: '新增', icon: 'icon-tianjia', type: 'add' }, - { label: '删除', icon: 'icon-tianjia', type: 'del' } + { label: '新增', icon: 'icon-tianjia', type: 'add' } + // { label: '删除', icon: 'icon-tianjia', type: 'del' } ], columns: [ { @@ -125,15 +134,17 @@ export default { } ], tableData: [], - tableOption: {}, + tableOption: { + select:false + }, pageOption: { - page: 0, + page: 1, pageSize: 10, - total: 0 + count: 0 }, tableH: '', formState: {}, - formStatus:'add',//表单状态辑状态 add:新增 edit:编辑 + formStatus: 'add' //表单状态辑状态 add:新增 edit:编辑 } }, mounted() { @@ -148,13 +159,12 @@ export default { }) console.log(res) this.tableData = res.data - this.total = res.count + this.pageOption.count = res.count } catch (error) { console.log(error) } }, getPolicyType(type) { - return policyTypes.find((item) => item.value == type)?.label || '' }, @@ -162,7 +172,8 @@ export default { console.log(data) }, operateForm(type, record = {}) { - + console.log(type, record) + this.formStatus = type switch (type) { case 'add': @@ -173,16 +184,45 @@ export default { this.formModal = true this.formState = record break - + case 'del': + this.handleDelete(record) + break + case 'edit': + this.formModal = true + this.formState = record + break default: break } }, - closeModal(){ + async handleDelete(record) { + try { + const res = await getReq('/deletePolicy', { + policy_id: record['policy_id'] + }) + if (res.errcode == 0) { + this.$message.success('删除成功') + this.getTableList() + } + } catch (error) { + this.$message.success(error) + } + }, + closeModal(flag = false) { this.formModal = false + if (flag) { + this.pageOption.page = 1 + this.getTableList() + } }, handlePagesizeChange(data) { - console.log(data) + if (data.pageSize !== this.pageOption.pageSize) { + this.pageOption.page = 1 + } else { + this.pageOption.page = data.page + } + this.pageOption.pageSize = data.pageSize + this.getTableList() } } }