list.vue 62 KB

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