Commit de2e6a5d authored by co_dengxiongwen's avatar co_dengxiongwen

页面调整

parent 932fae65
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
v-if="isShowOp" v-if="isShowOp"
align="center" align="center"
label="操作" label="操作"
fixed='right' fixed="right"
:width="opNum * 65" :width="opNum * 65"
> >
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -72,7 +72,7 @@ export default { ...@@ -72,7 +72,7 @@ export default {
}, },
opNum: { opNum: {
type: Number, type: Number,
default: 3 default: 4
}, },
isShowPage: { isShowPage: {
default: true 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 @@ ...@@ -126,8 +126,18 @@
isShowPage="true" isShowPage="true"
> >
<template v-slot:operation="scope"> <template v-slot:operation="scope">
<el-button type="text" @click="statusHandle">开启</el-button> <el-button
<el-button type="text" @click="statusHandle">关闭</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 <el-button
type="text" type="text"
@click="statusHandle" @click="statusHandle"
...@@ -137,9 +147,36 @@ ...@@ -137,9 +147,36 @@
<el-button <el-button
type="text" type="text"
@click="handleBtnClick(scope.scope.row)" @click="handleBtnClick(scope.scope.row)"
v-if="activeTab != 'b45827c068254695864ee3c1d42573cb'" v-if="
activeTab == '303310efddb34a2e9bf269bdff8a7dc5' ||
activeTab == 'f4c840711eae4bcb9536a890cdfda493'
"
>设置频率</el-button >设置频率</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> </template>
</enTable> </enTable>
</div> </div>
...@@ -150,6 +187,7 @@ ...@@ -150,6 +187,7 @@
@parentMethod="getDataList" @parentMethod="getDataList"
></table-pagination> ></table-pagination>
<hall-modal ref="hallModal"></hall-modal> <hall-modal ref="hallModal"></hall-modal>
<set-up-and-down ref="setUpAndDown"></set-up-and-down>
</div> </div>
</template> </template>
<script> <script>
...@@ -158,6 +196,7 @@ import enTable from '../../components/enTable' ...@@ -158,6 +196,7 @@ import enTable from '../../components/enTable'
import enTabs from '../../components/enTabs' import enTabs from '../../components/enTabs'
import hallModal from './components/hallModal' import hallModal from './components/hallModal'
import tablePagination from '@/pages/components/tablePagination' import tablePagination from '@/pages/components/tablePagination'
import setUpAndDown from './components/setUpAndDown.vue'
import { import {
tableColumsOne, tableColumsOne,
...@@ -172,7 +211,8 @@ export default { ...@@ -172,7 +211,8 @@ export default {
enTable, enTable,
enTabs, enTabs,
hallModal, hallModal,
tablePagination tablePagination,
setUpAndDown
}, },
data() { data() {
return { return {
...@@ -208,7 +248,7 @@ export default { ...@@ -208,7 +248,7 @@ export default {
tableData: [], tableData: [],
tableColums: tableColumsOne, tableColums: tableColumsOne,
isSaving: 1, //节能 isSaving: 1, //节能
isOpen: 1, //定时开关 isOpen: 2, //定时开关
formData: { formData: {
temperature: '', temperature: '',
taskId: '', taskId: '',
...@@ -432,17 +472,18 @@ export default { ...@@ -432,17 +472,18 @@ export default {
} }
}) })
}, },
cancelhandle() {
this.$nextTick(() => {
this.hallModalVisible = false
})
},
// 设置频率 // 设置频率
handleBtnClick(data) { handleBtnClick(data) {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.hallModal.init(data) this.$refs.hallModal.init(data)
}) })
}, },
// 定时升降
handleUpAndDownBtnClick(data) {
this.$nextTick(() => {
this.$refs.setUpAndDown.init()
})
},
handleType(id) { handleType(id) {
if (id !== this.currentId) { if (id !== this.currentId) {
this.active = true this.active = true
...@@ -510,8 +551,6 @@ export default { ...@@ -510,8 +551,6 @@ export default {
this.$message.error('定时功能启止时间不能为空!') this.$message.error('定时功能启止时间不能为空!')
return return
} }
this.isOpen = type
this.$http({ this.$http({
url: this.$http.adornUrl('/equipment/timedTask'), url: this.$http.adornUrl('/equipment/timedTask'),
method: 'post', method: 'post',
...@@ -519,6 +558,7 @@ export default { ...@@ -519,6 +558,7 @@ export default {
taskId: this.formData.taskId ? this.formData.taskId : '', taskId: this.formData.taskId ? this.formData.taskId : '',
startTime: this.formData.startTime, startTime: this.formData.startTime,
endTime: this.formData.endTime, endTime: this.formData.endTime,
businessType: 1,
status: type status: type
}) })
}).then((data) => { }).then((data) => {
...@@ -528,6 +568,7 @@ export default { ...@@ -528,6 +568,7 @@ export default {
} else { } else {
this.$message.success('关闭定时任务成功') this.$message.success('关闭定时任务成功')
} }
this.isOpen = type
this.getAllHcdt() this.getAllHcdt()
} }
}) })
......
...@@ -19,36 +19,8 @@ ...@@ -19,36 +19,8 @@
isShowPage="true" isShowPage="true"
> >
<template v-slot:operation="scope"> <template v-slot:operation="scope">
<el-button <el-button type="text" @click="statusHandle">开启</el-button>
type="text" <el-button type="text" @click="statusHandle">关闭</el-button>
@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
>
</template> </template>
</en-table> </en-table>
</div> </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