Commit bcb53928 authored by 李杨's avatar 李杨

增加操作按钮,控制资源点

parent 2788c53e
...@@ -152,25 +152,25 @@ ...@@ -152,25 +152,25 @@
:currentMode="currentModel" :currentMode="currentModel"
> >
<template v-slot:operation="scope"> <template v-slot:operation="scope">
<el-button <el-button disabled
type="text" type="text"
v-if="activeTab != 'c788ce98c1f248f590434394da485ce4'" v-if="activeTab != 'c788ce98c1f248f590434394da485ce4'"
@click="statusHandle" @click="statusHandle"
>开启</el-button >开启</el-button
> >
<el-button <el-button disabled
type="text" type="text"
v-if="activeTab != 'c788ce98c1f248f590434394da485ce4'" v-if="activeTab != 'c788ce98c1f248f590434394da485ce4'"
@click="statusHandle" @click="statusHandle"
>关闭</el-button >关闭</el-button
> >
<el-button <el-button disabled
type="text" type="text"
@click="statusHandle" @click="statusHandle"
v-if="activeTab == 'b45827c068254695864ee3c1d42573cb'" v-if="activeTab == 'b45827c068254695864ee3c1d42573cb'"
>故障复位</el-button >故障复位</el-button
> >
<el-button <el-button disabled
type="text" type="text"
@click="handleBtnClick(scope.scope.row)" @click="handleBtnClick(scope.scope.row)"
v-if=" v-if="
...@@ -179,25 +179,25 @@ ...@@ -179,25 +179,25 @@
" "
>设置频率</el-button >设置频率</el-button
> >
<el-button <el-button disabled
type="text" type="text"
@click="statusHandle" @click="statusHandle"
v-if="activeTab == 'c788ce98c1f248f590434394da485ce4'" v-if="activeTab == 'c788ce98c1f248f590434394da485ce4'"
>上升</el-button >上升</el-button
> >
<el-button <el-button disabled
type="text" type="text"
@click="statusHandle" @click="statusHandle"
v-if="activeTab == 'c788ce98c1f248f590434394da485ce4'" v-if="activeTab == 'c788ce98c1f248f590434394da485ce4'"
>下降</el-button >下降</el-button
> >
<el-button <el-button disabled
type="text" type="text"
@click="statusHandle" @click="statusHandle"
v-if="activeTab == 'c788ce98c1f248f590434394da485ce4'" v-if="activeTab == 'c788ce98c1f248f590434394da485ce4'"
>停止</el-button >停止</el-button
> >
<el-button <el-button disabled
type="text" type="text"
@click="handleUpAndDownBtnClick" @click="handleUpAndDownBtnClick"
v-if="activeTab == 'c788ce98c1f248f590434394da485ce4'" v-if="activeTab == 'c788ce98c1f248f590434394da485ce4'"
......
...@@ -2,47 +2,57 @@ ...@@ -2,47 +2,57 @@
<div class="office-area-control" style="height: 100%"> <div class="office-area-control" style="height: 100%">
<cardList cardListTitle="办公区域控制"> <cardList cardListTitle="办公区域控制">
<div slot="content"> <div slot="content">
<!-- <enTabs :tabList="officeTabList"></enTabs> -->
<el-tabs class="en-tabs" v-model="activeTab"> <el-tabs class="en-tabs" v-model="activeTab">
<el-tab-pane <el-tab-pane :label="item.label" :name="item.id" v-for="(item, index) in officeTabList" :key="index"></el-tab-pane>
:label="item.label"
:name="item.id"
v-for="(item, index) in officeTabList"
:key="index"
></el-tab-pane>
</el-tabs> </el-tabs>
<div style="margin-top: 20px"></div> <div style="margin-top: 20px"></div>
<table-list <table-list :tableColums="tableColums" :tableData="tableData" :showOpr="true" :opNum="3" :showStateColor="true" :currentMode="currentModel">
:tableColums="tableColums"
:tableData="tableData"
:showOpr="true"
:opNum="3"
:showStateColor="true"
:currentMode="currentModel"
>
<template v-slot:operation="scope"> <template v-slot:operation="scope">
<el-button type="text" @click="statusHandle(scope.scope,1)">开启</el-button> <el-button type="text" @click="statusHandle(scope.scope,1)">开启</el-button>
<el-button type="text" @click="statusHandle(scope.scope,2)">关闭</el-button> <el-button type="text" @click="statusHandle(scope.scope,2)">关闭</el-button>
<el-button v-if="activeTab != 'b6af764f2a6e454490a6b1b3c9057e57'" type="text" @click="settingJfkt(scope.scope,3)">设置</el-button>
</template> </template>
</table-list> </table-list>
<!-- <en-table <el-dialog title="空调设置" :visible.sync="jfktDialogVisible" append-to-body width="28%">
:tableData="tableData" <el-form label-position="" :inline="true" :model="formData" label-width="100" :rules="dataRule" ref="dataForm">
:tableColums="tableColums" <!-- <el-row>
:isShowOp="true" <el-form-item label="启停控制:" prop="temperature">
isShowPage="true" <el-switch v-model="newObject.state" active-text="开" inactive-text="关"></el-switch>
> </el-form-item>
<template v-slot:operation="scope"> </el-row> -->
<el-button type="text" @click="statusHandle">开启</el-button> <el-row>
<el-button type="text" @click="statusHandle">关闭</el-button> <el-form-item label="温度设定(℃):" prop="temperature">
</template> <el-input size="mini" v-model.number="formData.temperature" clearable=""></el-input>
</en-table> --> </el-form-item>
<el-form-item>
<el-button type="primary" size="mini" @click="changeTemperature2()" >确定</el-button>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="选择模式:" prop="xzms">
<el-select v-model="formData.xzms" placeholder="请选择">
<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" size="mini" @click="changeTemperature3()" >确定</el-button>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="选择风速:" prop="xzfs">
<el-select v-model="formData.xzfs" placeholder="请选择">
<el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" size="mini" @click="changeTemperature4()" >确定</el-button>
</el-form-item>
</el-row>
</el-form>
</el-dialog>
</div> </div>
</cardList> </cardList>
<table-pagination <table-pagination :pageSize="pageSize" :totalSize="totalSize" @parentMethod="getDataList"></table-pagination>
:pageSize="pageSize"
:totalSize="totalSize"
@parentMethod="getDataList"
></table-pagination>
</div> </div>
</template> </template>
<script> <script>
...@@ -62,8 +72,17 @@ export default { ...@@ -62,8 +72,17 @@ export default {
tablePagination, tablePagination,
tableList tableList
}, },
data() { data() {
let validateNumber = (rule, value, callback) => {
console.log("value:"+value)
if (value < 0) {
callback(new Error('只能输入正整数'))
} else if (value >= 17 && value <= 30) {
callback(new Error('温度需要是17-30之间的整数'))
} else {
callback()
}
}
return { return {
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
...@@ -93,6 +112,51 @@ export default { ...@@ -93,6 +112,51 @@ export default {
id: '8f0787103561423887324f8ac3c36b89', id: '8f0787103561423887324f8ac3c36b89',
label: '多联新风处理机室内机' label: '多联新风处理机室内机'
} }
],
activeName:'first',
newObject: {},
jfktDialogVisible: false,
formData: {},
dataRule: {
temperature: [
{ required: true, message: '温度需要是17-30之间的整数'},
{ type: 'number', message: '温度必须为数字' },
{validator: validateNumber, trigger: ['blur', 'change']}
],
xzms: [
{ required: true, message: '请选择模式'},
],
xzfs: [
{ required: true, message: '请选择风速'},
]
},
options1: [
{ value: '1',
label: '自动模式'
},
{ value: '2',
label: '制冷模式'
},
{ value: '4',
label: '除湿模式'
},
{ value: '8',
label: '送风模式'
},
{ value: '16',
label: '制热模式'
},
],
options2: [
{ value: '2',
label: '高风'
},
{ value: '4',
label: '中风'
},
{ value: '8',
label: '低风'
},
] ]
} }
}, },
...@@ -286,7 +350,7 @@ export default { ...@@ -286,7 +350,7 @@ export default {
} }
} }
}, },
statusHandle(row,status) { statusHandle(row, status) {
console.log('row:', row) console.log('row:', row)
this.$http({ this.$http({
url: this.$http.adornUrl('/equipment/onOrOff'), url: this.$http.adornUrl('/equipment/onOrOff'),
...@@ -305,7 +369,121 @@ export default { ...@@ -305,7 +369,121 @@ export default {
} }
}) })
},
// 看起设置空调温度窗口
settingJfkt(row, status){
this.newObject = row
this.jfktDialogVisible = true
},
// 关闭设置窗口
closeTemperature(){
this.jfktDialogVisible = false
},
// 启停空调,1=开启,2=关闭
changeTemperature1(val){
this.$http({
url: this.$http.adornUrl('/equipment/onOrOff'),
method: 'post',
data: {
id: this.newObject.id,
status: val,
actionName: this.newObject.name + val?'开启':'关闭',
actionType: 1
}
}).then((data) => {
if (data && data.code === 0) {
this.$message.success(data.msg)
}else{
this.$message.error(data.msg)
}
})
},
// 确定设置温度
changeTemperature2(){
this.$http({
url: this.$http.adornUrl('/equipment/onOrOff'),
method: 'post',
data: {
id: this.newObject.id,
status: this.formData.temperature,
actionName: this.newObject.name + '设定温度控制为:'+temperature,
actionType: 2
}
}).then((data) => {
if (data && data.code === 0) {
this.$message.success(data.msg)
}else{
this.$message.error(data.msg)
}
})
},
// 设定模式控制
changeTemperature3(){
let com = ""
if(this.formData.xzms == 1){
com = "设置模式为:自动模式"
}else if(this.formData.xzms == 2){
com = "设置模式为:制冷模式"
}else if(this.formData.xzms == 4){
com = "设置模式为:除湿模式"
}else if(this.formData.xzms == 8){
com = "设置模式为:送风模式"
}else if(this.formData.xzms == 16){
com = "设置模式为:制热模式"
}
this.$http({
url: this.$http.adornUrl('/equipment/onOrOff'),
method: 'post',
data: {
id: this.newObject.id,
status: this.formData.xzms,
actionName: this.newObject.name + com,
actionType: 3
}
}).then((data) => {
if (data && data.code === 0) {
this.$message.success(data.msg)
}else{
this.$message.error(data.msg)
}
})
},
changeTemperature4(){
let com = ""
if(this.formData.xzfs == 1){
com = "设置风速为:高风"
}else if(this.formData.xzfs == 2){
com = "设置风速为:中风"
}else if(this.formData.xzfs == 4){
com = "设置风速为:低风"
}
this.$http({
url: this.$http.adornUrl('/equipment/onOrOff'),
method: 'post',
data: {
id: this.newObject.id,
status: this.formData.xzfs,
actionName: this.newObject.name + com,
actionType: 4
}
}).then((data) => {
if (data && data.code === 0) {
this.$message.success(data.msg)
}else{
this.$message.error(data.msg)
}
})
} }
} }
} }
</script> </script>
<style scoped>
/deep/ .el-input__inner{
height: 28px !important;
line-height: 28px !important;
width: 200px !important;
}
/deep/ .el-form-item__label{
width: 150px;
}
</style>
\ No newline at end of file
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
.quDetailM .quDetailM
p.leftP 安装日期:&nbsp;&nbsp;&nbsp;{{ dataForm.installDate }} p.leftP 安装日期:&nbsp;&nbsp;&nbsp;{{ dataForm.installDate }}
.info-form(style="border-bottom: 1px solid #c0c0c0") .info-form(style="border-bottom: 1px solid #c0c0c0")
el-row.text-size(v-if="openOrClose.indexOf(dataForm.type)>-1") //- el-row.text-size(v-if="openOrClose.indexOf(dataForm.type)>-1")
el-row.text-size(v-if="dataForm.type=='b6af764f2a6e454490a6b1b3c9057e57'||dataForm.type=='ece0b8b2db27411886254e81134988a3'||dataForm.type=='8f5530fee2484e8eb107c0ca672132b2'|| dataForm.type=='173466a2cf9a42a6a17b2bdfbeae36d5'")
el-col(:span='10') 当前已 el-col(:span='10') 当前已
span(v-if="dataForm.status == 1") 运行 span(v-if="dataForm.status == 1") 运行
span(v-else-if="dataForm.status == 2") 停止 span(v-else-if="dataForm.status == 2") 停止
...@@ -35,10 +36,34 @@ ...@@ -35,10 +36,34 @@
.switch-warp .switch-warp
div(:class="[state == 1 ? 'on' : '']", @click="handleSwitch(1)") 打开 div(:class="[state == 1 ? 'on' : '']", @click="handleSwitch(1)") 打开
div(:class="[state == 2 ? 'on' : '']", @click="handleSwitch(2)") 关闭 div(:class="[state == 2 ? 'on' : '']", @click="handleSwitch(2)") 关闭
el-row.text-size(style="margin-top: 10px" v-if="dataForm.type=='ece0b8b2db27411886254e81134988a3'||dataForm.type=='8f5530fee2484e8eb107c0ca672132b2'|| dataForm.type=='173466a2cf9a42a6a17b2bdfbeae36d5'")
el-col(:span="16" )
span 温度设定:
el-input(size="mini", style="width: 80px", v-model="temperature")
span &nbsp;(℃)
el-button(type="primary", size="mini", style="margin-left: 3px",@click="handleSwitch2(1)") 设定
el-row.text-size(style="margin-top: 10px" v-if="dataForm.type=='ece0b8b2db27411886254e81134988a3'||dataForm.type=='8f5530fee2484e8eb107c0ca672132b2'|| dataForm.type=='173466a2cf9a42a6a17b2bdfbeae36d5'")
el-col(:span="16" )
span 选择模式:
el-select(size="mini" v-model="speed" placeholder="请选择数据库类型" style="width: 106px")
el-option(label="自动模式" value="1")
el-option(label="制冷模式" value="2")
el-option(label="除湿模式" value="4")
el-option(label="送风模式" value="8")
el-option(label="制热模式" value="16")
el-button(type="primary", size="mini", style="margin-left: 3px",@click="handleSwitch2(2)") 设定
el-row.text-size(style="margin-top: 10px" v-if="dataForm.type=='ece0b8b2db27411886254e81134988a3'||dataForm.type=='8f5530fee2484e8eb107c0ca672132b2'|| dataForm.type=='173466a2cf9a42a6a17b2bdfbeae36d5'")
el-col(:span="16" )
span 选择风速:
el-select(size="mini" v-model="models" placeholder="请选择数据库类型" style="width: 106px")
el-option(label="高风" value="2")
el-option(label="中风" value="4")
el-option(label="低风" value="8")
el-button(type="primary", size="mini", style="margin-left: 3px") 设定
el-row.text-size(style="margin-top: 10px" v-if="dataForm.type=='303310efddb34a2e9bf269bdff8a7dc5'||dataForm.type=='f4c840711eae4bcb9536a890cdfda493'") el-row.text-size(style="margin-top: 10px" v-if="dataForm.type=='303310efddb34a2e9bf269bdff8a7dc5'||dataForm.type=='f4c840711eae4bcb9536a890cdfda493'")
el-col(:span="16" ) el-col(:span="16" )
span 频率设置: span 频率设置:
el-input(size="mini", style="width: 80px", v-model="speed") el-input(size="mini", style="width: 80px", v-model="windSpeed",@click="handleSwitch2(3)")
span &nbsp;转/分 span &nbsp;转/分
el-button(type="primary", size="mini", style="margin-left: 3px") 设定 el-button(type="primary", size="mini", style="margin-left: 3px") 设定
//- 卷帘门 //- 卷帘门
...@@ -134,6 +159,9 @@ export default { ...@@ -134,6 +159,9 @@ export default {
data() { data() {
return { return {
speed: '', //装束 speed: '', //装束
temperature: '',//温度
models: '', //设定模式
windSpeed: '', //设定风速
state: 1, //开关 state: 1, //开关
stationId: localStorage.getItem('stationId'), stationId: localStorage.getItem('stationId'),
dataForm: { dataForm: {
...@@ -163,8 +191,9 @@ export default { ...@@ -163,8 +191,9 @@ export default {
}, },
created() { created() {
console.log(this.list) console.log("------")
this.setData() this.setData()
}, },
methods: { methods: {
init(data, stationId) { init(data, stationId) {
...@@ -211,8 +240,96 @@ export default { ...@@ -211,8 +240,96 @@ export default {
closeQueryDetailVisible() { closeQueryDetailVisible() {
this.$emit('closeQ') this.$emit('closeQ')
}, },
// 控制开/关
handleSwitch(state) { handleSwitch(state) {
this.state = state this.state = state
this.$http({
url: this.$http.adornUrl('/equipment/onOrOff'),
method: 'post',
data: {
id: this.dataForm.id,
status: state,
actionName: this.dataForm.name + state==1?'开启':'关闭',
actionType: 1
}
}).then((data) => {
if (data && data.code === 0) {
this.$message.success(data.msg)
}else{
this.$message.error(data.msg)
}
})
},
// 控制温度、设定模式、设定风速
handleSwitch2(val) {
let com = ""
let actionType = 2
let state = ""
// 温度 temperature
if(val == 1){
com = "设定温度控制为:" + this.temperature
state = this.temperature
if(this.temperature) {
if (!(/(^[1-9]\d*$)/.test(this.temperature))) {
this.$message.warning("温度需要是17-30之间的整数1")
return
     }else if(this.temperature*1 < 17 || this.temperature*1 > 30){
this.$message.warning("温度需要是17-30之间的整数2")
return
     }
}else{
this.$message.warning("温度需要是17-30之间的整数3")
return;
}
}else if(val == 2){ // 设定模式 models
actionType = 3
state = this.models
if(this.models == 1){
com = "设置模式为:自动模式"
}else if(this.models == 2){
com = "设置模式为:制冷模式"
}else if(this.models == 4){
com = "设置模式为:除湿模式"
}else if(this.models == 8){
com = "设置模式为:送风模式"
}else if(this.models == 16){
com = "设置模式为:制热模式"
}
if(!this.models) {
this.$message.warning("请选择设定模式")
return;
}
}else { // 设定风速 windSpeed
actionType = 4
state = this.windSpeed
if(windSpeed == 1){
com = "设置风速为:高风"
}else if(windSpeed == 2){
com = "设置风速为:中风"
}else if(windSpeed == 4){
com = "设置风速为:低风"
}
if(!this.windSpeed) {
this.$message.warning("请选择设定风速")
return;
}
}
this.$http({
url: this.$http.adornUrl('/equipment/onOrOff'),
method: 'post',
data: {
id: this.dataForm.id,
status: state,
actionName: this.dataForm.name + com,
actionType: actionType
}
}).then((data) => {
if (data && data.code === 0) {
this.$message.success(data.msg)
}else{
this.$message.error(data.msg)
}
})
} }
} }
} }
......
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