nanjingliujinyu пре 5 месеци
родитељ
комит
285532eec0

+ 2 - 0
ruoyi-ui/package.json

@@ -23,6 +23,8 @@
     "@vueup/vue-quill": "1.2.0",
     "@vueuse/core": "10.11.0",
     "axios": "0.28.1",
+    "codemirror": "^5.65.19",
+    "codemirror-editor-vue3": "^2.8.0",
     "echarts": "^5.5.1",
     "element-plus": "2.7.6",
     "file-saver": "2.0.5",

+ 5 - 1
ruoyi-ui/src/layout/components/Sidebar/index.vue

@@ -12,7 +12,7 @@
         </div>
       </el-col>
       <el-col :span="16">
-        <el-scrollbar :class="sideTheme" wrap-class="scrollbar-wrapper" style="margin-left: 3%;">
+        <el-scrollbar :class="sideTheme" wrap-class="scrollbar-wrapper" style="margin-left: 4%;">
           <el-menu
               :default-active="activeMenu"
               class="custom-menu"
@@ -119,6 +119,8 @@ function handleCommand(command) {
   line-height: 60px;
   background-image: url('../../../assets/images/title-background.png') !important;
   background-position: -90px 0;
+  background-size: auto 122%;        /* 高度100%,宽度按原比例 */
+  background-repeat: no-repeat;
   .line-left-img {
     float: left;
 
@@ -149,6 +151,8 @@ function handleCommand(command) {
 }
 
 .avatar-container {
+  background-image: url('../../../assets/images/title-background.png') !important;
+  background-position: right center;
   .avatar-wrapper {
     margin-top: 10px;
     position: relative;

+ 169 - 19
ruoyi-ui/src/views/register/modelData/dataJi.vue

@@ -130,14 +130,119 @@
       </span>
     </template>
   </el-dialog>
-  <el-dialog @close=""  v-model="dialogVisibleTree" title="配置管理" width="50%" destroy-on-close :key="tableKey">
+  <el-dialog @close=""  v-model="dialogVisibleTree" title="配置管理" width="60%" destroy-on-close :key="tableKey" @opened="refreshEditor">
+    <div style="display: flex;align-items: center;width: 100%;">
+      <div>
+        数据源:
+      </div>
+      <div style="width: 15%;">
+        <el-select
+        v-model="valueDs"
+        size="mini"
+        style="width: 100%;margin-left: 1%;"
+        >
+            <el-option
+            v-for="item in optionsDs"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+            />
+        </el-select>
+      </div>
+    </div>
+    <div style="border: solid  1px #e9e9eb;margin-top:1%;">
+      <Codemirror 
+      v-model:value="code" 
+      :options="cmOptions" 
+      height="100px"
+      ref="cmRef"
+      style="margin-top: 0%;"
+    />
+    </div>
     <div style="margin-top:0%;">
       <div style="display: flex;justify-content: space-between;align-items: center;">
-        <div style="display: flex;justify-content: flex-end;width: 100%;margin-right: 2%;">
-          <el-button  @click="addCanAdd" style="margin-top: 0%;" type="success" size="mini" plain>新增字段</el-button>
-        </div>
+        
       </div>
-      <div>
+      <el-button style="margin-top: 2%;left: 92%;z-index:555;position: absolute;" type="info" plain size="mini">测试</el-button>
+      <el-tabs
+        v-model="activeName"
+        type="card"
+        class="demo-tabs"
+        style="margin-top: 2%;"
+        @tab-click="handleClick"
+      >
+        
+        <el-tab-pane label="参数" name="first">
+          <div style="display: flex;width: 100%;margin-top: 0%;">
+            <el-button  @click="addCanAdd" style="margin-top: 0%;" type="success" size="mini" plain>新增字段</el-button>
+          </div>
+          <el-table 
+          style="margin-top: 1%;width: 98%;"
+          :data="tableDataCanAdd" 
+          :cell-style="{ textAlign: 'center',padding:'2px 0' }"
+          :header-cell-style="{ textAlign: 'center'}"
+          :row-style="{ height: heightAll*0.01+'px',fontSize: '16px',textAlign:'center'  }"
+          border >
+              <el-table-column prop="itemName" label="字段编码" width="200">
+                  <template #default="scope">
+                      <el-input placeholder="(必填)" type="primary" class="noBor" v-model="scope.row.fieldCode" size="mini" text style="margin-left: 0%;"></el-input>
+                  </template>
+              </el-table-column>
+              <el-table-column prop="itemName" label="字段名称">
+                  <template #default="scope">
+                      <div style="width: 100%;">
+                          <el-input placeholder="" type="primary" class="noBor" v-model="scope.row.fieldName" size="mini" text style="margin-left: 0%;"></el-input>
+                      </div>
+                  </template>
+              </el-table-column>
+              <el-table-column prop="itemName" label="字段类型">
+                  <template #default="scope">
+                      <div style="width: 100%;">
+                          <el-input placeholder="" type="primary" class="noBor" v-model="scope.row.metaType" size="mini" text style="margin-left: 0%;"></el-input>
+                      </div>
+                  </template>
+              </el-table-column>
+              <el-table-column prop="itemName" label="长度" >
+                  <template #default="scope">
+                      <div style="width: 100%;">
+                          <el-input type="primary" class="noBor" v-model="scope.row.fieldLength" size="mini" text style="margin-left: 0%;"></el-input>
+                      </div>
+                  </template>
+              </el-table-column>
+              <el-table-column prop="itemName" label="默认值" >
+                  <template #default="scope">
+                      <div style="width: 100%;">
+                          <el-input type="primary" class="noBor" v-model="scope.row.fieldDefault" size="mini" text style="margin-left: 0%;"></el-input>
+                      </div>
+                  </template>
+              </el-table-column>
+              <el-table-column prop="itemName" label="说明" >
+                  <template #default="scope">
+                      <div style="width: 100%;">
+                          <el-input type="primary" class="noBor" v-model="scope.row.fieldDesc" size="mini" text style="margin-left: 0%;"></el-input>
+                      </div>
+                  </template>
+              </el-table-column>
+              <el-table-column prop="itemName" label="主键" width="80">
+                  <template #default="scope">
+                      <div style="width: 100%;">
+                          <el-checkbox v-model="scope.row.fieldIspri" label="" size="large" />
+                      </div>
+                  </template>
+              </el-table-column>
+              <el-table-column prop="address" label="操作" width="100">
+                  <template #default="scope">
+                      <div style="width: 100%;">
+                          <el-button type="danger" @click="delCanAdd(scope.$index)" size="mini" text style="margin-left: 0%;">删除</el-button>
+                      </div>
+                  </template>
+              </el-table-column>
+          </el-table>
+        </el-tab-pane>
+        <el-tab-pane label="结果集" name="second">
+          <div style="display: flex;width: 100%;margin-top: 0%;">
+            <el-button  @click="addCanAdd" style="margin-top: 0%;" type="success" size="mini" plain>新增字段</el-button>
+          </div>
           <el-table 
           style="margin-top: 1%;width: 98%;"
           :data="tableDataCanAdd" 
@@ -200,6 +305,15 @@
                   </template>
               </el-table-column>
           </el-table>
+        </el-tab-pane>
+        <el-tab-pane label="预览" name="third">
+          <div style="overflow: auto;height: 20vh;margin-top: -1%;">
+            <el-input placeholder="" :rows="8" type="textarea" v-model="JsonAdd" size="mini" text style="margin-top: 1%;width: 98%;" ></el-input>
+          </div>
+        </el-tab-pane>
+      </el-tabs>
+      <div>
+          
           
       </div>
   </div>
@@ -237,8 +351,25 @@
 <script   setup>
 import { reactive } from 'vue'
 import { Plus } from '@element-plus/icons-vue'
-import { cateTree,addCate,delCate,fieldAll,addSet,dataSetList,editSet,fieldAdd,delField  } from "@/api/register/regCom.js";
+import { cateTree,addCate,delCate,fieldAll,addSet,dataSetList,editSet,fieldAdd,delField,getDataSourceList,getMetaFiele  } from "@/api/register/regCom.js";
 import { ref, onMounted, onUnmounted, nextTick } from 'vue';
+import Codemirror from 'codemirror-editor-vue3';
+import 'codemirror/lib/codemirror.css'; // 核心样式
+import 'codemirror/theme/dracula.css';  // 主题
+import 'codemirror/mode/sql/sql.js'; 
+const code = ref('const example = "Hello, CodeMirror!"');
+const cmRef = ref(null)
+const cmOptions = {
+  mode: 'x-sql',
+  hintOptions: {
+    completeSingle: false,
+    tables: {
+      users: ['id', 'name', 'email'],   // 自定义表字段提示
+      products: ['id', 'price', 'stock']
+    }
+  }
+};
+const activeName = ref('first')
 const { proxy } = getCurrentInstance();
 const data =  ref([])
 const title =  ref([])
@@ -256,7 +387,7 @@ const isAddTa = ref(false)
 const treeId = ref('');
 const dcName =ref()
 const parDel = ref({})
-const parTree = ref({})
+const parTree = ref(null)
 const formZu = ref({
   cateId:'',
   dcName:'',
@@ -264,6 +395,7 @@ const formZu = ref({
   dcSort:1,
   dcNote:''
 });
+const optionsDs = ref([])
 const currentNodeKey = ref('')
 const rulesZu = reactive({
   dcName: [{ required: true, message: '必填', trigger: 'blur' }],
@@ -285,7 +417,21 @@ const rulesTree = reactive({
 const formRefTree = ref();
 const parDscode = ref('')
 const parLev = ref(1)
-
+function getOptionsDs(){
+  getDataSourceList().then(res=>{
+    optionsDs.value = res.rows
+    optionsDs.value.forEach(item=>{
+        item.label = item.dsDbname
+        item.value = item.dsCode
+    })
+    total.value = res.total
+  })
+}
+const refreshEditor = () => {
+  nextTick(() => {
+    cmRef.value?.refresh(); // 关键调用
+  });
+};
 function delAll(){
     proxy.$modal.confirm('是否确认删除?').then(function () {
         return delCate(parTree.value.id);
@@ -355,23 +501,25 @@ tableDataCanAdd.value.forEach((item, index, array)=>{
   
 }
 function showPei(row){
+
   dialogVisibleTree.value = true
+  
   parMeta.value = row
   var par = {
     dsCode:parDscode.value,
     metaTable:row.metaTable,
   }
-  getMetaFiele(par).then(res=>{
-    tableDataCanAdd.value = res.data
-    tableDataCanAdd.value.forEach(item=>{
-    if(item.fieldIspri==='1'){
-      item.fieldIspri = true
-    }
-    if(item.fieldIspri==='2'){
-      item.fieldIspri = false 
-    }
-  })
-  })
+  // getMetaFiele(par).then(res=>{
+  //   tableDataCanAdd.value = res.data
+  //   tableDataCanAdd.value.forEach(item=>{
+  //   if(item.fieldIspri==='1'){
+  //     item.fieldIspri = true
+  //   }
+  //   if(item.fieldIspri==='2'){
+  //     item.fieldIspri = false 
+  //   }
+  // })
+  // })
 }
 function clearForm(){
   formTree.value = {
@@ -415,6 +563,7 @@ function getTable(){
   })
 }
 function showAdd(){
+  cmRef.value = Math.random()
   isAddTa.value = true
   title.value = '新增'
   dialogVisible.value = true
@@ -532,6 +681,7 @@ function editTree(node, data){
 }
 onMounted(() => {
   getTree()
+  getOptionsDs()
   // getTable()
 });