Commit 11f73108 authored by 何虹's avatar 何虹 💬

合并单元格

parent 749d8765
...@@ -69,7 +69,6 @@ ...@@ -69,7 +69,6 @@
<script> <script>
import elementUiMinins from '../../ucClass/elementUiMinins' import elementUiMinins from '../../ucClass/elementUiMinins'
import left from './left' import left from './left'
import hsUtil from 'hs-util-js'
import 'codemirror/theme/ambiance.css' import 'codemirror/theme/ambiance.css'
import 'codemirror/lib/codemirror.css' import 'codemirror/lib/codemirror.css'
import 'codemirror/addon/hint/show-hint.css' import 'codemirror/addon/hint/show-hint.css'
......
...@@ -52,8 +52,11 @@ export default { ...@@ -52,8 +52,11 @@ export default {
systemSysDevDb === 1 systemSysDevDb === 1
) { return true } ) { return true }
} else { } else {
if (top !== self && location.hostname !== '0.0.0.0') return false // 这是在本地开发时使用没有user_info时
if (top === self && location.hostname === '0.0.0.0') return true const hostname=location.hostname
if (top === self && (hostname === '0.0.0.0'||hostname==='localhost')) return true
if (top !== self && (hostname !== '0.0.0.0'||hostname !== 'localhost')) return false
} }
}, },
boxEventMouse(event) { boxEventMouse(event) {
......
...@@ -172,8 +172,18 @@ export default { ...@@ -172,8 +172,18 @@ export default {
const { is_admin } = user_info_json const { is_admin } = user_info_json
if (is_admin === true || is_admin === '1' || is_admin === 1) return true if (is_admin === true || is_admin === '1' || is_admin === 1) return true
} else { } else {
if (top !== self && location.hostname !== '0.0.0.0') return false // 这是在本地开发时使用没有user_info时
if (top === self && location.hostname === '0.0.0.0') return true const hostname = location.hostname
if (
top === self &&
(hostname === '0.0.0.0' || hostname === 'localhost')
)
return true
if (
top !== self &&
(hostname !== '0.0.0.0' || hostname !== 'localhost')
)
return false
} }
}, },
getIsDev() { getIsDev() {
...@@ -188,8 +198,18 @@ export default { ...@@ -188,8 +198,18 @@ export default {
) )
return true return true
} else { } else {
if (top !== self && location.hostname !== '0.0.0.0') return false // 这是在本地开发时使用没有user_info时
if (top === self && location.hostname === '0.0.0.0') return true const hostname = location.hostname
if (
top === self &&
(hostname === '0.0.0.0' || hostname === 'localhost')
)
return true
if (
top !== self &&
(hostname !== '0.0.0.0' || hostname !== 'localhost')
)
return false
} }
}, },
onContextmenu(event) { onContextmenu(event) {
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
</template> </template>
<template v-else-if="item.type==='elDatePicker'"> <template v-else-if="item.type==='elDatePicker'">
<el-date-picker <el-date-picker
v-click-outside="clickoutsideDom"
@blur='blur'
ref='currentDom' ref='currentDom'
clearable clearable
style="width:100%" style="width:100%"
...@@ -40,6 +42,8 @@ ...@@ -40,6 +42,8 @@
</template> </template>
<template v-else-if="item.type==='elDatePickerDatetime'"> <template v-else-if="item.type==='elDatePickerDatetime'">
<el-date-picker <el-date-picker
v-click-outside="clickoutsideDom"
@blur='blur'
ref='currentDom' ref='currentDom'
clearable clearable
style="width:100%" style="width:100%"
...@@ -53,6 +57,7 @@ ...@@ -53,6 +57,7 @@
</template> </template>
<template v-else-if="item.type==='elDatePickerDate'"> <template v-else-if="item.type==='elDatePickerDate'">
<el-date-picker <el-date-picker
v-click-outside="clickoutsideDom"
ref='currentDom' ref='currentDom'
clearable clearable
style="width:100%" style="width:100%"
...@@ -66,6 +71,7 @@ ...@@ -66,6 +71,7 @@
</template> </template>
<template v-else-if="item.type==='elDatePickerMonth'"> <template v-else-if="item.type==='elDatePickerMonth'">
<el-date-picker <el-date-picker
v-click-outside="clickoutsideDom"
ref='currentDom' ref='currentDom'
clearable clearable
style="width:100%" style="width:100%"
...@@ -79,6 +85,7 @@ ...@@ -79,6 +85,7 @@
</template> </template>
<template v-else-if="item.type==='elDatePickerMonthRange'"> <template v-else-if="item.type==='elDatePickerMonthRange'">
<el-date-picker <el-date-picker
v-click-outside="clickoutsideDom"
ref='currentDom' ref='currentDom'
clearable clearable
style="width:100%" style="width:100%"
...@@ -400,14 +407,11 @@ ...@@ -400,14 +407,11 @@
</template> </template>
<script> <script>
// import elementUiMinins from '../../ucClass/elementUiMinins' import Clickoutside from '../../ucClass/clickoutside'
// import clickOutSide from '../../ucClass/click-out-side'
import ClickOutside from 'vue-click-outside'
export default { export default {
// mixins: [elementUiMinins],
name: 'dyncFormItemComponentChild', name: 'dyncFormItemComponentChild',
directives: { directives: {
ClickOutside ClickOutside: Clickoutside
}, },
props: { props: {
popover_visible: { popover_visible: {
...@@ -426,6 +430,12 @@ export default { ...@@ -426,6 +430,12 @@ export default {
} }
}, },
methods: { methods: {
clickoutsideDom() {
this.hidePicker()
},
blur() {
this.hidePicker()
},
hidePicker() { hidePicker() {
this.$refs.currentDom.hidePicker() this.$refs.currentDom.hidePicker()
}, },
......
...@@ -59,7 +59,6 @@ ...@@ -59,7 +59,6 @@
</template> </template>
<script> <script>
import mockData from '../../common/initDbConfigDataJson'
import commonMixins from '../../ucClass/commonMixins' import commonMixins from '../../ucClass/commonMixins'
import _ from 'lodash' import _ from 'lodash'
export default { export default {
......
...@@ -249,9 +249,7 @@ ...@@ -249,9 +249,7 @@
</template> </template>
<script> <script>
// import clickOutSide from '../../ucClass/click-out-side' import Clickoutside from '../../ucClass/clickoutside'
// import Clickoutside from 'element-ui/src/utils/clickoutside'
import Clickoutside from 'vue-click-outside'
export default { export default {
directives: { directives: {
ClickOutside: Clickoutside ClickOutside: Clickoutside
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
:row-style='setRowStyle' :row-style='setRowStyle'
:cell-style="setCellStyle" :cell-style="setCellStyle"
@header-click="headerClick" @header-click="headerClick"
:span-method="spanMethod"
> >
<template v-for='(columnItem,index) in tableColumns'> <template v-for='(columnItem,index) in tableColumns'>
...@@ -322,9 +323,10 @@ ...@@ -322,9 +323,10 @@
v-show="!!paging" v-show="!!paging"
> >
<el-pagination <el-pagination
v-if='pagingConfig.total'
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page.sync="pagingConfig.page" :current-page="pagingConfig.page"
:page-sizes="pageSizes" :page-sizes="pageSizes"
:page-size="pagingConfig.per_page" :page-size="pagingConfig.per_page"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
...@@ -532,16 +534,11 @@ export default { ...@@ -532,16 +534,11 @@ export default {
}, },
pagingConfig() { pagingConfig() {
if (!this.paging) return {} if (!this.paging) return {}
const { page, per_page, total, total_page } = this.paging const { page, per_page, total } = this.paging
// this.paging.page = Number(page)
// this.paging.per_page = Number(per_page)
// this.paging.total = Number(total)
// this.paging.total_page = Number(total_page)
const obj = { const obj = {
page: Number(page), page: Number(page),
per_page: Number(per_page), per_page: Number(per_page),
total: Number(total), total: Number(total)
total_page: Number(total_page)
} }
return obj return obj
}, },
...@@ -599,17 +596,78 @@ export default { ...@@ -599,17 +596,78 @@ export default {
const tkeys = Object.keys(this.total || {}) // 返回的数据中会有这样的一个total const tkeys = Object.keys(this.total || {}) // 返回的数据中会有这样的一个total
const sumKey = this.tableColumns.find(item => item.summarizing) const sumKey = this.tableColumns.find(item => item.summarizing)
return !!tkeys.length || !!sumKey return !!tkeys.length || !!sumKey
},
spanList: function() {
return this.dealWithSpanList()
} }
}, },
mounted() { mounted() {
// this.initContextmenu()
this.targetDom = this.$refs.boxtable this.targetDom = this.$refs.boxtable
// setTimeout(() => {
// this.targetDom = this.$refs.boxtable// document.querySelector('._hs_table')
// console.log(this.$refs.boxtable)
// }, 500)
}, },
methods: { methods: {
getSpanArr(data, key1, key2) {
const spanList = []
let pos = 0
for (let i = 0; i < data.length; i++) {
if (i === 0) {
spanList.push(1)
pos = 0
} else {
if (key2) {
if (
data[i][key2] === data[i - 1][key2] &&
data[i][key1] === data[i - 1][key1]
) {
spanList[pos] += 1
spanList.push(0)
} else {
spanList.push(1)
pos = i
}
} else {
// 判断当前元素与上一个元素是否相同
if (data[i][key1] === data[i - 1][key1]) {
spanList[pos] += 1
spanList.push(0)
} else {
spanList.push(1)
pos = i
}
}
}
}
return spanList
},
dealWithSpanList() {
const spanList = {}
const tableData = _.cloneDeep(this.tableDat || [])
const config = _.cloneDeep(this.tableConfig || {})
if (config.spanCol) {
spanCol = config.spanCol
spanCol.forEach(key => {
if (key.indexOf('^') > -1) {
const key1 = key.split('^')[0]
const key2 = key.split('^')[1]
spanList[key1] = this.getSpanArr(tableData, key1, key2)
} else {
spanList[key] = this.getSpanArr(tableData, key)
}
})
}
return spanList
},
spanMethod({ row, column, rowIndex, columnIndex }) {
const prop = column.property
const target = this.spanList[prop]
if (target && target.length) {
const _row = target[rowIndex]
const _col = _row > 0 ? 1 : 0
return {
rowspan: _row,
colspan: _col
}
}
},
getIsAdmin() { getIsAdmin() {
const user_info = sessionStorage['user_info'] const user_info = sessionStorage['user_info']
if (user_info) { if (user_info) {
...@@ -617,8 +675,18 @@ export default { ...@@ -617,8 +675,18 @@ export default {
const { is_admin } = user_info_json const { is_admin } = user_info_json
if (is_admin === true || is_admin === '1' || is_admin === 1) return true if (is_admin === true || is_admin === '1' || is_admin === 1) return true
} else { } else {
if (top !== self && location.hostname !== '0.0.0.0') return false // 这是在本地开发时使用没有user_info时
if (top === self && location.hostname === '0.0.0.0') return true const hostname = location.hostname
if (
top === self &&
(hostname === '0.0.0.0' || hostname === 'localhost')
)
return true
if (
top !== self &&
(hostname !== '0.0.0.0' || hostname !== 'localhost')
)
return false
} }
}, },
getIsDev() { getIsDev() {
...@@ -636,8 +704,18 @@ export default { ...@@ -636,8 +704,18 @@ export default {
return false return false
} }
} else { } else {
if (top !== self && location.hostname !== '0.0.0.0') return false // 这是在本地开发时使用没有user_info时
if (top === self && location.hostname === '0.0.0.0') return true const hostname = location.hostname
if (
top === self &&
(hostname === '0.0.0.0' || hostname === 'localhost')
)
return true
if (
top !== self &&
(hostname !== '0.0.0.0' || hostname !== 'localhost')
)
return false
} }
}, },
onContextmenu(event) { onContextmenu(event) {
...@@ -674,7 +752,9 @@ export default { ...@@ -674,7 +752,9 @@ export default {
if (!is_admin || is_admin === 0) return if (!is_admin || is_admin === 0) return
return is_admin === true return is_admin === true
} else { } else {
if (!user_info && top !== self && location.hostname !== '0.0.0.0') { return false } if (!user_info && top !== self && location.hostname !== '0.0.0.0') {
return false
}
return true return true
} }
}, },
......
export default {
bind(el, binding, vnode) {
el.handler = function(e) {
if (el.contains(e.target)) {
return false
}
// vnode.context[binding.expression] = false
binding.value()
}
el.stopProp = function(event) {
event.stopPropagation()
}
el.addEventListener('click', el.stopProp)
document.body.addEventListener('click', el.handler)
},
unbind(el, binding) {
el.removeEventListener('click', el.stopProp)
document.body.removeEventListener('click', el.handler)
},
install(Vue) {
Vue.directive('clickoutside', {
bind: this.bind,
unbind: this.unbind
})
}
}
export default {
bind(el, binding, vnode) {
function documentHandler(e) {
// el 包含其触发的元素 那当然不能触发啦
if (el.contains(e.target)) {
return false
}
// 满足上面条件, 并且expression 的值不为空 触发(希望value是个函数)
if (binding.expression) {
// 调用自定义指令传来的函数,e是事件原对象 作为参数(为什么传e 因为有些情况需要把这个对象抛出方便用户的操作)
binding.value(e)
}
}
// 嗯??? 这么写有什么作用吗? 当然有了,如果你想取消事件的监听,那么是不是需要这个函数。
el.__vueClickOutside__ = documentHandler
// 在document上监听事件
document.addEventListener('click', documentHandler)
},
update() {
},
unbind(el, binding) {
// 取消事件监听(el.__vueClickOutside 派上用场了吧)
document.removeEventListener('click', el.__vueClickOutside__)
// 既然都取消了 那么这个属性就没必要存在了
delete el.__vueClickOutside__
}
}
// import elementUiMinins from './elementUiMinins'
// import clickOutSide from './click-out-side' import Clickoutside from './clickoutside'
// import Clickoutside from 'element-ui/src/utils/clickoutside'
import Clickoutside from 'vue-click-outside'
export default { export default {
// mixins:[elementUiMinins], // mixins:[elementUiMinins],
directives: { directives: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment