list.vue 85 KB

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