123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495 |
- <template>
- <div class="tabForm">
- <div class="tabForm_header">
- <div class="table_headerBtun" v-if="queryData.buttonList">
- <el-button type="primary" size="small" plain @click="handleQuery(item)" v-for="(item,index) in queryData.buttonList.split('')" :key="index">{{item | btnConversion}}</el-button>
- </div>
- </div>
- <!-- 内容 -->
- <div class="table_nav">
- <el-collapse v-model="activeNames">
- <el-collapse-item :title="item.columnComment" :name="index" v-for="(item,index) in queryData.showData" :key="index" class="eitde">
- <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="120px">
- <el-row :gutter="0">
- <el-col :span="24" :key="index">
- <dynamic-forms :ref="items.columnName" :config="queryParams" @inputs = "changeFn" :formConfig="items" v-for="(items,indexs) in item.hrChildren" :key='indexs' />
- </el-col>
- </el-row>
- </el-form>
- </el-collapse-item>
- <!-- 列表 -->
- <el-collapse-item :title="title" name="index" class="eitde" v-if="tabShoes">
- <div class="ppl">
- <p v-for="(item,index) in tabldie" :key="index" @click="enditTab(index)">
- <img src="../../../assets/images/icon_tbtab_normal.png" alt="" class="index_headerImg" v-if="numtab !== index">
- <img src="../../../assets/images/icon_tbtab_selected.png" alt="" class="index_headerImg" v-if="numtab == index">
- <span :class="[index == numtab ? 'span' : '']">{{item.tableComment}}</span>
- </p>
- </div>
- <el-divider></el-divider>
- <el-table stripe v-loading="loading" :data="postList.rows" @selection-change="handleSelectionChange">
- <el-table-column :label="item.columnComment" align="center" :prop="item.columnName" v-for="(item,index) in postList.tableHeadList" :key="index" />
- </el-table>
- <div class="index_haderPagin">
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParamslist.pageNo"
- :limit.sync="queryParamslist.pageSize"
- @pagination="foremliseju"
- />
- <!-- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="currentPage3"
- :page-size="queryParamslist.pageSize" layout="prev, pager, next, jumper" v-show="total>0"
- :total="total" @pagination="foremliseju">
- </el-pagination> -->
- </div>
- </el-collapse-item>
- </el-collapse>
- </div>
- </div>
- </template>
- <script>
- import {
- getTableQuery,
- getObject,
- geteditindeTab,
- listIndex,
- delMenutabform,
- tableSubimt, tableSubimtanit, addbjectSave
- } from '@/api/system/form.js'
- export default {
- name: "index",
- data() {
- return {
- num: 0,
- // 总条数
- total: 0,
- loading:true,
- tabList: {},
- currentPage3: 0,
- activeNames: [1],
- title: '列表',
- objParams: {
- table: 'obj_test',
- fixedData: {
- id: -1
- },
- isUi:true
- },
- queryData: {},
- // 查询参数
- queryParams: {
- dictName: undefined,
- dictType: undefined,
- status: undefined
- },
- queryParamslist: {
- pageNo: 1,
- pageSize: 10,
- orderBy:'create_time desc',
- table: '',
- },
- labletit: '查询参数1233',
- surlable: '实际数据库表',
- postList: {},
- numtab: 0,
- tabldie:[],
- tabShoes:false,//tab 显示隐藏
- tableZbietabg:{
- table:'sys_user'
- },
- forme:{
- table:'',
- fixedData:{}
- },
- formeanti:{
- table:'',
- commitData:[],
- },
- formy:{
- id:0,
- status:1
- },
- // 删除参数
- deledlid:{
- table:'',
- idList:[]
- }
- };
- },
- filters:{
- btnConversion(val) {
- switch(val){
- case 'A':
- return '新增';
- case 'M':
- return '修改';
- case 'D':
- return '删除';
- case 'Q':
- return '查询';
- case 'S':
- return '提交';
- case 'U':
- return '反提交';
- case 'I':
- return '导入';
- case 'E':
- return '导出';
- }
- }
- },
- mounted() {
- this.formeanti.table = this.$route.query.tables
- this.forme.table = this.$route.query.tables
- this.forme.objId = this.$route.query.id
- this.formy.id = this.$route.query.id
- this.tableZbietabg.table = this.$route.query.tables
- this.objParams.table = this.$route.query.tables
- this.objParams.fixedData.id = this.$route.query.id
- this.deledlid.table = this.$route.query.tables
- this.deledlid.idList.push(this.$route.query.id)
- this.queryParamslist.table = this.$route.query.tables
- this.init()
- this.edingelsietab()
- },
- methods: {
- handleCurrentChange() {
- },
- handleSizeChange() {
- },
- handleSelectionChange() {
- },
- headerBtn(item) {
- switch(item) {
- case 'A': {
- return
- }
- case 'M': {
- return
- }
- case 'D': {
- return
- }
- case 'Q': {
- return
- }
- case 'S': {
- return
- }
- case 'U': {
- return
- }
- case 'E': {
- return
- }
- }
- },
- init() {
- getObject(this.objParams).then(res => {
- console.log(res)
- let data = res.data
- this.queryData = data
- console.log(this.queryData,567)
- })
- },
- // tab数据
- edingelsietab(){
- console.log(4566)
- geteditindeTab(this.tableZbietabg).then(response => {
- if(response.data.ref.length !==0){
- this.tabldie = response.data.ref
- this.tabShoes = true
- this.foremliseju()
- }else{
- this.tabShoes = false
- }
- // this.msgSuccess("反提交成功");
- // this.open = false;
- // this.getList();
- });
- },
- // 列表数据
- foremliseju(){
- listIndex(this.queryParamslist).then(res => {
- console.log(res)
- let data = res.data
- this.postList = data
- this.loading = false
- this.total = res.data.total - 0
- console.log(this.total)
- console.log(this.postList,567)
- })
- },
- // tab点击
- tabSbu(index) {
- this.num = index
- },
- enditTab(index) {
- this.numtab = index
- this.queryParamslist.table = this.tabldie[index].tableName
- this.foremliseju()
- },
- changeFn(obj) {
- for(let key in obj){
- this.queryParams[key] = obj[key]
- }
- },
- resetQuery() {
- },
- /** 搜索按钮操作 */
- handleQuery(index) {
- console.log(index,4)
- for(let item of this.queryData.showData){
- for(var i = 0 ; i < item.hrChildren.length ; i++){
- if(item.hrChildren[i].htmlType == 'checkbox' || item.hrChildren[i].htmlType == 'imageUpload' || item.hrChildren[i].htmlType == 'fileUpload'){
- this.queryParams[item.hrChildren[i].columnName] = this.$refs[item.hrChildren[i].columnName][0].config
- } else{
- this.queryParams[item.hrChildren[i].columnName] = this.$refs[item.hrChildren[i].columnName][0].config[item.hrChildren[i].columnName]
- }
- }
- }
- this.queryParams.image = JSON.stringify(this.queryParams.image)
- this.queryParams.file = JSON.stringify(this.queryParams.file)
- console.log(this.queryParams)
- if(index == 'D'){
- //删除
- this.handleDelete(this.deledlid)
- }else if(index == 'S'){
- //提交 保存
- // this.formeanti.table = 'obj_test'
- this.formeanti.commitData = []
- this.formy.status = 1
- // this.formy.id = 0
- this.formeanti.commitData.push(this.formy)
- console.log(this.formeanti)
- this.antiSubmission()
- }else if(index == 'U'){
- //反提交 保存
- // this.formeanti.table = 'obj_test'
- this.formeanti.commitData = []
- this.formy.status = 2
- // this.formy.id = 0
- this.formeanti.commitData.push(this.formy)
- console.log(this.formeanti)
- this.antiSubmission()
- }else if(index == 'M'){
- // 修改
- // this.forme.table = 'obj_test'
- // this.forme.objId = 1
- this.forme.fixedData = this.queryParams
- this.submitForm()
- }else if(index == 'A'){
- //新增
- // this.forme.table = 'obj_test'
- // this.forme.objId = -1
- this.forme.fixedData = this.queryParams
- this.submitForm()
- }
- console.log(this.forme)
- // this.getList();
- },
- /** 新增 修改提交按钮 */
- submitForm: function() {
- addbjectSave(this.forme).then(response => {
- this.msgSuccess("保存成功");
- this.open = false;
- this.$router.go(-1)
- // this.getList();
- });
- },
- // 提交反提交
- antiSubmission(){
- if (this.formy.status == 1) {
- // 提交
- tableSubimt(this.formeanti).then(response => {
- this.msgSuccess("提交成功");
- this.$router.go(-1)
- // this.open = false;
- // this.getList();
- });
- } else if(this.formy.status == 2){
- // 反提交
- tableSubimtanit(this.formeanti).then(response => {
- this.msgSuccess("反提交成功");
- this.$router.go(-1)
- // this.open = false;
- // this.getList();
- });
- }
- },
- //删除
- handleDelete(index) {
- this.$confirm('是否确认删除', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return delMenutabform(index);
- }).then(() => {
- // this.getList();
- this.msgSuccess("删除成功");
- this.$router.go(-1)
- })
- }
- },
- };
- </script>
- <style lang="scss">
- .tabForm {
- .el-collapse-item__content {
- padding: 0;
- }
- .table_nav {
- .el-collapse-item__wrap {
- border-bottom: 0;
- }
- .el-collapse-item__header {
- border-bottom: 0;
- font-size: 15px;
- font-family: PingFang SC;
- font-weight: bold;
- color: #3C8DBC;
- line-height: 36px;
- }
- // .el-form-item__content {
- // width: 55%;
- // }
- .el-collapse {
- border-top: 0;
- }
- .el-divider--horizontal {
- margin-top: 0;
- }
- .eitde {
- background-color: #fff;
- border-radius: 6px;
- padding: 23px;
- margin-bottom: 20px;
- }
- }
- }
- </style>
- <style scoped lang="scss">
- .tabForm {
- background-color: #eef0ff;
- height: 100%;
- padding: 20px;
- p {
- margin: 0;
- }
- // 头部
- .tabForm_header {
- background-color: #fff;
- border-radius: 6px;
- padding: 23px;
- margin-bottom: 20px;
- }
- // 内容
- .table_nav {
- // background-color: #fff;
- // border-radius: 6px;
- // padding: 23px;
- .ppl {
- display: flex;
- height: 38px;
- p {
- position: relative;
- width: 113px;
- height: 38px;
- img {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- // z-index: -1;
- }
- span {
- width: 100%;
- position: absolute;
- top: 0;
- left: 0;
- // transform: translate(-50%);
- text-align: center;
- line-height: 38px;
- font-size: 15px;
- font-family: PingFang SC;
- font-weight: bold;
- color: #aaa;
- }
- .span {
- color: #3C8DBC;
- }
- }
- }
- }
- }
- // tab
- .index_headetab {
- display: flex;
- border-bottom: 1px solid #E5E5E5;
- height: 53px;
- // padding-top: 20px;
- padding-bottom: 10px;
- margin-bottom: 20px !important;
- span {
- width: 70px;
- text-align: center;
- line-height: 53px;
- height: 53px;
- font-size: 15px;
- font-family: PingFang SC;
- font-weight: bold;
- color: #666;
- position: relative;
- // flex: 1;
- // border-bottom: ;
- }
- .span {
- content: '';
- display: block;
- width: 18px;
- height: 8px;
- border-radius: 3px;
- background-color: #3C8DBC;
- color: #3C8DBC !important;
- // position: absolute;
- // border-bottom: ;
- }
- .spanto {
- color: #3C8DBC;
- border-bottom: 3px solid #3C8DBC;
- }
- }
- </style>
|