list.vue 65 KB

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