list.vue 85 KB

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