list.vue 86 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263
  1. <template>
  2. <section id="section">
  3. <div class="sidebars" ref="sidebars" :style="'width: 180px;display: block;overflow:hidden;background: #fff;height:'+hubs+ 'px'">
  4. <h3><i class="iconfont firerock-iconbaoxiao" style="padding-right: 10px"></i>{{ $t('navigation.askForLeaveManagement') }}</h3>
  5. <el-divider ></el-divider>
  6. <el-col :span="12">
  7. <el-menu :default-active="isSyncData ? '7' : '1'" class="el-menu-vertical-demo" @select="staffs" background-color="#ffffff" text-color="#666666" active-text-color="#20A0FF" style="width:100%">
  8. <!-- <el-submenu index="1">
  9. <template slot="title">
  10. <i class="iconfont firerock-icontianbao"></i>
  11. <span>员工请假填报</span>
  12. </template>
  13. <el-menu-item index="1-1"><p @click="ssl(0)">请事假</p></el-menu-item>
  14. <el-menu-item index="1-2"><p @click="ssl(1)">请病假</p></el-menu-item>
  15. <el-menu-item index="1-3"><p @click="ssl(2)">请年假</p></el-menu-item>
  16. <el-menu-item index="1-4"><p @click="ssl(3)">请产假</p></el-menu-item>
  17. </el-submenu> -->
  18. <template v-if="!isSyncData">
  19. <el-menu-item index="1" v-if="permissions.leaveFil">
  20. <i class="iconfont firerock-icontianbao"></i>
  21. <span slot="title">{{ $t('staffleavetofillin') }}</span>
  22. </el-menu-item>
  23. <el-submenu index="2" v-if="permissions.leaveAll">
  24. <template slot="title">
  25. <i class="iconfont firerock-iconbaoxiaodan"></i>
  26. <span>{{ $t('singlelistofleave') }}</span>
  27. </template>
  28. <el-menu-item index="2-1" ><p @click="bills(false, 2)" v-if="permissions.leaveAll">{{ $t('all') }}</p></el-menu-item>
  29. <el-menu-item index="2-2" ><p @click="bills(true, 1)" v-if="permissions.leaveAudit">{{ $t('state.WaitingAudit') }}</p></el-menu-item>
  30. </el-submenu>
  31. <el-menu-item index="3" @select="bills" @click="bills(false, 2)" v-if="!permissions.leaveAll">
  32. <i class="iconfont firerock-iconbaoxiaodan"></i>
  33. <span slot="title">{{ $t('myleaveform') }}</span>
  34. </el-menu-item>
  35. <el-menu-item index="4" v-if="permissions.leaveStatistical">
  36. <template slot="title">
  37. <i class="iconfont firerock-icontianbao"></i>
  38. <span slot="title">{{ $t('for') }}</span>
  39. </template>
  40. </el-menu-item>
  41. <el-menu-item index="5" v-if="permissions.leaveProcess">
  42. <template slot="title">
  43. <i class="iconfont firerock-iconliucheng"></i>
  44. <span slot="title">{{ $t('leaveApprovalProcess') }}</span>
  45. </template>
  46. </el-menu-item>
  47. <el-menu-item index="6" v-if="permissions.leaveAnnual">
  48. <template slot="title">
  49. <i class="iconfont firerock-icontianbao"></i>
  50. <span slot="title">{{ $t('annualleavemanagement') }}</span>
  51. </template>
  52. </el-menu-item>
  53. </template>
  54. <!-- 钉钉环境对接 -->
  55. <template v-if="isSyncData">
  56. <el-menu-item index="7">
  57. <template slot="title">
  58. <i class="iconfont firerock-iconbaoxiaodan"></i>
  59. <span slot="title">{{ $t('singlelistofleave') }}</span>
  60. </template>
  61. </el-menu-item>
  62. <el-menu-item index="8">
  63. <template slot="title">
  64. <i class="iconfont firerock-iconbaoxiaodan"></i>
  65. <span slot="title">{{ $t('scheduleofremainingLeave') }}</span>
  66. </template>
  67. </el-menu-item>
  68. </template>
  69. </el-menu>
  70. </el-col>
  71. </div>
  72. <!-- 侧边栏点击事件 -->
  73. <!-- <div class="side" @click="side" ref="sid" style="left: 430px">
  74. <div class="spans" ref="side" style="left: -19px;"><i ref="sideI" class="el-icon-arrow-left"></i></div>
  75. </div> -->
  76. <!-- 内容主体区域 -->
  77. <div class="contents">
  78. <div v-if="!displayTable && !isSyncData" class="headine" ref="headine">
  79. <h3 ref="headHe" style="padding-left: 220px">{{ $t('aketimeoffto') }}</h3>
  80. <!-- <p style="float: right;margin-right: 25px;"><el-button type="primary" @click="submits('addFormRules')" size="mini">提交</el-button></p> -->
  81. </div>
  82. <!-- 上面部分 -->
  83. <div v-if="!displayTable && apk == false" class="tops" :style="'height:' +hubs+'px'">
  84. <!-- 公共 -->
  85. <div class="ctons" style="width: 98%">
  86. <!-- 表单 -->
  87. <el-form ref="addForm" :model="addForm" label-width="80px" :rules="addFormRules">
  88. <!-- 请假类型 -->
  89. <el-form-item :label="$t('leavetype')" prop="leaveType" style="width: 100%">
  90. <!--普通员工只能自己填报自己的 -->
  91. <el-select v-model="addForm.leaveType" @change="txselts(addForm.leaveType,addForm.ownerId)" :placeholder="$t('defaultText.pleaseChoose')" style="width: 240px">
  92. <el-option v-for="item in qjType" :key="item.id" :label="item.name" :value="item.id"></el-option>
  93. </el-select>
  94. <template v-if="addForm.leaveType == 6">
  95. <span style="margin-left:18px;color:#777;">{{ $t('restcanbeadjusted') }} {{addForm.ownerId != '' ? txselnum : '~'}} {{ $t('time.day') }}</span>
  96. <el-tooltip effect="dark" :content="$t('overtimhourscabeusedforoffsetting')" placement="top-start">
  97. <i class="el-icon-question" style="color:#606266;"></i>
  98. </el-tooltip>
  99. </template>
  100. </el-form-item>
  101. <!-- 请假人 -->
  102. <el-form-item :label="$t('leavepeople')" prop="ownerId" style="width: 300px">
  103. <!--普通员工只能自己填报自己的 -->
  104. <el-select v-if="user.userNameNeedTranslate != 1" v-model="addForm.ownerId" @change="txselts(addForm.leaveType,addForm.ownerId)" :placeholder="$t('defaultText.pleaseChoose')" style="width: 240px" :disabled="true" filterable="true">
  105. <span v-for="(item, index) in users" :key="index">
  106. <el-option :label="item.name" :value="item.id"></el-option>
  107. </span>
  108. </el-select>
  109. <selectCat v-if="user.userNameNeedTranslate == 1" :size="'medium'" :widthStr="'240'" :subject="users" :subjectId="addForm.ownerId" :distinction="'1'" :disabled="true" @selectCal="selectCal"></selectCat>
  110. </el-form-item>
  111. <!-- 电话 -->
  112. <el-form-item :label="$t('phone')" prop="tel" style="margin-right:300px">
  113. <el-input ref="ipts" v-model="addForm.tel" :placeholder="$t('peaseenterthe')" style="width: 250px"></el-input>
  114. </el-form-item>
  115. <!-- 单选 -->
  116. <el-form-item style="display: inline-block;width:300px" :label="$t('lengthunit')">
  117. <el-radio-group v-model="addForm.timeType" @change="chanRadio()" style="display:inline-block;width:240px">
  118. <el-radio label="0">{{ $t('accordingdays') }}</el-radio>
  119. <el-radio label="1" v-if="addForm.leaveType != 6">{{ $t('leavehour') }}</el-radio>
  120. </el-radio-group>
  121. </el-form-item>
  122. <!-- 选择审批人 -->
  123. <el-form-item :label="$t('approver')" style="width:300px" prop="projectAuditorJson">
  124. <el-select style="display:inline-block;width:250px;" multiple v-model="addForm.projectAuditorJson" :placeholder="$t('defaultText.pleaseChoose')" v-if="user.userNameNeedTranslate != 1">
  125. <el-option
  126. v-for="item in approverList"
  127. :key="item.id"
  128. :label="item.name"
  129. :value="item.id"
  130. ></el-option>
  131. </el-select>
  132. <selectCat v-if="user.userNameNeedTranslate == 1" :size="'medium'" :multiSelect="true" :widthStr="'250'" :subject="users" :subjectId="addForm.ownerId" :distinction="'2'" @selectCal="selectCal"></selectCat>
  133. </el-form-item>
  134. <!-- 时间选择 -->
  135. <el-form-item :label="flg ? $t('optiondate') : $t('other.timeSelection')" style="width: 100%;">
  136. <el-col style="display: inline-block; width: 240px">
  137. <el-date-picker v-if="flg" type="date" :placeholder="$t('time.startDate')" value-format="yyyy-MM-dd" v-model="addForm.startDate" style="width: 240px;" @blur="datas()"></el-date-picker>
  138. <el-date-picker v-else type="date" :placeholder="$t('time.startDate')" value-format="yyyy-MM-dd" v-model="addForm.startDate" style="width: 240px;" @change="datasss()"></el-date-picker>
  139. </el-col>
  140. <el-col class="line" v-if="flg" style="display: inline-block; width: 50px">-</el-col>
  141. <el-col style="display: inline-block; width: 240px">
  142. <el-date-picker v-if="flg" type="date" :placeholder="$t('time.endDate')" value-format="yyyy-MM-dd" :picker-options="pickerOptionsEnd" v-model="addForm.endDate" style="width: 250px;" @blur="datas()"></el-date-picker>
  143. <!-- <el-select v-else v-model="addForm.timeHours" placeholder="请假时长" @change="chanSele()">
  144. <el-option v-for="(item, index) in options" :key="index" :label="item" :value="item"></el-option>
  145. </el-select> -->
  146. </el-col>
  147. </el-form-item>
  148. <!-- 请假天数 -->
  149. <el-form-item :label="flg ? $t('leavedays') : $t('leavetime')" prop="timeDays" style="margin-right: 500px">
  150. <!-- {{flg ? addForm.timeDays : addForm.timeHours}}{{flg ? '天' : '小时'}} -->
  151. <!-- <div v-if="flg">{{addForm.timeDays}} 天</div> -->
  152. <div v-if="flg"> <el-input v-model="addForm.timeDays" @blur="inputs()" @input="addForm.timeDays=addForm.timeDays.replace(/[^\d.]/g,'')" style="width: 120px; margin-right: 20px;" type="number" :step="0.5"></el-input> {{ $t('time.day') }}</div>
  153. <div v-else>
  154. <el-input v-model="addForm.timeHours" @blur="inputss()" @input="addForm.timeHours=addForm.timeHours.replace(/[^\d.]/g,'')" style="width: 120px; margin-right: 20px;"></el-input> {{ $t('time.hour') }}
  155. </div>
  156. </el-form-item>
  157. <!-- 备注 -->
  158. <el-form-item :label="$t('bei-zhu')" style="width: 100%">
  159. <el-input type="textarea" v-model="addForm.remark" :rows="5" style="width: 550px" maxlength="100" show-word-limit></el-input>
  160. </el-form-item>
  161. </el-form>
  162. <div>
  163. <p style="margin-left: 20%"><el-button type="primary" @click="submits('addFormRules')" size="mini" :disabled="txselnum == 0 && addForm.leaveType == 6 && addForm.ownerId != '' ? true : false">{{ $t('btn.submit') }}</el-button></p>
  164. </div>
  165. </div>
  166. </div>
  167. <!-- 下面部分 -->
  168. <div v-if="displayTable && apk == false" class="tops" :style="'height:' +hubs+'px'">
  169. <!-- 公共 -->
  170. <div class="ctons" style="width: 98%;">
  171. <div class="flex">
  172. <div>
  173. <el-select v-if="user.userNameNeedTranslate != 1" v-model="ownerIds" :placeholder="$t('pleaseselectthepersonaskingforleave')" clearable @change="chufas()" style="width: 120px" size="small" v-show="permissions.leaveAll" filterable="true">
  174. <span v-for="(item, index) in users" :key="index">
  175. <el-option :label="item.name" :value="item.id"></el-option>
  176. </span>
  177. </el-select>
  178. <selectCat v-if="user.userNameNeedTranslate == 1" :size="'small'" :subject="users" :subjectId="ownerIds" :distinction="'3'" :disabled="false" :widthStr="'120'" :clearable="true" @selectCal="selectCal" v-show="permissions.leaveAll" style="width: 120px"></selectCat>
  179. </div>
  180. <div>
  181. <span style="color: #606266">{{ $t('leavetype') }}</span>
  182. <el-select v-model="type" :placeholder="$t('defaultText.pleaseChoose')" clearable @change="chufas()" style="width: 110px;" size="small" filterable="true">
  183. <span v-for="(item, index) in typess" :key="index">
  184. <el-option :label="item.name" :value="item.id"></el-option>
  185. </span>
  186. </el-select>
  187. </div>
  188. <div>
  189. <span style="color: #606266">{{$t('offstate')}}</span>
  190. <el-select v-if="falg == 0" v-model="code" :placeholder="$t('defaultText.pleaseChoose')" clearable @change="chufas()" size="small" style="width: 110px" filterable="true">
  191. <span v-for="(item, index) in statuss" :key="index">
  192. <el-option :label="item.name" :value="item.id"></el-option>
  193. </span>
  194. </el-select>
  195. <el-select v-if="falg == 1" disabled v-model="code" :placeholder="$t('pleaseselectthetypeofleave')" clearable @change="chufas()" size="small" style="width: 110px" filterable="true">
  196. <span v-for="(item, index) in statuss" :key="index">
  197. <el-option :label="item.name" :value="item.id"></el-option>
  198. </span>
  199. </el-select>
  200. </div>
  201. <div>
  202. <!-- <span style="color: #606266">请假时间</span>
  203. <el-date-picker v-model="createDate" type="date" @change="chufas()" value-format="yyyy-MM-dd" placeholder="选择日期" size="small" clearable="false"> </el-date-picker> -->
  204. <span style="color: #606266">{{ $t('message.period') }}</span>
  205. <el-date-picker v-model="createDate" type="daterange" :range-separator="$t('other.to')" :start-placeholder="$t('time.startDate')" :end-placeholder="$t('time.endDate')" @change="chufas()" value-format="yyyy-MM-dd" :placeholder="$t('optiondate')" size="small" clearable style="width:250px"></el-date-picker>
  206. </div>
  207. <div>
  208. <el-button type="primary" size="small" style="margin-left:20px" @click="exportLeave()">{{ $t('dao-chu-qing-jia-dan') }}</el-button>
  209. </div>
  210. </div>
  211. <el-table v-loading="loading" :data="tableData" style="width: 100%" height="94%">
  212. <el-table-column prop="ownerName" :label="$t('leavepeople')" min-width="120" fixed="left">
  213. <template slot-scope="scope">
  214. <div>
  215. <span v-if="user.userNameNeedTranslate != 1">{{scope.row.ownerName}}</span>
  216. <span v-if="user.userNameNeedTranslate == 1">
  217. <ww-open-data type='userName' :openid='scope.row.ownerName'></ww-open-data>
  218. </span>
  219. </div>
  220. </template>
  221. </el-table-column>
  222. <el-table-column prop="tel" :label="$t('phone')" min-width="120"></el-table-column>
  223. <el-table-column prop="leaveType" :label="$t('leavetype')" min-width="120">
  224. <template slot-scope="scope">
  225. <!-- <div v-if="scope.row.leaveType == 0">事假</div>
  226. <div v-if="scope.row.leaveType == 1">病假</div>
  227. <div v-if="scope.row.leaveType == 2">年假</div>
  228. <div v-if="scope.row.leaveType == 3">产假</div> -->
  229. {{qjType[scope.row.leaveType].name}}
  230. </template>
  231. </el-table-column>
  232. <el-table-column prop="startDate" :label="$t('leavestarttime')" min-width="150"></el-table-column>
  233. <el-table-column prop="endDate" :label="$t('leaveendtime')" min-width="150"></el-table-column>
  234. <el-table-column :label="$t('leavedays')" min-width="120">
  235. <template slot-scope="scope">
  236. <div v-if="scope.row.timeType == '1'">/</div>
  237. <div v-else>{{scope.row.timeDays}} {{ $t('time.day') }}</div>
  238. </template>
  239. </el-table-column>
  240. <el-table-column :label="$t('leavetime')" min-width="120" v-if="!user.timeType.syncDingding">
  241. <template slot-scope="scope">
  242. <div>{{scope.row.timeHours}} {{ $t('time.hour') }}</div>
  243. </template>
  244. </el-table-column>
  245. <el-table-column prop="status" :label="$t('state.states')" min-width="100">
  246. <template slot-scope="scope">
  247. <div v-if="scope.row.status == 0 || scope.row.status == 1 || scope.row.status == 2 || scope.row.status == 3 || scope.row.status == 4">
  248. <div v-if="scope.row.status == 0" >{{ $t('state.approved') }}</div>
  249. <div v-if="scope.row.status == 1" style="color: orange">{{ $t('state.WaitingAudit') }}</div>
  250. <div v-if="scope.row.status == 2" style="color: red">{{ $t('btn.rejected') }}</div>
  251. <div v-if="scope.row.status == 3" style="color: #666666">{{ $t('btn.undo') }}</div>
  252. </div>
  253. <div v-else>
  254. <span>{{ $t('norequestforleaveatpresent') }}</span>
  255. </div>
  256. </template>
  257. </el-table-column>
  258. <el-table-column prop="remark" :label="$t('bei-zhu')" min-width="200" header-align="center">
  259. <template slot-scope="scope">
  260. <!-- <div class="apls">{{scope.row.remark}}</div> -->
  261. <el-popover placement="top-start" :title="$t('biao-ti')" width="200" trigger="hover" :content="scope.row.remark">
  262. <div slot="reference" class="apls">{{scope.row.remark}}</div>
  263. </el-popover>
  264. </template>
  265. </el-table-column>
  266. <el-table-column :label="$t('operation')" min-width="180" fixed="right" v-if="isAuditList && !isSyncData">
  267. <template slot-scope="scope">
  268. <div>
  269. <el-button icon="el-icon-check" circle size="mini" @click.stop.native="approve(scope.row)"></el-button>
  270. <el-button icon="el-icon-close" circle size="mini" @click.stop.native="deny(scope.row)"></el-button>
  271. </div>
  272. </template>
  273. </el-table-column>
  274. <el-table-column :label="$t('operation')" min-width="180" fixed="right" v-if="!isAuditList && !isSyncData">
  275. <template slot-scope="scope">
  276. <div v-if="(scope.row.status != 0 && scope.row.ownerId == user.id) || permissions.leaveAll">
  277. <el-button icon="el-icon-delete" circle size="mini" @click.stop.native="deletes(scope.row)" ></el-button>
  278. <el-button icon="el-icon-edit" circle size="mini" @click.stop.native="editor(scope.row)"></el-button>
  279. </div>
  280. <!-- <div>
  281. <el-button icon="el-icon-delete" circle size="mini" @click.stop.native="deletes(scope.row)"></el-button>
  282. <el-button icon="el-icon-edit" circle size="mini" @click.stop.native="editor(scope.row)"></el-button>
  283. </div> -->
  284. </template>
  285. </el-table-column>
  286. </el-table>
  287. <div class="poss">
  288. <!-- <el-pagination
  289. @size-change="handleSizeChange"
  290. @current-change="handleCurrentChange"
  291. :current-page="currentPage4"
  292. :page-sizes="[20, 50, 100, 200]"
  293. :page-size="20"
  294. layout="total, sizes, prev, pager, next"
  295. :total="total">
  296. </el-pagination> -->
  297. <el-pagination
  298. @size-change="handleSizeChange"
  299. @current-change="handleCurrentChange"
  300. :current-page="page"
  301. :page-sizes="[20, 50, 100, 200]"
  302. :page-size="20"
  303. layout="total, sizes, prev, pager, next"
  304. :total="total">
  305. </el-pagination>
  306. </div>
  307. </div>
  308. </div>
  309. <!-- 统计部分 -->
  310. <div v-if="displayTable && apk && apk2 == 4" class="tops" :style="'height:' +hubs+'px'">
  311. <!-- 公共 -->
  312. <div class="ctons" style="width: 98%;">
  313. <div style="display: flex;align-items: center;padding-bottom: 20px;border-bottom: 1px solid #f2f2f2">
  314. <div style="display: inline-block;width: 350px">
  315. <el-input style="float:left;" v-if="user.userNameNeedTranslate != 1" v-model="keyword" class="input-with-select" :placeholder="$t('pleaseenterstaffsearch')" clearable="true" size="small">
  316. <el-button slot="append" @click="statistical()" icon="el-icon-search"></el-button>
  317. </el-input>
  318. </div>
  319. <div style="display: inline-block;width: 340px">
  320. <span style="display: inline-block;margin: 0 15px 0 20px;color: rgb(96, 98, 102);">{{ $t('time.startDate') }}</span>
  321. <el-date-picker
  322. v-model="statData"
  323. type="date"
  324. :placeholder="$t('optiondate')"
  325. size="small"
  326. @change="statistical()"
  327. clearable="false"
  328. value-format="yyyy-MM-dd"
  329. :picker-options="pickerOptionsStarts">
  330. </el-date-picker>
  331. </div>
  332. <div style="display: inline-block;width: 350px">
  333. <span style="display: inline-block;margin: 0 15px 0 0;color: rgb(96, 98, 102);">{{ $t('time.endDate') }}</span>
  334. <el-date-picker
  335. v-model="endData"
  336. type="date"
  337. :placeholder="$t('optiondate')"
  338. size="small"
  339. @change="statistical()"
  340. clearable="fasle"
  341. value-format="yyyy-MM-dd"
  342. :picker-options="pickerOptionsEnds">
  343. </el-date-picker>
  344. </div>
  345. </div>
  346. <!-- <div style="margin-top: 30px"> -->
  347. <div>
  348. <el-table key="apk2is4" v-loading="loading" :data="statisticalList" height="780px" style="width: 99%">
  349. <el-table-column prop="ownerName" :label="$t('lable.name')" width="300">
  350. <template slot-scope="scope">
  351. <div v-if="scope.row.ownerName">
  352. <span v-if="user.userNameNeedTranslate != 1">{{scope.row.ownerName}}</span>
  353. <span v-if="user.userNameNeedTranslate == 1"><ww-open-data type='userName' :openid='scope.row.ownerName'></ww-open-data></span>
  354. </div>
  355. <div v-else>
  356. <span>{{ $t('Nstatisticpresent') }}</span>
  357. </div>
  358. </template>
  359. </el-table-column>
  360. <el-table-column prop="timeDays" :label="$t('totaldaysleave')" width="300">
  361. <template slot-scope="scope">
  362. {{scope.row.timeDays}} / {{ $t('time.day') }}
  363. </template>
  364. </el-table-column>
  365. <el-table-column prop="timeHours" :label="$t('totallengthofleave')">
  366. <template slot-scope="scope">
  367. {{scope.row.timeHours}}/{{ $t('time.hour') }}
  368. </template>
  369. </el-table-column>
  370. </el-table>
  371. </div>
  372. </div>
  373. </div>
  374. <!-- 审批流 -->
  375. <div v-if="displayTable && apk && apk2 == 5" class="tops" :style="'height:' +hubs+'px'">
  376. <div class="ctons" style="width: 98%;">
  377. <el-col :span="6" >
  378. <el-scrollbar style="height:100%;border:1px solid #dddddd;margin-left:15px;" >
  379. <div class="tree" :style="'height:'+ (tableHeight-120) + 'px'">
  380. <el-tree :data="sdata" :props="sdefaultProps" @node-click="handleNodeClick" accordion>
  381. <!-- 添加试试看 -->
  382. <span class="custom-tree-node" slot-scope="{ node, data }">
  383. <!-- <span>{{ node.label }}</span> -->
  384. <span v-if="user.userNameNeedTranslate == '1'">
  385. <ww-open-data type='departmentName' :openid='node.label'></ww-open-data>
  386. </span>
  387. <span v-else>
  388. {{ node.label }}
  389. <span v-if="false">{{data}}</span>
  390. </span>
  391. </span>
  392. </el-tree>
  393. </div>
  394. </el-scrollbar>
  395. </el-col>
  396. <el-col :span="18" >
  397. <el-scrollbar style="height:100%;border:1px solid #dddddd;margin-right:20px;" >
  398. <div class="tree" :style="'height:'+ (tableHeight-120) + 'px'">
  399. <div style="padding:5px;color:#333;" v-if="depData != null">{{ $t('setup') }} &lt;<span style="color:#20a0ff;">
  400. <!-- {{depData.label}} -->
  401. <span v-if="user.userNameNeedTranslate != 1">{{depData.label}}</span>
  402. <span v-if="user.userNameNeedTranslate == 1"><ww-open-data type='departmentName' :openid='depData.label'></ww-open-data></span>
  403. &gt;</span> {{ $t('approvalprocessforleaveofdirect staff') }}
  404. <el-tooltip effect="dark" v-if="depData != null && depData.children!=null" content="仅适用于当前部门的直属人员,子部门人员的审批流程需要单独设置" placement="top-start">
  405. <i class="el-icon-question"></i>
  406. </el-tooltip>
  407. </div>
  408. <div style="padding:5px;" v-if="depData == null">{{ $t('qing-xuan-ze-bu-men') }}</div>
  409. <div style="width:100%;margin:0 auto;text-align: center; margin-top:50px;" v-if="depData != null">
  410. <span>{{ $t('employeeisallowed') }}</span>
  411. <icon class="iconfont firerock-iconright"></icon>
  412. <icon class="iconfont firerock-iconInsertLine addNode" @click="showNodeDialog(0)"></icon>
  413. <icon class="iconfont firerock-iconright"></icon>
  414. <span v-for="(item, index) in dataArray" :key="item.seq" >
  415. <el-button type="primary" v-if="item.auditorType == 1" @click="editNodeDialog(index, item)">{{item.auditDeptName}}</el-button>
  416. <el-button type="primary" v-if="item.auditorType == 2" @click="editNodeDialog(index, item)">{{item.userName}}</el-button>
  417. <template v-if="item.auditorType == 1 || item.auditorType == 2">
  418. <icon class="iconfont firerock-iconright"></icon>
  419. <icon class="iconfont firerock-iconInsertLine addNode" @click="showNodeDialog(index+1)"></icon>
  420. <icon class="iconfont firerock-iconright"></icon>
  421. </template>
  422. </span>
  423. <!--结束点 -->
  424. <icon class="iconfont firerock-iconApp_New_Line" style="color:#20A0FF;"></icon>
  425. {{ $t('approvaltocomplete') }}
  426. </div>
  427. <div style="width:100%;margin:0 auto;margin-bottom:30px;position: absolute;bottom: 0px;text-align: center; ">
  428. <el-button type="primary" @click="submitInsert" :loading="addLoading">{{ $t('save') }}</el-button>
  429. </div>
  430. </div>
  431. </el-scrollbar>
  432. </el-col>
  433. </div>
  434. <!--部门选择列表 -->
  435. <el-dialog :title="$t('pleaseselectapprover')" v-if="dialogVisible" :visible.sync="dialogVisible" width="460px">
  436. <el-form label-width="140px">
  437. <el-form-item :label="$t('selectdepartmentsdesignatepersonnel')" >
  438. <el-cascader filterable ref="deptCascader" v-model="curDeptId" :placeholder="$t('defaultText.pleaseChoose')" style="width: 100%" @change="chooseDept"
  439. :options="soption" :props="{ checkStrictly: true,expandTrigger: 'hover' }" :show-all-levels="false" clearable v-show="user.userNameNeedTranslate != 1"></el-cascader>
  440. <vueCascader :size="'small'" :widthStr="'200'" :clearable="true" :userName="true" :subject="soption" :radios="true" :distinction="'1'" @vueCasader="vueCasader" v-if="user.userNameNeedTranslate == 1"></vueCascader>
  441. </el-form-item>
  442. </el-form>
  443. <div slot="footer" class="dialog-footer">
  444. <el-button type="default" @click="deleteNode" v-if="!isAdd" style="float:left;">{{ $t('btn.delete') }}</el-button>
  445. <el-button type="primary" @click="addNode" >{{ $t('btn.determine') }}</el-button>
  446. </div>
  447. </el-dialog>
  448. </div>
  449. <!-- 年假管理 -->
  450. <div v-if="displayTable && apk && apk2 == 6" class="tops" :style="'height:' +hubs+'px'">
  451. <div class="ctons" style="width: 98%;">
  452. <div style="display: flex;align-items: center;padding-bottom: 20px;border-bottom: 1px solid #f2f2f2">
  453. <div style="display: inline-block;width: 18%;margin-left:1%">
  454. <el-button size="small" @click="changeAltime(0)">{{ $t('volumeset') }}</el-button>
  455. </div>
  456. <div style="display: inline-block;width: 26%" v-if="user.userNameNeedTranslate != 1">
  457. <el-input style="float:left;" v-model="keywordAl" class="input-with-select" :placeholder="$t('pleaseenterhepersonnamesearch')" clearable="true" size="small" @clear="clearsearchAl()">
  458. <el-button slot="append" @click="searchAl()" icon="el-icon-search"></el-button>
  459. </el-input>
  460. </div>
  461. <div style="display: inline-block;width: 32%;">
  462. <span style="display: inline-block;margin: 0 15px 0 20px;color: rgb(96, 98, 102);">{{ $t('screeningDepartment') }}</span>
  463. <el-cascader
  464. ref="selectAl"
  465. filterable
  466. v-model="NcurDeptId"
  467. :placeholder="$t('defaultText.pleaseChoose')"
  468. size="small"
  469. style="width: 60%"
  470. @change="selAl()"
  471. clearable
  472. :options="Nsdata"
  473. :props="{ checkStrictly: true, expandTrigger: 'hover' }"
  474. :show-all-levels="false" v-if="user.userNameNeedTranslate != 1">
  475. </el-cascader>
  476. <vueCascader :size="'small'" :widthStr="'120'" :clearable="true" :subject="Nsdata" :radios="true" :distinction="'2'" @vueCasader="vueCasader" v-if="user.userNameNeedTranslate == 1"></vueCascader>
  477. </div>
  478. </div>
  479. <div>
  480. <el-table key="apk2is6" v-loading="loading" :data="iAlDataS" height="480" style="width: 99%;" @selection-change="selPchg">
  481. <el-table-column type="selection"></el-table-column>
  482. <el-table-column prop="userName" :label="$t('lable.name')" width="200">
  483. <template slot-scope="scope">
  484. <div v-if="scope.row.userName">
  485. <span v-if="user.userNameNeedTranslate != 1">
  486. {{scope.row.userName}}
  487. </span>
  488. <span v-if="user.userNameNeedTranslate == 1">
  489. <ww-open-data type='userName' :openid='scope.row.userName'></ww-open-data>
  490. </span>
  491. </div>
  492. </template>
  493. </el-table-column>
  494. <el-table-column prop="department" :label="$t('departmentsuod')" width="200">
  495. <template slot-scope="scope">
  496. <span v-if="user.userNameNeedTranslate != 1">
  497. {{scope.row.department}}
  498. </span>
  499. <span v-if="user.userNameNeedTranslate == 1">
  500. <ww-open-data type='departmentName' :openid='scope.row.department'></ww-open-data>
  501. </span>
  502. </template>
  503. </el-table-column>
  504. <el-table-column prop="yearDays" :label="$t('annualleaveperyear')" width="200">
  505. <template slot-scope="scope">
  506. {{scope.row.yearDays != null ? scope.row.yearDays + $t('time.day') : "-"}}
  507. </template>
  508. </el-table-column>
  509. <el-table-column prop="leftdays" :label="$t('remainingdaysofannualleave')" width="200">
  510. <template slot-scope="scope">
  511. {{scope.row.yearDays != null ? scope.row.yearDays - scope.row.alreadyDays + $t('time.day') : "-"}}
  512. </template>
  513. </el-table-column>
  514. <el-table-column prop="id" :label="$t('numberofannualleavedays')">
  515. <template slot-scope="scope">
  516. <el-button size="small" @click="changeAltime(scope.row)">{{ $t('setup') }}</el-button>
  517. </template>
  518. </el-table-column>
  519. </el-table>
  520. </div>
  521. </div>
  522. <el-dialog :title="$t('pleasesetthetimelimitforannualleave')" v-if="Alshow" :visible.sync="Alshow" @close="delAltime()" width="500px">
  523. <el-form label-width="8rem">
  524. <el-form-item :label="$t('setthenumberofannualleavedaysperyear')" >
  525. <el-input v-model="Alchange.yearDays" type="number" min="0" :placeholder="$t('pleaseenterdays')"></el-input>
  526. </el-form-item>
  527. </el-form>
  528. <div slot="footer" class="dialog-footer">
  529. <el-button type="default" @click="delAltime()">{{ $t('btn.cancel') }}</el-button>
  530. <el-button type="primary" @click="chgAltime()">{{ $t('btn.determine') }}</el-button>
  531. </div>
  532. </el-dialog>
  533. </div>
  534. <div v-if="displayTable && apk && apk2 == 8" class="tops" :style="'height:' +hubs+'px'">
  535. <!-- 公共 -->
  536. <div class="ctons" style="width: 98%;">
  537. <div class="flex">
  538. <div>
  539. <span>{{ $t('leavetype') }}</span>
  540. <el-select v-model="leaveTypeItem" :placeholder="$t('pleaseselectthetypeofleave')" @change="leaveTypeChange()" style="width: 120px" size="small" filterable="true">
  541. <span v-for="item in leaveTypeList" :key="item.leaveCode">
  542. <el-option :label="item.leaveName" :value="item.leaveCode"></el-option>
  543. </span>
  544. </el-select>
  545. </div>
  546. <template v-if="permissions.leaveAll">
  547. <div>
  548. <span>{{ $t('departmentofscreening') }}</span>
  549. <el-cascader
  550. size="small"
  551. collapse-tags
  552. @change="departmentOptionsChg"
  553. v-model="departmentSel"
  554. :options="departmentOptions"
  555. :placeholder="$t('qing-xuan-ze-bu-men')"
  556. :show-all-levels="false"
  557. :props="{ multiple: true }"
  558. clearable></el-cascader>
  559. </div>
  560. <div>
  561. <span>{{ $t('personnelselection') }}</span>
  562. <el-select v-model="userSelId" :placeholder="$t('pleaseselectthepersonaskingforleave')" clearable @change="userChg()" style="width: 140px" size="small" v-show="permissions.leaveAll" filterable="true">
  563. <span v-for="(item, index) in users" :key="index">
  564. <el-option :label="item.name" :value="item.id"></el-option>
  565. </span>
  566. </el-select>
  567. </div>
  568. <div style="margin:0 0px 0 10px">
  569. <el-button size="small" type="primary" @click="listSynchronize" :loading="synchronizeLoading">{{ $t('synchronizefromStaple') }}</el-button>
  570. <el-button size="small" type="primary" @click="exportLeaveList" :loading="exporLoading">{{ $t('dao-chu-jia-qi') }}</el-button>
  571. </div>
  572. </template>
  573. </div>
  574. <el-table key="apk2is8" v-loading="loading" :data="vacationList" style="width: 100%" height="94%">
  575. <el-table-column prop="name" :label="$t('screening.employeename')" min-width="120" fixed="left"></el-table-column>
  576. <el-table-column :label="$t('periodofvalidity')" min-width="250" align="center">
  577. <template slot-scope="scope">
  578. <span>{{scope.row.startTime == null && scope.row.endTime == null ? '~ ~' : (scope.row.startTime + '\u3000~\u3000' + scope.row.endTime)}}</span>
  579. </template>
  580. </el-table-column>
  581. <el-table-column :label="$t('combination')" min-width="100" align="center">
  582. <template slot-scope="scope">
  583. <span>{{scope.row.quotaInDays == null && scope.row.quotaInHours == null ? '-' : (scope.row.quotaInDays == null ? scope.row.quotaInHours + $t('time.hour') : scope.row.quotaInDays + $t('time.day'))}}</span>
  584. </template>
  585. </el-table-column>
  586. <el-table-column :label="$t('beenused')" min-width="100" align="center">
  587. <template slot-scope="scope">
  588. <span>{{scope.row.usedInDays == null && scope.row.usedInHours == null ? '-' : (scope.row.usedInDays == null ? scope.row.usedInHours + $t('time.hour') : scope.row.usedInDays + $t('time.day'))}}</span>
  589. </template>
  590. </el-table-column>
  591. <el-table-column :label="$t('remainingamount')" min-width="100" align="center">
  592. <template slot-scope="scope">
  593. <span>{{scope.row.leftInDays == null && scope.row.leftInHours == null ? '-' : (scope.row.leftInDays == null ? scope.row.leftInHours + $t('time.hour') : scope.row.leftInDays + $t('time.day'))}}</span>
  594. </template>
  595. </el-table-column>
  596. </el-table>
  597. <div class="poss">
  598. <el-pagination
  599. @size-change="vacationSizeChange"
  600. @current-change="vacationCurrentChange"
  601. :current-page="page"
  602. :page-sizes="[50]"
  603. :page-size="50"
  604. layout="total, sizes, prev, pager, next"
  605. :total="total">
  606. </el-pagination>
  607. </div>
  608. </div>
  609. </div>
  610. <!-- --------- -->
  611. </div>
  612. <!-- 请假单详情 -->
  613. <el-dialog :title="$t('leaveForm')" :visible.sync="dialog" width="1000px" @close="bangd()">
  614. <!-- 表单 -->
  615. <el-form ref="addForm" :model="addForm" label-width="80px" :rules="addFormRules">
  616. <!-- 请假人 -->
  617. <el-form-item :label="$t('leavepeople')" prop="ownerId" style="width: 300px;display: inline-block;">
  618. <!--普通员工只能自己填报自己的 -->
  619. <!-- <el-select v-if="user.userNameNeedTranslate != 1" v-model="addForm.ownerId" @change="selts()" :placeholder="$t('pleaseselectthepersonaskingforleave')" style="width: 240px" :disabled="true" filterable="true">
  620. <span v-for="(item, index) in users" :key="index">
  621. <el-option :label="item.name" :value="item.id"></el-option>
  622. </span>
  623. </el-select> -->
  624. <selectCat v-if="user.userNameNeedTranslate == 1" :size="'mini'" :subject="users" :subjectId="addForm.ownerId" :disabled="true" :distinction="'4'" :filterable="false" @selectCal="selectCal"></selectCat>
  625. </el-form-item>
  626. <!-- 电话 -->
  627. <el-form-item :label="$t('phone')" prop="tel" style="width: 300px;display: inline-block;">
  628. <el-input ref="ipts" v-model="addForm.tel" :placeholder="$t('defaultText.PleaseEnterYourPhone')" style="width: 250px;"></el-input>
  629. </el-form-item>
  630. <!-- 单选 -->
  631. <el-form-item style="display: block" :label="$t('lengthunit')">
  632. <el-radio-group v-model="addForm.timeType" @change="chanRadio()">
  633. <el-radio label="0">{{ $t('accordingdays') }}</el-radio>
  634. <el-radio label="1">{{ $t('leavehour') }}</el-radio>
  635. </el-radio-group>
  636. </el-form-item>
  637. <!-- 时间选择 -->
  638. <el-form-item :label="flg ? $t('optiondate') : $t('other.timeSelection')" style="width: 74%;margin-right:500px">
  639. <el-col :span="9">
  640. <el-date-picker v-if="flg" type="date" :placeholder="$t('time.startDate')" value-format="yyyy-MM-dd" v-model="addForm.startDate" style="width: 240px;" @blur="datas()"></el-date-picker>
  641. <el-date-picker v-else type="date" :placeholder="$t('time.startDate')" value-format="yyyy-MM-dd" v-model="addForm.startDate" style="width: 240px;" @change="datasss()"></el-date-picker>
  642. </el-col>
  643. <el-col class="line" v-if="flg" :span="2">-</el-col>
  644. <el-col :span="9">
  645. <el-date-picker v-if="flg" type="date" :placeholder="$t('time.endDate')" value-format="yyyy-MM-dd" :picker-options="pickerOptionsEnd" v-model="addForm.endDate" style="width: 250px;" @blur="datas()"></el-date-picker>
  646. <!-- <el-select v-else v-model="addForm.timeHours" placeholder="请假时长" @change="chanSele()">
  647. <el-option v-for="(item, index) in options" :key="index" :label="item" :value="item"></el-option>
  648. </el-select> -->
  649. </el-col>
  650. </el-form-item>
  651. <!-- 请假天数 -->
  652. <el-form-item :label="flg ? $t('leavedays') : $t('leavetime')" prop="timeDays" style="margin-right: 500px">
  653. <!-- {{flg ? addForm.timeDays : addForm.timeHours}}{{flg ? '天' : '小时'}} -->
  654. <!-- <div v-if="flg">{{addForm.timeDays}} 天</div> -->
  655. <div v-if="flg"> <el-input v-model="addForm.timeDays" @blur="inputs()" @input="addForm.timeDays=addForm.timeDays.replace(/[^\d.]/g,'')" style="width: 100px; margin-right: 20px;"></el-input> {{ $t('time.day') }}</div>
  656. <div v-else>
  657. <el-input v-model="addForm.timeHours" @blur="inputss()" @input="addForm.timeHours=addForm.timeHours.replace(/[^\d.]/g,'')" style="width: 100px; margin-right: 20px;"></el-input> {{ $t('time.hour') }}
  658. </div>
  659. </el-form-item>
  660. <!-- 备注 -->
  661. <el-form-item :label="$t('bei-zhu')" style="width: 100%">
  662. <el-input type="textarea" v-model="addForm.remark" :rows="5" style="width: 62%" maxlength="100" show-word-limit></el-input>
  663. </el-form-item>
  664. </el-form>
  665. <span slot="footer" class="dialog-footer">
  666. <el-button @click="dialog = false">{{ $t('btn.cancel') }}</el-button>
  667. <el-button type="primary" @click="determine()">{{ $t('btn.determine') }}</el-button>
  668. </span>
  669. </el-dialog>
  670. </section>
  671. </template>
  672. <script>
  673. import { config, error } from 'dingtalk-jsapi';
  674. // 自定义select组件
  675. import selectCat from "@/components/select.vue"
  676. import Select from '../../components/select.vue';
  677. // 引入自定义级联组件
  678. import vueCascader from "@/components/cascader.vue"
  679. export default {
  680. name: "expense",
  681. components: {
  682. selectCat,
  683. Select,
  684. vueCascader
  685. },
  686. props: {},
  687. data() {
  688. //验证手机号
  689. var checkTel = (rule, value, callback) =>{
  690. if (!value) {
  691. return callback(new Error(this.$t('phonenumbercannotbeempty')));
  692. } else {
  693. const reg = /^1[3|4|5|7|8|9][0-9]\d{8}$/
  694. if (reg.test(value)) {
  695. callback();
  696. } else {
  697. return callback(new Error(this.$t('pleaseenterthecorrectcellphonenumber')));
  698. }
  699. }
  700. };
  701. var checks = (rule, value, callback) => {
  702. if (!value) {
  703. return callback(new Error(this.$t('leavedayscannotbeempty')));
  704. } else {
  705. if (value > this.timeChoose) {
  706. return callback(new Error(this.$t('daysbeyondthecurrentlyselecteddat')));
  707. } else {
  708. callback();
  709. }
  710. }
  711. };
  712. return {
  713. addFormRules: {
  714. ownerId: [{ required: true, message: this.$t('pleaseselectthepersonaskingforleave'), trigger: "blur" }],
  715. tel: [{required: true, validator: checkTel, trigger: 'blur'}],
  716. timeDays: [{required: true, validator: checks, trigger: 'blur'}],
  717. leaveType: [{ required: true, message: this.$t('pleaseselectthetypeofleave'), trigger: "blur" }],
  718. projectAuditorJson: [{ required: true, message: this.$t('pleaseselectapprover'), trigger: "blur" }]
  719. },
  720. user: JSON.parse(sessionStorage.getItem("user")),
  721. shuz: [this.$t('personalleaveisallowed'), this.$t('leaveisallowed'), this.$t('annualleaveisallowed'), this.$t('maternityleaveisallowed')],
  722. ins: 0,
  723. addForm: {
  724. timeType: '0',
  725. startDate: this.getCurrentTime(),
  726. endDate: this.getCurrentTime(),
  727. timeDays: 1,
  728. leaveType: 0,
  729. ownerId: '',
  730. // indate: this.getCurrentTime(),
  731. timeHours: 8,
  732. tel: '',
  733. remark: '',
  734. projectAuditorJson: ''
  735. },
  736. displayTable: false,
  737. users: [], // 人员信息
  738. flg: true,
  739. createDate: [],
  740. pickerOptionsEnd: {
  741. disabledDate: (time) => {
  742. if (this.addForm.startDate) {
  743. return time.getTime() < new Date(this.addForm.startDate).getTime() - 86400000;
  744. }
  745. return time.getTime() <= new Date(this.createDate).getTime() - 86400000;
  746. },
  747. },
  748. pickerOptionsEnds: {
  749. disabledDate: (time) => {
  750. if (this.statData) {
  751. return time.getTime() < new Date(this.statData).getTime() - 86400000;
  752. }
  753. return time.getTime() <= new Date(this.createDate).getTime() - 86400000;
  754. },
  755. },
  756. options: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],
  757. tableData: [],
  758. page: 1,
  759. size: 20,
  760. isAuditList: '',
  761. total:0,
  762. apk: false,
  763. keyword: '',
  764. statData: this.getCurrentTimes(),
  765. endData: this.getCurrentTime(),
  766. statisticalList: [],
  767. loading: false,
  768. timeChoose: 1,
  769. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  770. typess: [{name: this.$t('leave.personalLeave'),id: 0},{name: this.$t('leave.sickLeave'),id: 1},{name: this.$t('leave.annualLeave'),id: 2},{name: this.$t('leave.maternityLeave'),id: 3},{name: this.$t('leave.marriageLeave'),id: 4},{name: this.$t('leave.bereavementLeave'),id: 5},{name: this.$t('leave.leave'),id: 6},{name: this.$t('leave.paternityLeave'),id: 7},{name: this.$t('leave.other'), id: 8}],
  771. statuss: [{
  772. name: this.$t('state.approved'),
  773. id: 0
  774. },{
  775. name: this.$t('state.WaitingAudit'),
  776. id: 1
  777. },{
  778. name: this.$t('btn.rejected'),
  779. id: 2
  780. },{
  781. name: this.$t('state.undone'),
  782. id: 3
  783. }],
  784. createDatelis: '',
  785. ownerIds: '',
  786. type: '',
  787. code: '',
  788. falg: 0,
  789. dialog: false,
  790. adform: {},
  791. affId: '',
  792. qjType: [
  793. {name: this.$t('leave.personalLeave'), id: 0},
  794. {name: this.$t('leave.sickLeave'), id: 1},
  795. {name: this.$t('leave.annualLeave'), id: 2},
  796. {name: this.$t('leave.maternityLeave'), id: 3},
  797. {name: this.$t('leave.marriageLeave'), id: 4},
  798. {name: this.$t('leave.bereavementLeave'), id: 5},
  799. {name: this.$t('leave.leave'), id: 6},
  800. {name: this.$t('leave.paternityLeave'), id: 7},
  801. {name: this.$t('leave.other'), id: 8}
  802. ],
  803. //
  804. apk2: false,
  805. sdata:[],
  806. dataArray:[],
  807. sdefaultProps: {
  808. children: 'children',
  809. label: 'label'
  810. },
  811. depData: null,
  812. isAdd : false,
  813. sindex : 0,
  814. curDeptId : null,
  815. curUserId : null,
  816. dialogVisible: false,
  817. soption : null,
  818. Alshow: false,
  819. Alchange: {yearDays:null,userId:null},
  820. AlchangeP: [],
  821. susers: [],
  822. keywordAl: '',
  823. NcurDeptId:[],
  824. Nsdata : [],
  825. AlData : [],
  826. iAlDataS: [],
  827. iAlData : [],
  828. // ---------
  829. txselnum: 0,
  830. approverList: [],
  831. isSyncData: 0,
  832. vacationList: [],
  833. leaveTypeList: [],
  834. leaveTypeItem: '',
  835. departmentOptions: [],
  836. departmentSel: [],
  837. userSelId: '',
  838. synchronizeLoading: false,
  839. kuanBl: 0,
  840. hubs: 0,
  841. vueCasaderItem: [], // 仿数据
  842. vueIAlDataSItems: undefined, // 仿数据
  843. exporLoading: false
  844. };
  845. },
  846. computed: {},
  847. watch: {},
  848. created() {
  849. let widTHBul = document.documentElement.clientWidth - 440
  850. this.kuanBl = widTHBul
  851. this.hubs = (document.documentElement.clientHeight || document.body.clientHeight) - 70
  852. let height = window.innerHeight;
  853. this.tableHeight = height - 195;
  854. const that = this;
  855. window.onresize = function temp() {
  856. that.tableHeight = window.innerHeight - 195;
  857. };
  858. // console.log('user',this.user);
  859. this.isSyncData = this.user.timeType.syncDingding || this.user.timeType.syncFanwei;
  860. },
  861. mounted() {
  862. if(this.isSyncData){
  863. this.bills(false,2)
  864. this.staffs(7,['7'])
  865. this.getUsers()
  866. }else{
  867. this.getUsers() // 获取人员信息
  868. this.getDepartment();
  869. this.getAl();
  870. this.getApproverList()
  871. }
  872. },
  873. filters: {},
  874. methods: {
  875. // 导出请假单
  876. exportLeave(){
  877. let param = {}
  878. if(this.code !== ''){
  879. param.status = this.code
  880. }
  881. if(this.type !== ''){
  882. param.leaveType = this.type
  883. }
  884. if(this.createDate && this.createDate.length){
  885. param.startTime = this.createDate[0]
  886. param.endTime = this.createDate[1]
  887. }
  888. // console.log(this.code,this.type,param);
  889. // return
  890. this.http.post('/leave-sheet/exportLeave',param,
  891. res => {
  892. if(res.code == 'ok'){
  893. var filePath = res.data;
  894. const a = document.createElement('a'); // 创建a标签
  895. a.setAttribute('download', '请假单');// download属性
  896. a.setAttribute('href', filePath);// href链接
  897. a.click(); //自执行点击事件
  898. a.remove();
  899. }else{
  900. this.$message({
  901. message: res.msg,
  902. type: 'error'
  903. })
  904. }
  905. },err => {
  906. this.$message({
  907. message: err,
  908. type: 'error'
  909. })
  910. })
  911. },
  912. // 导出假期
  913. exportLeaveList() {
  914. this.exporLoading = true
  915. let param = {
  916. leaveCode: this.leaveTypeItem,
  917. companyId: this.user.companyId,
  918. // departmentId: this.departmentSel ? this.departmentSel[this.departmentSel.length - 1] : '',
  919. }
  920. let arrList = []
  921. for(let i in this.departmentSel) {
  922. arrList.push(this.departmentSel[i][this.departmentSel[i].length - 1])
  923. }
  924. console.log(arrList, '处理好的')
  925. param.departmentId = arrList
  926. if(this.userSelId != '') {
  927. param.userId = this.userSelId
  928. }
  929. this.http.post('/user-yearleave-setting/exportDingDingLeaveQt',param,
  930. res => {
  931. this.exporLoading = false
  932. if(res.code == 'ok'){
  933. var filePath = res.data;
  934. const a = document.createElement('a'); // 创建a标签
  935. a.setAttribute('download', '剩余假期');// download属性
  936. a.setAttribute('href', filePath);// href链接
  937. a.click(); //自执行点击事件
  938. a.remove();
  939. }else{
  940. this.$message({
  941. message: res.msg,
  942. type: 'error'
  943. })
  944. }
  945. },err => {
  946. this.exporLoading = false
  947. this.$message({
  948. message: err,
  949. type: 'error'
  950. })
  951. })
  952. },
  953. // 从钉钉同步假期剩余表
  954. listSynchronize(){
  955. this.synchronizeLoading = true
  956. this.http.post('/dingding/syncLeaveQuotaData',{
  957. companyId: this.user.companyId
  958. },res => {
  959. if(res.code == 'ok'){
  960. this.synchronizeLoading = false
  961. this.$message({
  962. message: this.$t('synchronoussuccess'),
  963. type: 'success'
  964. })
  965. this.getVacationList()
  966. this.page = 1
  967. this.departmentSel = []
  968. this.userSelId = ''
  969. }else {
  970. this.synchronizeLoading = false
  971. this.$message({
  972. message: res.msg,
  973. type: 'error'
  974. })
  975. }
  976. },err => {
  977. this.synchronizeLoading = false
  978. this.$message({
  979. message: err,
  980. type: 'error'
  981. })
  982. })
  983. },
  984. // 获取部门列表
  985. getDepartmentOptions(){
  986. this.http.post(this.port.manage.depList,{
  987. },res =>{
  988. if(res.code == 'ok'){
  989. // console.log('getDepartment',res.data);
  990. this.departmentOptions = this.changeArr(res.data)
  991. }else {
  992. this.$message({
  993. message: res.msg,
  994. type: 'error'
  995. })
  996. }
  997. },err => {
  998. this.$message({
  999. message: err,
  1000. type: 'error'
  1001. })
  1002. })
  1003. },
  1004. departmentOptionsChg(){
  1005. // console.log(this.departmentSel);
  1006. this.page = 1
  1007. this.getVacationList(1)
  1008. },
  1009. userChg(){
  1010. // console.log(this.userSelId);
  1011. this.page = 1
  1012. this.getVacationList(1)
  1013. },
  1014. // 获取剩余假期信息列表
  1015. getVacationList(e){
  1016. this.loading = true
  1017. let item = {}
  1018. if(e){
  1019. item = {
  1020. companyId: this.user.companyId,
  1021. pageIndex: this.page,
  1022. leaveCode: this.leaveTypeItem
  1023. }
  1024. console.log(this.departmentSel, '甚于')
  1025. // if(this.departmentSel.length != 0){
  1026. // item.departmentId = this.departmentSel[this.departmentSel.length - 1]
  1027. // }
  1028. let arrList = []
  1029. for(let i in this.departmentSel) {
  1030. arrList.push(this.departmentSel[i][this.departmentSel[i].length - 1])
  1031. }
  1032. console.log(arrList, '处理好的')
  1033. item.departmentId = arrList
  1034. if(this.userSelId != ''){
  1035. item.userId = this.userSelId
  1036. }
  1037. // if()
  1038. }else{
  1039. item = {
  1040. companyId: this.user.companyId,
  1041. // leaveCode: '',
  1042. // userId: '',
  1043. pageIndex: this.page,
  1044. // departmentId: ''
  1045. }
  1046. }
  1047. this.http.post('/user-yearleave-setting/getDingDingLeaveQt',item,
  1048. res => {
  1049. if(res.code == 'ok'){
  1050. this.vacationList = res.data.records
  1051. this.total = res.data.total
  1052. if(!e){
  1053. this.leaveTypeList = res.data.leaveTypeList
  1054. this.leaveTypeItem = res.data.defaultLeaveType.leaveCode
  1055. }
  1056. this.loading = false
  1057. }else {
  1058. this.loading = false
  1059. this.$message({
  1060. message: res.msg,
  1061. type: 'error'
  1062. })
  1063. }
  1064. },err => {
  1065. this.loading = false
  1066. this.$message({
  1067. message: err,
  1068. type: 'error'
  1069. })
  1070. })
  1071. },
  1072. leaveTypeChange(){
  1073. // console.log(this.leaveTypeItem);
  1074. this.page = 1
  1075. this.getVacationList(1)
  1076. },
  1077. getApproverList(){
  1078. this.http.post('/project/getMyParticiPMList',{
  1079. },res => {
  1080. if(res.code == 'ok'){
  1081. this.approverList = res.data
  1082. if(this.approverList.length == 0){
  1083. this.$message({
  1084. message: this.$t('configureanapprover'),
  1085. type: 'warning'
  1086. })
  1087. }
  1088. // console.log('list',res.data);
  1089. }else {
  1090. this.$message({
  1091. message: res.msg,
  1092. type: 'error'
  1093. })
  1094. }
  1095. },error => {
  1096. this.$message({
  1097. message: error,
  1098. type: 'error'
  1099. })
  1100. })
  1101. },
  1102. changeAltime(e){
  1103. if(e == 0 && this.AlchangeP.length == 0){
  1104. this.$message(this.$t('selecttheitemsyouwanttobatchset'))
  1105. return
  1106. }else if(e != 0){
  1107. this.Alchange = JSON.parse(JSON.stringify(e))
  1108. }
  1109. this.Alshow = true
  1110. },
  1111. selPchg(e){
  1112. this.AlchangeP = e
  1113. },
  1114. searchAl(){
  1115. this.iAlDataS = []
  1116. for (let i = 0; i < this.iAlData.length; i++) {
  1117. if (this.iAlData[i].userName.indexOf(this.keywordAl) != -1) {
  1118. this.iAlDataS.push(this.iAlData[i])
  1119. }
  1120. }
  1121. },
  1122. clearsearchAl(){
  1123. this.iAlDataS = this.iAlData
  1124. },
  1125. delAltime(){
  1126. this.Alshow = false
  1127. this.Alchange = {yearDays:null,userId:null}
  1128. },
  1129. chgAltime(){
  1130. let chgPar = {}
  1131. let userids = ''
  1132. let Alpost = ''
  1133. if(this.Alchange.userId == null && this.AlchangeP != []){
  1134. Alpost = "/user-yearleave-setting/saveBatch"
  1135. for (let i = 0; i < this.AlchangeP.length; i++) {
  1136. userids = userids + "," + this.AlchangeP[i].userId
  1137. }
  1138. chgPar = {userIds: userids.slice(1), companyId: this.user.companyId, yearDays: this.Alchange.yearDays}
  1139. }else {
  1140. Alpost = "/user-yearleave-setting/save"
  1141. userids = this.Alchange.userId
  1142. chgPar = {userId: userids, companyId: this.user.companyId, yearDays: this.Alchange.yearDays}
  1143. }
  1144. this.http.post(Alpost,chgPar,
  1145. res => {
  1146. if(res.code == "ok"){
  1147. this.Alshow = false,
  1148. this.Alchange = {yearDays:null,userId:null},
  1149. this.AlchangeP = []
  1150. this.getAl()
  1151. }else{
  1152. this.$message({
  1153. message: res.msg,
  1154. type: "error"
  1155. })
  1156. }
  1157. },
  1158. error => {
  1159. this.Alshow = false
  1160. this.$message({
  1161. message: error,
  1162. type: "error"
  1163. })
  1164. }
  1165. )
  1166. },
  1167. getAl(){
  1168. this.http.get('/user-yearleave-setting/list',
  1169. res => {
  1170. if(res.code == "ok"){
  1171. this.iAlData = res.data
  1172. this.iAlDataS = this.iAlData
  1173. if(this.apk2 == 6){
  1174. this.selAl()
  1175. }
  1176. } else {
  1177. this.$message({
  1178. message: res.msg,
  1179. type: "error"
  1180. })
  1181. }
  1182. },
  1183. error => {
  1184. this.Alshow = false
  1185. this.$message({
  1186. message: error,
  1187. type: "error"
  1188. })
  1189. }
  1190. )
  1191. },
  1192. selAl(){
  1193. let e = this.user.userNameNeedTranslate != 1 ? this.$refs.selectAl.getCheckedNodes()[0] : this.vueIAlDataSItems
  1194. if(e == undefined){
  1195. this.iAlDataS = this.iAlData
  1196. }else{
  1197. this.iAlDataS = []
  1198. for (let i = 0; i < this.iAlData.length; i++) {
  1199. if (e.label == this.iAlData[i].department) {
  1200. this.iAlDataS.push(this.iAlData[i])
  1201. }
  1202. }
  1203. }
  1204. },
  1205. // ---------
  1206. handleNodeClick(data) {
  1207. if(this.depData == null || data.id != this.depData.id) {
  1208. this.depData = data;
  1209. // console.log("depdata",this.depData);
  1210. this.getSettings();
  1211. }
  1212. },
  1213. getSettings() {
  1214. this.http.post('/audit-workflow-setting/get',{deptId: this.depData.id,type: 1},
  1215. res => {
  1216. this.listLoading = false;
  1217. if (res.code == "ok") {
  1218. this.dataArray = res.data;
  1219. // console.log("请求1",res.data);
  1220. } else {
  1221. this.$message({
  1222. message: res.msg,
  1223. type: "error"
  1224. });
  1225. }
  1226. },
  1227. error => {
  1228. this.listLoading = false;
  1229. this.$message({
  1230. message: error,
  1231. type: "error"
  1232. });
  1233. }
  1234. );
  1235. },
  1236. // 获取部门列表
  1237. getDepartment() {
  1238. this.http.post( this.port.manage.depList, {},
  1239. res => {
  1240. if (res.code == "ok") {
  1241. var list = res.data , list1 = JSON.parse(JSON.stringify(res.data));
  1242. this.sdata = list;
  1243. this.soption = [
  1244. {value: 1 , label : this.$t('lable.department') , children : this.changeArr(list1)},
  1245. {value: 2 , label : this.$t('designatedpersonnel'),children : this.susers}
  1246. ]
  1247. this.Nsdata = list1
  1248. } else {
  1249. this.$message({
  1250. message: res.msg,
  1251. type: "error"
  1252. });
  1253. }
  1254. },
  1255. error => {
  1256. this.$message({
  1257. message: error,
  1258. type: "error"
  1259. });
  1260. });
  1261. },
  1262. changeArr(arr) {
  1263. for (var i = 0; i < arr.length; i++) {
  1264. if(arr[i].id != -1 && arr[i].id != 0) {
  1265. if (arr[i].children != null && arr[i].children.length>0) {
  1266. arr[i].children = this.changeArr(arr[i].children);
  1267. }
  1268. arr[i].type = 'dep'
  1269. arr[i].id && (arr[i].value = arr[i].id);
  1270. delete arr[i].id;
  1271. }
  1272. }
  1273. for(var i in arr) {
  1274. if(arr[i].id == -1 || arr[i].id == 0) {
  1275. arr.splice(i,1)
  1276. }
  1277. }
  1278. return arr;
  1279. },
  1280. showNodeDialog(index) {
  1281. this.isAdd = true;
  1282. this.sindex = index;
  1283. this.curDeptId = null;
  1284. this.curUserId = null;
  1285. this.dialogVisible = true;
  1286. },
  1287. editNodeDialog(index, item) {
  1288. //检查是否可编辑
  1289. this.http.post('/audit-workflow-setting/checkNodeInUse',{auditDeptId: item.auditDeptId, deptId: this.depData.id,type: 1},
  1290. res => {
  1291. this.listLoading = false;
  1292. if (res.code == "ok") {
  1293. this.isAdd = false;
  1294. this.sindex = index;
  1295. this.curUserId = item.userId;
  1296. this.dialogVisible = true;
  1297. this.curDeptId = item.auditDeptId;
  1298. } else {
  1299. this.$message({
  1300. message: res.msg,
  1301. type: "error"
  1302. });
  1303. }
  1304. },
  1305. error => {
  1306. this.listLoading = false;
  1307. this.$message({
  1308. message: error,
  1309. type: "error"
  1310. });
  1311. }
  1312. );
  1313. },
  1314. addNode() {
  1315. // console.log(this.curDeptId, 'zhilail')
  1316. // return
  1317. this.dialogVisible = false;
  1318. if (this.curDeptId == null) return;
  1319. // if(this.user.userNameNeedTranslate != '1') {
  1320. var node = this.user.userNameNeedTranslate != '1' ? this.vueCasaderItem : this.$refs.deptCascader.getCheckedNodes()[0];
  1321. // var node = this.$refs.deptCascader.getCheckedNodes()[0];
  1322. console.log(this.vueCasaderItem)
  1323. console.log("node",node);
  1324. if (this.isAdd) {
  1325. if(this.user.userNameNeedTranslate != 1) {
  1326. var nodes
  1327. if(node.path[0] == 1){
  1328. nodes = {auditDeptId: node.value, auditDeptName: node.label, auditorType: 1};
  1329. }else if(node.path[0] == 2){
  1330. nodes = {userId: node.value, userName: node.label, auditorType: 2};
  1331. }
  1332. } else {
  1333. if(node.managerId) {
  1334. nodes = {auditDeptId: node.value, auditDeptName: node.label, auditorType: 1};
  1335. } else {
  1336. nodes = {userId: node.value, userName: node.label, auditorType: 2};
  1337. }
  1338. }
  1339. this.dataArray.splice(this.sindex, 0, nodes);
  1340. } else {
  1341. //编辑
  1342. this.dataArray[this.sindex].auditDeptId = node.value;
  1343. this.dataArray[this.sindex].auditDeptName = node.label;
  1344. }
  1345. },
  1346. deleteNode() {
  1347. this.dialogVisible = false;
  1348. this.dataArray.splice(this.sindex, 1);
  1349. },
  1350. submitInsert() {
  1351. this.http.post('/audit-workflow-setting/add',{json:JSON.stringify(this.dataArray), deptId: this.depData.id, type:1},
  1352. res => {
  1353. this.listLoading = false;
  1354. if (res.code == "ok") {
  1355. this.$message({
  1356. message: this.$t('savesuccess'),
  1357. type: "success"
  1358. });
  1359. } else {
  1360. this.$message({
  1361. message: res.msg,
  1362. type: "error"
  1363. });
  1364. }
  1365. },
  1366. error => {
  1367. this.listLoading = false;
  1368. this.$message({
  1369. message: error,
  1370. type: "error"
  1371. });
  1372. }
  1373. );
  1374. },
  1375. //
  1376. approve(item) {
  1377. //审核通过
  1378. this.http.post('/leave-sheet/approve', {id:item.id
  1379. },
  1380. res => {
  1381. if (res.code == "ok") {
  1382. this.bills(true);
  1383. } else {
  1384. this.$message({
  1385. message: res.msg,
  1386. type: "error"
  1387. });
  1388. }
  1389. },
  1390. error => {
  1391. this.$message({
  1392. message: error,
  1393. type: "error"
  1394. });
  1395. });
  1396. },
  1397. deny(item) {
  1398. //审核驳回
  1399. this.http.post('/leave-sheet/deny', {id:item.id
  1400. },
  1401. res => {
  1402. if (res.code == "ok") {
  1403. this.bills(true);
  1404. } else {
  1405. this.$message({
  1406. message: res.msg,
  1407. type: "error"
  1408. });
  1409. }
  1410. },
  1411. error => {
  1412. this.$message({
  1413. message: error,
  1414. type: "error"
  1415. });
  1416. });
  1417. },
  1418. getUsers() {
  1419. // this.http.post(this.port.manage.list, {
  1420. // departmentId: -1,
  1421. // pageIndex: 1,
  1422. // // pageSize: 99999
  1423. // pageSize: -1
  1424. // },
  1425. this.http.post('/user/getSimpleActiveUserList', {},
  1426. res => {
  1427. if (res.code == "ok") {
  1428. // this.users = res.data.records;
  1429. this.users = res.data;
  1430. for (let i = 0; i < this.users.length; i++) {
  1431. this.susers.push({value:this.users[i].id,label:this.users[i].name,type: 'user'})
  1432. }
  1433. //只能自己填报自己的请假单
  1434. this.addForm.ownerId = this.user.id;
  1435. this.addForm.status = 1;
  1436. this.addForm.tel = this.user.phone
  1437. } else {
  1438. this.$message({
  1439. message: res.msg,
  1440. type: "error"
  1441. });
  1442. }
  1443. },
  1444. error => {
  1445. this.$message({
  1446. message: error,
  1447. type: "error"
  1448. });
  1449. });
  1450. },
  1451. // 员工请假填报点击事件
  1452. ssl(index) {
  1453. this.ins = index;
  1454. this.addForm.leaveType = index
  1455. },
  1456. staffs(key, keyPath) {
  1457. // console.log("keypath",key,keyPath)
  1458. if (keyPath[0] == '1') {
  1459. this.displayTable = false;
  1460. this.apk = false
  1461. } else if(keyPath[0] == '2' || keyPath[0] == '3') {
  1462. this.displayTable = true;
  1463. this.apk = false
  1464. } else if(keyPath[0] == '4'){
  1465. this.displayTable = true;
  1466. this.apk = true
  1467. this.apk2 = 4
  1468. this.statistical()
  1469. } else if(keyPath[0] == '5'){
  1470. this.displayTable = true;
  1471. this.apk2 = 5
  1472. this.apk = true
  1473. } else if(keyPath[0] == '6'){
  1474. this.NcurDeptId = []
  1475. this.displayTable = true;
  1476. this.apk2 = 6
  1477. this.apk = true
  1478. this.getAl()
  1479. } else if(keyPath[0] == '7'){
  1480. this.displayTable = true;
  1481. this.apk = false
  1482. this.bills(false,2)
  1483. } else if(keyPath[0] == '8'){
  1484. this.apk2 = 8
  1485. this.displayTable = true
  1486. this.apk = true
  1487. this.userSelId = ''
  1488. this.page = 1
  1489. this.departmentSel = []
  1490. this.getVacationList()
  1491. this.getDepartmentOptions()
  1492. }
  1493. },
  1494. bills(audit, tr){
  1495. if(tr) {
  1496. this.code = ''
  1497. this.createDate = []
  1498. // this.ownerIds = ''
  1499. this.type = ''
  1500. if(tr == 1) {
  1501. this.falg = 1
  1502. this.code = 1
  1503. } else if(tr == 2) {
  1504. this.code = ''
  1505. this.falg = 0
  1506. } else {
  1507. this.falg = 0
  1508. }
  1509. } else {
  1510. this.falg = false
  1511. }
  1512. this.tableData = []
  1513. this.displayTable = true;
  1514. this.isAuditList = audit;
  1515. this.loading = true
  1516. this.page = '1'
  1517. var param = { pageIndex: this.page,
  1518. pageSize: this.size,
  1519. status: this.code,
  1520. // createDate: this.createDate,
  1521. startDate: this.createDate == null ? '' : this.createDate[0],
  1522. endDate: this.createDate == null ? '' : this.createDate[1],
  1523. ownerId: this.ownerIds,
  1524. leaveType: this.type,
  1525. };
  1526. if (this.isAuditList) {
  1527. param.status = 1;
  1528. }
  1529. this.list = [];
  1530. // this.total = 0;
  1531. this.http.post('/leave-sheet/list', param,
  1532. res => {
  1533. if (res.code == "ok") {
  1534. this.tableData = res.data.records
  1535. this.total = res.data.total
  1536. this.loading = false
  1537. } else {
  1538. this.loading = false
  1539. this.$message({
  1540. message: res.msg,
  1541. type: "error"
  1542. });
  1543. }
  1544. },
  1545. error => {
  1546. this.loading = false
  1547. this.$message({
  1548. message: error,
  1549. type: "error"
  1550. });
  1551. });
  1552. },
  1553. billss() {
  1554. this.page = 1
  1555. var param = {pageIndex: this.page,
  1556. pageSize: this.size,
  1557. status: this.code,
  1558. // startDate: this.createDate,
  1559. startDate: this.createDate == null ? '' : this.createDate[0],
  1560. endDate: this.createDate == null ? '' : this.createDate[1],
  1561. ownerId: this.ownerIds,
  1562. leaveType: this.type,
  1563. };
  1564. this.http.post('/leave-sheet/list', param,
  1565. res => {
  1566. if (res.code == "ok") {
  1567. this.tableData = res.data.records
  1568. this.total = res.data.total
  1569. this.loading = false
  1570. } else {
  1571. this.loading = false
  1572. this.$message({
  1573. message: res.msg,
  1574. type: "error"
  1575. });
  1576. }
  1577. },
  1578. error => {
  1579. this.loading = false
  1580. this.$message({
  1581. message: error,
  1582. type: "error"
  1583. });
  1584. });
  1585. },
  1586. // 判断日期是否补零了
  1587. buling(das) {
  1588. var rqi = das.split('-')
  1589. rqi[1].length <= 1 ? rqi[1] = '0' + rqi[1] : rqi[1] = rqi[1]
  1590. rqi[2].length <= 1 ? rqi[2] = '0' + rqi[2] : rqi[2] = rqi[2]
  1591. var zong = rqi[0] + '-' + rqi[1] + '-' + rqi[2]
  1592. return zong
  1593. },
  1594. submits(){
  1595. // console.log(this.addForm)
  1596. // return
  1597. this.$refs.addForm.validate(valid => {
  1598. this.addForm.endDate = this.buling(this.addForm.endDate)
  1599. this.addForm.startDate = this.buling(this.addForm.startDate)
  1600. // this.addForm.projectAuditorJson = JSON.stringify(this.addForm.projectAuditorJson)
  1601. if (valid) {
  1602. this.http.post('/leave-sheet/add', this.addForm,
  1603. res => {
  1604. if (res.code == "ok") {
  1605. this.$message({
  1606. message: this.$t('message.fillinsuccessfully'),
  1607. type: "success"
  1608. });
  1609. this.addForm.timeType = '0'
  1610. this.addForm.startDate = this.getCurrentTime()
  1611. this.addForm.endDate = this.getCurrentTime()
  1612. this.addForm.timeDays = 1
  1613. this.addForm.leaveType = 0
  1614. this.addForm.timeHours = 8
  1615. this.addForm.remark = ''
  1616. this.addForm.projectAuditorJson = ''
  1617. // this.addForm = {
  1618. // timeType: '0',
  1619. // startDate: this.getCurrentTime(),
  1620. // endDate: this.getCurrentTime(),
  1621. // timeDays: 1,
  1622. // leaveType: 0,
  1623. // ownerId: '',
  1624. // // indate: this.getCurrentTime(),
  1625. // timeHours: 8,
  1626. // tel: '',
  1627. // remark: '',
  1628. // projectAuditorJson: ''
  1629. // }
  1630. this.flg = true
  1631. } else {
  1632. this.$message({
  1633. message: res.msg,
  1634. type: "error"
  1635. });
  1636. }
  1637. },
  1638. error => {
  1639. this.$message({
  1640. message: error,
  1641. type: "error"
  1642. });
  1643. });
  1644. } else {
  1645. return false;
  1646. }
  1647. });
  1648. },
  1649. txselts(a,b){
  1650. this.selts()
  1651. // console.log('txselts',this.addForm.ownerId);
  1652. if(a == 6 && this.addForm.ownerId != ''){
  1653. this.http.post('/leave-sheet/getOTAvaiDays',{ userId:b },
  1654. res => {
  1655. if(res.code == "ok") {
  1656. // console.log('post',res.data);
  1657. if(res.data < 0.5){
  1658. this.txselnum = 0
  1659. }else{
  1660. this.txselnum = res.data.toFixed(1)
  1661. }
  1662. } else {
  1663. this.$message({
  1664. message: res.msg,
  1665. type: "error"
  1666. });
  1667. }
  1668. },
  1669. error => {
  1670. this.$message({
  1671. message: error,
  1672. type: "error"
  1673. });
  1674. })
  1675. }
  1676. },
  1677. selts() {
  1678. for(var i in this.users) {
  1679. if(this.users[i].id == this.addForm.ownerId) {
  1680. this.addForm.tel = this.users[i].phone
  1681. }
  1682. }
  1683. },
  1684. chanRadio() {
  1685. // console.log(this.addForm.timeType)
  1686. if(this.addForm.timeType == '0') {
  1687. this.flg = true
  1688. this.addForm.startDate = this.getCurrentTime()
  1689. this.addForm.endDate = this.getCurrentTime()
  1690. this.addForm.timeType = '0'
  1691. this.addForm.timeDays = '1'
  1692. this.addForm.timeHours = '8'
  1693. } else {
  1694. this.flg = false
  1695. this.addForm.startDate = this.getCurrentTime()
  1696. this.addForm.endDate = this.getCurrentTime()
  1697. this.addForm.timeType = '1'
  1698. this.addForm.timeHours = 1,
  1699. this.addForm.timeDays = 1
  1700. }
  1701. },
  1702. // 计算日期
  1703. datas() {
  1704. // this.addForm.timeDays = this.DateDiff(this.addForm.startDate, this.addForm.endDate)
  1705. if(this.addForm.startDate > this.addForm.endDate) {
  1706. this.addForm.endDate = this.addForm.startDate
  1707. }
  1708. this.addForm.timeDays = this.countWorkDay(this.addForm.startDate, this.addForm.endDate)
  1709. this.timeChoose = this.addForm.timeDays
  1710. this.addForm.timeHours = this.addForm.timeDays * 8
  1711. },
  1712. datasss() {
  1713. // console.log(123)
  1714. this.addForm.endDate = this.addForm.startDate
  1715. },
  1716. DateDiff(sDate1, sDate2){
  1717. var aDate, oDate1, oDate2, iDays
  1718. aDate = sDate1.split("-")
  1719. oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0])
  1720. aDate = sDate2.split("-")
  1721. oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0])
  1722. iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 /24)
  1723. return iDays + 1
  1724. },
  1725. stringToDate(dateString){
  1726. dateString = dateString.split('-');
  1727. return new Date(dateString[0], dateString[1] - 1, dateString[2]);
  1728. },
  1729. countWorkDay(date1, date2){
  1730. date1 = this.stringToDate(date1);
  1731. date2 = this.stringToDate(date2);
  1732. var delta = (date2 - date1) / (1000 * 60 * 60 * 24) + 1; // 计算出总时间
  1733. var weeks = 0;
  1734. for(var i = 0; i < delta; i++){
  1735. if(date1.getDay() == 0 || date1.getDay() == 6) weeks ++; // 若为周六或周天则加1
  1736. date1 = date1.valueOf();
  1737. date1 += 1000 * 60 * 60 * 24;
  1738. date1 = new Date(date1);
  1739. }
  1740. return delta - weeks;
  1741. },
  1742. chufas() {
  1743. this.billss()
  1744. },
  1745. // 时间
  1746. getTadeTime() {
  1747. var time = new Date();
  1748. return time.getHours() +':00:00'
  1749. },
  1750. // 日期
  1751. getCurrentTime() {
  1752. var _this = this;
  1753.   let yy = new Date().getFullYear();
  1754.   let mm = new Date().getMonth()+1;
  1755.   let dd = new Date().getDate();
  1756.   _this.gettime = yy +'-'+ mm +'-'+ dd;
  1757.   return _this.gettime
  1758. },
  1759. getCurrentTimes() {
  1760. var _this = this;
  1761.   let yy = new Date().getFullYear();
  1762.   let mm = new Date().getMonth()+1;
  1763.   let dd = new Date().getDate();
  1764.   _this.gettime = yy+'-'+mm+'-'+'01';
  1765.   return _this.gettime
  1766. },
  1767. chanSele() {
  1768. this.addForm.timeHours = parseInt(this.addForm.timeHours)
  1769. },
  1770. handleSizeChange(val){
  1771. this.size = val;
  1772. this.bills()
  1773. },
  1774. handleCurrentChange(val) {
  1775. // console.log(val, 1, '1')
  1776. this.page = val;
  1777. this.bills()
  1778. },
  1779. vacationSizeChange(val){
  1780. this.size = val
  1781. this.getVacationList(1)
  1782. },
  1783. vacationCurrentChange(val){
  1784. this.page = val
  1785. this.getVacationList(1)
  1786. },
  1787. statistical() {
  1788. this.loading = true
  1789. this.http.post('/leave-sheet/summaryData', {
  1790. keyword: this.keyword,
  1791. startDate: this.statData,
  1792. endDate: this.endData
  1793. },
  1794. res => {
  1795. if (res.code == "ok") {
  1796. this.statisticalList = res.data
  1797. this.loading = false
  1798. } else {
  1799. this.loading = false
  1800. this.$message({
  1801. message: res.msg,
  1802. type: "error"
  1803. });
  1804. }
  1805. },
  1806. error => {
  1807. this.$message({
  1808. message: error,
  1809. type: "error"
  1810. });
  1811. });
  1812. },
  1813. //
  1814. inputs() {
  1815. var str = this.addForm.timeDays + ''
  1816. if(str.indexOf('.') != '-1') {
  1817. var s = str.split('.')[0]
  1818. var st = str.split('.')[1]
  1819. var sts = st.split('')
  1820. this.addForm.timeDays = s + '.' + sts[0]
  1821. }
  1822. },
  1823. inputss() {
  1824. if(this.addForm.timeHours <= 0) {
  1825. this.addForm.timeHours = 1
  1826. } else if(this.addForm.timeHours > 8) {
  1827. this.addForm.timeHours = 8
  1828. } else {
  1829. if(this.addForm.timeHours.indexOf('.') != '-1') {
  1830. var str = this.addForm.timeHours
  1831. // console.log(str)
  1832. if(str.indexOf('.') != '-1') {
  1833. var s = str.split('.')[0]
  1834. var st = str.split('.')[1]
  1835. var sts = st.split('')
  1836. this.addForm.timeHours = s + '.' + sts[0]
  1837. }
  1838. }
  1839. }
  1840. // console.log(this.addForm)
  1841. },
  1842. deletes(e) {
  1843. this.$confirm(this.$t('deleteit'), this.$t('other.prompts'), {
  1844. //type: 'warning'
  1845. }).then(() => {
  1846. this.http.post('/leave-sheet/delete', {id:e.id},
  1847. res => {
  1848. if (res.code == "ok") {
  1849. this.bills();
  1850. this.$message({
  1851. message: this.$t('message.successfullyDeleted'),
  1852. type: "success"
  1853. });
  1854. } else {
  1855. this.$message({
  1856. message: res.msg,
  1857. type: "error"
  1858. });
  1859. }
  1860. },
  1861. error => {
  1862. this.$message({
  1863. message: error,
  1864. type: "error"
  1865. });
  1866. });
  1867. });
  1868. },
  1869. editor(items) {
  1870. this.dialog = true
  1871. this.addForm.ownerId = items.ownerId
  1872. this.addForm.tel = items.tel
  1873. this.addForm.timeType = items.timeType + ''
  1874. this.addForm.startDate = items.startDate
  1875. this.addForm.endDate = items.endDate
  1876. this.addForm.timeDays = items.timeDays
  1877. this.addForm.timeHours = items.timeHours
  1878. this.addForm.remark = items.remark
  1879. this.affId = items.id
  1880. },
  1881. determine () {
  1882. var adl = this.addForm
  1883. adl.id = this.affId
  1884. this.http.post('/leave-sheet/add', adl,
  1885. res => {
  1886. if (res.code == "ok") {
  1887. this.dialog = false
  1888. this.bills();
  1889. this.addForm = {
  1890. timeType: '0',
  1891. startDate: this.getCurrentTime(),
  1892. endDate: this.getCurrentTime(),
  1893. timeDays: 1,
  1894. leaveType: 0,
  1895. timeHours: '8',
  1896. tel: '',
  1897. remark: ''
  1898. }
  1899. this.getUsers()
  1900. } else {
  1901. this.$message({
  1902. message: res.msg,
  1903. type: "error"
  1904. });
  1905. }
  1906. },
  1907. error => {
  1908. this.$message({
  1909. message: error,
  1910. type: "error"
  1911. });
  1912. });
  1913. },
  1914. bangd() {
  1915. this.addForm = {
  1916. timeType: '0',
  1917. startDate: this.getCurrentTime(),
  1918. endDate: this.getCurrentTime(),
  1919. timeDays: 1,
  1920. leaveType: 0,
  1921. timeHours: '8',
  1922. tel: '',
  1923. remark: ''
  1924. }
  1925. this.getUsers()
  1926. },
  1927. // 自定义组件事件
  1928. selectCal(obj) {
  1929. if(obj.distinction == '1') {
  1930. this.addForm.ownerId = obj.id
  1931. this.txselts(obj.other, obj.id)
  1932. } else if(obj.distinction == '2') {
  1933. let arr = []
  1934. for(let i in obj.arrUserList) {
  1935. arr.push(obj.arrUserList[i].id)
  1936. }
  1937. this.addForm.projectAuditorJson = arr
  1938. } else if(obj.distinction == '3') {
  1939. this.ownerIds = obj.id
  1940. this.chufas()
  1941. } else if(obj.distinction == '4') {
  1942. this.addForm.ownerId = obj.id
  1943. this.selts()
  1944. }
  1945. },
  1946. vueCasader(obj) {
  1947. if(obj.distinction == 1) {
  1948. let arr = []
  1949. arr.push(obj.id)
  1950. this.curDeptId = arr
  1951. this.vueCasaderItem = obj.item
  1952. console.log(obj)
  1953. } else if(obj.distinction == 2) {
  1954. let arr = []
  1955. arr.push(obj.id)
  1956. this.NcurDeptId = arr
  1957. console.log(obj, '闯过奥的值')
  1958. if(obj.item) {
  1959. if(obj.item.label != this.$t('defaultText.pleaseChoose')) {
  1960. this.vueIAlDataSItems = obj.item
  1961. } else {
  1962. this.vueIAlDataSItems = undefined
  1963. }
  1964. } else {
  1965. this.vueIAlDataSItems = undefined
  1966. }
  1967. this.selAl()
  1968. }
  1969. }
  1970. }
  1971. };
  1972. </script>
  1973. <style scoped>
  1974. .addNode {
  1975. cursor:pointer;
  1976. }
  1977. .addNode:hover {
  1978. color:#20a0ff;
  1979. }
  1980. .apls {
  1981. width: 200px;
  1982. white-space:nowrap;
  1983. overflow:hidden;
  1984. text-overflow:ellipsis;
  1985. }
  1986. .tups {
  1987. width: 100%;
  1988. height: 25px;
  1989. position: relative;
  1990. z-index: 99;
  1991. overflow: hidden;
  1992. }
  1993. .tups img {
  1994. height: 25px !important;
  1995. position: relative;
  1996. z-index: 99;
  1997. }
  1998. .viewer-canvas {
  1999. position: absolute;
  2000. z-index: 9 !important;
  2001. }
  2002. .icl {
  2003. margin-top: -25px !important;
  2004. }
  2005. /* 费用报销标题 */
  2006. .headine {
  2007. width: 100%;
  2008. height: 46.4px;
  2009. line-height: 46.4px;
  2010. background: #fff;
  2011. box-sizing: border-box;
  2012. }
  2013. .headine h3 {
  2014. margin: 0;
  2015. display: inline-block;
  2016. box-sizing: border-box;
  2017. color: #999;
  2018. }
  2019. .headine p {
  2020. display: inline-block;
  2021. margin: 0;
  2022. }
  2023. /* /费用报销标题 */
  2024. .sidebars {
  2025. height: 100%;
  2026. position: absolute;
  2027. border-right: 1px solid #E6E6E6;
  2028. z-index: 2;
  2029. top: 0;
  2030. }
  2031. .sidebars h3 {
  2032. margin: 0;
  2033. line-height: 45px;
  2034. background: #ffffff;
  2035. font-weight: normal;
  2036. color: #666;
  2037. padding-left: 20px;
  2038. }
  2039. .sidebars .el-col-12 {
  2040. width: 100%
  2041. }
  2042. .public {
  2043. height: 230px;
  2044. border-bottom: 1px solid #ddd;
  2045. }
  2046. .public .el-form-item {
  2047. display: inline-block;
  2048. }
  2049. .pu_button {
  2050. text-align: right;
  2051. width: 100%;
  2052. padding: 24px 30px;
  2053. box-sizing: border-box;
  2054. }
  2055. .pu_bu_x .pu_bu_t {
  2056. display: inline-block;
  2057. }
  2058. .pu_bu_x {
  2059. margin-right: 20px;
  2060. color: #20A0F7;
  2061. cursor: pointer;
  2062. }
  2063. .pu_bu_t {
  2064. color: #20A0F7;
  2065. cursor: pointer;
  2066. display: block;
  2067. float: right;
  2068. position:
  2069. relative;
  2070. top: -20px;
  2071. right: 63px;
  2072. }
  2073. .pu_table {
  2074. margin-left: 10px;
  2075. }
  2076. .pu_bu_t:hover {
  2077. color: #7bbcff;
  2078. }
  2079. .pu_bu_x:hover {
  2080. color: #7bbcff;
  2081. }
  2082. /* 我的单据报销凭证 */
  2083. .staff{
  2084. border-left: 1px solid #fff;
  2085. border-top: 1px solid #fff;
  2086. border-right: 1px solid #fff;
  2087. background: #fff;
  2088. }
  2089. /* */
  2090. .sdat{
  2091. display: inline-block;
  2092. width: 260px;
  2093. margin-left: 13px;
  2094. }
  2095. .messages .el-form-item{
  2096. display: inline-block;
  2097. }
  2098. .messages .el-date-editor.el-input, .el-date-editor.el-input__inner{
  2099. width: 190px;
  2100. }
  2101. /* 我的报销单据 */
  2102. .search {
  2103. position: relative;
  2104. top: 20px;
  2105. left: 20px;
  2106. }
  2107. .tables {
  2108. margin-top: 50px;
  2109. box-sizing: border-box;
  2110. padding: 10px;
  2111. }
  2112. .informant .el-form-item {
  2113. display: inline-block;
  2114. }
  2115. /* 侧边栏收索 */
  2116. .side {
  2117. position: absolute;
  2118. z-index: 2;
  2119. border-right: 2px solid #DDDDDD;
  2120. height: 100%;
  2121. top: 0;
  2122. width: 0;
  2123. }
  2124. .side .spans {
  2125. width: 20px;
  2126. height: 30px;
  2127. border: 1px solid #DDDDDD;
  2128. box-sizing: border-box;
  2129. position: absolute;
  2130. top: 50%;
  2131. margin-top: -50%;
  2132. text-align: center;
  2133. z-index: 1;
  2134. background: #fff;
  2135. }
  2136. .side .spans i{
  2137. margin-top: 7px;
  2138. color: #C0BFBF
  2139. }
  2140. .side:hover {
  2141. border-right: 2px solid #20A0FF;
  2142. }
  2143. .side:hover .spans {
  2144. border: 1px solid #20A0FF;
  2145. background: #20A0FF;
  2146. }
  2147. .side:hover .spans i{
  2148. color: #fff;
  2149. }
  2150. /* 右边整体页面 */
  2151. .contents {
  2152. height: 100%;
  2153. /* padding: 30px; */
  2154. background: #F7F7F7;
  2155. /* position: absolute; */
  2156. }
  2157. .submits {
  2158. margin-left: 50%;
  2159. }
  2160. .waiting {
  2161. color:orange;
  2162. }
  2163. .rejected {
  2164. color:red;
  2165. }
  2166. /* 请假模块 */
  2167. .tops {
  2168. width: 100%;
  2169. position: relative;
  2170. background: #f7f7f7;
  2171. box-sizing: border-box;
  2172. padding: 20px 0 0 200px;
  2173. }
  2174. .ctons {
  2175. /* width: 86%; */
  2176. height: 92%;
  2177. overflow: hidden;
  2178. background: #fff;
  2179. padding: 30px 40px;
  2180. box-sizing: border-box;
  2181. }
  2182. .ctons .el-form-item {
  2183. display: inline-block;
  2184. }
  2185. .line {
  2186. text-align: center;
  2187. margin: 0 6px
  2188. }
  2189. .poss {
  2190. position: fixed;
  2191. bottom: 4px;
  2192. right: 1%;
  2193. box-sizing: border-box;
  2194. }
  2195. .flex {
  2196. display: flex;
  2197. padding: 0 0 20px 0;
  2198. border-bottom: 1px solid #f2f2f2;
  2199. }
  2200. .flex span {
  2201. color: #606266;
  2202. display: inline-block;
  2203. margin: 0 10px 0 20px;
  2204. }
  2205. </style>