ViewClockInList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  6. <a-row :gutter="24">
  7. <a-col :md="6" :sm="8">
  8. <a-form-item label="工号">
  9. <a-input placeholder="请输入工号" v-model="queryParam.workNo"></a-input>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6" :sm="8">
  13. <a-form-item label="人员">
  14. <a-input placeholder="请输入人员" v-model="queryParam.realname"></a-input>
  15. </a-form-item>
  16. </a-col>
  17. <a-col :md="6" :sm="8">
  18. <a-form-item label="部门">
  19. <a-input placeholder="请输入部门" v-model="queryParam.departNames"></a-input>
  20. </a-form-item>
  21. </a-col>
  22. <!-- <a-col :md="6" :sm="8">
  23. <a-form-item label="班次">
  24. <a-input placeholder="请输入班次" v-model="queryParam.name"></a-input>
  25. </a-form-item>
  26. </a-col> -->
  27. <a-col :md="5" :sm="8">
  28. <a-form-item label="班次" style="width: 300px">
  29. <!-- <j-search-select-tag
  30. placeholder="请做出你的选择"
  31. v-model="asyncSelectValue"
  32. dict="geke_shift,name,name"
  33. :async="true">
  34. </j-search-select-tag> -->
  35. <a-select v-model="queryParam.name" placeholder="请选择班次">
  36. <a-select-option value="">请选择</a-select-option>
  37. <a-select-option value="休息">休息</a-select-option>
  38. <a-select-option value="固定上下班">固定上下班</a-select-option>
  39. <a-select-option value="自由上下班">自由上下班</a-select-option>
  40. <a-select-option v-for="(item,index) in shiftlist" :value="item.name">{{item.name}} ({{item.startDate}}-{{item.endDate}})
  41. </a-select-option>
  42. </a-select>
  43. </a-form-item>
  44. </a-col>
  45. <a-col :md="6" :sm="10">
  46. <a-form-item label="日期">
  47. <a-range-picker
  48. style="width: 210px"
  49. format="YYYY-MM-DD"
  50. :placeholder="['开始时间', '结束时间']"
  51. @change="onDateChange"
  52. @ok="onDateOk"
  53. />
  54. </a-form-item>
  55. </a-col>
  56. <a-col :md="6" :sm="8">
  57. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  58. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  59. <!-- <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> -->
  60. </span>
  61. </a-col>
  62. </a-row>
  63. <a-row :gutter="24">
  64. <a-col :md="6" :sm="8">
  65. <a-form-item label="生成月报日期">
  66. <a-month-picker format="YYYY-MM" placeholder="请输入生成月报日期" v-model="queryParam.nowDate" />
  67. <!-- <a-input placeholder="请输入生成月报日期" v-model="queryParam.nowDate"></a-input> -->
  68. </a-form-item>
  69. </a-col>
  70. <a-col :md="6" :sm="8">
  71. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  72. <a-button type="primary" @click="monthReport" icon="reload" style="margin-left: 8px">生成当月考勤月报</a-button>
  73. </span>
  74. </a-col>
  75. </a-row>
  76. </a-form>
  77. </div>
  78. <!-- table区域-begin -->
  79. <div>
  80. <a-table class="j-table-force-nowrap" ref="table" size="middle" bordered rowKey="pkId" :columns="columns"
  81. :dataSource="dataSource" :pagination="ipagination" :loading="loading" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  82. @change="handleTableChange" :scroll="{ x: 3000 }">
  83. <span slot="latetimeState" slot-scope="text, record, index">
  84. <!-- <a-tag color="pink" v-if="record.latetimeX > 0 || record.latetimeS > 0 ">异常</a-tag>
  85. <a-tag color="#87d068" v-if="record.latetimeX <= 0 && record.latetimeS <= 0 ">正常</a-tag> -->
  86. <a-tag color="pink" v-if="record.latetimeS < 0 || record.latetimeX > 0
  87. || record.shiftRealTimeS == '' || record.shiftRealTimeS == null || (record.ifwork !=0 && record.attendanceCount < 2)
  88. || (record.name != null && record.name != '' && (record.gotoTime == null || record.gotoTime == ''))
  89. && (record.setInfo == '' || record.setInfo == null)">
  90. 异常
  91. </a-tag>
  92. <a-tag color="#87d068" v-else>正常</a-tag>
  93. </span>
  94. <span slot="realShiftTime" slot-scope="text, record, index">
  95. <!-- ruleType 上班类型 1.固定时间上下班,2.按班次上下班,3.自由上下班 -->
  96. <span v-if="record.ruleType == '2' ">
  97. {{record.name}} {{record.shiftRealTimeS}}-{{record.shiftRealTimeX}}
  98. </span>
  99. <span v-else>{{record.name}}</span>
  100. </span>
  101. <span slot="action" slot-scope="text, record">
  102. <a @click="jiaozhun(record)">校准</a>
  103. </span>
  104. </a-table>
  105. </div>
  106. <!-- table区域-end -->
  107. <!-- 表单区域 -->
  108. <!-- <ViewClockIn-modal ref="modalForm" @ok="modalFormOk"></ViewClockIn-modal> -->
  109. </a-card>
  110. </template>
  111. <script>
  112. import {
  113. httpAction,
  114. getFileAccessHttpUrl,
  115. getAction,
  116. deleteAction
  117. } from '@/api/manage'
  118. import {
  119. JeecgListMixin
  120. } from '@/mixins/JeecgListMixin'
  121. import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
  122. import JDictSelectTag from '@/components/dict/JDictSelectTag'
  123. import {
  124. monthReport,jiaozhun
  125. } from '@/api/api'
  126. import moment from 'moment';
  127. import 'moment/locale/zh-cn';
  128. export default {
  129. name: 'ViewClockInList',
  130. mixins: [JeecgListMixin],
  131. components: {
  132. JDictSelectTag
  133. },
  134. data() {
  135. return {
  136. moment,
  137. shiftlist: null,
  138. description: '考勤日报',
  139. // 表头
  140. columns: [
  141. /* {
  142. title: '行号',
  143. dataIndex: '',
  144. key: 'rowIndex',
  145. width: 60,
  146. align: 'center',
  147. customRender: function(t, r, index) {
  148. return parseInt(index) + 1
  149. }
  150. }, */
  151. {
  152. title: '日期',
  153. align: 'center',
  154. dataIndex: 'viewDate', fixed: 'left', width: 100
  155. },
  156. {
  157. title: '人员',
  158. align: 'center',
  159. dataIndex: 'realname', fixed: 'left', width: 100
  160. },{
  161. title: '部门',
  162. align: 'center',
  163. dataIndex: 'departNames', fixed: 'left', width: 200
  164. },
  165. // {
  166. // title: '工号',
  167. // align: 'center',
  168. // dataIndex: 'workNo'
  169. // },
  170. {
  171. title: '班次',
  172. align: 'center',
  173. fixed: 'left', width: 160,
  174. scopedSlots: {
  175. customRender: 'realShiftTime'
  176. }
  177. },
  178. // {
  179. // title: '上班时间',
  180. // align: 'center',
  181. // dataIndex: 'shiftTimeS'
  182. // },
  183. {
  184. title: '最早打卡时间',
  185. align: 'center',
  186. dataIndex: 'gotoTime'
  187. },
  188. // {
  189. // title: '下班时间',
  190. // align: 'center',
  191. // dataIndex: 'shiftTimeX'
  192. // },
  193. {
  194. title: '最晚打卡时间',
  195. align: 'center',
  196. dataIndex: 'closingTime'
  197. }, {
  198. title: '打卡次数',
  199. align: 'center',
  200. dataIndex: 'attendanceCount', width: 100
  201. }, {
  202. title: '考勤状态',
  203. align: 'center', width: 100,
  204. scopedSlots: {
  205. customRender: 'latetimeState'
  206. }
  207. },
  208. /* {
  209. title: '迟到分钟',
  210. align: 'center',
  211. dataIndex: 'latetimeS',
  212. customRender: function(t, r, index) {
  213. if (t > 0) {
  214. return t;
  215. } else {
  216. return 0;
  217. }
  218. }
  219. },
  220. {
  221. title: '早退分钟',
  222. align: 'center',
  223. dataIndex: 'latetimeX',
  224. customRender: function(t, r, index) {
  225. if (t > 0) {
  226. return t;
  227. } else {
  228. return 0;
  229. }
  230. }
  231. },
  232. {
  233. title: '上班打卡',
  234. align: 'center',
  235. dataIndex: 'gotoState'
  236. },
  237. {
  238. title: '下班打卡',
  239. align: 'center',
  240. dataIndex: 'closingState'
  241. },*/
  242. {
  243. title: '加班开始时间',
  244. align: 'center',
  245. dataIndex: 'durationBeginDate'
  246. },
  247. {
  248. title: '加班结束时间',
  249. align: 'center',
  250. dataIndex: 'durationEndDate'
  251. },
  252. {
  253. title: '加班事由',
  254. align: 'center',
  255. dataIndex: 'demo'
  256. },
  257. {
  258. title: '加班时长',
  259. align: 'center',width: 100,
  260. dataIndex: 'duration'
  261. },
  262. {
  263. title: '请假开始时间',
  264. align: 'center',
  265. dataIndex: 'holidayStartDate'
  266. },
  267. {
  268. title: '请假结束时间',
  269. align: 'center',
  270. dataIndex: 'holidayEndDate'
  271. },
  272. {
  273. title: '请假类型',
  274. align: 'center',width: 100,
  275. dataIndex: 'holidayType'
  276. }
  277. // ,
  278. // {
  279. // title: '操作',
  280. // dataIndex: 'action',
  281. // align: 'center',
  282. // scopedSlots: { customRender: 'action' },
  283. // }
  284. ],
  285. url: {
  286. list: '/viewClockIn/viewClockIn/list',
  287. shift: "/shift/shift/lists"
  288. },
  289. }
  290. },
  291. computed: {
  292. importExcelUrl: function() {
  293. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
  294. }
  295. },
  296. created() {    //实例被创建时候执行
  297. this.queryShift();
  298. },
  299. methods: {
  300. onDateChange: function (value, dateString) {
  301. console.log(dateString[0],dateString[1]);
  302. this.queryParam.beginViewDate=dateString[0];
  303. this.queryParam.endViewDate=dateString[1];
  304. },
  305. onDateOk(value) {
  306. // console.log(value);
  307. },
  308. onChange(date, dateString) {
  309. // console.log(date, dateString);
  310. // this.value = "2021-01-01"
  311. },
  312. queryShift() {
  313. httpAction(this.url.shift, "", "get").then((res) => {
  314. if (res.success) {
  315. this.shiftlist = res.result;
  316. console.log(res.result);
  317. }
  318. }).finally(() => {
  319. })
  320. },
  321. jiaozhun(record) {
  322. // alert(record.viewDate);
  323. // alert(record.username);
  324. let that = this;
  325. this.$confirm({
  326. title: '校准后原打卡时间将失效',
  327. content: '上班打卡时间:'+record.shiftTimeS+'; 下班打卡时间:'+record.shiftTimeX,
  328. onOk: function () {
  329. jiaozhun({shiftTimeS:record.shiftTimeS,shiftTimeX:record.shiftTimeX,viewDate:record.viewDate,username:record.username}).then((res) => {
  330. if (res == 'true') {
  331. that.$message.success("已成功校准");
  332. that.loadData();
  333. } else {
  334. that.$message.warning(res);
  335. }
  336. });
  337. },
  338. onCancel() {},
  339. });
  340. },
  341. monthReport() {
  342. let ids = "";
  343. var conText = ";"
  344. let sqp1 = this.getQueryParams();
  345. if(sqp1['nowDate'] == 'undefined' || sqp1['nowDate'] == null || sqp1['nowDate'] == ''){
  346. this.$message.warning('请选择生成月报日期!');
  347. return false;
  348. }
  349. let nowDate = moment(sqp1['nowDate']).format('YYYY-MM');
  350. let that = this;
  351. for (var a = 0; a < this.selectedRowKeys.length; a++) {
  352. ids += this.selectedRowKeys[a] + ",";
  353. }
  354. if(ids == ""){
  355. conText = "是否生成所有员工" + nowDate + "月报?";
  356. }else{
  357. conText = "是否生成所选员工" + nowDate + "月报? 所选数量:" + this.selectedRowKeys.length;
  358. }
  359. // console.log(ids);
  360. that.$confirm({
  361. title: "确认操作",
  362. content: conText,
  363. onOk: function () {
  364. monthReport({nowDate:nowDate,userIds:ids}).then((res) => {
  365. if (res.success) {
  366. that.$message.success("已成功生成"+nowDate+"考勤月报");
  367. // that.$message.success("已成功生成"+nowDate+"考勤月报");
  368. that.loadData();
  369. } else {
  370. that.$message.warning(res.message);
  371. }
  372. });
  373. }
  374. });
  375. }
  376. }
  377. }
  378. </script>
  379. <style scoped>
  380. @import '~@assets/less/common.less'
  381. </style>