yrik 4 년 전
부모
커밋
a5671d5858
3개의 변경된 파일280개의 추가작업 그리고 43개의 파일을 삭제
  1. 7 12
      ruoyi-ui/src/components/DynamicForm/index.vue
  2. 266 27
      ruoyi-ui/src/views/system/editing/index.vue
  3. 7 4
      ruoyi-ui/src/views/system/form/index.vue

+ 7 - 12
ruoyi-ui/src/components/DynamicForm/index.vue

@@ -16,7 +16,7 @@
     <!-- 下拉框搜索 -->
     <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.table_id" :label="itemChild.table_name" :value="itemChild.table_id">
+      <el-option v-for="itemChild in filterList" :key="itemChild.id" :label="itemChild.table_name" :value="itemChild.id">
       </el-option>
     </el-select>
     <!-- 复选框 -->
@@ -97,22 +97,17 @@
         'default': {
           sysDictData: []
         }
+      },
+      type: {
+        type: Number,
+        default: 1
       },
     },
     created() {
       this.config = {}
       // console.log(this.formConfig.mask.slice(3,4),876454)
-      console.log(this.formConfig.fkInfo)
-      if(this.formConfig.readonly == true){
-        this.formConfig.disabshow = true
-      }else if(this.formConfig.mask.slice(3,4) == '0'){
-        this.formConfig.disabshow = true
-      }else{
-        this.formConfig.disabshow = false
-      }
-      if(this.formConfig.fkInfo == null){
-          this.formConfig.fkInfo=false
-      }
+      console.log(this.formConfig)
+     
       this.init()
     },
     watch: {

+ 266 - 27
ruoyi-ui/src/views/system/editing/index.vue

@@ -16,7 +16,15 @@
         </p>
       </div>
       <el-divider></el-divider>
-      <div class="table_headerBtun" v-if="queryData.buttonList">
+      <div class="table_headerBtun table_headerBtuntue" v-if="queryData.buttonList">
+        <el-form v-if="num !== 0" :model="queryParamstwoi" ref="queryForm" :inline="true" >
+          <dynamic-form :ref="item.columnName" :config="queryParamstwoi" @inputs="changeFn" :formConfig="item" v-for="(item,index) in queryDatatwo.queryList"
+            :key='index' />
+          <el-form-item>
+            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQueryiu">搜索</el-button>
+            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+          </el-form-item>
+        </el-form>
         <el-button type="primary" size="small" plain v-for="(item,indexss) in jeigneutwo" :key="keyname + indexss"
           @click="handleQuery(item)">{{item}}</el-button>
       </div>
@@ -24,7 +32,7 @@
     <!-- 内容 -->
     <div class="eniting_nav">
       <el-collapse v-model="activeNames" @change="handleChange">
-        <el-form :rules="queryData.rules" :model="queryParams" ref="queryForm" :inline="true" label-width="120px">
+       <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>
@@ -35,12 +43,38 @@
             </el-row>
           </el-collapse-item>
         </el-form>
+        <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" />
+            <template v-for="(item, index) in postList.tableHeadList">
+              <el-table-column :label="item.columnComment"  align="center" :prop="item.columnName" :key="index" >
+                <template slot-scope="scope">
+                  <img class="img_icon" v-if="item.htmlType=='imageUpload' && scope.row[scope.column.property]" @click="imgBtn(JSON.parse(scope.row[scope.column.property])[0].url)"
+                    :src="JSON.parse(scope.row[scope.column.property])[0].url" alt="">
+                  <!-- :style="scope.row.list_class" scope.row[scope.column.property] -->
+                  <span  :style="scope.row.list_class" v-else-if="item.columnName == 'status' " >{{ scope.row[scope.column.property] }}</span>
+                  <span  v-else>{{ scope.row[scope.column.property] }}</span>
+                </template>
+              </el-table-column>
+            </template>
+          </el-table>
+              <div class="index_haderPagin">
+                <pagination
+                  v-show="total>0"
+                  :total="total"
+                  :page.sync="queryParamslist.pageNo"
+                  :limit.sync="queryParamslist.pageSize"
+                  @pagination="foremliseju"
+                />
+              </div>
+        </div>
       </el-collapse>
     </div>
   </div>
 </template>
 <script>
   import {
+    tableQuery,
     getTableQuery,
     delMenutab,
     getQueryList,
@@ -49,11 +83,18 @@
     tableSubimtanit,
     addbjectSave
   } from '@/api/system/table.js';
+  import {
+    listIndex,
+  } from '@/api/system/form.js'
+
   export default {
     name: "index",
     inject: ['reload'],
     data() {
       return {
+        // 总条数
+         total: 0,
+         loading:true,
         activeNames: [0],
         title: '单表1',
         // 查询参数
@@ -77,6 +118,7 @@
           table: 'sys_user'
         },
         queryData: {},
+        queryDatatwo:{},
         keyname: 'nu',
         tabldie: [],
         forme: {
@@ -99,12 +141,26 @@
         },
         jeigneu: [],
         jeigneutwo: [],
-        imgShoew:1
+        imgShoew:1,
+        queryParamslist: {
+          pageNo: 1,
+          pageSize: 10,
+          orderBy:'create_time desc',
+          table: '',
+          fixedData:{
+            condition:{}
+          }
+        },
+        postList: {},
+         single: true,
+         multiple: true,
+         taheus:'',
+         taheusid:0,
+         tabName:'',
+         queryParamstwoi:{}
       };
     },
     mounted() {
-      // this.edingelsie()
-      // button
       this.deledlid.idList = []
       this.formeanti.table = this.$route.query.tables
       // this.formeanti.id = this.$route.query.id
@@ -116,10 +172,15 @@
       this.formy.id = this.$route.query.id
       this.tableZbietabg.table = this.$route.query.tables
       this.deledlid.table = this.$route.query.tables
+      this.queryParamslist.table = this.$route.query.tables
+      this.taheus = this.$route.query.tables
+      this.taheusid = this.$route.query.id
       this.deledlid.idList.push(this.$route.query.id)
       console.log(this.deledlid)
       // tab
       this.edingelsietab()
+      this.init()
+
     },
     filters: {},
     methods: {
@@ -131,13 +192,26 @@
       },
       enditTab(index) {
         this.num = index
-        this.tabledeLise.table = this.tabldie[index].tableName
-        this.formeanti.table = this.tabldie[index].tableName
-        this.forme.table = this.tabldie[index].tableName
-
-        this.tableZbie.table = this.tabldie[index].tableName
+        console.log(index)
+        if(this.num == 0){
+          console.log(34567)
+          this.tabledeLise.table = this.tabldie[index].tableName
+          this.formeanti.table = this.tabldie[index].tableName
+          this.forme.table = this.tabldie[index].tableName
+          this.tableZbie.table = this.taheus
+          this.tableZbie.fixedData.id = this.taheusid
+          this.init()
+          this.reload()
+        }else{
+          this.tabName = this.tabldie[index].tableName
+          this.queryParamslist.table = this.tabldie[index].tableName
+          this.inittwo()
+          this.foremliseju()
+        }
+        // this.tableZbie.table = this.tabldie[index].tableName
+        // this.tableZbie.fixedData.id = this.tabldie[index].id
         // this.edingelsie()
-        this.init()
+        // this.init()
       },
       // 按钮
       init() {
@@ -202,7 +276,7 @@
            this.queryData.showData.filter(route => {
                if(route.cssClass !== null){
                  this.imgShoew = route.cssClass
-                 if(route.cssClass == 2 || route.cssClass == 4){
+                 if(route.cssClass == 2 || route.cssClass == 4 || route.mask.slice(3,4) == '0'){
                    console.log(34)
                    route.hrChildren.filter(routers =>{
                      routers.isonliy = true
@@ -220,6 +294,60 @@
           }
         })
       },
+      inittwo() {
+        tableQuery({
+          table: this.tabName,
+        }).then(res => {
+          let data = res.data
+          this.queryDatatwo = data
+          this.jeigneutwo = []
+          this.jeigneu = []
+          this.jeigneu = data.buttonList.split('')
+          console.log(data.buttonList)
+          console.log(this.jeigneu)
+          this.jeigneu.filter(route => {
+            // route.dept_id = route.dept_id.value
+            console.log(route)
+            if (route == 'A') {
+                route = '新增'
+                this.jeigneutwo.push(route)
+
+            } else if (route == 'M') {
+              route = '修改'
+              if (this.formy.id != -1) {
+                this.jeigneutwo.push(route)
+              }
+            } else if (route == 'D') {
+              route = '删除'
+              if (this.formy.id != -1) {
+                this.jeigneutwo.push(route)
+              }
+            } else if (route == 'Q') {
+              route = '查询'
+              this.jeigneutwo.push(route)
+            } else if (route == 'S') {
+              route = '提交'
+              if (this.formy.id != -1) {
+                this.jeigneutwo.push(route)
+              }
+            } else if (route == 'U') {
+              route = '反提交'
+              if (this.formy.id != -1) {
+                this.jeigneutwo.push(route)
+              }
+            } else if (route == 'I') {
+              route = '导入'
+              this.jeigneutwo.push(route)
+            } else if (route == 'E') {
+              route = '导出'
+              this.jeigneutwo.push(route)
+            }
+
+          })
+          // this.jeigneutwo.push('刷新')
+          // this.jeigneutwo.push('返回')
+        })
+      },
       // 数据信息
       edingelsie() {
         console.log(1234)
@@ -235,10 +363,12 @@
       edingelsietab() {
         console.log(4566)
         geteditindeTab(this.tableZbietabg).then(response => {
-          this.tabldie = response.data.ref
-          if (this.tabldie.length !== 0) {
-            this.tableZbie.table = this.tabldie[0].tableName
-            this.init()
+          this.tabldie = [{tableComment:'主表数据',tableName:this.taheus}]
+          this.tabldie =this.tabldie.concat(response.data.ref)
+          if (this.tabldie.length !== 1) {
+            // this.tableZbie.table = this.tabldie[0].tableName
+            // this.tableZbie.fixedData.id = this.tabldie[0].id
+            // this.foremliseju()
           } else {
             this.msgSuccess("暂无tab数据");
             this.$router.go(-1)
@@ -248,6 +378,19 @@
           // this.getList();
         });
       },
+      // 列表数据
+      foremliseju(){
+       listIndex(this.queryParamslist).then(res => {
+         console.log(res)
+         let data = res.data
+         this.postList = data
+         this.loading = false
+         this.total = res.data.total - 0
+         console.log(this.total)
+         console.log(this.postList,567)
+
+       })
+      },
       changeFn(obj) {
         for (let key in obj) {
           this.queryParams[key] = obj[key]
@@ -311,6 +454,16 @@
         } else if (index == '刷新') {
           // this.xidugje = 1
           this.reload()
+        }else if(index == '新增'){
+            this.routerFn(-1, this.tabName)
+        }else if(index == '修改'){
+          if (this.single) {
+            this.msgInfo('请勾选一条信息')
+            return
+          }
+          const id = this.ids.join(',')
+          console.log(12346)
+          this.routerFn(id, this.tabName)
         }
 
         console.log(this.forme)
@@ -356,18 +509,95 @@
       },
       //删除
       handleDelete(index) {
-        this.$confirm('是否确认删除', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
-          return delMenutab(index);
-        }).then(() => {
-          // this.getList();
-          this.msgSuccess("删除成功");
-          this.$router.go(-1)
-        })
+        console.log(index)
+        if(this.num == 0){
+          this.$confirm('是否确认删除', "警告", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          }).then(function() {
+            return delMenutab(index);
+          }).then(() => {
+            // this.getList();
+            this.msgSuccess("删除成功");
+            this.$router.go(-1)
+          })
+        }else{
+          if (this.single) {
+            this.msgInfo('请勾选一条信息')
+            return
+          }
+          console.log(this.ids)
+          var that = this
+          index.idList  = this.ids
+          index.table = this.tabName
+         this.$confirm('是否确认删除', "警告", {
+           confirmButtonText: "确定",
+           cancelButtonText: "取消",
+           type: "warning"
+         }).then(function() {
+           return delMenutab(index);
+         }).then(() => {
+           this.foremliseju();
+           this.msgSuccess("删除成功");
+           // this.$router.go(-1)
+         })
+        }
+      },
+      // 多选框选中数据
+      handleSelectionChange(selection) {
+        this.ids = selection.map(item => item.id)
+        console.log(this.ids)
+        this.single = selection.length != 1
+        this.multiple = !selection.length
+      },
+      routerFn(id, tables) {
+        console.log(157)
+        if (this.queryDatatwo.viewType == 'crud') {
+          this.$router.push({
+            path: 'table',
+            query: {
+              id,
+              tables,
+            },
+          })
+        } else if (this.queryDatatwo.viewType == 'itemTab') {
+          this.$router.push({
+            path: '../form/index.vue',
+            query: {
+              id,
+              tables,
+            },
+          })
+        }
+      },
+     // 搜索
+     handleQueryiu(){
+      for(let item of this.queryDatatwo.queryList){
+        // for(var i = 0 ; i < item.hrChildren.length ; i++){
+          if(item.htmlType == 'checkbox'){
+            this.queryParamstwoi[item.columnName] = this.$refs[item.columnName][0].config
+          }else if(item.htmlType == 'imageUpload' || item.htmlType == 'fileUpload'){
+            this.queryParamstwoi[item.columnName] = JSON.stringify(this.$refs[item.columnName][0].config)
+          } else{
+            this.queryParamstwoi[item.columnName] = this.$refs[item.columnName][0].config[item.columnName]
+          }
+        // }
+
       }
+      for(var items in this.queryParamstwoi){
+        if(this.queryParamstwoi[items] == ''){
+          this.queryParamstwoi[items] = undefined
+        }
+      }
+      this.queryParamslist.fixedData.condition = this.queryParamstwoi
+      this.foremliseju()
+       console.log(this.queryParamstwoi)
+     },
+     resetQuery(){
+
+     }
+
     },
   };
 </script>
@@ -378,6 +608,10 @@
     .el-divider--horizontal {
       margin-top: 0;
     }
+   .el-form-item{
+     margin-bottom: 0 !important;
+     margin-right: 10px;
+   }
   }
 
   .eniting_nav {
@@ -459,6 +693,11 @@
 </style>
 
 <style scoped lang="scss">
+  .table_headerBtuntue{
+    display: flex;
+    height: 30px;
+    align-items: center;
+  }
   .eniting {
     p {
       margin: 0;

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

@@ -45,10 +45,13 @@
           <el-table stripe v-loading="loading" :data="postList.rows" @selection-change="handleSelectionChange">
             <template v-for="(item, index) in postList.tableHeadList">
               <el-table-column :label="item.columnComment" align="center" :prop="item.columnName" :key="index">
-                <template slot-scope="scope">
-                  <img class="img_icon" v-if="item.htmlType=='imageUpload'&& scope.row[scope.column.property]" @click="imgBtn(JSON.parse(scope.row[scope.column.property])[0].url)" :src="JSON.parse(scope.row[scope.column.property])[0].url" alt="">
-                  <span v-else>{{ scope.row[scope.column.property] }}</span>
-                </template>
+               <template slot-scope="scope">
+                 <img class="img_icon" v-if="item.htmlType=='imageUpload' && scope.row[scope.column.property]" @click="imgBtn(JSON.parse(scope.row[scope.column.property])[0].url)"
+                   :src="JSON.parse(scope.row[scope.column.property])[0].url" alt="">
+                 <!-- :style="scope.row.list_class" scope.row[scope.column.property] -->
+                 <span  :style="scope.row.list_class" v-else-if="item.columnName == 'status' " >{{ scope.row[scope.column.property] }}</span>
+                 <span  v-else>{{ scope.row[scope.column.property] }}</span>
+               </template>
               </el-table-column>
             </template>
             <!-- <el-table-column :label="item.columnComment" align="center" :prop="item.columnName" v-for="(item,index) in postList.tableHeadList" :key="index" /> -->