no message
							parent
							
								
									e8b73916c9
								
							
						
					
					
						commit
						e0fd0fcdd5
					
				| 
						 | 
					@ -2,6 +2,6 @@ ENV = 'production'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
 | 
					# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
 | 
				
			||||||
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
 | 
					# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
 | 
				
			||||||
VUE_APP_BASE_API  = 'http://localhost:8010'
 | 
					VUE_APP_BASE_API  = 'http://115.159.67.99:8010'
 | 
				
			||||||
# 如果接口是 http 形式, wss 需要改为 ws
 | 
					# 如果接口是 http 形式, wss 需要改为 ws
 | 
				
			||||||
VUE_APP_WS_API = 'wss://localhost:8010'
 | 
					VUE_APP_WS_API = 'wss://115.159.67.99:8010'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -130,21 +130,15 @@ export default {
 | 
				
			||||||
  props: {
 | 
					  props: {
 | 
				
			||||||
    permission: {
 | 
					    permission: {
 | 
				
			||||||
      type: Object,
 | 
					      type: Object,
 | 
				
			||||||
      default: () => {
 | 
					      default: () => { return {} }
 | 
				
			||||||
        return {}
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    ignoreColumns: {
 | 
					    ignoreColumns: {
 | 
				
			||||||
      type: Array,
 | 
					      type: Array,
 | 
				
			||||||
      default: () => {
 | 
					      default: () => { return [] }
 | 
				
			||||||
        return []
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    tableKey: {
 | 
					    tableKey: {
 | 
				
			||||||
      type: String,
 | 
					      type: String,
 | 
				
			||||||
      default: () => {
 | 
					      default: () => { return '' }
 | 
				
			||||||
        return ''
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  data() {
 | 
					  data() {
 | 
				
			||||||
| 
						 | 
					@ -178,45 +172,62 @@ export default {
 | 
				
			||||||
  mounted() {
 | 
					  mounted() {
 | 
				
			||||||
    //初始化数据
 | 
					    //初始化数据
 | 
				
			||||||
    this.columnDrop();
 | 
					    this.columnDrop();
 | 
				
			||||||
    this.hiddenColumns = JSON.parse(sessionStorage.getItem(this.tableKey));
 | 
					 | 
				
			||||||
    setTimeout(() => {
 | 
					    setTimeout(() => {
 | 
				
			||||||
      // 方法区
 | 
					      // 方法区
 | 
				
			||||||
      this.initcolumn();
 | 
					      this.initcolumn();
 | 
				
			||||||
    }, 600)
 | 
					    }, 200)
 | 
				
			||||||
    setTimeout(() => {
 | 
					
 | 
				
			||||||
      // 方法区
 | 
					 | 
				
			||||||
      this.showcolumn();
 | 
					 | 
				
			||||||
    }, 1000)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  methods: {
 | 
					  methods: {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    initcolumn() {
 | 
					    initcolumn() {
 | 
				
			||||||
      this.updateTableColumns()
 | 
					      this.updateTableColumns()
 | 
				
			||||||
 | 
					      const strHidden=sessionStorage.getItem(this.tableKey)
 | 
				
			||||||
 | 
					      this.hiddenColumns= JSON.parse(strHidden);
 | 
				
			||||||
 | 
					      if(this.hiddenColumns.length>0){
 | 
				
			||||||
 | 
					        console.log("------移除---------------")
 | 
				
			||||||
        const table = this.crud.props.table
 | 
					        const table = this.crud.props.table
 | 
				
			||||||
        this.table_configs_xs.forEach((column,index) => {
 | 
					        this.table_configs_xs.forEach((column,index) => {
 | 
				
			||||||
          const vm = table.$children.find(e => e.label === column.label)
 | 
					          const vm = table.$children.find(e => e.label === column.label)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          const columnConfig = vm.columnConfig
 | 
					          const columnConfig = vm.columnConfig
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          console.log(columnConfig)
 | 
				
			||||||
          vm.owner.store.commit('removeColumn', columnConfig, null)
 | 
					          vm.owner.store.commit('removeColumn', columnConfig, null)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
        this.ignoreNextTableColumnsChange = false
 | 
					        this.ignoreNextTableColumnsChange = false
 | 
				
			||||||
 | 
					        console.log("--------移除完成-------------")
 | 
				
			||||||
 | 
					        setTimeout(() => {
 | 
				
			||||||
 | 
					          // 方法区
 | 
				
			||||||
 | 
					          this.showcolumn();
 | 
				
			||||||
 | 
					        }, 200)
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      //vm.owner.store.commit('insertColumn', columnConfig, newIndex+myindex + 1 , null)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    showcolumn() {
 | 
					    showcolumn() {
 | 
				
			||||||
 | 
					      console.log("------显示列------")
 | 
				
			||||||
 | 
					      const strHidden=sessionStorage.getItem(this.tableKey)
 | 
				
			||||||
 | 
					      this.hiddenColumns= JSON.parse(strHidden);
 | 
				
			||||||
      const table = this.crud.props.table
 | 
					      const table = this.crud.props.table
 | 
				
			||||||
      if(this.hiddenColumns!== undefined && this.hiddenColumns!=null){
 | 
					 | 
				
			||||||
      this.hiddenColumns.forEach((column,index) => {
 | 
					      this.hiddenColumns.forEach((column,index) => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const vm = table.$children.find(e => e.prop === column.property)
 | 
					        const vm = table.$children.find(e => e.prop === column.property)
 | 
				
			||||||
        const columnConfig = vm.columnConfig
 | 
					        const columnConfig = vm.columnConfig
 | 
				
			||||||
 | 
					        console.log(columnConfig.label)
 | 
				
			||||||
        if(column.visible){
 | 
					        if(column.visible){
 | 
				
			||||||
          columnConfig.width=column.width
 | 
					          columnConfig.width=column.width
 | 
				
			||||||
          columnConfig.visible=column.visible
 | 
					          columnConfig.visible=column.visible
 | 
				
			||||||
          vm.owner.store.commit('insertColumn', columnConfig, index+1  , null)
 | 
					          vm.owner.store.commit('insertColumn', columnConfig, index+1  , null)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
 | 
					      console.log("------显示列完成------")
 | 
				
			||||||
      this. updateTableColumns();
 | 
					      this. updateTableColumns();
 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    //列拖拽
 | 
					    //列拖拽
 | 
				
			||||||
    columnDrop() {
 | 
					    columnDrop() {
 | 
				
			||||||
| 
						 | 
					@ -263,6 +274,8 @@ export default {
 | 
				
			||||||
      let item= this.tableColumns[oldIndex1]
 | 
					      let item= this.tableColumns[oldIndex1]
 | 
				
			||||||
      const vm = table.$children.find(e => e.prop === item.property)
 | 
					      const vm = table.$children.find(e => e.prop === item.property)
 | 
				
			||||||
      const columnConfig = vm.columnConfig
 | 
					      const columnConfig = vm.columnConfig
 | 
				
			||||||
 | 
					      /*this.tableColumns.splice(oldIndex1-1, 1)
 | 
				
			||||||
 | 
					      this.tableColumns.splice(myindex-1, 0, item)*/
 | 
				
			||||||
      if(oldIndex1 <newIndex){ // 从左至右拖动
 | 
					      if(oldIndex1 <newIndex){ // 从左至右拖动
 | 
				
			||||||
        vm.owner.store.commit('insertColumn', columnConfig, newIndex+myindex  , null)
 | 
					        vm.owner.store.commit('insertColumn', columnConfig, newIndex+myindex  , null)
 | 
				
			||||||
        vm.owner.store.commit('removeColumn', columnConfig, null)
 | 
					        vm.owner.store.commit('removeColumn', columnConfig, null)
 | 
				
			||||||
| 
						 | 
					@ -292,6 +305,7 @@ export default {
 | 
				
			||||||
      const fullTableColumns = table.$children.map(e => e.columnConfig).filter(columnFilter)
 | 
					      const fullTableColumns = table.$children.map(e => e.columnConfig).filter(columnFilter)
 | 
				
			||||||
      cols = sortWithRef(fullTableColumns, refCols)
 | 
					      cols = sortWithRef(fullTableColumns, refCols)
 | 
				
			||||||
      cols.forEach(config => {
 | 
					      cols.forEach(config => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const column = {
 | 
					        const column = {
 | 
				
			||||||
          property: config.property,
 | 
					          property: config.property,
 | 
				
			||||||
          label: config.label,
 | 
					          label: config.label,
 | 
				
			||||||
| 
						 | 
					@ -346,6 +360,20 @@ export default {
 | 
				
			||||||
      this.allColumnsSelected = selectedCount === totalCount
 | 
					      this.allColumnsSelected = selectedCount === totalCount
 | 
				
			||||||
      this.allColumnsSelectedIndeterminate = selectedCount !== totalCount && selectedCount !== 0
 | 
					      this.allColumnsSelectedIndeterminate = selectedCount !== totalCount && selectedCount !== 0
 | 
				
			||||||
      this.updateColumnVisible(item)
 | 
					      this.updateColumnVisible(item)
 | 
				
			||||||
 | 
					      /*const columns = []
 | 
				
			||||||
 | 
					      this.tableColumns.forEach(column => {
 | 
				
			||||||
 | 
					        if(column.visible==false){
 | 
				
			||||||
 | 
					          columns.push(column.property)
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        console.log("-"+column.property+"--"+column.visible)
 | 
				
			||||||
 | 
					      })
 | 
				
			||||||
 | 
					      const post_table_config = {
 | 
				
			||||||
 | 
					        value: JSON.stringify(columns),
 | 
				
			||||||
 | 
					        tableType: this.tableKey
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      crudTableConfig.add(post_table_config)*/
 | 
				
			||||||
 | 
					      //this.postToTableConfig();
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    postToTableConfig(){
 | 
					    postToTableConfig(){
 | 
				
			||||||
      this. updateTableColumns();
 | 
					      this. updateTableColumns();
 | 
				
			||||||
| 
						 | 
					@ -403,11 +431,9 @@ export default {
 | 
				
			||||||
  display: flex;
 | 
					  display: flex;
 | 
				
			||||||
  align-items: center;
 | 
					  align-items: center;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
.crud-opts .crud-opts-right {
 | 
					.crud-opts .crud-opts-right {
 | 
				
			||||||
  margin-left: auto;
 | 
					  margin-left: auto;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
.crud-opts .crud-opts-right span {
 | 
					.crud-opts .crud-opts-right span {
 | 
				
			||||||
  float: left;
 | 
					  float: left;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue