list.vue 77 KB

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