From 8e75a78f55d60565eb48b25eafd4eb07939ce2cc Mon Sep 17 00:00:00 2001 From: zenglf <18502938215@163.com> Date: 星期四, 28 九月 2023 14:09:05 +0800 Subject: [PATCH] Merge branch 'master' into develop --- src/views/system/modules/QuartzJobListModal.vue | 423 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 423 insertions(+), 0 deletions(-) diff --git a/src/views/system/modules/QuartzJobListModal.vue b/src/views/system/modules/QuartzJobListModal.vue new file mode 100644 index 0000000..3910b90 --- /dev/null +++ b/src/views/system/modules/QuartzJobListModal.vue @@ -0,0 +1,423 @@ + +<template> + <a-modal :title="title" width="100%" :visible="visible" :maskClosable="false" @ok="handleOk" @cancel="handleCancel" + cancelText="鍏抽棴"> + <a-card :bordered="false"> + <!-- 鏌ヨ鍖哄煙 --> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + + <a-col :md="6" :sm="6"> + <a-form-item label="浠诲姟鍚嶇О"> + <a-input placeholder="璇疯緭鍏ヤ换鍔″悕绉�" v-model="queryParam.jobName"></a-input> + </a-form-item> + </a-col> + + <a-col :md="6" :sm="6"> + <a-form-item label="鏃堕棿"> + <a-range-picker show-time @change="dateParamChange" :disabledDate="disabledDate" format="YYYY-MM-DD HH:mm:ss" v-model="dates"/> + </a-form-item> + </a-col> + <a-col :md="4" :sm="4"> + <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button> + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">閲嶇疆</a-button> + + </a-col> + <a-col :md="2" :sm="2"> + <a-button type="primary" icon="download" @click="handleExportXls('鎵ц鏃ュ織瀵煎嚭')">瀵煎嚭</a-button> + </a-col> + </a-row> + </a-form> + </div> + <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> + <div class="table-operator"> + + <!--<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">閲嶇疆</a-button>--> + </div> + <!-- table鍖哄煙-begin --> + <div> + <a-table ref="table" size="middle" bordered rowKey="index" :scroll="{聽 y: 400聽}" :columns="columns" + :dataSource="dataSource" :pagination="ipagination" :loading="loading" + @change="handleTableChange"> + <!-- 鐘舵�佹覆鏌撴ā鏉� --> + <template slot="customRenderStatus" slot-scope="isSuccess"> + <a-tag v-if="isSuccess==0" color="green">鎴愬姛</a-tag> + <a-tag v-if="isSuccess==-1" color="red">澶辫触</a-tag> + </template> + <span slot="action" slot-scope="text, record"> + + <a v-if="record.isSuccess == -1" @click="executeImmediately(record)">鏌ョ湅璇︽儏</a> + + </span> + </a-table> + </div> + <!-- table鍖哄煙-end --> + <quartz-job-details ref="modalForm"></quartz-job-details> + + </a-card> + </a-modal> +</template> + +<script> + import { filterObj } from '@/utils/util'; + import { + ajaxGetSelectItems + } from '@/api/api' + import JDictSelectTag from '@/components/dict/JDictSelectTag' + import { + deleteAction, + requestPut, + getAction, + downFile, + postAction + } from '@/api/manage' + import { + JeecgListMixin + } from '@/mixins/JeecgListMixin' + import JInput from '@/components/jeecg/JInput' + import JEllipsis from '@/components/jeecg/JEllipsis' + import Tooltip from 'ant-design-vue/es/tooltip' + import JDate from '@/components/jeecg/JDate' + import moment from 'moment' + import QuartzJobDetails from './QuartzJobDetails' + export default { + name: 'QuartzJobListModal', + // mixins: [JeecgListMixin], + components: { + JDictSelectTag, + JEllipsis, + JInput, + Tooltip, + JDate, + QuartzJobDetails + }, + props: { + status: { + type: Number, + default: 1 + } + }, + data() { + return { + title:'', + visible:false, + /* 鏌ヨ鏉′欢-璇蜂笉瑕佸湪queryParam涓0鏄庨潪瀛楃涓插�肩殑灞炴�� */ + queryParam: {}, + /* 鏁版嵁婧� */ + dataSource:[], + /* 鍒嗛〉鍙傛暟 */ + ipagination:{ + current: 1, + pageSize: 10, + pageSizeOptions: ['10', '20', '30'], + showTotal: (total, range) => { + return range[0] + "-" + range[1] + " 鍏�" + total + "鏉�" + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0 + }, + /* 鎺掑簭鍙傛暟 */ + isorter:{ + column: 'createTime', + order: 'desc', + }, + /* 绛涢�夊弬鏁� */ + filters: {}, + /* table鍔犺浇鐘舵�� */ + loading:false, + /* table閫変腑keys*/ + selectedRowKeys: [], + /* table閫変腑records*/ + selectionRows: [], + /* 鏌ヨ鎶樺彔 */ + toggleSearchStatus:false, + /* 楂樼骇鏌ヨ鏉′欢鐢熸晥鐘舵�� */ + superQueryFlag:false, + /* 楂樼骇鏌ヨ鏉′欢 */ + superQueryParams: '', + /** 楂樼骇鏌ヨ鎷兼帴鏂瑰紡 */ + superQueryMatchType: 'and', + + columns: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + width: 60, + align: "center", + customRender: function (t, r, index) { + return parseInt(index) + 1; + } + }, + // { + // title: '浠诲姟鍚嶇О', + // align: 'center', + // dataIndex: 'jobClassName', + // }, + // { + // title: 'cron琛ㄨ揪寮�', + // align: 'center', + // dataIndex: 'cronExpression', + // }, + { + title: '浠诲姟鍚嶇О', + align: 'center', + dataIndex: 'jobName' + }, + { + title: '鍙傛暟', + align: 'center', + dataIndex: 'parameter' + }, + + { + title: '鎶ラ敊淇℃伅', + dataIndex: 'action', + align:"center", + scopedSlots: { customRender: 'action' }, + }, + { + title: '鎴愬姛鏍囧織', + align: 'center', + dataIndex: 'isSuccess', + scopedSlots: { customRender: 'customRenderStatus' }, + filterMultiple: false, + filters: [ + { text: '鎴愬姛', value: '0' }, + { text: '澶辫触', value: '-1' }, + ] + }, + { + title: '鎵ц鏃堕棿锛堟绉掞級', + align: 'center', + dataIndex: 'executionTime', + customRender:(t,r,index) =>{ + var milliseconds = parseInt(t) + let hours = Math.floor(milliseconds / 3600000); + milliseconds = milliseconds % 3600000; + let minutes = Math.floor(milliseconds / 60000); + milliseconds = milliseconds % 60000; + let seconds = Math.floor(milliseconds / 1000); + milliseconds = milliseconds % 1000; + if(hours == 0){ + if(minutes == 0){ + if(seconds == 0) { + return `${milliseconds}姣` + }else{ + return `${seconds}绉� ${milliseconds}姣` + } + }else{ + return `${minutes}鍒嗛挓 ${seconds}绉� ${milliseconds}姣`; + } + }else{ + return `${hours}灏忔椂 ${minutes}鍒嗛挓 ${seconds}绉� ${milliseconds}姣`; + } + + } + + }, + { + title: '浠诲姟鎵ц鏃堕棿', + align: 'center', + dataIndex: 'createTime' + }, + ], + sectionPData: [], + sectionData: [], + url: { + list: '/sys/quartzLog/list', + exportXlsUrl:'/sys/quartzLog/exportXls' + }, + value:undefined, + valueProduct:undefined, + dates: [], + } + }, + created() { + + }, + watch: { + + }, + methods: { + searchReset() { + let id = this.queryParam.jobId + this.queryParam = {} + this.dates = [] + this.queryParam.jobId = id + this.loadData(1); + }, + executeImmediately:function (record) { + this.$refs.modalForm.showDetails(record); + this.$refs.modalForm.title = "鎶ラ敊淇℃伅"; + this.$refs.modalForm.disableSubmit = false; + }, + handleExportXls(fileName){ + if(!fileName || typeof fileName != "string"){ + fileName = "瀵煎嚭鏂囦欢" + } + let param = this.getQueryParams(); + if(this.selectedRowKeys && this.selectedRowKeys.length>0){ + param['selections'] = this.selectedRowKeys.join(",") + } + console.log("瀵煎嚭鍙傛暟",param) + downFile(this.url.exportXlsUrl,param).then((data)=>{ + if (!data) { + this.$message.warning("鏂囦欢涓嬭浇澶辫触") + return + } + if (typeof window.navigator.msSaveBlob !== 'undefined') { + window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName+'.xls') + }else{ + let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'})) + let link = document.createElement('a') + link.style.display = 'none' + link.href = url + link.setAttribute('download', fileName+'.xls') + document.body.appendChild(link) + link.click() + document.body.removeChild(link); //涓嬭浇瀹屾垚绉婚櫎鍏冪礌 + window.URL.revokeObjectURL(url); //閲婃斁鎺塨lob瀵硅薄 + } + }) + }, + disabledDate(current) { + return current && current > moment().subtract('days', 1); + }, + dateParamChange(v1, v2) { + this.queryParam.startTime = v2[0] + this.queryParam.endTime = v2[1] + }, + handleTableChange(pagination, filters, sorter) { + // this.onClearSelected() + //鍒嗛〉銆佹帓搴忋�佺瓫閫夊彉鍖栨椂瑙﹀彂 + //TODO 绛涢�� + console.log(pagination) + if (Object.keys(sorter).length > 0) { + this.isorter.column = sorter.field; + this.isorter.order = "ascend" == sorter.order ? "asc" : "desc" + } + this.ipagination = pagination; + this.loadData(); + }, + openPage(record) { + // console.log(record) + this.visible = true + this.dataSource = []; + this.queryParam = { + jobId: record.id + }; + + this.loadData(); + }, + getQueryParams() { + //鑾峰彇鏌ヨ鏉′欢 + let sqp = {} + if(this.superQueryParams){ + sqp['superQueryParams']=encodeURI(this.superQueryParams) + sqp['superQueryMatchType'] = this.superQueryMatchType + } + var param = Object.assign(sqp, this.queryParam, this.isorter ,this.filters); + param.field = this.getQueryField(); + param.pageNo = this.ipagination.current; + param.pageSize = this.ipagination.pageSize; + param.jobId = this.queryParam.jobId; + param.startTime = this.queryParam.startTime; + param.endTime = this.queryParam.endTime; + //鑾峰彇鐢ㄦ埛瀹氬埗鐨勫弬鏁板睘鎬� + // if (this.getCustomQueryParams) { + // param = this.getCustomQueryParams(param); + // if(!param){ + // return false; + // } + // } + + return filterObj(param); + }, + getQueryField() { + //TODO 瀛楁鏉冮檺鎺у埗 + var str = "id,"; + this.columns.forEach(function (value) { + str += "," + value.dataIndex; + }); + return str; + }, + loadData(arg) { + if(!this.url.list){ + this.$message.error("璇疯缃畊rl.list灞炴��!") + return + } + //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭 + if (arg === 1) { + this.ipagination.current = 1; + } + var params = this.getQueryParams();//鏌ヨ鏉′欢 + + if(!params){ + return false; + } + + this.loading = true; + // params.id = this.queryParam.id + getAction(this.url.list, params).then((res) => { + if (res.success) { + // console.log(res) + //update-begin---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------ + this.dataSource = res.result.records||res.result; + if(res.result.total) + { + this.ipagination.total = res.result.total; + }else{ + this.ipagination.total = 0; + } + //update-end---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------ + }else{ + // this.$message.warning(res.message) + this.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + } + }).finally(() => { + this.loading = false + }) + }, + modalFormOk(val) { + // 鏂板/淇敼 鎴愬姛鏃讹紝閲嶈浇鍒楄〃 + this.loadData(); + + this.selectedRowKeys = [val.id]; + }, + searchQuery() { + this.loadData(); + }, + close() { + this.$emit('close') + this.visible = false + }, + handleCancel() { + this.close() + }, + handleOk() { + this.close() + }, + }, + } +</script> +<style> + @import '~@assets/less/common.less'; + + .frozenRowClass { + color: #c9c9c9; + } + + .success { + color: green; + } + + .error { + color: red; + } +</style> -- Gitblit v1.9.3