|
@@ -5,21 +5,20 @@
|
|
<view class="device-bottom">
|
|
<view class="device-bottom">
|
|
<view
|
|
<view
|
|
class="info-box"
|
|
class="info-box"
|
|
- v-for="(item, index) in modules"
|
|
|
|
|
|
+ v-for="(item, index) in selectedPlan"
|
|
:key="index"
|
|
:key="index"
|
|
>
|
|
>
|
|
<view class="info-text">
|
|
<view class="info-text">
|
|
<text>{{ item.name }}</text>
|
|
<text>{{ item.name }}</text>
|
|
- <text>({{ item.width }}*{{ item.length }})cm</text>
|
|
|
|
</view>
|
|
</view>
|
|
<view class="edit_del">
|
|
<view class="edit_del">
|
|
<image
|
|
<image
|
|
- @click="deleteItem(index)"
|
|
|
|
|
|
+ @click="deleteItem(item)"
|
|
src="../../static/delete.png"
|
|
src="../../static/delete.png"
|
|
alt=""
|
|
alt=""
|
|
></image>
|
|
></image>
|
|
<image
|
|
<image
|
|
- @click="editItem(index)"
|
|
|
|
|
|
+ @click="editItem(item)"
|
|
style="margin-left: 10rpx"
|
|
style="margin-left: 10rpx"
|
|
src="../../static/edit.png"
|
|
src="../../static/edit.png"
|
|
alt=""
|
|
alt=""
|
|
@@ -29,25 +28,209 @@
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
- <view class="bottomTwo" @click="saveRoom">
|
|
|
|
- <view class="addNewAlarm">新增设备告警计划</view>
|
|
|
|
- <view class="previousTip">保存</view>
|
|
|
|
|
|
+ <view class="bottomTwo">
|
|
|
|
+ <view class="addNewAlarm" @click="addNewAlarm">新增守护计划</view>
|
|
|
|
+ </view>
|
|
|
|
+
|
|
|
|
+ <!-- 选择守护计划遮罩层 -->
|
|
|
|
+ <view v-if="showPopup" class="mask" @click="showPopup = false"></view>
|
|
|
|
+
|
|
|
|
+ <view v-if="showPopup" class="popup">
|
|
|
|
+ <view class="popup-body">
|
|
|
|
+ <picker
|
|
|
|
+ mode="selector"
|
|
|
|
+ :range="planListName"
|
|
|
|
+ @change="bindPickerChange"
|
|
|
|
+ :value="selectedIndex"
|
|
|
|
+ >
|
|
|
|
+ <view class="picker-text">
|
|
|
|
+ {{
|
|
|
|
+ planListName[selectedIndex] ||
|
|
|
|
+ "点击此处选择守护计划"
|
|
|
|
+ }}
|
|
|
|
+ </view>
|
|
|
|
+ </picker>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="popup-footer">
|
|
|
|
+ <view class="cancel-btn" @click="showPopup = false">
|
|
|
|
+ 取消
|
|
|
|
+ </view>
|
|
|
|
+ <view type="primary" @click="confirmSelect" class="sure-btn">
|
|
|
|
+ 确定
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
- return { modules: [] };
|
|
|
|
|
|
+ return {
|
|
|
|
+ devInfo: {},
|
|
|
|
+ showPopup: false,
|
|
|
|
+ planList: [],
|
|
|
|
+ planListName: [],
|
|
|
|
+ selectedIndex: null,
|
|
|
|
+ // 已经新增的守护计划
|
|
|
|
+ selectedPlan: [],
|
|
|
|
+ };
|
|
},
|
|
},
|
|
computed: {},
|
|
computed: {},
|
|
methods: {
|
|
methods: {
|
|
- saveRoom() {
|
|
|
|
- console.log("保存");
|
|
|
|
|
|
+ getPlanList() {
|
|
|
|
+ this.$http
|
|
|
|
+ .post("wap/alarm/plan/queryTpl", {
|
|
|
|
+ eventVal: "",
|
|
|
|
+ name: "",
|
|
|
|
+ })
|
|
|
|
+ .then((res) => {
|
|
|
|
+ if (res.data.code == 200) {
|
|
|
|
+ if (res.data.data.length > 0) {
|
|
|
|
+ this.planList = res.data.data;
|
|
|
|
+ this.planListName = res.data.data.map(
|
|
|
|
+ (ele) => ele.name
|
|
|
|
+ );
|
|
|
|
+ console.log(this.planList, 99999);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ confirmSelect() {
|
|
|
|
+ if (this.selectedIndex !== null) {
|
|
|
|
+ let selectedPlan = this.planList.find(
|
|
|
|
+ (plan) => plan.name == this.planListName[this.selectedIndex]
|
|
|
|
+ );
|
|
|
|
+ selectedPlan.clientId = this.devInfo.clientId;
|
|
|
|
+ if (!selectedPlan.alarmTimePlan) {
|
|
|
|
+ this.$set(selectedPlan, "alarmTimePlan", {});
|
|
|
|
+ }
|
|
|
|
+ selectedPlan.alarmTimePlan.startDate = this.$time(
|
|
|
|
+ new Date(),
|
|
|
|
+ 1
|
|
|
|
+ );
|
|
|
|
+ selectedPlan.alarmTimePlan.stopDate = this.$time(
|
|
|
|
+ new Date(
|
|
|
|
+ new Date().setFullYear(new Date().getFullYear() + 1)
|
|
|
|
+ ),
|
|
|
|
+ 1
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ this.$http
|
|
|
|
+ .post(
|
|
|
|
+ "wap/alarm/plan/save",
|
|
|
|
+ {
|
|
|
|
+ ...selectedPlan,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ header: {
|
|
|
|
+ "Content-Type":
|
|
|
|
+ "application/json;charset=UTF-8",
|
|
|
|
+ token: uni.getStorageSync("tokenValue") || "",
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ .then((res) => {
|
|
|
|
+ if (res.data.code == 200) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: "添加计划成功",
|
|
|
|
+ icon: "success",
|
|
|
|
+ duration: 1500,
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: res.data.message,
|
|
|
|
+ icon: "none",
|
|
|
|
+ duration: 1500,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ this.getSelectPlan();
|
|
|
|
+ });
|
|
|
|
+ this.showPopup = false;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ bindPickerChange(e) {
|
|
|
|
+ this.selectedIndex = e.detail.value;
|
|
|
|
+ },
|
|
|
|
+ addNewAlarm() {
|
|
|
|
+ this.showPopup = true;
|
|
|
|
+ },
|
|
|
|
+ getSelectPlan() {
|
|
|
|
+ this.$http
|
|
|
|
+ .post(
|
|
|
|
+ "wap/alarm/plan/query",
|
|
|
|
+ {
|
|
|
|
+ clientId: this.devInfo.clientId,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ header: {
|
|
|
|
+ "Content-Type": "application/json;charset=UTF-8",
|
|
|
|
+ token: uni.getStorageSync("tokenValue") || "",
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ .then((res) => {
|
|
|
|
+ if (res.data.code == 200) {
|
|
|
|
+ if (res.data.data.length > 0) {
|
|
|
|
+ this.selectedPlan = res.data.data;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ deleteItem(item) {
|
|
|
|
+ uni.showModal({
|
|
|
|
+ content: "是否删除该计划",
|
|
|
|
+ complete: (res) => {
|
|
|
|
+ if (res.confirm) {
|
|
|
|
+ this.$http
|
|
|
|
+ .post(
|
|
|
|
+ "wap/alarm/plan/del",
|
|
|
|
+ {
|
|
|
|
+ id: item.id,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ header: {
|
|
|
|
+ "Content-Type":
|
|
|
|
+ "application/json;charset=UTF-8",
|
|
|
|
+ token:
|
|
|
|
+ uni.getStorageSync("tokenValue") ||
|
|
|
|
+ "",
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ .then((res) => {
|
|
|
|
+ if (res.data.code == 200) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: "守护计划删除成功",
|
|
|
|
+ icon: "success",
|
|
|
|
+ duration: 1500,
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: res.data.message,
|
|
|
|
+ icon: "none",
|
|
|
|
+ duration: 1500,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ this.getSelectPlan();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if (res.cancel) {
|
|
|
|
+ }
|
|
|
|
+ return;
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ editItem(item) {
|
|
|
|
+ console.log(item, 88888);
|
|
},
|
|
},
|
|
},
|
|
},
|
|
- onLoad(options) {},
|
|
|
|
- onShow() {},
|
|
|
|
|
|
+ onLoad(options) {
|
|
|
|
+ this.devInfo = JSON.parse(options.devInfo);
|
|
|
|
+ this.getSelectPlan();
|
|
|
|
+ },
|
|
|
|
+ onShow() {
|
|
|
|
+ this.getPlanList();
|
|
|
|
+ },
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
<style lang="less" scoped>
|
|
<style lang="less" scoped>
|
|
@@ -152,10 +335,11 @@ export default {
|
|
height: 120rpx;
|
|
height: 120rpx;
|
|
background: #f3e2dd;
|
|
background: #f3e2dd;
|
|
.addNewAlarm {
|
|
.addNewAlarm {
|
|
|
|
+ margin: 0 auto;
|
|
display: flex;
|
|
display: flex;
|
|
align-items: center;
|
|
align-items: center;
|
|
justify-content: center;
|
|
justify-content: center;
|
|
- width: 400rpx;
|
|
|
|
|
|
+ width: 700rpx;
|
|
height: 94rpx;
|
|
height: 94rpx;
|
|
background: #ffebe4;
|
|
background: #ffebe4;
|
|
border-radius: 28rpx;
|
|
border-radius: 28rpx;
|
|
@@ -164,21 +348,62 @@ export default {
|
|
font-size: 32rpx;
|
|
font-size: 32rpx;
|
|
text-align: center;
|
|
text-align: center;
|
|
}
|
|
}
|
|
- .previousTip {
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .mask {
|
|
|
|
+ position: fixed;
|
|
|
|
+ top: 0;
|
|
|
|
+ left: 0;
|
|
|
|
+ right: 0;
|
|
|
|
+ bottom: 0;
|
|
|
|
+ background: rgba(0, 0, 0, 0.4);
|
|
|
|
+ z-index: 99;
|
|
|
|
+ }
|
|
|
|
+ .popup {
|
|
|
|
+ position: fixed;
|
|
|
|
+ left: 50%;
|
|
|
|
+ top: 50%;
|
|
|
|
+ transform: translate(-50%, -50%);
|
|
|
|
+ width: 500rpx;
|
|
|
|
+ background: #fff;
|
|
|
|
+ border-radius: 16rpx;
|
|
|
|
+ padding: 20rpx;
|
|
|
|
+ z-index: 100;
|
|
|
|
+ .popup-body {
|
|
|
|
+ text-align: center;
|
|
|
|
+ margin-bottom: 20rpx;
|
|
|
|
+
|
|
|
|
+ .picker-text {
|
|
|
|
+ padding: 20rpx;
|
|
|
|
+ border-radius: 8rpx;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ .popup-footer {
|
|
display: flex;
|
|
display: flex;
|
|
- align-items: center;
|
|
|
|
- justify-content: center;
|
|
|
|
- width: 328rpx;
|
|
|
|
- height: 94rpx;
|
|
|
|
- background: linear-gradient(105.95deg, #a27867 0%, #74483d 100%);
|
|
|
|
- border-radius: 28rpx;
|
|
|
|
- box-shadow: 0rpx 4.69rpx 18.75rpx rgba(72, 41, 29, 0.15),
|
|
|
|
- 0rpx 9.38rpx 9.38rpx rgba(154, 132, 89, 0.2),
|
|
|
|
- 0rpx -4.69rpx 28.13rpx 4.69rpx #a16647 inset;
|
|
|
|
- font-family: MiSans;
|
|
|
|
- font-weight: 500;
|
|
|
|
- color: #ffffff;
|
|
|
|
- font-size: 32rpx;
|
|
|
|
|
|
+ justify-content: space-around;
|
|
|
|
+ margin-top: 40rpx;
|
|
|
|
+ .cancel-btn {
|
|
|
|
+ width: 200rpx;
|
|
|
|
+ height: 75rpx;
|
|
|
|
+ background: #ffebe4;
|
|
|
|
+ line-height: 75rpx;
|
|
|
|
+ border-radius: 28rpx;
|
|
|
|
+ font-weight: 500;
|
|
|
|
+ color: #111111;
|
|
|
|
+ font-size: 32rpx;
|
|
|
|
+ text-align: center;
|
|
|
|
+ }
|
|
|
|
+ .sure-btn {
|
|
|
|
+ width: 200rpx;
|
|
|
|
+ height: 75rpx;
|
|
|
|
+ background: #4f372e;
|
|
|
|
+ line-height: 75rpx;
|
|
|
|
+ border-radius: 28rpx;
|
|
|
|
+ font-weight: 500;
|
|
|
|
+ color: #ffffff;
|
|
|
|
+ font-size: 32rpx;
|
|
|
|
+ text-align: center;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|