浏览代码

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/views/saas/tenant/index.vue
yh 2 天之前
父节点
当前提交
3748d39411
共有 4 个文件被更改,包括 93 次插入4 次删除
  1. 2 2
      src/api/tenant/tenant.js
  2. 6 0
      src/components/Material/index.vue
  3. 6 0
      src/components/Material/single.vue
  4. 79 2
      src/views/saas/tenant/index.vue

+ 2 - 2
src/api/tenant/tenant.js

@@ -78,11 +78,11 @@ export function menuEdit(data) {
 }
 
 // 查询租户配置
-export function getTenantConfigByKey(configKey, id) {
+export function getTenantConfigByKey(configKey, id, configName) {
   return request({
     url: '/tenant/tenant/getConfigByKey/' + configKey,
     method: 'get',
-    params: { id }
+    params: { id, configName }
   })
 }
 

+ 6 - 0
src/components/Material/index.vue

@@ -72,6 +72,7 @@
                 <el-col :span="12" style="text-align: right;">
                   <el-upload
                     :action="uploadUrl"
+                    :headers="uploadHeaders"
                     :file-list="[]"
                     :on-progress="handleProgress"
                     :before-upload="beforeUpload"
@@ -143,6 +144,7 @@
 import { listMaterial, getMaterial, delMaterial, addMaterial, updateMaterial, exportMaterial } from "@/api/store/material";
 import { getAllMaterialGroup,listMaterialGroup, getMaterialGroup, delMaterialGroup, addMaterialGroup, updateMaterialGroup, exportMaterialGroup } from "@/api/store/materialGroup";
 import { Loading } from 'element-ui';
+import { getToken, getTenantCode } from "@/utils/auth";
 export default {
   name: 'ImageSelect',
   props: {
@@ -183,6 +185,10 @@ export default {
     return {
       finalQuality:1,
       uploadUrl:process.env.VUE_APP_BASE_API+"/common/uploadOSS",
+      uploadHeaders: {
+        Authorization: 'Bearer ' + getToken(),
+        'tenant-code': getTenantCode()
+      },
       dialogVisible: false,
       url: '',
       listDialogVisible: false,

+ 6 - 0
src/components/Material/single.vue

@@ -63,6 +63,7 @@
                 <el-col :span="12" style="text-align: right;">
                   <el-upload
                     :action="uploadUrl"
+                    :headers="uploadHeaders"
                     :file-list="[]"
                     :on-progress="handleProgress"
                     :before-upload="beforeUpload"
@@ -134,6 +135,7 @@
 import { listMaterial, getMaterial, delMaterial, addMaterial, updateMaterial, exportMaterial } from "@/api/store/material";
 import { getAllMaterialGroup,listMaterialGroup, getMaterialGroup, delMaterialGroup, addMaterialGroup, updateMaterialGroup, exportMaterialGroup } from "@/api/store/materialGroup";
 import { Loading } from 'element-ui';
+import { getToken, getTenantCode } from "@/utils/auth";
 export default {
   name: 'ImageSelect',
   props: {
@@ -177,6 +179,10 @@ export default {
       finalQuality:1,
       myValue: this.value,
       uploadUrl:process.env.VUE_APP_BASE_API+"/common/uploadOSS",
+      uploadHeaders: {
+        Authorization: 'Bearer ' + getToken(),
+        'tenant-code': getTenantCode()
+      },
       dialogVisible: false,
       url: '',
       listDialogVisible: false,

+ 79 - 2
src/views/saas/tenant/index.vue

@@ -155,6 +155,13 @@
                 @click="handleSqlScript(scope.row)"
                 v-hasPermi="['tenant:config:edit']"
               >上传sql脚本</el-button>
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-key"
+                @click="handleAiKeyword(scope.row)"
+                v-hasPermi="['tenant:tenant:edit']"
+              >修改AI关键词</el-button>
             </div>
           </template>
         </el-table-column>
@@ -261,6 +268,24 @@
     <el-dialog title="修改配置" :visible.sync="openConfig" width="900px" append-to-body class="tenant-dialog">
       <config-index v-if="openConfig" :tenant-id="configTenantId" @success="handleConfigSuccess" />
     </el-dialog>
+
+    <!-- 修改AI关键词 -->
+    <el-dialog title="修改AI关键词" :visible.sync="openAiKeyword" width="600px" append-to-body class="tenant-dialog">
+      <el-form ref="aiKeywordForm" :model="aiKeywordForm" :rules="aiKeywordRules" label-width="100px">
+        <el-form-item label="AI关键词" prop="aiKeyword">
+          <el-input
+            type="textarea"
+            v-model="aiKeywordForm.aiKeyword"
+            placeholder="请输入AI关键词"
+            :rows="8"
+          />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitAiKeyword">确 定</el-button>
+        <el-button @click="openAiKeyword = false">取 消</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -271,9 +296,11 @@ import {
   exportTenant,
   getTenant,
   listTenant,
-  menuEdit,
   roleMenuTreeselect,
-  updateTenant
+  updateTenant,
+  menuEdit,
+  editTenantConfig,
+  getTenantConfigByKey
 } from "@/api/tenant/tenant";
 import ConfigIndex from "./config/index";
 import {uploadScript} from "@/api/tenant/record";
@@ -379,6 +406,18 @@ export default {
       isAdd: false,
       openConfig: false,
       configTenantId: null,
+      // AI关键词弹窗
+      openAiKeyword: false,
+      aiKeywordConfigId: null,
+      aiKeywordForm: {
+        tenantId: null,
+        aiKeyword: ''
+      },
+      aiKeywordRules: {
+        aiKeyword: [
+          { required: true, message: "AI关键词不能为空", trigger: "blur" }
+        ]
+      },
     };
   },
   created() {
@@ -669,6 +708,44 @@ export default {
     handleConfigSuccess() {
       this.openConfig = false;
     },
+    /** 修改AI关键词按钮操作 */
+    handleAiKeyword(row) {
+      this.aiKeywordForm = {
+        tenantId: row.id,
+        aiKeyword: ''
+      };
+      this.aiKeywordConfigId = null;
+      this.openAiKeyword = true;
+      this.$nextTick(() => {
+        this.$refs.aiKeywordForm && this.$refs.aiKeywordForm.clearValidate();
+      });
+      // 获取已有AI关键词配置
+      getTenantConfigByKey('aiKeyword', row.id).then(response => {
+        if (response.data) {
+          this.aiKeywordConfigId = response.data.configId || null;
+          if (response.data.configValue) {
+            this.aiKeywordForm.aiKeyword = response.data.configValue;
+          }
+        }
+      });
+    },
+    /** 提交AI关键词 */
+    submitAiKeyword() {
+      this.$refs.aiKeywordForm.validate(valid => {
+        if (valid) {
+          editTenantConfig({
+            configId: this.aiKeywordConfigId,
+            id: this.aiKeywordForm.tenantId,
+            configKey: 'aiKeyword',
+            configName: 'ai配置',
+            configValue: this.aiKeywordForm.aiKeyword
+          }).then(response => {
+            this.msgSuccess("修改AI关键词成功");
+            this.openAiKeyword = false;
+          });
+        }
+      });
+    },
 
     handleSqlScript(row){
       // 创建隐藏的文件选择框