list.vue 66 KB

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