update: fix bugs

This commit is contained in:
2025-10-13 15:52:52 +08:00
parent a1fee0a3e9
commit e285ee2d24
6 changed files with 408 additions and 33 deletions

View File

@@ -0,0 +1,167 @@
<template>
<basic-container>
<avue-crud :option="option"
v-model:search="search"
v-model:page="page"
v-model="form"
:table-loading="loading"
:data="data"
:permission="permissionList"
:before-open="beforeOpen"
ref="crud"
@row-update="rowUpdate"
@row-save="rowSave"
@row-del="rowDel"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad">
</avue-crud>
</basic-container>
</template>
<script>
import { getList, getDetail, add, update, remove } from '@/api/kiosk/priceList';
import option from '@/option/kiosk/priceList';
import { mapGetters } from 'vuex';
import 'nprogress/nprogress.css';
export default {
data() {
return {
form: {},
depts: '',
query: {},
search: {},
loading: true,
page: {
pageSize: 10,
currentPage: 1,
total: 0
},
selectionList: [],
option: option,
data: [],
deptOptions: [],
};
},
computed: {
...mapGetters(['permission']),
permissionList() {
return {
addBtn: this.validData(this.permission.priceList_add, false),
viewBtn: this.validData(this.permission.priceList_view, false),
delBtn: this.validData(this.permission.priceList_delete, false),
editBtn: this.validData(this.permission.priceList_edit, false)
};
},
ids() {
let ids = [];
this.selectionList.forEach(ele => {
ids.push(ele.id);
});
return ids.join(',');
}
},
methods: {
rowSave(row, done, loading) {
add(row).then(() => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: 'Success!'
});
done();
}, error => {
loading();
window.console.log(error);
});
},
rowUpdate(row, index, done, loading) {
update(row).then(() => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: 'Success!'
});
done();
}, error => {
loading();
console.log(error);
});
},
rowDel(row) {
this.$confirm('Confirmation for Delete?', {
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel',
type: 'warning'
})
.then(() => {
return remove(row.id);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: 'Success!'
});
});
},
beforeOpen(done, type) {
if (['edit', 'view'].includes(type)) {
getDetail(this.form.id).then(res => {
this.form = res.data.data;
});
}
done();
},
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
selectionChange(list) {
this.selectionList = list;
},
selectionClear() {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
},
refreshChange() {
this.onLoad(this.page, this.query);
},
onLoad(page, params = {}) {
this.loading = true;
const {} = this.query;
let values = {};
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();
});
}
}
};
</script>
<style>
</style>

View File

@@ -83,7 +83,7 @@
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
message: "Success!"
});
done();
}, error => {
@@ -96,7 +96,7 @@
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
message: "Success!"
});
done();
}, error => {
@@ -105,9 +105,9 @@
});
},
rowDel(row) {
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
this.$confirm("Confirmation for delete?", {
confirmButtonText: "Confirm",
cancelButtonText: "Cancel",
type: "warning"
})
.then(() => {
@@ -117,18 +117,18 @@
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
message: "Success!"
});
});
},
handleDelete() {
if (this.selectionList.length === 0) {
this.$message.warning("请选择至少一条数据");
this.$message.warning("Please select one or more");
return;
}
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
this.$confirm("Confirmation for delete?", {
confirmButtonText: "Confirm",
cancelButtonText: "Cancel",
type: "warning"
})
.then(() => {
@@ -138,7 +138,7 @@
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
message: "Success!"
});
this.$refs.crud.toggleSelection();
});

View File

@@ -38,7 +38,7 @@
icon="el-icon-circle-plus"
@click.stop="handleAdd(scope.row, scope.index)"
v-if="userInfo.authority.includes('admin')"
>ADD SUB
>Add Sub
</el-button>
</template>
<template #deptCategory="{ row }">

View File

@@ -194,8 +194,8 @@
</el-tree>
<template #footer>
<span class="dialog-footer">
<el-button @click="roleBox = false">取 消</el-button>
<el-button type="primary" @click="submitRole">确 定</el-button>
<el-button @click="roleBox = false">Cancel</el-button>
<el-button type="primary" @click="submitRole">Confirm</el-button>
</span>
</template>
</el-dialog>
@@ -518,7 +518,7 @@ export default {
this.$message.warning('Please select one or more');
return;
}
this.$confirm('Confirmation for DEL?', {
this.$confirm('Confirmation for Delete?', {
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel',
type: 'warning'
@@ -544,7 +544,7 @@ export default {
this.$message.warning('please select one or more');
return;
}
this.$confirm('确定将选择数据通过审核?', {
this.$confirm('Confirmation for pass audit?', {
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel',
type: 'warning'
@@ -566,9 +566,9 @@ export default {
this.$message.warning('Please select at least one record');
return;
}
this.$confirm('确定将选择数据拒绝审核?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
this.$confirm('Confirmation for reject audit?', {
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel',
type: 'warning'
})
.then(() => {
@@ -592,9 +592,9 @@ export default {
this.$message.warning('Please select at least one record');
return;
}
this.$confirm('确定将选择账号密码重置为初始密码?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
this.$confirm('Confirmation for rest password?', {
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel',
type: 'warning'
})
.then(() => {
@@ -603,7 +603,7 @@ export default {
.then(() => {
this.$message({
type: 'success',
message: '操作成功!'
message: 'Success!'
});
this.$refs.crud.toggleSelection();
});
@@ -630,9 +630,9 @@ export default {
this.$message.warning('Please select at least one record');
return;
}
this.$confirm('确定将选择账号解封?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
this.$confirm('Confirmation for unlock account?', {
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel',
type: 'warning'
})
.then(() => {
@@ -641,7 +641,7 @@ export default {
.then(() => {
this.$message({
type: 'success',
message: '操作成功!'
message: 'Success!'
});
});
},
@@ -657,9 +657,9 @@ export default {
handleExport() {
const account = func.toStr(this.search.account);
const realName = func.toStr(this.search.realName);
this.$confirm('是否导出用户数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
this.$confirm('Export user data?', 'Tips', {
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel',
type: 'warning'
}).then(() => {
NProgress.start();
@@ -668,7 +668,7 @@ export default {
this.website.tokenHeader
}=${getToken()}&account=${account}&realName=${realName}`
).then(res => {
downloadXls(res.data, `用户数据表${this.$dayjs().format('YYYY-MM-DD')}.xlsx`);
downloadXls(res.data, `UserData${this.$dayjs().format('YYYY-MM-DD')}.xlsx`);
NProgress.done();
});
});
@@ -677,7 +677,7 @@ export default {
exportBlob(
`/blade-system/user/export-template?${this.website.tokenHeader}=${getToken()}`
).then(res => {
downloadXls(res.data, '用户数据模板.xlsx');
downloadXls(res.data, 'UserDataTemplate.xlsx');
});
},
beforeOpen(done, type) {
@@ -736,7 +736,7 @@ export default {
this.platformOnLoad(this.platformPage);
this.$message({
type: 'success',
message: '操作成功!'
message: 'Success!'
});
done();
},