| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud :option="option" |
| | | :table-loading="loading" |
| | | :data="data" |
| | | ref="crud" |
| | | v-model="form" |
| | | :page.sync="page" |
| | | :permission="permissionList" |
| | | :before-open="beforeOpen" |
| | | @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"> |
| | | <basic-container |
| | | :class="[ |
| | | $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize', |
| | | $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : '' |
| | | ]" |
| | | > |
| | | <avue-crud |
| | | class="tablesss" |
| | | :option="option" |
| | | :table-loading="loading" |
| | | :data="data" |
| | | ref="crud" |
| | | v-model="form" |
| | | :page.sync="page" |
| | | :permission="permissionList" |
| | | :before-open="beforeOpen" |
| | | @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" |
| | | > |
| | | <template slot="menuLeft"> |
| | | <el-button type="danger" |
| | | size="small" |
| | | icon="el-icon-delete" |
| | | v-if="permission.tenant_delete" |
| | | plain |
| | | @click="handleDelete">删 除 |
| | | <el-button |
| | | type="danger" |
| | | size="small" |
| | | icon="el-icon-delete" |
| | | v-if="permission.tenant_delete" |
| | | plain |
| | | @click="handleDelete" |
| | | >删 除 |
| | | </el-button> |
| | | <el-button size="small" |
| | | plain |
| | | v-if="userInfo.role_name.includes('administrator')" |
| | | icon="el-icon-setting" |
| | | @click="handleSetting">授权配置 |
| | | <el-button |
| | | size="small" |
| | | plain |
| | | v-if="userInfo.role_name.includes('administrator')" |
| | | icon="el-icon-setting" |
| | | @click="handleSetting" |
| | | >授权配置 |
| | | </el-button> |
| | | <el-button size="small" |
| | | plain |
| | | v-if="userInfo.role_name.includes('administrator')" |
| | | icon="el-icon-coin" |
| | | @click="handleDatasource">数据源配置 |
| | | <el-button |
| | | size="small" |
| | | plain |
| | | v-if="userInfo.role_name.includes('administrator')" |
| | | icon="el-icon-coin" |
| | | @click="handleDatasource" |
| | | >数据源配置 |
| | | </el-button> |
| | | </template> |
| | | <template slot-scope="{row}" |
| | | slot="accountNumber"> |
| | | <el-tag>{{ row.accountNumber > 0 ? row.accountNumber : '不限制' }}</el-tag> |
| | | <template slot-scope="{ row }" slot="accountNumber"> |
| | | <el-tag>{{ |
| | | row.accountNumber > 0 ? row.accountNumber : "不限制" |
| | | }}</el-tag> |
| | | </template> |
| | | <template slot-scope="{row}" |
| | | slot="expireTime"> |
| | | <el-tag>{{ row.expireTime ? row.expireTime : '不限制' }}</el-tag> |
| | | <template slot-scope="{ row }" slot="expireTime"> |
| | | <el-tag>{{ row.expireTime ? row.expireTime : "不限制" }}</el-tag> |
| | | </template> |
| | | </avue-crud> |
| | | <el-dialog title="租户授权配置" |
| | | append-to-body |
| | | :visible.sync="box" |
| | | width="450px"> |
| | | <avue-form :option="settingOption" v-model="settingForm" @submit="handleSubmit"/> |
| | | <el-dialog |
| | | title="保安单位授权配置" |
| | | append-to-body |
| | | :visible.sync="box" |
| | | width="450px" |
| | | > |
| | | <avue-form |
| | | :option="settingOption" |
| | | v-model="settingForm" |
| | | @submit="handleSubmit" |
| | | /> |
| | | </el-dialog> |
| | | <el-dialog title="租户数据源配置" |
| | | append-to-body |
| | | :visible.sync="datasourceBox" |
| | | width="450px"> |
| | | <avue-form :option="datasourceOption" v-model="datasourceForm" @submit="handleDatasourceSubmit"/> |
| | | <el-dialog |
| | | title="保安单位数据源配置" |
| | | append-to-body |
| | | :visible.sync="datasourceBox" |
| | | width="450px" |
| | | > |
| | | <avue-form |
| | | :option="datasourceOption" |
| | | v-model="datasourceForm" |
| | | @submit="handleDatasourceSubmit" |
| | | /> |
| | | </el-dialog> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import {getList, getDetail, remove, update, add, setting, datasource} from "@/api/system/tenant"; |
| | | import {mapGetters} from "vuex"; |
| | | import { |
| | | getList, |
| | | getDetail, |
| | | remove, |
| | | update, |
| | | add, |
| | | setting, |
| | | datasource |
| | | } from "@/api/system/tenant"; |
| | | import { mapGetters } from "vuex"; |
| | | |
| | | export default { |
| | | data() { |
| | |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0 |
| | | total: 0, |
| | | ...this.$store.state.control.changePageSize |
| | | }, |
| | | option: { |
| | | height: 'auto', |
| | | height: "auto", |
| | | calcHeight: 30, |
| | | labelWidth: "125", |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | |
| | | viewBtn: true, |
| | | dialogWidth: 900, |
| | | dialogClickModal: false, |
| | | ...this.$store.state.control.clearOtherBut, |
| | | column: [ |
| | | { |
| | | label: "租户ID", |
| | | label: "保安单位ID", |
| | | prop: "tenantId", |
| | | width: 100, |
| | | width: 130, |
| | | searchLabelWidth: "150", |
| | | searchSpan: 5, |
| | | search: true, |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | span: 24, |
| | | rules: [{ |
| | | required: true, |
| | | message: "请输入租户ID", |
| | | trigger: "blur" |
| | | }] |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入保安单位ID", |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "租户名称", |
| | | label: "保安企业名称", |
| | | searchLabelWidth: "150", |
| | | prop: "tenantName", |
| | | searchSpan: 5, |
| | | search: true, |
| | | width: 180, |
| | | width: 280, |
| | | span: 24, |
| | | rules: [{ |
| | | required: true, |
| | | message: "请输入参数名称", |
| | | trigger: "blur" |
| | | }] |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入参数名称", |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "联系人", |
| | | searchLabelWidth: "100", |
| | | prop: "linkman", |
| | | width: 100, |
| | | width: 200, |
| | | search: true, |
| | | rules: [{ |
| | | required: true, |
| | | message: "请输入联系人", |
| | | trigger: "blur" |
| | | }] |
| | | searchSpan: 5, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入联系人", |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "联系电话", |
| | | prop: "contactNumber", |
| | | width: 150, |
| | | width: 150 |
| | | }, |
| | | { |
| | | label: "联系地址", |
| | |
| | | span: 24, |
| | | minRows: 2, |
| | | type: "textarea", |
| | | hide: true, |
| | | hide: true |
| | | }, |
| | | { |
| | | label: "账号额度", |
| | |
| | | width: 90, |
| | | slot: true, |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | editDisplay: false |
| | | }, |
| | | { |
| | | label: "过期时间", |
| | |
| | | width: 180, |
| | | slot: true, |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | editDisplay: false |
| | | }, |
| | | { |
| | | label: "绑定域名", |
| | | prop: "domain", |
| | | span: 24, |
| | | span: 24 |
| | | }, |
| | | { |
| | | label: "系统背景", |
| | | prop: "backgroundUrl", |
| | | type: 'upload', |
| | | listType: 'picture-img', |
| | | action: '/api/blade-resource/oss/endpoint/put-file', |
| | | type: "upload", |
| | | listType: "picture-img", |
| | | action: "/api/blade-resource/oss/endpoint/put-file", |
| | | propsHttp: { |
| | | res: 'data', |
| | | url: 'link', |
| | | res: "data", |
| | | url: "link" |
| | | }, |
| | | hide: true, |
| | | span: 24, |
| | | }, |
| | | span: 24 |
| | | } |
| | | ] |
| | | }, |
| | | data: [], |
| | |
| | | label: "账号额度", |
| | | prop: "accountNumber", |
| | | type: "number", |
| | | span: 24, |
| | | span: 24 |
| | | }, |
| | | { |
| | | label: "过期时间", |
| | |
| | | type: "date", |
| | | format: "yyyy-MM-dd hh:mm:ss", |
| | | valueFormat: "yyyy-MM-dd hh:mm:ss", |
| | | span: 24, |
| | | }, |
| | | span: 24 |
| | | } |
| | | ] |
| | | }, |
| | | datasourceForm: {}, |
| | |
| | | label: "name", |
| | | value: "id" |
| | | }, |
| | | rules: [{ |
| | | required: true, |
| | | message: "请选择数据源", |
| | | trigger: "blur" |
| | | }] |
| | | }, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请选择数据源", |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | } |
| | | }; |
| | |
| | | return this.selectionList[0].tenantId; |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.$store.commit("setWindowSizeHeightAdd"); |
| | | }, |
| | | methods: { |
| | | rowSave(row, done, loading) { |
| | | add(row).then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | }); |
| | | add(row).then( |
| | | () => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, |
| | | error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | | ); |
| | | }, |
| | | rowUpdate(row, index, done, loading) { |
| | | update(row).then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | }); |
| | | update(row).then( |
| | | () => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, |
| | | error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | | ); |
| | | }, |
| | | rowDel(row) { |
| | | this.$confirm("确定将选择数据删除?", { |
| | |
| | | }); |
| | | } else { |
| | | this.settingForm.accountNumber = -1; |
| | | this.settingForm.expireTime = ''; |
| | | this.settingForm.expireTime = ""; |
| | | } |
| | | this.box = true; |
| | | }, |
| | |
| | | this.datasourceBox = true; |
| | | }, |
| | | handleSubmit(form, done, loading) { |
| | | setting(this.ids, form).then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "配置成功!" |
| | | }); |
| | | done(); |
| | | this.box = false; |
| | | }, error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | }); |
| | | setting(this.ids, form).then( |
| | | () => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "配置成功!" |
| | | }); |
| | | done(); |
| | | this.box = false; |
| | | }, |
| | | error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | | ); |
| | | }, |
| | | handleDatasourceSubmit(form, done, loading) { |
| | | datasource(this.tenantId, form.datasourceId).then(() => { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "配置成功!" |
| | | }); |
| | | done(); |
| | | this.datasourceBox = false; |
| | | }, error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | }); |
| | | datasource(this.tenantId, form.datasourceId).then( |
| | | () => { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "配置成功!" |
| | | }); |
| | | done(); |
| | | this.datasourceBox = false; |
| | | }, |
| | | error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | | ); |
| | | }, |
| | | currentChange(currentPage) { |
| | | this.page.currentPage = currentPage; |
| | |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | this.loading = true; |
| | | getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { |
| | | 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.$store.commit("setWindowSizeHeightAdd"); |
| | | this.selectionClear(); |
| | | }); |
| | | } |
| | |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | </style> |
| | | <style></style> |