<!-- 基站管理表单组件 -->
|
<template>
|
<view class="m-form">
|
<view class="m-form-head"><u-icon name="close-circle" color="#fff" size="40" @click="cancel"></u-icon></view>
|
<!-- 添加 -->
|
<view class="m-form-label" v-if="baseType=='add'">
|
<u--form labelPosition="left" labelAlign="right" :model="model" :rules="rules" ref="form" labelWidth="100" :labelStyle="{'color':'rgb(129, 129, 129)'}">
|
<u-form-item label="基站ID" prop="anchorid" borderBottom ref="item">
|
<u--input :customStyle="{ 'background-color': 'rgb(233, 233, 233)','box-shadow':'inset 2px 1.464px 5px 0px #ccccc4, 1.464px 1.464px 5px 0px rgba(255, 255, 255, 0.75)'}" placeholderStyle="color:#000" color="#000" v-model="model.anchorid" border="none"></u--input>
|
</u-form-item>
|
<!-- <u-form-item label="高度/米" prop="POSZ" borderBottom ref="item">
|
<u--input :customStyle="{ 'background-color': 'rgb(233, 233, 233)','box-shadow':'inset 2px 1.464px 5px 0px #ccccc4, 1.464px 1.464px 5px 0px rgba(255, 255, 255, 0.75)'}" placeholderStyle="color:#000" color="#000" v-model="model.POSZ" border="none"></u--input>
|
</u-form-item> -->
|
</u--form>
|
</view>
|
<!-- 校准 -->
|
<view class="m-form-label" v-if="baseType=='update'">
|
<view class="m-form-label-text">请将手持端放在地面等待RTK灯绿色,点击确定校准按钮完成高度修正。</view>
|
<u--form labelPosition="left" labelAlign="right" :model="model" :rules="rules" ref="form" labelWidth="100" :labelStyle="{'color':'rgb(129, 129, 129)'}">
|
<!-- <u-form-item label="基站ID" prop="anchorid" borderBottom ref="item">
|
<u--input :customStyle="{ 'background-color': 'rgb(233, 233, 233)','box-shadow':'inset 2px 1.464px 5px 0px #ccccc4, 1.464px 1.464px 5px 0px rgba(255, 255, 255, 0.75)'}" placeholderStyle="color:#000" readonly color="#000" v-model="model.anchorid" border="none"></u--input>
|
</u-form-item>
|
<u-form-item label="高度/米" prop="POSZ" borderBottom ref="item">
|
<u--input :customStyle="{ 'background-color': 'rgb(233, 233, 233)','box-shadow':'inset 2px 1.464px 5px 0px #ccccc4, 1.464px 1.464px 5px 0px rgba(255, 255, 255, 0.75)'}" placeholderStyle="color:#000" color="#000" v-model="model.POSZ" border="none"></u--input>
|
</u-form-item> -->
|
<u-form-item label="选择标签" borderBottom ref="item">
|
<uni-data-select v-model="value_name" :localdata="range" @change="changeRange"></uni-data-select>
|
</u-form-item>
|
</u--form>
|
</view>
|
<view class="m-form-button-list">
|
<u-button type="primary" :color="baseType=='update' && state!=4?'#b8b8b8':''" :text="baseType=='update'?state==4?'确定校准':'等待校准':'确定'" @click="save"></u-button>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import {connChart} from '../../../common/utils.js'
|
export default {
|
props: {
|
baseType:String,
|
baseFormData:Object
|
},
|
data() {
|
return {
|
model: {
|
anchorid:'',
|
POSZ:'',
|
|
},
|
rules: {
|
POSZ: {
|
type: 'integer',
|
required: true,
|
message: '请输入整数',
|
trigger: ['blur', 'change']
|
},
|
},
|
labelModel:null,
|
value_name: '',
|
range: [],
|
p_tagid:'',
|
state:null,
|
xiuzhenggao:null
|
};
|
},
|
methods: {
|
//保存
|
save() {
|
if(this.baseType=='add'){
|
//查重
|
this.labelModel.find(`anchorid=${this.model.anchorid}`,(e,r)=>{
|
if(r.length>0){
|
uni.$u.toast('基站ID重复')
|
}else{
|
//添加
|
this.labelModel.insert({
|
anchorid:this.model.anchorid,
|
updateGao:'0.2'
|
}, (err, results) => {
|
console.log(err);
|
console.log(results);
|
this.$emit('submitBaseForm');
|
});
|
}
|
})
|
}else if(this.baseType=='update' && this.state==4){
|
this.labelModel.update(`id='${this.model.id}'`,{
|
updateGao:this.xiuzhenggao
|
},(err,results)=>{
|
console.log(err,results);
|
uni.$u.toast('保存成功')
|
this.$emit('submitBaseForm');
|
});
|
}
|
},
|
//取消
|
cancel() {
|
this.$emit('cancelBaseForm');
|
},
|
connDB() {
|
this.labelModel = connChart('base')
|
},
|
//获取标签列表数据
|
getTallyList() {
|
var labelModel = connChart('label');
|
labelModel.find((e,r)=>{
|
console.log(e,r)
|
if(r.length!=0){
|
this.range = [];
|
r.forEach((e, index) => {
|
this.range.push({
|
text: e.p_tagid + ' ' + e.p_name,
|
value: e.p_tagid
|
});
|
});
|
}
|
})
|
},
|
changeRange(e) {
|
this.value_name = e;
|
this.p_tagid = e;
|
this.getTally()
|
},
|
getTally(){
|
var tally=JSON.parse(JSON.stringify(this.$store.state.tallyPostion))
|
var new_tally= tally.filter(e=>{return e.tagid==this.p_tagid})
|
if(new_tally.length>0) this.state=new_tally[0].state
|
if(new_tally.length>0 && this.state==4){
|
this.xiuzhenggao=new_tally[0].xiuzhenggao
|
}
|
setTimeout(()=>{
|
this.getTally()
|
},1000)
|
}
|
},
|
mounted() {
|
if(this.baseType=='update'){
|
this.model=this.baseFormData
|
}
|
this.connDB()
|
this.getTallyList();
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.m-form {
|
position: fixed;
|
top: 50%;
|
left: 50%;
|
transform: translate(-50%, -50%);
|
background-color: rgba(233, 233, 233,0.8);
|
width: 60%;
|
display: flex;
|
flex-direction: column;
|
z-index: 99999;
|
}
|
.m-form-head {
|
width: 100%;
|
border-bottom: 1px solid #fff;
|
}
|
.m-form-head .u-icon {
|
float: right;
|
}
|
/deep/ .u-form-item__body__left__content__label {
|
color: #fff;
|
}
|
.m-form-label {
|
width: 80%;
|
margin: 0 auto;
|
margin-bottom: 0.5em;
|
.m-form-label-text{
|
color: red;
|
}
|
}
|
input{
|
width: 50px;
|
}
|
.m-form-button-list {
|
width: 100%;
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
justify-content: center;
|
margin-bottom: 1em;
|
}
|
.m-form-button-list .u-button {
|
width: 5em;
|
}
|
.m-form-button-list .u-button:nth-child(2),
|
.m-form-button-list .u-button:nth-child(3),
|
.m-form-button-list .u-button:nth-child(4) {
|
margin-top: 2em;
|
}
|
</style>
|