index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. <template>
  2. <div class="eniting">
  3. <!-- 头部 -->
  4. <div class="eniting_header">
  5. <!-- <p class="p">表编辑</p> -->
  6. <div class="ppl">
  7. <p v-for="(item,index) in tabldie" :key="index" @click="enditTab(index)">
  8. <img src="../../../assets/images/icon_tbtab_normal.png" alt="" class="index_headerImg" v-if="num !== index">
  9. <img src="../../../assets/images/icon_tbtab_selected.png" alt="" class="index_headerImg" v-if="num == index">
  10. <span :class="[index == num ? 'span' : '']">{{item.tableComment}}</span>
  11. </p>
  12. </div>
  13. <el-divider></el-divider>
  14. <div class="table_headerBtun" v-if="queryData.buttonList">
  15. <el-button type="primary" size="small" plain v-for="(item,indexss) in jeigneutwo" :key="keyname + indexss" @click="handleQuery(item)">{{item}}</el-button>
  16. </div>
  17. </div>
  18. <!-- 内容 -->
  19. <div class="eniting_nav">
  20. <el-collapse v-model="activeNames" @change="handleChange">
  21. <el-collapse-item :title="item.columnComment" :name="index" v-for="(item,index) in queryData.showData" :key="index" class="eitde">
  22. <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="120px">
  23. <el-row >
  24. <el-col :span="24" :key="index">
  25. <dynamic-forms :ref="items.columnName" :config="queryParams" @inputs = "changeFn" :formConfig="items" v-for="(items,indexs) in item.hrChildren" :key='indexs' />
  26. </el-col>
  27. </el-row>
  28. </el-form>
  29. </el-collapse-item>
  30. </el-collapse>
  31. </div>
  32. </div>
  33. </template>
  34. <script>
  35. import { getTableQuery, delMenutab, getQueryList, geteditindeTab, tableSubimt, tableSubimtanit, addbjectSave} from '@/api/system/table.js';
  36. // import { getTableQuery, getQueryList,geteditindeTab, tableSubimt, tableSubimtanit, addbjectSave } from '@/src/api/system/editing.js';
  37. export default {
  38. name: "index",
  39. data() {
  40. return {
  41. activeNames: ['1'],
  42. title:'单表1',
  43. // 查询参数
  44. queryParams: {
  45. },
  46. labletit:'查询参数1233',
  47. num:0,
  48. tabledeLise:{
  49. table:'',
  50. isUi:true
  51. },
  52. taleLisst:[] ,//列表数据
  53. // 按钮参数
  54. tableZbie:{
  55. table:'obj_test',
  56. isUi:true,
  57. fixedData:{
  58. id:-1
  59. }
  60. },
  61. tableZbietabg:{
  62. table:'sys_user'
  63. },
  64. queryData: {},
  65. keyname:'nu',
  66. tabldie:[],
  67. forme:{
  68. table:'',
  69. objId:-1,
  70. fixedData:{}
  71. },
  72. formeanti:{
  73. table:'',
  74. commitData:[],
  75. },
  76. formy:{
  77. id:0,
  78. status:1
  79. },
  80. // 删除参数
  81. deledlid:{
  82. table:'',
  83. idList:[]
  84. },
  85. jeigneu:[],
  86. jeigneutwo:[],
  87. };
  88. },
  89. mounted() {
  90. // this.edingelsie()
  91. // button
  92. this.deledlid.idList = []
  93. this.formeanti.table = this.$route.query.tables
  94. // this.formeanti.id = this.$route.query.id
  95. this.forme.table = this.$route.query.tables
  96. this.forme.objId = this.$route.query.id
  97. this.tabledeLise.table = this.$route.query.tables
  98. this.tableZbie.table = this.$route.query.tables
  99. this.tableZbie.fixedData.id = this.$route.query.id
  100. this.formy.id = this.$route.query.id
  101. this.tableZbietabg.table = this.$route.query.tables
  102. this.deledlid.table = this.$route.query.tables
  103. this.deledlid.idList.push(this.$route.query.id)
  104. console.log(this.deledlid)
  105. // tab
  106. this.edingelsietab()
  107. },
  108. filters:{
  109. },
  110. methods: {
  111. handleChange(val) {
  112. console.log(val);
  113. },
  114. enditTab(index){
  115. this.num = index
  116. this.tabledeLise.table = this.tabldie[index].tableName
  117. this.formeanti.table = this.tabldie[index].tableName
  118. this.forme.table = this.tabldie[index].tableName
  119. this.tableZbie.table = this.tabldie[index].tableName
  120. // this.edingelsie()
  121. this.init()
  122. },
  123. // 按钮
  124. init() {
  125. getTableQuery(
  126. this.tableZbie
  127. ).then(res => {
  128. let data = res.data
  129. this.queryData = data
  130. this.jeigneutwo = []
  131. this.jeigneu = []
  132. this.jeigneu = data.buttonList.split('')
  133. console.log(data.buttonList)
  134. console.log(this.jeigneu)
  135. this.jeigneu.filter(route => {
  136. // route.dept_id = route.dept_id.value
  137. console.log(route)
  138. if(route == 'A'){
  139. if(this.formy.id == -1){
  140. route = '保存'
  141. this.jeigneutwo.push(route)
  142. }else{
  143. route = '新增'
  144. }
  145. }else if(route == 'M'){
  146. route = '保存'
  147. if(this.formy.id != -1){
  148. this.jeigneutwo.push(route)
  149. }
  150. }else if(route == 'D'){
  151. route = '删除'
  152. if(this.formy.id != -1){
  153. this.jeigneutwo.push(route)
  154. }
  155. }else if(route == 'Q'){
  156. route = '查询'
  157. }else if(route == 'S'){
  158. route = '提交'
  159. if(this.formy.id != -1){
  160. this.jeigneutwo.push(route)
  161. }
  162. }else if(route == 'U'){
  163. route = '反提交'
  164. if(this.formy.id != -1){
  165. this.jeigneutwo.push(route)
  166. }
  167. }else if(route == 'I'){
  168. route = '导入'
  169. }else if(route == 'E'){
  170. route = '导出'
  171. }
  172. })
  173. this.jeigneutwo.push('刷新')
  174. this.jeigneutwo.push('返回')
  175. console.log(this.queryData,567)
  176. })
  177. },
  178. // 数据信息
  179. edingelsie(){
  180. console.log(1234)
  181. getQueryList(
  182. this.tabledeLise
  183. ).then(res => {
  184. let data = res.data
  185. this.taleLisst = data
  186. // console.log(this.queryData.queryList)
  187. })
  188. },
  189. // tab数据
  190. edingelsietab(){
  191. console.log(4566)
  192. geteditindeTab(this.tableZbietabg).then(response => {
  193. this.tabldie = response.data.ref
  194. if(this.tabldie.length !==0){
  195. this.init()
  196. }else {
  197. this.msgSuccess("暂无数据");
  198. this.$router.go(-1)
  199. }
  200. // this.msgSuccess("反提交成功");
  201. // this.open = false;
  202. // this.getList();
  203. });
  204. },
  205. changeFn(obj) {
  206. for(let key in obj){
  207. this.queryParams[key] = obj[key]
  208. }
  209. },
  210. handleQuery(index) {
  211. console.log(index,4)
  212. for(let item of this.queryData.showData){
  213. for(var i = 0 ; i < item.hrChildren.length ; i++){
  214. if(item.hrChildren[i].htmlType == 'checkbox' || item.hrChildren[i].htmlType == 'imageUpload' || item.hrChildren[i].htmlType == 'fileUpload'){
  215. this.queryParams[item.hrChildren[i].columnName] = this.$refs[item.hrChildren[i].columnName][0].config
  216. console.log(this.$refs[item.hrChildren[i].columnName][0].config)
  217. } else{
  218. this.queryParams[item.hrChildren[i].columnName] = this.$refs[item.hrChildren[i].columnName][0].config[item.hrChildren[i].columnName]
  219. console.log(this.$refs[item.hrChildren[i].columnName][0].config[item.hrChildren[i].columnName])
  220. }
  221. }
  222. }
  223. console.log(this.queryParams)
  224. this.queryParams.image = JSON.stringify(this.queryParams.image)
  225. this.queryParams.file = JSON.stringify(this.queryParams.file)
  226. if(this.queryParams.pageNum !== undefined){
  227. this.queryParams.pageNum = undefined
  228. }
  229. if(this.queryParams.pageSize !== undefined){
  230. this.queryParams.pageSize = undefined
  231. }
  232. if(index == '删除'){
  233. //删除
  234. this.handleDelete(this.deledlid)
  235. }else if(index == '提交'){
  236. //提交 保存
  237. // this.formeanti.table = 'obj_test'
  238. this.formeanti.commitData = []
  239. this.formy.status = 1
  240. // this.formy.id = 0
  241. this.formeanti.commitData.push(this.formy)
  242. console.log(this.formeanti)
  243. this.antiSubmission()
  244. }else if(index == '反提交'){
  245. //反提交 保存
  246. // this.formeanti.table = 'obj_test'
  247. this.formeanti.commitData = []
  248. this.formy.status = 2
  249. // this.formy.id = 0
  250. this.formeanti.commitData.push(this.formy)
  251. console.log(this.formeanti)
  252. this.antiSubmission()
  253. }else if(index == '保存'){
  254. // 修改
  255. // this.forme.table = 'obj_test'
  256. // this.forme.objId = 1
  257. this.forme.fixedData = this.queryParams
  258. this.submitForm()
  259. }else if(index == '返回'){
  260. // if(this.xidugje ==0){
  261. // this.$router.go(-2)
  262. // }else{
  263. this.$router.go(-1)
  264. // }
  265. }else if(index == '刷新'){
  266. // this.xidugje = 1
  267. this.reload()
  268. }
  269. console.log(this.forme)
  270. // this.getList();
  271. },
  272. /** 新增 修改提交按钮 */
  273. submitForm: function() {
  274. addbjectSave(this.forme).then(response => {
  275. this.msgSuccess("保存成功");
  276. this.open = false;
  277. this.$router.go(-1)
  278. // this.getList();
  279. });
  280. },
  281. // 提交反提交
  282. antiSubmission(){
  283. if (this.formy.status == 1) {
  284. // 提交
  285. tableSubimt(this.formeanti).then(response => {
  286. this.msgSuccess("提交成功");
  287. this.$router.go(-1)
  288. // this.open = false;
  289. // this.getList();
  290. });
  291. } else if(this.formy.status == 2){
  292. // 反提交
  293. tableSubimtanit(this.formeanti).then(response => {
  294. this.msgSuccess("反提交成功");
  295. this.$router.go(-1)
  296. // this.open = false;
  297. // this.getList();
  298. });
  299. }
  300. },
  301. //删除
  302. handleDelete(index) {
  303. this.$confirm('是否确认删除', "警告", {
  304. confirmButtonText: "确定",
  305. cancelButtonText: "取消",
  306. type: "warning"
  307. }).then(function() {
  308. return delMenutab(index);
  309. }).then(() => {
  310. // this.getList();
  311. this.msgSuccess("删除成功");
  312. this.$router.go(-1)
  313. })
  314. }
  315. },
  316. };
  317. </script>
  318. <style lang="scss">
  319. .eniting_header{
  320. .el-divider--horizontal{
  321. margin-top: 0;
  322. }
  323. }
  324. .eniting_nav{
  325. // .el-form-item{
  326. // width: 25% !important;
  327. // }
  328. .el-collapse-item__content{
  329. padding-bottom: 0;
  330. }
  331. .el-collapse-item__wrap{
  332. border-bottom: 0;
  333. }
  334. .el-collapse-item__header{
  335. border-bottom: 0;
  336. font-size: 15px;
  337. font-family: PingFang SC;
  338. font-weight: bold;
  339. color: #3C8DBC;
  340. line-height: 36px;
  341. }
  342. // .el-form-item__content{
  343. // width: 65%;
  344. // }
  345. .textarea_et{
  346. width: 95%;
  347. .el-form-item__content{
  348. width: 80%;
  349. height: 83px;
  350. .el-textarea__inner{
  351. height: 100%;
  352. }
  353. }
  354. }
  355. .textarea_etyju{
  356. width: 90%;
  357. .el-form-item__content{
  358. width: 75%;
  359. // height: 83px;
  360. .el-textarea__inner{
  361. // height: 100%;
  362. }
  363. }
  364. }
  365. .textarea_ety{
  366. width: 100%;
  367. .el-form-item__content{
  368. width: 88%;
  369. height: 150px;
  370. margin-bottom: 0;
  371. .el-textarea__inner{
  372. height: 100%;
  373. }
  374. }
  375. }
  376. .el-collapse{
  377. border-top: 0;
  378. }
  379. .eitde{
  380. background-color: #fff;
  381. border-radius: 6px;
  382. padding: 23px;
  383. margin-bottom: 20px;
  384. }
  385. }
  386. </style>
  387. <style scoped lang="scss">
  388. .eniting{
  389. p{
  390. margin: 0;
  391. }
  392. background-color: #eef0ff;
  393. height: 100%;
  394. padding: 20px;
  395. .eniting_header{
  396. background-color: #fff;
  397. border-radius: 6px;
  398. padding: 23px;
  399. margin-bottom: 20px;
  400. .p{
  401. font-size: 15px;
  402. font-weight: bold;
  403. color: #3C8DBC;
  404. line-height: 36px;
  405. margin-bottom: 0;
  406. }
  407. .p::before{
  408. content: "";
  409. display: block;
  410. width: 18px;
  411. height: 8px;
  412. background: #3C8DBC;
  413. border-radius: 3px;
  414. }
  415. .ppl{
  416. display: flex;
  417. height: 54px;
  418. p{
  419. position: relative;
  420. width: 113px;
  421. height: 38px;
  422. img{
  423. position: absolute;
  424. top:0;
  425. left: 0;
  426. width: 100%;
  427. height: 100%;
  428. // z-index: -1;
  429. }
  430. span{
  431. width: 100%;
  432. position: absolute;
  433. top: 0;
  434. left: 0;
  435. // transform: translate(-50%);
  436. text-align: center;
  437. line-height: 38px;
  438. font-size: 15px;
  439. font-family: PingFang SC;
  440. font-weight: bold;
  441. color: #aaa;
  442. }
  443. .span{
  444. color: #3C8DBC;
  445. }
  446. }
  447. }
  448. }
  449. // 内容
  450. .eniting_nav{
  451. // background-color: #fff;
  452. // border-radius: 6px;
  453. // padding: 23px;
  454. }
  455. }
  456. </style>