|
@@ -10,8 +10,8 @@
|
|
|
</el-col>
|
|
|
<el-col :span='12'>
|
|
|
<div class='start'>图例名称</div>
|
|
|
- <!-- <el-input v-model='ruleForm.Name' style='width:200px;height:32px;'></el-input> -->
|
|
|
- <Input v-model='ruleForm.Name' placeholder maxlength='20' style='width:200px' />
|
|
|
+ <el-input v-model='ruleForm.Name' class='reset-input-name' oninput='if(value.length>20)value=value.slice(0,20)'></el-input>
|
|
|
+ <!-- <Input v-model='ruleForm.Name' placeholder style='width:200px;' @input='if(value.length>11)value=value.slice(0,11)' /> -->
|
|
|
</el-col>
|
|
|
<el-col :span='12' style='margin-top:20px'>
|
|
|
<div class>单位</div>
|
|
@@ -41,7 +41,7 @@
|
|
|
</div>
|
|
|
<div v-show='ruleForm.Type=="Zone" || ruleForm.Type=="Image" || ruleForm.Type =="Line"'>
|
|
|
<div style='color:#646C73'>展示预览</div>
|
|
|
- <div class='input-right' ref='graph' style="width:200px;height:114px;">
|
|
|
+ <div class='input-right' ref='graph' style='width:200px;height:114px;'>
|
|
|
<canvas id='canvas' :width='canvasWidth' :height='canvasHeight'></canvas>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -109,7 +109,7 @@
|
|
|
tipPlace='top'
|
|
|
width='200'
|
|
|
style=' margin-right:48px;'
|
|
|
- :returnParentNode='true'
|
|
|
+ :returnParentNode='false'
|
|
|
:isShowAllChoice='true'
|
|
|
:choseArea='true'
|
|
|
:data='deviceList'
|
|
@@ -149,6 +149,7 @@ import { GraphView } from '@/lib/GraphView'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ maxlength: 20,
|
|
|
options: [
|
|
|
{
|
|
|
id: 'None',
|
|
@@ -277,7 +278,6 @@ export default {
|
|
|
let postParams = {
|
|
|
Content: [this.ruleForm]
|
|
|
}
|
|
|
-
|
|
|
updateLegend({ postParams }).then(res => {
|
|
|
if (res.Result == 'success') {
|
|
|
this.$message.success('图例修改成功!')
|
|
@@ -392,30 +392,43 @@ export default {
|
|
|
// 把canvas图保存到图片服务器
|
|
|
saveImg() {
|
|
|
let vm = this
|
|
|
- if (this.view) {
|
|
|
- let data = this.view.canvasView.toDataURL('image/png')
|
|
|
- var formData = new FormData()
|
|
|
- if (this.ruleForm.Type == 'Zone' || this.ruleForm.Type == 'Line') {
|
|
|
- formData.append('file', this.base64ToFile(data))
|
|
|
- } else {
|
|
|
- formData.append('file', this.file)
|
|
|
+ if (!this.file && this.ruleForm.Type == 'Image') {
|
|
|
+ //修改图片的时候没有重新上传图片
|
|
|
+ if (this.title == '添加图例库') {
|
|
|
+ this.create()
|
|
|
+ this.$emit('addSuccess')
|
|
|
+ this.view.canvas.clearRect(0, 0, this.width, this.height)
|
|
|
+ } else if (this.title == '修改图例库') {
|
|
|
+ this.update()
|
|
|
+ this.$emit('updateSuccess')
|
|
|
+ this.view.canvas.clearRect(0, 0, this.width, this.height)
|
|
|
}
|
|
|
- let postParams = formData
|
|
|
- uploadImg({ postParams }).then(res => {
|
|
|
- if (res.Result == 'success') {
|
|
|
- this.$set(vm.ruleForm, 'Url', res.EntityList[0])
|
|
|
- this.$message.success('图标上传成功!')
|
|
|
- if (this.title == '添加图例库') {
|
|
|
- this.create()
|
|
|
- this.$emit('addSuccess')
|
|
|
- this.view.canvas.clearRect(0, 0, this.width, this.height)
|
|
|
- } else if (this.title == '修改图例库') {
|
|
|
- this.update()
|
|
|
- this.$emit('updateSuccess')
|
|
|
- this.view.canvas.clearRect(0, 0, this.width, this.height)
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ if (this.view) {
|
|
|
+ let data = this.view.canvasView.toDataURL('image/png')
|
|
|
+ var formData = new FormData()
|
|
|
+ if (this.ruleForm.Type == 'Zone' || this.ruleForm.Type == 'Line') {
|
|
|
+ formData.append('file', this.base64ToFile(data))
|
|
|
+ } else {
|
|
|
+ formData.append('file', this.file)
|
|
|
}
|
|
|
- })
|
|
|
+ let postParams = formData
|
|
|
+ uploadImg({ postParams }).then(res => {
|
|
|
+ if (res.Result == 'success') {
|
|
|
+ this.$set(vm.ruleForm, 'Url', res.EntityList[0])
|
|
|
+ this.$message.success('图标上传成功!')
|
|
|
+ if (this.title == '添加图例库') {
|
|
|
+ this.create()
|
|
|
+ this.$emit('addSuccess')
|
|
|
+ this.view.canvas.clearRect(0, 0, this.width, this.height)
|
|
|
+ } else if (this.title == '修改图例库') {
|
|
|
+ this.update()
|
|
|
+ this.$emit('updateSuccess')
|
|
|
+ this.view.canvas.clearRect(0, 0, this.width, this.height)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
// 铺位可视化
|
|
@@ -426,27 +439,33 @@ export default {
|
|
|
|
|
|
//位置/设备
|
|
|
treeConfirmDevice(id, info) {
|
|
|
- console.log(id)
|
|
|
- // this.$set(this.ruleForm, 'InfoLocal', data)
|
|
|
- let InfoSystem = []
|
|
|
- let InfoLocal = []
|
|
|
- if (info && info.length > 0) {
|
|
|
- for (let i = 0; i < info.length; i++) {
|
|
|
- let type = info[i]
|
|
|
- if (type.name.includes('/')) {
|
|
|
- InfoLocal.push(type)
|
|
|
- //位置/设备
|
|
|
- this.$set(this.ruleForm, 'InfoLocal', InfoLocal)
|
|
|
- } else {
|
|
|
- InfoSystem.push(type)
|
|
|
- //专业
|
|
|
- this.$set(this.ruleForm, 'InfoSystem', InfoSystem)
|
|
|
+ let InfoSystem = [],
|
|
|
+ InfoSystems = [],
|
|
|
+ InfoLocal = []
|
|
|
+ this.deviceList.forEach(i => {
|
|
|
+ i.children.length > 0 &&
|
|
|
+ i.children.forEach(j => {
|
|
|
+ if (id.includes(j.id)) {
|
|
|
+ InfoSystems.push(i)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ InfoSystem = JSON.parse(JSON.stringify(InfoSystems))
|
|
|
+ .reduce((prev, element) => {
|
|
|
+ if (!prev.find(el => el.id == element.id)) {
|
|
|
+ prev.push(element)
|
|
|
}
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.$set(this.ruleForm, 'InfoLocal', [])
|
|
|
- this.$set(this.ruleForm, 'InfoSystem', [])
|
|
|
- }
|
|
|
+ return prev
|
|
|
+ }, [])
|
|
|
+ .map(i => {
|
|
|
+ if (i.children.length) {
|
|
|
+ delete i.children
|
|
|
+ }
|
|
|
+ return i
|
|
|
+ })
|
|
|
+ InfoLocal = info
|
|
|
+ this.$set(this.ruleForm, 'InfoLocal', InfoLocal)
|
|
|
+ this.$set(this.ruleForm, 'InfoSystem', InfoSystem)
|
|
|
},
|
|
|
focusChange(status) {
|
|
|
// //console.log('focusChange', status)
|
|
@@ -522,6 +541,14 @@ export default {
|
|
|
.ant-input-number {
|
|
|
border-radius: 4px 0 0 4px;
|
|
|
}
|
|
|
+ .reset-input-name {
|
|
|
+ /deep/ .el-input__inner {
|
|
|
+ width: 200px;
|
|
|
+ height: 32px;
|
|
|
+ line-height: 32px;
|
|
|
+ // border: 1px solid #c3c7cb;
|
|
|
+ }
|
|
|
+ }
|
|
|
// .add-form-type {
|
|
|
// /deep/ .p-select .p-select-header {
|
|
|
// height: 40px;
|
|
@@ -663,7 +690,7 @@ export default {
|
|
|
width: 245px !important;
|
|
|
}
|
|
|
.p-select-area .p-transfer-right .p-transfer-selected .p-transfer-selected-item {
|
|
|
- height: 25px;
|
|
|
+ height: 30px !important;
|
|
|
}
|
|
|
.p-select-area .p-transfer-right .p-transfer-selected .p-transfer-selected-item > span {
|
|
|
word-break: break-all !important;
|