ViewClockUserInfo.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896
  1. <template>
  2. <a-card :bordered="false" style="background-color:transparent">
  3. <!-- table区域-begin -->
  4. <div class="ant-alert ant-alert-info" style="margin-bottom: 10px;margin-top: -40px;">
  5. <!--<i class="anticon anticon-info-circle ant-alert-icon"></i>
  6. 已选择 <a style="font-weight: 600">{{selectedRowKeys.length }}</a>项
  7. <a style="margin-left: 24px" @click="onClearSelected">清空</a> -->
  8. <i class="anticon anticon-info-circle ant-alert-icon"></i>
  9. 姓名: <span style="margin-right: 40px"> {{userName }}</span>
  10. <i class="anticon anticon-info-circle ant-alert-icon"></i>
  11. 部门: <span style="margin-right: 40px">{{deptName}}</span>
  12. <i class="anticon anticon-info-circle ant-alert-icon"></i>
  13. 员工类型: <span style="margin-right: 40px">{{userType}}</span>
  14. <i class="anticon anticon-info-circle ant-alert-icon"></i>
  15. 月份:
  16. <!-- <a style="font-weight: 600;margin-right: 6px" @click="onClearSelected"> < </a> -->
  17. <a-month-picker :allowClear="false" format="YYYY-MM" placeholder="请输入考勤月份" v-model="headMonth" @change="onDateChange"/>
  18. <!-- <a style="font-weight: 600;margin-left: 6px" @click="onClearSelected"> > </a> -->
  19. <i class="anticon anticon-info-circle ant-alert-icon"></i>
  20. <a style="margin-left: 20px" @click="errorInfoShow()">异常打卡</a>
  21. <i class="anticon anticon-info-circle ant-alert-icon"></i>
  22. <a style="margin-left: 20px" @click="jiaBanInfoShow()">加班打卡</a>
  23. <i class="anticon anticon-info-circle ant-alert-icon"></i>
  24. <a-dropdown style="margin-left: 20px" v-has="'viewClockUserInfo:more'">
  25. <a class="ant-dropdown-link">
  26. 更多操作 <a-icon type="down"/>
  27. </a>
  28. <!-- 123-->
  29. <a-menu slot="overlay">
  30. <a-menu-item v-has="'viewClockUserInfo:fuxin'">
  31. <!-- <a-popconfirm title="确定对所选记录付薪吗?" @confirm="() => handleInfo('1')"> -->
  32. <a @click="showModal3('top','1',null)">付薪</a>
  33. <!-- </a-popconfirm> -->
  34. </a-menu-item>
  35. <a-menu-item v-has="'viewClockUserInfo:tiaoxiu'">
  36. <!-- <a-popconfirm title="确定对所选记录累计调休吗?" @confirm="() => handleInfo('2')"> -->
  37. <a @click="showModal3('top','2',null)">累计调休</a>
  38. <!-- </a-popconfirm> -->
  39. </a-menu-item>
  40. <a-menu-item v-has="'viewClockUserInfo:hulue'">
  41. <a-popconfirm title="确定对所选记录忽略吗?" @confirm="() => handleInfo('3')">
  42. <a>忽略</a>
  43. </a-popconfirm>
  44. </a-menu-item>
  45. </a-menu>
  46. </a-dropdown>
  47. <a style="margin-left: 20px" @click="handleExportXlsBegin('员工考勤信息')">导出</a>
  48. <a style="margin-left: 20px" @click="showModal4()">导出加班</a>
  49. <i class="anticon anticon-info-circle ant-alert-icon"></i>
  50. </div>
  51. <a-table
  52. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  53. ref="table"
  54. size="middle"
  55. bordered
  56. rowKey="viewDate"
  57. :columns="columns"
  58. :dataSource="dataSource"
  59. :pagination="ipagination"
  60. :loading="loading"
  61. @change="handleTableChange">
  62. <span slot="ShiftTime" slot-scope="text, record, index">
  63. {{record.shiftRealTimeS}} - {{record.shiftRealTimeX}}
  64. <span v-if="record.shiftRealTime2S != null "><br/>{{record.shiftRealTime2S}} - {{record.shiftRealTime2X}}</span>
  65. </span>
  66. <span slot="customTime" slot-scope="text, record, index">
  67. <span v-if="text != null ">{{text.slice(10)}}</span>
  68. </span>
  69. <span slot="customDuration" slot-scope="text, record, index">
  70. <!-- <a-tag @click="workInfo(record)" color="pink" v-if="record.workOvertime != null && record.workOvertime > 0 ">
  71. {{text}}
  72. </a-tag>
  73. <a @click="workInfo(record)" v-else>{{text}}</a> -->
  74. <span v-if="record.setInfo > 0 ">
  75. <a-tag :title="record.multipleInfo" @click="workInfo(record)" color="pink" >{{text}}</a-tag>
  76. </span>
  77. <span v-if="record.setInfo == 0 ">
  78. <a-tag :title="record.multipleInfo" @click="workInfo(record)" color="#87d068" >{{text}}</a-tag>
  79. </span>
  80. </span>
  81. <a-badge slot="shiftType" slot-scope="text, record, index">
  82. <!-- ruleType 上班类型 1.固定时间上下班,2.按班次上下班,3.自由上下班 -->
  83. <a-tag color="pink" v-if="record.showState == '1'">
  84. 异常
  85. </a-tag>
  86. <a-tag color="#87d068" v-if="record.showState == '2'">
  87. 正常
  88. </a-tag>
  89. <a-icon v-if="record.showState == '2'" title="该员工在未排班或休息班打卡" slot="count" type="exclamation-circle" style="color: #f52b02" />
  90. <a-tag color="#87d068" v-if="record.showState == '0'">
  91. 正常
  92. </a-tag>
  93. </a-badge>
  94. <span slot="action" slot-scope="text, record">
  95. <!-- <a v-has="'viewClockUserInfo:jiaozhun'" @click="handleEdit(record)">校准</a> -->
  96. <a v-has="'viewClockUserInfo:jiaozhun'" @click="showModal(record)">校准</a>
  97. <!-- <a-popconfirm v-has="'viewClockUserInfo:jiaozhun'" title="确定忽略此异常吗?" @confirm="() => errorInfo(record)">
  98. <a>校准</a>
  99. </a-popconfirm>-->
  100. <a-divider type="vertical"/>
  101. <a-dropdown v-has="'viewClockUserInfo:more'">
  102. <a class="ant-dropdown-link">
  103. 更多 <a-icon type="down"/>
  104. </a>
  105. <a-menu slot="overlay">
  106. <a-menu-item v-has="'viewClockUserInfo:fuxin'">
  107. <!-- <a-popconfirm title="确定付薪吗?" @confirm="() => fuXinInfo('2','1',record)"> -->
  108. <a @click="showModal3('right','1',record)">付薪</a>
  109. <!-- </a-popconfirm> -->
  110. </a-menu-item>
  111. <a-menu-item v-has="'viewClockUserInfo:tiaoxiu'">
  112. <!-- <a-popconfirm title="确定累计调休吗?" @confirm="() => fuXinInfo('2','2',record)"> -->
  113. <a @click="showModal3('right','2',record)">累计调休</a>
  114. <!-- </a-popconfirm> -->
  115. </a-menu-item>
  116. <a-menu-item v-has="'viewClockUserInfo:hulue'">
  117. <a-popconfirm title="确定忽略吗?" @confirm="() => fuXinInfo('2','3',record)">
  118. <a>忽略</a>
  119. </a-popconfirm>
  120. </a-menu-item>
  121. </a-menu>
  122. </a-dropdown>
  123. </span>
  124. </a-table>
  125. <!-- table区域-end -->
  126. <a-spin size="large" v-if="spinning == true" style="z-index:999;position:absolute;top:180px;left:50%;" tip="Loading..."></a-spin>
  127. <!-- 表单区域 -->
  128. <Jiao-Zhun-Modal ref="modalForm" @ok="modalFormOk"></Jiao-Zhun-Modal>
  129. <Select-User-Modal ref="selectUserModal" @selectFinished="selectOK"></Select-User-Modal>
  130. <dept-role-user-modal ref="deptRoleUser"></dept-role-user-modal>
  131. <a-modal width="1200px"
  132. v-model="modal2Visible" title="加班信息详情" :footer="null"
  133. centered @ok="() => (modal2Visible = false)" >
  134. <a-table :columns="columns2" :data-source="data" rowKey="id">
  135. <span slot="action" slot-scope="text, record">
  136. <a-dropdown v-has="'viewClockUserInfo:more'">
  137. <a class="ant-dropdown-link">
  138. 更多 <a-icon type="down"/>
  139. </a>
  140. <a-menu slot="overlay">
  141. <a-menu-item v-has="'viewClockUserInfo:fuxin'">
  142. <!-- <a-popconfirm title="确定付薪吗?" @confirm="() => fuXinInfo('1','1',record)"> -->
  143. <a @click="showModal3('in','1',record)">付薪</a>
  144. <!-- </a-popconfirm> -->
  145. </a-menu-item>
  146. <a-menu-item v-has="'viewClockUserInfo:tiaoxiu'">
  147. <!-- <a-popconfirm title="确定累计调休吗?" @confirm="() => fuXinInfo('1','2',record)"> -->
  148. <a @click="showModal3('in','2',record)">累计调休</a>
  149. <!-- </a-popconfirm> -->
  150. </a-menu-item>
  151. <a-menu-item v-has="'viewClockUserInfo:hulue'">
  152. <a-popconfirm title="确定忽略吗?" @confirm="() => fuXinInfo('1','3',record)">
  153. <a>忽略</a>
  154. </a-popconfirm>
  155. </a-menu-item>
  156. </a-menu>
  157. </a-dropdown>
  158. </span>
  159. </a-table>
  160. </a-modal>
  161. <a-modal
  162. title="校准忽略本次异常"
  163. :visible="visible"
  164. :confirm-loading="confirmLoading"
  165. @ok="handleOk"
  166. @cancel="handleCancel"
  167. >
  168. <a-input placeholder="请填写忽略原因" v-model="errorText"></a-input>
  169. </a-modal>
  170. <a-modal style="z-index:auto"
  171. title="请选择倍数"
  172. :visible="visibleShowModal3"
  173. :confirm-loading="confirmLoading"
  174. @ok="handleOk3"
  175. @cancel="handleCancel3"
  176. >
  177. <j-dict-select-tag style="width:100%;" v-model="multiple" placeholder="请选择倍数"
  178. dictCode="multiple" />
  179. </a-modal>
  180. <a-modal style="z-index:999"
  181. title="请选择导出条件"
  182. :visible="visibleShowModal4"
  183. :confirm-loading="confirmLoading"
  184. @ok="handleOk4"
  185. @cancel="handleCancel4"
  186. >
  187. 姓名:
  188. <a-input placeholder="请输入姓名" v-model="par_name" style="width:100%;margin-bottom: 10px;" />
  189. 工号:
  190. <a-input placeholder="请输入工号" v-model="par_code" style="width:100%;margin-bottom: 10px;" />
  191. 部门:
  192. <j-tree-select style="width:100%;margin-bottom: 10px;" v-model="par_departIds" dict="sys_depart,depart_name,id"
  193. pid-field="parent_id" placeholder="请选择部门">
  194. </j-tree-select>
  195. 加班事由:
  196. <j-dict-select-tag style="width:100%;margin-bottom: 10px;" v-model="par_works_type" placeholder="请选择加班类型"
  197. dictCode="works_type" />
  198. 时间:
  199. <a-range-picker
  200. style="width:100%;margin-bottom: 10px;"
  201. format="YYYY-MM-DD"
  202. :placeholder="['开始时间', '结束时间']"
  203. @change="onDateChange2"
  204. @ok="onDateOk2"
  205. />
  206. 支付类型:
  207. <j-dict-select-tag style="width:100%;margin-bottom: 10px;" v-model="par_pay_type" placeholder="请选择支付类型"
  208. dictCode="pay_type" />
  209. 支付倍数:
  210. <j-dict-select-tag style="width:100%;margin-bottom: 10px;" v-model="par_multiple" placeholder="请选择倍数"
  211. dictCode="multiple" />
  212. </a-modal>
  213. </a-card>
  214. </template>
  215. <script>
  216. import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  217. import {getAction, postAction, deleteAction,putAction} from '@/api/manage'
  218. import SelectUserModal from '../modules/SelectUserModal'
  219. import JiaoZhunModal from './JiaoZhunModal'
  220. import DeptRoleUserModal from '../modules/DeptRoleUserModal'
  221. import moment from 'moment';
  222. import 'moment/locale/zh-cn';
  223. import {
  224. fuXinInfo
  225. } from '@/api/api'
  226. export default {
  227. name: "DeptUserInfo",
  228. mixins: [JeecgListMixin],
  229. components: {
  230. DeptRoleUserModal,
  231. SelectUserModal,
  232. JiaoZhunModal
  233. },
  234. data() {
  235. return {
  236. spinning:false,
  237. par_name:'',//导出加班 姓名
  238. par_code:'',//导出加班 工号
  239. par_departIds:'',//导出加班 部门
  240. par_works_type:'',//导出加班 加班事由
  241. par_pay_type:'',//导出加班 支付类型
  242. par_multiple:'',//导出加班 支付倍数
  243. par_begin:'',//导出加班 开始时间
  244. par_end:'',//导出加班 结束时间
  245. errorViewDate:'',
  246. errorSt:'',
  247. errorUserId:'',
  248. errorText: '',//校准弹框属性
  249. visible: false,//校准弹框属性
  250. confirmLoading: false,//校准弹框属性
  251. durationCommitDate:'',//加班申请时间
  252. durationBeginDate:'',//加班开始时间
  253. durationEndDate:'',//加班结束时间
  254. duration:'',//加班时长
  255. demo:'',//加班事由
  256. modal2Visible: false,//加班信息详情
  257. visibleShowModal3:false,//薪资倍数选择框
  258. visibleShowModal4:false,//加班导出弹框
  259. multiple:2,//薪资倍数选择框倍数
  260. area:'',//点击倍数弹框的区域 top/right/in
  261. recordPar:'',//弹框参数
  262. stPar:null,//1付薪,2调休
  263. moment,
  264. description: '员工考勤信息',
  265. userName:'',//标题员工姓名
  266. deptName:'',//标题员工部门
  267. userType:'',//标题员工类型
  268. headMonth:'',//标题选择月份
  269. newMonth:'',//更改时选择的月份
  270. currentDeptId: '',
  271. data : [],//加班信息弹框
  272. ipagination:{
  273. pageSize: 31,
  274. },
  275. columns2:[{
  276. title: '加班申请时间',
  277. align: "center",
  278. dataIndex: 'commitDate'
  279. },{
  280. title: '加班开始时间',
  281. align: "center",
  282. dataIndex: 'beginDate'
  283. },{
  284. title: '加班结束时间',
  285. align: "center",
  286. dataIndex: 'endDate'
  287. },{
  288. title: '加班时长',
  289. align: "center",
  290. dataIndex: 'duration'
  291. },{
  292. title: '加班事由',
  293. align: "center",
  294. dataIndex: 'demo'
  295. },{
  296. title: '处理方式',
  297. align: "center",
  298. dataIndex: 'setInfo'
  299. },{
  300. title: '倍数',
  301. align: "center",
  302. dataIndex: 'multiple'
  303. },
  304. {
  305. title: '操作',
  306. dataIndex: 'action',
  307. scopedSlots: {customRender: 'action'},
  308. align: "center",
  309. width: 120
  310. }],
  311. // 表头
  312. columns: [{
  313. title: '日期',
  314. align: "center",
  315. dataIndex: 'viewDate', fixed: 'left', width: 100
  316. },
  317. {
  318. title: '星期',
  319. align: "center",
  320. dataIndex: 'weekDate'
  321. },
  322. {
  323. title: '班次',
  324. align: "center",
  325. dataIndex: 'name'
  326. },
  327. {
  328. title: '班次时间',
  329. align: "center",
  330. scopedSlots: {
  331. customRender: 'ShiftTime'
  332. }
  333. },
  334. {
  335. title: '状态',
  336. align: "center",
  337. scopedSlots: {customRender: 'shiftType'},
  338. },
  339. {
  340. title: '最早',
  341. align: "center",
  342. dataIndex: 'gotoTime',
  343. scopedSlots: {
  344. customRender: 'customTime'
  345. }
  346. },
  347. {
  348. title: '最晚',
  349. align: "center",
  350. dataIndex: 'closingTime',
  351. scopedSlots: {
  352. customRender: 'customTime'
  353. }
  354. },
  355. // {
  356. // title: '上班1',
  357. // align: "center",
  358. // dataIndex: 'oneTime',
  359. // scopedSlots: {
  360. // customRender: 'customTime'
  361. // }
  362. // },
  363. // {
  364. // title: '下班1',
  365. // align: "center",
  366. // dataIndex: 'twoTime',
  367. // scopedSlots: {
  368. // customRender: 'customTime'
  369. // }
  370. // },{
  371. // title: '上班2',
  372. // align: "center",
  373. // dataIndex: 'threeTime',
  374. // scopedSlots: {
  375. // customRender: 'customTime'
  376. // }
  377. // },
  378. // {
  379. // title: '下班2',
  380. // align: "center",
  381. // dataIndex: 'fourTime',
  382. // scopedSlots: {
  383. // customRender: 'customTime'
  384. // }
  385. // },
  386. {
  387. title: '打卡次数',
  388. align: "center",
  389. dataIndex: 'attendanceCount'
  390. },
  391. {
  392. title: '加班时间',
  393. align: "center",
  394. dataIndex: 'duration',
  395. width: 100,
  396. scopedSlots: {
  397. customRender: 'customDuration'
  398. }
  399. },{
  400. title: '请假',
  401. align: "center",
  402. dataIndex: 'holidayType'
  403. },
  404. {
  405. title: '校准人',
  406. align: "center",
  407. dataIndex: 'jzBy'
  408. },
  409. {
  410. title: '操作',
  411. dataIndex: 'action',fixed: 'right', width: 100,
  412. scopedSlots: {customRender: 'action'},
  413. align: "center",
  414. width: 120
  415. }],
  416. url: {
  417. exportXlsUrl: '/viewClockIn/viewClockIn/exportXls',
  418. handleInfo: '/viewClockIn/viewClockIn/handleInfo',
  419. errorInfo: '/viewClockIn/viewClockIn/errorInfo',
  420. getJiaBan: '/workOvertime/workOvertime/getJiaBan',
  421. list: '/viewClockIn/viewClockIn/list',
  422. // list: "/sys/user/departUserList",
  423. edit: "/sys/user/editSysDepartWithUser",
  424. delete: "/sys/user/deleteUserInDepart",
  425. deleteBatch: "/sys/user/deleteUserInDepartBatch",
  426. }
  427. }
  428. },
  429. created() {
  430. let yy = new Date().getFullYear();
  431. let mm = new Date().getMonth()+1;
  432. // let dd = new Date().getDate();
  433. this.headMonth = yy+"-"+mm;
  434. },
  435. methods: {
  436. handleExportXlsBegin(name){
  437. if(this.userName == '' || this.userName == null){
  438. this.$message.warning("请选择要导出的人员姓名");
  439. return;
  440. }
  441. if(this.headMonth == '' && this.newMonth == null){
  442. this.$message.warning("请选择要导出的月份");
  443. return;
  444. }
  445. this.queryParam.userType=this.userType;
  446. this.queryParam.excelType = "0";
  447. this.handleExportXls(name);
  448. },
  449. handleInfo(st){
  450. if(this.selectedRowKeys.length < 1){
  451. this.$message.warning("您没有选择任何数据");
  452. return;
  453. }
  454. let that = this;
  455. //st:1付薪 2累计调休 3忽略
  456. let ids = "";
  457. let username = "";
  458. let dataSource = this.dataSource;
  459. // console.log("-===="+this.dataSource);
  460. let userIds = "";
  461. this.selectUserRows = [];
  462. for (let i = 0, len = dataSource.length; i < len; i++) {
  463. if (this.selectedRowKeys.includes(dataSource[i].viewDate)) {
  464. if(dataSource[i].duration == null || dataSource[i].duration == ''){
  465. this.$message.warning(dataSource[i].viewDate+"该员工当日没有加班申请信息,请勿此操作");
  466. return;
  467. }
  468. username = dataSource[i].username;
  469. ids += dataSource[i].viewDate + ",";
  470. }
  471. }
  472. putAction(this.url.handleInfo, {multiple:this.multiple,viewDate:ids,st:st,username:username}).then((res) => {
  473. if (res.success) {
  474. that.$message.success("操作成功");
  475. that.loadData();
  476. } else {
  477. that.$message.warning(res.message);
  478. that.loadData();
  479. }
  480. }).finally(() => {
  481. that.multiple = 2;
  482. that.selectedRowKeys = [];
  483. })
  484. },
  485. onDateChange2: function (value, dateString) {
  486. // console.log(dateString[0],dateString[1]);
  487. this.par_begin=dateString[0];
  488. this.par_end=dateString[1];
  489. },
  490. onDateOk2(value) {
  491. // console.log(value);
  492. },
  493. errorInfoShow(){
  494. this.queryParam.showState=1;
  495. this.loadData(1);
  496. // this.queryParam.showState=null;
  497. },
  498. jiaBanInfoShow(){
  499. this.queryParam.duration=1;
  500. this.loadData(1);
  501. // this.queryParam.duration=null;
  502. },
  503. showModal(record) {
  504. this.errorViewDate = record.viewDate;
  505. this.errorUserId = record.userId;
  506. this.errorSt = record.errorState;
  507. this.errorText = record.errorText;
  508. this.visible = true;
  509. },
  510. showModal3(area,st,record) {//薪资倍数选择框
  511. if(area == 'top' && this.selectedRowKeys.length < 1){
  512. this.$message.warning("请选择一条含有加班信息的数据");
  513. return;
  514. }
  515. this.stPar = st;
  516. this.area = area;
  517. this.recordPar = record;
  518. this.visibleShowModal3 = true;
  519. },
  520. showModal4() {//加班导出选择框
  521. this.visibleShowModal4 = true;
  522. },
  523. handleOk(e) {
  524. if(this.errorSt == 0){
  525. this.$message.warning("已校准过,无需再次校准");
  526. return;
  527. }
  528. if(this.errorText == null || this.errorText == ''){
  529. this.$message.warning("请填写忽略原因");
  530. return;
  531. }
  532. let that = this;
  533. this.confirmLoading = true;
  534. putAction(this.url.errorInfo, {viewDate:this.errorViewDate,userId:this.errorUserId,errorText:this.errorText}).then((res) => {
  535. if (res.success) {
  536. that.$message.success("操作成功");
  537. that.loadData();
  538. } else {
  539. that.$message.warning(res.message);
  540. that.loadData();
  541. }
  542. }).finally(() => {
  543. this.confirmLoading = false;
  544. this.visible = false;
  545. })
  546. },
  547. handleOk3(e) {
  548. if(this.multiple == '' || this.multiple == null){
  549. this.$message.warning("请选择倍数");
  550. return;
  551. }
  552. this.modal2Visible = false;
  553. this.visibleShowModal3 = false;
  554. if(this.area == 'top'){
  555. this.handleInfo(this.stPar);
  556. }
  557. if(this.area == 'right'){
  558. this.fuXinInfo('2',this.stPar,this.recordPar);
  559. }
  560. if(this.area == 'in'){
  561. this.fuXinInfo('1',this.stPar,this.recordPar);
  562. }
  563. },
  564. handleOk4(e) {
  565. this.queryParam.par_name = this.par_name;//导出加班 姓名
  566. this.queryParam.par_code = this.par_code;//导出加班 工号
  567. this.queryParam.par_departIds = this.par_departIds;//导出加班 部门
  568. this.queryParam.par_works_type = this.par_works_type;//导出加班 加班事由
  569. this.queryParam.par_pay_type = this.par_pay_type;//导出加班 支付类型
  570. this.queryParam.par_multiple = this.par_multiple;//导出加班 支付倍数
  571. this.queryParam.par_begin = this.par_begin;//导出加班 开始时间
  572. this.queryParam.par_end = this.par_end;//导出加班 结束时间
  573. this.queryParam.excelType = "1";
  574. this.handleExportXls('员工加班信息');
  575. this.visibleShowModal4 = false;
  576. },
  577. handleCancel3(e) {
  578. this.multiple = 2;
  579. this.visibleShowModal3 = false;
  580. },
  581. handleCancel4(e) {
  582. this.visibleShowModal4 = false;
  583. },
  584. handleCancel(e) {
  585. console.log('Clicked cancel button');
  586. this.visible = false;
  587. },
  588. onDateChange: function (value, dateString) {
  589. this.newMonth = dateString;
  590. this.$emit('clearSelectedDepartKeys');
  591. // this.userName = e.node.dataRef.title;
  592. this.queryParam.mDate=dateString;
  593. this.loadData(1);
  594. // console.log(value+"------------"+dateString);
  595. },
  596. searchReset() {
  597. this.queryParam = {}
  598. this.loadData(1);
  599. },
  600. loadData(arg) {
  601. if (!this.url.list) {
  602. this.$message.error("请设置url.list属性!")
  603. return
  604. }
  605. if (!this.userName) {
  606. return
  607. }
  608. this.spinning = true;
  609. //加载数据 若传入参数1则加载第一页的内容
  610. if (arg === 1) {
  611. this.ipagination.current = 1;
  612. }
  613. //if (this.currentDeptId === '') return;
  614. let params = this.getQueryParams();//查询条件
  615. let that = this;
  616. params.depId = this.currentDeptId;
  617. // params = {'endViewDate':'userName'}
  618. // console.log("============="+params.userName);
  619. getAction(this.url.list, params).then((res) => {
  620. if (res.success && res.result) {
  621. this.dataSource = res.result.records;
  622. this.ipagination.total = res.result.total;
  623. }
  624. that.spinning = false;
  625. })
  626. },
  627. batchDel: function () {
  628. if (!this.url.deleteBatch) {
  629. this.$message.error("请设置url.deleteBatch属性!")
  630. return
  631. }
  632. if (!this.currentDeptId) {
  633. this.$message.error("未选中任何部门,无法取消部门与用户的关联!")
  634. return
  635. }
  636. if (this.selectedRowKeys.length <= 0) {
  637. this.$message.warning('请选择一条记录!');
  638. return;
  639. } else {
  640. var ids = "";
  641. for (var a = 0; a < this.selectedRowKeys.length; a++) {
  642. ids += this.selectedRowKeys[a] + ",";
  643. }
  644. var that = this;
  645. console.log(this.currentDeptId);
  646. this.$confirm({
  647. title: "确认取消",
  648. content: "是否取消用户与选中部门的关联?",
  649. onOk: function () {
  650. deleteAction(that.url.deleteBatch, {depId: that.currentDeptId, userIds: ids}).then((res) => {
  651. if (res.success) {
  652. that.$message.success("删除用户与选中部门关系成功!");
  653. that.loadData();
  654. that.onClearSelected();
  655. } else {
  656. that.$message.warning(res.message);
  657. }
  658. });
  659. }
  660. });
  661. }
  662. },
  663. handleDelete: function (id) {
  664. if (!this.url.delete) {
  665. this.$message.error("请设置url.delete属性!")
  666. return
  667. }
  668. if (!this.currentDeptId) {
  669. this.$message.error("未选中任何部门,无法取消部门与用户的关联!")
  670. return
  671. }
  672. var that = this;
  673. deleteAction(that.url.delete, {depId: this.currentDeptId, userId: id}).then((res) => {
  674. if (res.success) {
  675. that.$message.success("删除用户与选中部门关系成功!");
  676. if (this.selectedRowKeys.length>0){
  677. for(let i =0; i<this.selectedRowKeys.length;i++){
  678. if (this.selectedRowKeys[i] == id){
  679. this.selectedRowKeys.splice(i,1);
  680. break;
  681. }
  682. }
  683. }
  684. that.loadData();
  685. } else {
  686. that.$message.warning(res.message);
  687. }
  688. });
  689. },
  690. open(selectedKeys, e) {
  691. if(e.node.dataRef.orgType == 1 || e.node.dataRef.orgType == 2 || e.node.dataRef.orgType == 3){
  692. // this.$message.warn("点击左侧加减号,展开或者收起菜单!")
  693. return;
  694. }
  695. this.queryParam = {}
  696. let arr = e.node.dataRef.title.split('(');//姓名
  697. let arr2 = e.node.$parent.title.split('(');//上级部门
  698. this.userName = arr[0];//e.node.dataRef.title;
  699. this.deptName = arr2[0];//e.node.$parent.title;
  700. this.userType = e.node.dataRef.orgType;//员工类型
  701. this.queryParam.userName= arr[0];//e.node.dataRef.title;
  702. this.queryParam.mDate=moment(this.headMonth).format('YYYY-MM');
  703. this.loadData(1);
  704. },
  705. clearList() {
  706. this.currentDeptId = '';
  707. this.dataSource = [];
  708. },
  709. hasSelectDept() {
  710. if (this.currentDeptId == '') {
  711. this.$message.error("请选择一个部门!")
  712. return false;
  713. }
  714. return true;
  715. },
  716. handleAddUserDepart() {
  717. if (this.currentDeptId == '' ) {
  718. this.$message.error("请选择一个部门!")
  719. } else {
  720. this.$refs.selectUserModal.visible = true;
  721. }
  722. },
  723. handleEdit: function (record) {
  724. this.$refs.modalForm.title = "校准";
  725. this.$refs.modalForm.departDisabled = true;
  726. this.$refs.modalForm.disableSubmit = false;
  727. this.$refs.modalForm.startDate = record.gotoTime;
  728. this.$refs.modalForm.endDate = record.closingTime;
  729. if(record.gotoTime == null || record.gotoTime == ''){
  730. this.$refs.modalForm.startDate = record.viewDate;
  731. }
  732. if(record.closingTime == null || record.closingTime == ''){
  733. this.$refs.modalForm.endDate = record.viewDate;
  734. }
  735. this.$refs.modalForm.startDateYs = record.gotoTime;
  736. this.$refs.modalForm.endDateYs = record.closingTime;
  737. this.$refs.modalForm.jzTime = record.jzTime;
  738. this.$refs.modalForm.jzBy = record.jzBy;
  739. this.$refs.modalForm.viewDate = record.viewDate;
  740. this.$refs.modalForm.username = record.userId;
  741. this.$refs.modalForm.setInfo = record.setInfo;
  742. this.$refs.modalForm.add(record);
  743. },
  744. handleAdd: function () {
  745. if (this.currentDeptId == '') {
  746. this.$message.error("请选择一个部门!")
  747. } else {
  748. this.$refs.modalForm.departDisabled = true;
  749. this.$refs.modalForm.userDepartModel.departIdList = [this.currentDeptId]; //传入一个部门id
  750. this.$refs.modalForm.add();
  751. this.$refs.modalForm.title = "新增";
  752. }
  753. },
  754. selectOK(data) {
  755. let params = {};
  756. params.depId = this.currentDeptId;
  757. params.userIdList = [];
  758. for (var a = 0; a < data.length; a++) {
  759. params.userIdList.push(data[a]);
  760. }
  761. postAction(this.url.edit, params).then((res) => {
  762. if (res.success) {
  763. this.$message.success(res.message);
  764. this.loadData();
  765. } else {
  766. this.$message.warning(res.message);
  767. }
  768. })
  769. },
  770. errorInfo(record){//校准
  771. if(record.errorState == 0){
  772. this.$message.warning("已校准过,无需再次校准");
  773. return;
  774. }
  775. let that = this;
  776. putAction(this.url.errorInfo, {viewDate:record.viewDate,userId:record.userId}).then((res) => {
  777. if (res.success) {
  778. that.$message.success("操作成功");
  779. that.loadData();
  780. } else {
  781. that.$message.warning(res.message);
  782. that.loadData();
  783. }
  784. }).finally(() => {
  785. })
  786. },
  787. fuXinInfo(w,st,record){//薪资操作
  788. // w 1:弹框中方法,2列表中方法
  789. // st 1付薪,2累计调休,3忽略
  790. // if(record.setInfo != '' && record.setInfo != null){
  791. // this.$message.warning("已设置过,不能再次设置");
  792. // return;
  793. // }
  794. if(record.duration == '' || record.duration == null){
  795. this.$message.warning("该员工当日没有加班申请信息");
  796. return;
  797. }
  798. let userId = null;
  799. if(record.userId == '' || record.userId == null){
  800. userId = record.person;
  801. }else{
  802. userId = record.userId;
  803. }
  804. let that = this;
  805. fuXinInfo({multiple:this.multiple,viewDate:record.viewDate,viewDate1:record.beginDate,userId:userId,pkId:record.id,st:st,w:w}).then((res) => {
  806. if (res.success) {
  807. that.multiple = 2;
  808. that.$message.success("已成功设置");
  809. that.loadData();
  810. } else {
  811. that.multiple = 2;
  812. that.$message.warning(res.message);
  813. that.loadData();
  814. }
  815. });
  816. that.modal2Visible = false;
  817. },
  818. workInfo(record){//点击加班时间事件
  819. let that = this;
  820. putAction(this.url.getJiaBan, {viewDate:record.viewDate,username:record.username}).then((res) => {
  821. that.data = res;
  822. }).finally(() => {
  823. that.modal2Visible = true;
  824. })
  825. }
  826. }
  827. }
  828. </script>
  829. <style scoped>
  830. /** Button按钮间距 */
  831. .ant-btn {
  832. margin-left: 3px
  833. }
  834. .ant-card {
  835. margin-left: -30px;
  836. margin-right: -30px;
  837. }
  838. .table-page-search-wrapper {
  839. margin-top: -16px;
  840. margin-bottom: 16px;
  841. }
  842. </style>