BdClockinMonthList.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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.personName"></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.personId"></a-input>
  15. </a-form-item>
  16. </a-col>
  17. <a-col :md="6" :sm="8">
  18. <a-form-item label="是否同步">
  19. <a-select v-model="queryParam.syU8" placeholder="请选择是否同步">
  20. <a-select-option value="">请选择</a-select-option>
  21. <a-select-option value="1">是</a-select-option>
  22. <a-select-option value="0">否</a-select-option>
  23. </a-select>
  24. </a-form-item>
  25. </a-col>
  26. <a-col :md="6" :sm="8">
  27. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  28. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  29. </span>
  30. </a-col>
  31. <a-col :md="6" :sm="8">
  32. <a-form-item label="同步日期">
  33. <a-month-picker valueFormat="YYYY-MM" @change="onChange" placeholder="请输入日期" v-model="queryParam.monthTime"></a-month-picker>
  34. </a-form-item>
  35. </a-col>
  36. <a-col :md="6" :sm="8">
  37. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  38. <a-button type="primary" @click="monthReport" icon="reload" style="margin-left: 8px">生成考勤月报</a-button>
  39. <a-button type="primary" @click="syMonthReport" icon="reload" style="margin-left: 8px">同步至U8</a-button>
  40. <a-button type="primary" icon="download" style="margin-left: 8px" @click="handleExportXls('考勤月报')">导出</a-button>
  41. </span>
  42. </a-col>
  43. <a-col :md="6" :sm="8">
  44. <a-button type="danger" @click="showModal">
  45. 关账
  46. </a-button>
  47. </a-col>
  48. </a-row>
  49. </a-form>
  50. </div>
  51. <!-- table区域-begin -->
  52. <div>
  53. <a-table class="j-table-force-nowrap" ref="table" size="middle" bordered rowKey="username" :columns="columns"
  54. :dataSource="dataSource" :pagination="ipagination" :loading="loading" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  55. @change="handleTableChange" :scroll="{ x: 1200, y: 700 }">
  56. <span slot="syU8" slot-scope="text, record, index">
  57. <a v-if="record.syU8 == 1 ">是</a>
  58. <a v-if="record.syU8 == 0 ">否</a>
  59. </span>
  60. </a-table>
  61. </div>
  62. <!-- table区域-end -->
  63. <!-- 表单区域 -->
  64. <!-- <ViewClockIn-modal ref="modalForm" @ok="modalFormOk"></ViewClockIn-modal> -->
  65. <a-modal v-model="visible" title="系统关账后无法取消,请谨慎操作" @ok="handleOk">
  66. 已关账日期:
  67. {{oldCloseDate}}
  68. <a-form-item label="关账日期">
  69. <a-month-picker valueFormat="YYYY-MM" placeholder="请输入关账日期" v-model="closeDate"></a-month-picker>
  70. </a-form-item>
  71. </a-modal>
  72. </a-card>
  73. </template>
  74. <script>
  75. import {
  76. JeecgListMixin
  77. } from '@/mixins/JeecgListMixin'
  78. import {getAction, postAction, deleteAction,putAction} from '@/api/manage'
  79. import JDictSelectTag from '@/components/dict/JDictSelectTag'
  80. import moment from 'moment';
  81. import 'moment/locale/zh-cn';
  82. import {monthReport} from '@/api/api';
  83. export default {
  84. name: 'ViewClockInList',
  85. mixins: [JeecgListMixin],
  86. components: {
  87. JDictSelectTag
  88. },
  89. data() {
  90. return {
  91. visible: false,
  92. moment,
  93. oldCloseDate:'',//原始关账日期
  94. closeDate:'',//关账日期
  95. monthTime:'',
  96. description: '考勤月报',
  97. // 表头
  98. columns: [
  99. {
  100. title: '日期',
  101. align: 'center',
  102. dataIndex: 'monthdate'
  103. },
  104. {
  105. title: '人员姓名',
  106. align: 'center',
  107. dataIndex: 'realname'
  108. },
  109. {
  110. title: '工号',
  111. align: 'center',
  112. dataIndex: 'username'
  113. },
  114. {
  115. title: '考勤天数',
  116. align: 'center',
  117. dataIndex: 'workDay'
  118. },
  119. {
  120. title: '实际考勤天数',
  121. align: 'center',
  122. dataIndex: 'workDayReal'
  123. },
  124. {
  125. title: '旷工天数',
  126. align: 'center',
  127. dataIndex: 'missingNum'
  128. },
  129. {
  130. title: '加班时长(时)',
  131. align: 'center',
  132. dataIndex: 'duration'
  133. },
  134. {
  135. title: '事假时长(天)',
  136. align: 'center',
  137. dataIndex: 'holidayTimeSj'
  138. },
  139. {
  140. title: '病假时长(天)',
  141. align: 'center',
  142. dataIndex: 'holidayTimeBj'
  143. },
  144. {
  145. title: '是否同步U8',
  146. align: 'center',scopedSlots: {
  147. customRender: 'syU8'
  148. }
  149. }
  150. ],
  151. url: {
  152. exportXlsUrl: '/viewClockIn/bdClockinMonth/exportXls',
  153. getCloseDate:'/viewClockIn/bdClockinMonth/getCloseDate',
  154. closeDateUrl:'/viewClockIn/bdClockinMonth/closeDate',
  155. list: '/viewClockIn/bdClockinMonth/list',
  156. syMonthReport: '/viewClockIn/viewClockIn/syMonthReport'
  157. },
  158. }
  159. },
  160. created() {    //实例被创建时候执行
  161. let yy = new Date().getFullYear();
  162. let mm = new Date().getMonth()+1;
  163. // let dd = new Date().getDate();
  164. this.monthTime = yy+"-"+mm;
  165. },
  166. computed: {
  167. importExcelUrl: function() {
  168. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
  169. },
  170. },
  171. methods: {
  172. monthReport() {
  173. let ids = "";
  174. var conText = ";"
  175. let sqp1 = this.getQueryParams();
  176. if(sqp1['monthTime'] == 'undefined' || sqp1['monthTime'] == null || sqp1['monthTime'] == ''){
  177. this.$message.warning('请选择生成月报日期!');
  178. return false;
  179. }
  180. let nowDate = moment(sqp1['monthTime']).format('YYYY-MM');
  181. let that = this;
  182. for (var a = 0; a < this.selectedRowKeys.length; a++) {
  183. ids += this.selectedRowKeys[a] + ",";
  184. }
  185. if(ids == ""){
  186. conText = "是否生成所有员工" + nowDate + "月报?";
  187. }else{
  188. conText = "是否生成所选员工" + nowDate + "月报? 所选数量:" + this.selectedRowKeys.length;
  189. }
  190. // console.log(ids);
  191. that.$confirm({
  192. title: "确认操作",
  193. content: conText,
  194. onOk: function () {
  195. monthReport({nowDate:nowDate,userIds:ids}).then((res) => {
  196. if (res.success) {
  197. that.$message.success("已成功生成"+nowDate+"考勤月报");
  198. // that.$message.success("已成功生成"+nowDate+"考勤月报");
  199. that.loadData();
  200. } else {
  201. that.$message.warning(res.message);
  202. }
  203. });
  204. }
  205. });
  206. },
  207. showModal() {
  208. let that = this;
  209. getAction(this.url.getCloseDate, {}).then((res) => {
  210. that.oldCloseDate = res;
  211. }).finally(() => {
  212. })
  213. this.visible = true;
  214. },
  215. handleOk(e) {
  216. if(this.closeDate == '' || this.closeDate == null){
  217. this.$message.warning("请选择关账日期");
  218. return;
  219. }
  220. let that = this;
  221. this.visible = false;
  222. putAction(that.url.closeDateUrl, {closeDate:this.closeDate}).then((res) => {
  223. if (res.success) {
  224. that.$message.success("关账成功");
  225. that.loadData();
  226. }else{
  227. that.$message.warning(res.message);
  228. }
  229. }).finally(() => {
  230. that.closeDate = '';
  231. })
  232. },
  233. onChange(date, dateString) {
  234. console.log(date, dateString);
  235. // this.value = "2021-01-01"
  236. },
  237. syMonthReport() {
  238. let ids = "";
  239. var conText = "";
  240. let sqp1 = this.getQueryParams();
  241. if(sqp1['monthTime'] == 'undefined' || sqp1['monthTime'] == null || sqp1['monthTime'] == ''){
  242. this.$message.warning('请选择同步月份!');
  243. return false;
  244. }
  245. let nowDate = moment(sqp1['monthTime']).format('YYYY-MM');
  246. let that = this;
  247. for (var a = 0; a < this.selectedRowKeys.length; a++) {
  248. ids += this.selectedRowKeys[a] + ",";
  249. }
  250. if(ids == ""){
  251. conText = "是否同步所有员工" + nowDate + "月报?";
  252. }else{
  253. conText = "是否同步所选员工" + nowDate + "月报? 所选数量:" + this.selectedRowKeys.length;
  254. }
  255. that.$confirm({
  256. title: conText,
  257. content: "同步后不可修改,请确认操作!",
  258. onOk: function () {
  259. putAction(that.url.syMonthReport, {viewDate:nowDate,ids:ids}).then((res) => {
  260. if (res.success) {
  261. that.$message.success("同步成功");
  262. that.loadData();
  263. }else{
  264. that.$message.warning(res.message);
  265. }
  266. }).finally(() => {
  267. })
  268. }
  269. });
  270. }
  271. }
  272. }
  273. </script>
  274. <style scoped>
  275. @import '~@assets/less/common.less'
  276. </style>