123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233 |
- <template>
- <div class="dataShare-pushTask-container layout-pd">
- <el-card shadow="never">
- <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline>
- <el-form-item label="ID" prop="Id">
- <el-input v-model="state.queryParams.Id" placeholder="查询ID" clearable @keyup.enter="handleQuery" />
- </el-form-item>
- <!-- <el-form-item label="关键词" prop="Keyword">
- <el-input v-model="state.queryParams.Keyword" placeholder="关键词" clearable @keyup.enter="handleQuery" />
- </el-form-item>-->
- <el-form-item label="是否成功" prop="IsSuccess">
- <el-select v-model="state.queryParams.IsSuccess" placeholder="请选择是否成功" @change="handleQuery" clearable>
- <el-option label="成功" value="true" />
- <el-option label="失败" value="false" />
- </el-select>
- </el-form-item>
- <el-form-item label="时间段" prop="crTime">
- <el-date-picker
- v-model="state.queryParams.crTime"
- type="daterange"
- unlink-panels
- range-separator="至"
- start-placeholder="开始时间"
- end-placeholder="结束时间"
- :shortcuts="shortcuts"
- @change="handleQuery"
- value-format="YYYY-MM-DD"
- :clearable="false"
- />
- </el-form-item>
- <el-form-item label-width="0">
- <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
- <el-button @click="resetQuery(ruleFormRef)" class="default-button" :loading="state.loading">
- <SvgIcon name="ele-Refresh" class="mr5" />重置
- </el-button>
- </el-form-item>
- </el-form>
- </el-card>
- <el-card shadow="never">
- <ProTable
- ref="proTableRef"
- :columns="columns"
- :data="state.tableData"
- @updateTable="queryList"
- :loading="state.loading"
- :total="state.total"
- v-model:page-index="state.queryParams.PageIndex"
- v-model:page-size="state.queryParams.PageSize"
- border
- >
- <template #operation="{ row }">
- <el-button link type="primary" @click="onDetail(row)" title="查看任务明细"> 任务明细 </el-button>
- <el-button link type="primary" @click="onRePush(row)" title="重新推送"> 重推 </el-button>
- <el-button link type="primary" @click="onPushed(row)" title="修改状态为已推送"> 已推送 </el-button>
- </template>
- </ProTable>
- </el-card>
- </div>
- </template>
- <script setup lang="tsx" name="dataSharePushTask">
- import { onMounted, reactive, ref } from 'vue';
- import { ElMessage, ElMessageBox, FormInstance } from 'element-plus';
- import { defaultDate, shortcuts } from "@/utils/constants";
- import { getPushTaskList, rePush, taskPushed } from "@/api/dataShare";
- import { formatDate } from '@/utils/formatTime';
- import { useRouter } from 'vue-router';
- import other from "@/utils/other";
- const proTableRef = ref<RefType>(); // 表格ref
- // 表格配置项
- const columns = ref<any[]>([
- // { prop: 'id', label: 'ID', align: 'center',minWidth: 210 },
- { prop: 'provinceNo', label: '省工单编码', align: 'center',minWidth: 200 },
- {
- prop: 'firstTime',
- label: '初次推送时间',
- align: 'center',
- width: 170,
- render: (scope) => {
- return <span>{formatDate(scope.row.firstTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
- },
- },
- {
- prop: 'lastTime',
- label: '最近一次推送时间',
- align: 'center',
- width: 170,
- render: (scope) => {
- return <span>{formatDate(scope.row.lastTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
- },
- },
- {
- prop: 'sendTimes',
- label: '推送次数',
- align: 'center',
- },
- {
- prop: 'isSuccess',
- label: '推送状态',
- align: 'center',
- render: (scope) => {
- return <span>{scope.row.isSuccess ? '成功' : '失败'}</span>;
- },
- },
- {
- prop: 'platformSourceText',
- label: '平台名称',
- align: 'center',
- },
- { prop: 'pathText', label: '任务类型', align: 'center' },
- { prop: 'request', label: '请求参数', align: 'center' },
- {
- prop: 'generationTime',
- label: '生成时间',
- align: 'center',
- width: 170,
- render: (scope) => {
- return <span>{formatDate(scope.row.generationTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
- },
- },
- {
- prop: 'creationTime',
- label: '创建时间',
- align: 'center',
- width: 170,
- render: (scope) => {
- return <span>{formatDate(scope.row.creationTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
- },
- },
- { prop: 'operation', label: '操作', fixed: 'right', width: 210, align: 'center' },
- ]);
- // 定义变量内容
- const ruleFormRef = ref<RefType>(); // 表单ref
- const state = reactive<any>({
- queryParams: {
- // 查询条件
- PageIndex: 1,
- PageSize: 10,
- Id: null, //
- Keyword: null,
- IsSuccess: null,
- crTime: defaultDate,
- StartTime:null,
- EndTime:null
- },
- tableData: [], //表单
- loading: false, // 加载
- total: 0, // 总数
- });
- /** 搜索按钮操作 */
- const handleQuery = () => {
- state.queryParams.PageIndex = 1;
- queryList();
- };
- /** 获取列表 */
- const queryList = () => {
- state.loading = true;
- let request = other.deepClone(state.queryParams);
- request.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
- request.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
- Reflect.deleteProperty(request, 'crTime');
- getPushTaskList(request)
- .then((res: any) => {
- state.tableData = res.result?.items ?? [];
- state.total = res.result?.total ?? 0;
- state.loading = false;
- })
- .catch(() => {
- state.loading = false;
- });
- };
- /** 重置按钮操作 */
- const resetQuery = (formEl: FormInstance | undefined) => {
- if (!formEl) return;
- formEl.resetFields();
- queryList();
- };
- // 查看任务明细
- const router = useRouter();
- const onDetail = (row: any) => {
- router.push({
- name: 'dataShareTaskDetail',
- query: {
- IsSuccess: state.queryParams.IsSuccess,
- id: row.id,
- },
- });
- };
- // 重推
- const onRePush = (row: any) => {
- ElMessageBox.confirm(`确定重新推送省工单编码为【${row.provinceNo}】吗?`, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- draggable: true,
- })
- .then(() => {
- rePush({ id: row.id })
- .then(() => {
- ElMessage({
- message: '操作成功',
- type: 'success',
- });
- queryList();
- })
- .catch(() => {});
- })
- .catch(() => {});
- };
- // 改状态为已推送
- const onPushed = (row: any) => {
- ElMessageBox.confirm(`确定将省工单编码为【${row.provinceNo}】的任务状态修改为已推送吗?`, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- draggable: true,
- })
- .then(() => {
- taskPushed({id:row.id})
- .then(() => {
- ElMessage({
- message: '操作成功',
- type: 'success',
- });
- queryList();
- })
- .catch(() => {});
- })
- .catch(() => {});
- };
- onMounted(() => {
- queryList();
- });
- </script>
|