index.vue 13 KB

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