451 lines
12 KiB
Vue
451 lines
12 KiB
Vue
<template>
|
||
<div class="warning-page">
|
||
<LeftMenu
|
||
v-model="active"
|
||
:tabs="['项目名称', '工程名称']"
|
||
:records="records"
|
||
@change-page="onCurChange"
|
||
@search="onSearchInput"
|
||
:pageable="pages"
|
||
class="leftMenu"
|
||
>
|
||
<template #default="{ data }">
|
||
<div class="leftProject" @click="onSearch(data)">
|
||
<span class="projectName">{{
|
||
(data as ResAiProjectPage).projectName || (data as ResAiEngineerPage).engineeringName
|
||
}}</span>
|
||
<div class="leftMenu_item">
|
||
<div class="leftMenu_item flx-justify-between">
|
||
<div style="margin-top: 5px" class="flx-justify-between">
|
||
<img style="margin-right: 5px" src="@/assets/images/AIwaring/dustMap.png" alt="" />
|
||
<span class="middleSize">{{ data.projectAddress || data.address }}</span>
|
||
</div>
|
||
<!-- <div>
|
||
<img src="@/assets/images/AIwaring/报警.png" alt="" />
|
||
<span class="middleSize">今日报警次数:{{ data.todayAlarm }}</span>
|
||
</div> -->
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</LeftMenu>
|
||
<div class="table-box">
|
||
<div class="table">
|
||
<ProTable
|
||
ref="proTable"
|
||
title="用户列表"
|
||
:columns="columns"
|
||
:requestApi="getTableList"
|
||
:dataCallback="dataCallback"
|
||
:tool-button="false"
|
||
:pagination="true"
|
||
background
|
||
:isShowSearch="false"
|
||
>
|
||
<template #formButton="scope">
|
||
<el-button class="btnStyle" @click="handleAddItem()">新增</el-button>
|
||
<!-- <el-button class="btnStyle">刷新</el-button> -->
|
||
</template>
|
||
<template #state="{ row }">
|
||
<span>{{
|
||
row.state == 1
|
||
? "未开始"
|
||
: row.state == 2
|
||
? "进行中"
|
||
: row.state == 3
|
||
? "已完成"
|
||
: row.state == 4
|
||
? "逾期未开始"
|
||
: row.state == 5
|
||
? "逾期进行中"
|
||
: row.state == 6
|
||
? "逾期已完成"
|
||
: ""
|
||
}}</span>
|
||
</template>
|
||
<template #slippage="{ row }">
|
||
<span :style="{ color: row.slippage ? 'red' : 'var(--el-menu-text-color)' }">{{
|
||
row.slippage ? row.slippage : ""
|
||
}}</span>
|
||
</template>
|
||
<!-- 表格操作 -->
|
||
<template #operation="scope">
|
||
<el-button class="btnStyle" type="primary" @click="seeGantt">
|
||
<!-- <img src="@/assets/images/tableIcon/configureIcon.png" alt="" class="configureIcon" /> -->
|
||
<span>查看</span>
|
||
</el-button>
|
||
</template>
|
||
</ProTable>
|
||
<DialogForm
|
||
:title="title"
|
||
:formConfig="formConfig"
|
||
:formData="formData"
|
||
v-model:visible="visible"
|
||
append-to-body
|
||
width="36%"
|
||
@confirm="saveItem"
|
||
>
|
||
</DialogForm>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script lang="ts" setup>
|
||
import { ref, reactive, onMounted, watch } from "vue";
|
||
import {
|
||
getDustprojectPage,
|
||
getDustengineeringPage,
|
||
getAIQuestionPage,
|
||
addAIrecords,
|
||
getAiMonitorDev
|
||
} from "@/api/modules/goverment";
|
||
import { videoList, videoDataAdd, videoDataEdit, videoDataDelete } from "@/api/modules/enterpriseApi";
|
||
import Pagination from "@/components/ProTable/components/Pagination.vue";
|
||
import { ElMessage, UploadProps } from "element-plus";
|
||
import type { FormRules, FormInstance, UploadInstance } from "element-plus";
|
||
import { GlobalStore } from "@/stores";
|
||
import { Delete } from "@element-plus/icons-vue";
|
||
import { jxj_User } from "@/api/types";
|
||
import { useHandleData } from "@/hooks/useHandleData";
|
||
import LeftMenu from "@/components/LeftMenu/LeftMenu.vue";
|
||
import type { ResAiProjectPage, ResAiEngineerPage } from "@/api/types/government/AIwaring";
|
||
import ProTable from "@/components/ProTable/index.vue";
|
||
import DialogForm from "@/components/DialogForm/index.vue";
|
||
import { ColumnProps } from "@/components/ProTable/interface";
|
||
import { getRealTimePage } from "@/api/modules/project";
|
||
import { parentItemGovermentList, payGovermentAdd } from "@/api/modules/huizhou";
|
||
import { useRouter } from "vue-router";
|
||
import { sendIframeMessage } from "@/utils/util";
|
||
const pages = ref({
|
||
pageNo: 1,
|
||
pageSize: 7,
|
||
total: 0
|
||
});
|
||
const router = useRouter();
|
||
const records = ref<ResAiProjectPage[] | ResAiEngineerPage[]>([]);
|
||
const active = ref(0);
|
||
const fileList = ref([]);
|
||
const store = GlobalStore();
|
||
// {
|
||
// prop: "deviceName",
|
||
// label: "合同金额(万元)",
|
||
// render: scoped => {
|
||
// return scoped.row.temperature + "万元";
|
||
// }
|
||
// },
|
||
// 表格配置项
|
||
const columns: ColumnProps[] = [
|
||
{ type: "index", label: "序号", width: 80 },
|
||
{
|
||
prop: "name",
|
||
label: "任务名称",
|
||
width: 200,
|
||
search: { el: "input" }
|
||
},
|
||
// 多级 prop
|
||
{ prop: "commander", label: "负责人" },
|
||
{ prop: "planStartTime", label: "开始日期" },
|
||
{ prop: "planEndTime", label: "结束日期" },
|
||
{ prop: "unit", label: "申请单位" },
|
||
{ prop: "completeRatio", label: "完成百分比(%)", width: 200 },
|
||
{ prop: "slippage", label: "逾期情况(天)", width: 200 },
|
||
{
|
||
prop: "payTime",
|
||
label: "时间筛选",
|
||
isShow: false,
|
||
search: {
|
||
el: "date-picker",
|
||
props: {
|
||
type: "daterange",
|
||
format: "YYYY-MM-DD",
|
||
valueFormat: "YYYY-MM-DD"
|
||
// defaultTime: defaultTime2
|
||
}
|
||
}
|
||
},
|
||
{
|
||
prop: "state",
|
||
label: "状态",
|
||
search: { el: "select" },
|
||
enum: [
|
||
{ label: "未开始", value: 1 },
|
||
{ label: "进行中", value: 2 },
|
||
{ label: "已完成", value: 3 },
|
||
{ label: "逾期未开始", value: 4 },
|
||
{ label: "逾期进行中", value: 5 },
|
||
{ label: "逾期已完成", value: 6 }
|
||
]
|
||
},
|
||
{ prop: "operation", label: "操作", fixed: "right", width: 120 }
|
||
];
|
||
// 弹窗中的配置
|
||
const formConfig = {
|
||
formItemConfig: [
|
||
{
|
||
label: "费用类型",
|
||
prop: "type",
|
||
type: "input"
|
||
},
|
||
{
|
||
label: "合同金额",
|
||
prop: "contractAmount",
|
||
type: "input"
|
||
},
|
||
{
|
||
label: "结算金额",
|
||
prop: "settlementAmount",
|
||
type: "input"
|
||
},
|
||
{
|
||
label: "结算定额日期",
|
||
prop: "settlementTime",
|
||
type: "date"
|
||
},
|
||
{
|
||
label: "申请单位",
|
||
prop: "applicationUnit",
|
||
type: "input"
|
||
},
|
||
{
|
||
label: "中标通知书日期",
|
||
prop: "bidderTime",
|
||
type: "date"
|
||
},
|
||
{
|
||
label: "合同签订日期",
|
||
prop: "contractTime",
|
||
type: "date"
|
||
},
|
||
{
|
||
label: "累计拨付金额",
|
||
prop: "totalAmount",
|
||
type: "input"
|
||
},
|
||
{
|
||
label: "付款金额",
|
||
prop: "payAmount",
|
||
type: "input"
|
||
},
|
||
{
|
||
label: "付款日期",
|
||
prop: "payTime",
|
||
type: "date"
|
||
},
|
||
{
|
||
label: "未支付工程款",
|
||
prop: "unPayAmount",
|
||
type: "input"
|
||
},
|
||
{
|
||
label: "支付百分比",
|
||
prop: "payRatio",
|
||
type: "input"
|
||
}
|
||
],
|
||
rules: {}
|
||
};
|
||
const formData = ref({
|
||
type: "",
|
||
contractAmount: "",
|
||
settlementAmount: "",
|
||
settlementTime: "",
|
||
applicationUnit: "",
|
||
bidderTime: "",
|
||
contractTime: "",
|
||
totalAmount: "",
|
||
payAmount: "",
|
||
payTime: "",
|
||
unPayAmount: "",
|
||
payRatio: ""
|
||
});
|
||
const visible = ref(false);
|
||
const title = ref("新增录像");
|
||
|
||
const pageable = ref({
|
||
pageNo: 1,
|
||
pageSize: 12,
|
||
total: 0
|
||
});
|
||
|
||
const videoData = ref({
|
||
records: []
|
||
});
|
||
const form = ref({
|
||
title: "",
|
||
createTime: "",
|
||
startTime: "",
|
||
endTime: ""
|
||
});
|
||
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
|
||
const proTable = ref();
|
||
// 搜索用的项目sn或者工程sn
|
||
const searchSn = ref("");
|
||
// 跳转至甘特图
|
||
const seeGantt = () => {
|
||
router.push("/goverment/huizhou/progressManagement/GanttchartChart/index");
|
||
};
|
||
// 添加数据按钮
|
||
const handleAddItem = () => {
|
||
formData.value = reactive({
|
||
type: "",
|
||
contractAmount: "",
|
||
settlementAmount: "",
|
||
settlementTime: "",
|
||
applicationUnit: "",
|
||
bidderTime: "",
|
||
contractTime: "",
|
||
totalAmount: "",
|
||
payAmount: "",
|
||
payTime: "",
|
||
unPayAmount: "",
|
||
payRatio: ""
|
||
});
|
||
visible.value = true;
|
||
title.value = "新增";
|
||
// formData.value = reactive({});
|
||
};
|
||
// 新增,编辑数据
|
||
const saveItem = async (form: any) => {
|
||
if (active.value === 0) {
|
||
form.projectSn = searchSn.value;
|
||
} else {
|
||
form.engineeringSn = searchSn.value;
|
||
}
|
||
const res = await payGovermentAdd(form);
|
||
ElMessage.success("新增成功");
|
||
proTable.value.getTableList();
|
||
visible.value = false;
|
||
};
|
||
// 项目或者工程名字
|
||
const searchName = ref<string>("");
|
||
// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total && pageNum && pageSize 这些字段,那么你可以在这里进行处理成这些字段
|
||
// 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
|
||
const dataCallback = (data: any) => {
|
||
// console.log(data);
|
||
return {
|
||
list: data.records,
|
||
total: Number(data.total),
|
||
pageNo: Number(data.current),
|
||
pageSize: Number(data.size)
|
||
};
|
||
};
|
||
// 如果你想在请求之前对当前请求参数做一些操作,可以自定义如下函数:params 为当前所有的请求参数(包括分页),最后返回请求列表接口
|
||
// 默认不做操作就直接在 ProTable 组件上绑定 :requestApi="getUserList"
|
||
const getTableList = (params: any) => {
|
||
let newParams = JSON.parse(JSON.stringify(params));
|
||
if (newParams.payTime) {
|
||
newParams.realEndTime_begin = newParams.payTime[0];
|
||
newParams.realEndTime_end = newParams.payTime[1];
|
||
delete newParams.payTime;
|
||
}
|
||
if (active.value === 0) {
|
||
newParams.projectSn = searchSn.value;
|
||
} else {
|
||
newParams.engineeringSn = searchSn.value;
|
||
}
|
||
return parentItemGovermentList(newParams);
|
||
};
|
||
// 页面的项目名称和工程名称的div点击事件
|
||
const onSearch = async (params: ResAiProjectPage | ResAiEngineerPage) => {
|
||
const { result } = await getAIQuestionPage(
|
||
active.value === 0
|
||
? { projectSn: (params as ResAiProjectPage).projectSn, pageNo: pageable.value.pageNo, pageSize: pageable.value.pageSize }
|
||
: {
|
||
engineeringSn: (params as ResAiEngineerPage).engineeringSn,
|
||
pageNo: pageable.value.pageNo,
|
||
pageSize: pageable.value.pageSize
|
||
}
|
||
);
|
||
pageable.value.total = Number(result.total);
|
||
active.value === 0
|
||
? (searchSn.value = (params as ResAiProjectPage).projectSn)
|
||
: (searchSn.value = (params as ResAiEngineerPage).engineeringSn);
|
||
active.value === 0
|
||
? (searchName.value = (params as ResAiProjectPage).projectName)
|
||
: (searchName.value = (params as ResAiEngineerPage).engineeringName);
|
||
getVideoData();
|
||
proTable.value.getTableList();
|
||
};
|
||
// leftMenu页面的搜索按钮
|
||
const onSearchInput = async (params: string) => {
|
||
console.log(params);
|
||
if (active.value === 0) {
|
||
const { result } = await getDustprojectPage({ projectName: params, ...pages.value });
|
||
records.value = result.records;
|
||
} else {
|
||
const { result } = await getDustengineeringPage({ engineeringName: params, ...pages.value });
|
||
records.value = result.records;
|
||
}
|
||
};
|
||
// leftMenu页面的分页
|
||
const onCurChange = async (params: number) => {
|
||
if (active.value === 0) {
|
||
const { result } = await getDustprojectPage({ ...pages.value, pageNo: params });
|
||
records.value = result.records;
|
||
} else {
|
||
const { result } = await getDustengineeringPage({ ...pages.value, pageNo: params });
|
||
records.value = result.records;
|
||
pages.value.total = +result.total;
|
||
}
|
||
pages.value.total = +res.result.total;
|
||
};
|
||
const getVideoData = async () => {
|
||
const res = await videoList({ ...pageable.value, ...form.value });
|
||
videoData.value.records = res.result.records;
|
||
console.log(videoData.value);
|
||
console.log(res);
|
||
};
|
||
// 获取项目名称分页
|
||
const getProPage = async () => {
|
||
const { result } = await getDustprojectPage(pages.value);
|
||
records.value = result.records;
|
||
records.value.map(item => {
|
||
let showGif = false;
|
||
item.showGif = showGif;
|
||
});
|
||
pages.value.total = Number(result.total);
|
||
};
|
||
// 获取工程名称分页
|
||
const getEngPage = async () => {
|
||
const { result } = await getDustengineeringPage(pages.value);
|
||
records.value = result.records;
|
||
records.value.map(item => {
|
||
let showGif = false;
|
||
item.showGif = showGif;
|
||
});
|
||
pages.value.total = +result.total;
|
||
};
|
||
watch(
|
||
() => active.value,
|
||
async (value: number) => {
|
||
pages.value.pageNo = 1;
|
||
pages.value.total = 0;
|
||
// console.log(value);
|
||
|
||
if (value === 0) {
|
||
await getProPage();
|
||
onSearch(records.value[0]);
|
||
} else {
|
||
await getEngPage();
|
||
onSearch(records.value[0]);
|
||
}
|
||
},
|
||
{
|
||
deep: true
|
||
}
|
||
);
|
||
onMounted(async () => {
|
||
getVideoData();
|
||
await getProPage();
|
||
onSearch(records.value[0]);
|
||
searchSn.value = (records.value as ResAiProjectPage[])[0].projectSn;
|
||
searchName.value = (records.value as ResAiProjectPage[])[0].projectName;
|
||
await sendIframeMessage({ obj: { path: store.path, moduleId: store.moduleId } }, 2, undefined);
|
||
});
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
@import "./index.scss";
|
||
</style>
|