lph преди 1 година
родител
ревизия
bc1be3423a

+ 2 - 2
ruoyi-ui/.env.development

@@ -11,7 +11,7 @@ VUE_APP_BASE_API = '/dev-api'
 VUE_CLI_BABEL_TRANSPILE_MODULES = true
 
 #数据引擎模块IP
-VUE_APP_BASE_API2 = 'http://192.168.110.76:8099/'
+VUE_APP_BASE_API2 = 'http://192.168.110.59:8099/'
 
 #表单引擎模块IP
-VUE_APP_BASE_API3 = 'http://192.168.110.76:8088/'
+VUE_APP_BASE_API3 = 'http://192.168.110.59:8088/'

+ 1 - 0
ruoyi-ui/src/views/system/fromModel/index.vue

@@ -82,6 +82,7 @@ export default {
         addForm({
           dfName: "1",
           dfNickname: "1",
+          sqlKey: sessionStorage.getItem("sqlKey") || "",
           dfVueTemplate: values,
           dtId: JSON.parse(values).config.tdId,
           dfHtmlTemplate: editorHtmlJson.toString(),

+ 31 - 2
ruoyi-ui/src/views/tableMange/index.vue

@@ -235,6 +235,19 @@
                 ></el-option>
               </el-select>
             </el-form-item>
+            <el-form-item label="表格主键" prop="primaryKey">
+              <el-select
+                v-model="formData.primaryKey"
+                placeholder="请选择表格主键"
+              >
+                <el-option
+                  v-for="val in primaryKeyList"
+                  :key="val.fieldName"
+                  :label="val.fieldDescription"
+                  :value="val.fieldName"
+                ></el-option>
+              </el-select>
+            </el-form-item>
             <el-form-item label="排序依赖字段">
               <el-select
                 v-model="formData.orderByColumn"
@@ -253,8 +266,8 @@
               <el-radio v-model="formData.isAsc" label="DESC">降序</el-radio>
             </el-form-item>
             <el-form-item>
-              <el-button @click="previewHandle">预览</el-button>
-              <el-button type="primary" @click="createHandle">{{
+              <el-button size="mini" @click="previewHandle">预览</el-button>
+              <el-button size="mini" type="primary" @click="createHandle">{{
                 tId ? "确认修改" : "确认创建"
               }}</el-button>
             </el-form-item>
@@ -510,6 +523,7 @@ export default {
         timeFormate: "",
         orderByColumn: "",
         isAsc: "ASC",
+        primaryKey: "",
       },
       rules: {
         menuName: [
@@ -521,6 +535,9 @@ export default {
         timeFormate: [
           { required: true, message: "请选择时间格式", trigger: "change" },
         ],
+        primaryKey: [
+          { required: true, message: "请选择表格主键", trigger: "blur" },
+        ],
         fieldDescription: [
           { required: true, message: "请输入字段描述", trigger: "blur" },
         ],
@@ -560,6 +577,9 @@ export default {
     orderByFieldList() {
       return this.tableFieldList.filter((item) => item.isShow);
     },
+    primaryKeyList() {
+      return this.tableFieldList.filter((item) => !item.isChildren);
+    },
   },
   watch: {
     tableName: function (val) {
@@ -838,6 +858,14 @@ export default {
         //   this.getSQLString(temp.relationFieldList, fieldArr, tableArr);
         // }
       }
+      // 如果主键不包含显示,则添加至sql语句中
+      let isNotInclude = this.primaryKeyList.find(
+        (val) => !val.isShow && val.fieldName == this.formData.primaryKey
+      );
+      console.log(isNotInclude);
+      if (isNotInclude) {
+        fieldArr.push(isNotInclude.tableName + "." + isNotInclude.fieldName);
+      }
     },
 
     // 拼接查询sql语句
@@ -1042,6 +1070,7 @@ export default {
             // menuId: this.formData.routePath,
             // tableKey: this.formData.routePath, //  暂定
             dtTableName: this.tableName,
+            primaryKey: this.formData.primaryKey,
             sqlKey: uuid,
             dtColumnName: columns, //列字段标题名称(存储显示字段信息
             timeFormat: this.formData.timeFormate,

+ 26 - 26
ruoyi-ui/src/views/tablelist/commonTable/listInfo.vue

@@ -38,7 +38,7 @@
             :underline="false"
             style="font-size: 12px; vertical-align: baseline"
             @click="importTemplate"
-          >下载模板
+            >下载模板
           </el-link>
         </div>
       </el-upload>
@@ -60,7 +60,7 @@
           icon="el-icon-plus"
           size="mini"
           @click="handleAdd"
-        >新增
+          >新增
         </el-button>
       </el-col>
       <el-col :span="1.5">
@@ -71,7 +71,7 @@
           size="mini"
           :disabled="single"
           @click="handleUpdate"
-        >修改
+          >修改
         </el-button>
       </el-col>
       <el-col :span="1.5">
@@ -82,7 +82,7 @@
           size="mini"
           :disabled="multiple"
           @click="handleDelete"
-        >删除
+          >删除
         </el-button>
       </el-col>
       <el-col :span="1.5">
@@ -91,7 +91,7 @@
           icon="el-icon-upload2"
           size="mini"
           @click="upload.open = true"
-        >导入
+          >导入
         </el-button>
       </el-col>
       <el-col :span="1.5">
@@ -101,7 +101,7 @@
           icon="el-icon-download"
           size="mini"
           @click="handleExport"
-        >导出
+          >导出
         </el-button>
       </el-col>
       <right-toolbar
@@ -114,7 +114,7 @@
       :data="tableList"
       @selection-change="handleSelectionChange"
     >
-      <el-table-column type="selection" width="55" align="center"/>
+      <el-table-column type="selection" width="55" align="center" />
       <!-- <span v-for="(key, val) in columns" :key="key">
         <el-table-column :label="key" align="center" :prop="val" />
       </span> -->
@@ -136,14 +136,14 @@
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
-          >修改
+            >修改
           </el-button>
           <el-button
             size="mini"
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
-          >删除
+            >删除
           </el-button>
         </template>
       </el-table-column>
@@ -187,12 +187,12 @@ import {
   getInfoBySqlKey,
   addTableData,
 } from "@/api/tablelist/commonTable";
-import {getToken} from "@/utils/auth";
+import { getToken } from "@/utils/auth";
 import Queryfrom from "@/views/tablelist/commonTable/queryfrom.vue";
 
 export default {
   name: "listInfo",
-  components: {Queryfrom},
+  components: { Queryfrom },
   data() {
     return {
       // 遮罩层
@@ -229,7 +229,7 @@ export default {
         // 是否更新已经存在的数据
         updateSupport: 0,
         // 设置上传的请求头部
-        headers: {Authorization: "Bearer " + getToken()},
+        headers: { Authorization: "Bearer " + getToken() },
         // 上传的地址
         url: process.env.VUE_APP_BASE_API3 + "common/uploadData",
       },
@@ -302,9 +302,9 @@ export default {
     getList(queryParams) {
       this.loading = true;
       // 序列化当前查询参数列表
-      this.queryParams.queryMap = queryParams.queryMap;
+      queryParams && (this.queryParams.queryMap = queryParams.queryMap);
       // 获取当前表单结构信息
-      dragTableInfo({queryMap: {sqlkey: this.sqlkey}})
+      dragTableInfo({ queryMap: { sqlkey: this.sqlkey } })
         .then((res) => {
           // 得到当前模版信息 --- sql columns queryWhere
           this.templateInfo = res.data.resultMap;
@@ -351,9 +351,9 @@ export default {
       this.$refs.mychild.pageList(
         row == undefined
           ? {
-            limit: this.queryParams.pageSize,
-            page: this.queryParams.pageNum,
-          }
+              limit: this.queryParams.pageSize,
+              page: this.queryParams.pageNum,
+            }
           : row
       );
     },
@@ -381,7 +381,7 @@ export default {
     handleAdd(row) {
       // this.reset();
       this.defaultValue = {};
-      getInfoBySqlKey(this.sqlkey).then(({data}) => {
+      getInfoBySqlKey(this.sqlkey).then(({ data }) => {
         const htmlCode = data.dfHtmlTemplate;
         this.iframeUrl = "data:text/html;charset=utf-8," + encodeURI(htmlCode);
         this.jsonData = JSON.parse(data.dfVueTemplate);
@@ -395,13 +395,13 @@ export default {
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
-      getInfoBySqlKey(this.sqlkey).then(({data}) => {
+      getInfoBySqlKey(this.sqlkey).then(({ data }) => {
         const htmlCode = data.dfHtmlTemplate;
         this.iframeUrl = "data:text/html;charset=utf-8," + encodeURI(htmlCode);
         Object.assign(this.defaultValue, row);
         this.jsonData = JSON.parse(data.dfVueTemplate);
         this.open = true;
-        this.title = "添加信息";
+        this.title = "修改信息";
         this.form.password = this.initPassword;
         this.$nextTick(() => {
           this.$refs.addFromRef.setData(row);
@@ -474,8 +474,7 @@ export default {
           this.$refs.mychild.pageList();
           this.$modal.msgSuccess("删除成功");
         })
-        .catch(() => {
-        });
+        .catch(() => {});
     },
     /** 导出按钮操作 */
     handleExport() {
@@ -508,7 +507,7 @@ export default {
     importTemplate() {
       this.download(
         process.env.VUE_APP_BASE_API3 +
-        `dragform/common/exportTemplate?tableName=${this.tableName}&sqlkey=${this.sqlkey}`,
+          `dragform/common/exportTemplate?tableName=${this.tableName}&sqlkey=${this.sqlkey}`,
         {},
         `下载模版名称${new Date().getTime()}.xlsx`
       );
@@ -524,10 +523,10 @@ export default {
       this.$refs.upload.clearFiles();
       this.$alert(
         "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
-        response.msg +
-        "</div>",
+          response.msg +
+          "</div>",
         "导入结果",
-        {dangerouslyUseHTMLString: true}
+        { dangerouslyUseHTMLString: true }
       );
       this.$refs.mychild.pageList({
         limit: this.queryParams.pageSize,
@@ -568,6 +567,7 @@ export default {
             this.$modal.msgSuccess("添加成功");
             this.getList();
           }
+          console.log("123");
           this.defaultValue = {};
           this.open = false;
         })

+ 1 - 1
ruoyi-ui/vue.config.js

@@ -35,7 +35,7 @@ module.exports = {
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
-        target: `http://192.168.110.76:8080`,
+        target: `http://192.168.110.59:8080`,
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''