Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	ruoyi-ui/src/main.js
Administrator 4 rokov pred
rodič
commit
64dc79b51d

+ 94 - 53
ruoyi-ui/src/components/DynamicForms/index.vue

@@ -1,11 +1,11 @@
 <template>
   <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">
@@ -13,10 +13,11 @@
         :value="itemChild.dictValue">
       </el-option>
     </el-select>
-    <!-- 下拉框搜索 -->
+    <!-- 下拉框搜索 -->
     <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]">
+      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>
     </el-select>
     <!-- 复选框 -->
@@ -31,27 +32,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>
 </template>
 
@@ -90,45 +92,83 @@
     components: {
       Editor
     },
-    props: {
+    props: {
+      queryData: {
+        type: Object,
+        default: res => {
+          return {
+            showData: []
+          }
+        }
+      },
       formConfig: {
         type: Object,
         required: true,
-        'default': {
-          sysDictData: []
+        default: res => {
+          return {
+            sysDictData: []
+          }
         }
-      },
+      },
       type: {
         type: Number,
         default: 1
       },
     },
     created() {
-      this.config = {}
-      if(this.type){
-        if(this.formConfig.readonly == true){
-          this.formConfig.disabshow = true
-        }else if(this.formConfig.mask.slice(3,4) == '0' || this.formConfig.isonliy == true){
-          this.formConfig.disabshow = true
-        }else{
-          this.formConfig.disabshow = false
-        }
-        if(this.formConfig.fkInfo == null){
-          this.formConfig.fkInfo=false
-        }
-      }
-      this.init()
-    },
-    watch: {
-      'config': {
-         handler: function() {
-             this.$emit('modelFn',this.formConfig.columnName,this.config[this.formConfig.columnName])
-         },
-         deep: true
-     }
+      this.config = {}
+      if (this.type) {
+        if (this.formConfig.readonly == true) {
+          this.formConfig.disabshow = true
+        } else if (this.formConfig.mask.slice(3, 4) == '0' || this.formConfig.isonliy == true) {
+          this.formConfig.disabshow = true
+        } else {
+          this.formConfig.disabshow = false
+        }
+        if (this.formConfig.fkInfo == null) {
+          this.formConfig.fkInfo = false
+        }
+      }
+      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
+      },
+      '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() {},
-    methods: {
+    methods: {
+      iChange(val){
+        if(this.formConfig.isUseExtend){
+          console.log(this.formConfig.columnName)
+          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) {
@@ -154,15 +194,16 @@
           'fileUpload') {
           this.config = []
         } else {
-          this.$set(this.config, this.formConfig.columnName, ((this.formConfig.columnValue?this.formConfig.columnValue:this.formConfig.defaultValue) || ''))
-        }
-
-        if(this.formConfig.fkInfo){
-          this.aliemg.table = this.formConfig.fkInfo.fkTableName
-          if(this.formConfig.fkInfo.value){
-            this.aliemg.fixedData.condition[this.formConfig.fkInfo.dkColumnName] = this.formConfig.fkInfo.value
-          }
-          this.listIndexfouFn()
+          this.$set(this.config, this.formConfig.columnName, ((this.formConfig.columnValue ? this.formConfig.columnValue :
+            this.formConfig.defaultValue) || ''))
+        }
+
+        if (this.formConfig.fkInfo) {
+          this.aliemg.table = this.formConfig.fkInfo.fkTableName
+          if (this.formConfig.fkInfo.value) {
+            this.aliemg.fixedData.condition[this.formConfig.fkInfo.dkColumnName] = this.formConfig.fkInfo.value
+          }
+          this.listIndexfouFn()
         }
       },
       handleChange(file, fileList) {
@@ -197,7 +238,7 @@
           }
         }
       },
-      handlePictureCardPreview(file) {
+      handlePictureCardPreview(file) {
         console.log(file)
         this.dialogImageUrl = file.url;
         this.dialogVisible = true;

+ 11 - 2
ruoyi-ui/src/components/DynamicFormsteo/index.vue

@@ -1,6 +1,6 @@
 <template>
   <!-- <el-row  class="row-bg"> -->
-  <el-col :span="this.formConfig.tableColumnuy !== null? this.formConfig.tableColumnuy : 8 "  >
+  <el-col :span="ieug !== null? ieug : 8 "  >
   <el-form-item   :label="formConfig.columnComment"  :prop="formConfig.columnName">
     <!-- 输入框 -->
     <el-input v-if="formConfig.htmlType == 'input'" v-model="config[formConfig.columnName]" :placeholder="'请输入'+formConfig.columnComment"
@@ -87,7 +87,8 @@
           pageSize: 10,
           fixedData: {
             condition: {}
-          }
+          },
+          ieug:8
         },
       }
     },
@@ -121,6 +122,14 @@
           this.formConfig.fkInfo=false
         }
       }
+      if(this.formConfig.tableColumnuy == null){
+        this.ieug = null
+      }else{
+        this.ieug = 24 / (this.formConfig.tableColumnuy -0)
+      }
+        
+      
+      console.log(this.formConfig.tableColumnuy -0)
       this.init()
     },
     watch: {

+ 2 - 0
ruoyi-ui/src/main.js

@@ -17,6 +17,7 @@ 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'
 
@@ -48,6 +49,7 @@ 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) {

+ 62 - 0
ruoyi-ui/src/utils/currencyFn.js

@@ -0,0 +1,62 @@
+export function getDyn(col, arr, comp) {
+  let str = comp
+  let is = true
+  let type = ''
+
+  for (let item of arr) {
+    for (let itemChild of item.hrChildren) {
+      for (let colItem of col) {
+        if (itemChild.columnValue) {
+          is = false
+        }
+        if (colItem == itemChild.columnName) {
+          if (itemChild.htmlType == "input") {
+            type = 1
+            str = str.replace(itemChild.columnName, itemChild.columnValue)
+          } else if (itemChild.htmlType == "datetime") {
+            type = 2
+            if(getTime(itemChild.columnValue)){
+              str = str.replace(itemChild.columnName, getTime(itemChild.columnValue))
+            }else{
+              is=true
+            }
+          }
+        }
+      }
+    }
+  }
+  if (is) {
+    return
+  }
+  if (type == 2) {
+    return setTime(evals(str))
+  }
+  return evals(str)
+}
+
+function evals(code) {
+  let fun = new Function(`return ${code}`)();
+  return fun
+}
+// 时间戳转成天
+function setTime(val) {
+  return Number(val) / (1000 * 3600 * 24)
+}
+// 转化成时间戳
+function getTime(val) {
+  var date = new Date(val);
+  return date.getTime()
+}
+export function setDyn(col, arr, comp) {
+  let str = comp
+  for (let item of arr) {
+    for (let itemChild of item.hrChildren) {
+      for (let colItem of col) {
+        if (colItem == itemChild.columnName) {
+          str = str.replace(itemChild.columnName, itemChild.columnValue)
+        }
+      }
+    }
+  }
+  return str
+}

+ 6 - 8
ruoyi-ui/src/views/system/editing/index.vue

@@ -262,22 +262,20 @@
           // 图片的显示隐藏
           if(this.queryData.showData.length !==0){
            this.queryData.showData.filter(route => {
+             route.hrChildren.filter(routerst =>{
+               if(this.queryData.table_column == undefined){
+                 this.queryData.table_column = null
+               }
+               routerst.tableColumnuy = this.queryData.table_column
+             })
                if(route.cssClass !== null){
                  this.imgShoew = route.cssClass
                  if(route.cssClass == 2 || route.cssClass == 4 ){
                    route.hrChildren.filter(routers =>{
-                    if(this.queryData.table_column == undefined){
-                      this.queryData.table_column = null
-                    }
-                    routers.tableColumnuy = this.queryData.table_column
                      routers.isonliy = true
                    })
                  }else{
                    route.hrChildren.filter(routers =>{
-                     if(this.queryData.table_column == undefined){
-                       this.queryData.table_column = null
-                     }
-                     routers.tableColumnuy = this.queryData.table_column
                      routers.isonliy = false
                    })
                  }

+ 8 - 4
ruoyi-ui/src/views/system/form/index.vue

@@ -280,7 +280,6 @@
                  if(route.cssClass == 2 || route.cssClass == 4){
                    route.hrChildren.filter(routers =>{
                      routers.isonliy = true
-
                    })
                  }else{
                    route.hrChildren.filter(routers =>{
@@ -598,11 +597,16 @@
          //删除
          this.handleDeletetwo(this.deledlid)
        }  else if(index == '新增'){
-         if(this.cielsshow == true){
-           this.routerFn(-1, this.tabName,this.oieufr,this.forme.table)
+         if(this.objParams.fixedData.id !== -1){
+            this.routerFn(-1, this.tabName,this.oieufr,this.forme.table)
          }else{
-           this.msgInfo('基本信息暂未保存')
+           if(this.cielsshow == true){
+             this.routerFn(-1, this.tabName,this.oieufr,this.forme.table)
+           }else{
+             this.msgInfo('基本信息暂未保存')
+           }
          }
+         
        }else if(index == '修改'){
          if (this.single) {
            this.msgInfo('请勾选一条信息')

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

@@ -14,17 +14,13 @@
     </div>
     <!-- 内容 -->
     <div class="table_nav headertable_nav table_forem" >
-      <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 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">
-            <el-row    class="row-bg" >
-              <!-- <el-col :span="24" :key="index" > -->
-                <DynamicFormsteo @modelFn="modelFn" :ref="items.columnName" :config="queryParams" @inputs="changeFn" :formConfig="items" v-for="(items,indexs) in item.hrChildren"
+                <dynamic-forms @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-col> -->
-            </el-row>
-          </el-collapse-item>
-        </el-form>
+          </el-collapse-item>
+        </el-form>
       </el-collapse>
     </div>
   </div>
@@ -116,11 +112,19 @@
         this.juegkae = undefined
         this.tabdiese = this.$route.query.tabik
       }
-      console.log(this.forme.fixedData)
       this.init()
       // this.tablsie()
     },
-    methods: {
+    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)
       },
@@ -187,14 +191,13 @@
           //新增
           this.xidugje = 0
           this.reload()
-        } else if (index == '返回') {
-            this.$router.go(-1)
+        } else if (index == '返回') {
+          this.$store.dispatch("tagsView/delView", this.$route);
+          this.$router.go(-1)
         } else if (index == '刷新') {
           this.xidugje = 1
           this.reload()
         }
-
-
         // this.getList();
       },
       getList() {
@@ -268,7 +271,7 @@
                if(this.queryData.table_column == undefined){
                  this.queryData.table_column = null
                }
-               routerst.tableColumnuy = 34
+               routerst.tableColumnuy = this.queryData.table_column
              })
             if(route.cssClass !== null){
               this.imgShoew = route.cssClass