list.vue 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190
  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-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-submenu index="2" v-if="user.role != 0">
  19. <template slot="title">
  20. <i class="iconfont firerock-iconbaoxiaodan"></i>
  21. <span>{{user.role == 0?"我的请假单":"请假单列表"}}</span>
  22. </template>
  23. <el-menu-item index="2-1" ><p @click="bills(false, 2)" >全部</p></el-menu-item>
  24. <el-menu-item index="2-2" ><p @click="bills(true, 1)">待审核</p></el-menu-item>
  25. </el-submenu>
  26. <el-menu-item index="3" @select="bills" @click="bills(false, 2)" v-if="user.role == 0">
  27. <i class="iconfont firerock-iconbaoxiaodan"></i>
  28. <span slot="title">{{user.role == 0?"我的请假单":"请假单列表"}}</span>
  29. </el-menu-item>
  30. <el-menu-item index="4" v-if="user.role != 0">
  31. <template slot="title">
  32. <i class="iconfont firerock-icontianbao"></i>
  33. <span slot="title">请假统计</span>
  34. </template>
  35. </el-menu-item>
  36. </el-menu>
  37. </el-col>
  38. </div>
  39. <!-- 侧边栏点击事件 -->
  40. <!-- <div class="side" @click="side" ref="sid" style="left: 430px">
  41. <div class="spans" ref="side" style="left: -19px;"><i ref="sideI" class="el-icon-arrow-left"></i></div>
  42. </div> -->
  43. <!-- 内容主体区域 -->
  44. <div class="contents">
  45. <div v-if="!displayTable" class="headine" ref="headine">
  46. <h3 ref="headHe" style="padding-left: 220px">{{shuz[ins]}}</h3>
  47. <!-- <p style="float: right;margin-right: 25px;"><el-button type="primary" @click="submits('addFormRules')" size="mini">提交</el-button></p> -->
  48. </div>
  49. <!-- 上面部分 -->
  50. <div v-if="!displayTable && apk == false" class="tops">
  51. <!-- 公共 -->
  52. <div class="ctons">
  53. <!-- 表单 -->
  54. <el-form ref="addForm" :model="addForm" label-width="80px" :rules="addFormRules">
  55. <!-- 请假人 -->
  56. <el-form-item label="请假人" prop="ownerId" style="width: 300px">
  57. <!--普通员工只能自己填报自己的 -->
  58. <el-select v-model="addForm.ownerId" @change="selts()" placeholder="请选择请假人" style="width: 240px" :disabled="user.role == 0" filterable="true">
  59. <span v-for="(item, index) in users" :key="index">
  60. <el-option :label="item.name" :value="item.id"></el-option>
  61. </span>
  62. </el-select>
  63. </el-form-item>
  64. <!-- 电话 -->
  65. <el-form-item label="电话" prop="tel">
  66. <el-input ref="ipts" v-model="addForm.tel" placeholder="请输入手机号" style="width: 250px"></el-input>
  67. </el-form-item>
  68. <!-- 单选 -->
  69. <el-form-item style="display: block" label="时长单位">
  70. <el-radio-group v-model="addForm.timeType" @change="chanRadio()">
  71. <el-radio label="0">按天请假</el-radio>
  72. <el-radio label="1">按小时请假</el-radio>
  73. </el-radio-group>
  74. </el-form-item>
  75. <!-- 时间选择 -->
  76. <el-form-item :label="flg ? '选择日期' : '选择时间'" style="width: 48%;margin-right:500px">
  77. <el-col :span="9">
  78. <el-date-picker v-if="flg" type="date" placeholder="开始日期" value-format="yyyy-MM-dd" :picker-options="pickerOptionsStart" v-model="addForm.startDate" style="width: 240px;" @blur="datas()"></el-date-picker>
  79. <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>
  80. </el-col>
  81. <el-col class="line" v-if="flg" :span="2">-</el-col>
  82. <el-col :span="9">
  83. <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>
  84. <!-- <el-select v-else v-model="addForm.timeHours" placeholder="请假时长" @change="chanSele()">
  85. <el-option v-for="(item, index) in options" :key="index" :label="item" :value="item"></el-option>
  86. </el-select> -->
  87. </el-col>
  88. </el-form-item>
  89. <!-- 请假天数 -->
  90. <el-form-item :label="flg ? '请假天数' : '请假时长'" prop="timeDays" style="margin-right: 500px">
  91. <!-- {{flg ? addForm.timeDays : addForm.timeHours}}{{flg ? '天' : '小时'}} -->
  92. <!-- <div v-if="flg">{{addForm.timeDays}} 天</div> -->
  93. <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>
  94. <div v-else>
  95. <el-input v-model="addForm.timeHours" @blur="inputss()" @input="addForm.timeHours=addForm.timeHours.replace(/[^\d.]/g,'')" style="width: 100px; margin-right: 20px;"></el-input> 小时
  96. </div>
  97. </el-form-item>
  98. <!-- 备注 -->
  99. <el-form-item label="备注" style="width: 100%">
  100. <el-input type="textarea" v-model="addForm.remark" :rows="5" style="width: 550px" maxlength="100" show-word-limit></el-input>
  101. </el-form-item>
  102. </el-form>
  103. <div>
  104. <p style="margin-left: 20%"><el-button type="primary" @click="submits('addFormRules')" size="mini">提交</el-button></p>
  105. </div>
  106. </div>
  107. </div>
  108. <!-- 下面部分 -->
  109. <div v-if="displayTable && apk == false" class="tops">
  110. <!-- 公共 -->
  111. <div class="ctons">
  112. <div class="flex">
  113. <div>
  114. <el-select v-model="ownerIds" placeholder="请选择请假人" clearable @change="chufas()" style="width: 180px" size="small" :disabled="user.role == 0" filterable="true">
  115. <span v-for="(item, index) in users" :key="index">
  116. <el-option :label="item.name" :value="item.id"></el-option>
  117. </span>
  118. </el-select>
  119. </div>
  120. <div>
  121. <span style="color: #606266">请假类型</span>
  122. <el-select v-model="type" placeholder="请选择请假类型" clearable @change="chufas()" style="width: 180px;" size="small" filterable="true">
  123. <span v-for="(item, index) in typess" :key="index">
  124. <el-option :label="item.name" :value="item.id"></el-option>
  125. </span>
  126. </el-select>
  127. </div>
  128. <div>
  129. <span style="color: #606266">请假状态</span>
  130. <el-select v-if="falg == 0" v-model="code" placeholder="请选择请假状态" clearable @change="chufas()" size="small" style="width: 180px" filterable="true">
  131. <span v-for="(item, index) in statuss" :key="index">
  132. <el-option :label="item.name" :value="item.id"></el-option>
  133. </span>
  134. </el-select>
  135. <el-select v-if="falg == 1" disabled v-model="code" placeholder="请选择请假类型" clearable @change="chufas()" size="small" style="width: 180px" filterable="true">
  136. <span v-for="(item, index) in statuss" :key="index">
  137. <el-option :label="item.name" :value="item.id"></el-option>
  138. </span>
  139. </el-select>
  140. </div>
  141. <div>
  142. <span style="color: #606266">请假时间</span>
  143. <el-date-picker v-model="createDate" type="date" @change="chufas()" :value-format = "YYYY-MM-DD" placeholder="选择日期" size="small" clearable> </el-date-picker>
  144. </div>
  145. </div>
  146. <el-table v-loading="loading" :data="tableData" style="width: 100%" height="90%">
  147. <el-table-column prop="ownerName" label="请假人" width="120"></el-table-column>
  148. <el-table-column prop="tel" label="电话" width="120"></el-table-column>
  149. <el-table-column prop="leaveType" label="请假类型" width="120">
  150. <template slot-scope="scope">
  151. <div v-if="scope.row.leaveType == 0">事假</div>
  152. <div v-if="scope.row.leaveType == 1">病假</div>
  153. <div v-if="scope.row.leaveType == 2">年假</div>
  154. <div v-if="scope.row.leaveType == 3">产假</div>
  155. </template>
  156. </el-table-column>
  157. <el-table-column prop="startDate" label="请假开始时间" width="150"></el-table-column>
  158. <el-table-column prop="endDate" label="请假结束时间" width="150"></el-table-column>
  159. <el-table-column label="请假天数" width="120">
  160. <template slot-scope="scope">
  161. <div>{{scope.row.timeDays}}天</div>
  162. </template>
  163. </el-table-column>
  164. <el-table-column label="请假时长" width="120">
  165. <template slot-scope="scope">
  166. <div>{{scope.row.timeHours}}小时</div>
  167. </template>
  168. </el-table-column>
  169. <el-table-column prop="status" label="状态" width="100">
  170. <template slot-scope="scope">
  171. <div v-if="scope.row.status == 0 || scope.row.status == 1 || scope.row.status == 2 || scope.row.status == 3 || scope.row.status == 4">
  172. <div v-if="scope.row.status == 0" >审核通过</div>
  173. <div v-if="scope.row.status == 1" style="color: orange">待审核</div>
  174. <div v-if="scope.row.status == 2" style="color: red">驳回</div>
  175. <div v-if="scope.row.status == 3" style="color: #666666">撤销</div>
  176. </div>
  177. <div v-else>
  178. <span>暂无请假单</span>
  179. </div>
  180. </template>
  181. </el-table-column>
  182. <el-table-column prop="remark" label="备注" width="200">
  183. <template slot-scope="scope">
  184. <!-- <div class="apls">{{scope.row.remark}}</div> -->
  185. <el-popover placement="top-start" title="标题" width="200" trigger="hover" :content="scope.row.remark">
  186. <div slot="reference" class="apls">{{scope.row.remark}}</div>
  187. </el-popover>
  188. </template>
  189. </el-table-column>
  190. <el-table-column label="操作" width="180" fixed="right" v-if="isAuditList">
  191. <template slot-scope="scope">
  192. <div v-if="user.role != 0">
  193. <el-button icon="el-icon-check" circle size="mini" @click.stop.native="approve(scope.row)"></el-button>
  194. <el-button icon="el-icon-close" circle size="mini" @click.stop.native="deny(scope.row)"></el-button>
  195. </div>
  196. <div v-else>
  197. <el-button type="danger" size="mini">撤销</el-button>
  198. </div>
  199. </template>
  200. </el-table-column>
  201. <el-table-column label="操作" width="180" fixed="right" v-if="!isAuditList">
  202. <template slot-scope="scope">
  203. <div v-if="user.role == 0">
  204. <el-button icon="el-icon-delete" circle size="mini" @click.stop.native="deletes(scope.row)" v-if="scope.row.status != 0"></el-button>
  205. <el-button icon="el-icon-edit" circle size="mini" @click.stop.native="editor(scope.row)" v-if="scope.row.status != 0"></el-button>
  206. </div>
  207. <div v-if="user.role != 0">
  208. <el-button icon="el-icon-delete" circle size="mini" @click.stop.native="deletes(scope.row)"></el-button>
  209. <el-button icon="el-icon-edit" circle size="mini" @click.stop.native="editor(scope.row)"></el-button>
  210. </div>
  211. </template>
  212. </el-table-column>
  213. </el-table>
  214. <div class="poss">
  215. <el-pagination
  216. @size-change="handleSizeChange"
  217. @current-change="handleCurrentChange"
  218. :current-page="currentPage4"
  219. :page-sizes="[20, 50, 100, 200]"
  220. :page-size="20"
  221. layout="total, sizes, prev, pager, next"
  222. :total="total">
  223. </el-pagination>
  224. </div>
  225. </div>
  226. </div>
  227. <!-- 统计部分 -->
  228. <div v-if="displayTable && apk" class="tops">
  229. <!-- 公共 -->
  230. <div class="ctons">
  231. <div style="display: flex;align-items: center;">
  232. <div style="display: inline-block;width: 350px">
  233. <el-input style="float:left;" v-model="keyword" class="input-with-select" placeholder="请输入人员搜索" clearable="true" size="small">
  234. <el-button slot="append" @click="statistical()" icon="el-icon-search"></el-button>
  235. </el-input>
  236. </div>
  237. <div style="display: inline-block;width: 340px">
  238. <span style="display: inline-block;margin: 0 15px 0 20px;color: rgb(96, 98, 102);">开始日期</span>
  239. <el-date-picker
  240. v-model="statData"
  241. type="date"
  242. placeholder="选择日期"
  243. size="small"
  244. @change="statistical()"
  245. clearable="false"
  246. value-format="yyyy-MM-dd"
  247. :picker-options="pickerOptionsStarts">
  248. </el-date-picker>
  249. </div>
  250. <div style="display: inline-block;width: 350px">
  251. <span style="display: inline-block;margin: 0 15px 0 0;color: rgb(96, 98, 102);">结束日期</span>
  252. <el-date-picker
  253. v-model="endData"
  254. type="date"
  255. placeholder="选择日期"
  256. size="small"
  257. @change="statistical()"
  258. clearable="fasle"
  259. value-format="yyyy-MM-dd"
  260. :picker-options="pickerOptionsEnds">
  261. </el-date-picker>
  262. </div>
  263. </div>
  264. <div style="margin-top: 30px">
  265. <el-table v-loading="loading" :data="statisticalList" height="780px" style="width: 100%">
  266. <el-table-column prop="ownerName" label="姓名" width="300">
  267. <template slot-scope="scope">
  268. <div v-if="scope.row.ownerName">
  269. {{scope.row.ownerName}}
  270. </div>
  271. <div v-else>
  272. <span>暂无请假统计</span>
  273. </div>
  274. </template>
  275. </el-table-column>
  276. <el-table-column prop="timeDays" label="请假总天数" width="300">
  277. <template slot-scope="scope">
  278. {{scope.row.timeDays}}/天
  279. </template>
  280. </el-table-column>
  281. <el-table-column prop="timeHours" label="请假总时长">
  282. <template slot-scope="scope">
  283. {{scope.row.timeHours}}/小时
  284. </template>
  285. </el-table-column>
  286. </el-table>
  287. </div>
  288. </div>
  289. </div>
  290. </div>
  291. <!-- 请假单详情 -->
  292. <el-dialog title="请假单详情" :visible.sync="dialog" width="1000px" @close="bangd()">
  293. <!-- 表单 -->
  294. <el-form ref="addForm" :model="addForm" label-width="80px" :rules="addFormRules">
  295. <!-- 请假人 -->
  296. <el-form-item label="请假人" prop="ownerId" style="width: 300px;display: inline-block;">
  297. <!--普通员工只能自己填报自己的 -->
  298. <el-select v-model="addForm.ownerId" @change="selts()" placeholder="请选择请假人" style="width: 240px" :disabled="user.role == 0" filterable="true">
  299. <span v-for="(item, index) in users" :key="index">
  300. <el-option :label="item.name" :value="item.id"></el-option>
  301. </span>
  302. </el-select>
  303. </el-form-item>
  304. <!-- 电话 -->
  305. <el-form-item label="电话" prop="tel" style="width: 300px;display: inline-block;">
  306. <el-input ref="ipts" v-model="addForm.tel" placeholder="请输入手机号" style="width: 250px;"></el-input>
  307. </el-form-item>
  308. <!-- 单选 -->
  309. <el-form-item style="display: block" label="时长单位">
  310. <el-radio-group v-model="addForm.timeType" @change="chanRadio()">
  311. <el-radio label="0">按天请假</el-radio>
  312. <el-radio label="1">按小时请假</el-radio>
  313. </el-radio-group>
  314. </el-form-item>
  315. <!-- 时间选择 -->
  316. <el-form-item :label="flg ? '选择日期' : '选择时间'" style="width: 74%;margin-right:500px">
  317. <el-col :span="9">
  318. <el-date-picker v-if="flg" type="date" placeholder="开始日期" value-format="yyyy-MM-dd" :picker-options="pickerOptionsStart" v-model="addForm.startDate" style="width: 240px;" @blur="datas()"></el-date-picker>
  319. <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>
  320. </el-col>
  321. <el-col class="line" v-if="flg" :span="2">-</el-col>
  322. <el-col :span="9">
  323. <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>
  324. <!-- <el-select v-else v-model="addForm.timeHours" placeholder="请假时长" @change="chanSele()">
  325. <el-option v-for="(item, index) in options" :key="index" :label="item" :value="item"></el-option>
  326. </el-select> -->
  327. </el-col>
  328. </el-form-item>
  329. <!-- 请假天数 -->
  330. <el-form-item :label="flg ? '请假天数' : '请假时长'" prop="timeDays" style="margin-right: 500px">
  331. <!-- {{flg ? addForm.timeDays : addForm.timeHours}}{{flg ? '天' : '小时'}} -->
  332. <!-- <div v-if="flg">{{addForm.timeDays}} 天</div> -->
  333. <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>
  334. <div v-else>
  335. <el-input v-model="addForm.timeHours" @blur="inputss()" @input="addForm.timeHours=addForm.timeHours.replace(/[^\d.]/g,'')" style="width: 100px; margin-right: 20px;"></el-input> 小时
  336. </div>
  337. </el-form-item>
  338. <!-- 备注 -->
  339. <el-form-item label="备注" style="width: 100%">
  340. <el-input type="textarea" v-model="addForm.remark" :rows="5" style="width: 62%" maxlength="100" show-word-limit></el-input>
  341. </el-form-item>
  342. </el-form>
  343. <span slot="footer" class="dialog-footer">
  344. <el-button @click="dialog = false">取 消</el-button>
  345. <el-button type="primary" @click="determine()">确 定</el-button>
  346. </span>
  347. </el-dialog>
  348. </section>
  349. </template>
  350. <script>
  351. import { config } from 'dingtalk-jsapi';
  352. export default {
  353. name: "expense",
  354. components: {},
  355. props: {},
  356. data() {
  357. //验证手机号
  358. var checkTel = (rule, value, callback) =>{
  359. if (!value) {
  360. return callback(new Error('手机号不能为空'));
  361. } else {
  362. const reg = /^1[3|4|5|7|8][0-9]\d{8}$/
  363. if (reg.test(value)) {
  364. callback();
  365. } else {
  366. return callback(new Error('请输入正确的手机号'));
  367. }
  368. }
  369. };
  370. var checks = (rule, value, callback) => {
  371. if (!value) {
  372. return callback(new Error('请假天数不能为空'));
  373. } else {
  374. if (value > this.timeChoose) {
  375. return callback(new Error('超过当前选择日期的天数'));
  376. } else {
  377. callback();
  378. }
  379. }
  380. };
  381. return {
  382. addFormRules: {
  383. ownerId: [{ required: true, message: "请选择请假人", trigger: "blur" }],
  384. tel: [{required: true, validator: checkTel, trigger: 'blur'}],
  385. timeDays: [{required: true, validator: checks, trigger: 'blur'}]
  386. },
  387. user: JSON.parse(sessionStorage.getItem("user")),
  388. shuz: ['事假填报', '病假填报', '年假填报', '产假填报'],
  389. ins: 0,
  390. addForm: {
  391. timeType: '0',
  392. startDate: this.getCurrentTime(),
  393. endDate: this.getCurrentTime(),
  394. timeDays: 1,
  395. leaveType: 0,
  396. ownerId: '',
  397. // indate: this.getCurrentTime(),
  398. timeHours: 8,
  399. tel: '',
  400. remark: ''
  401. },
  402. displayTable: false,
  403. users: [], // 人员信息
  404. flg: true,
  405. createDate: '2020-01-01',
  406. pickerOptionsStart: {
  407. disabledDate: (time) => {
  408. if (this.addForm.endDate) {
  409. return time.getTime() > new Date(this.addForm.endDate).getTime() || time.getTime() <= new Date(this.createDate).getTime() - 86400000;
  410. }
  411. return time.getTime() <= new Date(this.createDate).getTime() - 86400000;
  412. },
  413. },
  414. pickerOptionsEnd: {
  415. disabledDate: (time) => {
  416. if (this.addForm.startDate) {
  417. return time.getTime() < new Date(this.addForm.startDate).getTime();
  418. }
  419. return time.getTime() <= new Date(this.createDate).getTime() - 86400000;
  420. },
  421. },
  422. pickerOptionsStarts: {
  423. disabledDate: (time) => {
  424. if (this.endData) {
  425. return time.getTime() > new Date(this.endData).getTime() || time.getTime() <= new Date(this.createDate).getTime() - 86400000;
  426. }
  427. return time.getTime() <= new Date(this.createDate).getTime() - 86400000;
  428. },
  429. },
  430. pickerOptionsEnds: {
  431. disabledDate: (time) => {
  432. if (this.endData) {
  433. return time.getTime() < new Date(this.endData).getTime();
  434. }
  435. return time.getTime() <= new Date(this.createDate).getTime() - 86400000;
  436. },
  437. },
  438. options: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],
  439. tableData: [],
  440. page: 1,
  441. size: 20,
  442. isAuditList: '',
  443. total:0,
  444. apk: false,
  445. keyword: '',
  446. statData: this.getCurrentTimes(),
  447. endData: this.getCurrentTime(),
  448. statisticalList: [],
  449. loading: false,
  450. timeChoose: 1,
  451. typess: [{
  452. name: '事假',
  453. id: 0
  454. },{
  455. name: '病假',
  456. id: 1
  457. },{
  458. name: '年假',
  459. id: 2
  460. },{
  461. name: '产假',
  462. id: 3
  463. }],
  464. statuss: [{
  465. name: '审核通过',
  466. id: 0
  467. },{
  468. name: '待审核',
  469. id: 1
  470. },{
  471. name: '驳回',
  472. id: 2
  473. },{
  474. name: '已撤销',
  475. id: 3
  476. }],
  477. createDatelis: '',
  478. ownerIds: '',
  479. type: '',
  480. code: '',
  481. createDate: '',
  482. falg: 0,
  483. dialog: false,
  484. adform: {},
  485. affId: ''
  486. };
  487. },
  488. computed: {},
  489. watch: {},
  490. created() {},
  491. mounted() {
  492. this.getUsers() // 获取人员信息
  493. },
  494. filters: {},
  495. methods: {
  496. approve(item) {
  497. //审核通过
  498. this.http.post('/leave-sheet/approve', {id:item.id
  499. },
  500. res => {
  501. if (res.code == "ok") {
  502. this.bills(true);
  503. } else {
  504. this.$message({
  505. message: res.msg,
  506. type: "error"
  507. });
  508. }
  509. },
  510. error => {
  511. this.$message({
  512. message: error,
  513. type: "error"
  514. });
  515. });
  516. },
  517. deny(item) {
  518. //审核驳回
  519. this.http.post('/leave-sheet/deny', {id:item.id
  520. },
  521. res => {
  522. if (res.code == "ok") {
  523. this.bills(true);
  524. } else {
  525. this.$message({
  526. message: res.msg,
  527. type: "error"
  528. });
  529. }
  530. },
  531. error => {
  532. this.$message({
  533. message: error,
  534. type: "error"
  535. });
  536. });
  537. },
  538. getUsers() {
  539. this.http.post(this.port.manage.list, {
  540. departmentId: -1,
  541. pageIndex: 1,
  542. pageSize: 99999
  543. },
  544. res => {
  545. if (res.code == "ok") {
  546. this.users = res.data.records;
  547. if (this.user.role == 0) {
  548. this.addForm.ownerId = this.user.id;
  549. this.ownerIds = this.user.id
  550. this.addForm.status = 1;
  551. this.addForm.tel = this.user.phone
  552. }
  553. } else {
  554. this.$message({
  555. message: res.msg,
  556. type: "error"
  557. });
  558. }
  559. },
  560. error => {
  561. this.$message({
  562. message: error,
  563. type: "error"
  564. });
  565. });
  566. },
  567. // 员工请假填报点击事件
  568. ssl(index) {
  569. this.ins = index;
  570. this.addForm.leaveType = index
  571. },
  572. staffs(key, keyPath) {
  573. console.log(keyPath)
  574. if (keyPath[0] == '1') {
  575. this.displayTable = false;
  576. this.apk = false
  577. } else if(keyPath[0] == '2' || keyPath[0] == '3') {
  578. this.displayTable = true;
  579. this.apk = false
  580. } else {
  581. this.displayTable = true;
  582. this.apk = true
  583. this.statistical()
  584. }
  585. },
  586. bills(audit, tr){
  587. if(tr) {
  588. this.code = ''
  589. this.createDate = ''
  590. // this.ownerIds = ''
  591. this.type = ''
  592. if(tr == 1) {
  593. this.falg = 1
  594. this.code = 1
  595. } else if(tr == 2) {
  596. this.code = ''
  597. this.falg = 0
  598. } else {
  599. this.falg = 0
  600. }
  601. } else {
  602. this.falg = false
  603. }
  604. this.tableData = []
  605. this.displayTable = true;
  606. this.isAuditList = audit;
  607. this.loading = true
  608. var param = {pageIndex: this.page,
  609. pageSize: this.size,
  610. status: this.code,
  611. createDate: this.createDate,
  612. ownerId: this.ownerIds,
  613. leaveType: this.type,
  614. };
  615. if (this.isAuditList) {
  616. param.status = 1;
  617. }
  618. this.list = [];
  619. // this.total = 0;
  620. this.http.post('/leave-sheet/list', param,
  621. res => {
  622. if (res.code == "ok") {
  623. this.tableData = res.data.records
  624. this.total = res.data.total
  625. this.loading = false
  626. } else {
  627. this.loading = false
  628. this.$message({
  629. message: res.msg,
  630. type: "error"
  631. });
  632. }
  633. },
  634. error => {
  635. this.loading = false
  636. this.$message({
  637. message: error,
  638. type: "error"
  639. });
  640. });
  641. },
  642. billss() {
  643. var param = {pageIndex: this.page,
  644. pageSize: this.size,
  645. status: this.code,
  646. createDate: this.createDate,
  647. ownerId: this.ownerIds,
  648. leaveType: this.type,
  649. };
  650. this.http.post('/leave-sheet/list', param,
  651. res => {
  652. if (res.code == "ok") {
  653. this.tableData = res.data.records
  654. this.total = res.data.total
  655. this.loading = false
  656. } else {
  657. this.loading = false
  658. this.$message({
  659. message: res.msg,
  660. type: "error"
  661. });
  662. }
  663. },
  664. error => {
  665. this.loading = false
  666. this.$message({
  667. message: error,
  668. type: "error"
  669. });
  670. });
  671. },
  672. submits(){
  673. console.log(this.addForm)
  674. // return
  675. this.$refs.addForm.validate(valid => {
  676. if (valid) {
  677. this.http.post('/leave-sheet/add', this.addForm,
  678. res => {
  679. if (res.code == "ok") {
  680. this.$message({
  681. message: '填报成功',
  682. type: "success"
  683. });
  684. this.addForm.timeType = '0'
  685. this.addForm.startDate = this.getCurrentTime()
  686. this.addForm.endDate = this.getCurrentTime()
  687. this.addForm.timeDays = 1
  688. this.addForm.leaveType = 0
  689. this.addForm.timeHours = 8
  690. this.addForm.remark = ''
  691. this.flg = true
  692. } else {
  693. this.$message({
  694. message: res.msg,
  695. type: "error"
  696. });
  697. }
  698. },
  699. error => {
  700. this.$message({
  701. message: error,
  702. type: "error"
  703. });
  704. });
  705. } else {
  706. return false;
  707. }
  708. });
  709. },
  710. selts() {
  711. for(var i in this.users) {
  712. if(this.users[i].id == this.addForm.ownerId) {
  713. this.addForm.tel = this.users[i].phone
  714. }
  715. }
  716. },
  717. chanRadio() {
  718. console.log(this.addForm.timeType)
  719. if(this.addForm.timeType == '0') {
  720. this.flg = true
  721. this.addForm.startDate = this.getCurrentTime()
  722. this.addForm.endDate = this.getCurrentTime()
  723. this.addForm.timeType = '0'
  724. this.addForm.timeDays = '1'
  725. this.addForm.timeHours = '8'
  726. } else {
  727. this.flg = false
  728. this.addForm.startDate = this.getCurrentTime()
  729. this.addForm.endDate = this.getCurrentTime()
  730. this.addForm.timeType = '1'
  731. this.addForm.timeHours = 1,
  732. this.addForm.timeDays = 1
  733. }
  734. },
  735. // 计算日期
  736. datas() {
  737. // this.addForm.timeDays = this.DateDiff(this.addForm.startDate, this.addForm.endDate)
  738. this.addForm.timeDays = this.countWorkDay(this.addForm.startDate, this.addForm.endDate)
  739. this.timeChoose = this.addForm.timeDays
  740. this.addForm.timeHours = this.addForm.timeDays * 8
  741. },
  742. datasss() {
  743. console.log(123)
  744. this.addForm.endDate = this.addForm.startDate
  745. },
  746. DateDiff(sDate1, sDate2){
  747. var aDate, oDate1, oDate2, iDays
  748. aDate = sDate1.split("-")
  749. oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0])
  750. aDate = sDate2.split("-")
  751. oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0])
  752. iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 /24)
  753. return iDays + 1
  754. },
  755. stringToDate(dateString){
  756. dateString = dateString.split('-');
  757. return new Date(dateString[0], dateString[1] - 1, dateString[2]);
  758. },
  759. countWorkDay(date1, date2){
  760. date1 = this.stringToDate(date1);
  761. date2 = this.stringToDate(date2);
  762. var delta = (date2 - date1) / (1000 * 60 * 60 * 24) + 1; // 计算出总时间
  763. var weeks = 0;
  764. for(var i = 0; i < delta; i++){
  765. if(date1.getDay() == 0 || date1.getDay() == 6) weeks ++; // 若为周六或周天则加1
  766. date1 = date1.valueOf();
  767. date1 += 1000 * 60 * 60 * 24;
  768. date1 = new Date(date1);
  769. }
  770. return delta - weeks;
  771. },
  772. chufas() {
  773. this.billss()
  774. },
  775. // 时间
  776. getTadeTime() {
  777. var time = new Date();
  778. return time.getHours() +':00:00'
  779. },
  780. // 日期
  781. getCurrentTime() {
  782. var _this = this;
  783.   let yy = new Date().getFullYear();
  784.   let mm = new Date().getMonth()+1;
  785.   let dd = new Date().getDate();
  786.   _this.gettime = yy +'-'+ mm +'-'+ dd;
  787.   return _this.gettime
  788. },
  789. getCurrentTimes() {
  790. var _this = this;
  791.   let yy = new Date().getFullYear();
  792.   let mm = new Date().getMonth()+1;
  793.   let dd = new Date().getDate();
  794.   _this.gettime = yy+'-'+mm+'-'+'01';
  795.   return _this.gettime
  796. },
  797. chanSele() {
  798. this.addForm.timeHours = parseInt(this.addForm.timeHours)
  799. },
  800. handleSizeChange(val){
  801. this.size = val;
  802. this.bills()
  803. },
  804. handleCurrentChange(val) {
  805. console.log(val, 1, '1')
  806. this.page = val;
  807. this.bills()
  808. },
  809. statistical() {
  810. this.loading = true
  811. this.http.post('/leave-sheet/summaryData', {
  812. keyword: this.keyword,
  813. startDate: this.statData,
  814. endDate: this.endData
  815. },
  816. res => {
  817. if (res.code == "ok") {
  818. this.statisticalList = res.data
  819. this.loading = false
  820. } else {
  821. this.loading = false
  822. this.$message({
  823. message: res.msg,
  824. type: "error"
  825. });
  826. }
  827. },
  828. error => {
  829. this.$message({
  830. message: error,
  831. type: "error"
  832. });
  833. });
  834. },
  835. //
  836. inputs() {
  837. var str = this.addForm.timeDays + ''
  838. if(str.indexOf('.') != '-1') {
  839. var s = str.split('.')[0]
  840. var st = str.split('.')[1]
  841. var sts = st.split('')
  842. this.addForm.timeDays = s + '.' + sts[0]
  843. }
  844. },
  845. inputss() {
  846. if(this.addForm.timeHours <= 0) {
  847. this.addForm.timeHours = 1
  848. } else if(this.addForm.timeHours > 8) {
  849. this.addForm.timeHours = 8
  850. } else {
  851. if(this.addForm.timeHours.indexOf('.') != '-1') {
  852. var str = this.addForm.timeHours
  853. console.log(str)
  854. if(str.indexOf('.') != '-1') {
  855. var s = str.split('.')[0]
  856. var st = str.split('.')[1]
  857. var sts = st.split('')
  858. this.addForm.timeHours = s + '.' + sts[0]
  859. }
  860. }
  861. }
  862. console.log(this.addForm)
  863. },
  864. deletes(e) {
  865. this.$confirm("确认要删除吗?", "提示", {
  866. //type: 'warning'
  867. }).then(() => {
  868. this.http.post('/leave-sheet/delete', {id:e.id},
  869. res => {
  870. if (res.code == "ok") {
  871. this.bills();
  872. this.$message({
  873. message: '删除成功',
  874. type: "success"
  875. });
  876. } else {
  877. this.$message({
  878. message: res.msg,
  879. type: "error"
  880. });
  881. }
  882. },
  883. error => {
  884. this.$message({
  885. message: error,
  886. type: "error"
  887. });
  888. });
  889. });
  890. },
  891. editor(items) {
  892. this.dialog = true
  893. this.addForm.ownerId = items.ownerId
  894. this.addForm.tel = items.tel
  895. this.addForm.timeType = items.timeType + ''
  896. this.addForm.startDate = items.startDate
  897. this.addForm.endDate = items.endDate
  898. this.addForm.timeDays = items.timeDays
  899. this.addForm.timeHours = items.timeHours
  900. this.addForm.remark = items.remark
  901. this.affId = items.id
  902. },
  903. determine () {
  904. var adl = this.addForm
  905. adl.id = this.affId
  906. this.http.post('/leave-sheet/add', adl,
  907. res => {
  908. if (res.code == "ok") {
  909. this.dialog = false
  910. this.bills();
  911. this.addForm = {
  912. timeType: '0',
  913. startDate: this.getCurrentTime(),
  914. endDate: this.getCurrentTime(),
  915. timeDays: 1,
  916. leaveType: 0,
  917. timeHours: '8',
  918. tel: '',
  919. remark: ''
  920. }
  921. this.getUsers()
  922. } else {
  923. this.$message({
  924. message: res.msg,
  925. type: "error"
  926. });
  927. }
  928. },
  929. error => {
  930. this.$message({
  931. message: error,
  932. type: "error"
  933. });
  934. });
  935. },
  936. bangd() {
  937. this.addForm = {
  938. timeType: '0',
  939. startDate: this.getCurrentTime(),
  940. endDate: this.getCurrentTime(),
  941. timeDays: 1,
  942. leaveType: 0,
  943. timeHours: '8',
  944. tel: '',
  945. remark: ''
  946. }
  947. this.getUsers()
  948. }
  949. }
  950. };
  951. </script>
  952. <style scoped>
  953. .apls {
  954. width: 200px;
  955. white-space:nowrap;
  956. overflow:hidden;
  957. text-overflow:ellipsis;
  958. }
  959. .tups {
  960. width: 100%;
  961. height: 25px;
  962. position: relative;
  963. z-index: 99;
  964. overflow: hidden;
  965. }
  966. .tups img {
  967. height: 25px !important;
  968. position: relative;
  969. z-index: 99;
  970. }
  971. .viewer-canvas {
  972. position: absolute;
  973. z-index: 9 !important;
  974. }
  975. .icl {
  976. margin-top: -25px !important;
  977. }
  978. /* 费用报销标题 */
  979. .headine {
  980. width: 100%;
  981. height: 46.4px;
  982. line-height: 46.4px;
  983. background: #fff;
  984. box-sizing: border-box;
  985. }
  986. .headine h3 {
  987. margin: 0;
  988. display: inline-block;
  989. box-sizing: border-box;
  990. color: #999;
  991. }
  992. .headine p {
  993. display: inline-block;
  994. margin: 0;
  995. }
  996. /* /费用报销标题 */
  997. .sidebars {
  998. height: 100%;
  999. position: absolute;
  1000. border-right: 1px solid #E6E6E6;
  1001. z-index: 2;
  1002. top: 0;
  1003. }
  1004. .sidebars h3 {
  1005. margin: 0;
  1006. line-height: 45px;
  1007. background: #ffffff;
  1008. font-weight: normal;
  1009. color: #666;
  1010. padding-left: 20px;
  1011. }
  1012. .sidebars .el-col-12 {
  1013. width: 100%
  1014. }
  1015. .public {
  1016. height: 230px;
  1017. border-bottom: 1px solid #ddd;
  1018. }
  1019. .public .el-form-item {
  1020. display: inline-block;
  1021. }
  1022. .pu_button {
  1023. text-align: right;
  1024. width: 100%;
  1025. padding: 24px 30px;
  1026. box-sizing: border-box;
  1027. }
  1028. .pu_bu_x .pu_bu_t {
  1029. display: inline-block;
  1030. }
  1031. .pu_bu_x {
  1032. margin-right: 20px;
  1033. color: #20A0F7;
  1034. cursor: pointer;
  1035. }
  1036. .pu_bu_t {
  1037. color: #20A0F7;
  1038. cursor: pointer;
  1039. display: block;
  1040. float: right;
  1041. position:
  1042. relative;
  1043. top: -20px;
  1044. right: 63px;
  1045. }
  1046. .pu_table {
  1047. margin-left: 10px;
  1048. }
  1049. .pu_bu_t:hover {
  1050. color: #7bbcff;
  1051. }
  1052. .pu_bu_x:hover {
  1053. color: #7bbcff;
  1054. }
  1055. /* 我的单据报销凭证 */
  1056. .staff{
  1057. border-left: 1px solid #fff;
  1058. border-top: 1px solid #fff;
  1059. border-right: 1px solid #fff;
  1060. background: #fff;
  1061. }
  1062. /* */
  1063. .sdat{
  1064. display: inline-block;
  1065. width: 260px;
  1066. margin-left: 13px;
  1067. }
  1068. .messages .el-form-item{
  1069. display: inline-block;
  1070. }
  1071. .messages .el-date-editor.el-input, .el-date-editor.el-input__inner{
  1072. width: 190px;
  1073. }
  1074. /* 我的报销单据 */
  1075. .search {
  1076. position: relative;
  1077. top: 20px;
  1078. left: 20px;
  1079. }
  1080. .tables {
  1081. margin-top: 50px;
  1082. box-sizing: border-box;
  1083. padding: 10px;
  1084. }
  1085. .informant .el-form-item {
  1086. display: inline-block;
  1087. }
  1088. /* 侧边栏收索 */
  1089. .side {
  1090. position: absolute;
  1091. z-index: 2;
  1092. border-right: 2px solid #DDDDDD;
  1093. height: 100%;
  1094. top: 0;
  1095. width: 0;
  1096. }
  1097. .side .spans {
  1098. width: 20px;
  1099. height: 30px;
  1100. border: 1px solid #DDDDDD;
  1101. box-sizing: border-box;
  1102. position: absolute;
  1103. top: 50%;
  1104. margin-top: -50%;
  1105. text-align: center;
  1106. z-index: 1;
  1107. background: #fff;
  1108. }
  1109. .side .spans i{
  1110. margin-top: 7px;
  1111. color: #C0BFBF
  1112. }
  1113. .side:hover {
  1114. border-right: 2px solid #20A0FF;
  1115. }
  1116. .side:hover .spans {
  1117. border: 1px solid #20A0FF;
  1118. background: #20A0FF;
  1119. }
  1120. .side:hover .spans i{
  1121. color: #fff;
  1122. }
  1123. /* 右边整体页面 */
  1124. .contents {
  1125. height: 100%;
  1126. /* padding: 30px; */
  1127. background: #F7F7F7;
  1128. /* position: absolute; */
  1129. }
  1130. .submits {
  1131. margin-left: 50%;
  1132. }
  1133. .waiting {
  1134. color:orange;
  1135. }
  1136. .rejected {
  1137. color:red;
  1138. }
  1139. /* 请假模块 */
  1140. .tops {
  1141. width: 100%;
  1142. height:100%;
  1143. position: absolute;
  1144. background: #f7f7f7;
  1145. box-sizing: border-box;
  1146. padding: 20px 0 0 220px;
  1147. }
  1148. .ctons {
  1149. width: 86%;
  1150. height: 92%;
  1151. background: #fff;
  1152. padding: 30px 40px;
  1153. box-sizing: border-box;
  1154. }
  1155. .ctons .el-form-item {
  1156. display: inline-block;
  1157. }
  1158. .line {
  1159. text-align: center;
  1160. margin: 0 6px
  1161. }
  1162. .poss {
  1163. position: fixed;
  1164. bottom: 20px;
  1165. right: 1%;
  1166. box-sizing: border-box;
  1167. }
  1168. .flex {
  1169. display: flex;
  1170. margin: 0 0 20px 0;
  1171. }
  1172. .flex span {
  1173. display: inline-block;
  1174. margin: 0 10px 0 20px;
  1175. }
  1176. </style>