Commit 7ac950c958add1df4672653135e394bfb057c435

Authored by fengtao
1 parent 01d9c39a

feat:新增告警详情清除按钮

... ... @@ -70,8 +70,12 @@
70 70 <view><u--textarea border="none" height="96" placeholder="请输入处理结果" v-model="formModel.result" count></u--textarea></view>
71 71 </view>
72 72 <!-- #endif -->
73   - <view v-if="list.status !== 'CLEARED_ACK'" style="margin-top: 44rpx;display: flex;align-items: center;justify-content: center;">
74   - <view class="u-flex" style="width: 400rpx"><u-button @click="handleSubmit" type="primary" shape="circle" text="处理"></u-button></view>
  73 + <view style="margin-top: 44rpx;display: flex;align-items: center;justify-content: space-between;">
  74 + <view v-if="list.status !== 'CLEARED_ACK' && list.status !== 'ACTIVE_ACK'" class="u-flex" style="width: 260rpx">
  75 + <u-button @click="handleSubmit" type="primary" shape="circle" text="处理"></u-button>
  76 + </view>
  77 + <view style="width: 30rpx;"></view>
  78 + <view v-if="list.status == 'ACTIVE_ACK'" class="u-flex" style="width: 260rpx"><u-button @click="handleRemove" type="error" shape="circle" text="清除"></u-button></view>
75 79 </view>
76 80 </view>
77 81 </template>
... ... @@ -95,6 +99,7 @@ export default {
95 99 uni.hideTabBar();
96 100 },
97 101 methods: {
  102 + //处理
98 103 handleSubmit() {
99 104 if (this.formModel.result == '') return uni.$u.toast('请输入处理结果');
100 105 else
... ... @@ -121,6 +126,31 @@ export default {
121 126 uni.$u.toast(e.data?.message);
122 127 });
123 128 },
  129 + //清除
  130 + handleRemove() {
  131 + uni.$u.http
  132 + .post(`/alarm/${this.list.id}/clear`)
  133 + .then(res => {
  134 + if (res == '') {
  135 + uni.showToast({
  136 + title: '清除成功~',
  137 + icon: 'none'
  138 + });
  139 + let pages = getCurrentPages(); //获取所有页面栈实例列表
  140 + let nowPage = pages[pages.length - 1]; //当前页页面实例
  141 + let prevPage = pages[pages.length - 2]; //上一页页面实例
  142 + prevPage.$vm.detailStatus = true;
  143 + setTimeout(() => {
  144 + uni.navigateBack({
  145 + delta: 1
  146 + });
  147 + }, 500);
  148 + }
  149 + })
  150 + .catch(e => {
  151 + uni.$u.toast(e.data?.message);
  152 + });
  153 + },
124 154 formatDetailText(e) {
125 155 //去除字符串双引号
126 156 const jsonStr = JSON.stringify(e);
... ...