list.vue 59 KB

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