list.vue 83 KB

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