index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <div class="table_total">
  3. <div class="table_header">
  4. <!-- <p>单表</p>
  5. <el-divider></el-divider> -->
  6. <div class="table_headerBtun" v-if="queryData.buttonList">
  7. <el-button type="primary" plain v-for="(item,index) in queryData.buttonList.split('')" :key="index">{{item | btnConversion}}</el-button>
  8. </div>
  9. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" >
  10. <dynamic-form :ref="item.columnName" :config="queryParams" @inputs = "changeFn" :formConfig="item" v-for="(item,index) in queryData.queryList" :key='index' />
  11. <el-form-item>
  12. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  13. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  14. </el-form-item>
  15. </el-form>
  16. </div>
  17. <!-- 内容 -->
  18. <div class="table_nav">
  19. <!-- <el-collapse v-model="activeNames" @change="handleChange">
  20. <el-collapse-item :title="title" :name="index" v-for="(item,index) in 4" :key="index">
  21. <el-form :model="queryParams" ref="queryForm" :inline="true">
  22. <el-row :gutter="0">
  23. <el-col :span="6" v-for="(item,index) in 12" :key="index">
  24. <el-form-item :label="labletit" prop="dictName">
  25. <el-input v-model="queryParams.dictName" placeholder="请输入字典名称" clearable size="small"
  26. @keyup.enter.native="handleQuery" />
  27. </el-form-item>
  28. </el-col>
  29. </el-row>
  30. </el-form>
  31. </el-collapse-item>
  32. </el-collapse> -->
  33. </div>
  34. </div>
  35. </template>
  36. <script>
  37. import {
  38. getTableQuery
  39. } from '@/api/system/table.js'
  40. export default {
  41. name: "index",
  42. data() {
  43. return {
  44. // 显示搜索条件
  45. showSearch: true,
  46. activeNames: ['1'],
  47. title: '单表1',
  48. queryData: {},
  49. // 查询参数
  50. queryParams: {
  51. pageNum: 1,
  52. pageSize: 10,
  53. },
  54. labletit: '查询参数1233'
  55. };
  56. },
  57. filters:{
  58. btnConversion(val) {
  59. switch(val){
  60. case 'A':
  61. return '新增';
  62. case 'M':
  63. return '修改';
  64. case 'D':
  65. return '删除';
  66. case 'Q':
  67. return '查询';
  68. case 'S':
  69. return '提交';
  70. case 'U':
  71. return '反提交';
  72. case 'I':
  73. return '导入';
  74. case 'E':
  75. return '导出';
  76. }
  77. }
  78. },
  79. mounted() {
  80. this.init()
  81. },
  82. methods: {
  83. changeFn(obj) {
  84. for(let key in obj){
  85. this.queryParams[key] = obj[key]
  86. }
  87. },
  88. resetQuery() {
  89. },
  90. /** 搜索按钮操作 */
  91. handleQuery() {
  92. for(let item of this.queryData.queryList){
  93. if(item.htmlType == 'checkbox'){
  94. this.queryParams[item.columnName] = this.$refs[item.columnName][0].config
  95. }else if(item.htmlType == 'imageUpload'){
  96. console.log(this.$refs[item.columnName][0].config,7777)
  97. } else{
  98. this.queryParams[item.columnName] = this.$refs[item.columnName][0].config[item.columnName]
  99. }
  100. }
  101. console.log(this.queryParams,22311)
  102. this.getList();
  103. },
  104. getList() {
  105. },
  106. init() {
  107. getTableQuery({
  108. table: 'obj_test'
  109. }).then(res => {
  110. let data = res.data
  111. this.queryData = data
  112. // this.queryData.queryList.filter(route => {
  113. // if(route.htmlType == 'checkbox'){
  114. // route.sysDictDatatwo = []
  115. // route.sysDictDatatwo.push(route.columnName)
  116. // console.log(route.sysDictDatatwo,846)
  117. // }
  118. // })
  119. })
  120. },
  121. handleChange(val) {
  122. console.log(val);
  123. }
  124. },
  125. };
  126. </script>
  127. <style lang="scss">
  128. .table_header {
  129. .el-divider--horizontal {
  130. margin-top: 16px;
  131. }
  132. .table_headerBtun{
  133. margin-bottom: 20px;
  134. }
  135. }
  136. .table_nav {
  137. .el-collapse-item__wrap {
  138. border-bottom: 0;
  139. }
  140. .el-collapse-item__header {
  141. border-bottom: 0;
  142. font-size: 15px;
  143. font-family: PingFang SC;
  144. font-weight: bold;
  145. color: #3C8DBC;
  146. line-height: 36px;
  147. }
  148. .el-form-item__content {
  149. width: 55%;
  150. }
  151. .el-collapse {
  152. border-top: 0;
  153. }
  154. }
  155. </style>
  156. <style scoped lang="scss">
  157. .app-main {
  158. // background-color: #eef0ff !important;
  159. }
  160. .table_total {
  161. background-color: #eef0ff;
  162. min-height: calc(100vh - 94px);
  163. padding: 20px;
  164. // 头部
  165. .table_header {
  166. background-color: #fff;
  167. border-radius: 6px;
  168. padding: 23px 23px 0px;
  169. margin-bottom: 20px;
  170. p {
  171. font-size: 15px;
  172. font-weight: bold;
  173. color: #3C8DBC;
  174. line-height: 36px;
  175. }
  176. p::before {
  177. content: "";
  178. display: block;
  179. width: 18px;
  180. height: 8px;
  181. background: #3C8DBC;
  182. border-radius: 3px;
  183. }
  184. }
  185. // 内容
  186. .table_nav {
  187. background-color: #fff;
  188. border-radius: 6px;
  189. padding: 23px;
  190. }
  191. }
  192. p {
  193. margin: 0;
  194. }
  195. </style>