Commit de2e6a5d authored by co_dengxiongwen's avatar co_dengxiongwen

页面调整

parent 932fae65
......@@ -28,7 +28,7 @@
v-if="isShowOp"
align="center"
label="操作"
fixed='right'
fixed="right"
:width="opNum * 65"
>
<template slot-scope="scope">
......@@ -72,7 +72,7 @@ export default {
},
opNum: {
type: Number,
default: 3
default: 4
},
isShowPage: {
default: true
......
<template>
<el-dialog
title="定时设置升降"
:visible.sync="visible"
:append-to-body="true"
width="40%"
>
<el-form ref="dataForm" :model="formData" label-width="100px">
<el-row :span="18">
<el-col :span="9">
<el-form-item label="上升:">
<el-time-select
size="mini"
placeholder="时间"
v-model="formData.upTime"
:picker-options="{
start: '00:00',
step: '00:15',
end: '24:00'
}"
>
</el-time-select>
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item>
<div class="switch-warp" style="transform: translateY(5px)">
<div
:class="[isOpen1 == 1 ? 'on' : '']"
@click="setSendTime(1, 1)"
>
</div>
<div
:class="[isOpen1 == 2 ? 'on' : '']"
@click="setSendTime(1, 2)"
>
</div>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row :span="18">
<el-col :span="9">
<el-form-item label="下降:">
<el-time-select
size="mini"
placeholder="时间"
v-model="formData.downTime"
:picker-options="{
start: '00:00',
step: '00:15',
end: '24:00'
}"
>
</el-time-select>
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item>
<div class="switch-warp" style="transform: translateY(5px)">
<div
:class="[isOpen2 == 1 ? 'on' : '']"
@click="setSendTime(2, 1)"
>
</div>
<div
:class="[isOpen2 == 2 ? 'on' : '']"
@click="setSendTime(2, 2)"
>
</div>
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-dialog>
</template>
<script lang="ts">
export default {
data() {
return {
visible: false,
isOpen1: 2, //定时开关
isOpen2: 2, //定时开关
formData: {
taskId1: '',
taskId2: '',
upTime: '',
downTime: ''
}
}
},
methods: {
init() {
// console.log('data', data)
this.visible = true
// this.formData = {}
this.getDateList()
},
getDateList() {
this.$http({
url: this.$http.adornUrl('/equipment/getAllDdml'),
method: 'get'
}).then((data) => {
console.log(data)
if (data.list) {
data.list.forEach((element) => {
if (element.type === 1) {
this.formData.upTime = element.startTime
this.formData.taskId1 = element.id
this.isOpen1 = element.status
} else {
this.formData.downTime = element.startTime
this.formData.taskId2 = element.id
this.isOpen2 = element.status
}
})
}
console.log('formData:', this.formData)
})
},
cancelhandle() {
this.visible = false
},
// 设置定时任务
setSendTime(type, status) {
let taskId
if (type === 1) {
if (status === 1) {
if (!this.formData.upTime) {
this.$message.error('时间不能为空!')
return
}
}
taskId = this.formData.taskId1
} else if (type === 2) {
if (status === 1) {
if (!this.formData.downTime) {
this.$message.error('时间不能为空!')
return
}
}
taskId = this.formData.taskId2
}
this.$http({
url: this.$http.adornUrl('/equipment/timedTask'),
method: 'post',
params: this.$http.adornParams({
taskId: taskId || '',
businessType: 2,
type: type,
startTime: type === 1 ? this.formData.upTime : this.formData.downTime,
status: status
})
}).then((data) => {
if (data && data.code === 0) {
if (status === 1) {
this.$message.success('开启定时任务成功')
} else {
this.$message.success('关闭定时任务成功')
}
if (type === 1) {
this.isOpen1 = status
} else {
this.isOpen2 = status
}
this.getDateList()
}
})
}
}
}
</script>
<style lang="scss"></style>
......@@ -126,8 +126,18 @@
isShowPage="true"
>
<template v-slot:operation="scope">
<el-button type="text" @click="statusHandle">开启</el-button>
<el-button type="text" @click="statusHandle">关闭</el-button>
<el-button
type="text"
v-if="activeTab != 'c788ce98c1f248f590434394da485ce4'"
@click="statusHandle"
>开启</el-button
>
<el-button
type="text"
v-if="activeTab != 'c788ce98c1f248f590434394da485ce4'"
@click="statusHandle"
>关闭</el-button
>
<el-button
type="text"
@click="statusHandle"
......@@ -137,9 +147,36 @@
<el-button
type="text"
@click="handleBtnClick(scope.scope.row)"
v-if="activeTab != 'b45827c068254695864ee3c1d42573cb'"
v-if="
activeTab == '303310efddb34a2e9bf269bdff8a7dc5' ||
activeTab == 'f4c840711eae4bcb9536a890cdfda493'
"
>设置频率</el-button
>
<el-button
type="text"
@click="statusHandle"
v-if="activeTab == 'c788ce98c1f248f590434394da485ce4'"
>上升</el-button
>
<el-button
type="text"
@click="statusHandle"
v-if="activeTab == 'c788ce98c1f248f590434394da485ce4'"
>下降</el-button
>
<el-button
type="text"
@click="statusHandle"
v-if="activeTab == 'c788ce98c1f248f590434394da485ce4'"
>停止</el-button
>
<el-button
type="text"
@click="handleUpAndDownBtnClick"
v-if="activeTab == 'c788ce98c1f248f590434394da485ce4'"
>定时升降</el-button
>
</template>
</enTable>
</div>
......@@ -150,6 +187,7 @@
@parentMethod="getDataList"
></table-pagination>
<hall-modal ref="hallModal"></hall-modal>
<set-up-and-down ref="setUpAndDown"></set-up-and-down>
</div>
</template>
<script>
......@@ -158,6 +196,7 @@ import enTable from '../../components/enTable'
import enTabs from '../../components/enTabs'
import hallModal from './components/hallModal'
import tablePagination from '@/pages/components/tablePagination'
import setUpAndDown from './components/setUpAndDown.vue'
import {
tableColumsOne,
......@@ -172,7 +211,8 @@ export default {
enTable,
enTabs,
hallModal,
tablePagination
tablePagination,
setUpAndDown
},
data() {
return {
......@@ -208,7 +248,7 @@ export default {
tableData: [],
tableColums: tableColumsOne,
isSaving: 1, //节能
isOpen: 1, //定时开关
isOpen: 2, //定时开关
formData: {
temperature: '',
taskId: '',
......@@ -432,17 +472,18 @@ export default {
}
})
},
cancelhandle() {
this.$nextTick(() => {
this.hallModalVisible = false
})
},
// 设置频率
handleBtnClick(data) {
this.$nextTick(() => {
this.$refs.hallModal.init(data)
})
},
// 定时升降
handleUpAndDownBtnClick(data) {
this.$nextTick(() => {
this.$refs.setUpAndDown.init()
})
},
handleType(id) {
if (id !== this.currentId) {
this.active = true
......@@ -510,8 +551,6 @@ export default {
this.$message.error('定时功能启止时间不能为空!')
return
}
this.isOpen = type
this.$http({
url: this.$http.adornUrl('/equipment/timedTask'),
method: 'post',
......@@ -519,6 +558,7 @@ export default {
taskId: this.formData.taskId ? this.formData.taskId : '',
startTime: this.formData.startTime,
endTime: this.formData.endTime,
businessType: 1,
status: type
})
}).then((data) => {
......@@ -528,6 +568,7 @@ export default {
} else {
this.$message.success('关闭定时任务成功')
}
this.isOpen = type
this.getAllHcdt()
}
})
......
......@@ -19,36 +19,8 @@
isShowPage="true"
>
<template v-slot:operation="scope">
<el-button
type="text"
@click="statusHandle"
v-if="activeTab != 'c788ce98c1f248f590434394da485ce4'"
>开启</el-button
>
<el-button
type="text"
@click="statusHandle"
v-if="activeTab != 'c788ce98c1f248f590434394da485ce4'"
>关闭</el-button
>
<el-button
type="text"
@click="statusHandle"
v-if="activeTab == 'c788ce98c1f248f590434394da485ce4'"
>上升</el-button
>
<el-button
type="text"
@click="statusHandle"
v-if="activeTab == 'c788ce98c1f248f590434394da485ce4'"
>下降</el-button
>
<el-button
type="text"
@click="statusHandle"
v-if="activeTab == 'c788ce98c1f248f590434394da485ce4'"
>停止</el-button
>
<el-button type="text" @click="statusHandle">开启</el-button>
<el-button type="text" @click="statusHandle">关闭</el-button>
</template>
</en-table>
</div>
......
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