123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- <template>
- <div class="app-container">
- <div class="filter-container">
- <div class="filter-left">
- <div class="filter-item">
- 实际班组:
- <el-input
- v-model="query.eTeamName"
- placeholder="请输入实际班组"
- style="width: 150px"
- clearable
- ></el-input>
- </div>
- <div class="filter-item">
- 实际巡更人:
- <el-input
- v-model="query.UserName"
- placeholder="请输入实际巡更人"
- style="width: 150px"
- clearable
- ></el-input>
- </div>
- <div class="filter-item">
- 线路名称:
- <el-input
- v-model="query.eLName"
- placeholder="请输入线路名称"
- style="width: 150px"
- clearable
- ></el-input>
- </div>
- <el-button
- type="primary"
- icon="el-icon-search"
- size="mini"
- @click="getData('query')"
- >搜索</el-button
- >
- <el-button type="primary" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
- </div>
- </div>
- <!-- <el-divider></el-divider> -->
- <el-table
- v-loading="loading"
- :data="tableData"
- stripe
- style="width: 100%; margin-bottom: 5rem;margin-top:10px"
- id="out-table"
- @selection-change="handleSelectionChange"
- :max-height="tableHeight"
- >
- <el-table-column prop="eBindDevice" label="巡更设备" show-overflow-tooltip></el-table-column>
- <el-table-column prop="eBindTeam" label="绑定班组" show-overflow-tooltip></el-table-column>
- <el-table-column prop="eBindUser" label="计划巡更人" width="100" show-overflow-tooltip></el-table-column>
- <el-table-column prop="eCreateTime" label="实际实施创建时间" width="130" show-overflow-tooltip></el-table-column>
- <el-table-column prop="eDeviceName" label="实际巡检设备" width="120" show-overflow-tooltip></el-table-column>
- <el-table-column prop="eDFlag" label="是否报警" show-overflow-tooltip></el-table-column>
- <el-table-column prop="eEndTime" label="结束时间" show-overflow-tooltip></el-table-column>
- <el-table-column prop="eErrorTime" label="误差时间" show-overflow-tooltip></el-table-column>
- <el-table-column prop="eLineOrder" label="线路顺序" show-overflow-tooltip></el-table-column>
- <el-table-column prop="eLName" label="线路名称" show-overflow-tooltip></el-table-column>
- <el-table-column prop="ePatrolTime" label="巡更时间" show-overflow-tooltip></el-table-column>
- <el-table-column prop="ePlaceName" label="巡更地点" show-overflow-tooltip></el-table-column>
- <el-table-column prop="ePlanMode" label="计划模式" show-overflow-tooltip>
- <template slot-scope="scope">
- {{scope.row.ePlanMode == "0" ? "常规" : scope.row.ePlanMode == "1" ? "班组" : scope.row.ePlanMode == "2" ? "星期" : scope.row.ePlanMode == "3" ? "周期" : ""}}
- </template>
- </el-table-column>
- <el-table-column prop="ePlanState" label="巡更状态" show-overflow-tooltip></el-table-column>
- <el-table-column prop="ePlanType" label="计划类型" show-overflow-tooltip></el-table-column>
- <el-table-column prop="eStartTime" label="开始时间" show-overflow-tooltip></el-table-column>
- <el-table-column prop="eStayTime" label="停留时间" show-overflow-tooltip></el-table-column>
- <el-table-column prop="eTeamName" label="实际班组" show-overflow-tooltip></el-table-column>
- <el-table-column prop="eUserName" label="实际巡更人" width="100" show-overflow-tooltip></el-table-column>
- </el-table>
- <el-pagination
- background
- @current-change="handleCurrentChange"
- :page-sizes="[10, 15, 20, 30]"
- @size-change="handleSizeChange"
- :current-page="pageNo"
- :page-size="pageSize"
- layout="sizes,prev, pager, next"
- :total="totalCount"
- >
- </el-pagination>
- </div>
- </template>
- <script>
- //引入api文件
- import api from "@/api/patrol/elect-partol";
- export default {
- //组件注册
- components: {},
- name: "elect-partol",
- data() {
- return {
- loading:true,
- //初始化列表
- cols: [],
- //列表数据
- tableData: [],
- //列表总数
- totalCount: 0,
- //列表每页条目数
- pageSize: 15,
- //开始页
- pageNo: 1,
- //input实际巡更人
- eBindUser_value: "",
- //input线路名称
- eLName_value: "",
- //input计划完成状态
- ePlanState_value: "",
- query:{
- eTeamName:undefined,
- UserName: undefined,
- eLName: undefined,
- pageNo: 1,
- pageSize: 15,
- },
- form:{
- //列表每页条目数
- pageSize: 15,
- //开始页
- pageNo: 1,
- },
- //表格自适应高度
- tableHeight:undefined,
- };
- },
- mounted(){
- // table高度
- if(window.innerWidth <1920){
- this.tableHeight = window.innerHeight - 300
- }else{
- this.tableHeight = window.innerHeight - 295
- }
- // 监听窗口大小变化
- let self = this;
- window.onresize = function() {
- self.tableHeight = window.innerHeight - 300
- }
- this.getData();
- },
- created() {
- this.getData();
- },
- methods: {
- /** 重置按钮操作 */
- resetQuery() {
- this.query = {
- eTeamName:undefined,
- UserName: undefined,
- eLName: undefined,
- pageNo: 1,
- pageSize: 15,
- },
- this.handleQuery();
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.getData();
- },
- //列表查询
- getData(data) {
- if(data){
- api.queryPatrollingPlanStatus(this.query).then((Response) => {
- this.tableData = Response.data.pageList;
- this.totalCount = Response.data.totalCount;
- this.loading = false
- if(this.tableData.length<1){
- setTimeout(() =>{
- document.getElementsByClassName("el-table__empty-text")[0].innerHTML = "您查询的巡更计划不存在"
- },10)
- }
- });
- }else{
- api.queryPatrollingPlanStatus(this.form).then((Response) => {
- this.tableData = Response.data.pageList;
- this.totalCount = Response.data.totalCount;
- this.loading = false
- if(this.tableData.length<1){
- setTimeout(() =>{
- document.getElementsByClassName("el-table__empty-text")[0].innerHTML = "您查询的巡更计划不存在"
- },10)
- }
- });
- }
- },
- //改变起始页
- handleCurrentChange(val) {
- this.pageNo = val;
- this.query.pageNo = this.pageNo
- this.getData('query');
- },
- //改变每条数
- handleSizeChange(val) {
- this.pageSize = val;
- this.query.pageSize = this.pageSize
- this.getData('query');
- },
- //修改
- handleEdit(index, row) {},
- //删除
- handleDelete(id) {
- this.$confirm("确定删除该数据吗?", "删除", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- // 发送删除请求
- api.deleteById({ queryJson: id }).then((response) => {
- // 处理响应结果提示
- this.$message({
- type: response.success ? "success" : "error",
- message: response.Msg,
- });
- });
- // 刷新列表数据
- this.select();
- })
- .catch(() => {
- // 不用理会
- });
- },
- //全部删除
- batchDelete() {
- let multData = this.multipleSelection;
- let tableData = this.list;
- let multDataLen = multData.length;
- let tableDataLen = tableData.length;
- for (let i = 0; i < multDataLen; i++) {
- for (let y = 0; y < tableDataLen; y++) {
- if (JSON.stringify(tableData[y]) == JSON.stringify(multData[i])) {
- //判断是否相等,相等就删除
- this.list.splice(y, 1);
- }
- }
- }
- },
- handleSelectionChange(val) {
- this.multipleSelection = val;
- },
- //导出功能
- handleDownload() {
- this.downloadLoading = true;
- import("@/vendor/Export2Excel").then((excel) => {
- const tHeader = [
- "巡更计划名称",
- "设备名称",
- "执行开始日期",
- "执行结束日期",
- "巡更开始时间",
- "巡更结束时间",
- "巡更周期",
- "添加时间",
- ];
- const filterVal = [
- "deviceName",
- "patrolPlanName",
- "startDate",
- "endDate",
- "startTime",
- "endTime",
- "patrolPlanCycle",
- "creationTime",
- ];
- const data = this.formatJson(filterVal);
- excel.export_json_to_excel({
- header: tHeader,
- data,
- filename: "table-list",
- });
- this.downloadLoading = false;
- });
- },
- formatJson(filterVal) {
- return this.list.map((v) =>
- filterVal.map((j) => {
- if (j === "timestamp") {
- return parseTime(v[j]);
- } else {
- return v[j];
- }
- })
- );
- },
- },
- };
- </script>
- <style scoped>
- .table-tit {
- background: rgb(235, 241, 255);
- border: 1px solid #d9d9d9;
- border-bottom: 0;
- font-weight: bold;
- padding: 8px 10px;
- }
- .el-checkbox {
- margin-right: 15px;
- line-height: 0;
- }
- .el-dialog {
- min-width: 736px !important;
- }
- </style>
- <style >
- </style>
|