From e6a02c8b09a796e436a501e9b87d19e25c34c9d1 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期日, 07 四月 2024 15:53:37 +0800
Subject: [PATCH] #
---
pages/business/plan/planDetails.vue | 155 +++++++++++++++++++++++++++++++++++++--------------
1 files changed, 111 insertions(+), 44 deletions(-)
diff --git a/pages/business/plan/planDetails.vue b/pages/business/plan/planDetails.vue
index 4a4f5b4..63a50e9 100644
--- a/pages/business/plan/planDetails.vue
+++ b/pages/business/plan/planDetails.vue
@@ -32,7 +32,7 @@
<!-- 鍏朵粬淇℃伅 -->
<view class="container" v-show="info.length > 0">
- <view><y-title title="涓柊鍗庨厤缃�"></y-title></view><view></view>
+ <view><y-title title="涓�у寲"></y-title></view><view></view>
</view>
<view class="detail-box">
<plan-detail :info="info"></plan-detail>
@@ -63,25 +63,43 @@
<view>
<!-- 杈撳叆妗嗙ず渚� -->
<uni-popup ref="inputDialog" type="dialog">
- <uni-popup-dialog ref="inputClose" mode="input" title="娣诲姞璺熻繘浜�" value="瀵硅瘽妗嗛缃彁绀哄唴瀹�!"
+ <uni-popup-dialog ref="inputClose" mode="input" title="閫夋嫨瑙勫垝鍛�"
placeholder="璇疯緭鍏ュ唴瀹�" @confirm="confirm">
- <uni-combox :candidates="addFollower.followers" placeholder="璇烽�夋嫨"
- v-model="addFollower.follower" @input="autoLoad('follower',addFollower.follower)"></uni-combox>
+ <uni-combox :candidates="planners" placeholder="璇烽�夋嫨"
+ v-model="planner" @input="autoLoad('planner',planner)"></uni-combox>
</uni-popup-dialog>
</uni-popup>
</view>
<view class="foot">
- <button size="mini" type="primary" @click="edite(id)">淇敼</button>
- <button size="mini" type="warn" @click="del(id)">鍒犻櫎</button>
+ <button v-show="((((detl.settle == 2 || detl.settle == 3) && detl.settleSize==4) || detl.settle == 1) && user.id == detl.director)"
+ size="mini" type="primary" @click="approval(id)">瀹℃壒</button>
+ <button v-show="(((detl.settle == 2 || detl.settle == 3)&& detl.settleSize==4) && user.id == detl.director)"
+ size="mini" type="primary" @click="approvalEnd(id)">鍥為��瀹℃壒</button>
+ <button v-show="(detl.settle == 1 && user.id == detl.userId)"
+ size="mini" type="primary" @click="edite(id)">淇敼</button>
+ <!-- <button size="mini" type="warn" @click="del(id)">鍒犻櫎</button> -->
</view>
</view>
</template>
<script>
+ import user from '@/pages/api/user/user.js'
export default {
data() {
return {
+ planner: '',
+ plannerId: '',
+ planners: [],
+ plannerList: [],
+ nowUserId: '', // 褰撳墠鐧诲綍浜哄憳 user.userId
+ director: '', // 褰撳墠鑺傜偣瀹℃牳 dire
+ userId: '', // 褰撳墠浠诲姟涓氬姟鍛� userid
+ user: {
+ username: '',
+ id: 0,
+ type: ''
+ },
current: 1,
id: 0,
detl: {
@@ -120,7 +138,8 @@
}
},
onLoad(option) {
- if (option != '') {
+ this.current = 1
+ if (JSON.stringify(option) != "{}") {
this.id = option.id
this.init()
} else {
@@ -132,7 +151,21 @@
})
}
},
+ onShow() {
+ this.getDetail()
+ },
methods: {
+ // 鑾峰彇鐢ㄦ埛淇℃伅
+ async getDetail() {
+ let res = await user.getDetail()
+ if (res.code === 200) {
+ this.user.username = res.data.username
+ this.user.id = res.data.id
+ } else if (res.code === 403) {
+ this.backLogin(res)
+ }
+ },
+ // 鍒濆鍖�
init() {
let that = this
that.info = []
@@ -226,6 +259,7 @@
}
})
},
+ // 鍒犻櫎
del(e) {
let that = this
e = Number(e)
@@ -254,52 +288,26 @@
addPerson() {
this.$refs.inputDialog.open()
},
- // 纭閫夋嫨宸ヤ綔浜�
- confirm() {
- let that = this
- var followerId
- var followerList = that.addFollower.followerList
- for (var i = 0;i < followerList.length; i++) {
- if (followerList[i].name == this.addFollower.follower) {
- followerId =followerList[i].value
- }
- }
- uni.request({
- url: that.baseUrl + '/detl/followers/add/json',
- header:{'token':uni.getStorageSync('token'),
- // 'content-type':'application/x-www-form-urlencoded',
- },
- data: {
- cstmrId: that.cstmrId,
- followerIds:followerId},
- method: 'POST',
- success(result) {
- var res = result.data
- that.getFollowers()
- }
- })
- this.addFollower.follower = ''
- },
// 宸ヤ綔浜哄垪琛�
autoLoad(type,condition) {
let that = this
- that.addFollower.followers = []
- that.addFollower.followerList = []
uni.request({
- url: that.baseUrl + '/user/all/get/kv',
- header:{'token':uni.getStorageSync('token')},
- data: {condition:condition},
+ url: that.baseUrl + '/plan/planner/list/auth',
+ header:{
+ 'token':uni.getStorageSync('token'),
+ 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
+ },
+ sslVerify: false,
+ data: {planId:condition},
method: 'POST',
success(result) {
var res = result.data
if (res.code === 200) {
- var element;
- if (type == 'follower') {
- for(element of res.data) {
- that.addFollower.followers.push(element.name)
- that.addFollower.followerList.push(element)
+ if (res.data) {
+ for (let k of res.data) {
+ that.planners.push(k.name)
+ that.plannerList.push(k)
}
- return
}
}
}
@@ -335,6 +343,65 @@
url: url
})
},
+ // 瀹℃壒
+ approval() {
+ let _this = this
+ this.$refs.inputDialog.open()
+ this.autoLoad("type",this.detl.id)
+ },
+ // 瑙勫垝鍛樺鎵�
+ confirm() {
+ for (let element of this.plannerList) {
+ if(element.value == this.planner) {
+ this.plannerId = element.value
+ }
+ }
+ let _this = this
+ uni.request({
+ url: `${_this.baseUrl}/plan/approval/auth`,
+ header: {
+ 'token':uni.getStorageSync('token'),
+ 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
+ },
+ sslVerify: false,
+ data: {
+ planId: _this.detl.id,
+ plannerId: _this.plannerId
+ },
+ method: 'POST',
+ success(res) {
+ res = res.data
+ uni.showToast({title: res.msg, icon: "none", position: 'top'})
+ uni.navigateBack()
+ }
+ })
+ },
+ approvalEnd() {
+ let _this = this
+ uni.request({
+ url: `${_this.baseUrl}/plan/approvalEnd/auth`,
+ header: {
+ 'token':uni.getStorageSync('token'),
+ 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
+ },
+ sslVerify: false,
+ data: { planId: _this.detl.id },
+ method: 'POST',
+ success(res) {
+ res = res.data
+ uni.showToast({title: res.msg, icon: "none", position: 'top'})
+ uni.navigateBack()
+ }
+ })
+ },
+ backLogin(res) {
+ uni.showToast({title: res.msg, icon: "none", position: 'top'})
+ setTimeout(() => {
+ uni.reLaunch({
+ url: '../../login/login'
+ });
+ }, 1000);
+ },
}
}
</script>
--
Gitblit v1.9.1