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

合并单元格

parent 749d8765
......@@ -69,7 +69,6 @@
<script>
import elementUiMinins from '../../ucClass/elementUiMinins'
import left from './left'
import hsUtil from 'hs-util-js'
import 'codemirror/theme/ambiance.css'
import 'codemirror/lib/codemirror.css'
import 'codemirror/addon/hint/show-hint.css'
......
......@@ -52,8 +52,11 @@ export default {
systemSysDevDb === 1
) { return true }
} else {
if (top !== self && location.hostname !== '0.0.0.0') return false
if (top === self && location.hostname === '0.0.0.0') return true
// 这是在本地开发时使用没有user_info时
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) {
......
......@@ -172,8 +172,18 @@ export default {
const { is_admin } = user_info_json
if (is_admin === true || is_admin === '1' || is_admin === 1) return true
} else {
if (top !== self && location.hostname !== '0.0.0.0') return false
if (top === self && location.hostname === '0.0.0.0') return true
// 这是在本地开发时使用没有user_info时
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() {
......@@ -188,8 +198,18 @@ export default {
)
return true
} else {
if (top !== self && location.hostname !== '0.0.0.0') return false
if (top === self && location.hostname === '0.0.0.0') return true
// 这是在本地开发时使用没有user_info时
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) {
......
......@@ -24,6 +24,8 @@
</template>
<template v-else-if="item.type==='elDatePicker'">
<el-date-picker
v-click-outside="clickoutsideDom"
@blur='blur'
ref='currentDom'
clearable
style="width:100%"
......@@ -40,6 +42,8 @@
</template>
<template v-else-if="item.type==='elDatePickerDatetime'">
<el-date-picker
v-click-outside="clickoutsideDom"
@blur='blur'
ref='currentDom'
clearable
style="width:100%"
......@@ -53,6 +57,7 @@
</template>
<template v-else-if="item.type==='elDatePickerDate'">
<el-date-picker
v-click-outside="clickoutsideDom"
ref='currentDom'
clearable
style="width:100%"
......@@ -66,6 +71,7 @@
</template>
<template v-else-if="item.type==='elDatePickerMonth'">
<el-date-picker
v-click-outside="clickoutsideDom"
ref='currentDom'
clearable
style="width:100%"
......@@ -79,6 +85,7 @@
</template>
<template v-else-if="item.type==='elDatePickerMonthRange'">
<el-date-picker
v-click-outside="clickoutsideDom"
ref='currentDom'
clearable
style="width:100%"
......@@ -400,14 +407,11 @@
</template>
<script>
// import elementUiMinins from '../../ucClass/elementUiMinins'
// import clickOutSide from '../../ucClass/click-out-side'
import ClickOutside from 'vue-click-outside'
import Clickoutside from '../../ucClass/clickoutside'
export default {
// mixins: [elementUiMinins],
name: 'dyncFormItemComponentChild',
directives: {
ClickOutside
ClickOutside: Clickoutside
},
props: {
popover_visible: {
......@@ -426,6 +430,12 @@ export default {
}
},
methods: {
clickoutsideDom() {
this.hidePicker()
},
blur() {
this.hidePicker()
},
hidePicker() {
this.$refs.currentDom.hidePicker()
},
......
......@@ -59,7 +59,6 @@
</template>
<script>
import mockData from '../../common/initDbConfigDataJson'
import commonMixins from '../../ucClass/commonMixins'
import _ from 'lodash'
export default {
......
......@@ -249,9 +249,7 @@
</template>
<script>
// import clickOutSide from '../../ucClass/click-out-side'
// import Clickoutside from 'element-ui/src/utils/clickoutside'
import Clickoutside from 'vue-click-outside'
import Clickoutside from '../../ucClass/clickoutside'
export default {
directives: {
ClickOutside: Clickoutside
......
......@@ -53,6 +53,7 @@
:row-style='setRowStyle'
:cell-style="setCellStyle"
@header-click="headerClick"
:span-method="spanMethod"
>
<template v-for='(columnItem,index) in tableColumns'>
......@@ -322,9 +323,10 @@
v-show="!!paging"
>
<el-pagination
v-if='pagingConfig.total'
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="pagingConfig.page"
:current-page="pagingConfig.page"
:page-sizes="pageSizes"
:page-size="pagingConfig.per_page"
layout="total, sizes, prev, pager, next, jumper"
......@@ -532,16 +534,11 @@ export default {
},
pagingConfig() {
if (!this.paging) return {}
const { page, per_page, total, total_page } = 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 { page, per_page, total } = this.paging
const obj = {
page: Number(page),
per_page: Number(per_page),
total: Number(total),
total_page: Number(total_page)
total: Number(total)
}
return obj
},
......@@ -599,17 +596,78 @@ export default {
const tkeys = Object.keys(this.total || {}) // 返回的数据中会有这样的一个total
const sumKey = this.tableColumns.find(item => item.summarizing)
return !!tkeys.length || !!sumKey
},
spanList: function() {
return this.dealWithSpanList()
}
},
mounted() {
// this.initContextmenu()
this.targetDom = this.$refs.boxtable
// setTimeout(() => {
// this.targetDom = this.$refs.boxtable// document.querySelector('._hs_table')
// console.log(this.$refs.boxtable)
// }, 500)
},
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() {
const user_info = sessionStorage['user_info']
if (user_info) {
......@@ -617,8 +675,18 @@ export default {
const { is_admin } = user_info_json
if (is_admin === true || is_admin === '1' || is_admin === 1) return true
} else {
if (top !== self && location.hostname !== '0.0.0.0') return false
if (top === self && location.hostname === '0.0.0.0') return true
// 这是在本地开发时使用没有user_info时
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() {
......@@ -636,8 +704,18 @@ export default {
return false
}
} else {
if (top !== self && location.hostname !== '0.0.0.0') return false
if (top === self && location.hostname === '0.0.0.0') return true
// 这是在本地开发时使用没有user_info时
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) {
......@@ -674,7 +752,9 @@ export default {
if (!is_admin || is_admin === 0) return
return is_admin === true
} 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
}
},
......
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 'element-ui/src/utils/clickoutside'
import Clickoutside from 'vue-click-outside'
import Clickoutside from './clickoutside'
export default {
// mixins:[elementUiMinins],
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