list.vue 62 KB

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