#
zjj
2024-04-07 e6a02c8b09a796e436a501e9b87d19e25c34c9d1
pages/business/plan/planDetails.vue
@@ -31,8 +31,8 @@
         </view>
         <!-- 其他信息 -->
         <view class="container">
            <view><y-title title="其他信息"></y-title></view><view></view>
         <view class="container" v-show="info.length > 0">
            <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 = []
@@ -142,7 +175,6 @@
               method: 'GET',
               success(res) {
                  res = res.data
                  console.log(res);
                  if (res.code === 200) {
                     that.detl = res.data
                     that.active = res.data.settle
@@ -190,6 +222,20 @@
                        {name:'其他要求及注意点',val:res.data.textarea_2 ? res.data.textarea_2 : '--'},
                        )
                     } else if(res.data.planType == 5) {
                        switch(res.data.select_3) {
                           case 'value1':
                              res.data.select_3 = '牛腿式'
                              break;
                           case 'value2':
                              res.data.select_3 = '横梁式'
                              break;
                           case 'value3':
                              res.data.select_3 = '新能源'
                              break;
                           case 'value4':
                              res.data.select_3 = '其他'
                              break;
                        }
                        that.info.push(
                        {name:'货物规格',val:res.data.input_2},
                        {name:'货物重量',val:res.data.input_5},
@@ -213,6 +259,7 @@
               }
            })
         },
         // 删除
         del(e) {
            let that = this
            e = Number(e)
@@ -241,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
                     }
                  }
               }
@@ -301,7 +322,7 @@
               case 5:
                  url = `/pages/business/plan/modiPlan2?id=${id}`
                  break
               case 3:
               case 6:
                  url = `/pages/business/plan/modiPlan3?id=${id}`
                  break
               case 7:
@@ -322,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>