Browse Source

上传出差管理

Lijy 2 years ago
parent
commit
ed6cd784a6

File diff suppressed because it is too large
+ 1 - 0
fhKeeper/formulahousekeeper/timesheet_h5/src/assets/shju.json


+ 61 - 5
fhKeeper/formulahousekeeper/timesheet_h5/src/views/exaLeave/applyLeave.vue

@@ -3,10 +3,13 @@
     <van-nav-bar title="请假管理" left-text="返回" @click-left="back" fixed left-arrow style="z-index:1000" />
 <div class="content">
     <van-tabs v-model="active" @change="activeChange">
-        <van-tab title="请假填报" :name="0"></van-tab>
-        <van-tab title="请假单列表" :name="1"></van-tab>
-        <van-tab title="请假审核" :name="2" v-if="leaveAudit"></van-tab>
+        <!-- <van-tab title="请假填报" :name="0" v-if="leaveFil"></van-tab> -->
+        <van-tab title="请假填报" :name="0" v-if="leaveFil && !isSyncData"></van-tab>
+        <van-tab title="请假单列表" :name="1" v-if="leaveSingleList"></van-tab>
+        <van-tab title="请假审核" :name="2" v-if="leaveAudit && !isSyncData"></van-tab>
+        <van-tab title="假期剩余表" :name="3" v-if="isSyncData"></van-tab>
     </van-tabs>
+
     <div class="edit" v-if="active == 0">
         <van-form class="edit_form" ref="loginForm" label-width="120">
                 <!-- 请假类型 -->
@@ -86,7 +89,6 @@
         </div>
     </div>
     <div class="list" v-if="active == 1">
-
         <van-collapse v-model="activeName" accordion class="list_collapse">
                 <van-collapse-item v-for="item in leaveList" :key="item.id" title="标题1" :name="item.id">
                     <template #title>
@@ -105,7 +107,7 @@
                         <div><span>请假时长:</span><span>{{item.timeHours ? item.timeHours + '小时' : '/'}}</span></div>
                         <div><span>备注:</span><span>{{item.remark}}</span></div>
                     </div>
-                    <div class="operation" v-if="(item.status != 0 && item.ownerId == user.id) || leaveAll">
+                    <div class="operation" v-if="((item.status != 0 && item.ownerId == user.id) || leaveAll) && !isSyncData">
                         <van-button v-if="item.status == 3 || item.status == 2" size="small" type="info" @click="submitAgain(item)">重新提交</van-button>
                         <van-button v-if="item.status == 3 || item.status == 2" style="margin-left:10px" size="small" type="danger" @click="deleteLeave(item.id)">删除</van-button>
                         <van-button v-if="item.status == 1" style="margin-left:10px" size="small" type="default" @click="cancelLeave(item.id)">撤回</van-button>
@@ -146,6 +148,30 @@
                 <van-button style="width:100%;" type="info" :loading="denyLoading" @click="deny()">提交</van-button>
             </van-popup>
     </div>
+    <div class="audit" v-if="active == 3">
+            <van-collapse v-model="auditName" accordion class="list_collapse">
+                <van-collapse-item v-for="item in dingDingLeaveQtList" :key="item.id" title="标题2" :name="item.id">
+                    <template #title>
+                        <div class="collapse_label_l">员工姓名:
+                            <span v-if="user.userNameNeedTranslate == 1"><ww-open-data type='userName' :openid='item.name'></ww-open-data></span>
+                            <span v-else>{{item.name}}</span>
+                        </div>
+                        <div class="collapse_label_r">总额度:{{item.quotaInDays}}天</div>
+                        <div class="collapse_label_l">已使用:{{item.usedInDays}}天</div>
+                        <div class="collapse_label_l">剩余额度:{{item.leftInDays}}天</div>
+                        <div class="collapse_label_l" style="width: 100%">有效期开始日期:{{item.startTime}}</div>
+                        <div class="collapse_label_l" style="width: 100%">有效期结束日期:{{item.endTime}}</div>
+                    </template>
+                    <div class="wrapper">
+                        <div><span>总额度:</span><span>{{item.quotaInDays}}天</span></div>
+                        <div><span>已使用:</span><span>{{item.usedInDays}}天</span></div>
+                        <div><span>剩余额度:</span><span>{{item.leftInDays}}天</span></div>
+                        <div><span>有效期开始日期:</span><span>{{item.startTime}}</span></div>
+                        <div><span>有效期结束日期:</span><span>{{item.endTime}}</span></div>
+                    </div>
+                </van-collapse-item>
+            </van-collapse>
+    </div>
 </div>
 </div>
 </template>
@@ -154,9 +180,12 @@
 export default {
     data() {
         return {
+            isSyncData: 0,
             user: JSON.parse(localStorage.userInfo),
+            dingDingLeaveQtList: [],
             canExamine: false,
             leaveAll: false,
+            leaveSingleList: false,
             leaveAudit: false,
             leaveFil: false,
             active: 0,
@@ -210,6 +239,9 @@ export default {
         }
     },
     mounted() {
+        this.isSyncData = this.user.timeType.syncDingding || this.user.timeType.syncFanwei;
+        console.log(this.isSyncData)
+        this.leaveSingleList = true
         for(let i in this.user.functionList){
             if(this.user.functionList[i].name == '查看全部请假单'){
                 this.leaveAll = true
@@ -221,6 +253,18 @@ export default {
                 this.leaveFil = true
             }
         }
+        if(this.isSyncData) {
+            this.getLeaveList()
+        } else {
+            if(this.leaveAudit) {
+                this.active = '2'
+                this.getAuditList()
+            }
+            if(this.leaveFil) {
+                this.active = '0'
+            }
+        }
+        
         // if(!this.canExamine){
             this.editForm.ownerId = this.user.id
             this.formshowText.name = this.user.name
@@ -258,6 +302,9 @@ export default {
             if(this.active == 2){
                 this.getAuditList()
             }
+            if(this.active == 3) {
+                this.getDingDingLeaveQt()
+            }
         },
 // #region 
         ownerIdChange(){
@@ -364,6 +411,15 @@ export default {
             }
             this.formshowText.dateTitle = ''
         },
+        getDingDingLeaveQt(){
+            this.$axios.post("/user-yearleave-setting/getDingDingLeaveQt", {
+                companyId: this.user.companyId,
+                pageIndex: 1
+            })
+            .then(res => {
+                this.dingDingLeaveQtList = res.data.records
+            }).catch(err=> {this.submitLoading = false;this.$toast.clear();console.log(err)});
+        },
 // #endregion
 
 // #region

+ 244 - 185
fhKeeper/formulahousekeeper/timesheet_h5/src/views/exaLeave/awayOffice.vue

@@ -1,108 +1,95 @@
 <template>
 <div>
     <van-nav-bar title="出差管理" left-text="返回" @click-left="back" fixed left-arrow style="z-index:1000" />
-<div class="content">
-    <van-tabs v-model="active" @change="activeChange">
-        <van-tab title="出差填报" :name="0"></van-tab>
-        <van-tab title="出差列表" :name="1"></van-tab>
-        <van-tab title="出差审核" :name="2" v-if="leaveAudit"></van-tab>
-    </van-tabs>
-    <div class="edit" v-if="active == 0">
-        <van-form class="edit_form" ref="loginForm" label-width="120">
-                <!-- 请假类型 -->
-                <van-field v-model="editForm.leaveType" label="请假类型" @click="typeShow = true" readonly clickable>
-                    <template #input>{{typeList[editForm.leaveType]}}</template>
-                </van-field>
-                <van-popup v-model="typeShow" position="bottom">
-                    <van-picker
-                    show-toolbar
-                    :columns="typeList"
-                    @confirm="typeChange"
-                    @cancel="typeShow = false;$forceUpdate();"/>
-                </van-popup>
-                <!-- 请假人 -->
-                <van-field v-model="editForm.ownerId" label="请假人" @click="ownerIdShow = true" :readonly="!canExamine" clickable required :rules="[{ required: true, message: '请选择请假人' }]">
-                    <template #input>
-                        <span v-if="user.userNameNeedTranslate == 1 && formshowText.name"><ww-open-data type='userName' :openid='formshowText.name'></ww-open-data></span>
-                        <span v-else>{{formshowText.name}}</span>
-                    </template>
-                </van-field>
-                <van-popup v-model="ownerIdShow" position="bottom" v-if="canExamine">
-                    <div style="minHeight:300px;">
-                        <van-radio-group v-model="userRadio" v-if="user.userNameNeedTranslate == '1'">
-                            <van-radio v-for="item in userList" :key="item.id" :name="item" class="userCheckbox">
-                                <ww-open-data type='userName' :openid='item.name'></ww-open-data>
-                            </van-radio>
-                        </van-radio-group>
-                        <van-radio-group v-model="userRadio" v-else>
-                            <van-radio v-for="item in userList" :key="item.id" :name="item" class="userCheckbox">{{item.name}}</van-radio>
-                        </van-radio-group>
-                        <van-button style="width:100%;position: -webkit-sticky;position: sticky;bottom: 0;" @click="ownerIdChange()">确定</van-button>
-                    </div>
-                </van-popup>
-                <!-- 电话 -->
-                <van-field label="电话" v-model="editForm.tel" type="number" :rules="[{ required: true, message: '请输入联系电话' }]"></van-field>
-                <!-- 按天/小时请假 -->
-                <van-field label="时长单位" readonly>
-                    <template #input>
-                        <van-radio-group v-model="editForm.timeType" direction="horizontal" @change="timeTypeChange">
-                            <van-radio name="0">按天</van-radio>
-                            <van-radio name="1" v-if="editForm.leaveType != 6">按小时</van-radio>
-                        </van-radio-group>
-                    </template>
-                </van-field>
-                <!-- 选择日期 -->
-                <van-field :label="editForm.timeType == '0' ? '选择日期' : '选择时间'" v-model="formshowText.dateTitle" @click="dateShow()" readonly clickable :rules="[{ required: true, message: editForm.timeType == '0' ? '请选择日期' : '请选择时间' }]">
-                    <template #input><span>{{formshowText.dateTitle}}</span></template>
-                </van-field>
+    <div class="content" v-show="!isSyncData">
+        <van-tabs v-model="active" @change="activeChange">
+            <van-tab title="出差填报" :name="0" v-if="awayOfficeFil"></van-tab>
+            <van-tab title="出差列表" :name="1" v-if="awayOfficeList"></van-tab>
+            <van-tab title="出差审核" :name="2" v-if="awayOfficeAudit"></van-tab>
+        </van-tabs>
+        <div class="edit" v-if="active == 0">
+            <van-form class="edit_form" ref="loginForm" label-width="120">
+                    <!-- 出差事由 -->
+                    <van-field v-model="editForm.reason" label="出差事由" type="textarea" :autosize="{minHeight:50}" required :rules="[{ required: true, message: '请填写出差事由' }]"></van-field>
+                    <!-- 请假类型 -->
+                    <van-field v-model="editForm.way" label="交通工具" @click="typeShow = true" readonly clickable>
+                        <template #input>{{typeList[editForm.way]}}</template>
+                    </van-field>
+                    <van-popup v-model="typeShow" position="bottom">
+                        <van-picker
+                        show-toolbar
+                        :columns="typeList"
+                        @confirm="typeChange"
+                        @cancel="typeShow = false;$forceUpdate();"/>
+                    </van-popup>
+                    <!-- 请假人 -->
+                    <van-field v-model="editForm.cityFrom" label="出发城市" @click="ownerIdShow = true,cityType = 1" clickable required :rules="[{ required: true, message: '请选择出发城市' }]">
+                        <template #input>
+                            <span>{{ editForm.cityFrom }}</span>
+                        </template>
+                    </van-field>
+                    <van-field v-model="editForm.cityTo" label="目的城市" @click="ownerIdShow = true,cityType = 2" clickable required :rules="[{ required: true, message: '请选择出发城市' }]">
+                        <template #input>
+                            <span>{{ editForm.cityTo }}</span>
+                        </template>
+                    </van-field>
+                    <van-popup v-model="ownerIdShow" position="bottom">
+                        <div style="minHeight:300px;">
+                            <van-radio-group v-model="userRadio">
+                                <van-radio v-for="item in cityList" :key="item.id" :name="item" class="userCheckbox">{{item.label}}</van-radio>
+                            </van-radio-group>
+                            <van-button style="width:100%;position: -webkit-sticky;position: sticky;bottom: 0;" @click="cityToChange()">确定</van-button>
+                        </div>
+                    </van-popup>
+                    <!-- 单程往返 -->
+                    <van-field label="单程往返" readonly>
+                        <template #input>
+                            <van-radio-group v-model="editForm.goBack" direction="horizontal" @change="timeTypeChange">
+                                <van-radio name="0">单程</van-radio>
+                                <van-radio name="1">往返</van-radio>
+                            </van-radio-group>
+                        </template>
+                    </van-field>
+                    <!-- 选择日期 -->
+                    <van-field label="选择日期" v-model="formshowText.dateTitle" @click="dateShow()" readonly clickable required :rules="[{ required: true, message: '请选择日期'}]">
+                        <template #input><span>{{formshowText.dateTitle}}</span></template>
+                    </van-field>
                     <!-- 按天 -->
-                <van-calendar v-model="dateShow_day" type="range" :allow-same-day="true" :show-confirm="false" @confirm="date_dayChange" :min-date="minDate" :max-date="maxDate" />
-                    <!-- 按小时 -->
-                <van-popup v-model="dateShow_hour" position="bottom">
-                    <van-datetime-picker
-                    type="date"
-                    title="选择填报日期"
-                    @confirm="date_hourChange"
-                    v-model="currentDate"
-                    @cancel="dateShow_hour = false;$forceUpdate();"
-                    :min-date="minDate"
-                    :max-date="maxDate"/>
-                </van-popup>
-                <!-- 请假天数 -->
-                <van-field label="请假天数(天)" v-if="editForm.timeType == '0'" @blur="dayBlur()" v-model="editForm.timeDays" type="number" :rules="[{ required: true, message: '请输入请假天数' }]"></van-field>
-                <!-- 请假时长 -->
-                <van-field label="请假时长(小时)" v-else v-model="editForm.timeHours" @blur="hourBlur()" type="number" :rules="[{ required: true, message: '请输入请假时长' }]"></van-field>
-                <!-- 备注 -->
-                <van-field v-model="editForm.remark" label="备注" type="textarea" :autosize="{minHeight:100}"></van-field>
-        </van-form>
-        <!-- 提交 -->
-        <div class="form_btn" style="position:fixed; bottom:0px;width:100%;">
-            <div style="padding-bottom:10px;" v-if="editForm.id">
-                <van-button square block type="default" @click="clearEditForm()" style="width:100%;float:left;">清除</van-button>
-            </div>
-            <div style="padding-bottom:10px;">
-                <van-button square block type="info" @click="submitLeave()" :disabled="txselnum == 0 && editForm.leaveType == 6 && editForm.ownerId != '' ? true : false" :loading="submitLoading" style="width:100%;float:left;">提交</van-button>
+                    <van-calendar v-model="dateShow_day" type="range" :allow-same-day="true" :show-confirm="false" @confirm="date_dayChange" :min-date="minDate" :max-date="maxDate" />
+                    <!-- 出差天数 -->
+                    <van-field label="出差天数(天)" @blur="dayBlur()" v-model="editForm.dayCount" type="number" :rules="[{ required: true, message: '请输入请假天数' }]"></van-field>
+            
+                    <!-- 备注 -->
+                    <van-field v-model="editForm.remark" label="备注" type="textarea" :autosize="{minHeight:100}"></van-field>
+            </van-form>
+            <!-- 提交 -->
+            <div class="form_btn" style="position:fixed; bottom:0px;width:100%;">
+                <div style="padding-bottom:10px;" v-if="editForm.id">
+                    <van-button square block type="default" @click="clearEditForm()" style="width:100%;float:left;">清除</van-button>
+                </div>
+                <div style="padding-bottom:10px;">
+                    <van-button square block type="info" @click="submitLeave()" :loading="submitLoading" style="width:100%;float:left;">提交</van-button>
+                </div>
             </div>
         </div>
-    </div>
-    <div class="list" v-if="active == 1">
+        <div class="list" v-if="active == 1">
 
-        <van-collapse v-model="activeName" accordion class="list_collapse">
+            <van-collapse v-model="activeName" accordion class="list_collapse">
                 <van-collapse-item v-for="item in leaveList" :key="item.id" title="标题1" :name="item.id">
                     <template #title>
-                        <div class="collapse_label_l">请假人:
+                        <div class="collapse_label_l">人员:
                             <span v-if="user.userNameNeedTranslate == 1"><ww-open-data type='userName' :openid='item.ownerName'></ww-open-data></span>
                             <span v-else>{{item.ownerName}}</span>
                         </div>
-                        <div class="collapse_label_r">电话:{{item.tel}}</div>
-                        <div class="collapse_label_l">请假类型:{{typeList[item.leaveType]}}</div>
+                        <div class="collapse_label_r">天数:{{item.dayCount}}</div>
+                        <div class="collapse_label_l">行程:{{item.cityFrom + '-' + item.cityTo}}</div>
                         <div class="collapse_label_r">状态:<span :class="statusClass[item.status]">{{statusList[item.status]}}</span></div>
                     </template>
                     <div class="wrapper">
-                        <div><span>请假开始时间:</span><span>{{item.startDate}}</span></div>
-                        <div><span>请假结束时间:</span><span>{{item.endDate}}</span></div>
-                        <div><span>请假天数:</span><span>{{item.timeDays ? item.timeDays + '天' : '/'}}</span></div>
-                        <div><span>请假时长:</span><span>{{item.timeHours ? item.timeHours + '小时' : '/'}}</span></div>
+                        <div><span>交通工具:</span><span>{{typeList[item.way]}}</span></div>
+                        <div><span>申请时间:</span><span>{{item.indate}}</span></div>
+                        <div><span>出差开始时间:</span><span>{{item.startDate}}</span></div>
+                        <div><span>出差结束时间:</span><span>{{item.endDate}}</span></div>
                         <div><span>备注:</span><span>{{item.remark}}</span></div>
                     </div>
                     <div class="operation" v-if="(item.status != 0 && item.ownerId == user.id) || leaveAll">
@@ -112,65 +99,110 @@
                     </div>
                 </van-collapse-item>
             </van-collapse>
+        </div>
+        <div class="audit" v-if="active == 2">
+                <van-collapse v-model="auditName" accordion class="list_collapse">
+                    <van-collapse-item v-for="item in auditList" :key="item.id" title="标题2" :name="item.id">
+                        <template #title>
+                            <div class="collapse_label_l">人员:
+                                <span v-if="user.userNameNeedTranslate == 1"><ww-open-data type='userName' :openid='item.ownerName'></ww-open-data></span>
+                                <span v-else>{{item.ownerName}}</span>
+                            </div>
+                            <div class="collapse_label_r">天数:{{item.dayCount}}</div>
+                            <div class="collapse_label_l">行程:{{item.cityFrom + '-' + item.cityTo}}</div>
+                            <div class="collapse_label_r">状态:<span :class="statusClass[item.status]">{{statusList[item.status]}}</span></div>
+                            <div class="operation">
+                                <van-button size="small" type="info" :loading="item.approveLoading" @click.stop="approveLeave(item)">通过</van-button>
+                                <van-button style="margin-left:15px" size="small" type="danger" @click.stop="denyLeave(item.id)">驳回</van-button>
+                            </div>
+                        </template>
+                        <div class="wrapper">
+                            <div><span>交通工具:</span><span>{{typeList[item.way]}}</span></div>
+                            <div><span>申请时间:</span><span>{{item.indate}}</span></div>
+                            <div><span>出差开始时间:</span><span>{{item.startDate}}</span></div>
+                            <div><span>出差结束时间:</span><span>{{item.endDate}}</span></div>
+                            <div><span>备注:</span><span>{{item.remark}}</span></div>
+                        </div>
+                    </van-collapse-item>
+                </van-collapse>
+                <van-popup v-model="denyReasonDialog" position="bottom" closeable >
+                    <van-cell>请输入原因</van-cell>
+                    <van-field class="form_input"
+                        v-model="denyParm.denyReason" name="reason" type="textarea" placeholder="请输入您决定驳回的原因"
+                        rows="3" autosize  />
+                    <van-button style="width:100%;" type="info" :loading="denyLoading" @click="deny()">提交</van-button>
+                </van-popup>
+        </div>
     </div>
-    <div class="audit" v-if="active == 2">
-            <van-collapse v-model="auditName" accordion class="list_collapse">
-                <van-collapse-item v-for="item in auditList" :key="item.id" title="标题2" :name="item.id">
+    <!-- 钉钉同步 -->
+    <div class="content" v-show="isSyncData">
+        <div class="list">
+            <van-collapse v-model="activeName" accordion class="list_collapse">
+                <van-collapse-item v-for="item in leaveList" :key="item.id" title="标题1" :name="item.id">
                     <template #title>
-                        <div class="collapse_label_l">请假人:
+                        <div class="collapse_label_l">人
                             <span v-if="user.userNameNeedTranslate == 1"><ww-open-data type='userName' :openid='item.ownerName'></ww-open-data></span>
                             <span v-else>{{item.ownerName}}</span>
                         </div>
-                        <div class="collapse_label_r">电话:{{item.tel}}</div>
-                        <div class="collapse_label_l">请假类型:{{typeList[item.leaveType]}}</div>
+                        <div class="collapse_label_r">天数:{{item.dayCount}}天</div>
+                        <div class="collapse_label_l">交通工具:{{typeList[item.way]}}</div>
                         <div class="collapse_label_r">状态:<span :class="statusClass[item.status]">{{statusList[item.status]}}</span></div>
-                        <div class="operation">
-                            <van-button size="small" type="info" :loading="item.approveLoading" @click.stop="approveLeave(item)">通过</van-button>
-                            <van-button style="margin-left:15px" size="small" type="danger" @click.stop="denyLeave(item.id)">驳回</van-button>
-                        </div>
                     </template>
                     <div class="wrapper">
-                        <div><span>请假开始时间:</span><span>{{item.startDate}}</span></div>
-                        <div><span>请假结束时间:</span><span>{{item.endDate}}</span></div>
-                        <div><span>请假天数:</span><span>{{item.timeDays ? item.timeDays + '天' : '/'}}</span></div>
-                        <div><span>请假时长:</span><span>{{item.timeHours ? item.timeHours + '小时' : '/'}}</span></div>
+                        <div><span>出差详情:</span>
+                            <span v-for="items in item.projectList" :key="items.projectId">
+                                <span>{{items.startDate + '至' + items.endDate}}</span><span>{{items.projectName}}</span><span>{{items.degreeName}}</span>
+                            </span>
+                        </div>
+                        <div><span>出差开始时间:</span><span>{{item.startDate}}</span></div>
+                        <div><span>出差结束时间:</span><span>{{item.endDate}}</span></div>
                         <div><span>备注:</span><span>{{item.remark}}</span></div>
                     </div>
+                    <!-- <div class="operation">
+                        <van-button size="small" type="info" @click="submitAgain(item)">关联</van-button>
+                    </div> -->
                 </van-collapse-item>
             </van-collapse>
-            <van-popup v-model="denyReasonDialog" position="bottom" closeable >
-                <van-cell>请输入原因</van-cell>
-                <van-field class="form_input"
-                    v-model="denyParm.denyReason" name="reason" type="textarea" placeholder="请输入您决定驳回的原因"
-                    rows="3" autosize  />
-                <van-button style="width:100%;" type="info" :loading="denyLoading" @click="deny()">提交</van-button>
-            </van-popup>
+        </div>
     </div>
 </div>
-</div>
 </template>
 
 <script>
+// 映入城市
+import citys from '../../assets/shju.json'
+
 export default {
     data() {
         return {
+            isSyncData: 0,
+            wuduData: JSON.parse(localStorage.userInfo).timeType,
             user: JSON.parse(localStorage.userInfo),
+            awayOfficeFil: false,
+            awayOfficeAudit: false,
+            awayOfficeList: false,
+
             canExamine: false,
             leaveAll: false,
             leaveAudit: false,
             leaveFil: false,
             active: 0,
             txselnum: 0,
+            cityType: '',
+            cityList: [],
+            cityList2: [],
             editForm: {
-                leaveType: 0,
-                ownerId: '',
-                tel: '',
+                reason: '',
                 startDate: '',
                 endDate: '',
-                timeType: '0',
-                timeDays: 0,
-                timeHours: 8,
-                remark: ''
+                way: 0,
+                cityFrom: '',
+                cityTo: '',
+                goBack: '0',
+                dayCount: 0,
+                remark: '',
+                projectId: '',
+                wuduId: '',
             },
             formshowText: {
                 name: '',
@@ -178,7 +210,7 @@ export default {
             },
             userRadio: null,
             userList: [],
-            typeList: ['事假','病假','年假','产假','婚假','丧假','调休假','陪产假','其他'],
+            typeList: ['飞机','火车','汽车','轮船','其他'],
             currentDate: new Date(),
             minDate: new Date(2020,0,1),
             maxDate: new Date(2030,11,31),
@@ -209,26 +241,46 @@ export default {
             
         }
     },
+    filters: {
+        departureCity(str, json) {
+            for(var i in json) {
+                if(json[i].value == str) {
+                    return json[i].label
+                }
+            }
+        }
+    },
     mounted() {
+        this.cityList = citys
+        this.cityList2 = citys
+        this.isSyncData = (this.wuduData.syncDingding || this.wuduData.syncFanwei)
+        console.log(this.isSyncData, '是否是钉钉')
+
         for(let i in this.user.functionList){
-            if(this.user.functionList[i].name == '查看全部请假单'){
+            if(this.user.functionList[i].name == '查看全部出差'){
                 this.leaveAll = true
             }
-            if(this.user.functionList[i].name == '请假审核'){
-                this.leaveAudit = true
+            if(this.user.functionList[i].name == '出差填报'){
+                this.awayOfficeFil = true
+            }
+            if(this.user.functionList[i].name == '出差审核'){
+                this.awayOfficeAudit = true
+            }
+        }
+        if(this.isSyncData) {
+            this.getLeaveList()
+        } else {
+            this.awayOfficeList = true
+            if(this.awayOfficeAudit) {
+                this.active = '2'
+                this.getAuditList()
             }
-            if(this.user.functionList[i].name == '请假填报'){
-                this.leaveFil = true
+            if(this.awayOfficeFil) {
+                this.active = '0'
             }
         }
-        // if(!this.canExamine){
-            this.editForm.ownerId = this.user.id
-            this.formshowText.name = this.user.name
-            this.editForm.timeHours = this.user.timeType.allday
-            this.getTxsel()
-        // }else{
-        //     this.getUserList()
-        // }
+        
+        this.getTxsel()
     },
     methods: {
         back(){
@@ -260,41 +312,32 @@ export default {
             }
         },
 // #region 
-        ownerIdChange(){
-            this.editForm.ownerId = this.userRadio ? this.userRadio.id : ''
-            this.formshowText.name = this.userRadio ? this.userRadio.name : ''
+        cityToChange(){
+            if(this.cityType == 1) {
+                this.editForm.cityFrom = this.userRadio ? this.userRadio.label : ''
+            } 
+            if(this.cityType == 2) {
+                this.editForm.cityTo = this.userRadio ? this.userRadio.label : ''
+            }
             this.ownerIdShow = false
         },
         timeTypeChange(){
-            if(this.editForm.timeType == '0'){
-                if(this.editForm.startDate && this.editForm.endDate){
-                    this.formshowText.dateTitle = this.editForm.startDate+'\u3000至\u3000'+this.editForm.endDate
-                }else{
-                    this.formshowText.dateTitle = ''
-                }
+            if(this.editForm.startDate && this.editForm.endDate){
+                this.formshowText.dateTitle = this.editForm.startDate+'\u3000至\u3000'+this.editForm.endDate
             }else{
-                if(this.editForm.startDate){
-                    this.formshowText.dateTitle = this.editForm.startDate
-                }else{
-                    this.formshowText.dateTitle = ''
-                }
+                this.formshowText.dateTitle = ''
             }
             
         },
         dateShow(){
-            
-            if(this.editForm.timeType == '0'){
-                this.dateShow_day = true
-            }else{
-                this.dateShow_hour = true
-            }
+            this.dateShow_day = true
         },
         date_dayChange(value,date){
             this.dateShow_day = false
             this.editForm.startDate = this.formatDate(value[0])
             this.editForm.endDate = this.formatDate(value[1])
             this.formshowText.dateTitle = this.formatDate(value[0])+'\u3000至\u3000'+this.formatDate(value[1])
-            this.editForm.timeDays = this.getDaysBetween(value[0],value[1])
+            this.editForm.dayCount = this.getDaysBetween(value[0],value[1])
         },
         date_hourChange(value){
             this.editForm.startDate = this.formatDate(value)
@@ -303,10 +346,10 @@ export default {
         },
         dayBlur(){
             if(this.editForm.startDate && this.editForm.endDate){
-                if(this.editForm.timeDays*1 < this.getDaysBetween(this.editForm.startDate,this.editForm.endDate) - 1){
-                    this.editForm.timeDays = this.getDaysBetween(this.editForm.startDate,this.editForm.endDate) - 1
-                }else if(this.editForm.timeDays*1 > this.getDaysBetween(this.editForm.startDate,this.editForm.endDate)){
-                    this.editForm.timeDays = this.getDaysBetween(this.editForm.startDate,this.editForm.endDate)
+                if(this.editForm.dayCount*1 < this.getDaysBetween(this.editForm.startDate,this.editForm.endDate) - 1){
+                    this.editForm.dayCount = this.getDaysBetween(this.editForm.startDate,this.editForm.endDate) - 1
+                }else if(this.editForm.dayCount*1 > this.getDaysBetween(this.editForm.startDate,this.editForm.endDate)){
+                    this.editForm.dayCount = this.getDaysBetween(this.editForm.startDate,this.editForm.endDate)
                 }
             }
         },
@@ -320,27 +363,31 @@ export default {
         },
 
         typeChange(value,key){
-            this.editForm.leaveType = key
+            this.editForm.way = key
             this.typeShow = false
         },
         submitLeave(){
             this.$refs.loginForm.validate().then(()=>{
                 console.log('success');
                 this.submitLoading = true
-                this.$axios.post("/leave-sheet/add", this.editForm)
+                console.log(this.editForm, '看看数据')
+                // return
+                this.$axios.post("/business-trip/add", this.editForm)
                 .then(res => {
                     this.submitLoading = false
                     if(res.code == "ok") {
                         this.editForm = {
-                            leaveType: 0,
-                            ownerId: this.editForm.ownerId,
-                            tel: this.editForm.tel,
+                            reason: '',
                             startDate: '',
                             endDate: '',
-                            timeType: '0',
-                            timeDays: 0,
-                            timeHours: this.user.timeType.allday,
-                            remark: ''
+                            way: 0,
+                            cityFrom: '',
+                            cityTo: '',
+                            goBack: '0',
+                            dayCount: 0,
+                            remark: '',
+                            projectId: '',
+                            wuduId: '',
                         }
                         this.formshowText.dateTitle = ''
                         this.$toast.success('提交成功');
@@ -352,15 +399,17 @@ export default {
         },
         clearEditForm(){
             this.editForm = {
-                leaveType: 0,
-                ownerId: this.editForm.ownerId,
-                tel: this.editForm.tel,
+                reason: '',
                 startDate: '',
                 endDate: '',
-                timeType: '0',
-                timeDays: 0,
-                timeHours: this.user.timeType.allday,
-                remark: ''
+                way: 0,
+                cityFrom: '',
+                cityTo: '',
+                goBack: '0',
+                dayCount: 0,
+                remark: '',
+                projectId: '',
+                wuduId: '',
             }
             this.formshowText.dateTitle = ''
         },
@@ -373,7 +422,7 @@ export default {
             })
             .then(() => {
                 // on confirm
-                this.$axios.post("/leave-sheet/cancel", {id: pid})
+                this.$axios.post("/business-trip/cancel", {id: pid})
                 .then(res => {
                     if(res.code == "ok") {
                         this.$toast.success('撤回成功')
@@ -393,7 +442,7 @@ export default {
             })
             .then(() => {
                 // on confirm
-                this.$axios.post("/leave-sheet/delete", {id: pid})
+                this.$axios.post("/business-trip/delete", {id: pid})
                 .then(res => {
                     if(res.code == "ok") {
                         this.$toast.success('删除成功')
@@ -409,20 +458,30 @@ export default {
             
         },
         submitAgain(item){
-            this.editForm = item
-            if(this.editForm.startDate && !this.editForm.endDate){
-                this.$set(this.editForm,'timeType','1')
-            }else{
-                this.$set(this.editForm,'timeType','0')
+            item.goBack = item.goBack + ''
+            this.editForm = {
+                id: item.id,
+                reason: item.reason,
+                startDate: item.startDate,
+                endDate: item.endDate,
+                way: item.way,
+                cityFrom: item.cityFrom,
+                cityTo: item.cityTo,
+                goBack: item.goBack,
+                dayCount: item.dayCount,
+                remark: item.remark,
+                projectId: item.projectId,
+                wuduId: item.wuduId,
             }
             this.timeTypeChange()
+            console.log(item, '数据')
             this.active = 0
         },
 // #endregion
 
         approveLeave(item){
             item.approveLoading = true
-            this.$axios.post("/leave-sheet/approve", {id: item.id})
+            this.$axios.post("/business-trip/approve", {id: item.id})
             .then(res => {
                 if(res.code == "ok") {
                     this.$toast.success('已通过')
@@ -440,7 +499,7 @@ export default {
         },
         deny(){
             this.denyLoading = true
-            this.$axios.post("/leave-sheet/deny", this.denyParm)
+            this.$axios.post("/business-trip/deny", this.denyParm)
             .then(res => {
                 if(res.code == "ok") {
                     this.$toast.success('已驳回')
@@ -487,7 +546,7 @@ export default {
                 // ownerId: '',
                 // leaveType: ''
             }
-            this.$axios.post("/leave-sheet/list", parameter)
+            this.$axios.post("/business-trip/list", parameter)
             .then(res => {
                 if(res.code == "ok") {
                     this.leaveList = res.data.records
@@ -497,7 +556,7 @@ export default {
             }).catch(err=> {this.$toast.clear();console.log(err)});
         },
         getAuditList(){
-            this.$axios.post("/leave-sheet/auditList", {
+            this.$axios.post("/business-trip/auditList", {
                 pageSize: 999,
                 pageIndex: 1
             }).then(res => {

+ 15 - 4
fhKeeper/formulahousekeeper/timesheet_h5/src/views/index/index.vue

@@ -39,6 +39,7 @@
                 ],
                 routers: [],
                 key: 0,
+                isSyncData: null
             };
         },
         created() {
@@ -47,6 +48,9 @@
             }
         },
         mounted() {
+            // 是否为钉钉同步
+            this.isSyncData = this.user.timeType.syncDingding || this.user.timeType.syncFanwei;
+
             //有错误信息,优先跳转到登录页面去
             if(window.location.href.indexOf('errorMsg') != '-1') {
                 this.$router.push("/login");
@@ -140,11 +144,18 @@
                         this.routers.push({name: '导入日报审核',url: '/audit',icon: 'completed'})
                     }
 
-                    if(list[i].name == '请假管理') {
-                        this.routers.push({name: '请假管理',url: '/applyLeave',icon: 'completed'})
-                        // this.routers.push({name: '请假审批',url: '/exaLeave',icon: 'completed'})
-                        // this.routers.push({name: '出差管理',url: '/awayOffice',icon: 'completed'})
+                    if(!this.isSyncData) {
+                        if(list[i].name == '请假管理') {
+                            this.routers.push({name: '请假管理',url: '/applyLeave',icon: 'notes-o'})
+                            // this.routers.push({name: '请假审批',url: '/exaLeave',icon: 'completed'})
+                            // this.routers.push({name: '出差管理',url: '/awayOffice',icon: 'completed'})
+                        }
+
+                        if(list[i].name == '出差管理') {
+                            this.routers.push({name: '出差管理',url: '/awayOffice',icon: 'logistics'})
+                        }
                     }
+                    
 
                     if(list[i].name == '费用报销') {
                         this.routers.push({