|
@@ -3,18 +3,14 @@
|
|
<div class="newly">
|
|
<div class="newly">
|
|
<el-button type="primary" @click="addRow" size="small">新增</el-button>
|
|
<el-button type="primary" @click="addRow" size="small">新增</el-button>
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
<el-table :data="tableData" border>
|
|
<el-table :data="tableData" border>
|
|
<el-table-column prop="name" label="异常数量" align="center">
|
|
<el-table-column prop="name" label="异常数量" align="center">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<div v-if="scope.row.isEditing">
|
|
<div v-if="scope.row.isEditing">
|
|
- <el-input
|
|
|
|
- v-model="scope.row.name"
|
|
|
|
- placeholder="Enter name"
|
|
|
|
- ></el-input>
|
|
|
|
|
|
+ <el-input v-model="scope.row.errCount" type="number"></el-input>
|
|
</div>
|
|
</div>
|
|
<div v-else>
|
|
<div v-else>
|
|
- {{ scope.row.name }}
|
|
|
|
|
|
+ {{ scope.row.errCount }}
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -22,52 +18,67 @@
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<div v-if="scope.row.isEditing">
|
|
<div v-if="scope.row.isEditing">
|
|
<el-input
|
|
<el-input
|
|
- v-model="scope.row.age"
|
|
|
|
|
|
+ v-model="scope.row.handleErrCount"
|
|
type="number"
|
|
type="number"
|
|
- placeholder="Enter age"
|
|
|
|
></el-input>
|
|
></el-input>
|
|
</div>
|
|
</div>
|
|
<div v-else>
|
|
<div v-else>
|
|
- {{ scope.row.age }}
|
|
|
|
|
|
+ {{ scope.row.handleErrCount }}
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column prop="address" label="分析类型">
|
|
<el-table-column prop="address" label="分析类型">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <div v-if="scope.row.isEditing">
|
|
|
|
- <el-input
|
|
|
|
- v-model="scope.row.address"
|
|
|
|
- placeholder="Enter address"
|
|
|
|
- ></el-input>
|
|
|
|
|
|
+ <div v-if="scope.row.isEditing && setDataState === 'add'">
|
|
|
|
+ <el-select v-model="scope.row.analysisTypeCode" size="small">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in analysisTypeList"
|
|
|
|
+ :key="item.typeCode"
|
|
|
|
+ :label="item.typeName"
|
|
|
|
+ :value="item.typeCode"
|
|
|
|
+ ></el-option>
|
|
|
|
+ </el-select>
|
|
</div>
|
|
</div>
|
|
<div v-else>
|
|
<div v-else>
|
|
- {{ scope.row.address }}
|
|
|
|
|
|
+ {{ scope.row.analysisTypeName }}
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column prop="address" label="机组编号" align="center">
|
|
<el-table-column prop="address" label="机组编号" align="center">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <div v-if="scope.row.isEditing">
|
|
|
|
- <el-input
|
|
|
|
- v-model="scope.row.address"
|
|
|
|
- placeholder="Enter address"
|
|
|
|
- ></el-input>
|
|
|
|
|
|
+ <div v-if="scope.row.isEditing && setDataState === 'add'">
|
|
|
|
+ <el-select v-model="scope.row.engineCode" size="small">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in windEngineGroupList"
|
|
|
|
+ :key="item"
|
|
|
|
+ :label="item"
|
|
|
|
+ :value="item"
|
|
|
|
+ ></el-option>
|
|
|
|
+ </el-select>
|
|
</div>
|
|
</div>
|
|
<div v-else>
|
|
<div v-else>
|
|
- {{ scope.row.address }}
|
|
|
|
|
|
+ {{ scope.row.engineCode }}
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column prop="address" label="创建时间" align="center">
|
|
<el-table-column prop="address" label="创建时间" align="center">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <div v-if="scope.row.isEditing">/</div>
|
|
|
|
- <div v-else>/</div>
|
|
|
|
|
|
+ <div v-if="scope.row.isEditing">
|
|
|
|
+ {{ scope.row.createTime ? scope.row.createTime : "/" }}
|
|
|
|
+ </div>
|
|
|
|
+ <div v-else>
|
|
|
|
+ {{ scope.row.createTime ? scope.row.createTime : "/" }}
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column prop="address" label="更新时间" align="center">
|
|
<el-table-column prop="address" label="更新时间" align="center">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <div v-if="scope.row.isEditing">/</div>
|
|
|
|
- <div v-else>/</div>
|
|
|
|
|
|
+ <div v-if="scope.row.isEditing">
|
|
|
|
+ {{ scope.row.updateTime ? scope.row.updateTime : "/" }}
|
|
|
|
+ </div>
|
|
|
|
+ <div v-else>
|
|
|
|
+ {{ scope.row.updateTime ? scope.row.updateTime : "/" }}
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column label="操作" width="150" align="center">
|
|
<el-table-column label="操作" width="150" align="center">
|
|
@@ -84,9 +95,7 @@
|
|
@click="submitRow(scope.$index)"
|
|
@click="submitRow(scope.$index)"
|
|
>提交</el-button
|
|
>提交</el-button
|
|
>
|
|
>
|
|
- <el-button @click="deleteRow(scope.$index)" size="small"
|
|
|
|
- >删除</el-button
|
|
|
|
- >
|
|
|
|
|
|
+ <el-button @click="deleteRow(scope.row)" size="small">删除</el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
@@ -104,49 +113,134 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+import Treeselect from "@riophae/vue-treeselect";
|
|
|
|
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
|
+import {
|
|
|
|
+ analysisErrQuery,
|
|
|
|
+ analysisErrAdd,
|
|
|
|
+ analysisEditQuery,
|
|
|
|
+ analysisErrDel,
|
|
|
|
+ analysisErrEdit,
|
|
|
|
+} from "@/api/performance";
|
|
|
|
+
|
|
export default {
|
|
export default {
|
|
|
|
+ components: {
|
|
|
|
+ Treeselect,
|
|
|
|
+ },
|
|
|
|
+ props: {
|
|
|
|
+ batchCode: String,
|
|
|
|
+ },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ setDataState: "",
|
|
formInline: {
|
|
formInline: {
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
- pageSize: 10,
|
|
|
|
|
|
+ pageSize: 5,
|
|
totalSize: 0,
|
|
totalSize: 0,
|
|
},
|
|
},
|
|
- tableData: [
|
|
|
|
- { name: "John", age: 25, address: "New York", isEditing: false },
|
|
|
|
- { name: "Mike", age: 30, address: "Los Angeles", isEditing: false },
|
|
|
|
- { name: "Kate", age: 22, address: "Chicago", isEditing: false },
|
|
|
|
- ],
|
|
|
|
|
|
+ menuOptions: [],
|
|
|
|
+ tableData: [],
|
|
|
|
+ windEngineGroupList: [],
|
|
|
|
+ analysisTypeList: [],
|
|
};
|
|
};
|
|
},
|
|
},
|
|
|
|
+ created() {
|
|
|
|
+ this.getWindCodeList(this.batchCode);
|
|
|
|
+ this.getTableList(this.batchCode);
|
|
|
|
+ },
|
|
|
|
+ watch: {
|
|
|
|
+ batchCode(newVal) {
|
|
|
|
+ this.getWindCodeList(newVal);
|
|
|
|
+ this.getTableList(newVal);
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+
|
|
methods: {
|
|
methods: {
|
|
// 分页数据切换
|
|
// 分页数据切换
|
|
handleCurrentChange(val) {
|
|
handleCurrentChange(val) {
|
|
this.formInline.pageNum = val;
|
|
this.formInline.pageNum = val;
|
|
- // this.getTableList();
|
|
|
|
|
|
+ this.getTableList(this.batchCode);
|
|
|
|
+ },
|
|
|
|
+ async getWindCodeList(batchCode) {
|
|
|
|
+ try {
|
|
|
|
+ const response = await analysisEditQuery({ batchCode });
|
|
|
|
+ this.analysisTypeList = response.data.analysisTypeList;
|
|
|
|
+ this.windEngineGroupList = response.data.windEngineGroupList;
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error(error);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ async getTableList(batchCode) {
|
|
|
|
+ try {
|
|
|
|
+ const response = await analysisErrQuery({
|
|
|
|
+ batchCode,
|
|
|
|
+ pageNum: this.formInline.pageNum,
|
|
|
|
+ pageSize: 5,
|
|
|
|
+ });
|
|
|
|
+ this.tableData = response.data.list;
|
|
|
|
+ this.formInline.totalSize = response.data.totalSize;
|
|
|
|
+ console.log(response, "response");
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error(error);
|
|
|
|
+ }
|
|
},
|
|
},
|
|
// 新增数据
|
|
// 新增数据
|
|
addRow() {
|
|
addRow() {
|
|
|
|
+ this.setDataState = "add";
|
|
this.tableData.unshift({
|
|
this.tableData.unshift({
|
|
- name: "",
|
|
|
|
- age: null,
|
|
|
|
- address: "",
|
|
|
|
|
|
+ batchCode: "",
|
|
|
|
+ engineCode: "",
|
|
|
|
+ analysisTypeCode: "",
|
|
|
|
+ errCount: "",
|
|
|
|
+ handleErrCount: "",
|
|
isEditing: true,
|
|
isEditing: true,
|
|
});
|
|
});
|
|
},
|
|
},
|
|
// 编辑行
|
|
// 编辑行
|
|
editRow(index) {
|
|
editRow(index) {
|
|
|
|
+ this.setDataState = "edit";
|
|
this.$set(this.tableData[index], "isEditing", true);
|
|
this.$set(this.tableData[index], "isEditing", true);
|
|
},
|
|
},
|
|
// 提交行
|
|
// 提交行
|
|
- submitRow(index) {
|
|
|
|
- this.$set(this.tableData[index], "isEditing", false);
|
|
|
|
|
|
+ async submitRow(index) {
|
|
|
|
+ if (this.setDataState === "add") {
|
|
|
|
+ try {
|
|
|
|
+ const response = await analysisErrAdd({
|
|
|
|
+ batchCode: this.batchCode,
|
|
|
|
+ engineCode: this.tableData[0].engineCode,
|
|
|
|
+ analysisTypeCode: this.tableData[0].analysisTypeCode,
|
|
|
|
+ errCount: this.tableData[0].errCount,
|
|
|
|
+ handleErrCount: this.tableData[0].handleErrCount,
|
|
|
|
+ });
|
|
|
|
+ this.$set(this.tableData[index], "isEditing", false);
|
|
|
|
+ this.getTableList(this.batchCode);
|
|
|
|
+ } catch (err) {
|
|
|
|
+ console.error(err);
|
|
|
|
+ }
|
|
|
|
+ } else if (this.setDataState === "edit") {
|
|
|
|
+ try {
|
|
|
|
+ await analysisErrEdit({
|
|
|
|
+ id: this.tableData[index].id,
|
|
|
|
+ errCount: this.tableData[index].errCount,
|
|
|
|
+ handleErrCount: this.tableData[index].handleErrCount,
|
|
|
|
+ });
|
|
|
|
+ this.$set(this.tableData[index], "isEditing", false);
|
|
|
|
+ this.getTableList(this.batchCode);
|
|
|
|
+ } catch (err) {
|
|
|
|
+ console.error(err);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
// 处理提交逻辑,例如发送数据到服务器
|
|
// 处理提交逻辑,例如发送数据到服务器
|
|
- console.log("Row submitted:", this.tableData[index]);
|
|
|
|
},
|
|
},
|
|
// 删除行
|
|
// 删除行
|
|
- deleteRow(index) {
|
|
|
|
- this.tableData.splice(index, 1);
|
|
|
|
|
|
+ async deleteRow(row) {
|
|
|
|
+ try {
|
|
|
|
+ await analysisErrDel({ id: row.id });
|
|
|
|
+ this.getTableList(this.batchCode);
|
|
|
|
+ } catch (err) {
|
|
|
|
+ console.error(err);
|
|
|
|
+ }
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
};
|