sr 4 rokov pred
rodič
commit
2e9363d144

+ 28 - 0
boman-modules/boman-gen/src/main/java/com/boman/gen/service/GenTableColumnServiceImpl.java

@@ -16,8 +16,11 @@ import com.boman.gen.mapper.GenTableMapper;
 import com.boman.gen.mapper.TableSqlMapper;
 import com.google.common.collect.Maps;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
 
+import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -38,6 +41,8 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService {
     @Autowired
     private TableSqlMapper tableSqlMapper;
 
+
+
     /**
      * 查询业务字段列表
      *
@@ -133,6 +138,8 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService {
         list.add(genTableColumn);
         isAk(list);
         insertCreateLog(list, BusinessType.INSERT);
+        //处理字段翻译器
+        fieldTranslator(list);
         return i;
     }
 
@@ -148,6 +155,7 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService {
         list.add(genTableColumn);
         isAk(list);
         insertCreateLog(list, BusinessType.UPDATE);
+        fieldTranslator(list);
         return genTableColumnMapper.updateGenTableColumn(genTableColumn);
     }
 
@@ -170,6 +178,7 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService {
     /**
      * 插入表sql日志
      */
+    @Async
     public void insertCreateLog(List<GenTableColumn> genTableColumnList, BusinessType type) {
         GenTable genTable = genTableMapper.selectGenTableById(genTableColumnList.get(0).getTableId());
         TableSql tableSql = tableSqlMapper.selectTableSqlByTableId(genTableColumnList.get(0).getTableId());
@@ -203,6 +212,7 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService {
      *
      * @param genTableColumnList
      */
+    @Async
     public void isAk(List<GenTableColumn> genTableColumnList) {
         GenTable genTable = new GenTable();
         for (GenTableColumn genTableColumn : genTableColumnList) {
@@ -250,6 +260,24 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService {
     }
 
 
+
+    /**
+     * 处理字段翻译器
+     * @param genTableColumnList
+     */
+    @Async
+    public void fieldTranslator (List<GenTableColumn> genTableColumnList) {
+        for (GenTableColumn genTableColumn : genTableColumnList) {
+            String fieldTranslator = genTableColumn.getFieldTranslator();
+            if (StringUtils.isNotBlank(fieldTranslator)){
+                RestTemplate restTemplate = new RestTemplate();
+                restTemplate.postForObject("http://" + fieldTranslator, genTableColumn, GenTableColumn.class);
+            }
+        }
+    }
+
+
+
     /**
      * 删除业务字段对象
      *

+ 0 - 8
boman-modules/boman-gen/src/main/java/com/boman/gen/service/GenTableServiceImpl.java

@@ -452,14 +452,6 @@ public class GenTableServiceImpl implements IGenTableService {
     public AjaxResult insertGenTable(GenTable genTable) {
         String menuRole = genTable.getMenuRole();
         genTable.setMenuRole(menuRole.toUpperCase());
-
-        Integer tableColumn = genTable.getTableColumn();
-        if (tableColumn != null && tableColumn > 0){
-            //判断表单有几列 用24进行除法
-            int num = 24 / tableColumn;
-            genTable.setTableColumn(num);
-
-        }
         //新增表成功的时候,新增字段公共字段
         int i = genTableMapper.insertGenTable(genTable);
         if (i > 0) {

+ 5 - 5
ruoyi-ui/package.json

@@ -37,7 +37,7 @@
   },
   "dependencies": {
     "@riophae/vue-treeselect": "0.4.0",
-    "axios": "0.21.0",
+    "axios": "^0.21.1",
     "burgeon-ui": "1.0.46",
     "clipboard": "2.0.6",
     "core-js": "3.8.1",
@@ -65,21 +65,21 @@
   "devDependencies": {
     "@vue/cli-plugin-babel": "4.4.6",
     "@vue/cli-plugin-eslint": "4.4.6",
-    "@vue/cli-service": "4.4.6",
+    "@vue/cli-service": "^4.5.13",
     "babel-eslint": "10.1.0",
     "chalk": "4.1.0",
     "connect": "3.6.6",
     "eslint": "7.15.0",
     "eslint-plugin-vue": "7.2.0",
+    "less": "^4.1.1",
+    "less-loader": "^4.1.0",
     "lint-staged": "10.5.3",
     "runjs": "4.4.2",
     "sass": "1.32.0",
     "sass-loader": "10.1.0",
     "script-ext-html-webpack-plugin": "2.1.5",
     "svg-sprite-loader": "5.1.1",
-    "vue-template-compiler": "2.6.12",
-    "less": "^4.1.1",
-    "less-loader": "^4.1.0"
+    "vue-template-compiler": "2.6.12"
   },
   "engines": {
     "node": ">=8.9",

+ 65 - 27
ruoyi-ui/src/components/DynamicFormsteo/index.vue

@@ -1,13 +1,13 @@
 <template>
   <!-- <el-row  class="row-bg"> -->
   <el-col :span="ieug !== null? ieug : 8 "  >
-  <el-form-item   :label="formConfig.columnComment"  :prop="formConfig.columnName">
+  <el-form-item label-width="120px" :label="formConfig.columnComment" style="display: inline-block;" :prop="formConfig.columnName">
     <!-- 输入框 -->
-    <el-input v-if="formConfig.htmlType == 'input'" v-model="config[formConfig.columnName]" :placeholder="'请输入'+formConfig.columnComment"
-      clearable @keyup.enter.native="handleQuery"  :disabled="formConfig.disabshow" />
+    <el-input v-if="formConfig.htmlType == 'input'" @change="iChange" v-model="config[formConfig.columnName]" :placeholder="'请输入'+formConfig.columnComment"
+      clearable @keyup.enter.native="handleQuery" :disabled="formConfig.disabshow" />
     <!-- 多行输入框 -->
-    <el-input v-if="formConfig.htmlType == 'textarea'" type="textarea" v-model="config[formConfig.columnName]"
-      :placeholder="'请输入'+formConfig.columnComment" clearable @keyup.enter.native="handleQuery" :disabled="formConfig.disabshow"/>
+    <el-input v-if="formConfig.htmlType == 'textarea'" @change="iChange" type="textarea" v-model="config[formConfig.columnName]"
+      :placeholder="'请输入'+formConfig.columnComment" clearable @keyup.enter.native="handleQuery" :disabled="formConfig.disabshow" />
     <!-- 下拉框 -->
     <el-select v-model="config[formConfig.columnName]" v-if="formConfig.htmlType == 'select'&&(!formConfig.fkInfo)"
       filterable :placeholder="'请输入'+formConfig.columnComment" :disabled="formConfig.disabshow">
@@ -18,7 +18,8 @@
     <!-- 下拉框搜索 -->
     <el-select :disabled="formConfig.disabshow" v-model="config[formConfig.columnName]" v-if="formConfig.htmlType == 'select'&&(formConfig.fkInfo)"
       filterable remote :remote-method="remoteMethod" :loading="loading" :placeholder="'请输入'+formConfig.columnComment">
-      <el-option v-for="itemChild in filterList" :key="itemChild[formConfig.fkInfo.fkColumnName]" :label="itemChild[formConfig.fkInfo.dkColumnName]" :value="itemChild[formConfig.fkInfo.fkColumnName]">
+      <el-option v-for="itemChild in filterList" :key="itemChild[formConfig.fkInfo.fkColumnName]" :label="itemChild[formConfig.fkInfo.dkColumnName]"
+        :value="itemChild[formConfig.fkInfo.fkColumnName]">
       </el-option>
     </el-select>
     <!-- 复选框 -->
@@ -33,27 +34,28 @@
       <el-radio v-for="itemChild in formConfig.sysDictData" :key="itemChild.dictValue" :label="itemChild.dictValue">{{itemChild.dictLabel}}</el-radio>
     </el-radio-group>
     <!-- 时间控件 -->
-    <el-date-picker :disabled="formConfig.disabshow" v-model="config[formConfig.columnName]" v-if="formConfig.htmlType == 'datetime'" type="date"
-      :placeholder="'请输入'+formConfig.columnComment">
+    <el-date-picker :disabled="formConfig.disabshow" @change="iChange" v-model="config[formConfig.columnName]" v-if="formConfig.htmlType == 'datetime'"
+      type="date" :placeholder="'请输入'+formConfig.columnComment">
     </el-date-picker>
     <!-- 上传图片 -->
-    <el-upload :disabled="formConfig.disabshow" v-if="formConfig.htmlType == 'imageUpload'" :headers="{Authorization: 'Bearer ' + getToken()}" :action="process + '/boman-file/upload'"
-      :file-list="config" list-type="picture-card" :on-preview="handlePictureCardPreview" :on-success="upImageFn"
-      :on-remove="reseImage">
+    <el-upload :disabled="formConfig.disabshow" v-if="formConfig.htmlType == 'imageUpload'" :headers="{Authorization: 'Bearer ' + getToken()}"
+      :action="process + '/boman-file/upload'" :file-list="config" list-type="picture-card" :on-preview="handlePictureCardPreview"
+      :on-success="upImageFn" :on-remove="reseImage">
       <i class="el-icon-plus"></i>
     </el-upload>
     <el-dialog :disabled="formConfig.disabshow" :visible.sync="dialogVisible" v-if="formConfig.htmlType == 'imageUpload'">
       <img :src="dialogImageUrl" alt="">
     </el-dialog>
     <!-- 上传文件 -->
-    <el-upload :disabled="formConfig.disabshow" class="upload-demo" :headers="{Authorization: 'Bearer ' + getToken()}" v-if="formConfig.htmlType == 'fileUpload'"
-      :action="process + '/boman-file/upload'" :on-change="handleChange" :on-success="upImageFn" :on-remove="reseImage"
-      :file-list="config">
+    <el-upload :disabled="formConfig.disabshow" class="upload-demo" :headers="{Authorization: 'Bearer ' + getToken()}"
+      v-if="formConfig.htmlType == 'fileUpload'" :action="process + '/boman-file/upload'" :on-change="handleChange"
+      :on-success="upImageFn" :on-remove="reseImage" :file-list="config">
       <el-button size="small" type="primary">点击上传</el-button>
       <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
     </el-upload>
     <!-- 富文本 -->
-    <editor :disabled="formConfig.disabshow" v-model="config[formConfig.columnName]" v-if="formConfig.htmlType == 'editor'" :min-height="192" />
+    <editor :disabled="formConfig.disabshow" v-model="config[formConfig.columnName]" v-if="formConfig.htmlType == 'editor'"
+      :min-height="192" />
   </el-form-item>
   </el-col>
   <!-- </el-row> -->
@@ -96,6 +98,14 @@
       Editor
     },
     props: {
+      queryData: {
+        type: Object,
+        default: res => {
+          return {
+            showData: []
+          }
+        }
+      },
       formConfig: {
         type: Object,
         required: true,
@@ -128,19 +138,46 @@
         this.ieug = 24 / (this.formConfig.tableColumnuy -0)
       }
       this.init()
+      if (this.formConfig.extendedAttributes) {
+        let extend = JSON.parse(this.formConfig.extendedAttributes)
+        this.extFn(extend.col, extend.comp)
+      }
     },
-    watch: {
-      'config': {
-         handler: function() {
-             this.$emit('modelFn',this.formConfig.columnName,this.config[this.formConfig.columnName])
-         },
-         deep: true
-     }
-    },
+   watch: {
+     'config': {
+       handler: function() {
+         this.$emit('modelFn', this.formConfig.columnName, this.config[this.formConfig.columnName])
+       },
+       deep: true
+     },
+     'queryData': {
+       handler: function() {
+         if (this.formConfig.extendedAttributes) {
+           console.log(this.formConfig,222)
+           let extend = JSON.parse(this.formConfig.extendedAttributes)
+           this.extFn(extend.col, extend.comp)
+         }
+       },
+       deep: true
+     },
+   },
     mounted() {
-      console.log(this.formConfig)
+      // console.log(this.formConfig)
     },
     methods: {
+      iChange(val){
+        if(this.formConfig.isUseExtend){
+          this.$emit('iChange',this.formConfig.columnName,val)
+        }
+      },
+      extFn(col, comp) {
+        let str = this.getDyn(col, this.queryData.showData,comp)
+        this.config[this.formConfig.columnName] = str
+      },
+      eval(code){
+        let fun = new Function(`return ${code}`)();
+        return fun
+      },
       listIndexfouFn() {
         listIndexfou(this.aliemg).then(response => {
           if (response.data) {
@@ -166,12 +203,13 @@
           'fileUpload') {
           this.config = []
         } else {
-          this.$set(this.config, this.formConfig.columnName, (this.formConfig.columnValue || ''))
+          this.$set(this.config, this.formConfig.columnName, ((this.formConfig.columnValue ? this.formConfig.columnValue :
+            this.formConfig.defaultValue) || ''))
         }
 
-        if(this.formConfig.fkInfo){
+        if (this.formConfig.fkInfo) {
           this.aliemg.table = this.formConfig.fkInfo.fkTableName
-          if(this.formConfig.fkInfo.value){
+          if (this.formConfig.fkInfo.value) {
             this.aliemg.fixedData.condition[this.formConfig.fkInfo.dkColumnName] = this.formConfig.fkInfo.value
           }
           this.listIndexfouFn()

+ 83 - 83
ruoyi-ui/src/main.js

@@ -1,100 +1,100 @@
-import Vue from 'vue'
-
+import Vue from 'vue'
+
 import Cookies from 'js-cookie'
 
 // import '@/assets/styles/theme.scss';
 import less from 'less'
-Vue.use(less)
-
-import Element from 'element-ui'
-import './assets/styles/element-variables.scss'
+Vue.use(less)
+
+import Element from 'element-ui'
+import './assets/styles/element-variables.scss'
 import 'burgeon-ui/dist/styles/burgeon-ui.css';
-
-import '@/assets/styles/index.scss' // global css
-import '@/assets/styles/ruoyi.scss' // ruoyi css
-import App from './App'
-import store from './store'
-import router from './router'
-import permission from './directive/permission'
+
+import '@/assets/styles/index.scss' // global css
+import '@/assets/styles/ruoyi.scss' // ruoyi css
+import App from './App'
+import store from './store'
+import router from './router'
+import permission from './directive/permission'
 import { download } from '@/utils/request'
 import { getDyn } from '@/utils/currencyFn'
 
-import '@/utils/dateApi'
-
-
-import './assets/icons' // icon
-import './permission' // permission control
-import { getDicts } from "@/api/system/dict/data";
-import { getConfigKey } from "@/api/system/config";
-import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
-import Pagination from "@/components/Pagination";
-// 自定义表格工具扩展
-import RightToolbar from "@/components/RightToolbar"
-import DynamicForm from "@/components/DynamicForm"
-import DynamicForms from "@/components/DynamicForms"
-import DynamicFormsteo from "@/components/DynamicFormsteo"
+import '@/utils/dateApi'
+
+
+import './assets/icons' // icon
+import './permission' // permission control
+import { getDicts } from "@/api/system/dict/data";
+import { getConfigKey } from "@/api/system/config";
+import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
+import Pagination from "@/components/Pagination";
+// 自定义表格工具扩展
+import RightToolbar from "@/components/RightToolbar"
+import DynamicForm from "@/components/DynamicForm"
+import DynamicForms from "@/components/DynamicForms"
+import DynamicFormsteo from "@/components/DynamicFormsteo"
 import MemoranDum from "@/components/MemoranDum"
 import 'burgeon-ui/dist/styles/burgeon-ui.css';
 import 'burgeon-ui/dist/styles/bjIconfonts/iconfont.css';
 import BigPicture from "@/components/BigPicture";
 Vue.component('BigPicture', BigPicture)
 import BurgeonUi from 'burgeon-ui';
-
-// 全局方法挂载
-Vue.prototype.getDicts = getDicts
-Vue.prototype.getConfigKey = getConfigKey
-Vue.prototype.parseTime = parseTime
-Vue.prototype.resetForm = resetForm
-Vue.prototype.addDateRange = addDateRange
-Vue.prototype.selectDictLabel = selectDictLabel
-Vue.prototype.selectDictLabels = selectDictLabels
+
+// 全局方法挂载
+Vue.prototype.getDicts = getDicts
+Vue.prototype.getConfigKey = getConfigKey
+Vue.prototype.parseTime = parseTime
+Vue.prototype.resetForm = resetForm
+Vue.prototype.addDateRange = addDateRange
+Vue.prototype.selectDictLabel = selectDictLabel
+Vue.prototype.selectDictLabels = selectDictLabels
 Vue.prototype.download = download
 Vue.prototype.getDyn = getDyn
-Vue.prototype.handleTree = handleTree
-
-Vue.prototype.msgSuccess = function (msg) {
-  this.$message({ showClose: true, message: msg, type: "success" });
-}
-
-Vue.prototype.msgError = function (msg) {
-  this.$message({ showClose: true, message: msg, type: "error" });
-}
-
-Vue.prototype.msgInfo = function (msg) {
-  this.$message.info(msg);
-}
-
-import directive from "@/components/Directives";
-Vue.use(directive)
-
-// 全局组件挂载
-Vue.component('Pagination', Pagination)
-Vue.component('RightToolbar', RightToolbar)
-Vue.component('DynamicForm', DynamicForm)
-Vue.component('DynamicForms', DynamicForms)
-Vue.component('DynamicFormsteo', DynamicFormsteo)
-Vue.component('MemoranDum', MemoranDum)
-
+Vue.prototype.handleTree = handleTree
+
+Vue.prototype.msgSuccess = function (msg) {
+  this.$message({ showClose: true, message: msg, type: "success" });
+}
+
+Vue.prototype.msgError = function (msg) {
+  this.$message({ showClose: true, message: msg, type: "error" });
+}
+
+Vue.prototype.msgInfo = function (msg) {
+  this.$message.info(msg);
+}
+
+import directive from "@/components/Directives";
+Vue.use(directive)
+
+// 全局组件挂载
+Vue.component('Pagination', Pagination)
+Vue.component('RightToolbar', RightToolbar)
+Vue.component('DynamicForm', DynamicForm)
+Vue.component('DynamicForms', DynamicForms)
+Vue.component('DynamicFormsteo', DynamicFormsteo)
+Vue.component('MemoranDum', MemoranDum)
+
 Vue.use(permission)
-
-/**
- * If you don't want to use mock-server
- * you want to use MockJs for mock api
- * you can execute: mockXHR()
- *
- * Currently MockJs will be used in the production environment,
- * please remove it before going online! ! !
- */
-
-Vue.use(Element, {
-  size: Cookies.get('size') || 'medium' // set element-ui default size
-})
-Vue.use(BurgeonUi);
-Vue.config.productionTip = false
-
-new Vue({
-  el: '#app',
-  router,
-  store,
-  render: h => h(App)
-})
+
+/**
+ * If you don't want to use mock-server
+ * you want to use MockJs for mock api
+ * you can execute: mockXHR()
+ *
+ * Currently MockJs will be used in the production environment,
+ * please remove it before going online! ! !
+ */
+
+Vue.use(Element, {
+  size: Cookies.get('size') || 'medium' // set element-ui default size
+})
+Vue.use(BurgeonUi);
+Vue.config.productionTip = false
+
+new Vue({
+  el: '#app',
+  router,
+  store,
+  render: h => h(App)
+})

+ 9 - 0
ruoyi-ui/src/views/system/editing/index.vue

@@ -184,6 +184,15 @@
     },
     filters: {},
     methods: {
+      iChange(name,val){
+        for(let item of this.queryData.showData){
+          for(let itemChild of item.hrChildren){
+            if(itemChild.columnName == name){
+              itemChild.columnValue = (val?val:null)
+            }
+          }
+        }
+      },
       modelFn(obj, cont) {
         this.$set(this.queryParams,obj,cont)
       },

+ 10 - 1
ruoyi-ui/src/views/system/form/index.vue

@@ -224,6 +224,15 @@
 
     },
     methods: {
+      iChange(name,val){
+        for(let item of this.queryData.showData){
+          for(let itemChild of item.hrChildren){
+            if(itemChild.columnName == name){
+              itemChild.columnValue = (val?val:null)
+            }
+          }
+        }
+      },
       imgBtn(url) {
         this.pir_imgs = url
         this.$refs.BigPicture.hidden.status = true
@@ -606,7 +615,7 @@
              this.msgInfo('基本信息暂未保存')
            }
          }
-         
+
        }else if(index == '修改'){
          if (this.single) {
            this.msgInfo('请勾选一条信息')

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

@@ -17,7 +17,7 @@
       <el-collapse v-model="activeNames" @change="handleChange">
         <el-form :model="queryParams" :rules="queryData.rules" ref="queryForm" :inline="true" :label-width="this.queryData.table_column == 6 ? '70px' :'110px'" >
           <el-collapse-item :title="item.columnComment" :name="index" v-for="(item,index) in queryData.showData" :key="index">
-                <dynamic-forms @iChange="iChange" :queryData="queryData" @modelFn="modelFn" :ref="items.columnName" :config="queryParams" @inputs="changeFn" :formConfig="items" v-for="(items,indexs) in item.hrChildren"
+                <dynamic-formsteo @iChange="iChange" :queryData="queryData" @modelFn="modelFn" :ref="items.columnName" :config="queryParams" @inputs="changeFn" :formConfig="items" v-for="(items,indexs) in item.hrChildren"
                   :key='indexs' />
           </el-collapse-item>
         </el-form>