| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <template>
- <div class="m-container">
- <h2>
- <div class="squrt"></div>
- 机构管理
- </h2>
- <!-- 列表 -->
- <div v-if="status" class="m-core">
- <!-- 机构基本信息 -->
- <organInfo
- ref="organInfo"
- :data="info"
- type="update"
- tenantInfo="SETTING"
- />
- <div
- style="display: flex;width: 100%;"
- v-if="$helpers.permission('tenantInfo/update/info')"
- >
- <i class="icon_admin_home"></i>
- <el-button type="primary" @click="onNext">确认</el-button>
- </div>
- </div>
- </div>
- </template>
- <script>
- import {
- tenantInfoAdd,
- tenantInfoInfo,
- tenantInfoUpdate
- } from "../organManager/api";
- import organInfo from "../organManager/components/organInfo";
- import { setTheme } from "@/utils/setTheme";
- export default {
- components: { organInfo },
- data() {
- return {
- tableList: [],
- form: {},
- info: {},
- status: false
- };
- },
- mounted() {
- this.__init();
- },
- methods: {
- async __init() {
- try {
- const res = await tenantInfoInfo({ id: this.$helpers.tenantId });
- this.status = true;
- const { config, productInfo, ...other } = res.data;
- const {
- theme,
- themeColor,
- corporateChops,
- corporateFinanceChops,
- id,
- ...con
- } = config;
- this.info = {
- ...other,
- theme,
- themeColor,
- corporateChops,
- corporateFinanceChops,
- configId: id
- };
- } catch (e) {}
- },
- async onNext() {
- const organStatus = await this.$refs.organInfo.onSubmit();
- if (!organStatus) return;
- const organData = await this.$refs.organInfo.getValues();
- // const { theme, themeColor, configId, ...con } = organData;
- const {
- theme,
- themeColor,
- configId,
- corporateChops,
- corporateFinanceChops,
- ...con
- } = organData;
- let config = {
- theme,
- themeColor,
- corporateChops,
- corporateFinanceChops,
- id: configId
- };
- let params = {
- ...con,
- config
- };
- try {
- const res = await tenantInfoUpdate(params);
- this.$message.success("修改更新成功");
- // 机构购买不能修改主题
- let baseTenantId = sessionStorage.getItem("baseTenantId");
- if (baseTenantId > 0) {
- setTheme({
- theme,
- themeColor
- });
- // 重新设置样式
- let tenantConfig = sessionStorage.getItem("tenantConfig");
- tenantConfig = tenantConfig ? JSON.parse(tenantConfig) : {};
- sessionStorage.setItem(
- "tenantConfig",
- JSON.stringify({
- ...tenantConfig,
- theme,
- themeColor
- })
- );
- }
- } catch (e) {}
- }
- },
- async beforeDestroy() {
- let tenantConfig = sessionStorage.getItem("tenantConfig");
- tenantConfig = tenantConfig ? JSON.parse(tenantConfig) : {};
- const organData = await this.$refs.organInfo.getValues();
- const { theme, themeColor } = organData;
- if (theme != tenantConfig.theme) {
- setTheme({
- theme: tenantConfig.theme,
- themeColor: tenantConfig.themeColor
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .courseMask .el-dialog__body {
- padding-bottom: 0;
- }
- </style>
|