index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  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" size="small" plain v-for="(item,index) in jeigneutwo" :key="index" @click="handleQuery(item)">{{item }}</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 queryData.showData" :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. tableSubimt,
  31. tableSubimtanit,
  32. addbjectSave,
  33. delMenutab
  34. } from '@/api/system/table.js'
  35. export default {
  36. name: "index",
  37. data() {
  38. return {
  39. // 显示搜索条件
  40. showSearch: true,
  41. activeNames: [0],
  42. title: '单表1',
  43. tabledeLise:{
  44. table:'',
  45. isUi:true
  46. },
  47. queryData: {},
  48. // 查询参数
  49. queryParams: {
  50. },
  51. labletit: '查询参数1233',
  52. tableZbie:{
  53. table:'',
  54. isUi:true,
  55. fixedData:{
  56. id:-1
  57. }
  58. },
  59. taleLisst:[],
  60. forme:{
  61. table:'',
  62. objId:-1,
  63. fixedData:{}
  64. },
  65. formeanti:{
  66. table:'',
  67. commitData:[],
  68. },
  69. formy:{
  70. id:0,
  71. status:1
  72. },
  73. // 删除参数
  74. deledlid:{
  75. table:'',
  76. idList:[]
  77. },
  78. jeigneu:[],
  79. jeigneutwo:[]
  80. };
  81. },
  82. filters:{
  83. btnConversion(val) {
  84. switch(val){
  85. case 'A':
  86. return '保存';
  87. case 'M':
  88. return '保存';
  89. case 'D':
  90. return '删除';
  91. case 'Q':
  92. return '查询';
  93. case 'S':
  94. return '提交';
  95. case 'U':
  96. return '反提交';
  97. case 'I':
  98. return '导入';
  99. case 'E':
  100. return '导出';
  101. }
  102. }
  103. },
  104. mounted() {
  105. // this.tableZbie.fixedData.id = 0
  106. this.deledlid.idList = []
  107. this.formeanti.table = this.$route.query.tables
  108. // this.formeanti.id = this.$route.query.id
  109. this.forme.table = this.$route.query.tables
  110. this.forme.objId = this.$route.query.id
  111. this.tableZbie.table = this.$route.query.tables
  112. this.tableZbie.fixedData.id = this.$route.query.id
  113. this.formy.id = this.$route.query.id
  114. this.deledlid.table = this.$route.query.tables
  115. this.deledlid.idList.push(this.$route.query.tables)
  116. console.log(this.$route.query.id)
  117. console.log(this.tableZbie.table)
  118. this.init()
  119. // this.tablsie()
  120. },
  121. methods: {
  122. changeFn(obj) {
  123. for(let key in obj){
  124. this.queryParams[key] = obj[key]
  125. }
  126. },
  127. resetQuery() {
  128. },
  129. /** 搜索按钮操作 */
  130. handleQuery(index) {
  131. console.log(index,4)
  132. for(let item of this.queryData.showData){
  133. for(var i = 0 ; i < item.hrChildren.length ; i++){
  134. if(item.hrChildren[i].htmlType == 'checkbox' || item.hrChildren[i].htmlType == 'imageUpload' || item.hrChildren[i].htmlType == 'fileUpload'){
  135. this.queryParams[item.hrChildren[i].columnName] = this.$refs[item.hrChildren[i].columnName][0].config
  136. } else{
  137. this.queryParams[item.hrChildren[i].columnName] = this.$refs[item.hrChildren[i].columnName][0].config[item.hrChildren[i].columnName]
  138. }
  139. }
  140. }
  141. this.queryParams.image = JSON.stringify(this.queryParams.image)
  142. this.queryParams.file = JSON.stringify(this.queryParams.file)
  143. console.log(this.queryParams)
  144. if(this.queryParams.pageNum !== undefined){
  145. this.queryParams.pageNum = undefined
  146. }
  147. if(this.queryParams.pageSize !== undefined){
  148. this.queryParams.pageSize = undefined
  149. }
  150. if(index == '删除'){
  151. //删除
  152. console.log(this.formy.id)
  153. this.handleDelete(this.deledlid)
  154. }else if(index == '提交'){
  155. //提交 保存
  156. this.formeanti.commitData = []
  157. this.formy.status = 1
  158. this.formeanti.commitData.push(this.formy)
  159. console.log(this.formeanti)
  160. this.antiSubmission()
  161. }else if(index == '反提交'){
  162. //反提交 保存
  163. this.formeanti.commitData = []
  164. this.formy.status = 2
  165. this.formeanti.commitData.push(this.formy)
  166. console.log(this.formeanti)
  167. this.antiSubmission()
  168. }else if(index == '保存'){
  169. // 修改
  170. this.forme.fixedData = this.queryParams
  171. this.submitForm()
  172. }else if(index == '新增'){
  173. //新增
  174. this.$router.push({
  175. path: '/business/table',
  176. query: {id:-1,tables:this.forme.table},
  177. })
  178. this.$router.go(0)
  179. }else if(index == '返回'){
  180. this.$router.go(-1)
  181. }else if(index == '刷新'){
  182. this.$router.go(0)
  183. }
  184. console.log(this.forme)
  185. // this.getList();
  186. },
  187. getList() {
  188. },
  189. init() {
  190. getTableQuery(
  191. this.tableZbie
  192. ).then(res => {
  193. let data = res.data
  194. this.queryData = data
  195. this.jeigneutwo = []
  196. this.queryData.jeigneu = data.buttonList.split('')
  197. console.log(this.queryData.jeigneu)
  198. this.queryData.jeigneu.filter(route => {
  199. // route.dept_id = route.dept_id.value
  200. console.log(route)
  201. if(route == 'A'){
  202. if(this.formy.id == -1){
  203. route = '保存'
  204. }else{
  205. route = '新增'
  206. }
  207. this.jeigneutwo.push(route)
  208. }else if(route == 'M'){
  209. route = '保存'
  210. if(this.formy.id != -1){
  211. this.jeigneutwo.push(route)
  212. }
  213. }else if(route == 'D'){
  214. route = '删除'
  215. if(this.formy.id != -1){
  216. this.jeigneutwo.push(route)
  217. }
  218. }else if(route == 'Q'){
  219. route = '查询'
  220. }else if(route == 'S'){
  221. route = '提交'
  222. if(this.formy.id != -1){
  223. this.jeigneutwo.push(route)
  224. }
  225. }else if(route == 'U'){
  226. route = '反提交'
  227. if(this.formy.id != -1){
  228. this.jeigneutwo.push(route)
  229. }
  230. }else if(route == 'I'){
  231. route = '导入'
  232. }else if(route == 'E'){
  233. route = '导出'
  234. }
  235. })
  236. this.jeigneutwo.push('刷新')
  237. this.jeigneutwo.push('返回')
  238. console.log(this.jeigneutwo,567)
  239. })
  240. },
  241. tablsie(){
  242. console.log(1234)
  243. getQueryList(
  244. this.tabledeLise
  245. ).then(res => {
  246. let data = res.data
  247. this.taleLisst = data
  248. // console.log(this.queryData.queryList)
  249. })
  250. },
  251. handleChange(val) {
  252. console.log(val);
  253. },
  254. // 按钮点击
  255. delet(index){
  256. console.log(index)
  257. if(index == 'D'){
  258. this.handleDelete(this.formy.id)
  259. }
  260. },
  261. /** 新增 修改提交按钮 */
  262. submitForm: function() {
  263. addbjectSave(this.forme).then(response => {
  264. this.msgSuccess("保存成功");
  265. this.open = false;
  266. this.$router.go(-1)
  267. // this.getList();
  268. });
  269. },
  270. // 提交反提交
  271. antiSubmission(){
  272. if (this.formy.status == 1) {
  273. // 提交
  274. tableSubimt(this.formeanti).then(response => {
  275. this.msgSuccess("提交成功");
  276. this.$router.go(-1)
  277. // this.open = false;
  278. // this.getList();
  279. });
  280. } else if(this.formy.status == 2){
  281. // 反提交
  282. tableSubimtanit(this.formeanti).then(response => {
  283. this.msgSuccess("反提交成功");
  284. this.$router.go(-1)
  285. // this.open = false;
  286. // this.getList();
  287. });
  288. }
  289. },
  290. //删除
  291. handleDelete(index) {
  292. this.$confirm('是否确认删除', "警告", {
  293. confirmButtonText: "确定",
  294. cancelButtonText: "取消",
  295. type: "warning"
  296. }).then(function() {
  297. return delMenutab(index);
  298. }).then(() => {
  299. // this.getList();
  300. this.msgSuccess("删除成功");
  301. this.$router.go(-1)
  302. })
  303. }
  304. },
  305. };
  306. </script>
  307. <style lang="scss">
  308. .table_header{
  309. .el-divider--horizontal{
  310. margin-top: 16px;
  311. }
  312. }
  313. .headertable_nav{
  314. .el-collapse-item__wrap{
  315. border-bottom: 0;
  316. }
  317. .el-collapse-item__header{
  318. border-bottom: 0;
  319. font-size: 15px;
  320. font-family: PingFang SC;
  321. font-weight: bold;
  322. color: #3C8DBC;
  323. line-height: 36px;
  324. }
  325. // .el-form-item__content{
  326. // width: 55%;
  327. // }
  328. .el-collapse{
  329. border-top: 0;
  330. }
  331. }
  332. </style>
  333. <style scoped lang="scss">
  334. .app-main{
  335. // background-color: #eef0ff !important;
  336. }
  337. .table_total{
  338. background-color: #eef0ff;
  339. height: 100%;
  340. padding: 20px;
  341. // 头部
  342. .table_header{
  343. background-color: #fff;
  344. border-radius: 6px;
  345. padding: 23px;
  346. margin-bottom: 20px;
  347. p{
  348. font-size: 15px;
  349. font-weight: bold;
  350. color: #3C8DBC;
  351. line-height: 36px;
  352. }
  353. p::before{
  354. content: "";
  355. display: block;
  356. width: 18px;
  357. height: 8px;
  358. background: #3C8DBC;
  359. border-radius: 3px;
  360. }
  361. }
  362. // 内容
  363. .headertable_nav{
  364. background-color: #fff;
  365. border-radius: 6px;
  366. padding: 23px;
  367. }
  368. }
  369. p{
  370. margin: 0;
  371. }
  372. </style>