feat: panel 滚动超过 50px 显示分割线
This commit is contained in:
@@ -313,7 +313,7 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button @click="imgUpload" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new"
|
<button @click="imgUpload" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new"
|
||||||
v-has="'project_topo_save'" :disabled="prevent_opt.save"
|
v-has="'topo_icon_save'" :disabled="prevent_opt.save"
|
||||||
:class="{'nz-btn-disabled':prevent_opt.save}"
|
:class="{'nz-btn-disabled':prevent_opt.save}"
|
||||||
style="margin-right: 20px">
|
style="margin-right: 20px">
|
||||||
{{$t('project.topology.save')}}
|
{{$t('project.topology.save')}}
|
||||||
@@ -477,6 +477,8 @@ export default {
|
|||||||
penToolTipScale: 1,
|
penToolTipScale: 1,
|
||||||
oldScale: 1,
|
oldScale: 1,
|
||||||
uploadPicShow: false,
|
uploadPicShow: false,
|
||||||
|
imgWidth: 0,
|
||||||
|
imgHeight: 0,
|
||||||
uploadPic: {
|
uploadPic: {
|
||||||
name: '',
|
name: '',
|
||||||
unit: ''
|
unit: ''
|
||||||
@@ -1484,22 +1486,24 @@ export default {
|
|||||||
beforeAvatarUpload (file, fileList) {
|
beforeAvatarUpload (file, fileList) {
|
||||||
const this_ = this
|
const this_ = this
|
||||||
const isJPG = (file.raw.type === 'image/jpeg' || file.raw.type === 'image/png')
|
const isJPG = (file.raw.type === 'image/jpeg' || file.raw.type === 'image/png')
|
||||||
|
const isLt2M = file.size / 1024 / 1024 < 2
|
||||||
if (!isJPG) {
|
if (!isJPG) {
|
||||||
this.$message.error(this_.$t('project.topology.imgFormat'))
|
this.$message.error(this_.$t('project.topology.imgFormat'))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// if (!isLt2M) {
|
if (!isLt2M) {
|
||||||
// this.$message.error( this_.$t('project.topology.imgSize'));
|
this.$message.error(this_.$t('project.topology.imgSize'))
|
||||||
// return false;
|
return false
|
||||||
// }
|
}
|
||||||
const isSize = new Promise(function (resolve, reject) {
|
const isSize = new Promise(function (resolve, reject) {
|
||||||
const width = 100
|
const width = 0
|
||||||
const height = 100
|
const height = 0
|
||||||
const _URL = window.URL || window.webkitURL
|
const _URL = window.URL || window.webkitURL
|
||||||
const img = new Image()
|
const img = new Image()
|
||||||
img.onload = function () {
|
img.onload = function () {
|
||||||
const valid = img.width > width && img.height > height
|
const valid = img.width > width && img.height > height
|
||||||
|
this_.imgWidth = img.width
|
||||||
|
this_.imgHeight = img.height
|
||||||
valid ? resolve() : reject()
|
valid ? resolve() : reject()
|
||||||
}
|
}
|
||||||
img.src = _URL.createObjectURL(file.raw)
|
img.src = _URL.createObjectURL(file.raw)
|
||||||
@@ -1545,17 +1549,20 @@ export default {
|
|||||||
upload () {
|
upload () {
|
||||||
const form = new FormData()
|
const form = new FormData()
|
||||||
form.append('file', this.file)
|
form.append('file', this.file)
|
||||||
|
console.log(this.file)
|
||||||
if (this.uploadPic.name) {
|
if (this.uploadPic.name) {
|
||||||
form.append('name', this.uploadPic.name)
|
form.append('name', this.uploadPic.name)
|
||||||
} else {
|
} else {
|
||||||
form.append('name', this.file.name.substring(0, this.file.name.lastIndexOf('.')))
|
form.append('name', this.file.name.substring(0, this.file.name.lastIndexOf('.')))
|
||||||
}
|
}
|
||||||
form.append('unit', this.uploadPic.unit)
|
form.append('unit', this.uploadPic.unit)
|
||||||
|
form.append('width', this.imgWidth)
|
||||||
|
form.append('height', this.imgHeight)
|
||||||
this.$post('monitor/project/topo/icon', form, { 'Content-Type': 'multipart/form-data' }).then(res => {
|
this.$post('monitor/project/topo/icon', form, { 'Content-Type': 'multipart/form-data' }).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
|
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
|
||||||
this.uploadPicShow = false
|
this.uploadPicShow = false
|
||||||
this.dealImg(`monitor/project/topo/icon/${res.data.id}`).then((data) => {
|
this.dealImg(`monitor/project/topo/icon/${res.data.id}/1`).then((data) => {
|
||||||
const group = this.tools.find(tool => tool.group === this.uploadPic.unit)
|
const group = this.tools.find(tool => tool.group === this.uploadPic.unit)
|
||||||
if (group) {
|
if (group) {
|
||||||
group.children.push({
|
group.children.push({
|
||||||
@@ -1611,7 +1618,7 @@ export default {
|
|||||||
res.data.list.forEach((item, index) => {
|
res.data.list.forEach((item, index) => {
|
||||||
item.imageName = item.name
|
item.imageName = item.name
|
||||||
delete item.name
|
delete item.name
|
||||||
promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.id}`))
|
promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.id}/1`))
|
||||||
imgArr.push({ ...item })
|
imgArr.push({ ...item })
|
||||||
})
|
})
|
||||||
Promise.all(promiseArr).then((res2) => {
|
Promise.all(promiseArr).then((res2) => {
|
||||||
@@ -1655,7 +1662,7 @@ export default {
|
|||||||
const promiseArr = []
|
const promiseArr = []
|
||||||
imgidList.forEach((item, index) => {
|
imgidList.forEach((item, index) => {
|
||||||
if (item.data.imageId) {
|
if (item.data.imageId) {
|
||||||
promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.data.imageId}`))
|
promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.data.imageId}/1`))
|
||||||
} else {
|
} else {
|
||||||
promiseArr.push('')
|
promiseArr.push('')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div id="tableList" class="table-list">
|
<div id="tableList" class="table-list">
|
||||||
<div ref="dashboardScrollbar" style="height: 100%; overflow: auto;">
|
<div ref="dashboardScrollbar" style="height: calc(100% - 1px); overflow: auto;" :class="overScroll10?'border-t-1-de':'border-t-1-tr'">
|
||||||
<div class="box-content">
|
<div class="box-content">
|
||||||
<chart-list ref="chartList" :class="{'show-top':showTopBtn}" :from="$CONSTANTS.fromRoute.panel" :panel-lock="panelLock" @on-edit-chart="editChart" @on-refresh-time="refreshTime" @on-remove-chart="delChart" @on-add-group-item-chart="addGroupItem"></chart-list>
|
<chart-list ref="chartList" :class="{'show-top':showTopBtn}" :from="$CONSTANTS.fromRoute.panel" :panel-lock="panelLock" @on-edit-chart="editChart" @on-refresh-time="refreshTime" @on-remove-chart="delChart" @on-add-group-item-chart="addGroupItem"></chart-list>
|
||||||
</div>
|
</div>
|
||||||
@@ -102,6 +102,7 @@ export default {
|
|||||||
name: 'panel',
|
name: 'panel',
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
overScroll10: false,
|
||||||
panelLock: true,
|
panelLock: true,
|
||||||
showTopBtn: false, // top按钮
|
showTopBtn: false, // top按钮
|
||||||
visible: false,
|
visible: false,
|
||||||
@@ -571,6 +572,7 @@ export default {
|
|||||||
const _self = this
|
const _self = this
|
||||||
this.scrollbarWrap.addEventListener('scroll', bus.debounce(function () {
|
this.scrollbarWrap.addEventListener('scroll', bus.debounce(function () {
|
||||||
_self.showTopBtn = _self.scrollbarWrap.scrollTop > 50
|
_self.showTopBtn = _self.scrollbarWrap.scrollTop > 50
|
||||||
|
_self.overScroll10 = _self.scrollbarWrap.scrollTop > 50
|
||||||
_self.$refs.chartList.loadChartData(_self.scrollbarWrap.scrollTop)
|
_self.$refs.chartList.loadChartData(_self.scrollbarWrap.scrollTop)
|
||||||
}, 300))
|
}, 300))
|
||||||
},
|
},
|
||||||
@@ -783,6 +785,12 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
.border-t-1-de{
|
||||||
|
border-top: 1px solid #dedede;
|
||||||
|
}
|
||||||
|
.border-t-1-tr{
|
||||||
|
border-top: 1px solid transparent;
|
||||||
|
}
|
||||||
.panel {
|
.panel {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
Reference in New Issue
Block a user