list.vue 78 KB

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