From a3c868db4d017961be2d394eadb7d428045d5adc Mon Sep 17 00:00:00 2001 From: lihang <lihang@vci-tech.com> Date: 星期四, 13 七月 2023 11:13:16 +0800 Subject: [PATCH] 业务类型页面增加生命周期的处理 --- Source/UBCS-WEB/dist/src/views/system/client.vue | 340 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 340 insertions(+), 0 deletions(-) diff --git a/Source/UBCS-WEB/dist/src/views/system/client.vue b/Source/UBCS-WEB/dist/src/views/system/client.vue new file mode 100644 index 0000000..a630f6f --- /dev/null +++ b/Source/UBCS-WEB/dist/src/views/system/client.vue @@ -0,0 +1,340 @@ +<template> + <basic-container> + <avue-crud :option="option" + :table-loading="loading" + :data="data" + :page.sync="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 slot="menuLeft"> + <el-button type="danger" + size="small" + icon="el-icon-delete" + plain + v-if="permission.client_delete" + @click="handleDelete">鍒� 闄� + </el-button> + </template> + </avue-crud> + </basic-container> +</template> + +<script> + import {getList, getDetail, add, update, remove} from "@/api/system/client"; + import {mapGetters} from "vuex"; + + export default { + data() { + return { + form: {}, + query: {}, + loading: true, + page: { + pageSize: 10, + currentPage: 1, + total: 0 + }, + selectionList: [], + option: { + height: 'auto', + calcHeight: 30, + tip: false, + searchShow: true, + searchMenuSpan: 6, + border: true, + index: true, + viewBtn: true, + selection: true, + dialogClickModal: false, + column: [ + { + label: "搴旂敤id", + prop: "clientId", + search: true, + rules: [{ + required: true, + message: "璇疯緭鍏ュ鎴风id", + trigger: "blur" + }] + }, + { + label: "搴旂敤瀵嗛挜", + prop: "clientSecret", + search: true, + rules: [{ + required: true, + message: "璇疯緭鍏ュ鎴风瀵嗛挜", + trigger: "blur" + }] + }, + { + label: "鎺堟潈绫诲瀷", + prop: "authorizedGrantTypes", + type: "checkbox", + value: "refresh_token,password,authorization_code", + dicData: [ + { + label: "refresh_token", + value: "refresh_token" + }, + { + label: "password", + value: "password" + }, + { + label: "authorization_code", + value: "authorization_code" + }, + { + label: "captcha", + value: "captcha" + }, + { + label: "social", + value: "social" + } + ], + rules: [{ + required: true, + message: "璇疯緭鍏ユ巿鏉冪被鍨�", + trigger: "blur" + }] + }, + { + label: "鎺堟潈鑼冨洿", + prop: "scope", + value: "all", + rules: [{ + required: true, + message: "璇疯緭鍏ユ巿鏉冭寖鍥�", + trigger: "blur" + }] + }, + { + label: "浠ょ墝绉掓暟", + prop: "accessTokenValidity", + type: "number", + value: 3600, + rules: [{ + required: true, + message: "璇疯緭鍏ヤ护鐗岃繃鏈熺鏁�", + trigger: "blur" + }] + }, + { + label: "鍒锋柊绉掓暟", + prop: "refreshTokenValidity", + type: "number", + value: 604800, + hide: true, + rules: [{ + required: true, + message: "璇疯緭鍏ュ埛鏂颁护鐗岃繃鏈熺鏁�", + trigger: "blur" + }] + }, + { + label: "鍥炶皟鍦板潃", + prop: "webServerRedirectUri", + hide: true, + rules: [{ + required: true, + message: "璇疯緭鍏ュ洖璋冨湴鍧�", + trigger: "blur" + }] + }, + { + label: "璧勬簮闆嗗悎", + prop: "resourceIds", + hide: true, + rules: [{ + message: "璇疯緭鍏ヨ祫婧愰泦鍚�", + trigger: "blur" + }] + }, + { + label: "鏉冮檺", + prop: "authorities", + hide: true, + rules: [{ + message: "璇疯緭鍏ユ潈闄�", + trigger: "blur" + }] + }, + { + label: "鑷姩鎺堟潈", + prop: "autoapprove", + hide: true, + rules: [{ + message: "璇疯緭鍏ヨ嚜鍔ㄦ巿鏉�", + trigger: "blur" + }] + }, + { + label: "闄勫姞璇存槑", + hide: true, + prop: "additionalInformation", + span: 24, + rules: [{ + message: "璇疯緭鍏ラ檮鍔犺鏄�", + trigger: "blur" + }] + }, + ] + }, + data: [] + }; + }, + computed: { + ...mapGetters(["permission"]), + permissionList() { + return { + addBtn: this.vaildData(this.permission.client_add), + viewBtn: this.vaildData(this.permission.client_view), + delBtn: this.vaildData(this.permission.client_delete), + editBtn: this.vaildData(this.permission.client_edit) + }; + }, + ids() { + let ids = []; + this.selectionList.forEach(ele => { + ids.push(ele.id); + }); + return ids.join(","); + } + }, + beforeUpdate() { + console.log(this.data) + }, + methods: { + rowSave(row, done, loading) { + add(row).then(() => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "鎿嶄綔鎴愬姛!" + }); + done(); + + }, error => { + window.console.log(error); + loading(); + }); + console.log(row) + }, + rowUpdate(row, index, done, loading) { + update(row).then(() => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "鎿嶄綔鎴愬姛!" + }); + done(); + }, error => { + window.console.log(error); + loading(); + }); + console.log('缂栬緫',row) + }, + rowDel(row) { + this.$confirm("纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }) + .then(() => { + return remove(row.id); + }) + .then(() => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "鎿嶄綔鎴愬姛!" + }); + }); + }, + 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(); + }, + handleDelete() { + if (this.selectionList.length === 0) { + this.$message.warning("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�"); + return; + } + this.$confirm("纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }) + .then(() => { + return remove(this.ids); + }) + .then(() => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "鎿嶄綔鎴愬姛!" + }); + this.$refs.crud.toggleSelection(); + }); + }, + beforeOpen(done, type) { + if (["edit", "view"].includes(type)) { + getDetail(this.form.id).then(res => { + this.form = res.data.data; + }); + } + done(); + }, + 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; + 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(); + console.log(this.data) + }); + } + } + }; +</script> + +<style> +</style> -- Gitblit v1.9.3