cyy преди 1 година
родител
ревизия
470adcc781

+ 50 - 0
src/api/platform/feature/changeShift.js

@@ -0,0 +1,50 @@
+import request from '@/utils/request'
+import { BPMN_URL } from '@/api/baseUrl'
+/**
+ * 获取调班列表数据
+ * @param {*} params
+ */
+export function queryAdjustment(data) {
+  return request({
+    url: BPMN_URL() + '/employee/adjustment/query',
+    method: 'post',
+    data
+  })
+}
+
+/**
+ * 获取调班记录详情
+ * @param {*} params
+ */
+export function getAdjustment(params) {
+  return request({
+    url: BPMN_URL() + '/employee/adjustment/get',
+    method: 'get',
+    params
+  })
+}
+
+/**
+ * 获取排班记录详情
+ * @param {*} params
+ */
+export function getStaffSchedule(params) {
+  return request({
+    url: BPMN_URL() + '/employee/staffSchedule/get',
+    method: 'get',
+    params
+  })
+}
+
+/**
+ * 保存排班
+ * @param {*} params
+ */
+export function saveStaffSchedule(data) {
+  return request({
+    url: BPMN_URL() + '/employee/staffSchedule/save',
+    method: 'post',
+    data
+  })
+}
+

+ 36 - 34
src/utils/action.js

@@ -14,7 +14,7 @@ import I18n from '@/utils/i18n'
 import common from '@/constants/common.js'
 
 const action = {
-  descDialog: function ({ title, message, className = 'ibps-dialog-desc', confirmButtonColor = '#3396FB', confirmButtonText = '知道了', overlay = true }) {
+  descDialog: function({ title, message, className = 'ibps-dialog-desc', confirmButtonColor = '#3396FB', confirmButtonText = '知道了', overlay = true }) {
     Dialog.alert({
       title,
       message,
@@ -25,7 +25,7 @@ const action = {
       messageAlign: 'left'
     })
   },
-  msg: function (message, options) {
+  msg: function(message, options) {
     if (!options) {
       options = options || {}
     }
@@ -35,7 +35,7 @@ const action = {
   /**
    * 操作警告提示
    */
-  warning: function (message) {
+  warning: function(message) {
     this.msg(message, {
       type: 'warning'
     })
@@ -43,12 +43,12 @@ const action = {
   /**
    * 操作成功提示
    */
-  success: function (message) {
+  success: function(message) {
     this.msg(message, {
       type: 'success'
     })
   },
-  error: function (message) {
+  error: function(message) {
     this.msg(message, {
       type: 'error'
     })
@@ -57,14 +57,14 @@ const action = {
    * 默认操作成功提示
    *  @param {*} message
    */
-  successMessage: function (message = I18n.t('common.dialog.operateSuccess')) {
+  successMessage: function(message = I18n.t('common.dialog.operateSuccess')) {
     this.success(message)
   },
   /**
    * 删除成功提示
    * @param {*} message
    */
-  removeSuccessMessage: function (message = I18n.t('common.dialog.removeSuccess')) {
+  removeSuccessMessage: function(message = I18n.t('common.dialog.removeSuccess')) {
     this.success(message)
   },
   /**
@@ -72,7 +72,7 @@ const action = {
  * @param {*} rows
  * @param {*} pkKey
  */
-  getSelectedIds: function (rows, pkKey = 'id') {
+  getSelectedIds: function(rows, pkKey = 'id') {
     const ids = []
     rows.forEach(row => {
       ids.push(row[pkKey])
@@ -86,7 +86,7 @@ const action = {
  *
  * @param {*} selection
  */
-  selectedRecord: function (selection) {
+  selectedRecord: function(selection) {
     return new Promise((resolve, reject) => {
       if (Utils.isEmpty(selection)) {
         this.warning(I18n.t('common.dialog.selectedRecords'))
@@ -111,7 +111,7 @@ const action = {
  * @param {*} isArray 是否数组格式返回 默认 false
  * @param {*} separator 分割符 默认 `,`
  */
-  selectedMultiRecord: function (selection, isArray = false, separator = ',') {
+  selectedMultiRecord: function(selection, isArray = false, separator = ',') {
     return new Promise((resolve, reject) => {
       if (Utils.isEmpty(selection)) {
         this.warning(I18n.t('common.dialog.selectedRecords'))
@@ -132,7 +132,7 @@ const action = {
  * @param {*} rows
  * @param {*} pkKey
  */
-  removeRecord: function (selection, confirmMsg = I18n.t('common.dialog.removeRecord'), isArray = false, separator = ',') {
+  removeRecord: function(selection, confirmMsg = I18n.t('common.dialog.removeRecord'), isArray = false, separator = ',') {
     return new Promise((resolve, reject) => {
       if (Utils.isEmpty(selection)) {
         this.warning(I18n.t('common.dialog.selectedRecords'))
@@ -159,7 +159,7 @@ const action = {
   /**
  * 保存成功提示
  */
-  saveSuccessMessage: function (message = I18n.t('common.dialog.operateSuccess'), callback) {
+  saveSuccessMessage: function(message = I18n.t('common.dialog.operateSuccess'), callback) {
     message = Utils.isNotEmpty(message) ? message : I18n.t('common.dialog.operateSuccess')
 
     // MessageBox.confirm(message,
@@ -179,7 +179,7 @@ const action = {
   /**
  * 保存成功提示
  */
-  saveSuccessAlert: function (message = I18n.t('common.dialog.operateSuccess'), callback) {
+  saveSuccessAlert: function(message = I18n.t('common.dialog.operateSuccess'), callback) {
     // MessageBox.alert(message,
     //   I18n.t('common.dialog.title'),
     //   {
@@ -193,7 +193,7 @@ const action = {
   /**
  * 保存失败
  */
-  saveErrorMessage: function (message, callback) {
+  saveErrorMessage: function(message, callback) {
     this.warning(message || I18n.t('common.dialog.saveError'))
     if (callback) { callback() }
   },
@@ -221,7 +221,7 @@ const action = {
  *  resultKey 结果key 默认 listData
  *  pageKey 分页key 默认 pagination
  */
-  handleListData: function (vm, data, options = {}) {
+  handleListData: function(vm, data, options = {}) {
     const loadingKey = options.loadingKey || 'loading'
     const refreshingKey = options.refreshingKey || 'refreshing'
     const finishedKey = options.finishedKey || 'finished'
@@ -263,7 +263,7 @@ const action = {
  *  resultKey 结果key 默认 listData
  *  pageKey 分页key 默认 pagination
  */
-   existHandleListData: function (vm, data, filtration, itemid, tid, options={}) {
+  existHandleListData: function(vm, data, filtration, itemid, tid, options = {}) {
     const loadingKey = options.loadingKey || 'loading'
     const refreshingKey = options.refreshingKey || 'refreshing'
     const finishedKey = options.finishedKey || 'finished'
@@ -283,19 +283,18 @@ const action = {
       vm[refreshingKey] = false
     }
     if (Utils.isNotEmpty(listData)) {
-      let mid = []
-      listData.forEach((item,i)=>{
-        const obj = filtration.findIndex(t=> t[tid] === item[itemid])
-        if(obj != -1){
+      const mid = []
+      listData.forEach((item, i) => {
+        const obj = filtration.findIndex(t => t[tid] === item[itemid])
+        if (obj != -1) {
           mid.push(item)
         }
       })
       pagination[pageKey] = pagination[pageKey] + 1
       vm[resultKey] = vm[resultKey].concat(mid)
-      
     }
     vm[loadingKey] = false
-    vm[finishedKey] = Utils.isEmpty(listData) ? true : false
+    vm[finishedKey] = !!Utils.isEmpty(listData)
 
     vm[paginationKey] = pagination
     // 处理结果类型
@@ -312,7 +311,7 @@ const action = {
    *  resultKey 结果key 默认 listData
    *  pageKey 分页key 默认 pagination
    */
-  handleListDataCommon: function (vm, data, options = {}) {
+  handleListDataCommon: function(vm, data, options = {}) {
     const loadingKey = options.loadingKey || 'loading'
     const refreshingKey = options.refreshingKey || 'refreshing'
     const finishedKey = options.finishedKey || 'finished'
@@ -331,19 +330,22 @@ const action = {
       vm[refreshingKey] = false
     }
 
-    if (Utils.isNotEmpty(listData)) {
+    if (Utils.isNotEmpty(listData) && vm[pageKey] === 1) {
+      vm[pageKey] = vm[pageKey] + 1
+      vm[resultKey] = listData
+    } else if (Utils.isNotEmpty(listData) && vm[pageKey] !== 1) {
       vm[pageKey] = vm[pageKey] + 1
       vm[resultKey] = vm[resultKey].concat(listData)
     }
     vm[loadingKey] = false
-    vm[finishedKey] = Utils.isEmpty(listData) ? true : false
+    vm[finishedKey] = !!Utils.isEmpty(listData)
 
     // vm[paginationKey] = pagination
     // 处理结果类型
     vm[resultTypeKey] = this.handleResultType(vm, options)
     vm[resultMessageKey] = null
   },
-  handleResultType: function (vm, options) {
+  handleResultType: function(vm, options) {
     const resultKey = options.resultKey || 'listData'
     const finishedKey = options.finishedKey || 'finished'
     const list = vm[resultKey]
@@ -361,7 +363,7 @@ const action = {
     }
     return listData.length >= totalCount
   },
-  handleErrorData: function (vm, e, options = {}) {
+  handleErrorData: function(vm, e, options = {}) {
     const loadingKey = options.loadingKey || 'loading'
     const refreshingKey = options.refreshingKey || 'refreshing'
     const finishedKey = options.finishedKey || 'finished'
@@ -376,7 +378,7 @@ const action = {
   /**
  *  设置分页设置
  */
-  setPagination: function (pagination, defaultPagination) {
+  setPagination: function(pagination, defaultPagination) {
     pagination.page = defaultPagination ? defaultPagination.page || common.PAGE : common.PAGE
     pagination.limit = defaultPagination ? defaultPagination.limit || common.LIMIT : common.LIMIT
   },
@@ -384,8 +386,8 @@ const action = {
   /**
  * 设置排序
  */
-  setSorts: function (sorts, sort, defaultSorts = {}) {
-    const defaultSortsData = function () {
+  setSorts: function(sorts, sort, defaultSorts = {}) {
+    const defaultSortsData = function() {
       for (const key in defaultSorts) {
         sorts[key] = defaultSorts[key]
       }
@@ -412,7 +414,7 @@ const action = {
  * @param {} page 分页
  * @param {} sorts 排序
  */
-  formatParams: function (params, pagination, sorts) {
+  formatParams: function(params, pagination, sorts) {
     const results = {}
     if (params) {
       results.parameters = Object.keys(params).map((k) => {
@@ -446,7 +448,7 @@ const action = {
   /**
  * 下载
  */
-  download: function (data, fileName, responseType = 'application/octet-stream') {
+  download: function(data, fileName, responseType = 'application/octet-stream') {
     const blob = data instanceof Blob ? data : new Blob([data], { type: responseType })
     if ('download' in document.createElement('a')) { // 非IE下载
       const url = window.URL.createObjectURL(blob)
@@ -466,10 +468,10 @@ const action = {
   /**
  * 导出文件
  */
-  exportFile: function (data, fileName, responseType = 'application/octet-stream') {
+  exportFile: function(data, fileName, responseType = 'application/octet-stream') {
     this.download(data, fileName, responseType)
   }
 
 }
 
-export default action
+export default action

+ 1 - 1
src/utils/request.js

@@ -133,7 +133,7 @@ service.interceptors.request.use(async config => {
  * 响应(respone)拦截器
  */
 service.interceptors.response.use(response => {
-  console.log(response)
+  // console.log(response)
   tryHideFullScreenLoading()
   const dataAxios = response.data
   const { state, message, cause } = dataAxios

+ 285 - 256
src/views/platform/bpmn/shiftTransferApplication/staForm.vue

@@ -16,6 +16,23 @@
         </div>
         <div class="scrollView">
             <van-form>
+              <van-field
+                    required
+                    label="调班方式:"
+                    placeholder="请选择调班方式"
+                    label-width="6em"
+                    :value="form.type"
+                    readonly
+                    @click="typeValue == 3 || typeValue == 4|| typeValue == 6 ? modeShow = true:''"
+                />
+                <van-popup v-if="typeValue == 3 || typeValue == 4|| typeValue == 6" v-model="modeShow" position="bottom">
+                    <van-picker
+                        show-toolbar
+                        :columns="modeType"
+                        @confirm="actionModeCallback"
+                        @cancel="modeShow = false"
+                    />
+                </van-popup>
                 <van-field
                     required
                     label="选择排班:"
@@ -23,9 +40,9 @@
                     label-width="6em"
                     :value="form.paiBan"
                     readonly
-                    @click="typeValue == 3 || typeValue == 4 ? sheetShow = true:''"
+                    @click="typeValue == 3 || typeValue == 4 || typeValue == 6? sheetShow = true:''"
                 />
-                <van-popup v-if="list.length>0 && (typeValue == 3 || typeValue == 4 )" v-model="sheetShow" position="bottom">
+                <van-popup v-if="list.length>0 && (typeValue == 3 || typeValue == 4|| typeValue == 6 )" v-model="sheetShow" position="bottom">
                     <van-picker
                         show-toolbar
                         :columns="list"
@@ -35,33 +52,32 @@
                 </van-popup>
                 <van-field
                     v-model="form.tiaoBanYuanYin"
-                    required
                     autosize
                     type="textarea"
                     label="调班原因:"
                     placeholder="请输入调班原因"
                     label-width="6em"
                     clearable
-                    :readonly="typeValue != 3 && typeValue != 4 ? true : false"
+                    :readonly="typeValue != 3 && typeValue != 4 && typeValue != 6? true : false"
                 />
             </van-form>
-            <div v-if="(typeValue==1||typeValue==2||typeValue == '5')||(typeof showDateArr == 'object'&&Object.keys(showDateArr).length>0&&showDateArr[userInfo.user.id].dateKeyArr.length>0&&tabChildShow)" class="tabChildClass">
-                <div v-if="typeValue == 3 || typeValue == 4 " class="tabAdd"><van-button plain hairline round size="mini" icon="plus" type="primary" @click="addEvent">添加</van-button></div>
+            <div v-if="(typeValue==1||typeValue==2||typeValue == 5 || typeValue == 7)||(typeof showDateArr == 'object'&&Object.keys(showDateArr).length>0&&showDateArr[userInfo.user.id].dateKeyArr.length>0&&tabChildShow)" class="tabChildClass">
+                <div v-if="typeValue == 3 || typeValue == 4 || typeValue == 6 " class="tabAdd"><van-button plain hairline round size="mini" icon="plus" type="primary" @click="addEvent">添加</van-button></div>
                 <van-collapse v-if="tabChildActiveArr.length>0" v-model="tabChildActive">
                     <van-collapse-item v-for="(item, index) in tabChildActiveArr" :key="index" :name="index+''" >
                       <template #title>
-                        <div>{{'序号'+ (index+1)}} <van-icon name="question-o" /></div>
+                        <div style="display: flex;align-items: center;">{{'序号'+ (index+1)}} <van-icon name="close" style="margin-left:5px" color="#ee0a24" @click.stop.prevent="delCollapse(index)" /></div>
                       </template>
                         <van-field
                             required
                             label="调班日期:"
-                            :placeholder="form.paiBan===''?'请先选择排班记录':'请选择调班日期'"
+                            :placeholder="form.paiBan===''?'请先选择排班记录':showDateArr[userInfo.user.id].dateKeyArr.length>0?'请选择调班日期':'暂无可选日期'"
                             label-width="6em"
                             :value="tabChildActiveArr[index].tiaobanBenRenRiQi"
                             readonly
-                            @click="typeValue == 3 || typeValue == 4 ? tbbrrqShow = true:''"
+                            @click="(typeValue == 3 || typeValue == 4 || typeValue == 6)&&showDateArr[userInfo.user.id].dateKeyArr.length>0 ? tbbrrqShow = true:''"
                         />
-                        <van-popup v-if="(typeValue == 3 || typeValue == 4 )&&Object.keys(showDateArr[userInfo.user.id]).length>0" v-model="tbbrrqShow" position="bottom">
+                        <van-popup v-if="(typeValue == 3 || typeValue == 4 || typeValue == 6 )&&Object.keys(showDateArr[userInfo.user.id]).length>0" v-model="tbbrrqShow" position="bottom">
                             <van-picker
                                 :ref="'tbrq'+index"
                                 show-toolbar
@@ -73,13 +89,31 @@
                         <van-field
                             required
                             label="调班班次:"
-                            :placeholder="tabChildActiveArr[index].tiaobanBenRenRiQi===''?'请先选择调班日期':'请选择调班班次'"
+                            :placeholder="tabChildActiveArr[index].tiaobanBenRenRiQi===''?'请先选择调班日期':showDateArr[userInfo.user.id]['dateKeyValArr'][tabChildActiveArr[index].tiaobanBenRenRiQi]!=''?'请选择调班班次':'暂无可选班次'"
                             label-width="6em"
                             :value="tabChildActiveArr[index].tiaobanBenRenBanCi"
                             readonly
-                            @click="(typeValue == 3 || typeValue == 4) && tabChildActiveArr[index].tiaobanBenRenRiQi!=='' ? tbbrbcShow = true:''"
+                            @click="(typeValue == 3 || typeValue == 4 || typeValue == 6) && tabChildActiveArr[index].tiaobanBenRenRiQi!=='' &&showDateArr[userInfo.user.id]['dateKeyValArr'][tabChildActiveArr[index].tiaobanBenRenRiQi]!=''? tbbrbcShow = true:''"
                         />
-                        <van-popup v-if="tabChildActiveArr[index].tiaobanBenRenRiQi!==''&& (typeValue == 3 || typeValue == 4 )" v-model="tbbrbcShow" position="bottom">
+                        <van-popup v-if="tabChildActiveArr[index].tiaobanBenRenRiQi!==''&& (typeValue == 3 || typeValue == 4 || typeValue == 6 )" v-model="tbbrbcShow" position="bottom">
+                            <!-- <van-checkbox-group v-model="tabChildActiveArr[index].tiaobanBenRenBanCi">
+
+                              <van-cell-group>
+                                <van-cell
+                                  v-for="(item, index) in getBanCi(showDateArr[userInfo.user.id]['dateKeyValArr'][tabChildActiveArr[index].tiaobanBenRenRiQi])"
+
+                                  :ref="'tbbc'+index"
+                                  :key="item"
+                                  clickable
+                                  :title="`${item}`"
+                                  @click="toggle(index)"
+                                >
+                                  <template #right-icon>
+                                    <van-checkbox ref="checkboxes" :name="item" />
+                                  </template>
+                                </van-cell>
+                              </van-cell-group>
+                            </van-checkbox-group> -->
                             <van-picker
                                 :ref="'tbbc'+index"
                                 show-toolbar
@@ -89,15 +123,16 @@
                             />
                         </van-popup>
                         <van-field
+                            v-if="form.type!=='排班变更'"
                             required
                             label="目标人员:"
-                            :placeholder="form.paiBan===''?'请先选择排班记录':'请选择目标人员'"
+                            :placeholder="form.paiBan===''?'请先选择排班记录':getAllPer(showDateArr).length>0?'请选择目标人员':'暂无可选人员'"
                             label-width="6em"
                             :value="tabChildActiveArr[index].tiaobanMuBiaoRenYuan"
                             readonly
-                            @click="typeValue == 3 || typeValue == 4 ? tbmbryShow = true:''"
+                            @click="(typeValue == 3 || typeValue == 4 || typeValue == 6 )&&getAllPer(showDateArr).length>0? tbmbryShow = true:''"
                         />
-                        <van-popup v-if="Object.keys(showDateArr).length>1 && (typeValue == 3 || typeValue == 4 )" v-model="tbmbryShow" position="bottom">
+                        <van-popup v-if="Object.keys(showDateArr).length>1 && (typeValue == 3 || typeValue == 4 || typeValue == 6 )" v-model="tbmbryShow" position="bottom">
                             <van-picker
                                 :ref="'mbry'+index"
                                 show-toolbar
@@ -109,13 +144,13 @@
                         <van-field
                             required
                             label="目标日期:"
-                            :placeholder="tabChildActiveArr[index].tiaobanMuBiaoRenYuan===''?'请先选择目标人员':'请选择目标日期'"
+                            :placeholder="tabChildActiveArr[index].tiaobanMuBiaoRenYuan===''?'请先选择目标人员':showDateArr[tabChildActiveArr[index].tiaobanMuBiaoRenYuanId].dateKeyArr.length>0?'请选择目标日期':'暂无可选日期'"
                             label-width="6em"
                             :value="tabChildActiveArr[index].tiaobanMuBiaoRiQi"
                             readonly
-                            @click="(typeValue == 3 || typeValue == 4) && tabChildActiveArr[index].tiaobanMuBiaoRenYuan!=='' ? tbmbrqShow = true:''"
+                            @click="(typeValue == 3 || typeValue == 4 || typeValue == 6) && tabChildActiveArr[index].tiaobanMuBiaoRenYuan!=='' && showDateArr[tabChildActiveArr[index].tiaobanMuBiaoRenYuanId].dateKeyArr.length>0? tbmbrqShow = true:''"
                         />
-                        <van-popup v-if="tabChildActiveArr[index].tiaobanMuBiaoRenYuan!==''&& (typeValue == 3 || typeValue == 4 )" v-model="tbmbrqShow" position="bottom">
+                        <van-popup v-if="tabChildActiveArr[index].tiaobanMuBiaoRenYuan!==''&& (typeValue == 3 || typeValue == 4 || typeValue == 6 )" v-model="tbmbrqShow" position="bottom">
                             <van-picker
                                 :ref="'mbrq'+index"
                                 show-toolbar
@@ -125,15 +160,15 @@
                             />
                         </van-popup>
                         <van-field
-                            required
+                            :required="form.type==='调班'"
                             label="目标班次:"
-                            :placeholder="tabChildActiveArr[index].tiaobanMuBiaoRiQi===''?'请先选择目标日期':'请选择目标班次'"
+                            :placeholder="tabChildActiveArr[index].tiaobanMuBiaoRiQi===''?'请先选择目标日期':form.type==='排班变更'?'不选择班次视为休息':showDateArr[tabChildActiveArr[index].tiaobanMuBiaoRenYuanId]['dateKeyValArr'][tabChildActiveArr[index].tiaobanMuBiaoRiQi]!=''?'请选择目标班次':'暂无可选班次'"
                             label-width="6em"
                             :value="tabChildActiveArr[index].tiaobanMuBiaoBanCi"
                             readonly
-                            @click="(typeValue == 3 || typeValue == 4) && tabChildActiveArr[index].tiaobanMuBiaoRiQi!=='' ? tbmbbcShow = true:''"
+                            @click="(typeValue == 3 || typeValue == 4 || typeValue == 6) && tabChildActiveArr[index].tiaobanMuBiaoRiQi!=='' && showDateArr[tabChildActiveArr[index].tiaobanMuBiaoRenYuanId]['dateKeyValArr'][tabChildActiveArr[index].tiaobanMuBiaoRiQi]!=''? tbmbbcShow = true:''"
                         />
-                        <van-popup v-if="tabChildActiveArr[index].tiaobanMuBiaoRiQi!==''&& (typeValue == 3 || typeValue == 4 )" v-model="tbmbbcShow" position="bottom">
+                        <van-popup v-if="tabChildActiveArr[index].tiaobanMuBiaoRiQi!==''&& (typeValue == 3 || typeValue == 4 || typeValue == 6 )" v-model="tbmbbcShow" position="bottom">
                             <van-picker
                                 :ref="'mbbc'+index"
                                 show-toolbar
@@ -146,23 +181,23 @@
                 </van-collapse>
             </div>
 
-            <van-cell-group v-if="typeValue != 3 && typeValue != 4">
-                <div class="verticalLine" style="width:4em;padding: 1em 0;">
-                    意见
+            <van-cell-group v-if="typeValue == 2 || typeValue == 5">
+                <div class="verticalLine" style="width:6em;padding: 1em 0;">
+                    拒绝原因
                 </div>
                 <van-field
                     v-model="form.gouTongQueDingNei"
                     autosize
                     type="textarea"
                     label=""
-                    placeholder="请输入意见和建议"
+                    placeholder="若拒绝,请输入原因"
                     label-width="0"
                     clearable
-                    :readonly="typeValue != 2"
+                    :readonly="typeValue != 2 && typeValue != 5"
                 />
             </van-cell-group>
 
-            <div v-if="typeValue == '3'" class="padding flex flex-direction">
+            <div v-if="typeValue == '3'||typeValue == '6'" class="padding flex flex-direction">
                 <van-button
                     type="success"
                     class="btn btn-back-color"
@@ -170,20 +205,39 @@
                 >提交
                 </van-button>
             </div>
-            <div v-if="typeValue == '2'" class="padding flex flex-direction">
+            <div v-if="typeValue == '2'||typeValue == '5'" class="padding flex flex-direction">
                 <van-button
                     type="success"
-                    class="btn btn-back-color"
-                    @click="onAgree('已完成', '同意', '确定')"
+                    class="btn"
+                    style="margin: 0 3px 0 6px;"
+                    @click="onAgree(typeValue == '2'?'已通过':'已完成', '同意', '同意')"
                 >同意
                 </van-button>
+                <van-button
+                    type="danger"
+                    class="btn"
+                    style="margin: 0 6px 0 3px;"
+                    @click="onAgree('已拒绝', '同意', '拒绝')"
+                >拒绝
+                </van-button>
+            </div>
+            <!-- <div v-if="typeValue == '2'||typeValue == '5'" class="padding flex flex-direction">
+
+            </div> -->
+            <div v-if="typeValue == '7'" class="padding flex flex-direction">
+                <van-button
+                    type="success"
+                    class="btn btn-back-color"
+                    @click="onAgree('已取消', '同意', '确认取消')"
+                >确认取消
+                </van-button>
             </div>
             <div v-if="typeValue == '4'" class="padding flex flex-direction">
                 <van-button
                     type="success"
                     class="btn btn-back-color"
-                    @click="onAgree('已编制', '重新提交', '提交')"
-                >修改
+                    @click="onSubmit"
+                >再次申请
                 </van-button>
             </div>
         </div>
@@ -192,19 +246,18 @@
 <script>
 import random from '@/mixins/random'
 import bpmnStatus from '@/mixins/bpmnStatus'
-import IbpsUploader from '@/business/platform/file/uploader'
+// import IbpsUploader from '@/business/platform/file/uploader'
 import { saveAdjustment } from '@/api/platform/bpmn/bpmCommonStatment'
+import { getAdjustment, getStaffSchedule, saveStaffSchedule } from '@/api/platform/feature/changeShift'
 
 import {
-  getNextIdByAlias,
-  findFormJsonByBo,
   snapshot
 } from '@/api/platform/form/transfer'
-import { agree } from '@/api/platform/bpmn/bpmTask'
+// import { agree } from '@/api/platform/bpmn/bpmTask'
 
 export default {
   components: {
-    IbpsUploader
+    // IbpsUploader
   },
   mixins: [random, bpmnStatus],
   props: {
@@ -231,7 +284,7 @@ export default {
       tabChildActiveArr: [],
       show: this.showPop,
       showDateArr: {},
-      // typeValue: '3',
+      modeShow: false,
       sheetShow: false,
       tbbrrqShow: false,
       tbbrbcShow: false,
@@ -240,54 +293,26 @@ export default {
       tbmbbcShow: false,
       taskId: '',
       form: {
-        // xuanZeKeHu: '',
-        // biaoDanBianHao: '',
-        // buMenName: '',
-        // keHuDanWeiMin: '',
-        // keHuLianXiRen: '',
+        type: '',
         tiaoBanYuanYin: '',
-        // lianXiDianHua: '',
-        // yangPinMingCheng: '',
-        // yangPinBianHao: '',
-        // yangPinLeiXing: '',
-        // baoGaoBianHao: '',
         paiBan: '',
         paiBanId: '',
-        // gouTongNeiRong: '',
-        // keHu: '',
+        executor: '',
         gouTongQueDingNei: ''
-        // leiXing: '2',
-        // yongHuYouXiang: '',
-        // qiTa: ''
       },
-      //   fuJianShangChuanArray: [],
-      //   popupShow: false,
       list: [],
-      //   kehuXinXinList: [],
-
-      //   weiTuoList: [],
-      //   bianZhiRenName: '',
-      //   queDingRenName: '',
       backShow: false,
       option: '',
       content: '',
-      //   timeShow: false,
-      //   params: {
-      //     year: true,
-      //     month: true,
-      //     day: true,
-      //     hour: true,
-      //     minute: true,
-      //     second: false
-      //   },
       level: null,
       mainPosition: {
         id: ''
       },
-      //   xuanzeTime: null,
       nowDate: new Date(),
       tabChildShow: false,
-      dateArr: []
+      dateArr: [],
+      modeType: ['调班', '排班变更'],
+      poor: 0
     }
   },
   computed: {
@@ -305,29 +330,16 @@ export default {
       handler: function(val, oldVal) {
         if (val === true) {
           this.form = {
-            // xuanZeKeHu: '',
-            // biaoDanBianHao: '',
-            // buMenName: '',
-            // keHuDanWeiMin: '',
-            // keHuLianXiRen: '',
             tiaoBanYuanYin: '',
-            // lianXiDianHua: '',
-            // yangPinMingCheng: '',
-            // yangPinBianHao: '',
-            // yangPinLeiXing: '',
-            // baoGaoBianHao: '',
             paiBan: '',
             paiBanId: '',
-            // gouTongNeiRong: '',
-            // keHu: '',
+            type: '',
+            executor: '',
             gouTongQueDingNei: ''
-            // leiXing: '2',
-            // yongHuYouXiang: '',
-            // qiTa: ''
           }
           this.tabChildActive = ['0']
           this.tabChildActiveArr = []
-          this.getKehu()
+          // this.getKehu()
           this.level = this.$store.getters.level
           const mid = JSON.parse(localStorage.getItem('mainPosition'))
           const mainPosition =
@@ -346,10 +358,10 @@ export default {
     },
     form: {
       handler: function(val, oldVal) {
-        if (val.paiBan !== '') {
+        if (val.paiBan !== '' && val.type !== '') {
           this.tabChildShow = true
           if (this.tabChildActiveArr.length === 0) {
-            this.tabChildActiveArr.push({ tiaobanBenRenRiQi: '', tiaobanBenRenBanCi: '', tiaobanMuBiaoRenYuan: '', tiaobanMuBiaoRenYuanId: '', tiaobanMuBiaoRiQi: '', tiaobanMuBiaoBanCi: '' })
+            this.tabChildActiveArr.push({ tiaobanBenRenRiQi: '', tiaobanBenRenBanCi: '', tiaobanMuBiaoRenYuan: this.form.type === '排班变更' ? this.userInfo.user.name : '', tiaobanMuBiaoRenYuanId: this.form.type === '排班变更' ? this.userInfo.user.id : '', tiaobanMuBiaoRiQi: '', tiaobanMuBiaoBanCi: '' })
           }
         } else {
           this.tabChildShow = false
@@ -389,14 +401,14 @@ export default {
           data.forEach((item, i) => {
             if (showData.hasOwnProperty(item.user_id_)) {
               this.dateArr.forEach((e, n) => {
-                if (item['d' + (n + 1) + '_']) {
+                if (item['d' + (n + 1) + '_'] && n > 4) {
                   showData[item.user_id_]['dateKeyValArr'][e] = showData[item.user_id_]['dateKeyValArr'][e] + (item['d' + (n + 1) + '_'] !== '' && showData[item.user_id_]['dateKeyValArr'][e] !== '' ? ',' : '') + (item['d' + (n + 1) + '_'] ? item['d' + (n + 1) + '_'] : '')
                 }
               })
             } else {
               showData[item.user_id_] = { dateKeyArr: [], dateKeyValArr: {}}
               this.dateArr.forEach((e, n) => {
-                if (item['d' + (n + 1) + '_']) {
+                if (item['d' + (n + 1) + '_'] && n > 4) {
                   showData[item.user_id_]['dateKeyValArr'][e] = item['d' + (n + 1) + '_']
                   showData[item.user_id_]['dateKeyArr'].push({ text: e })
                 }
@@ -407,16 +419,32 @@ export default {
         }
       })
     },
-    actionSheetCallback(e) {
-      this.dateArr = this.generationDate(e.obj.start_date_, e.obj.end_date_)
-      this.getPlanList(e.id)
-      this.form.paiBan = e.text
-      this.form.paiBanId = e.id
+    actionSheetCallback(e, type = '') {
+      if (this.form.paiBan !== e || type === '1') {
+        this.dateArr = this.generationDate(e.obj.start_date_, e.obj.end_date_)
+        this.getPlanList(e.id)
+        this.form.paiBan = e.text
+        this.form.paiBanId = e.id
+        this.form.executor = JSON.parse(e.obj.config_).approver.join(',')
+      }
+
       this.sheetShow = false
     },
+    actionModeCallback(e, type = '') {
+      if (this.form.type !== e || type === '1') {
+        this.form.type = e
+        this.tabChildActiveArr = []
+        this.tabChildActive = ['0']
+      }
+      this.modeShow = false
+    },
     actionTbbrrqCallback(index) {
       const obj = this.$refs['tbrq' + index][0].getValues()
-      this.tabChildActiveArr[index].tiaobanBenRenRiQi = obj[0].text
+      if (this.tabChildActiveArr[index].tiaobanBenRenRiQi !== obj[0].text) {
+        this.tabChildActiveArr[index].tiaobanBenRenRiQi = obj[0].text
+
+        this.tabChildActiveArr[index].tiaobanBenRenBanCi = ''
+      }
       this.tbbrrqShow = false
     },
     actionTbbrbcCallback(index) {
@@ -426,13 +454,24 @@ export default {
     },
     actionTbmbryCallback(index) {
       const obj = this.$refs['mbry' + index][0].getValues()
-      this.tabChildActiveArr[index].tiaobanMuBiaoRenYuan = obj[0].text
-      this.tabChildActiveArr[index].tiaobanMuBiaoRenYuanId = obj[0].id
+      if (this.tabChildActiveArr[index].tiaobanMuBiaoRenYuan !== obj[0].text && this.tabChildActiveArr[index].tiaobanMuBiaoRenYuanId !== obj[0].id) {
+        this.tabChildActiveArr[index].tiaobanMuBiaoRenYuan = obj[0].text
+        this.tabChildActiveArr[index].tiaobanMuBiaoRenYuanId = obj[0].id
+
+        this.tabChildActiveArr[index].tiaobanMuBiaoRiQi = ''
+        this.tabChildActiveArr[index].tiaobanMuBiaoBanCi = ''
+      }
+
       this.tbmbryShow = false
     },
     actionTbmbrqCallback(index) {
       const obj = this.$refs['mbrq' + index][0].getValues()
-      this.tabChildActiveArr[index].tiaobanMuBiaoRiQi = obj[0].text
+      if (this.tabChildActiveArr[index].tiaobanMuBiaoRiQi !== obj[0].text) {
+        this.tabChildActiveArr[index].tiaobanMuBiaoRiQi = obj[0].text
+
+        this.tabChildActiveArr[index].tiaobanMuBiaoBanCi = ''
+      }
+
       this.tbmbrqShow = false
     },
     actionTbmbbcCallback(index) {
@@ -442,7 +481,6 @@ export default {
     },
     // 获取排班人员
     getAllPer(val) {
-      // console.log(val)
       const data = Object.keys(val)
       const returnArr = []
       data.forEach((item, i) => {
@@ -469,6 +507,7 @@ export default {
       de.setUTCFullYear(endArr[0], endArr[1] - 1, endArr[2])
       const unixDb = db.getTime()
       const unixDe = de.getTime()
+      this.daysBetween(db, this.nowDate)
       let stamp
       const oneDay = 24 * 60 * 60 * 1000
       for (stamp = unixDb; stamp <= unixDe;) {
@@ -477,37 +516,44 @@ export default {
       }
       return dateArr
     },
+    daysBetween(date1, date2) {
+      const oneDay = 24 * 60 * 60 * 1000 // 每天的毫秒数
+      const diff = date2.getTime() - date1.getTime() // 计算两个日期的时间差(绝对值)
+      this.poor = Math.floor(diff / oneDay) // 将时间差转换为天数
+    },
     addEvent() {
       this.tabChildActive.push(this.tabChildActiveArr.length + '')
-      this.tabChildActiveArr.push({ tiaobanBenRenRiQi: '', tiaobanBenRenBanCi: '', tiaobanMuBiaoRenYuan: '', tiaobanMuBiaoRenYuanId: '', tiaobanMuBiaoRiQi: '', tiaobanMuBiaoBanCi: '' })
-    },
-    getKehu() {
-      const info = this.$store.getters.userInfo
-      if (info) {
-        // this.form.keHuDanWeiMin = info.user.qq
-        // this.form.lianXiDianHua = info.user.mobile
-        // this.form.keHuDanWeiMingChe = info.user.id
-        // this.form.keHuLianXiRen = info.user.fullname
-        this.form.paiBan = ''
-        this.form.gouTongRiQi = this.$methCommon.time(16)
-        // this.xuanzeTime = new Date()
-        // this.form.yongHuYouXiang = info.user.email
-      }
+      this.tabChildActiveArr.push({ tiaobanBenRenRiQi: '', tiaobanBenRenBanCi: '', tiaobanMuBiaoRenYuan: this.form.type === '排班变更' ? this.userInfo.user.name : '', tiaobanMuBiaoRenYuanId: this.form.type === '排班变更' ? this.userInfo.user.id : '', tiaobanMuBiaoRiQi: '', tiaobanMuBiaoBanCi: '' })
     },
+    // getKehu() {
+    //   const info = this.$store.getters.userInfo
+    //   if (info) {
+    //     // this.form.keHuDanWeiMin = info.user.qq
+    //     // this.form.lianXiDianHua = info.user.mobile
+    //     // this.form.keHuDanWeiMingChe = info.user.id
+    //     // this.form.keHuLianXiRen = info.user.fullname
+    //     // this.form.paiBan = ''
+    //     // this.form.gouTongRiQi = this.$methCommon.time(16)
+    //     // this.xuanzeTime = new Date()
+    //     // this.form.yongHuYouXiang = info.user.email
+    //   }
+    // },
     getDe(id) {
-      const sql = `select c.*,d.title_ from (select a.id_ as fid, a.schedule_id_,a.reason_,a.status,b.* from t_adjustment_detail b join t_adjustment a on a.id_ = b.parent_id_ where a.id_ = '${id}') c join t_schedule d on c.schedule_id_ = d.id_`
+      const sql = `select c.*,d.title_,d.start_date_, d.end_date_,d.config_ from (select a.id_ as fid, a.schedule_id_,a.reason_,a.status,a.type_,a.executor_,a.reject_reason_ as frejectReason,b.* from t_adjustment_detail b join t_adjustment a on a.id_ = b.parent_id_ where a.id_ = '${id}') c join t_schedule d on c.schedule_id_ = d.id_`
 
       this.$common.request('sql', sql).then(res => {
         if (res.state === 200) {
           const data = res.variables.data
           this.form = {
             id: data[0].id_,
+            type: data[0].type_ === 'diaoban' ? '调班' : data[0].type_ === 'paiban' ? '排班变更' : '',
             tiaoBanYuanYin: data[0].reason_,
             paiBan: data[0].title_,
             paiBanId: data[0].schedule_id_,
-            gouTongQueDingNei: data[0].gou_tong_que_ding,
+            gouTongQueDingNei: data[0].frejectReason,
             bianZhiShiJian: data[0].bian_zhi_shi_jian,
-            gouTongRiQi: data[0].gou_tong_ri_qi_
+            // gouTongRiQi: data[0].gou_tong_ri_qi_,
+            executor: data[0].executor_
           }
           this.tabChildActive = []
           data.forEach((item, i) => {
@@ -528,53 +574,63 @@ export default {
               }
             )
           })
-          // if (this.typeValue === '2' || this.typeValue === '4') {
-          //   this.getTaskId(data.id_)
-          // }
+          this.actionSheetCallback({ text: data[0].title_, id: data[0].schedule_id_, obj: data[0] }, '1')
         }
       })
     },
+    delCollapse(val) {
+      if (this.tabChildActiveArr.length === 1) {
+        this.$notify({
+          type: 'success',
+          message: '只剩一个,不能再删了哦~'
+        })
+      } else {
+        this.tabChildActiveArr = this.tabChildActiveArr.filter((item, i) => i !== val)
+      }
+    },
     onSubmit() {
       if (!this.getYanZheng()) {
         return
       }
-      //   const tmpArray = []
-      //   this.fuJianShangChuanArray.forEach(item => {
-      //     tmpArray.push(item.id)
-      //   })
-
-      // const info = this.$store.getters.userInfo
       const { second = '' } = this.$store.getters.level || {}
-      // const useId = info.user.id
-      // const detpId = info.employee.positions
       const midArr = []
       let midStr = ''
+      let mark = 0
       this.tabChildActiveArr.forEach((item, i) => {
         const str = `${this.userInfo.user.name}${item.tiaobanBenRenRiQi}班次【${item.tiaobanBenRenBanCi}】与${item.tiaobanMuBiaoRenYuan}${item.tiaobanMuBiaoRiQi}班次【${item.tiaobanMuBiaoBanCi}】调换`
+        const str1 = `${this.userInfo.user.name}${item.tiaobanBenRenRiQi}班次【${item.tiaobanBenRenBanCi}】与${item.tiaobanMuBiaoRiQi}班次【${item.tiaobanMuBiaoBanCi}】调换`
+        const str2 = `${this.userInfo.user.name}${item.tiaobanBenRenRiQi}班次【${item.tiaobanBenRenBanCi}】休息`
         if (i === 0) {
-          midStr = str
+          midStr = this.form.type === '调班' ? str : item.tiaobanMuBiaoBanCi === '' ? str2 : str1
         } else {
-          midStr = midStr + ';' + str
+          const strAdd = this.form.type === '调班' ? str : item.tiaobanMuBiaoBanCi === '' ? str2 : str1
+          midStr = midStr + ';' + strAdd
+        }
+        if (item.tiaobanMuBiaoRenYuanId === this.userInfo.user.id) {
+          mark += 1
         }
-
         midArr.push({
           afterAdjust: item.tiaobanMuBiaoBanCi,
           afterDate: item.tiaobanMuBiaoRiQi,
           beforeAdjust: item.tiaobanBenRenBanCi,
           beforeDate: item.tiaobanBenRenRiQi,
           party: item.tiaobanMuBiaoRenYuanId,
-          status: '待审核'
+          status: item.tiaobanMuBiaoRenYuanId === this.userInfo.user.id ? '审核中' : '待审核'
         })
       })
-      console.log(midArr)
       const para = {
         adjustmentDetailPoList: midArr,
         diDian: second,
         overview: midStr,
         reason: this.form.tiaoBanYuanYin,
         scheduleId: this.form.paiBanId,
-        status: '待审核'
+        type: this.form.type === '排班变更' ? 'paiban' : 'diaoban',
+        executor: this.form.executor,
+        status: this.form.type === '排班变更' || this.form.type === '调班' && mark >= midArr.length ? '待审批' : this.form.type === '调班' && mark > 0 && mark < midArr.length ? '审核中' : '待审核',
+        rejectReason: '',
+        id: this.id
       }
+
       const that = this
 
       saveAdjustment(para)
@@ -589,95 +645,56 @@ export default {
         .catch(() => {})
     },
     onAgree(shiFouGuoShen, opinion, type) {
-      if (this.typeValue !== '2' && !this.getYanZheng()) {
-        return
-      }
-      // const info = this.$store.getters.userInfo
-      // const useId = info.user.id
-      // const detpId = info.employee.positions
-      //   const tmpArray = []
-      //   this.fuJianShangChuanArray.forEach(item => {
-      //     tmpArray.push(item.id)
-      //   })
-      // this.form.fuJian = tmpArray.join(',')
-      this.form.shiFouGuoShen = shiFouGuoShen
-      this.form.diDian = this.level.second
-      this.form.shiFouGuoShen = shiFouGuoShen
-      const editData = {
-        data: JSON.stringify(this.form),
-        opinion: opinion,
-        taskId: this.taskId
-      }
-      agree(editData).then(res => {
+      let midParam = {}
+      const that = this
+      getAdjustment({ id: this.id }).then((res) => {
+        midParam = res.data
+        midParam.rejectReason = this.form.gouTongQueDingNei
         if (res.state === 200) {
-          if (this.typeValue === '2') {
-            setTimeout(() => {
-              this.getPath(this.id)
-            }, 1000)
+          if (this.typeValue == 5 && midParam.adjustmentDetailPoList.length > 0) {
+            midParam.adjustmentDetailPoList.forEach(item => {
+              if (item.party === this.userInfo.user.id) {
+                item.status = '待审批'
+              }
+              console.log(item.party === this.userInfo.user.id, item.status)
+            })
+            console.log()
+            midParam.status = midParam.adjustmentDetailPoList.some(item => item.status === '待审核') ? '审核中' : '待审批'
+          } else if (midParam.adjustmentDetailPoList.length > 0) {
+            midParam.adjustmentDetailPoList.forEach(item => {
+              item.status === shiFouGuoShen
+            })
+            midParam.status = shiFouGuoShen
           } else {
-            this.$toast.success(type + '成功!')
-            this.closePop()
+            midParam.status = shiFouGuoShen
           }
-          this.$toast.success(type + '成功!')
-          setTimeout(() => {
-            this.closePop()
-          }, 1000)
-        } else {
-          this.$toast.fail(type + '异常!')
-        }
-      })
-    },
-    // 生成快照
-    getPath(id) {
-      const org = this.level.first
 
-      const url = this.$common.getRequest.downloadReport(
-        '咨询活动/客户沟通记录表.rpx',
-        `id_=${id}&org_=${org}`
-      )
-      const data = {
-        url,
-        name: '用户沟通记录表' + this.$methCommon.time(19),
-        type: 'pdf'
-      }
-      snapshot(data).then(res => {
-        const result = res.data
-        if (result.state === 200) {
-          this.updateData(id, result.data.id)
+          saveAdjustment(midParam)
+            .then(res => {
+              if (res.state === 200) {
+                that.$toast.success(type + '成功!')
+                if (midParam.status === '已通过') {
+                  this.handleAccess(midParam)
+                }
+                setTimeout(() => {
+                  that.closePop()
+                }, 1000)
+              }
+            })
+            .catch(() => {})
         }
       })
     },
-    updateData(id, fileId) {
-      const pp = {
-        updList: [
-          {
-            where: {
-              id_: id
-            },
-            param: {
-              kuai_zhao_: fileId,
-              shi_fou_guo_shen_: '已完成'
-            }
-          }
-        ],
-        tableName: 't_khgtjlb'
-      }
-      const data = this.$sig(pp)
-      this.$common.request('update', data).then(res => {
-        this.$methCommon.getPrompt('提交成功', 'success')
-        setTimeout(() => {
-          this.closePop()
-        }, 1000)
-      })
-    },
     getYanZheng() {
       const suList = [
-        'tiaoBanYuanYin'
-        // 'paiBan'
+        // 'tiaoBanYuanYin',
+        'type',
+        'paiBan'
       ]
       const suListName = [
-        '调班原因'
-        // '排班'
+        // '调班原因',
+        '调班方式',
+        '排班'
       ]
       for (const item in suList) {
         if (!this.form[suList[item]]) {
@@ -689,17 +706,17 @@ export default {
         }
       }
 
-      const selList = ['gouTongRiQi', 'paiBan']
-      const selListName = ['沟通时间', '沟通类型']
-      for (const item in selList) {
-        if (!this.form[selList[item]]) {
-          this.$toast({
-            duration: 2000, // 持续展示 toast
-            message: '请选择' + selListName[item]
-          })
-          return false
-        }
-      }
+      // const selList = ['gouTongRiQi', 'paiBan']
+      // const selListName = ['沟通时间', '排班']
+      // for (const item in selList) {
+      //   if (!this.form[selList[item]]) {
+      //     this.$toast({
+      //       duration: 2000, // 持续展示 toast
+      //       message: '请选择' + selListName[item]
+      //     })
+      //     return false
+      //   }
+      // }
 
       if (this.form.paiBan === '') {
         this.$toast({
@@ -711,7 +728,7 @@ export default {
       if (this.tabChildActiveArr.length <= 0) {
         return false
       }
-      if (this.tabChildActiveArr.some(i => i.tiaobanBenRenRiQ === '' || i.tiaobanBenRenBanCi === '' || i.tiaobanMuBiaoRenYuan === '' || i.tiaobanMuBiaoRenYuanId === '' || i.tiaobanMuBiaoRiQi === '' || i.tiaobanMuBiaoBanCi === '')) {
+      if (this.tabChildActiveArr.some(i => i.tiaobanBenRenRiQ === '' || i.tiaobanBenRenBanCi === '' || i.tiaobanMuBiaoRenYuan === '' || i.tiaobanMuBiaoRenYuanId === '' || i.tiaobanMuBiaoRiQi === '' || (i.tiaobanMuBiaoBanCi === '' && this.form.type === '调班'))) {
         this.$toast({
           duration: 2000, // 持续展示 toast
           message: '请填写具体调班信息'
@@ -720,33 +737,6 @@ export default {
       }
       return true
     },
-    // 根据委托单id查询 taskId
-    getTaskId(id) {
-      let sql = ``
-      if (this.typeValue === '2') {
-        sql = `select TASK_ID_,PROC_INST_ID_ from ibps_bpm_tasks where NAME_ = '确认' and NODE_ID_ = 'Activity_02lroj1' and PROC_DEF_KEY_ = 'Process_0pjp1fy' and EXEC_ID_ = (select PROC_INST_ID_ from act_ru_execution where ACT_ID_ = 'Activity_02lroj1' and BUSINESS_KEY_ = '${id}') ORDER BY CREATE_TIME_ desc`
-      } else if (this.typeValue === '4') {
-        sql = `select TASK_ID_,PROC_INST_ID_ from ibps_bpm_tasks where NAME_ = '沟通' and NODE_ID_ = 'Activity_0qy1dd7' and PROC_DEF_KEY_ = 'Process_0pjp1fy' and EXEC_ID_ = (select PROC_INST_ID_ from act_ru_execution where ACT_ID_ = 'Activity_0qy1dd7' and BUSINESS_KEY_ = '${id}') ORDER BY CREATE_TIME_ desc`
-      }
-      this.$common.request('sql', sql).then(res => {
-        if (res.state === 200) {
-          const result = res.variables.data[0]
-          this.taskId = result.TASK_ID_
-
-          this.getProcInstId(result.PROC_INST_ID_)
-        }
-      })
-    },
-    // 根据委托单id查询 taskId
-    getProcInstId(id) {
-      const sql = `select OPTION_ from ibps_bpm_oper_log where PROC_INST_ID_ = '${id}'   order by create_time_ desc  limit 1`
-      this.$common.request('sql', sql).then(res => {
-        if (res.state === 200) {
-          const result = res.variables.data[0]
-          this.option = result.OPTION_
-        }
-      })
-    },
     // 退回原因
     getBack() {
       this.content = this.option
@@ -754,7 +744,7 @@ export default {
       this.$dialog
         .alert({
           title: '退回原因',
-          message: this.option,
+          message: this.form.gouTongQueDingNei,
           theme: 'round-button',
           confirmButtonColor: '#1989fa'
         })
@@ -764,6 +754,44 @@ export default {
     },
     cancel() {
       this.backShow = false
+    },
+    async handleAccess(data) {
+      if (data.adjustmentDetailPoList.length > 0) {
+        const scheduleId = data.scheduleId
+        const response = await getStaffSchedule({ id: scheduleId })
+        const submitData = response.data
+        const { staffScheduleDetailPoList, startDate } = response.data
+        data.adjustmentDetailPoList.forEach(async(el) => {
+          const userId = el.createBy
+          const partyId = el.party
+          const userResIndex = staffScheduleDetailPoList.findIndex(item => item.userId === userId) // 获取调班人的排班详情
+          const partyResIndex = staffScheduleDetailPoList.findIndex(item => item.userId === partyId) // 获取目标人的排班详情
+          // 修改调班人排班数据
+          const index = this.getDays(startDate, el.beforeDate) // 计算得出是d几天
+          staffScheduleDetailPoList[userResIndex][`d${index + 1}`] = staffScheduleDetailPoList[userResIndex][`d${index + 1}`].replace(el.beforeAdjust, el.afterAdjust)
+          if (data.type !== 'paiban') {
+            // 修改目标人排班数据
+            const partyIndex = this.getDays(startDate, el.afterDate) // 计算得出是d几天
+            staffScheduleDetailPoList[partyResIndex][`d${partyIndex + 1}`] = staffScheduleDetailPoList[partyResIndex][`d${partyIndex + 1}`].replace(el.afterAdjust, el.beforeAdjust)
+          }
+        })
+        // 保存修改后的排班
+        submitData.staffScheduleDetailPoList = staffScheduleDetailPoList
+        saveStaffSchedule(submitData).then(() => {
+          console.log('排班已更新')
+        }).catch((err) => {
+          console.log(err)
+        })
+      }
+    },
+    getDays(start, end) { // 根据日期获取排序 d1、d2、d3...
+      if (!start || !end) {
+        return 0
+      }
+      return Math.ceil((new Date(end) - new Date(start)) / (1000 * 60 * 60 * 24))
+    },
+    toggle(index) {
+      this.$refs.checkboxes[index].toggle()
     }
   }
 }
@@ -796,7 +824,7 @@ export default {
 }
 .btn-back-color {
   background-color: #1989fa !important;
-  border: none;
+  // border: none;
 }
 .btn-sty {
   padding: 0 13px;
@@ -847,6 +875,7 @@ export default {
   width: 90%;
   padding: 15px;
   border-radius: 5px;
+  border: none;
 }
 
 .fileBox {

+ 107 - 66
src/views/platform/bpmn/shiftTransferApplication/staList.vue

@@ -12,45 +12,49 @@
                     <!-- <van-icon name="filter-o" :class="{'ibps-active':stateActive}" @click="clickMoreSearch" /> -->
                 </template>
             </van-search>
+            <van-tabs
+                v-model="active"
+                color="#3396FB"
+                line-width="40"
+                @click="onClickTab"
+            >
+                <van-tab v-for="(item, i) in activeArr" :key="i" :name="item" :title="item">
+                    <!-- <template #title>
+                        <div class="badge">
+                        {{data.title}}
+                        <div class="icon">{{ data.val*1>100?'99+':data.val }}</div>
+                        </div>
+                    </template> -->
+                </van-tab>
+            </van-tabs>
         </van-sticky>
-        <van-tabs
-            v-model="active"
-            color="#3396FB"
-            line-width="40"
-            @click="onClickTab"
-        >
-            <van-tab v-for="(item, i) in activeArr" :key="i" :name="item" :title="item">
-                <!-- <template #title>
-                    <div class="badge">
-                    {{data.title}}
-                    <div class="icon">{{ data.val*1>100?'99+':data.val }}</div>
-                    </div>
-                </template> -->
-            </van-tab>
-        </van-tabs>
+
         <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
             <van-list v-model="loading" :finished="finished" @load="loadData">
                 <van-checkbox-group v-model="checkedIds">
                     <van-cell v-for="(item,index) in listData" :key="item.id+index">
                         <div class="sectionBox verticalLine">
                             <div class="left ">申请时间:</div>
-                            <div>{{ $common.getFormatDate('string', 16, item.create_time_) }} </div>
+                            <div>{{ $common.getFormatDate('string', 16, item.createTime) }} </div>
                             <!-- <div class="right">{{ item.status }} </div> -->
                             <van-button class="right" size="mini" color="#ae514a" disabled plain hairline round type="info">{{ item.status }}</van-button>
                         </div>
                         <div class="sectionBox">
                             <div class="left">概览:</div>
-                            <div>{{ item.overview_ }} </div>
+                            <div>{{ item.overview }} </div>
                         </div>
                         <div class="sectionBox">
                             <div class="left">调班原因:</div>
-                            <div>{{ item.reason_ }} </div>
+                            <div>{{ item.reason }} </div>
                         </div>
+
                         <div style=" width: 100%; text-align: right; padding-top: 5rpx;padding-bottom: 0rpx;">
-                            <van-button v-if="active==='我发起的'" type="success" size="mini" class="u-m-r-15 btn-sty" @click="getGo(item.id_,'1')">详情</van-button>
-                            <van-button v-if="active==='我发起的'&& item.status !== '已完成'" type="warning" size="mini" class="btn-sty" @click="getGo(item.id_,'2')">取消</van-button>
-                            <van-button v-if="active==='待我处理'&& item.status == '待审核'" type="warning" size="mini" class="btn-back-color btn-sty" @click="getGo(item.id_,'5')">审核</van-button>
-                            <van-button v-if="active==='待我处理'&& item.status == '待审批'" type="warning" size="mini" class="btn-back-color btn-sty" @click="getGo(item.id_,'2')">审批</van-button>
+                            <van-button v-if="active==='我发起的'&& item.status == '已暂存'" type="info" size="mini" class="btn-sty" @click="LiftUpPop(item.id,'6')">编辑</van-button>
+                            <van-button v-if="active==='我发起的'&& (item.status == '已取消' || item.status == '已拒绝')" type="info" size="mini" class="btn-sty" @click="LiftUpPop(item.id,'4')">再次申请</van-button>
+                            <van-button v-if="active==='我发起的'" type="success" size="mini" class="u-m-l-15 btn-sty" @click="LiftUpPop(item.id,'1')">详情</van-button>
+                            <van-button v-if="active==='我发起的'&& item.status == '待审核'" type="warning" size="mini" class="u-m-l-15 btn-sty" @click="LiftUpPop(item.id,'7')">取消</van-button>
+                            <van-button v-if="active==='待我处理'&& (item.status == '待审核'||item.partys.some(obj => obj.value === useId && item.createBy !== useId && obj.status === '待审核'))" type="warning" size="mini" class="btn-back-color btn-sty" @click="LiftUpPop(item.id,'5')">审核</van-button>
+                            <van-button v-if="active==='待我处理'&& item.status == '待审批'" type="warning" size="mini" class="btn-back-color btn-sty" @click="LiftUpPop(item.id,'2')">审批</van-button>
                         </div>
                     </van-cell>
                 </van-checkbox-group>
@@ -58,7 +62,7 @@
             <ibps-list-result-page :result-type="resultType" :error-type="errorType" :result-message="resultMessage" />
         </van-pull-refresh>
         <div class="suspensionBtn">
-            <img src="@/assets/images/add.png" alt="" srcset="" @click="LiftUpPop()">
+            <img src="@/assets/images/add.png" alt="" srcset="" @click="LiftUpPop('','3')">
         </div>
         <approve-popup
             :visible="batchOpinionPopup"
@@ -95,6 +99,7 @@ import IbpsListResultPage from '@/components/ibps-list-result-page'
 import IbpsBpmnDefinition from '@/business/platform/bpmn/definition/field'
 
 import staForm from './staForm.vue'
+import { queryAdjustment } from '@/api/platform/feature/changeShift'
 
 export default {
   components: {
@@ -107,43 +112,15 @@ export default {
   mixins: [random, bpmnStatus],
   data() {
     const useId = this.$store.getters.userId
+    const { userList = [] } = this.$store.getters || {}
+    const userOption = userList.map(item => ({ label: item.userName, value: item.userId }))
     return {
+      userOption,
       useId,
       active: '我发起的',
       activeArr: ['待我处理', '我发起的'],
       moreSearchPopup: false,
       stateActive: false,
-      searchForms: {
-        forms: [
-          { prop: 'biao_dan_bian_hao', label: '表单编号', fieldType: 'text' },
-          { prop: 'ke_hu_lian_xi_ren', label: '用户姓名', fieldType: 'text' },
-          { prop: 'gou_tong_lei_xing', label: '沟通类型', fieldType: 'checker', cols: 3, options: [
-            {
-              value: '全部',
-              label: '全部'
-            }, {
-              value: '投诉',
-              label: '投诉'
-            }, {
-              value: '检验项目',
-              label: '检验项目'
-            }, {
-              value: '危机值报告',
-              label: '危机值报告'
-            }, {
-              value: '口头报告结果',
-              label: '口头报告结果'
-            }, {
-              value: '延迟报告',
-              label: '延迟报告'
-            }, {
-              value: '其它',
-              label: '其它'
-            }
-          ]
-          }
-        ]
-      },
       subject: '',
       typeId: '',
       defKey: '',
@@ -221,19 +198,82 @@ export default {
       //   if (khlxr && khlxr.value !== '') {
       //     itemSql = itemSql + `and ke_hu_lian_xi_ren like '%${khlxr.value}%'`
       //   }
+
+      // v1
       const two = params.parameters.find(i => i.key === 'two') || ''
       if (two) {
         itemSql = itemSql + `and overview_ like '%${two.value}%'`
       }
-      const typeActive = this.active === '我发起的' ? `create_by_ = '${this.useId}' ` : `create_by_ = '${this.useId}'`
-      const sql =
-					`select * from t_adjustment where ${typeActive} ${itemSql}  ORDER BY create_time_ desc LIMIT ${this.page * params.requestPage.limit},${params.requestPage.limit}`
-      this.$common.request('sql', sql).then(response => {
+      // const typeActive = this.active === '我发起的' ? `create_by_ = '${this.useId}' ` : `FIND_IN_SET('${this.useId}', executor_) and `
+      // const sql =
+      // 		`select * from t_adjustment where ${typeActive} ${itemSql}  ORDER BY create_time_ desc LIMIT ${this.page * params.requestPage.limit},${params.requestPage.limit}`
+      if (this.active === '我发起的') {
+        const sql =
+					`select a.id_ as id,a.tenant_id_ as tenantId,a.ip_ as ip,a.create_by_ as createBy,a.create_time_ as createTime,a.update_by_ as updateBy,a.update_time_ as updateTime,a.di_dian_ as diDian,a.reason_ as reason,a.status as status,a.executor_ as executor,a.execute_date_ as executeDate,a.overview_ as overview,a.schedule_id_ as scheduleId,a.type_ as type,a.reject_reason_ as rejectReason,a.partys from (select f.*,GROUP_CONCAT(z.party_) as partys from t_adjustment f left join t_adjustment_detail z on f.id_ = z.parent_id_  GROUP BY f.id_) a where create_by_ = '${this.useId}' ORDER BY a.create_time_ desc LIMIT ${this.page * params.requestPage.limit},${params.requestPage.limit}`
+        this.$common.request('sql', sql).then(response => {
         // 处理数据
-        ActionUtils.handleListDataCommon(this, response.variables)
-      }).catch((e) => {
-        ActionUtils.handleErrorData(this, e)
+          ActionUtils.handleListDataCommon(this, response.variables)
+        }).catch((e) => {
+          ActionUtils.handleErrorData(this, e)
+        })
+      } else if (this.active === '待我处理') {
+        console.log('221312312321312321')
+        queryAdjustment(this.getSearcFormData()).then(res => {
+          res.data.dataResult.forEach((el) => { // 遍历子表提取审核人字段
+            el.partys = this.getPartysList(el.adjustmentDetailPoList)
+          })
+          // if (!this.isRoleFilter()) { // 如果不是高权限角色
+          // 审核人审批人过滤
+          res.data.dataResult = this.filteredData(this.isRoleFilter(), res.data.dataResult)
+          ActionUtils.handleListDataCommon(this, res.data, { dataResultKey: 'dataResult' })
+
+          // }
+
+          // this.loading = false
+        }).catch(() => {
+          // this.loading = false
+        })
+      }
+    },
+    getPartysList(poList) {
+      const self = this
+      const result = poList.map(item => ({
+        value: item.party,
+        status: item.status,
+        label: self.userOption.filter(o => o.value === item.party).length > 0 ? (self.userOption.filter(o => o.value === item.party))[0].label : '',
+        type: 'success'
+      }))
+      return result
+    },
+    isRoleFilter() {
+      const highRoles = this.$store.getters.userInfo.highRoles || [] // 高权限角色
+      const userRole = this.$store.getters.userInfo.role || [] // 用户权限角色
+      let isHighRole = false
+      userRole.forEach(el => {
+        const roleAlias = el.alias
+        if (highRoles.includes(roleAlias)) {
+          isHighRole = true
+        }
       })
+      return (this.$store.getters.isSuper || isHighRole)
+    },
+    filteredData(judge, data) {
+      const { userId = '' } = this.$store.getters
+      const result = data.reduce((acc, item) => {
+        // acc.push(item)
+
+        if (judge) {
+          if (userId && (item.partys.some(obj => obj.value === userId && item.createBy !== userId && obj.status === '待审核') || (item.executor && item.status === '待审批')) && (item.status === '待审核' || item.status === '待审批')) {
+            acc.push(item)
+          }
+        } else {
+          if (userId && (item.partys.some(obj => obj.value === userId && item.createBy !== userId && obj.status === '待审核') || (item.executor && item.executor.includes(userId) && item.status === '待审批'))) {
+            acc.push(item)
+          }
+        }
+        return acc
+      }, [])
+      return result
     },
     /**
        * 获取格式化参数
@@ -254,13 +294,14 @@ export default {
       //   }
       return ActionUtils.formatParams(
         params,
-        this.pagination,
+        { page: this.page },
         this.sorts)
     },
-    LiftUpPop() {
+    LiftUpPop(id, typeValue) {
       this.scrollWhere = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop
       this.stopScroll()
-      this.getGo('', '3')
+      // this.getGo('', '3')
+      this.getGo(id, typeValue)
     },
     /**
        * 下拉刷新
@@ -402,8 +443,8 @@ export default {
     padding: 0 13px;
     border-radius: 5px;
   }
-  .u-m-r-15 {
-    margin-right: 8px !important;
+  .u-m-l-15 {
+    margin-left: 8px !important;
   }
   .verticalLine {
     color: #000;