BdClockinMonthList.vue 9.8 KB

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