|
|
@@ -4,50 +4,65 @@
|
|
|
<van-cell :title="data.name">
|
|
|
<template #right-icon>
|
|
|
<van-button
|
|
|
- size="mini"
|
|
|
- color="#008cd6"
|
|
|
- type="info"
|
|
|
- @click.stop="updateStatus(data, '1');return false;"
|
|
|
- v-if="data.status != '1' && data.orgId == orgId"
|
|
|
- >布防时间登记</van-button
|
|
|
- >
|
|
|
- <van-button
|
|
|
- size="mini"
|
|
|
- color="#008cd6"
|
|
|
- type="info"
|
|
|
- @click.stop="updateStatus(data, '0');return false;"
|
|
|
- v-if="data.status != '0' && data.orgId == orgId"
|
|
|
- >撤防时间登记</van-button
|
|
|
- >
|
|
|
+ size="mini"
|
|
|
+ color="#008cd6"
|
|
|
+ type="info"
|
|
|
+ @click.stop="
|
|
|
+ openUpdateStateDialog(data, '1')
|
|
|
+ return false
|
|
|
+ "
|
|
|
+ v-if="data.status != '1' && data.orgId == orgId"
|
|
|
+ >布防时间登记</van-button
|
|
|
+ >
|
|
|
+ <van-button
|
|
|
+ size="mini"
|
|
|
+ color="#008cd6"
|
|
|
+ type="info"
|
|
|
+ @click.stop="
|
|
|
+ openUpdateStateDialog(data, '0')
|
|
|
+ return false
|
|
|
+ "
|
|
|
+ v-if="data.status != '0' && data.orgId == orgId"
|
|
|
+ >撤防时间登记</van-button
|
|
|
+ >
|
|
|
</template>
|
|
|
</van-cell>
|
|
|
- <van-cell title="布撤防状态" >
|
|
|
+ <van-cell title="布撤防状态">
|
|
|
<template #right-icon>
|
|
|
- <!-- <span v-if="data.status==1" style="color:rgb(0,164,46)">布防</span>
|
|
|
+ <!-- <span v-if="data.status==1" style="color:rgb(0,164,46)">布防</span>
|
|
|
<span v-else-if="data.status==0" style="color:rgb(215,0,15)">撤防</span> -->
|
|
|
- <span >{{getDictLabel(data.status, 'protection_status', '未上报')}}</span>
|
|
|
+ <span>{{ getDictLabel(data.status, 'protection_status', '未上报') }}</span>
|
|
|
</template>
|
|
|
</van-cell>
|
|
|
<van-cell
|
|
|
v-if="data.status == '0' || data.status == '1'"
|
|
|
:title="data.status == '0' ? '撤防时间' : '布防时间'"
|
|
|
- :value="data.statusUpdateTime"
|
|
|
- />
|
|
|
+ value-class="time-cell-default"
|
|
|
+ >
|
|
|
+ <template #default>
|
|
|
+ <van-tag type="primary" color="rgb(184,159,113)" v-if="data.statusUpdatorName!=null">人工登记</van-tag>
|
|
|
+ <van-tag type="primary" v-else>自动获取</van-tag>
|
|
|
+ <span style="margin-left:10px">{{data.statusChangeTime}}</span>
|
|
|
+ </template>
|
|
|
+ </van-cell>
|
|
|
+
|
|
|
</van-cell-group>
|
|
|
+ <state-change-diaolog ref="stateChangeDiaolog" @success="updateStatus"/>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import { mapGetters } from 'vuex'
|
|
|
import * as api from '@/api/protection.js'
|
|
|
import { Dialog } from 'vant'
|
|
|
+import StateChangeDiaolog from './dialog.stateChange.vue'
|
|
|
import dayjs from 'dayjs'
|
|
|
export default {
|
|
|
- components: {},
|
|
|
+ components: { StateChangeDiaolog },
|
|
|
data() {
|
|
|
return {}
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapGetters(['orgName', 'orgId','dictionary'])
|
|
|
+ ...mapGetters(['orgName', 'orgId', 'dictionary'])
|
|
|
},
|
|
|
watch: {},
|
|
|
props: {
|
|
|
@@ -58,30 +73,38 @@ export default {
|
|
|
formatDate(dateStr) {
|
|
|
return toFormatStr(dateStr)
|
|
|
},
|
|
|
- updateStatus(data, status) {
|
|
|
- Dialog.confirm({
|
|
|
- message: `是否更新${this.getDictLabel(status, 'protection_status', '未上报')}时间?`
|
|
|
+ openUpdateStateDialog(data, status) {
|
|
|
+ this.$refs.stateChangeDiaolog.open(data,status, this.getDictLabel(status, 'protection_status', '未知'))
|
|
|
+
|
|
|
+ // Dialog.confirm({
|
|
|
+ // message: `是否更新${this.getDictLabel(status, 'protection_status', '未上报')}时间?`
|
|
|
+ // })
|
|
|
+ // .then(() => {
|
|
|
+ // api.updateStatus(data.id, status).then(r => {
|
|
|
+ // if (r.data) {
|
|
|
+ // data.status = status
|
|
|
+ // data.statusUpdateTime = dayjs(r.data).format('YYYY-MM-DD HH:mm')
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // .catch(() => {
|
|
|
+ // // on cancel
|
|
|
+ // })
|
|
|
+ },
|
|
|
+ updateStatus(data, status,changeTime) {
|
|
|
+ api.updateStatus(data.id, status,changeTime).then(r => {
|
|
|
+ if (r.data) {
|
|
|
+ data.status = status
|
|
|
+ data.statusChangeTime = dayjs(changeTime).format('YYYY-MM-DD HH:mm')
|
|
|
+ }
|
|
|
})
|
|
|
- .then(() => {
|
|
|
- api.updateStatus(data.id, status).then(r => {
|
|
|
- if (r.data) {
|
|
|
- data.status = status
|
|
|
- data.statusUpdateTime = dayjs(r.data).format('YYYY-MM-DD HH:mm')
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- // on cancel
|
|
|
- })
|
|
|
},
|
|
|
itemClick() {
|
|
|
this.$router.push('/protection/detail?id=' + this.data.id)
|
|
|
}
|
|
|
},
|
|
|
async created() {},
|
|
|
- async mounted() {
|
|
|
-
|
|
|
- }
|
|
|
+ async mounted() {}
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
@@ -123,4 +146,8 @@ export default {
|
|
|
justify-content: center;
|
|
|
height: 100%;
|
|
|
}
|
|
|
+
|
|
|
+.time-cell-default{
|
|
|
+ min-width: 60vw;
|
|
|
+}
|
|
|
</style>
|