middleground_code_v2/src/views/intergrationTask/detailData/index.vue

372 lines
17 KiB
Vue
Raw Normal View History

2024-03-26 11:18:19 +08:00
<template>
<div>
<base-layout ref="baseLayout" :buttonList="buttonList" @onFuncBtn="onFuncBtn" :querySwitch="true"
:searchBtnList="searchBtnList" :searchList="requirementList" @search="handleSearchEvent" :isPage="true"
@pageChange="handlePageChange" @onFuncSearchBtn="onFuncSearchBtn">
<div slot="main" slot-scope="{ tableHeight }">
<base-table ref="baseTable" :showIndex="true" :funWidth="300" :funData="funData" @onFunc="onFunc"
:tabLoading.sync="tabLoading" :tableHeight="tableHeight" :tableData="tableData"
:fixedTable="'right'" :tableColumn="tableColumnData" :showSelect="true">
<template v-slot:new_state="{ row }">
<div style="width: 100%">
<span v-if="row.new_state == 'Y'" style="color: #67c23a">成功</span>
<span v-else-if="row.new_state == 'H'" style="color: #67c23a">已处理</span>
<span v-else style="color: #f56c6c">失败</span>
</div>
</template>
</base-table>
</div>
</base-layout>
<right-dialog ref="rightDialog" @resetTable="resetTable"></right-dialog>
</div>
</template>
<script>
import baseLayout from "@/components/base/baseLayout";
import baseTable from "@/components/base/baseTable";
import rightDialog from "./rightDialog";
import configData from "./configData";
import {
authApi
} from "@/api/apis/auth";
import { option } from "@/api/apis/detailData"
export default
{
components: {
baseLayout,
baseTable,
rightDialog,
},
data() {
return {
buttonList: [
{
menuName: "刷新",
icon: "el-icon-refresh",
btnFunction: "resetLoad",
},
], //按钮组
searchBtnList: [
{
name: "批量推送",
btnFunction: "batchPush",
},
], //搜索按钮组
requirementList: [
{
placeholder: "任务名称",
prop: "plugin_id",
tag: "elSelect",
options: [],
optionValue: "pluginId",
optionLabel: "pluginName",
},
{
placeholder: "源系统编码",
prop: "root_app_bill",
tag: "elInput",
},
{
placeholder: "推送时间",
prop: "new_push_date",
tag: "elDatePicker",
valueFormat: "yyyy-MM-dd",
},
{
placeholder: "业务⽇期",
prop: "business_date",
tag: "elDatePicker",
valueFormat: "yyyy-MM-dd",
},
{
placeholder: "下游系统单号",
prop: "new_system_number",
tag: "elInput",
},
{
placeholder: "推送状态",
prop: "new_state",
tag: "elRadio",
options: [
{ label: "全部", value: "" },
{ label: "成功", value: "Y" },
{ label: "已处理", value: "H" },
{ label: "失败", value: "N" },
],
},
], //查询模板list
tabLoading: false,
tableColumnData: configData.tableColumnData, //表头数据
funData: [
{
color: "#6a9af1",
text: "查看",
},
{
color: "#6a9af1",
text: "重新推送",
},
{
color: "#6a9af1",
text: "手工处理",
},
{
color: "#d67a74",
text: "删除",
},
],
tableData: [], //表格数据
pageModel: {
pageNum: 1,
pageSize: 10,
},
queryModel: {
plugin_id: '',
root_app_bill: '',
new_push_date: '',
business_date: '',
new_system_number: '',
new_state: 'N'
},
};
},
mounted() {
this.$refs.baseLayout.getField("new_state", "N");
this.queryProductClassfy();
this.GetProductionTableData();
},
methods: {
// 表格数据
async GetProductionTableData() {
this.tabLoading = true;
const res = await option({
tl: "integration_task_living_detailsService",
as: "integrationTaskLog",
dj: "queryPage",
}, {
...this.pageModel,
...this.queryModel
})
this.tabLoading = false;
if (res.status == "200") {
this.tableData = res.attribute.list;
this.$refs.baseTable.setTableKey()
this.$refs.baseLayout.setPageTotal(res.attribute.total);
}
},
async queryProductClassfy() {
const res = await option({
tl: "pluginService",
as: "plugins",
dj: "queryPlugins",
}, {})
if (res.status == "200") {
this.requirementList[0].options = res.attribute;
}
},
// 搜索
handleSearchEvent() {
let data = this.$refs.baseLayout.ruleForm;
this.queryModel.plugin_id = data.plugin_id;
this.queryModel.root_app_bill = data.root_app_bill;
this.queryModel.new_push_date = data.new_push_date;
this.queryModel.business_date = data.business_date;
this.queryModel.new_system_number = data.new_system_number;
this.queryModel.new_state = data.new_state;
this.resetTable();
},
// 批量推送
async batchPush() {
let data = ''
this.$refs.baseTable.$refs.elTable.selection.forEach(el => {
if (data == '') {
data = el.id
} else {
data += `,${el.id}`
}
});
if (data.length > 0) {
this.$confirm("确认重新推送吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.openLoading("submit");
this.rePushBatch(data)
})
.catch(() => {
this.$vmNews("取消操作", "info");
});
} else {
this.$vmNews("请选择需要推送的单据", "warning");
}
},
async rePushBatch(data) {
const res = await option({
tl: "integration_task_living_detailsService",
as: "integrationTaskLog",
dj: "batchPush",
}, {
id: data
})
if (res.status == "200") {
this.$vmNews("批量推送成功", "success");
this.resetTable();
}
},
// 分页变化
handlePageChange(val) {
this.pageModel.pageNum = val.pageIndex;
this.pageModel.pageSize = val.pageSize;
this.GetProductionTableData();
},
// 按钮组
onFuncBtn(btn) {
this[btn.btnFunction]();
},
// 搜索按钮组
onFuncSearchBtn(btn) {
this[btn.btnFunction]();
},
// 新增
add() {
this.$refs.rightDialog.openDialog("add");
},
// 表格操作事件 查看 编辑 删除
async onFunc(index, row) {
// 查看
if (index == 0) {
this.openLoading("detail");
this.$refs.rightDialog.openDialog("show", row);
}
// 重新推送
if (index == 1) {
this.$confirm("确认重新推送吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.openLoading("submit");
this.handleRePush(row);
})
.catch(() => {
this.$vmNews("取消操作", "info");
});
}
// 手工推送
if (index == 2) {
this.$prompt("请填写旺店通或者NC的单据号方便以后排查", "提示", {
confirmButtonText: "提交",
cancelButtonText: "取消",
inputType: "textarea",
inputValidator: (value) => {
if (!value) {
return "请输入处理内容";
}
},
})
.then(({ value }) => {
this.openLoading("submit");
let params =
{
id: row.id,
processing_remarks: value,
}
;
this.updateManualProcess(params);
})
.catch(() => {
this.$message({
type: "info",
message: "取消操作",
});
});
}
// 删除
if (index == 3) {
this.$confirm("确认删除该内容吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.openLoading("del");
this.productionDeleteById(row.id);
})
.catch(() => {
this.$vmNews("取消操作", "info");
});
}
},
async handleRePush(row) {
const res = await option({
tl: "integration_task_living_detailsService",
as: "integrationTaskLog",
dj: "repush",
}, {
id: row.id
})
if (res.status == "200") {
this.$vmNews("补推成功", "success");
this.resetTable();
} else if (res.status == "500") {
this.$message({
title: "补推失败",
showClose: true,
message: res.msg,
duration: 0,
type: "error",
});
this.resetTable();
}
},
async updateManualProcess(val) {
const res = await option({
tl: "integration_task_living_detailsService",
as: "integrationTaskLog",
dj: "manualProcessing",
}, val)
if (res.status == "200") {
this.$vmNews("手工处理成功", "success");
this.resetTable();
}
},
async productionDeleteById(id) {
const res = await option({
tl: "integration_task_living_detailsService",
as: "integrationTaskLog",
dj: "deleteEntity",
}, {
id
})
if (res.status == "200") {
this.$vmNews("删除成功", "success");
this.resetTable();
}
},
// 重置表格
resetTable() {
this.pageModel.pageNum = 1;
this.$refs.baseLayout.pageClear();
this.GetProductionTableData();
},
},
};
</script>
<style scoped>
.clickTitle {
color: #409eff;
cursor: pointer;
}
::v-deep .searchBox:nth-child(6) {
width: 250px !important;
}
</style>