list.vue 108 KB

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