Files
hht-shangdianke-uni/pages/manage/task-flow.vue

133 lines
3.7 KiB
Vue
Raw Normal View History

2024-02-18 18:00:04 +08:00
<template>
<view class="zd_container">
<nav-bar title="任务流转"></nav-bar>
<view class="zd_content">
<view class="flow_wrapper" v-for="e in dataList" :key="e.point_code">
<view class="zd-row">
<view class="zd-col-24">
<view class="zd-row">
<view class="zd-col-2">
<view class="zd-row flow_icon_item_1">
<view class="iconfont icon_start_point">&#xe820;</view>
</view>
</view>
<view class="zd-col-22">
2024-02-19 14:08:44 +08:00
<view class="zd-row flow_start_item" @tap="checkcode1(e)" :class="{'flow_start_item_checked': pkId1 === e.point_id}">
2024-02-19 09:11:53 +08:00
<view class="zd-col-8 pdl20 pdr20 font-size-1">{{e.point_code}}</view>
<view class="zd-col-16 pdr20 font-size-2">{{e.point_name}}</view>
2024-02-18 18:00:04 +08:00
<view v-show="pkId1 === e.point_code" class="iconfont icon_choosed">&#xe66b;</view>
</view>
</view>
</view>
</view>
</view>
<view class="zd-row">
<view class="zd-col-24">
<view class="zd-row flow_icon_item_2">
<view class="iconfont icon_vdash_line">&#xe603;</view>
</view>
</view>
</view>
<view class="zd-row">
<view class="zd-col-24">
<view class="zd-row flexstart">
<view class="zd-col-2">
<view class="zd-row flow_icon_item_1">
<view class="iconfont icon_start_point">&#xe61f;</view>
</view>
</view>
<view class="zd-col-22">
2024-02-19 14:08:44 +08:00
<view class="zd-row mgb10 flow_start_item" v-for="el in e.end_points" :key="el.point_code" @tap="checkcode2(el, e)" :class="{'flow_start_item_checked': pkId2 === el.point_id}">
2024-02-19 09:11:53 +08:00
<view class="zd-col-8 pdl20 pdr20 font-size-1">{{el.point_code}}</view>
<view class="zd-col-16 pdr20 font-size-2">{{el.point_name}}</view>
2024-02-18 18:00:04 +08:00
<view v-show="pkId2 === el.point_code" class="iconfont icon_choosed">&#xe66b;</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="submit-bar_new">
<button class="zd-col-24 submit-button_new" :class="{'btn-disabled': !pkId1}" :disabled="disabled" @tap="toSure">生成任务</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryAllPoints, createP2pTask} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
dataList: [],
disabled: false,
pkId1: '',
2024-02-19 09:48:42 +08:00
pkId2: '',
2024-02-19 14:08:44 +08:00
pid1: '',
pid2: '',
pd2: ''
2024-02-18 18:00:04 +08:00
};
},
created () {
this._queryAllPoints()
},
methods: {
/** 初始化查询 */
async _queryAllPoints () {
let res = await queryAllPoints()
this.dataList = [...res]
},
checkcode1 (e) {
2024-02-19 14:08:44 +08:00
if (this.pid2 !== '' && e.point_id !== this.pid2) {
2024-02-19 09:48:42 +08:00
this.pkId2 = ''
2024-02-19 14:08:44 +08:00
this.pid2 = ''
this.pd2 = ''
2024-02-19 09:48:42 +08:00
}
2024-02-19 14:08:44 +08:00
this.pkId1 = this.pkId1 === e.point_id ? '' : e.point_id
this.pid1 = this.pkId1 === e.point_id ? e.point_code : ''
2024-02-18 18:00:04 +08:00
},
2024-02-19 09:48:42 +08:00
checkcode2 (el, e) {
2024-02-19 14:08:44 +08:00
if (this.pkId1 !== '' && this.pkId1 !== e.point_id) {
2024-02-19 09:48:42 +08:00
return
}
2024-02-19 14:08:44 +08:00
this.pkId2 = this.pkId2 === el.point_id ? '' : el.point_id
this.pid2 = this.pkId2 === el.point_id ? e.point_id : ''
this.pd2 = this.pkId2 === el.point_id ? el.point_code : ''
2024-02-18 18:00:04 +08:00
},
/** 重新下发 */
async toSure () {
this.disabled = true
if (!this.pkId1) {
this.disabled = false
return
}
try {
2024-02-19 14:08:44 +08:00
let res = await createP2pTask(this.pid1, this.pd2)
2024-02-18 18:00:04 +08:00
this.disabled = false
this.pkId1 = ''
this.pkId2 = ''
2024-02-19 14:08:44 +08:00
this.pid1 = ''
this.pid2 = ''
this.pd2 = ''
2024-02-18 18:00:04 +08:00
this._queryAllPoints()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
}
}
}
</script>
<style lang="stylus">
</style>