index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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" @click="handleQuery(item)">{{item | btnConversion}}</el-button>
  8. </div>
  9. </div>
  10. <!-- 内容 -->
  11. <div class="table_nav headertable_nav">
  12. <el-collapse v-model="activeNames" @change="handleChange">
  13. <el-collapse-item :title="item.columnComment" :name="index" v-for="(item,index) in taleLisst" :key="index">
  14. <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="120px">
  15. <el-row :gutter="0">
  16. <el-col :span="24" :key="index">
  17. <dynamic-forms :ref="items.columnName" :config="queryParams" @inputs = "changeFn" :formConfig="items" v-for="(items,indexs) in item.hrChildren" :key='indexs' />
  18. </el-col>
  19. </el-row>
  20. </el-form>
  21. </el-collapse-item>
  22. </el-collapse>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. import {
  28. getTableQuery,
  29. getQueryList
  30. } from '@/api/system/table.js'
  31. export default {
  32. name: "index",
  33. data() {
  34. return {
  35. // 显示搜索条件
  36. showSearch: true,
  37. activeNames: ['1'],
  38. title: '单表1',
  39. tabledeLise:{
  40. table:'obj_test',
  41. isUi:true
  42. },
  43. queryData: {},
  44. // 查询参数
  45. queryParams: {
  46. },
  47. labletit: '查询参数1233',
  48. tableZbie:{
  49. table:'obj_test'
  50. },
  51. taleLisst:[],
  52. forme:{
  53. table:'',
  54. objId:-1,
  55. fixedData:{}
  56. },
  57. };
  58. },
  59. filters:{
  60. btnConversion(val) {
  61. switch(val){
  62. case 'A':
  63. return '新增';
  64. case 'M':
  65. return '修改';
  66. case 'D':
  67. return '删除';
  68. case 'Q':
  69. return '查询';
  70. case 'S':
  71. return '提交';
  72. case 'U':
  73. return '反提交';
  74. case 'I':
  75. return '导入';
  76. case 'E':
  77. return '导出';
  78. }
  79. }
  80. },
  81. mounted() {
  82. this.init()
  83. this.tablsie()
  84. },
  85. methods: {
  86. changeFn(obj) {
  87. for(let key in obj){
  88. this.queryParams[key] = obj[key]
  89. }
  90. },
  91. resetQuery() {
  92. },
  93. /** 搜索按钮操作 */
  94. handleQuery(index) {
  95. console.log(index,4)
  96. for(let item of this.taleLisst){
  97. for(var i = 0 ; i < item.hrChildren.length ; i++){
  98. if(item.hrChildren[i].htmlType == 'checkbox' || item.hrChildren[i].htmlType == 'imageUpload' || item.hrChildren[i].htmlType == 'fileUpload'){
  99. this.queryParams[item.hrChildren[i].columnName] = this.$refs[item.hrChildren[i].columnName][0].config
  100. } else{
  101. this.queryParams[item.hrChildren[i].columnName] = this.$refs[item.hrChildren[i].columnName][0].config[item.hrChildren[i].columnName]
  102. }
  103. }
  104. }
  105. if(index == 'D'){
  106. //删除
  107. this.handleDelete(index)
  108. }else if(index == 'S' || index == 'A'){
  109. //提交 保存
  110. this.forme.table = 'obj_test'
  111. this.forme.objId = -1
  112. this.forme.fixedData = this.queryParams
  113. // this.submitForm()
  114. }else if(index == 'M'){
  115. this.forme.table = 'obj_test'
  116. this.forme.objId = 1
  117. this.forme.fixedData = this.queryParams
  118. this.submitForm()
  119. }
  120. console.log(this.forme)
  121. // this.getList();
  122. },
  123. getList() {
  124. },
  125. init() {
  126. getTableQuery(
  127. this.tableZbie
  128. ).then(res => {
  129. let data = res.data
  130. this.queryData = data
  131. console.log(this.queryData,567)
  132. })
  133. },
  134. tablsie(){
  135. console.log(1234)
  136. getQueryList(
  137. this.tabledeLise
  138. ).then(res => {
  139. let data = res.data
  140. this.taleLisst = data
  141. // console.log(this.queryData.queryList)
  142. })
  143. },
  144. handleChange(val) {
  145. console.log(val);
  146. },
  147. // 按钮点击
  148. delet(index){
  149. console.log(index)
  150. if(index == 'D'){
  151. this.handleDelete(index)
  152. }
  153. },
  154. /** 提交按钮 */
  155. submitForm: function() {
  156. // this.$refs["form"].validate(valid => {
  157. // if (valid) {
  158. if (this.forme.objId != -1) {
  159. updateType(this.forme).then(response => {
  160. this.msgSuccess("修改成功");
  161. this.open = false;
  162. // this.getList();
  163. });
  164. } else {
  165. addType(this.forme).then(response => {
  166. this.msgSuccess("新增成功");
  167. this.open = false;
  168. // this.getList();
  169. });
  170. }
  171. // }
  172. // });
  173. },
  174. //删除
  175. handleDelete(row) {
  176. this.$confirm('是否确认删除名称为"' + row + '"的数据项?', "警告", {
  177. confirmButtonText: "确定",
  178. cancelButtonText: "取消",
  179. type: "warning"
  180. }).then(function() {
  181. // return delMenu(row.id);
  182. }).then(() => {
  183. // this.getList();
  184. this.msgSuccess("删除成功");
  185. })
  186. }
  187. },
  188. };
  189. </script>
  190. <style lang="scss">
  191. .table_header{
  192. .el-divider--horizontal{
  193. margin-top: 16px;
  194. }
  195. }
  196. .headertable_nav{
  197. .el-collapse-item__wrap{
  198. border-bottom: 0;
  199. }
  200. .el-collapse-item__header{
  201. border-bottom: 0;
  202. font-size: 15px;
  203. font-family: PingFang SC;
  204. font-weight: bold;
  205. color: #3C8DBC;
  206. line-height: 36px;
  207. }
  208. // .el-form-item__content{
  209. // width: 55%;
  210. // }
  211. .el-collapse{
  212. border-top: 0;
  213. }
  214. }
  215. </style>
  216. <style scoped lang="scss">
  217. .app-main{
  218. // background-color: #eef0ff !important;
  219. }
  220. .table_total{
  221. background-color: #eef0ff;
  222. height: 100%;
  223. padding: 20px;
  224. // 头部
  225. .table_header{
  226. background-color: #fff;
  227. border-radius: 6px;
  228. padding: 23px;
  229. margin-bottom: 20px;
  230. p{
  231. font-size: 15px;
  232. font-weight: bold;
  233. color: #3C8DBC;
  234. line-height: 36px;
  235. }
  236. p::before{
  237. content: "";
  238. display: block;
  239. width: 18px;
  240. height: 8px;
  241. background: #3C8DBC;
  242. border-radius: 3px;
  243. }
  244. }
  245. // 内容
  246. .headertable_nav{
  247. background-color: #fff;
  248. border-radius: 6px;
  249. padding: 23px;
  250. }
  251. }
  252. p{
  253. margin: 0;
  254. }
  255. </style>