list.vue 83 KB

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