From 0d5f70bbcf830f6c3aebf92a0b865a04c9d7f263 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 27 Jun 2025 11:28:12 +0800
Subject: [PATCH] feat:系统管理---二级页面样式调整
---
src/views/license/license.vue | 176 +++----
src/views/system/dept.vue | 403 +++++++++----------
src/option/system/dictbiz.js | 8
src/views/system/menu.vue | 256 +++++------
src/views/system/sysConfig.vue | 209 ++++-----
src/views/system/client.vue | 180 +++----
src/option/system/dict.js | 8
7 files changed, 566 insertions(+), 674 deletions(-)
diff --git a/src/option/system/dict.js b/src/option/system/dict.js
index 7a2cd7c..e64065b 100644
--- a/src/option/system/dict.js
+++ b/src/option/system/dict.js
@@ -9,6 +9,10 @@
menuWidth: 250,
dialogWidth: 880,
dialogClickModal: false,
+
+ height: 'auto',
+ calcHeight: 20,
+
column: [
{
label: '字典编号',
@@ -83,7 +87,7 @@
hide: true,
},
],
-};
+}
export const optionChild = {
tip: false,
@@ -203,4 +207,4 @@
hide: true,
},
],
-};
+}
diff --git a/src/option/system/dictbiz.js b/src/option/system/dictbiz.js
index 2b3bce3..e3a2742 100644
--- a/src/option/system/dictbiz.js
+++ b/src/option/system/dictbiz.js
@@ -9,6 +9,10 @@
menuWidth: 250,
dialogWidth: 880,
dialogClickModal: false,
+
+ height: 'auto',
+ calcHeight: 20,
+
column: [
{
label: '字典编号',
@@ -84,7 +88,7 @@
hide: true,
},
],
-};
+}
export const optionChild = {
tip: false,
@@ -204,4 +208,4 @@
hide: true,
},
],
-};
+}
diff --git a/src/views/license/license.vue b/src/views/license/license.vue
index 7365e8a..16ab9ed 100644
--- a/src/views/license/license.vue
+++ b/src/views/license/license.vue
@@ -1,32 +1,15 @@
<template>
<basic-container>
-
- <avue-crud
- :option="option"
- :table-loading="loading"
- :data="data"
- v-model:page="page"
- ref="crud"
- @row-del="rowDel"
- v-model="form"
- :permission="permissionList"
- @row-update="rowUpdate"
- @row-save="rowSave"
- :before-open="beforeOpen"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad">
-
+
+ <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" ref="crud"
+ @row-del="rowDel" v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave"
+ :before-open="beforeOpen" @search-change="searchChange" @search-reset="searchReset"
+ @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
+ @refresh-change="refreshChange" @on-load="onLoad">
+
<!-- 自定义证书地址列 -->
<template #url="scope">
- <el-link
- :href="scope.row.url"
- target="_blank"
- type="primary">
+ <el-link :href="scope.row.url" target="_blank" type="primary">
下载密钥
</el-link>
</template>
@@ -34,7 +17,7 @@
<!-- 自定义过期时间列 -->
<template #expireDay="scope">
<span :style="{ color: isExpired(scope.row.expireDay) ? 'red' : 'inherit' }">
- {{ formatExpireDay(scope.row.expireDay,scope.row.licenseType) }}
+ {{ formatExpireDay(scope.row.expireDay, scope.row.licenseType) }}
</span>
</template>
@@ -52,21 +35,16 @@
</span>
</template>
<template #menu-left>
- <el-button type="primary" icon="el-icon-plus"
- @click="createLicenseShow()">新 增
- </el-button>
+ <el-button type="primary" icon="el-icon-plus" @click="createLicenseShow()">新 增
+ </el-button>
</template>
</avue-crud>
<!-- 新增弹窗 -->
- <el-dialog title="新增 License"
- v-model="addDialogVisible"
- width="70%"
- :close-on-click-modal="false"
- @close="resetForm"
- >
+ <el-dialog title="新增 License" v-model="addDialogVisible" width="70%" :close-on-click-modal="false"
+ @close="resetForm">
<el-form :model="newLicense" ref="licenseForm" label-width="120px">
- <el-form-item label="机构ID" prop="licenseId" >
+ <el-form-item label="机构ID" prop="licenseId">
<el-input v-model="newLicense.licenseId" />
</el-form-item>
<el-form-item label="机构名称" prop="licenseName" required>
@@ -78,7 +56,7 @@
<el-option label="验证过期时间" :value="2" />
</el-select>
</el-form-item>
- <el-form-item v-if="newLicense.licenseType==2" label="过期时间" prop="expireDay">
+ <el-form-item v-if="newLicense.licenseType == 2" label="过期时间" prop="expireDay">
<el-date-picker v-model="newLicense.expireDay" type="date" placeholder="选择日期" />
</el-form-item>
<el-form-item label="设备数量" prop="printClientCount">
@@ -86,13 +64,8 @@
<el-radio :label="-1">不限制</el-radio>
<el-radio :label="1">限制</el-radio>
</el-radio-group>
- <el-input-number
- v-if="deviceLimit === 1"
- v-model="newLicense.printClientCount"
- :min="0"
- placeholder="请输入数量"
- style="margin-top: 10px;"
- />
+ <el-input-number v-if="deviceLimit === 1" v-model="newLicense.printClientCount" :min="0"
+ placeholder="请输入数量" style="margin-top: 10px;" />
</el-form-item>
<el-form-item label="是否校验机器码" prop="checkMachineCode">
<el-switch v-model="newLicense.checkMachineCode" />
@@ -106,21 +79,21 @@
</el-form>
<template #footer>
<div class="dialog-footer">
- <el-button @click="addDialogVisible = false">取消</el-button>
- <el-button type="primary" @click="createLicense">保存</el-button>
+ <el-button @click="addDialogVisible = false">取消</el-button>
+ <el-button type="primary" @click="createLicense">保存</el-button>
</div>
</template>
-
+
</el-dialog>
</basic-container>
</template>
<script>
-import { getList, add } from '@/api/license/license';
-import { mapGetters } from 'vuex';
+import { getList, add } from '@/api/license/license'
+import { mapGetters } from 'vuex'
export default {
- data() {
+ data () {
return {
loading: true,
page: {
@@ -153,10 +126,14 @@
viewBtn: true,
selection: false,
excelBtn: false,
- addBtnText: '新建license',
- addBtn: true,
+ addBtnText: '新建license',
+ addBtn: true,
dialogClickModal: false,
grid: false,
+
+ height: 'auto',
+ calcHeight: 20,
+
column: [
{
label: '机构ID',
@@ -289,89 +266,88 @@
],
},
data: [],
- };
+ }
},
computed: {
...mapGetters(['userInfo', 'permission']),
- permissionList() {
+ permissionList () {
return {
addBtn: this.validData(this.permission.license_add, false),
viewBtn: this.validData(this.permission.license_view, true),
delBtn: this.validData(this.permission.license_delete, false),
editBtn: this.validData(this.permission.license_edit, false),
- };
+ }
},
},
methods: {
- isExpired(expireDay) {
- const now = new Date();
- return new Date(expireDay) < now;
+ isExpired (expireDay) {
+ const now = new Date()
+ return new Date(expireDay) < now
},
- formatExpireDay(expireDay,licenseType) {
- if (licenseType==2&& this.isExpired(expireDay)) {
- return `${expireDay} (已过期)`;
+ formatExpireDay (expireDay, licenseType) {
+ if (licenseType == 2 && this.isExpired(expireDay)) {
+ return `${expireDay} (已过期)`
}
- if(licenseType==1){
- return `永久`;
+ if (licenseType == 1) {
+ return `永久`
}
- return expireDay;
+ return expireDay
},
- rowSave(row, done, loading) {
+ rowSave (row, done, loading) {
add(row).then(
() => {
- this.onLoad(this.page);
+ this.onLoad(this.page)
this.$message({
type: 'success',
message: '操作成功!',
- });
- done();
+ })
+ done()
},
error => {
- console.error(error);
- loading();
+ console.error(error)
+ loading()
}
- );
+ )
},
- createLicenseShow(){
- this.addDialogVisible = true;
+ createLicenseShow () {
+ this.addDialogVisible = true
},
- createLicense() {
+ createLicense () {
// 格式化过期时间
if (this.newLicense.expireDay) {
- this.newLicense.expireDay = this.formatDate(this.newLicense.expireDay);
- console.log(this.newLicense.expireDay);
-
- }
+ this.newLicense.expireDay = this.formatDate(this.newLicense.expireDay)
+ console.log(this.newLicense.expireDay)
+
+ }
// 保存数据
add(this.newLicense).then(() => {
- this.$message.success('新增成功');
- this.addDialogVisible = false;
- this.onLoad(this.page);
+ this.$message.success('新增成功')
+ this.addDialogVisible = false
+ this.onLoad(this.page)
}).catch(error => {
- console.error(error);
- this.$message.error('新增失败');
- });
+ console.error(error)
+ this.$message.error('新增失败')
+ })
},
- formatDate(date) {
- const d = new Date(date);
- const year = d.getFullYear();
- const month = String(d.getMonth() + 1).padStart(2, '0');
- const day = String(d.getDate()).padStart(2, '0');
- return `${year}-${month}-${day}`;
+ formatDate (date) {
+ const d = new Date(date)
+ const year = d.getFullYear()
+ const month = String(d.getMonth() + 1).padStart(2, '0')
+ const day = String(d.getDate()).padStart(2, '0')
+ return `${year}-${month}-${day}`
},
- onLoad(page, params = {}) {
- this.loading = true;
+ onLoad (page, params = {}) {
+ this.loading = true
getList(page.currentPage, page.pageSize, params).then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.loading = false;
- });
+ const data = res.data.data
+ this.page.total = data.total
+ this.data = data.records
+ this.loading = false
+ })
},
},
-};
+}
</script>
-<style lang="scss" scoped>
-</style>
+<style lang="scss" scoped></style>
diff --git a/src/views/system/client.vue b/src/views/system/client.vue
index 9840d26..49a6cf0 100644
--- a/src/views/system/client.vue
+++ b/src/views/system/client.vue
@@ -1,33 +1,12 @@
<template>
<basic-container>
- <avue-crud
- :option="option"
- :table-loading="loading"
- :data="data"
- v-model:page="page"
- @row-del="rowDel"
- v-model="form"
- ref="crud"
- :permission="permissionList"
- @row-update="rowUpdate"
- @row-save="rowSave"
- :before-open="beforeOpen"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad"
- >
+ <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" @row-del="rowDel"
+ v-model="form" ref="crud" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave"
+ :before-open="beforeOpen" @search-change="searchChange" @search-reset="searchReset"
+ @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
+ @refresh-change="refreshChange" @on-load="onLoad">
<template #menu-left>
- <el-button
- type="danger"
- icon="el-icon-delete"
- plain
- v-if="permission.client_delete"
- @click="handleDelete"
- >删 除
+ <el-button type="danger" icon="el-icon-delete" plain v-if="permission.client_delete" @click="handleDelete">删 除
</el-button>
</template>
</avue-crud>
@@ -35,11 +14,11 @@
</template>
<script>
-import { getList, getDetail, add, update, remove } from '@/api/system/client';
-import { mapGetters } from 'vuex';
+import { getList, getDetail, add, update, remove } from '@/api/system/client'
+import { mapGetters } from 'vuex'
export default {
- data() {
+ data () {
return {
form: {},
query: {},
@@ -60,6 +39,10 @@
grid: true,
selection: true,
dialogClickModal: false,
+
+ height: 'auto',
+ calcHeight: 20,
+
column: [
{
label: '应用id',
@@ -240,97 +223,97 @@
],
},
data: [],
- };
+ }
},
computed: {
...mapGetters(['permission']),
- permissionList() {
+ permissionList () {
return {
addBtn: this.validData(this.permission.client_add),
viewBtn: this.validData(this.permission.client_view),
delBtn: this.validData(this.permission.client_delete),
editBtn: this.validData(this.permission.client_edit),
- };
+ }
},
- ids() {
- let ids = [];
+ ids () {
+ let ids = []
this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(',');
+ ids.push(ele.id)
+ })
+ return ids.join(',')
},
},
methods: {
- rowSave(row, done, loading) {
+ rowSave (row, done, loading) {
add(row).then(
() => {
- this.onLoad(this.page);
+ this.onLoad(this.page)
this.$message({
type: 'success',
message: '操作成功!',
- });
- done();
+ })
+ done()
},
error => {
- window.console.log(error);
- loading();
+ window.console.log(error)
+ loading()
}
- );
+ )
},
- rowUpdate(row, index, done, loading) {
+ rowUpdate (row, index, done, loading) {
update(row).then(
() => {
- this.onLoad(this.page);
+ this.onLoad(this.page)
this.$message({
type: 'success',
message: '操作成功!',
- });
- done();
+ })
+ done()
},
error => {
- window.console.log(error);
- loading();
+ window.console.log(error)
+ loading()
}
- );
+ )
},
- rowDel(row) {
+ rowDel (row) {
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
- return remove(row.id);
+ return remove(row.id)
})
.then(() => {
- this.onLoad(this.page);
+ this.onLoad(this.page)
this.$message({
type: 'success',
message: '操作成功!',
- });
- });
+ })
+ })
},
- searchReset() {
- this.query = {};
- this.onLoad(this.page);
+ searchReset () {
+ this.query = {}
+ this.onLoad(this.page)
},
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
+ searchChange (params, done) {
+ this.query = params
+ this.page.currentPage = 1
+ this.onLoad(this.page, params)
+ done()
},
- selectionChange(list) {
- this.selectionList = list;
+ selectionChange (list) {
+ this.selectionList = list
},
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
+ selectionClear () {
+ this.selectionList = []
+ this.$refs.crud.toggleSelection()
},
- handleDelete() {
+ handleDelete () {
if (this.selectionList.length === 0) {
- this.$message.warning('请选择至少一条数据');
- return;
+ this.$message.warning('请选择至少一条数据')
+ return
}
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
@@ -338,47 +321,46 @@
type: 'warning',
})
.then(() => {
- return remove(this.ids);
+ return remove(this.ids)
})
.then(() => {
- this.onLoad(this.page);
+ this.onLoad(this.page)
this.$message({
type: 'success',
message: '操作成功!',
- });
- this.$refs.crud.toggleSelection();
- });
+ })
+ this.$refs.crud.toggleSelection()
+ })
},
- beforeOpen(done, type) {
+ beforeOpen (done, type) {
if (['edit', 'view'].includes(type)) {
getDetail(this.form.id).then(res => {
- this.form = res.data.data;
- });
+ this.form = res.data.data
+ })
}
- done();
+ done()
},
- currentChange(currentPage) {
- this.page.currentPage = currentPage;
+ currentChange (currentPage) {
+ this.page.currentPage = currentPage
},
- sizeChange(pageSize) {
- this.page.pageSize = pageSize;
+ sizeChange (pageSize) {
+ this.page.pageSize = pageSize
},
- refreshChange() {
- this.onLoad(this.page, this.query);
+ refreshChange () {
+ this.onLoad(this.page, this.query)
},
- onLoad(page, params = {}) {
- this.loading = true;
+ onLoad (page, params = {}) {
+ this.loading = true
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.loading = false;
- this.selectionClear();
- });
+ const data = res.data.data
+ this.page.total = data.total
+ this.data = data.records
+ this.loading = false
+ this.selectionClear()
+ })
},
},
-};
+}
</script>
-<style scoped lang="scss">
-</style>
\ No newline at end of file
+<style scoped lang="scss"></style>
\ No newline at end of file
diff --git a/src/views/system/dept.vue b/src/views/system/dept.vue
index 9475470..93d87a8 100644
--- a/src/views/system/dept.vue
+++ b/src/views/system/dept.vue
@@ -1,45 +1,18 @@
<template>
<basic-container>
- <avue-crud
- :option="option"
- :table-loading="loading"
- :data="data"
- ref="crud"
- v-model="form"
- :permission="permissionList"
- :before-open="beforeOpen"
- :before-close="beforeClose"
- @row-del="rowDel"
- @row-update="rowUpdate"
- @row-save="rowSave"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad"
- @tree-load="treeLoad"
- >
+ <avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form"
+ :permission="permissionList" :before-open="beforeOpen" :before-close="beforeClose" @row-del="rowDel"
+ @row-update="rowUpdate" @row-save="rowSave" @search-change="searchChange" @search-reset="searchReset"
+ @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
+ @refresh-change="refreshChange" @on-load="onLoad" @tree-load="treeLoad">
<template #menu-left>
- <el-button
- type="danger"
- icon="el-icon-delete"
- v-if="permission.dept_delete"
- plain
- @click="handleDelete"
- >
+ <el-button type="danger" icon="el-icon-delete" v-if="permission.dept_delete" plain @click="handleDelete">
删除
</el-button>
</template>
<template #menu="scope">
- <el-button
- type="primary"
- text
- icon="el-icon-plus"
- @click.stop="handleAdd(scope.row, scope.index)"
- v-if="userInfo.role_name.includes('admin')"
- >
+ <el-button type="primary" text icon="el-icon-plus" @click.stop="handleAdd(scope.row, scope.index)"
+ v-if="userInfo.role_name.includes('admin')">
新增子项
</el-button>
</template>
@@ -63,13 +36,13 @@
add,
getDept,
getDeptTree,
-} from '@/api/system/dept';
-import { getLazyTree } from '@/api/base/region';
-import { mapGetters } from 'vuex';
-import website from '@/config/website';
+} from '@/api/system/dept'
+import { getLazyTree } from '@/api/base/region'
+import { mapGetters } from 'vuex'
+import website from '@/config/website'
export default {
- data() {
+ data () {
return {
form: {},
selectionList: [],
@@ -94,6 +67,10 @@
viewBtn: true,
menuWidth: 320,
dialogClickModal: false,
+
+ height: 'auto',
+ calcHeight: 20,
+
column: [
{
label: '机构名称',
@@ -239,23 +216,23 @@
],
change: ({ value }) => {
if (!value) {
- this.form.areaCode = null; // 未选择时置为空
+ this.form.areaCode = null // 未选择时置为空
} else {
// 如果 value 是逗号分隔的字符串,拆分并取最后一个值
if (typeof value === 'string' && value.includes(',')) {
- const codes = value.split(',');
- this.form.areaCode = codes[codes.length - 1];
+ const codes = value.split(',')
+ this.form.areaCode = codes[codes.length - 1]
} else {
- this.form.areaCode = value; // 直接使用单一值
+ this.form.areaCode = value // 直接使用单一值
}
}
- console.log('cascader change value:', value);
- console.log('处理后的区县编码:', this.form.areaCode);
+ console.log('cascader change value:', value)
+ console.log('处理后的区县编码:', this.form.areaCode)
},
lazy: true,
- lazyLoad(node, resolve) {
- let level = node.level;
- let list = [];
+ lazyLoad (node, resolve) {
+ let level = node.level
+ let list = []
let callback = () => {
resolve(
(list || []).map(ele => ({
@@ -263,26 +240,26 @@
value: ele.value, // 保持原始值类型(字符串)
leaf: level >= 2, // 县级为最后一级
}))
- );
- };
+ )
+ }
if (level === 0) {
getLazyTree('000000000000').then(res => {
- list = res.data.data;
- callback();
- });
+ list = res.data.data
+ callback()
+ })
} else if (level === 1) {
getLazyTree(node.value).then(res => {
- list = res.data.data;
- callback();
- });
+ list = res.data.data
+ callback()
+ })
} else if (level === 2) {
getLazyTree(node.value).then(res => {
- list = res.data.data;
- callback();
- });
+ list = res.data.data
+ callback()
+ })
} else {
- callback();
+ callback()
}
},
},
@@ -302,148 +279,148 @@
],
},
data: [],
- };
+ }
},
computed: {
...mapGetters(['userInfo', 'permission']),
- permissionList() {
+ permissionList () {
return {
addBtn: this.validData(this.permission.dept_add, false),
viewBtn: this.validData(this.permission.dept_view, false),
delBtn: this.validData(this.permission.dept_delete, false),
editBtn: this.validData(this.permission.dept_edit, false),
- };
+ }
},
- ids() {
- let ids = [];
+ ids () {
+ let ids = []
this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(',');
+ ids.push(ele.id)
+ })
+ return ids.join(',')
},
},
methods: {
- initData() {
+ initData () {
getDeptTree().then(res => {
- const column = this.findObject(this.option.column, 'parentId');
- column.dicData = res.data.data;
- });
+ const column = this.findObject(this.option.column, 'parentId')
+ column.dicData = res.data.data
+ })
},
- handleAdd(row) {
- this.parentId = row.id;
- const column = this.findObject(this.option.column, 'parentId');
- column.value = row.id;
- column.addDisabled = true;
- this.form.areaCode = null; // 初始化为空
- this.$refs.crud.rowAdd();
+ handleAdd (row) {
+ this.parentId = row.id
+ const column = this.findObject(this.option.column, 'parentId')
+ column.value = row.id
+ column.addDisabled = true
+ this.form.areaCode = null // 初始化为空
+ this.$refs.crud.rowAdd()
},
- validateSubmitData(row) {
+ validateSubmitData (row) {
if (!row.areaCode) {
- this.$message.warning('请选择行政区划');
- return false;
+ this.$message.warning('请选择行政区划')
+ return false
}
- return true;
+ return true
},
- rowSave(row, done, loading) {
+ rowSave (row, done, loading) {
if (!this.validateSubmitData(row)) {
- loading();
- return;
+ loading()
+ return
}
- console.log('--- Start rowSave ---');
- console.log('Form data before save:', this.form);
+ console.log('--- Start rowSave ---')
+ console.log('Form data before save:', this.form)
// 处理 areaCode,确保只取最后一个值
- let areaCode = this.form.areaCode;
+ let areaCode = this.form.areaCode
if (Array.isArray(areaCode)) {
- areaCode = areaCode[areaCode.length - 1]; // 数组取最后一个
+ areaCode = areaCode[areaCode.length - 1] // 数组取最后一个
} else if (typeof areaCode === 'string' && areaCode.includes(',')) {
- const codes = areaCode.split(',');
- areaCode = codes[codes.length - 1]; // 字符串拆分取最后一个
+ const codes = areaCode.split(',')
+ areaCode = codes[codes.length - 1] // 字符串拆分取最后一个
}
- row.areaCode = areaCode || null; // 确保非空
+ row.areaCode = areaCode || null // 确保非空
- console.log('Row data before submit:', row);
+ console.log('Row data before submit:', row)
add(row).then(
res => {
- console.log('Save response:', res.data);
- const data = res.data.data;
- row.id = data.id;
- row.deptCategoryName = data.deptCategoryName;
- row.tenantId = data.tenantId;
+ console.log('Save response:', res.data)
+ const data = res.data.data
+ row.id = data.id
+ row.deptCategoryName = data.deptCategoryName
+ row.tenantId = data.tenantId
this.$message({
type: 'success',
message: '操作成功!',
- });
- this.onLoad(this.page);
- done(row);
+ })
+ this.onLoad(this.page)
+ done(row)
},
error => {
- console.log('Save error:', error);
- this.loading = false;
- loading();
+ console.log('Save error:', error)
+ this.loading = false
+ loading()
}
- );
+ )
},
- rowUpdate(row, index, done, loading) {
+ rowUpdate (row, index, done, loading) {
if (!this.validateSubmitData(row)) {
- loading();
- return;
+ loading()
+ return
}
- console.log('--- Start rowUpdate ---');
+ console.log('--- Start rowUpdate ---')
// 提交时只使用县级代码
const submitData = {
...row,
areaCode: row.areaCode.split(',').pop(), // 取最后一个代码(县级)
- };
+ }
- console.log('Row data before submit:', row);
+ console.log('Row data before submit:', row)
update(submitData)
.then(
res => {
- console.log('Update response:', res.data);
+ console.log('Update response:', res.data)
this.$message({
type: 'success',
message: '操作成功!',
- });
- this.onLoad(this.page);
- done(row);
+ })
+ this.onLoad(this.page)
+ done(row)
},
error => {
- console.log('Update error:', error);
- this.loading = false;
- loading();
+ console.log('Update error:', error)
+ this.loading = false
+ loading()
}
)
.catch(error => {
- console.log('Update promise rejected:', error);
- this.loading = false;
- });
+ console.log('Update promise rejected:', error)
+ this.loading = false
+ })
},
- rowDel(row, index, done) {
+ rowDel (row, index, done) {
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
- return remove(row.id);
+ return remove(row.id)
})
.then(() => {
this.$message({
type: 'success',
message: '操作成功!',
- });
- this.onLoad(this.page);
- done(row);
- });
+ })
+ this.onLoad(this.page)
+ done(row)
+ })
},
- handleDelete() {
+ handleDelete () {
if (this.selectionList.length === 0) {
- this.$message.warning('请选择至少一条数据');
- return;
+ this.$message.warning('请选择至少一条数据')
+ return
}
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
@@ -451,153 +428,153 @@
type: 'warning',
})
.then(() => {
- return remove(this.ids);
+ return remove(this.ids)
})
.then(() => {
- this.data = [];
- this.parentId = 0;
- this.$refs.crud.refreshTable();
- this.$refs.crud.toggleSelection();
- this.onLoad(this.page);
+ this.data = []
+ this.parentId = 0
+ this.$refs.crud.refreshTable()
+ this.$refs.crud.toggleSelection()
+ this.onLoad(this.page)
this.$message({
type: 'success',
message: '操作成功!',
- });
- });
+ })
+ })
},
- searchReset() {
- this.query = {};
- this.parentId = 0;
- this.onLoad(this.page);
+ searchReset () {
+ this.query = {}
+ this.parentId = 0
+ this.onLoad(this.page)
},
- searchChange(params, done) {
- this.query = params;
- this.parentId = '';
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
+ searchChange (params, done) {
+ this.query = params
+ this.parentId = ''
+ this.page.currentPage = 1
+ this.onLoad(this.page, params)
+ done()
},
- selectionChange(list) {
- this.selectionList = list;
+ selectionChange (list) {
+ this.selectionList = list
},
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
+ selectionClear () {
+ this.selectionList = []
+ this.$refs.crud.toggleSelection()
},
// 修改 beforeOpen 方法
- beforeOpen(done, type) {
+ beforeOpen (done, type) {
if (['add', 'edit'].includes(type)) {
- this.initData();
+ this.initData()
}
if (['edit', 'view'].includes(type)) {
getDept(this.form.id).then(res => {
- const data = res.data.data;
- const areaCode = data.areaCode;
- const areaName = data.areaName;
+ const data = res.data.data
+ const areaCode = data.areaCode
+ const areaName = data.areaName
// 生成完整的行政区划代码(考虑不同级别)
- const fullAreaCode = this.getFullAreaCode(areaCode);
+ const fullAreaCode = this.getFullAreaCode(areaCode)
this.form = Object.assign({}, data, {
hasChildren: this.form.hasChildren,
areaCode: fullAreaCode,
areaName: areaName || '',
- });
+ })
// 调试输出
console.log('回显数据:', {
originalAreaCode: areaCode,
fullAreaCode: fullAreaCode,
areaName: areaName,
- });
- });
+ })
+ })
} else if (type === 'add') {
- this.form.areaCode = '';
- this.form.areaName = '';
+ this.form.areaCode = ''
+ this.form.areaName = ''
}
- done();
+ done()
},
- beforeClose(done) {
- this.parentId = '';
- const column = this.findObject(this.option.column, 'parentId');
- column.value = '';
- column.addDisabled = false;
- this.form.areaCode = null;
- done();
+ beforeClose (done) {
+ this.parentId = ''
+ const column = this.findObject(this.option.column, 'parentId')
+ column.value = ''
+ column.addDisabled = false
+ this.form.areaCode = null
+ done()
},
- currentChange(currentPage) {
- this.page.currentPage = currentPage;
- this.onLoad(this.page);
+ currentChange (currentPage) {
+ this.page.currentPage = currentPage
+ this.onLoad(this.page)
},
- sizeChange(pageSize) {
- this.page.pageSize = pageSize;
- this.onLoad(this.page);
+ sizeChange (pageSize) {
+ this.page.pageSize = pageSize
+ this.onLoad(this.page)
},
- refreshChange() {
- this.onLoad(this.page, this.query);
+ refreshChange () {
+ this.onLoad(this.page, this.query)
},
- onLoad(page, params = {}) {
- this.loading = true;
- console.log('onLoad triggered with page:', page, 'params:', params);
- console.log('Current parentId:', this.parentId, 'query:', this.query);
+ onLoad (page, params = {}) {
+ this.loading = true
+ console.log('onLoad triggered with page:', page, 'params:', params)
+ console.log('Current parentId:', this.parentId, 'query:', this.query)
getLazyList(this.parentId, Object.assign(params, this.query))
.then(res => {
- console.log('onLoad response:', res.data);
+ console.log('onLoad response:', res.data)
// 处理 areaCode,确保是单一字符串
const data = (res.data.data || []).map(item => {
- const fullAreaCode = this.getFullAreaCode(item.areaCode);
+ const fullAreaCode = this.getFullAreaCode(item.areaCode)
return {
...item,
// 保存完整的行政区划代码
areaCode: fullAreaCode,
// 使用原始的县级代码作为实际值
originalAreaCode: item.areaCode,
- };
- });
- this.data = data;
- this.loading = false;
- this.selectionClear();
- console.log('Table data after onLoad:', this.data);
+ }
+ })
+ this.data = data
+ this.loading = false
+ this.selectionClear()
+ console.log('Table data after onLoad:', this.data)
})
.catch(error => {
- console.log('onLoad error:', error);
- this.loading = false;
- this.data = this.data; // 保留当前数据
- console.log('Table data after onLoad error:', this.data);
- });
+ console.log('onLoad error:', error)
+ this.loading = false
+ this.data = this.data // 保留当前数据
+ console.log('Table data after onLoad error:', this.data)
+ })
},
- treeLoad(tree, treeNode, resolve) {
+ treeLoad (tree, treeNode, resolve) {
getChildLazyTree({ parentId: tree.id }).then(res => {
- resolve(res.data.data);
- });
+ resolve(res.data.data)
+ })
},
// 修改 getFullAreaCode 方法
- getFullAreaCode(areaCode) {
- if (!areaCode) return '';
+ getFullAreaCode (areaCode) {
+ if (!areaCode) return ''
// 根据编码长度判断层级
- const code = areaCode.toString();
+ const code = areaCode.toString()
// 如果已经是完整的逗号分隔格式,直接返回
- if (code.includes(',')) return code;
+ if (code.includes(',')) return code
// 处理不同级别的编码
if (code.endsWith('0000000000')) {
// 省级编码
- return code;
+ return code
} else if (code.endsWith('00000000') && !code.endsWith('0000000000')) {
// 市级编码
- const provinceCode = code.substring(0, 2) + '0000000000';
- return `${provinceCode},${code}`;
+ const provinceCode = code.substring(0, 2) + '0000000000'
+ return `${provinceCode},${code}`
} else {
// 县级编码
- const provinceCode = code.substring(0, 2) + '0000000000';
- const cityCode = code.substring(0, 4) + '00000000';
- return `${provinceCode},${cityCode},${code}`;
+ const provinceCode = code.substring(0, 2) + '0000000000'
+ const cityCode = code.substring(0, 4) + '00000000'
+ return `${provinceCode},${cityCode},${code}`
}
},
},
-};
+}
</script>
<style></style>
diff --git a/src/views/system/menu.vue b/src/views/system/menu.vue
index 02ca349..a78e8d8 100644
--- a/src/views/system/menu.vue
+++ b/src/views/system/menu.vue
@@ -1,48 +1,21 @@
<template>
<basic-container>
- <avue-crud
- :option="option"
- :table-loading="loading"
- :data="data"
- ref="crud"
- v-model="form"
- :permission="permissionList"
- :before-open="beforeOpen"
- :before-close="beforeClose"
- @row-del="rowDel"
- @row-update="rowUpdate"
- @row-save="rowSave"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad"
- @tree-load="treeLoad"
- >
+ <avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form"
+ :permission="permissionList" :before-open="beforeOpen" :before-close="beforeClose" @row-del="rowDel"
+ @row-update="rowUpdate" @row-save="rowSave" @search-change="searchChange" @search-reset="searchReset"
+ @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
+ @refresh-change="refreshChange" @on-load="onLoad" @tree-load="treeLoad">
<template #menu-left>
- <el-button
- type="danger"
- icon="el-icon-delete"
- v-if="permission.menu_delete"
- plain
- @click="handleDelete"
- >删 除
+ <el-button type="danger" icon="el-icon-delete" v-if="permission.menu_delete" plain @click="handleDelete">删 除
</el-button>
</template>
<template #menu="scope">
- <el-button
- type="primary"
- text
- icon="el-icon-plus"
- @click.stop="handleAdd(scope.row, scope.index)"
- v-if="userInfo.role_name.includes('admin') && scope.row.category === 1"
- >新增子项
+ <el-button type="primary" text icon="el-icon-plus" @click.stop="handleAdd(scope.row, scope.index)"
+ v-if="userInfo.role_name.includes('admin') && scope.row.category === 1">新增子项
</el-button>
</template>
<template #name="{ row }">
- <i class="namei" :class="row.source" />
+ <i class="namei" :class="row.source" />
<span>{{ row.name }}</span>
</template>
<template #source="{ row }">
@@ -55,14 +28,14 @@
</template>
<script>
-import { getLazyList, remove, update, add, getMenu } from '@/api/system/menu';
-import { mapGetters } from 'vuex';
-import iconList from '@/config/iconList';
-import func from '@/utils/func';
-import { getMenuTree } from '@/api/system/menu';
+import { getLazyList, remove, update, add, getMenu } from '@/api/system/menu'
+import { mapGetters } from 'vuex'
+import iconList from '@/config/iconList'
+import func from '@/utils/func'
+import { getMenuTree } from '@/api/system/menu'
export default {
- data() {
+ data () {
return {
form: {},
query: {},
@@ -88,6 +61,10 @@
viewBtn: true,
menuWidth: 320,
dialogClickModal: false,
+
+ height: 'auto',
+ calcHeight: 20,
+
column: [
{
label: '菜单名称',
@@ -287,110 +264,110 @@
],
},
data: [],
- };
+ }
},
watch: {
- 'form.category'() {
- const category = func.toInt(this.form.category);
+ 'form.category' () {
+ const category = func.toInt(this.form.category)
this.$refs.crud.option.column.filter(item => {
if (item.prop === 'path') {
- item.rules[0].required = category === 1;
+ item.rules[0].required = category === 1
}
if (item.prop === 'isOpen') {
- item.disabled = category === 2;
+ item.disabled = category === 2
}
- });
+ })
},
},
computed: {
...mapGetters(['userInfo', 'permission']),
- permissionList() {
+ permissionList () {
return {
addBtn: this.validData(this.permission.menu_add, false),
viewBtn: this.validData(this.permission.menu_view, false),
delBtn: this.validData(this.permission.menu_delete, false),
editBtn: this.validData(this.permission.menu_edit, false),
- };
+ }
},
- ids() {
- let ids = [];
+ ids () {
+ let ids = []
this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(',');
+ ids.push(ele.id)
+ })
+ return ids.join(',')
},
},
methods: {
- initData() {
+ initData () {
getMenuTree().then(res => {
- const column = this.findObject(this.option.column, 'parentId');
- column.dicData = res.data.data;
- });
+ const column = this.findObject(this.option.column, 'parentId')
+ column.dicData = res.data.data
+ })
},
- handleAdd(row) {
- this.parentId = row.id;
- const column = this.findObject(this.option.column, 'parentId');
- column.value = row.id;
- column.addDisabled = true;
- this.$refs.crud.rowAdd();
+ handleAdd (row) {
+ this.parentId = row.id
+ const column = this.findObject(this.option.column, 'parentId')
+ column.value = row.id
+ column.addDisabled = true
+ this.$refs.crud.rowAdd()
},
- rowSave(row, done, loading) {
+ rowSave (row, done, loading) {
add(row).then(
res => {
// 获取新增数据的相关字段
- const data = res.data.data;
- row.id = data.id;
+ const data = res.data.data
+ row.id = data.id
this.$message({
type: 'success',
message: '操作成功!',
- });
+ })
// 数据回调进行刷新
- done(row);
+ done(row)
},
error => {
- window.console.log(error);
- loading();
+ window.console.log(error)
+ loading()
}
- );
+ )
},
- rowUpdate(row, index, done, loading) {
+ rowUpdate (row, index, done, loading) {
update(row).then(
() => {
this.$message({
type: 'success',
message: '操作成功!',
- });
+ })
// 数据回调进行刷新
- done(row);
+ done(row)
},
error => {
- window.console.log(error);
- loading();
+ window.console.log(error)
+ loading()
}
- );
+ )
},
- rowDel(row, index, done) {
+ rowDel (row, index, done) {
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
- return remove(row.id);
+ return remove(row.id)
})
.then(() => {
this.$message({
type: 'success',
message: '操作成功!',
- });
+ })
// 数据回调进行刷新
- done(row);
- });
+ done(row)
+ })
},
- handleDelete() {
+ handleDelete () {
if (this.selectionList.length === 0) {
- this.$message.warning('请选择至少一条数据');
- return;
+ this.$message.warning('请选择至少一条数据')
+ return
}
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
@@ -398,90 +375,91 @@
type: 'warning',
})
.then(() => {
- return remove(this.ids);
+ return remove(this.ids)
})
.then(() => {
// 刷新表格数据并重载
- this.data = [];
- this.parentId = 0;
- this.$refs.crud.refreshTable();
- this.$refs.crud.toggleSelection();
+ this.data = []
+ this.parentId = 0
+ this.$refs.crud.refreshTable()
+ this.$refs.crud.toggleSelection()
// 表格数据重载
- this.onLoad(this.page);
+ this.onLoad(this.page)
this.$message({
type: 'success',
message: '操作成功!',
- });
- });
+ })
+ })
},
- searchReset() {
- this.query = {};
- this.parentId = 0;
- this.onLoad(this.page);
+ searchReset () {
+ this.query = {}
+ this.parentId = 0
+ this.onLoad(this.page)
},
- searchChange(params, done) {
- this.query = params;
- this.parentId = '';
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
+ searchChange (params, done) {
+ this.query = params
+ this.parentId = ''
+ this.page.currentPage = 1
+ this.onLoad(this.page, params)
+ done()
},
- selectionChange(list) {
- this.selectionList = list;
+ selectionChange (list) {
+ this.selectionList = list
},
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
+ selectionClear () {
+ this.selectionList = []
+ this.$refs.crud.toggleSelection()
},
- beforeOpen(done, type) {
+ beforeOpen (done, type) {
if (['add', 'edit'].includes(type)) {
- this.initData();
+ this.initData()
}
if (['edit', 'view'].includes(type)) {
getMenu(this.form.id).then(res => {
this.form = Object.assign(res.data.data, {
hasChildren: this.form.hasChildren,
- });
- });
+ })
+ })
}
- done();
+ done()
},
- beforeClose(done) {
- this.parentId = '';
- const column = this.findObject(this.option.column, 'parentId');
- column.value = '';
- column.addDisabled = false;
- done();
+ beforeClose (done) {
+ this.parentId = ''
+ const column = this.findObject(this.option.column, 'parentId')
+ column.value = ''
+ column.addDisabled = false
+ done()
},
- currentChange(currentPage) {
- this.page.currentPage = currentPage;
+ currentChange (currentPage) {
+ this.page.currentPage = currentPage
},
- sizeChange(pageSize) {
- this.page.pageSize = pageSize;
+ sizeChange (pageSize) {
+ this.page.pageSize = pageSize
},
- refreshChange() {
- this.onLoad(this.page, this.query);
+ refreshChange () {
+ this.onLoad(this.page, this.query)
},
- onLoad(page, params = {}) {
- this.loading = true;
+ onLoad (page, params = {}) {
+ this.loading = true
getLazyList(this.parentId, Object.assign(params, this.query)).then(res => {
- this.data = res.data.data;
- this.loading = false;
- this.selectionClear();
- });
+ this.data = res.data.data
+ this.loading = false
+ this.selectionClear()
+ })
},
- treeLoad(tree, treeNode, resolve) {
- const parentId = tree.id;
+ treeLoad (tree, treeNode, resolve) {
+ const parentId = tree.id
getLazyList(parentId).then(res => {
- resolve(res.data.data);
- });
+ resolve(res.data.data)
+ })
},
},
-};
+}
</script>
<style scoped lang="scss">
.namei {
margin-right: 5px;
-}</style>
\ No newline at end of file
+}
+</style>
\ No newline at end of file
diff --git a/src/views/system/sysConfig.vue b/src/views/system/sysConfig.vue
index 2e9bf23..7fdc560 100644
--- a/src/views/system/sysConfig.vue
+++ b/src/views/system/sysConfig.vue
@@ -1,64 +1,31 @@
<template>
<basic-container>
- <avue-crud
- :option="option"
- :table-loading="loading"
- :data="data"
- v-model:page="page"
- ref="crud"
- @row-del="rowDel"
- v-model="form"
- :permission="permissionList"
- @row-update="rowUpdate"
- @row-save="rowSave"
- :before-open="beforeOpen"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad"
- >
+ <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" ref="crud" @row-del="rowDel"
+ v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen"
+ @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
+ @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
<template #menu-left>
- <el-button
- type="primary"
- icon="el-icon-plus"
- v-if="permissionList.addBtn"
- @click="$refs.crud.rowAdd()"
- >新增</el-button>
- <el-button
- type="danger"
- plain
- icon="el-icon-delete"
- v-if="permissionList.delBtn"
- @click="handleDelete"
- >删除</el-button>
+ <el-button type="primary" icon="el-icon-plus" v-if="permissionList.addBtn"
+ @click="$refs.crud.rowAdd()">新增</el-button>
+ <el-button type="danger" plain icon="el-icon-delete" v-if="permissionList.delBtn"
+ @click="handleDelete">删除</el-button>
</template>
<template #menu="{ row, index }">
- <el-button
- type="text"
- icon="el-icon-view"
- v-if="permissionList.viewBtn"
- @click.stop="$refs.crud.rowView(row, index)"
- >查看</el-button>
- <el-button
- type="text"
- icon="el-icon-edit"
- v-if="permissionList.editBtn"
- @click.stop="$refs.crud.rowEdit(row, index)"
- >编辑</el-button>
+ <el-button type="text" icon="el-icon-view" v-if="permissionList.viewBtn"
+ @click.stop="$refs.crud.rowView(row, index)">查看</el-button>
+ <el-button type="text" icon="el-icon-edit" v-if="permissionList.editBtn"
+ @click.stop="$refs.crud.rowEdit(row, index)">编辑</el-button>
</template>
</avue-crud>
</basic-container>
</template>
<script>
-import { getList, remove, update, add, getDetail } from '@/api/system/sysConfig';
-import { mapGetters } from 'vuex';
+import { getList, remove, update, add, getDetail } from '@/api/system/sysConfig'
+import { mapGetters } from 'vuex'
export default {
- data() {
+ data () {
return {
form: {},
query: {},
@@ -85,6 +52,10 @@
excelBtn: true,
dialogClickModal: false,
grid: false,
+
+ height: 'auto',
+ calcHeight: 20,
+
column: [
{
label: '系统名称',
@@ -149,97 +120,97 @@
],
},
data: [],
- };
+ }
},
computed: {
...mapGetters(['permission']),
- permissionList() {
+ permissionList () {
return {
addBtn: this.permission.sysConfig_add,
viewBtn: this.permission.sysConfig_view,
delBtn: this.permission.sysConfig_delete,
editBtn: this.permission.sysConfig_edit,
- };
+ }
},
- ids() {
- let ids = [];
+ ids () {
+ let ids = []
this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(',');
+ ids.push(ele.id)
+ })
+ return ids.join(',')
},
},
methods: {
- rowSave(row, done, loading) {
+ rowSave (row, done, loading) {
add(row).then(
() => {
- this.onLoad(this.page);
+ this.onLoad(this.page)
this.$message({
type: 'success',
message: '操作成功!',
- });
- done();
+ })
+ done()
},
error => {
- window.console.log(error);
- loading();
+ window.console.log(error)
+ loading()
}
- );
+ )
},
- rowUpdate(row, index, done, loading) {
+ rowUpdate (row, index, done, loading) {
update(row).then(
() => {
- this.onLoad(this.page);
+ this.onLoad(this.page)
this.$message({
type: 'success',
message: '操作成功!',
- });
- done();
+ })
+ done()
},
error => {
- window.console.log(error);
- loading();
+ window.console.log(error)
+ loading()
}
- );
+ )
},
- rowDel(row) {
+ rowDel (row) {
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
- return remove(row.id);
+ return remove(row.id)
})
.then(() => {
- this.onLoad(this.page);
+ this.onLoad(this.page)
this.$message({
type: 'success',
message: '操作成功!',
- });
- });
+ })
+ })
},
- searchReset() {
- this.query = {};
- this.onLoad(this.page);
+ searchReset () {
+ this.query = {}
+ this.onLoad(this.page)
},
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
+ searchChange (params, done) {
+ this.query = params
+ this.page.currentPage = 1
+ this.onLoad(this.page, params)
+ done()
},
- selectionChange(list) {
- this.selectionList = list;
+ selectionChange (list) {
+ this.selectionList = list
},
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
+ selectionClear () {
+ this.selectionList = []
+ this.$refs.crud.toggleSelection()
},
- handleDelete() {
+ handleDelete () {
if (this.selectionList.length === 0) {
- this.$message.warning('请选择至少一条数据');
- return;
+ this.$message.warning('请选择至少一条数据')
+ return
}
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
@@ -247,59 +218,59 @@
type: 'warning',
})
.then(() => {
- return remove(this.ids);
+ return remove(this.ids)
})
.then(() => {
- this.onLoad(this.page);
+ this.onLoad(this.page)
this.$message({
type: 'success',
message: '操作成功!',
- });
- this.$refs.crud.toggleSelection();
- });
+ })
+ this.$refs.crud.toggleSelection()
+ })
},
- beforeOpen(done, type) {
+ beforeOpen (done, type) {
if (['edit', 'view'].includes(type)) {
getDetail(this.form.id).then(res => {
- this.form = res.data.data;
- });
+ this.form = res.data.data
+ })
}
- done();
+ done()
},
- currentChange(currentPage) {
- this.page.currentPage = currentPage;
+ currentChange (currentPage) {
+ this.page.currentPage = currentPage
},
- sizeChange(pageSize) {
- this.page.pageSize = pageSize;
+ sizeChange (pageSize) {
+ this.page.pageSize = pageSize
},
- refreshChange() {
- this.onLoad(this.page, this.query);
+ refreshChange () {
+ this.onLoad(this.page, this.query)
},
- onLoad(page, params = {}) {
- const { releaseTimeRange } = this.query;
+ onLoad (page, params = {}) {
+ const { releaseTimeRange } = this.query
let values = {
...params,
...this.query,
- };
+ }
if (releaseTimeRange) {
values = {
...values,
releaseTime_datege: releaseTimeRange[0],
releaseTime_datelt: releaseTimeRange[1],
- };
- values.releaseTimeRange = null;
+ }
+ values.releaseTimeRange = null
}
- this.loading = true;
+ this.loading = true
getList(page.currentPage, page.pageSize, values).then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.loading = false;
- this.selectionClear();
- });
+ const data = res.data.data
+ this.page.total = data.total
+ this.data = data.records
+ this.loading = false
+ this.selectionClear()
+ })
},
},
-};
+}
</script>
<style scoped lang="scss"></style>
--
Gitblit v1.9.3