yrik 4 éve
szülő
commit
99a4aabc7d

+ 225 - 0
ruoyi-ui/src/components/DynamicFormsteo/index.vue

@@ -0,0 +1,225 @@
+<template>
+  <!-- <el-row  class="row-bg"> -->
+  <el-col :span="this.formConfig.tableColumnuy !== null? this.formConfig.tableColumnuy : 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"
+      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-select v-model="config[formConfig.columnName]" v-if="formConfig.htmlType == 'select'&&(!formConfig.fkInfo)"
+      filterable :placeholder="'请输入'+formConfig.columnComment" :disabled="formConfig.disabshow">
+      <el-option v-for="itemChild in formConfig.sysDictData" :key="itemChild.dictValue" :label="itemChild.dictLabel"
+        :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]">
+      </el-option>
+    </el-select>
+    <!-- 复选框 -->
+    <el-checkbox-group :disabled="formConfig.disabshow" v-model="config" v-if="formConfig.htmlType == 'checkbox'">
+      <el-checkbox @change="handleCheckedCitiesChange" v-for="itemChild in formConfig.sysDictData" :label="itemChild.dictValue"
+        :key="itemChild.dictLabel">
+        {{itemChild.dictLabel}}
+      </el-checkbox>
+    </el-checkbox-group>
+    <!-- 单选框 -->
+    <el-radio-group :disabled="formConfig.disabshow" v-model="config[formConfig.columnName]" v-if="formConfig.htmlType == 'radio'">
+      <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>
+    <!-- 上传图片 -->
+    <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-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" />
+  </el-form-item>
+  </el-col>
+  <!-- </el-row> -->
+</template>
+
+<script>
+  const defaultSettings = require('@/settings.js')
+  import Editor from '@/components/Editor';
+  import {
+    listIndexfou
+  } from "@/api/tool/gen";
+  import {
+    getToken
+  } from "@/utils/auth";
+  export default {
+    data() {
+      return {
+        fileList: [],
+        defaultSettings,
+        dialogImageUrl: '',
+        process: process.env.VUE_APP_BASE_API,
+        dialogVisible: false,
+        disabled: false,
+        loading: false,
+        filterList: [],
+        config: {},
+        aliemg: {
+          table: '',
+          orderBy: 'create_time desc',
+          pageNo: 1,
+          pageSize: 10,
+          fixedData: {
+            condition: {}
+          }
+        },
+      }
+    },
+    components: {
+      Editor
+    },
+    props: {
+      formConfig: {
+        type: Object,
+        required: true,
+        'default': {
+          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
+     }
+    },
+    mounted() {
+      console.log(this.formConfig)
+    },
+    methods: {
+      listIndexfouFn() {
+        listIndexfou(this.aliemg).then(response => {
+          if (response.data) {
+            this.filterList = response.data.rows
+          }
+          this.loading = false;
+        })
+      },
+      remoteMethod(query) {
+        if (query !== '') {
+          this.loading = true;
+          this.aliemg.fixedData.condition[this.formConfig.fkInfo.dkColumnName] = query
+          this.listIndexfouFn()
+        } else {
+          this.filterList = [];
+        }
+      },
+      upImageFn(res, file) {
+        this.config.push(res.data);
+      },
+      init() {
+        if (this.formConfig.htmlType == 'checkbox' || this.formConfig.htmlType == 'imageUpload' || this.formConfig.htmlType ==
+          'fileUpload') {
+          this.config = []
+        } else {
+          this.$set(this.config, this.formConfig.columnName, (this.formConfig.columnValue || ''))
+        }
+
+        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) {
+        this.fileList = fileList.slice(-3);
+      },
+      getToken() {
+        return getToken()
+      },
+      reseImage(file, fileList) {
+        let urls = ""
+        if (file.response) {
+          urls = file.response.url
+        } else {
+          urls = file.url
+        }
+        for (let i = this.config.length - 1; i >= 0; i--) {
+          if (this.config[i].url == urls) {
+            this.config.splice(i, 1);
+          }
+        }
+      },
+      reseImage1(file, fileList) {
+        let urls = ""
+        if (file.response) {
+          urls = file.response.url
+        } else {
+          urls = file.url
+        }
+        for (let i = this.config.length - 1; i >= 0; i--) {
+          if (this.config[i].url == urls) {
+            this.config.splice(i, 1);
+          }
+        }
+      },
+      handlePictureCardPreview(file) {
+        console.log(file)
+        this.dialogImageUrl = file.url;
+        this.dialogVisible = true;
+      },
+      handleDownload(file) {
+        console.log(file);
+      },
+      handleQuery() {
+        this.$emit('btns')
+      },
+      handleCheckedCitiesChange(value) {
+        console.log(this.config)
+      }
+    }
+  }
+</script>
+
+<style>
+</style>

+ 24 - 23
ruoyi-ui/src/views/system/editing/index.vue

@@ -30,19 +30,19 @@
       </div>
     </div>
     <!-- 内容 -->
-    <div class="eniting_nav table_forem">
+    <div class="eniting_nav">
       <el-collapse v-model="activeNames" @change="handleChange" >
-       <el-form v-show="num == 0" :rules="queryData.rules" :model="queryParams" ref="queryForm" :inline="true" label-width="120px">
-          <el-collapse-item :title="item.columnComment" :name="index" v-for="(item,index) in queryData.showData" :key="index"
-            class="eitde">
-            <el-row>
-              <el-col :span="24" :key="index">
-                <dynamic-formsteo @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>
+       <div class="table_forem">
+         <el-form v-show="num == 0" :rules="queryData.rules" :model="queryParams" ref="queryForm" :inline="true" label-width="120px">
+            <el-collapse-item :title="item.columnComment" :name="index" v-for="(item,index) in queryData.showData" :key="index"
+              class="eitde">
+              <el-row>
+                  <dynamic-formsteo @modelFn="modelFn" :ref="items.columnName" :config="queryParams" @inputs="changeFn" :formConfig="items"
+                    v-for="(items,indexs) in item.hrChildren" :key='indexs' />
+              </el-row>
+            </el-collapse-item>
+          </el-form>
+       </div>
         <div v-show= "num !==0" style="background-color: #fff; padding-bottom: 40px; padding-left: 23px; padding-right: 23px; padding-top: 23px;" >
           <el-table v-loading="loading" :data="postList.rows" @selection-change="handleSelectionChange">
             <el-table-column type="selection" width="55" style="color: red;" align="center" />
@@ -157,7 +157,7 @@
          taheus:'',
          taheusid:0,
          tabName:'',
-         queryParamstwoi:{}
+         queryParamstwoi:{},
       };
     },
     mounted() {
@@ -176,6 +176,7 @@
       this.taheus = this.$route.query.tables
       this.taheusid = this.$route.query.id
       this.deledlid.idList.push(this.$route.query.id)
+
       // tab
       this.edingelsietab()
       this.init()
@@ -520,7 +521,7 @@
         this.multiple = !selection.length
       },
       routerFn(id, tables) {
-        if (this.queryDatatwo.viewType == 'crud') {
+        // if (this.queryDatatwo.viewType == 'crud') {
           this.$router.push({
             path: 'table',
             query: {
@@ -528,15 +529,15 @@
               tables,
             },
           })
-        } else if (this.queryDatatwo.viewType == 'itemTab') {
-          this.$router.push({
-            path: '../form/index.vue',
-            query: {
-              id,
-              tables,
-            },
-          })
-        }
+        // } else if (this.queryDatatwo.viewType == 'itemTab') {
+        //   this.$router.push({
+        //     path: '../form/index.vue',
+        //     query: {
+        //       id,
+        //       tables,
+        //     },
+        //   })
+        // }
       },
      // 搜索
      handleQueryiu(){

+ 65 - 32
ruoyi-ui/src/views/system/form/index.vue

@@ -13,15 +13,17 @@
       </div>
     </div>
     <!-- 内容 -->
-    <div class="table_nav table_forem" >
+    <div class="table_nav " >
       <el-collapse v-model="activeNames">
-         <el-form :model="queryParams" :rules="queryData.rules" ref="queryForm" :inline="true" :label-width="this.queryData.table_column == 6 ? 80 :120">
-        <el-collapse-item :title="item.columnComment" :name="index" v-for="(item,index) in queryData.showData" :key="index" class="eitde">
-            <el-row :gutter="0">
-                  <dynamic-formsteo @modelFn="modelFn" :ref="items.columnName" :config="queryParams" @inputs = "changeFn" :formConfig="items" v-for="(items,indexs) in item.hrChildren" :key='indexs' />
-            </el-row>
-        </el-collapse-item>
-        </el-form>
+         <div class="table_forem">
+           <el-form :model="queryParams"  :rules="queryData.rules" ref="queryForm" :inline="true" :label-width="this.queryData.table_column == 6 ? 80 :120">
+           <el-collapse-item :title="item.columnComment" :name="index" v-for="(item,index) in queryData.showData" :key="index" class="eitde">
+               <el-row :gutter="0">
+                     <dynamic-formsteo @modelFn="modelFn" :ref="items.columnName" :config="queryParams" @inputs = "changeFn" :formConfig="items" v-for="(items,indexs) in item.hrChildren" :key='indexs' />
+               </el-row>
+           </el-collapse-item>
+           </el-form>
+         </div>
         <!-- 列表 -->
         <el-collapse-item :title="title" name="lised"  class="eitde" v-if="tabShoes">
           <div class="ppl">
@@ -164,7 +166,10 @@
         single: true,
         multiple: true,
         tabName:'',
-        oieufr:''
+        oieufr:'',
+        cielsshow:false,
+        foremTtae:'',
+        foremTtaid:-1
       };
     },
     filters:{
@@ -201,6 +206,14 @@
       this.deledlid.table = this.$route.query.tables
       this.deledlid.idList.push(this.$route.query.id)
       this.queryParamslist.table = this.$route.query.tables
+      if(this.$route.query.id == -1){
+        console.log(this.$route.query.id)
+        this.foremTtae = this.$route.query.tables+'_id'
+      }else{
+        let begad = this.$route.query.tables+'_id'
+        this.queryParamslist.fixedData.condition[begad] = this.$route.query.id
+        this.foremTtae = this.$route.query.tables+'_id'
+      }
       // this.objParamstue.fixedData.id = this.$route.query.id
       this.init()
       this.edingelsietab()
@@ -251,23 +264,22 @@
           // 图片的显示隐藏
           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 =>{
                      routers.isonliy = true
-                     if(this.queryData.table_column == undefined){
-                       this.queryData.table_column = null
-                     }
-                     routers.tableColumnuy = this.queryData.table_column
+
                    })
                  }else{
                    route.hrChildren.filter(routers =>{
                      routers.isonliy = false
-                     if(this.queryData.table_column == undefined){
-                       this.queryData.table_column = null
-                     }
-                     routers.tableColumnuy = this.queryData.table_column
                    })
                  }
                }
@@ -421,6 +433,9 @@
            this.forme.fixedData = this.queryParams
            this.submitForm()
          }else if(index == 'A'){
+          //  let query = Object.assign({'id':'630'},{} )
+          // this.$router.push({ query})
+          //  this.reload()
            this.forme.fixedData = this.queryParams
            this.submitForm()
          }
@@ -444,7 +459,9 @@
            this.queryParamstwoi[items] = undefined
          }
        }
+       this.queryParamstwoi[this.foremTtae] = this.oieufr
        this.queryParamslist.fixedData.condition = this.queryParamstwoi
+       // this.queryParamslist.fixedData.condition[this.foremTtae] = this.oieufr
        this.foremliseju()
 
       },
@@ -454,9 +471,21 @@
          if (valid) {
            addbjectSave(this.forme).then(response => {
              this.msgSuccess("保存成功");
-             this.open = false;
-             this.$store.dispatch("tagsView/delView", this.$route);
-             this.$router.go(-1)
+             if(response.code == 200){
+               this.cielsshow = true;
+             }else{
+               this.cielsshow = false;
+             }
+             // this.$store.dispatch("tagsView/delView", this.$route);
+             let query = Object.assign({'id':response.data,'tables': this.forme.table},{} )
+             this.$router.push({ query})
+             this.queryParamslist.fixedData.condition[this.foremTtae] = response.data
+             this.oieufr = response.data
+             this.objParams.fixedData.id = response.data
+             this.init()
+             this.foremliseju()
+             // this.$store.dispatch("tagsView/delView", this.$route);
+             // this.$router.go(-1)
              // this.getList();
            });
          }
@@ -549,7 +578,11 @@
          //删除
          this.handleDeletetwo(this.deledlid)
        }  else if(index == '新增'){
+         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('请勾选一条信息')
@@ -560,7 +593,7 @@
        }
      },
      routerFn(id, tables,tabfe, tabik) {
-       if (this.queryDatatao.viewType == 'crud') {
+       // if (this.queryDatatao.viewType == 'crud') {
          this.$router.push({
            path: 'table',
            query: {
@@ -570,17 +603,17 @@
              tabik
            },
          })
-       } else if (this.queryDatatao.viewType == 'headTab') {
-         this.$router.push({
-           path: 'editing',
-           query: {
-             id,
-             tables,
-             tabfe,
-             tabik
-           },
-         })
-       }
+       // } else if (this.queryDatatao.viewType == 'headTab') {
+       //   this.$router.push({
+       //     path: 'editing',
+       //     query: {
+       //       id,
+       //       tables,
+       //       tabfe,
+       //       tabik
+       //     },
+       //   })
+       // }
      },
 
     },

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

@@ -15,7 +15,7 @@
     <!-- 内容 -->
     <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 ? 80 :120" >
+        <el-form :model="queryParams" :rules="queryData.rules" ref="queryForm" :inline="true" :label-width=" this.queryData.table_column == 6 ? 80 :'120px'" >
           <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" > -->
@@ -90,7 +90,8 @@
         tijeq:0,
         imgShoew:0,
         tablees:-1,
-        juegkae:''
+        juegkae:'',
+        tabdiese:''
       };
     },
     mounted() {
@@ -107,9 +108,13 @@
       this.deledlid.idList.push(this.$route.query.id)
       if(this.$route.query.tabfe){
        this.tablees = this.$route.query.tabfe
-       this.juegkae = this.$route.query.tables + '_id'
-
+       this.juegkae = this.$route.query.tabik + '_id'
+       this.tabdiese = this.$route.query.tabik
        console.log(this.juegkae)
+      }else{
+        this.tablees = undefined
+        this.juegkae = undefined
+        this.tabdiese = this.$route.query.tabik
       }
       console.log(this.forme.fixedData)
       this.init()
@@ -172,7 +177,9 @@
           this.formeanti.commitData.push(this.formy)
           this.antiSubmission()
         } else if (index == '保存') {
-          // 修改
+          // 修改
+
+
           this.forme.fixedData = this.queryParams
           this.forme.fixedData[this.juegkae] =  this.tablees
           this.submitForm()
@@ -257,24 +264,21 @@
          // 图片的显示隐藏
          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 = 34
+             })
             if(route.cssClass !== null){
               this.imgShoew = route.cssClass
               if(route.cssClass == 2 || route.cssClass == 4){
                 route.hrChildren.filter(routers =>{
                   routers.isonliy = true
-                  if(this.queryData.table_column == undefined){
-                    this.queryData.table_column = null
-                  }
-                  routers.tableColumnuy = this.queryData.table_column
                 })
               }else{
                 route.hrChildren.filter(routers =>{
                   routers.isonliy = false
-                  if(this.queryData.table_column == undefined){
-                    this.queryData.table_column = null
-                  }
-                  routers.tableColumnuy = this.queryData.table_column
                 })
               }
             }
@@ -307,7 +311,8 @@
             // }
             addbjectSave(this.forme).then(response => {
               this.msgSuccess("保存成功");
-              // this.open = false;
+              // this.open = false;
+              this.$store.dispatch("tagsView/delView", this.$route);
               this.$router.go(-1)
             });
           }
@@ -320,14 +325,16 @@
             if (this.formy.status == 1) {
               // 提交
               tableSubimt(this.formeanti).then(response => {
-                this.msgSuccess("提交成功");
+                this.msgSuccess("提交成功");
+                this.$store.dispatch("tagsView/delView", this.$route);
                 this.$router.go(-1)
                 // this.getList();
               });
             } else if (this.formy.status == 2) {
               // 反提交
               tableSubimtanit(this.formeanti).then(response => {
-                this.msgSuccess("反提交成功");
+                this.msgSuccess("反提交成功");
+                this.$store.dispatch("tagsView/delView", this.$route);
                 this.$router.go(-1)
                 // this.getList();
               });
@@ -345,7 +352,8 @@
           return delMenutab(index);
         }).then(() => {
           // this.getList();
-          this.msgSuccess("删除成功");
+          this.msgSuccess("删除成功");
+          this.$store.dispatch("tagsView/delView", this.$route);
           this.$router.go(-1)
         })
       }