You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

230 lines
6.8 KiB
Vue

2 years ago
<template>
<div class="lineInformation">
<div class="lineBtnGroup">
<el-button type="primary" @click="handleAddLine()"></el-button>
<el-button type="primary" @click="handleResive()"></el-button>
<!-- <el-button type="primary">批量添加</el-button> -->
<el-button type="primary" @click="handleDelete()"></el-button>
<!-- <el-button type="primary">查询</el-button> -->
2 years ago
</div>
<!-- <div class="searchForm">
<el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item label="单位:">
<el-select v-model="formInline.region" placeholder="活动区域">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
</el-select>
</el-form-item>
<el-form-item label="DY等级:">
<el-select v-model="formInline.region" placeholder="活动区域">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
</el-select>
</el-form-item>
<el-form-item label="XL名称:">
<el-input v-model="formInline.user" placeholder="审批人"></el-input>
</el-form-item>
<el-form-item label="是否为采集">
<el-select v-model="formInline.region" placeholder="活动区域">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
</el-select>
</el-form-item>
<el-form-item label="PMS编号:">
<el-input v-model="formInline.user" placeholder="审批人"></el-input>
</el-form-item>
</el-form>
</div> -->
<div class="lineTable">
<el-table
ref="multipleTable"
:data="lineTableData"
tooltip-effect="dark"
style="width: 100%"
height="calc(100% - 40px)"
border
@selection-change="handleSelectionChange"
@row-click="handleRowClick"
2 years ago
:header-cell-style="{ background: '#F5F7FA' }"
>
<el-table-column type="index" width="55"> </el-table-column>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column label="单位" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.bsManufacturer }}</template>
</el-table-column>
<el-table-column prop="id" label="线路id" show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="name"
label="XL名称"
min-width="95"
show-overflow-tooltip
>
</el-table-column>
<el-table-column prop="dyLevel" label="DY等级" show-overflow-tooltip>
</el-table-column>
2 years ago
<el-table-column fixed="right" label="操作" width="200">
<template slot-scope="scope">
<el-button @click="handleClick(scope.row)" type="text"
>修改</el-button
>
<el-button type="text">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 新增线路 -->
<add-lineDialog
:lineDialog="lineDialog"
:lineDialogTitle="lineDialogTitle"
:formItem="formLineInfo"
@lineDialogClose="lineDialogClose"
></add-lineDialog>
</div>
2 years ago
</template>
<script>
import { getLineListJoggle, deleteLineJoggle } from "@/utils/api/index";
import addLineDialog from "./components/addLineDialog.vue";
2 years ago
export default {
components: {
addLineDialog,
},
data() {
return {
formInline: {
user: "",
region: "",
},
lineDialogTitle: "", //弹窗标题
lineDialog: false,
formLineInfo: {}, //弹窗传值
lineTableData: [],
multipleSelection: [], //获取当前选中
//删除数组
deleteArr: [],
};
},
methods: {
//获取线路列表数据
lineList() {
getLineListJoggle()
.then((res) => {
console.log(res);
this.lineTableData = res.data.list;
})
.catch((err) => {
console.log(err); //代码错误、请求失败捕获
});
},
//点击行选中
handleRowClick(row, column, event) {
this.$refs.multipleTable.toggleRowSelection(row);
// console.log(column, row, event);
},
//获取选中的行
handleSelectionChange(val) {
this.multipleSelection = val;
},
// 新建弹窗
handleAddLine() {
this.lineDialog = true;
this.lineDialogTitle = "新增";
},
//handleResive 修改线路数据
handleResive() {
if (this.multipleSelection.length !== 1) {
this.$message({
showClose: true,
message: "请选择要操作的记录最多只能选择一条!",
type: "warning",
});
} else {
console.log(this.multipleSelection);
this.lineDialogTitle = "修改";
this.formLineInfo = Object.assign({}, this.multipleSelection[0]);
this.lineDialog = true;
}
},
//新建弹窗取消按钮 关闭弹窗
lineDialogClose(flag) {
if (flag) {
//更新列表
this.lineList();
}
this.lineDialog = false;
2 years ago
},
//删除数据
handleDelete() {
if (this.multipleSelection.length == 0) {
this.$message({
showClose: true,
message: "请选择要操作的记录!",
type: "warning",
});
} else {
console.log(this.multipleSelection);
for (let i in this.multipleSelection) {
console.log(i);
this.deleteArr.push({
id: this.multipleSelection[i].id,
});
2 years ago
}
console.log(this.deleteArr);
this.$confirm("确定要删除记录吗,同时删除关联关系?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
// 行设置向后台请求删除数据
deleteLineJoggle({ list: this.deleteArr }).then((res) => {
console.log(res);
this.lineList(); //刷新
});
this.$message({
type: "success",
message: "删除成功!",
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
});
}
},
},
created() {
this.lineList();
},
2 years ago
};
</script>
<style lang="less">
.lineInformation {
width: 100%;
height: 100%;
background: @color-white;
.lineBtnGroup {
padding: 16px 8px;
}
.searchForm {
padding: 0px 8px;
.el-form {
.el-form-item {
margin-bottom: 0px;
}
2 years ago
}
}
.lineTable {
padding: 16px 8px 0 8px;
height: calc(100% - 80px);
//background: #fcc;
}
2 years ago
}
</style>