#
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,20 +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 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: {
@@ -115,13 +138,10 @@
         }
      },
      onLoad(option) { 
         if (option != '') {
         this.current = 1
         if (JSON.stringify(option) != "{}") {
            this.id = option.id
            this.init()
            this.autoLoad('follower','')
            setTimeout(()=>{
               this.getFollowers()
            },500)
         } else {
            let _this = this
            const eventChannel = this.getOpenerEventChannel();
@@ -129,14 +149,23 @@
               _this.id = data.data
               _this.init()
            })
            this.autoLoad('follower','')
            setTimeout(()=>{
               this.getFollowers()
            },500)
         }
      },
      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 = []
@@ -146,70 +175,91 @@
               method: 'GET',
               success(res) {
                  res = res.data
                  console.log(res);
                  that.detl = res.data
                  that.active = res.data.settle
                  that.list1 = JSON.parse(res.data.settleMsg)
                  for (let key of that.list1) {
                     key.desc = key.username
                  if (res.code === 200) {
                     that.detl = res.data
                     that.active = res.data.settle
                     that.list1 = JSON.parse(res.data.settleMsg)
                     for (let key of that.list1) {
                        key.desc = key.username
                     }
                     that.current = res.data.settle-1
                     if (res.data.planType == 4) {
                        switch(res.data.select_2) {
                           case 'value1':
                              res.data.select_2 = '横梁式'
                              break;
                           case 'value2':
                              res.data.select_2 = '驶入式'
                              break;
                           case 'value3':
                              res.data.select_2 = '悬梁式'
                              break;
                           case 'value4':
                              res.data.select_2 = '流利式'
                              break;
                           case 'value5':
                              res.data.select_2 = '重力式'
                              break;
                           case 'value6':
                              res.data.select_2 = '其他'
                              break;
                        }
                        that.info.push(
                        {name:'货物规格',val:res.data.input_1},
                        {name:'货物重量',val:res.data.input_2},
                        {name:'仓库温度',val:res.data.input_6},
                        {name:'顶部最低点离地距离',val:res.data.input_8},
                        {name:'进叉方向',val:res.data.input_4},
                        {name:'厂房可用高度',val:res.data.input_5},
                        {name:'通道大小有无要求',val:res.data.input_7},
                        {name:'平库货架类型',val:res.data.select_2},
                        {name:'是否需要跨梁',val:res.data.radio_1 == 'value1' ? '是' : '否'},
                        {name:'是否需要网层板',val:res.data.radio_2 == 'value1' ? '是' : '否'},
                        {name:'是否需要层板',val:res.data.radio_8 == 'value1' ? '是' : '否'},
                        {name:'地面有无电缆沟',val:res.data.radio_3 == 'value1' ? '是' : '否'},
                        {name:'地面平整度和地面沉降是否满足标准',val:res.data.radio_5 == 'value1' ? '是' : '否'},
                        {name:'布局区域是否提供CAD场地图纸/场地',val:res.data.radio_7 == 'value1' ? '是' : '否'},
                        {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},
                        {name:'厂房可用高度',val:res.data.input_4},
                        {name:'顶部最低点离地距离',val:res.data.input_9},
                        {name:'进叉方向',val:res.data.input_3},
                        {name:'仓库温度',val:res.data.input_7},
                        {name:'抗震设防烈度',val:res.data.input_6},
                        {name:'基本地震加速度',val:res.data.input_11},
                        {name:'客户技术对接联系方式(选填)',val:res.data.input_8},
                        {name:'立体库货架类型',val:res.data.select_3},
                        {name:'是否有消防要求',val:res.data.radio_5 == 'value1' ? '是' : '否'},
                        {name:'否需要货架背网',val:res.data.radio_8 == 'value1' ? '是' : '否'},
                        {name:'地面有无电缆沟',val:res.data.radio_7 == 'value1' ? '是' : '否'},
                        {name:'布局区域是否提供CAD场地图纸/场地',val:res.data.radio_6 == 'value1' ? '是' : '否'},
                        {name:'地面平整度和地面沉降是否满足标准',val:res.data.radio_10 == 'value1' ? '是' : '否'},
                        {name:'其他要求及注意点',val:res.data.textarea_2 ? res.data.textarea_2 : '--'},
                        )
                     }
                  }
                  that.current = res.data.settle-1
                  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;
                  }
                  if (res.data.planType == 4) {
                     that.info.push(
                     {name:'货物规格',val:res.data.input_1},
                     {name:'货物重量',val:res.data.input_2},
                     {name:'仓库温度',val:res.data.input_6},
                     {name:'顶部最低点离地距离',val:res.data.input_8},
                     {name:'进叉方向',val:res.data.input_4},
                     {name:'厂房可用高度',val:res.data.input_5},
                     {name:'通道大小有无要求',val:res.data.input_7},
                     {name:'平库货架类型',val:res.data.select_2},
                     {name:'是否需要跨梁',val:res.data.radio_1 == 'value1' ? '是' : '否'},
                     {name:'是否需要网层板',val:res.data.radio_2 == 'value1' ? '是' : '否'},
                     {name:'是否需要层板',val:res.data.radio_8 == 'value1' ? '是' : '否'},
                     {name:'地面有无电缆沟',val:res.data.radio_3 == 'value1' ? '是' : '否'},
                     {name:'地面平整度和地面沉降是否满足标准',val:res.data.radio_5 == 'value1' ? '是' : '否'},
                     {name:'布局区域是否提供CAD场地图纸/场地',val:res.data.radio_7 == 'value1' ? '是' : '否'},
                     {name:'其他要求及注意点',val:res.data.textarea_2 ? res.data.textarea_2 : '--'},
                     )
                  } else if(res.data.planType == 5) {
                     that.info.push(
                     {name:'货物规格',val:res.data.input_2},
                     {name:'货物重量',val:res.data.input_5},
                     {name:'厂房可用高度',val:res.data.input_4},
                     {name:'顶部最低点离地距离',val:res.data.input_9},
                     {name:'进叉方向',val:res.data.input_3},
                     {name:'仓库温度',val:res.data.input_7},
                     {name:'抗震设防烈度',val:res.data.input_6},
                     {name:'基本地震加速度',val:res.data.input_11},
                     {name:'客户技术对接联系方式(选填)',val:res.data.input_8},
                     {name:'立体库货架类型',val:res.data.select_3},
                     {name:'是否有消防要求',val:res.data.radio_5 == 'value1' ? '是' : '否'},
                     {name:'否需要货架背网',val:res.data.radio_8 == 'value1' ? '是' : '否'},
                     {name:'地面有无电缆沟',val:res.data.radio_7 == 'value1' ? '是' : '否'},
                     {name:'布局区域是否提供CAD场地图纸/场地',val:res.data.radio_6 == 'value1' ? '是' : '否'},
                     {name:'地面平整度和地面沉降是否满足标准',val:res.data.radio_10 == 'value1' ? '是' : '否'},
                     {name:'其他要求及注意点',val:res.data.textarea_2 ? res.data.textarea_2 : '--'},
                     )
                  }
                  // that.cstmrId = that.cstmr.id
               }
            })
         },
         // 删除
         del(e) {
            let that = this
            e = Number(e)
@@ -238,89 +288,120 @@
         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
                     }
                  }
               }
            })
         },
         getFollowers() {
            let that = this
         edite(id) {
            let _this = this,url = '';
            switch(this.detl.planType) {
               case 4:
                  url = `/pages/business/plan/modiPlan?id=${id}`
                  break
               case 5:
                  url = `/pages/business/plan/modiPlan2?id=${id}`
                  break
               case 6:
                  url = `/pages/business/plan/modiPlan3?id=${id}`
                  break
               case 7:
                  url = `/pages/business/plan/modiPlan4?id=${id}`
                  break
               case 8:
                  url = `/pages/business/plan/modiPlan5?id=${id}`
                  break
               case 9:
                  url = `/pages/business/plan/modiPlan6?id=${id}`
                  break
               case 11:
                  url = `/pages/business/plan/modiPlan7?id=${id}`
                  break
            }
            uni.navigateTo({
               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: that.baseUrl + '/detl/followers/table/auth',
               header:{'token':uni.getStorageSync('token')},
               data: {cstmrId:that.cstmrId},
               method:'GET',
               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
                  that.followers = res.data
                  uni.showToast({title: res.msg, icon: "none", position: 'top'})
                  uni.navigateBack()
               }
            })
         },
         removeFollowers(userId) {
            let that = this
         approvalEnd() {
            let _this = this
            uni.request({
               url: that.baseUrl + '/cstmr/followers/remove/auth',
               header:{
               url: `${_this.baseUrl}/plan/approvalEnd/auth`,
               header: {
                  'token':uni.getStorageSync('token'),
                  'content-type': 'application/x-www-form-urlencoded'
                  'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
               },
               data: {
                  cstmrId:that.cstmrId,
                  userId: userId
                  },
               method:'POST',
               sslVerify: false,
               data: { planId: _this.detl.id },
               method: 'POST',
               success(res) {
                  res = res.data
                  that.getFollowers()
                  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>