From f14f0c01c3f82921ca4ef439abdd9f92596ac137 Mon Sep 17 00:00:00 2001
From: 李喆(开发组) <lzhe@yxqiche.com>
Date: 星期一, 16 六月 2025 14:34:22 +0800
Subject: [PATCH] 1
---
src/views/flow/todolist.vue | 198 +++++++++++--------------------------------------
1 files changed, 44 insertions(+), 154 deletions(-)
diff --git a/src/views/flow/todolist.vue b/src/views/flow/todolist.vue
index 1e2121d..0764443 100644
--- a/src/views/flow/todolist.vue
+++ b/src/views/flow/todolist.vue
@@ -1,13 +1,10 @@
<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-save="rowSave" @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" v-model="form" ref="crud"
+ @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" plain
- @click="reassign">閲嶆柊鎸囨淳
+ <el-button type="primary" plain @click="reassign">閲嶆柊鎸囨淳
</el-button>
</template>
<!-- <template #source="{ row }">
@@ -20,7 +17,7 @@
</template>
<script>
-import { getLazyList, remove, update, add, getMenu } from '@/api/system/menu';
+import { getLazyList, remove, update, add, getMenu } from '@/api/flow/todolist';
import { mapGetters } from 'vuex';
import iconList from '@/config/iconList';
import func from '@/utils/func';
@@ -29,6 +26,11 @@
export default {
data() {
return {
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0,
+ },
form: {},
query: {},
loading: true,
@@ -41,24 +43,23 @@
},
option: {
addBtn: false,
- lazy: true,
+ columnBtn: false,
tip: false,
- simplePage: true,
+ // simplePage: true,
searchShow: true,
searchMenuSpan: 6,
dialogWidth: '60%',
- tree: true,
+ // tree: true,
border: true,
index: true,
- selection: true,
- viewBtn: true,
+ // selection: true,
+ // viewBtn: true,
menuWidth: 320,
dialogClickModal: false,
column: [
{
label: '鍒涘缓鏃堕棿',
prop: 'time',
- width: 300,
type: 'datetime',
search: true,
searchRange: true,
@@ -83,14 +84,15 @@
},
],
},
-
+
{
label: '缂栧彿',
prop: 'name',
- width: 300,
+ width: 100,
},
{
label: '娴佺▼绫诲瀷',
+ width: 100,
prop: 'path',
rules: [
{
@@ -102,41 +104,50 @@
},
{
label: '瀹炰緥缂栧彿',
+ width: 100,
type: 'tree',
},
{
label: '娴佺▼瀹炰緥鍚�',
+ width: 100,
type: 'tree',
},
{
label: '鏈哄簥',
+ width: 100,
type: 'tree',
},
{
label: '鍒涘缓浜�',
+ width: 100,
type: 'tree',
},
{
label: '鍒涘缓鏃堕棿',
+ width: 100,
type: 'tree',
},
{
label: '鍒拌揪鏃堕棿',
+ width: 100,
type: 'tree',
},
{
label: '鍒拌揪鎻忚堪',
+ width: 100,
type: 'tree',
},
{
label: '鏂囦欢',
+ width: 100,
type: 'tree',
},
{
label: '鍒拌揪鏃堕棿',
+ width: 100,
type: 'tree',
},
-
+
],
},
data: [],
@@ -165,114 +176,19 @@
editBtn: this.validData(this.permission.menu_edit, false),
};
},
- ids() {
- let ids = [];
- this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(',');
- },
},
methods: {
- reassign () {// 閲嶆柊鎸囨淳
+ reassign() {// 閲嶆柊鎸囨淳
},
- initData() {
- getMenuTree().then(res => {
- 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();
- },
- rowSave(row, done, loading) {
- add(row).then(
- res => {
- // 鑾峰彇鏂板鏁版嵁鐨勭浉鍏冲瓧娈�
- const data = res.data.data;
- row.id = data.id;
- this.$message({
- type: 'success',
- message: '鎿嶄綔鎴愬姛!',
- });
- // 鏁版嵁鍥炶皟杩涜鍒锋柊
- done(row);
- },
- error => {
- window.console.log(error);
- loading();
- }
- );
- },
- rowUpdate(row, index, done, loading) {
- update(row).then(
- () => {
- this.$message({
- type: 'success',
- message: '鎿嶄綔鎴愬姛!',
- });
- // 鏁版嵁鍥炶皟杩涜鍒锋柊
- done(row);
- },
- error => {
- window.console.log(error);
- loading();
- }
- );
- },
- rowDel(row, index, done) {
- this.$confirm('纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?', {
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- })
- .then(() => {
- return remove(row.id);
- })
- .then(() => {
- this.$message({
- type: 'success',
- message: '鎿嶄綔鎴愬姛!',
- });
- // 鏁版嵁鍥炶皟杩涜鍒锋柊
- done(row);
- });
- },
- handleDelete() {
- if (this.selectionList.length === 0) {
- this.$message.warning('璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�');
- return;
- }
- this.$confirm('纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?', {
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- })
- .then(() => {
- return remove(this.ids);
- })
- .then(() => {
- // 鍒锋柊琛ㄦ牸鏁版嵁骞堕噸杞�
- this.data = [];
- this.parentId = 0;
- this.$refs.crud.refreshTable();
- this.$refs.crud.toggleSelection();
- // 琛ㄦ牸鏁版嵁閲嶈浇
- this.onLoad(this.page);
- this.$message({
- type: 'success',
- message: '鎿嶄綔鎴愬姛!',
- });
- });
+ searchChange(params, done) {
+ this.query = params;
+ this.page.currentPage = 1;
+ this.onLoad(this.page, params);
+ done();
},
searchReset() {
this.query = {};
- this.parentId = 0;
this.onLoad(this.page);
},
searchChange(params, done) {
@@ -280,33 +196,6 @@
this.parentId = '';
this.page.currentPage = 1;
this.onLoad(this.page, params);
- done();
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
- },
- beforeOpen(done, type) {
- if (['add', 'edit'].includes(type)) {
- 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();
- },
- beforeClose(done) {
- this.parentId = '';
- const column = this.findObject(this.option.column, 'parentId');
- column.value = '';
- column.addDisabled = false;
done();
},
currentChange(currentPage) {
@@ -318,19 +207,20 @@
refreshChange() {
this.onLoad(this.page, this.query);
},
+
onLoad(page, params = {}) {
+ const query = {
+ ...this.query,
+ category: params.category ? flowCategory(params.category) : null,
+ mode: this.mode,
+ };
this.loading = true;
- getLazyList(this.parentId, Object.assign(params, this.query)).then(res => {
- this.data = res.data.data;
+ getLazyList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {
+ const data = res.data.data;
+ this.page.total = data.total;
+ this.data = data.records;
this.loading = false;
- this.selectionClear();
});
- },
- treeLoad(tree, treeNode, resolve) {
- const parentId = tree.id;
- // getLazyList(parentId).then(res => {
- // resolve(res.data.data);
- // });
},
},
};
--
Gitblit v1.9.3