list.vue 86 KB

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