Browse Source

处理公式变量更改后更新,添加手机号登录

yangg 9 months ago
parent
commit
3376ac8e9b
44 changed files with 533 additions and 202 deletions
  1. 1 1
      .env.development
  2. 0 0
      dist/index.html
  3. 0 0
      dist/static/css/app.cf6f8a94.css
  4. 0 0
      dist/static/css/chunk-077f515e.6f8877c6.css
  5. 0 0
      dist/static/css/chunk-0d23420e.8d28e945.css
  6. 0 0
      dist/static/css/chunk-10bfc27e.6044f932.css
  7. 0 0
      dist/static/css/chunk-2018313d.775a21e3.css
  8. 1 0
      dist/static/css/chunk-434b24b1.6b80018e.css
  9. 0 1
      dist/static/css/chunk-6b49e032.35543b1d.css
  10. 0 0
      dist/static/css/chunk-910f7562.e30e9787.css
  11. 0 0
      dist/static/css/chunk-b836da0a.68741a84.css
  12. 0 0
      dist/static/js/app.28a0e803.js
  13. 0 0
      dist/static/js/app.f640a250.js
  14. 0 0
      dist/static/js/chunk-077f515e.7d8fbb81.js
  15. 0 0
      dist/static/js/chunk-0a97e1f4.c2abdbf7.js
  16. 0 0
      dist/static/js/chunk-0d23420e.0543cad1.js
  17. 0 0
      dist/static/js/chunk-10bfc27e.ee284db3.js
  18. 1 1
      dist/static/js/chunk-2018313d.65250cac.js
  19. 0 0
      dist/static/js/chunk-227fce26.d4e347ce.js
  20. 0 0
      dist/static/js/chunk-269b71dc.ca28a4c5.js
  21. 1 0
      dist/static/js/chunk-434b24b1.d99c6b5d.js
  22. 0 0
      dist/static/js/chunk-52f685c2.74a3c68f.js
  23. 0 0
      dist/static/js/chunk-6155c71d.7053b184.js
  24. 0 1
      dist/static/js/chunk-6b49e032.57baf1f6.js
  25. 0 0
      dist/static/js/chunk-79a693c7.e700d262.js
  26. 0 0
      dist/static/js/chunk-910f7562.89f89d65.js
  27. 0 0
      dist/static/js/chunk-b836da0a.8bc79024.js
  28. 0 0
      dist/static/js/chunk-f23301fc.6b884ccb.js
  29. 37 0
      src/api/api.js
  30. 174 0
      src/components/LoginModal/index.vue
  31. 6 0
      src/components/webAi/index.vue
  32. 30 27
      src/components/webAi/js/ChatBox.js
  33. 10 0
      src/views/document/com/components/Formula/dataInfo.vue
  34. 4 4
      src/views/document/com/components/Formula/index.vue
  35. 27 20
      src/views/document/com/components/Variable/dataInfo.vue
  36. 15 14
      src/views/document/com/components/Variable/index.vue
  37. 1 1
      src/views/document/com/menus.vue
  38. 157 110
      src/views/document/create.vue
  39. 9 1
      src/views/knowledgeMenu/category/components/dataList.vue
  40. 33 9
      src/views/login/aiIndex.vue
  41. 20 8
      src/views/role/components/dataInfo.vue
  42. 1 1
      src/views/template/category/components/dataList.vue
  43. 1 1
      src/views/template/components/dataList.scss
  44. 4 2
      src/views/template/components/dataList.vue

+ 1 - 1
.env.development

@@ -2,5 +2,5 @@
 ENV = 'development'
 ENV = 'development'
 port = 8080
 port = 8080
 # base api
 # base api
-VUE_APP_BASE_API = 'http://58.246.234.210:8084'
+VUE_APP_BASE_API = 'http://192.168.1.178:8084'
 #192.168.1.178
 #192.168.1.178

File diff suppressed because it is too large
+ 0 - 0
dist/index.html


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.cf6f8a94.css


+ 0 - 0
dist/static/css/chunk-f23301fc.6f8877c6.css → dist/static/css/chunk-077f515e.6f8877c6.css


+ 0 - 0
dist/static/css/chunk-79a693c7.8d28e945.css → dist/static/css/chunk-0d23420e.8d28e945.css


+ 0 - 0
dist/static/css/chunk-0a97e1f4.6044f932.css → dist/static/css/chunk-10bfc27e.6044f932.css


+ 0 - 0
dist/static/css/chunk-7c02fbbc.775a21e3.css → dist/static/css/chunk-2018313d.775a21e3.css


+ 1 - 0
dist/static/css/chunk-434b24b1.6b80018e.css

@@ -0,0 +1 @@
+[data-v-e99d0770] .chat-container{height:100vh}[data-v-e99d0770] .messages{margin-bottom:0;height:calc(100vh - 120px)}[data-v-e99d0770] .input-container{max-width:1200px}

+ 0 - 1
dist/static/css/chunk-6b49e032.35543b1d.css

@@ -1 +0,0 @@
-[data-v-43c76dc8] .chat-container{height:100vh}[data-v-43c76dc8] .messages{margin-bottom:0;height:calc(100vh - 120px)}[data-v-43c76dc8] .input-container{max-width:1200px}

+ 0 - 0
dist/static/css/chunk-227fce26.e30e9787.css → dist/static/css/chunk-910f7562.e30e9787.css


+ 0 - 0
dist/static/css/chunk-269b71dc.68741a84.css → dist/static/css/chunk-b836da0a.68741a84.css


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.28a0e803.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.f640a250.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-077f515e.7d8fbb81.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-0a97e1f4.c2abdbf7.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-0d23420e.0543cad1.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-10bfc27e.ee284db3.js


File diff suppressed because it is too large
+ 1 - 1
dist/static/js/chunk-2018313d.65250cac.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-227fce26.d4e347ce.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-269b71dc.ca28a4c5.js


+ 1 - 0
dist/static/js/chunk-434b24b1.d99c6b5d.js

@@ -0,0 +1 @@
+(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-434b24b1"],{"5cb5":function(o,n,t){"use strict";t.r(n);var c=function(){var o=this,n=o.$createElement,t=o._self._c||n;return t("div",[t("ChatBox"),t("LoginModal",{attrs:{visible:o.showLoginModal},on:{"update:visible":function(n){o.showLoginModal=n},close:function(n){o.showLoginModal=!1},"login-success":o.handleLoginSuccess}})],1)},a=[],e=t("c3b3"),i=t("ecd9"),s={components:{ChatBox:e["default"],LoginModal:i["default"]},data:function(){return{showLoginModal:!1}},mounted:function(){this.checkAIData()},methods:{checkAIData:function(){var o=localStorage.getItem("AIData");this.showLoginModal=!o},handleLoginSuccess:function(){this.showLoginModal=!1}}},u=s,l=(t("c8ac"),t("2877")),d=Object(l["a"])(u,c,a,!1,null,"e99d0770",null);n["default"]=d.exports},6831:function(o,n,t){},c8ac:function(o,n,t){"use strict";t("6831")}}]);

File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-52f685c2.74a3c68f.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-6155c71d.7053b184.js


+ 0 - 1
dist/static/js/chunk-6b49e032.57baf1f6.js

@@ -1 +0,0 @@
-(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6b49e032"],{"1f47":function(n,t,c){"use strict";c("a668")},"5cb5":function(n,t,c){"use strict";c.r(t);var e=function(){var n=this,t=n.$createElement,c=n._self._c||t;return c("div",[c("ChatBox")],1)},o=[],u=c("c3b3"),a={components:{ChatBox:u["default"]}},s=a,i=(c("1f47"),c("2877")),f=Object(i["a"])(s,e,o,!1,null,"43c76dc8",null);t["default"]=f.exports},a668:function(n,t,c){}}]);

File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-79a693c7.e700d262.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-910f7562.89f89d65.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-b836da0a.8bc79024.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-f23301fc.6b884ccb.js


+ 37 - 0
src/api/api.js

@@ -38,3 +38,40 @@ export function statistics(data) {
   })
   })
 }
 }
 
 
+
+/* ai登录  */
+export function pcLoging(data) {
+  return request({
+    url: '/pcai/pcLoging',
+    method: 'post',
+    data
+  })
+}
+
+/* 发送验证码 */
+export function pcSMS(data) {
+  return request({
+    url: '/pcai/pcSMS',
+    method: 'post',
+    data
+  })
+}
+/* 校验验证码 */
+
+export function codeCheckout(data) {
+  return request({
+    url: '/pcai/codeCheckout',
+    method: 'post',
+    data
+  })
+}
+
+/* 内部链接 */
+
+export function pcInnerAi(data) {
+  return request({
+    url: '/pcai/pcInnerAi',
+    method: 'post',
+    data
+  })
+}

+ 174 - 0
src/components/LoginModal/index.vue

@@ -0,0 +1,174 @@
+<template>
+  <el-dialog
+    title="登录"
+    :visible.sync="visible"
+    :close-on-click-modal="false"
+    width="360px"
+    custom-class="login-dialog"
+    @close="$emit('close')"
+  >
+    <el-form :model="form" :rules="rules" ref="loginForm" class="login-form">
+      <el-form-item prop="phone">
+        <el-input v-model="form.phone" placeholder="请输入手机号">
+          <template slot="prepend">
+            <i class="el-icon-mobile-phone"></i>
+          </template>
+        </el-input>
+      </el-form-item>
+      <el-form-item prop="code">
+        <el-input v-model="form.code" placeholder="请输入验证码">
+          <el-button
+            slot="append"
+            @click="sendCode"
+            :disabled="countdown > 0"
+            class="send-code-btn"
+          >
+            {{ countdown > 0 ? `${countdown}s` : "发送验证码" }}
+          </el-button>
+        </el-input>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" @click="login" class="login-btn"
+          >登录</el-button
+        >
+      </el-form-item>
+    </el-form>
+  </el-dialog>
+</template>
+  
+  <script>
+import { pcLoging, pcSMS, codeCheckout } from "@/api/api";
+
+export default {
+  props: {
+    visible: {
+      type: Boolean,
+      default: false,
+    },
+  },
+  data() {
+    const validatePhone = (rule, value, callback) => {
+      if (!/^1[3-9]\d{9}$/.test(value)) {
+        callback(new Error("请输入正确的手机号"));
+      } else {
+        callback();
+      }
+    };
+    return {
+      form: {
+        phone: "",
+        code: "",
+      },
+      rules: {
+        phone: [
+          { required: true, message: "请输入手机号", trigger: "blur" },
+          { validator: validatePhone, trigger: "blur" },
+        ],
+        code: [
+          { required: true, message: "请输入验证码", trigger: "blur" },
+          { len: 6, message: "验证码长度应为6位", trigger: "blur" },
+        ],
+      },
+      countdown: 0,
+    };
+  },
+  methods: {
+    async sendCode() {
+      if (!this.form.phone) {
+        this.$message.error("请先输入手机号");
+        return;
+      }
+
+      try {
+        await pcSMS({ phone: this.form.phone });
+        this.$message.success("验证码已发送");
+        this.countdown = 60;
+        const timer = setInterval(() => {
+          this.countdown--;
+          if (this.countdown === 0) {
+            clearInterval(timer);
+          }
+        }, 1000);
+      } catch (error) {
+        this.$message.error("发送验证码失败:" + error.message);
+      }
+    },
+
+    async login() {
+      this.$refs.loginForm.validate(async (valid) => {
+        if (valid) {
+          try {
+            // 先验证验证码
+            const checkoutResult = await codeCheckout({
+              phone: this.form.phone,
+              verification_code: this.form.code,
+            });
+
+            // 检查验证码是否正确
+            if (checkoutResult.status==200) {
+              // 验证码正确,进行登录
+              const loginResult = await pcLoging({
+                phone: this.form.phone,
+                code: this.form.code,
+              });
+
+              // 保存用户数据到本地存储
+              this.saveUserData(loginResult);
+
+              this.$message.success("登录成功");
+              this.$emit("login-success");
+              this.$emit("close");
+            } else {
+              // 验证码不正确,显示错误消息
+              this.$message.error("验证码不正确");
+            }
+          } catch (error) {
+            this.$message.error("操作失败:" + error.message);
+          }
+        } else {
+          return false;
+        }
+      });
+    },
+    saveUserData(userData) {
+      // 将用户数据保存到本地存储
+      localStorage.setItem("AIData", JSON.stringify(userData));
+      // 如果有token,单独保存token
+    },
+  },
+};
+</script>
+  <style scoped>
+.login-dialog {
+  border-radius: 8px;
+}
+
+.login-form {
+  padding: 0 20px;
+}
+
+.el-form-item {
+  margin-bottom: 20px;
+}
+
+.login-btn {
+  width: 100%;
+}
+
+.send-code-btn {
+  width: 110px;
+}
+
+/* 添加一些过渡效果 */
+.el-input-group__prepend,
+.el-input-group__append,
+.el-input__inner {
+  transition: all 0.3s ease;
+}
+
+.el-input:hover .el-input__inner,
+.el-input:hover .el-input-group__prepend,
+.el-input:hover .el-input-group__append {
+  border-color: #409eff;
+}
+</style>

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

@@ -18,6 +18,12 @@
         <textarea v-model="userInput" rows="4" @keydown="handleKeydown" placeholder="Type a message..."></textarea>
         <textarea v-model="userInput" rows="4" @keydown="handleKeydown" placeholder="Type a message..."></textarea>
         <button @click="sendMessage" class="btn">发送</button>
         <button @click="sendMessage" class="btn">发送</button>
       </div>
       </div>
+      <!-- 添加 LoginModal 组件 -->
+    <LoginModal
+      :visible.sync="showLoginModal"
+      @close="showLoginModal = false"
+      @login-success="handleLoginSuccess"
+    />
     </div>
     </div>
   </template>
   </template>
   
   

+ 30 - 27
src/components/webAi/js/ChatBox.js

@@ -1,7 +1,12 @@
+import LoginModal from "@/components/LoginModal";
 import MarkdownIt from "markdown-it";
 import MarkdownIt from "markdown-it";
+import { pcInnerAi } from "@/api/api";
 const md = new MarkdownIt();
 const md = new MarkdownIt();
 
 
 export default {
 export default {
+  components: {
+    LoginModal,
+  },
   data() {
   data() {
     return {
     return {
       messages: [
       messages: [
@@ -18,7 +23,9 @@ export default {
       userInput: "",
       userInput: "",
       websocket: null,
       websocket: null,
       wsUrl:'http://58.246.234.210:7860/api/v1/run/951e3ba4-c66a-496c-9497-7dbddc2647f8?stream=false',
       wsUrl:'http://58.246.234.210:7860/api/v1/run/951e3ba4-c66a-496c-9497-7dbddc2647f8?stream=false',
-      tweaks:{}
+      tweaks:{},
+      showLoginModal: false,
+      isLoggedIn: false, // 添加登录状态标志
     };
     };
   },
   },
   created() {
   created() {
@@ -27,37 +34,27 @@ export default {
   mounted() {
   mounted() {
     if(this.$route.name=='ai'){
     if(this.$route.name=='ai'){
       /* 外部知识库 */
       /* 外部知识库 */
-      this.wsUrl='http://58.246.234.210:7860/api/v1/run/951e3ba4-c66a-496c-9497-7dbddc2647f8?stream=false'
-      this.tweaks={
-              "ChatInput-dDbhW": {},
-              "Prompt-1stgH": {},
-              "ChatOutput-b1zWw": {},
-              "OllamaModel-5n7vc": {},
-              "Milvus-1X7fT": {},
-              "OllamaEmbeddings-V29wK": {},
-              "Memory-GrHZr": {},
-              "ParseData-0dk9n": {}
-            }
+      const AIData=JSON.parse(localStorage.getItem("AIData"))
+      this.wsUrl=AIData.data.url
+      this.tweaks=AIData.data.tweaks
     }else{
     }else{
       /* 内部知识库 */
       /* 内部知识库 */
-      this.wsUrl='https://ai.raycos.net/api/v1/run/9263c538-2cd2-4c1b-8c9a-3bb986920d6d?stream=false'
-      this.tweaks={
-              "ChatInput-NYqTq": { },
-              "Prompt-oVfSC": {},
-              "ChatOutput-sA5Uc": {},
-              "SplitText-GvztW": {},
-              "File-rHitZ": {},
-              "OllamaEmbeddings-bQe5H": {},
-              "Milvus-QVby8": {},
-              "OllamaModel-UxNZ1": {},
-              "Milvus-XiwA4": {},
-              "OllamaEmbeddings-91fPV": {},
-              "Memory-ZBrXL": {},
-              "ParseData-ZmaJQ": {}
-            }
+      pcInnerAi().then(res=>{
+        if(res.status!==200) return
+        this.wsUrl=res.data.url
+        this.tweaks=res.data.tweaks
+        
+      })
+      
     }
     }
   },
   },
   methods: {
   methods: {
+    handleLoginSuccess() {
+      this.showLoginModal = false;
+      this.isLoggedIn = true;
+      // 登录成功后,可以继续发送消息
+      this.sendMessage();
+    },
     getUuid() {
     getUuid() {
       return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
       return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
         /[xy]/g,
         /[xy]/g,
@@ -115,6 +112,12 @@ export default {
       };
       };
     },
     },
     async sendMessage() {
     async sendMessage() {
+      if(this.$route.name=='ai'){
+        if(!localStorage.getItem('AIData')){
+          this.showLoginModal=true
+          return
+        }
+      }
       const chatId = this.getUuid();
       const chatId = this.getUuid();
       const wsUrl =this.wsUrl//'http://58.246.234.210:7860/api/v1/run/951e3ba4-c66a-496c-9497-7dbddc2647f8?stream=false'
       const wsUrl =this.wsUrl//'http://58.246.234.210:7860/api/v1/run/951e3ba4-c66a-496c-9497-7dbddc2647f8?stream=false'
       let message = this.userInput.trim();
       let message = this.userInput.trim();

+ 10 - 0
src/views/document/com/components/Formula/dataInfo.vue

@@ -320,6 +320,11 @@ export default {
             status: 5,
             status: 5,
             use_status: 5,
             use_status: 5,
             params: "[]",
             params: "[]",
+            id: 0,
+            name: "",
+            formula: "",
+            intro: "",
+            point: 0,
           };
           };
           _this.$message.success("公式更新成功");
           _this.$message.success("公式更新成功");
         });
         });
@@ -329,6 +334,11 @@ export default {
             status: 5,
             status: 5,
             use_status: 5,
             use_status: 5,
             params: "[]",
             params: "[]",
+            id: 0,
+            name: "",
+            formula: "",
+            intro: "",
+            point: 0,
           };
           };
           _this.$message.success("公式创建的成功");
           _this.$message.success("公式创建的成功");
         });
         });

+ 4 - 4
src/views/document/com/components/Formula/index.vue

@@ -11,9 +11,9 @@
           </el-form>
           </el-form>
 
 
           <el-table :data="dataList" style="width: 100%" header-row-class-name="headerBg" empty-text="没有公式信息">
           <el-table :data="dataList" style="width: 100%" header-row-class-name="headerBg" empty-text="没有公式信息">
-            <el-table-column prop="id" label="ID" align="center" width="80"/>
-            <el-table-column prop="name" label="名称" align="left" width="180"/>
-            <el-table-column prop="intro" label="介绍" align="center" width="150"/>
+            <el-table-column prop="id" label="ID" align="center" width="50"/>
+            <el-table-column prop="name" label="名称" align="left"/>
+            <el-table-column prop="intro" label="介绍" align="center" />
             <el-table-column prop="formula" label="内容" align="center" min-width="150"/>
             <el-table-column prop="formula" label="内容" align="center" min-width="150"/>
             <el-table-column label="操作" align="center" width="350">
             <el-table-column label="操作" align="center" width="350">
               <template #default="scope">
               <template #default="scope">
@@ -30,7 +30,7 @@
 
 
           <div class="page-info">
           <div class="page-info">
           	<el-pagination
           	<el-pagination
-          	v-model:currentPage="queryForm.page"
+          	:currentPage="queryForm.page"
           	:page-size="queryForm.pageSize"
           	:page-size="queryForm.pageSize"
           	:total="recordCount"
           	:total="recordCount"
           	:page-count="pageTotal"
           	:page-count="pageTotal"

+ 27 - 20
src/views/document/com/components/Variable/dataInfo.vue

@@ -60,15 +60,15 @@
         </el-form-item>
         </el-form-item>
         <el-form-item label="取值范围:" v-if="dataForm.value_type == 2">
         <el-form-item label="取值范围:" v-if="dataForm.value_type == 2">
           <el-select
           <el-select
-          ref="categorySelect"
+            ref="categorySelect"
             v-model="dataForm.value_item"
             v-model="dataForm.value_item"
             multiple
             multiple
             filterable
             filterable
             allow-create
             allow-create
             default-first-option
             default-first-option
             placeholder="点击enter创建选择标签"
             placeholder="点击enter创建选择标签"
-            style="width: 100%;"
-           popper-class="custom-select-dropdown"
+            style="width: 100%"
+            popper-class="custom-select-dropdown"
           >
           >
           </el-select>
           </el-select>
           <!-- <el-input type="textarea" v-model="dataForm.value_item"   @keydown.native.enter="createTag"></el-input> -->
           <!-- <el-input type="textarea" v-model="dataForm.value_item"   @keydown.native.enter="createTag"></el-input> -->
@@ -135,11 +135,11 @@ export default {
       deep: true,
       deep: true,
     },
     },
     hideDropdown(newVal) {
     hideDropdown(newVal) {
-      const dropdown = document.querySelector('.custom-select-dropdown');
+      const dropdown = document.querySelector(".custom-select-dropdown");
       if (dropdown) {
       if (dropdown) {
-        dropdown.style.display = newVal ? 'none' : '';
+        dropdown.style.display = newVal ? "none" : "";
       }
       }
-    }
+    },
   },
   },
   data() {
   data() {
     const validateBucketName = (rule, value, callback) => {
     const validateBucketName = (rule, value, callback) => {
@@ -247,7 +247,7 @@ export default {
   },
   },
   methods: {
   methods: {
     handleSelectFocus(event) {
     handleSelectFocus(event) {
-        this.$refs.categorySelect.blur();
+      this.$refs.categorySelect.blur();
     },
     },
     createTag() {
     createTag() {
       // Logic to create a tag
       // Logic to create a tag
@@ -264,16 +264,28 @@ export default {
     },
     },
     resetForm() {
     resetForm() {
       // 重置所有表单字段
       // 重置所有表单字段
-      this.dataForm = { type: 1, value_type: 1, status: 5 }; // 或者设置为初始值
+      this.dataForm = {
+        id: 0,
+        type: this.type, // 保留传入的 type
+        name: "",
+        value: "",
+        value_type: 0,
+        value_item: "",
+        intro: "",
+        status: 5,
+      };
       // 如果使用 el-form,可以调用其 resetFields 方法
       // 如果使用 el-form,可以调用其 resetFields 方法
-      this.$refs.dataFormRef.resetFields();
+      this.$nextTick(() => {
+        if (this.$refs.dataFormRef) {
+          this.$refs.dataFormRef.resetFields();
+        }
+      });
     },
     },
     //保存更新
     //保存更新
     btnSave(e) {
     btnSave(e) {
       let _this = this;
       let _this = this;
       _this.$refs.dataFormRef.validate((valid) => {
       _this.$refs.dataFormRef.validate((valid) => {
         if (valid) {
         if (valid) {
-           
           if (_this.dataForm.value_type == 1) {
           if (_this.dataForm.value_type == 1) {
             _this.dataForm.value_item = _this.dataForm.value;
             _this.dataForm.value_item = _this.dataForm.value;
           } else if (_this.dataForm.value_type == 4) {
           } else if (_this.dataForm.value_type == 4) {
@@ -289,22 +301,14 @@ export default {
           if (_this.dataForm.id > 0) {
           if (_this.dataForm.id > 0) {
             updateParams(_this.dataForm).then((res) => {
             updateParams(_this.dataForm).then((res) => {
               if (res.status != 200) return;
               if (res.status != 200) return;
-              _this.dataForm = {
-                type: 1,
-                value_type: 1,
-                status: 5,
-              };
+              _this.resetForm(); // 添加这行
               _this.$alert("信息更新成功");
               _this.$alert("信息更新成功");
               _this.$emit("onClose");
               _this.$emit("onClose");
             });
             });
           } else {
           } else {
             createParams(_this.dataForm).then((res) => {
             createParams(_this.dataForm).then((res) => {
               if (res.status != 200) return;
               if (res.status != 200) return;
-              _this.dataForm = {
-                type: 1,
-                value_type: 1,
-                status: 5,
-              };
+              _this.resetForm(); // 添加这行
               _this.$alert("信息创建成功");
               _this.$alert("信息创建成功");
               _this.$emit("onClose");
               _this.$emit("onClose");
             });
             });
@@ -326,6 +330,9 @@ export default {
         if (!res) return;
         if (!res) return;
         if (res.status != 200) return;
         if (res.status != 200) return;
         _this.dataForm = res.data;
         _this.dataForm = res.data;
+        if (_this.dataForm.value_type == 2 && _this.dataForm.value_item) {
+          _this.dataForm.value_item = _this.dataForm.value_item.split(',');
+        }
       });
       });
     },
     },
 
 

+ 15 - 14
src/views/document/com/components/Variable/index.vue

@@ -110,7 +110,7 @@
 
 
     <div class="page-info">
     <div class="page-info">
       <el-pagination
       <el-pagination
-        v-model:currentPage="queryForm.page"
+        :currentPage="queryForm.page"
         :page-size="queryForm.pageSize"
         :page-size="queryForm.pageSize"
         :total="recordCount"
         :total="recordCount"
         :page-count="pageTotal"
         :page-count="pageTotal"
@@ -214,15 +214,24 @@ export default {
   },
   },
   methods: {
   methods: {
     handleDialogClosed() {
     handleDialogClosed() {
-      // 清空 dataInfo 组件内的表单
       if (this.$refs.dataInfoRef) {
       if (this.$refs.dataInfoRef) {
-        this.$refs.dataInfoRef.resetForm(); // 假设 dataInfo 组件有一个 resetForm 方法
+        this.$refs.dataInfoRef.resetForm();
       }
       }
+      this.dataId = 0; // Reset dataId when dialog is closed
     },
     },
+
     onClose(e) {
     onClose(e) {
-      let _this = this;
-      _this.dialogVisible = false;
-      _this.onBtnSearch();
+      this.dialogVisible = false;
+      this.onBtnSearch();
+      this.handleDialogClosed();
+    },
+
+    btnOnEdit(id, row) {
+      this.title = row.type == 1 ? "修改变量" : "修改常量";
+      this.$nextTick(() => {
+        this.dataId = id;
+        this.dialogVisible = true;
+      });
     },
     },
 
 
     btnOnDelete(e) {
     btnOnDelete(e) {
@@ -251,14 +260,6 @@ export default {
       _this.dialogVisible = true;
       _this.dialogVisible = true;
     },
     },
 
 
-    btnOnEdit(id, row) {
-      this.title = row.type == 1 ? "修改变量" : "修改常量";
-      this.$nextTick(() => {
-        this.dataId = id;
-        this.dialogVisible = true;
-      });
-    },
-
     onBtnSearch(e) {
     onBtnSearch(e) {
       let _this = this;
       let _this = this;
       _this.queryForm.page = 1;
       _this.queryForm.page = 1;

+ 1 - 1
src/views/document/com/menus.vue

@@ -39,7 +39,7 @@
       :visible.sync="showFormula"
       :visible.sync="showFormula"
       append-to-body
       append-to-body
       v-el-drag-dialog
       v-el-drag-dialog
-      width="300"
+      width="60%"
       :close-on-click-modal="false"
       :close-on-click-modal="false"
       custom-class="prod-verify"
       custom-class="prod-verify"
       top="20px"
       top="20px"

+ 157 - 110
src/views/document/create.vue

@@ -625,6 +625,7 @@ import ViewForm from "./com/view";
 import elDragDialog from "@/directive/el-drag-dialog";
 import elDragDialog from "@/directive/el-drag-dialog";
 import draggable from "vuedraggable";
 import draggable from "vuedraggable";
 import htmlDocx from "html-docx-js/dist/html-docx";
 import htmlDocx from "html-docx-js/dist/html-docx";
+import { searchFormula } from "@/api/formula";
 import axios from "axios";
 import axios from "axios";
 // import htmlDocx from "htmlDocx";
 // import htmlDocx from "htmlDocx";
 export default {
 export default {
@@ -1163,29 +1164,45 @@ export default {
         this.loading = false; // 结束加载动画
         this.loading = false; // 结束加载动画
       }
       }
     },
     },
-    loadTemplateInfo(e) {
-      let _this = this;
-      let par = {
-        id: e,
-      };
-      getTemplateInfo(par)
-        .then((res) => {
-          if (res.status != 200) return;
-          if (res.data.attrs == null || res.data.type == "") {
-            res.data.attrs = "[]";
-            res.data.content = "请填写内容";
-            res.data.lay_id = "textArea";
-            res.data.type = "TextArea";
-          }
-          document.title =
-            res.data.name == ""
-              ? "新建模块-轻良实业"
-              : res.data.name + "-轻良实业";
-          res.data.attrs = JSON.parse(res.data.attrs);
-          _this.coms = [res.data];
-          console.log("11", _this.coms);
-        })
-        .catch(() => {});
+    async loadTemplateInfo(id) {
+      try {
+        // 获取模板信息
+        const { data } = await getTemplateInfo({ id });
+
+        // 设置默认值
+        if (!data.attrs || !data.type) {
+          Object.assign(data, {
+            attrs: "[]",
+            content: "请填写内容",
+            lay_id: "textArea",
+            type: "TextArea",
+          });
+        }
+
+        // 设置文档标题
+        document.title = data.name
+          ? `${data.name}-轻良实业`
+          : "新建模块-轻良实业";
+
+        // 解析属性
+        data.attrs = JSON.parse(data.attrs);
+
+        // 获取公式并更新属性
+        const {
+          data: { dataList },
+        } = await searchFormula({ page: 1, pageSize: 999 });
+        data.attrs = data.attrs.map((item) => {
+          const formula = dataList.find((el) => el.id === item.data.id);
+          return formula
+            ? { ...item, formula: formula.formula, data: formula }
+            : item;
+        });
+
+        this.coms = [data];
+        console.log("11", this.coms);
+      } catch (error) {
+        console.error("加载模板信息失败:", error);
+      }
     },
     },
     onExport(e) {
     onExport(e) {
       let _this = this;
       let _this = this;
@@ -1249,100 +1266,130 @@ export default {
       _this.userInfo = res.data;
       _this.userInfo = res.data;
     },
     },
     //加载文档信息
     //加载文档信息
-    onLoadArticle(e) {
-      let _this = this;
-      this.loading = true; // Set loading to true
-      getDocumentInfo({ id: e })
-        .then((res) => {
-          this.loading = false; // Set loading to false after data is loaded
-          if (res.status !== 200) return;
-          _this.docAttr = {
-            id: res.data.id,
-            category_id: res.data.category_id * 1,
-            title: res.data.title,
-            content: "",
-            status: res.data.status,
-            is_template: res.data.is_template,
-            linkProduct: res.data.linkProduct,
-            links: res.data.links,
-            linkProject: res.data.linkProject,
-            projects: res.data.projects,
-          };
-          const templatePromises = JSON.parse(res.data.data).map((el) => {
-            return getTemplateInfo({ id: el.id }).then((response) => {
-              this.loading = true;
-              response.data.attrs = JSON.parse(response.data.attrs);
-              return { ...el, ...response.data };
-            });
-          });
+    async onLoadArticle(id) {
+      try {
+        this.loading = true;
+        const res = await getDocumentInfo({ id });
+
+        if (res.status !== 200) {
+          throw new Error("Invalid response status");
+        }
+
+        this.docAttr = {
+          id: res.data.id,
+          category_id: Number(res.data.category_id),
+          title: res.data.title,
+          content: "",
+          status: res.data.status,
+          is_template: res.data.is_template,
+          linkProduct: res.data.linkProduct,
+          links: res.data.links,
+          linkProject: res.data.linkProject,
+          projects: res.data.projects,
+        };
+
+        const templateData =
+          typeof res.data.data === "string"
+            ? JSON.parse(res.data.data)
+            : res.data.data;
 
 
-          Promise.all(templatePromises)
-            .then((updatedComs) => {
-              _this.coms = updatedComs;
-              this.loading = false;
-            })
-            .catch((error) => {
-              console.error("Error fetching template info:", error);
-              this.loading = false;
+        const updatedComs = await Promise.all(
+          templateData.map(async (el) => {
+            const templateInfo = await getTemplateInfo({ id: el.id });
+            const formulaData = await searchFormula({ page: 1, pageSize: 999 });
+
+            const attrs =
+              typeof templateInfo.data.attrs === "string"
+                ? JSON.parse(templateInfo.data.attrs)
+                : templateInfo.data.attrs;
+
+            attrs.forEach((item) => {
+              const matchedFormula = formulaData.data.dataList.find(
+                (ite) => ite.id === item.data.id
+              );
+              if (matchedFormula) {
+                item.data = matchedFormula;
+                item.formula = matchedFormula.formula;
+              }
             });
             });
-          if (_this.type == "document" && _this.articleId !== undefined) {
-            document.title = _this.docAttr.title + "-轻良实业";
-          }
-        })
-        .catch((error) => {
-          console.error("Error:", error);
-        })
-        .finally(() => {
-          this.loading = false; // 所有操作完成后取消 loading
-        });
 
 
-      this.uptadeSearch();
+            return { ...el, ...templateInfo.data, attrs };
+          })
+        );
+
+        this.coms = updatedComs;
+        console.log("coms", updatedComs);
+
+        if (this.type === "document" && this.articleId !== undefined) {
+          document.title = `${this.docAttr.title}-轻良实业`;
+        }
+
+        this.uptadeSearch();
+      } catch (error) {
+        console.error("Error in onLoadArticle:", error);
+      } finally {
+        this.loading = false;
+      }
     },
     },
     /* 加载模版信息 */
     /* 加载模版信息 */
-    onTemplateInfo(e) {
-      let _this = this;
-      this.loading = true;
-      getDocumentInfo({ id: e })
-        .then((res) => {
-          this.loading = false; // Set loading to false after data is loaded
-          if (res.status !== 200) return;
-          _this.docAttr = {
-            id: res.data.id,
-            category_id: res.data.category_id * 1,
-            title: res.data.title,
-            content: "",
-            status: res.data.status,
-            is_template: res.data.is_template,
-            linkProduct: res.data.linkProduct,
-            links: res.data.links,
-            linkProject: res.data.linkProject,
-            projects: res.data.projects,
-          };
-          const templatePromises = JSON.parse(res.data.data).map((el) => {
-            return getTemplateInfo({ id: el.id }).then((response) => {
-              this.loading = true;
-              response.data.attrs = JSON.parse(response.data.attrs);
-              return { ...el, ...response.data };
-            });
-          });
+    async onTemplateInfo(id) {
+      try {
+        this.loading = true;
+        const res = await getDocumentInfo({ id });
 
 
-          Promise.all(templatePromises)
-            .then((updatedComs) => {
-              _this.coms = updatedComs;
-              this.loading = false;
-            })
-            .catch((error) => {
-              console.error("Error fetching template info:", error);
-              this.loading = false;
+        if (res.status !== 200) {
+          throw new Error("Invalid response status");
+        }
+
+        this.docAttr = {
+          id: res.data.id,
+          category_id: Number(res.data.category_id),
+          title: res.data.title,
+          content: "",
+          status: res.data.status,
+          is_template: res.data.is_template,
+          linkProduct: res.data.linkProduct,
+          links: res.data.links,
+          linkProject: res.data.linkProject,
+          projects: res.data.projects,
+        };
+
+        const templateData = JSON.parse(res.data.data);
+
+        const updatedComs = await Promise.all(
+          templateData.map(async (el) => {
+            const templateInfo = await getTemplateInfo({ id: el.id });
+            const formulaData = await searchFormula({ page: 1, pageSize: 999 });
+
+            let attrs = JSON.parse(templateInfo.data.attrs);
+
+            attrs = attrs.map((item) => {
+              const matchedFormula = formulaData.data.dataList.find(
+                (ite) => ite.id === item.data.id
+              );
+              if (matchedFormula) {
+                return {
+                  ...item,
+                  data: matchedFormula,
+                  formula: matchedFormula.formula,
+                };
+              }
+              return item;
             });
             });
-        })
-        .catch((error) => {
-          console.error("Error:", error);
-        })
-        .finally(() => {
-          this.loading = false; // 所有操作完成后取消 loading
-        });
-      this.uptadeSearch();
+
+            return { ...el, ...templateInfo.data, attrs };
+          })
+        );
+
+        this.coms = updatedComs;
+        console.log("coms", updatedComs);
+
+        this.uptadeSearch();
+      } catch (error) {
+        console.error("Error in onTemplateInfo:", error);
+      } finally {
+        this.loading = false;
+      }
     },
     },
     onRemove(index) {
     onRemove(index) {
       this.coms.splice(index, 1);
       this.coms.splice(index, 1);

+ 9 - 1
src/views/knowledgeMenu/category/components/dataList.vue

@@ -169,9 +169,11 @@
         :page-size="queryForm.pageSize"
         :page-size="queryForm.pageSize"
         :total="recordCount"
         :total="recordCount"
         :page-count="pageTotal"
         :page-count="pageTotal"
+        :page-sizes="[10, 20, 50, 100]"
         background
         background
-        layout="prev, pager, next"
+        layout="sizes, prev, pager, next"
         @current-change="ChangePage"
         @current-change="ChangePage"
+        @size-change="handleSizeChange"
       >
       >
       </el-pagination>
       </el-pagination>
     </div>
     </div>
@@ -650,6 +652,7 @@ export default {
           }));
           }));
           _this.pageTotal = res.data.pagination.total_count;
           _this.pageTotal = res.data.pagination.total_count;
           _this.recordCount = res.data.pagination.total_count;
           _this.recordCount = res.data.pagination.total_count;
+          _this.queryForm.pageSize = res.data.pagination.total_size;
           _this.loading = false;
           _this.loading = false;
 
 
           // Initialize the analysis status for each row
           // Initialize the analysis status for each row
@@ -669,6 +672,11 @@ export default {
       _this.queryForm.page = e;
       _this.queryForm.page = e;
       _this.search();
       _this.search();
     },
     },
+    handleSizeChange(val) {
+      this.queryForm.pageSize = val;
+      this.queryForm.page = 1; // Reset to first page when changing page size
+      this.search();
+    },
   },
   },
 };
 };
 </script>
 </script>

+ 33 - 9
src/views/login/aiIndex.vue

@@ -1,28 +1,52 @@
 <template>
 <template>
   <div>
   <div>
     <ChatBox />
     <ChatBox />
+    <LoginModal
+      :visible.sync="showLoginModal"
+      @close="showLoginModal = false"
+      @login-success="handleLoginSuccess"
+    />
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
 import ChatBox from "@/components/webAi/index.vue";
 import ChatBox from "@/components/webAi/index.vue";
+import LoginModal from "@/components/LoginModal";
+
 export default {
 export default {
   components: {
   components: {
     ChatBox,
     ChatBox,
+    LoginModal,
+  },
+  data() {
+    return {
+      showLoginModal: false,
+    };
+  },
+  mounted() {
+    this.checkAIData();
+  },
+  methods: {
+    checkAIData() {
+      const aiData = localStorage.getItem('AIData');
+      this.showLoginModal = !aiData;
+    },
+    handleLoginSuccess() {
+      this.showLoginModal = false;
+      // 处理登录成功后的逻辑,例如刷新数据或更新状态
+    },
   },
   },
 };
 };
 </script>
 </script>
-
 <style scoped>
 <style scoped>
-::v-deep .chat-container{
-    height: 100vh;
+::v-deep .chat-container {
+  height: 100vh;
 }
 }
-::v-deep .messages{
-  /* 在这里添加您想要的样式 */
- margin-bottom: 0;
- height: calc(100vh - 120px);
+::v-deep .messages {
+  margin-bottom: 0;
+  height: calc(100vh - 120px);
 }
 }
-::v-deep .input-container{
-    max-width:1200px;
+::v-deep .input-container {
+  max-width: 1200px;
 }
 }
 </style>
 </style>

+ 20 - 8
src/views/role/components/dataInfo.vue

@@ -462,14 +462,19 @@ export default {
           _this.treeData = [];
           _this.treeData = [];
           return;
           return;
         }
         }
-        /*      let dataList=this.$store.state.user.authList */
-        let data = [
-          {
+        /*      let dataList=this.$store.state.user.authList   {
+            value: 5,
+            label: "产品管理",
+            children: [],
+            sub: false,
+          },{
             value: 1,
             value: 1,
             label: "项目管理",
             label: "项目管理",
             children: [],
             children: [],
             sub: false,
             sub: false,
-          },
+          },*/
+        let data = [
+          
           {
           {
             value: 4,
             value: 4,
             label: "客户管理",
             label: "客户管理",
@@ -477,17 +482,24 @@ export default {
             sub: false,
             sub: false,
           },
           },
           {
           {
-            value: 5,
-            label: "产品管理",
+            value: 10,
+            label: "文档管理",
             children: [],
             children: [],
             sub: false,
             sub: false,
           },
           },
           {
           {
-            value: 10,
-            label: "文档管理",
+            value: 32,
+            label: "知识库管理",
+            children: [],
+            sub: false,
+          },
+          {
+            value: 37,
+            label: "小程序管理",
             children: [],
             children: [],
             sub: false,
             sub: false,
           },
           },
+          
           {
           {
             value: 21,
             value: 21,
             label: "系统设置",
             label: "系统设置",

+ 1 - 1
src/views/template/category/components/dataList.vue

@@ -33,7 +33,7 @@
           <div v-if="scope.row.status == 6">停用</div>
           <div v-if="scope.row.status == 6">停用</div>
         </template>
         </template>
       </el-table-column>
       </el-table-column>
-      <el-table-column label="操作" fixed="right" align="center">
+      <el-table-column label="操作" fixed="right" align="center" width="300">
         <template #default="scope">
         <template #default="scope">
           <div class="btns">
           <div class="btns">
             <el-button type="primary" size="small" @click="Subclass(scope.row)"
             <el-button type="primary" size="small" @click="Subclass(scope.row)"

+ 1 - 1
src/views/template/components/dataList.scss

@@ -6,7 +6,7 @@
     display:flex;
     display:flex;
     flex-direction: row;
     flex-direction: row;
   }
   }
-
+ 
 
 
 
 
 
 

+ 4 - 2
src/views/template/components/dataList.vue

@@ -2,9 +2,9 @@
   <div class="data-list">
   <div class="data-list">
     <el-table
     <el-table
       :data="dataList"
       :data="dataList"
-      style="width: 100%"
       header-row-class-name="headerBg"
       header-row-class-name="headerBg"
       empty-text="没有项目信息"
       empty-text="没有项目信息"
+      :max-height="tableMaxHeight"
     >
     >
       <el-table-column prop="id" label="ID" align="center" width="80" />
       <el-table-column prop="id" label="ID" align="center" width="80" />
       <!--  <el-table-column prop="code" label="引用名" align="center" width="180"/> -->
       <!--  <el-table-column prop="code" label="引用名" align="center" width="180"/> -->
@@ -17,7 +17,7 @@
           <div v-if="scope.row.status == 6">停用</div>
           <div v-if="scope.row.status == 6">停用</div>
         </template>
         </template>
       </el-table-column>
       </el-table-column>
-      <el-table-column label="操作" fixed="right" align="center">
+      <el-table-column label="操作" fixed="right" align="center" width="300">
         <template #default="scope">
         <template #default="scope">
           <div class="btns">
           <div class="btns">
             <el-button
             <el-button
@@ -206,6 +206,8 @@ export default {
           label: "停用",
           label: "停用",
         },
         },
       ],
       ],
+      categoryList:[],
+      tableMaxHeight: 500, // Add this line
     };
     };
   },
   },
   mounted() {
   mounted() {

Some files were not shown because too many files changed in this diff