|
@@ -1,7 +1,7 @@
|
|
|
<!--
|
|
|
* @Author: your name
|
|
|
* @Date: 2024-11-25 09:28:47
|
|
|
- * @LastEditTime: 2024-11-29 14:36:46
|
|
|
+ * @LastEditTime: 2024-12-06 16:12:50
|
|
|
* @LastEditors: bogon
|
|
|
* @Description: In User Settings Edit
|
|
|
* @FilePath: /performance-test/src/views/dataAdministration/vibration/index.vue
|
|
@@ -10,12 +10,11 @@
|
|
|
<div class="global-variable" v-loading="loading">
|
|
|
<!-- 振动数据操作页面 -->
|
|
|
<div class="condition">
|
|
|
- <!-- <el-form
|
|
|
+ <el-form
|
|
|
:inline="true"
|
|
|
ref="ruleForm"
|
|
|
:model="formInline"
|
|
|
class="demo-form-inline"
|
|
|
- :rules="rules"
|
|
|
>
|
|
|
<el-form-item label="风场名称:" prop="fieldName">
|
|
|
<el-input
|
|
@@ -24,13 +23,27 @@
|
|
|
placeholder="请输入风场名称"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="状态:">
|
|
|
+ <el-select
|
|
|
+ size="small"
|
|
|
+ v-model="formInline.transferStatus"
|
|
|
+ placeholder="请选择状态"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ :label="item.label"
|
|
|
+ v-for="item in StateCodeList"
|
|
|
+ :value="item.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" @click="onSubmit" size="small"
|
|
|
>查询</el-button
|
|
|
>
|
|
|
<el-button @click="reset('ruleForm')" size="small">重置</el-button>
|
|
|
</el-form-item>
|
|
|
- </el-form> -->
|
|
|
+ </el-form>
|
|
|
</div>
|
|
|
<div class="list-page">
|
|
|
<div class="newly">
|
|
@@ -59,6 +72,13 @@
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
min-width="100"
|
|
|
+ label="转换路径"
|
|
|
+ prop="transferAddr"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ align="center"
|
|
|
+ min-width="100"
|
|
|
label="进度"
|
|
|
prop="transferProgress"
|
|
|
>
|
|
@@ -114,22 +134,22 @@
|
|
|
label="操作"
|
|
|
min-width="200"
|
|
|
>
|
|
|
+ <!-- v-hasPermi="['dataAdministration:vibration:conversion']" -->
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
v-if="scope.row.transferStatus === -1"
|
|
|
- v-hasPermi="['dataAdministration:vibration:conversion']"
|
|
|
@click="conversion(scope.row, 0)"
|
|
|
type="text"
|
|
|
size="small"
|
|
|
>转换</el-button
|
|
|
>
|
|
|
+ <!-- v-hasPermi="['dataAdministration:vibration:reconversion']" -->
|
|
|
<el-button
|
|
|
v-if="
|
|
|
scope.row.transferStatus === 0 ||
|
|
|
scope.row.transferStatus === 1 ||
|
|
|
scope.row.transferStatus === 2
|
|
|
"
|
|
|
- v-hasPermi="['dataAdministration:vibration:reconversion']"
|
|
|
@click="conversion(scope.row, 1)"
|
|
|
type="text"
|
|
|
size="small"
|
|
@@ -171,6 +191,7 @@
|
|
|
<el-select
|
|
|
v-model="ruleForm.fieldCode"
|
|
|
placeholder="请选择风场"
|
|
|
+ :disabled="title !== '新增'"
|
|
|
style="width: 100%"
|
|
|
>
|
|
|
<el-option
|
|
@@ -205,15 +226,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {
|
|
|
- getBatchMagList,
|
|
|
- addFieldBatch,
|
|
|
- updateFieldBatch,
|
|
|
- queryCodeNum,
|
|
|
- onOrOffFieldBatch,
|
|
|
- deleteFieldBatch,
|
|
|
- createBatchName,
|
|
|
-} from "@/api/performance.js";
|
|
|
+import { updateFieldBatch, queryCodeNum } from "@/api/performance.js";
|
|
|
import {
|
|
|
getDataTransfer,
|
|
|
addDataTransfer,
|
|
@@ -225,44 +238,51 @@ export default {
|
|
|
return {
|
|
|
loadingView: false,
|
|
|
loading: false, //数据加载中
|
|
|
- rules: {
|
|
|
- fieldCode: { trigger: "change" },
|
|
|
- batchState: { trigger: "blur" },
|
|
|
- },
|
|
|
- startDate: "",
|
|
|
- endDate: "",
|
|
|
fieldCodeList: [],
|
|
|
+ StateCodeList: [
|
|
|
+ {
|
|
|
+ label: "未转换",
|
|
|
+ value: -1,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "转换中",
|
|
|
+ value: 0,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "转换完成",
|
|
|
+ value: 1,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "转换异常",
|
|
|
+ value: 2,
|
|
|
+ },
|
|
|
+ ],
|
|
|
formInline: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
transferType: 1,
|
|
|
+ fieldName: "",
|
|
|
+ transferStatus: "",
|
|
|
},
|
|
|
tableData: [],
|
|
|
// 新增编辑表单
|
|
|
ruleForm: {
|
|
|
fieldCode: null,
|
|
|
- batchName: null,
|
|
|
- batchCode: null,
|
|
|
+ transferAddr: null,
|
|
|
},
|
|
|
addUserRules: {
|
|
|
- batchCode: {
|
|
|
+ fieldCode: {
|
|
|
required: true,
|
|
|
- message: "请选择关联风场",
|
|
|
+ message: "请选择风场",
|
|
|
trigger: "change",
|
|
|
},
|
|
|
transferAddr: [
|
|
|
{ required: true, message: "请输入转换路径", trigger: "blur" },
|
|
|
],
|
|
|
},
|
|
|
- //修改密码
|
|
|
- editUserPassword: {
|
|
|
- oldPWD: "",
|
|
|
- newPWD: "",
|
|
|
- userId: "",
|
|
|
- },
|
|
|
-
|
|
|
nuedialog: false,
|
|
|
title: "",
|
|
|
+ id: "",
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -271,7 +291,21 @@ export default {
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
- conversion(row, retransfer) {},
|
|
|
+ //转换重新转换
|
|
|
+ conversion(row, retransfer) {
|
|
|
+ try {
|
|
|
+ // 直接替换整个对象,以确保 Vue 的响应式系统能够检测到变化
|
|
|
+ this.ruleForm = {
|
|
|
+ fieldCode: row.fieldCode,
|
|
|
+ transferAddr: row.transferAddr,
|
|
|
+ };
|
|
|
+ this.id = row.id;
|
|
|
+ this.nuedialog = true;
|
|
|
+ this.title = retransfer === 0 ? "转换" : "重新转换";
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error("获取用户信息失败");
|
|
|
+ }
|
|
|
+ },
|
|
|
handleCloses(done) {
|
|
|
this.$confirm("确认关闭?")
|
|
|
.then((_) => {
|
|
@@ -279,18 +313,7 @@ export default {
|
|
|
})
|
|
|
.catch((_) => {});
|
|
|
},
|
|
|
- onDateChange(date) {
|
|
|
- if (Array.isArray(date)) {
|
|
|
- this.startDate = this.$formatDate(date[0]);
|
|
|
- this.endDate = this.$formatDate(date[1]);
|
|
|
- if (this.endDate < this.startDate) {
|
|
|
- this.endDate = this.startDate;
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.startDate = null;
|
|
|
- this.endDate = null;
|
|
|
- }
|
|
|
- },
|
|
|
+
|
|
|
//获取风场列表
|
|
|
async getQueryCodeNumList() {
|
|
|
this.loading = true;
|
|
@@ -308,28 +331,20 @@ export default {
|
|
|
this.formInline.pageNum = val;
|
|
|
this.getTableList();
|
|
|
},
|
|
|
- //修改状态
|
|
|
- setState(state, row) {
|
|
|
- //启用接口
|
|
|
- this.loading = true;
|
|
|
- onOrOffFieldBatch({ batchCode: row.batchCode, batchState: state })
|
|
|
- .then((res) => {
|
|
|
- this.$message({
|
|
|
- message: res.msg,
|
|
|
- type: "success",
|
|
|
- });
|
|
|
- this.loading = false;
|
|
|
- this.getTableList();
|
|
|
- })
|
|
|
- .catch((error) => {
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
- },
|
|
|
+
|
|
|
async getTableList() {
|
|
|
try {
|
|
|
this.loading = true;
|
|
|
const result = await getDataTransfer({
|
|
|
...this.formInline,
|
|
|
+ transferStatus:
|
|
|
+ this.formInline.transferStatus === ""
|
|
|
+ ? undefined
|
|
|
+ : this.formInline.transferStatus,
|
|
|
+ fieldName:
|
|
|
+ this.formInline.fieldName === ""
|
|
|
+ ? undefined
|
|
|
+ : this.formInline.fieldName,
|
|
|
});
|
|
|
this.tableData = result.data.list;
|
|
|
this.formInline.totalSize = result.data.totalSize;
|
|
@@ -352,124 +367,67 @@ export default {
|
|
|
|
|
|
// 新增,编辑确定
|
|
|
submitForm(formName) {
|
|
|
- // this.loading = true;
|
|
|
- this.$refs[formName].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- this.loadingView = true;
|
|
|
- switch (this.title) {
|
|
|
- case "新增":
|
|
|
- const obj = this.fieldCodeList.find(
|
|
|
- (item) => item.codeNumber === this.ruleForm.fieldCode
|
|
|
- );
|
|
|
- const form = new FormData();
|
|
|
- form.append("fieldName", obj.fieldName);
|
|
|
- addDataTransfer(form).then((results) => {
|
|
|
- addFieldBatch({
|
|
|
- ...this.ruleForm,
|
|
|
- batchName: results.data,
|
|
|
- batchCode: undefined,
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: res.msg,
|
|
|
- });
|
|
|
- // this.loading = false;
|
|
|
- this.getTableList();
|
|
|
- this.nuedialog = false;
|
|
|
- this.loadingView = false;
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- this.loadingView = false;
|
|
|
- // this.loading = false;
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- break;
|
|
|
- case "编辑":
|
|
|
- updateFieldBatch({ ...this.ruleForm, fieldCode: undefined })
|
|
|
- .then((res) => {
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: res.msg,
|
|
|
- });
|
|
|
- this.getTableList();
|
|
|
- this.nuedialog = false;
|
|
|
- this.loadingView = false;
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- this.loadingView = false;
|
|
|
- });
|
|
|
-
|
|
|
- break;
|
|
|
+ this.$refs[formName].validate(async (valid) => {
|
|
|
+ if (!valid) return false;
|
|
|
+ this.loadingView = true;
|
|
|
+ // 定义处理逻辑的映射
|
|
|
+ const actionMap = {
|
|
|
+ 新增: () => addDataTransfer({ transferType: "1", ...this.ruleForm }),
|
|
|
+ 转换: () =>
|
|
|
+ DataTransfer({
|
|
|
+ id: this.id,
|
|
|
+ retransfer: 0,
|
|
|
+ transferAddr: this.ruleForm.transferAddr,
|
|
|
+ }),
|
|
|
+ 重新转换: () =>
|
|
|
+ DataTransfer({
|
|
|
+ id: this.id,
|
|
|
+ retransfer: 1,
|
|
|
+ transferAddr: this.ruleForm.transferAddr,
|
|
|
+ }),
|
|
|
+ };
|
|
|
+ try {
|
|
|
+ // 执行对应的操作
|
|
|
+ const response = await actionMap[this.title]?.();
|
|
|
+ if (response) {
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: response.msg,
|
|
|
+ });
|
|
|
+ this.getTableList();
|
|
|
+ this.nuedialog = false;
|
|
|
}
|
|
|
- // this.nuedialog = false;
|
|
|
- } else {
|
|
|
- return false;
|
|
|
+ } catch (error) {
|
|
|
+ console.error("操作失败:", error);
|
|
|
+ this.$message.error(error?.msg || "操作失败,请稍后重试。");
|
|
|
+ } finally {
|
|
|
+ this.loadingView = false;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+
|
|
|
//点击取消
|
|
|
cancel(formName) {
|
|
|
this.$refs[formName] && this.$refs[formName].resetFields();
|
|
|
this.ruleForm = {
|
|
|
fieldCode: null,
|
|
|
- batchCode: null,
|
|
|
- batchName: null,
|
|
|
+ transferAddr: null,
|
|
|
};
|
|
|
this.nuedialog = false;
|
|
|
this.loadingView = false;
|
|
|
},
|
|
|
- // 编辑 回显数据
|
|
|
- async compile(row) {
|
|
|
- try {
|
|
|
- // 直接替换整个对象,以确保 Vue 的响应式系统能够检测到变化
|
|
|
- this.ruleForm = {
|
|
|
- fieldCode: row.fieldCode,
|
|
|
- batchCode: row.batchCode,
|
|
|
- batchName: row.batchName,
|
|
|
- };
|
|
|
- this.nuedialog = true;
|
|
|
- this.title = "编辑";
|
|
|
- } catch (error) {
|
|
|
- this.$message.error("获取用户信息失败");
|
|
|
- }
|
|
|
- },
|
|
|
- // 删除
|
|
|
- deleted(row) {
|
|
|
- this.$confirm("此操作将永久删除该用户, 是否继续?", "提示", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning",
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.loading = true;
|
|
|
- deleteFieldBatch({ batchCode: row.batchCode })
|
|
|
- .then((res) => {
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: "删除成功!",
|
|
|
- });
|
|
|
- this.loading = false;
|
|
|
- this.getTableList();
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- this.$message({
|
|
|
- type: "info",
|
|
|
- message: "已取消删除",
|
|
|
- });
|
|
|
- });
|
|
|
+ reset() {
|
|
|
+ this.formInline = {
|
|
|
+ fieldName: "",
|
|
|
+ transferStatus: "",
|
|
|
+ };
|
|
|
+ this.getTableList();
|
|
|
},
|
|
|
// 新增
|
|
|
newnuedialog() {
|
|
|
this.cancel("addUserForm");
|
|
|
this.ruleForm = {
|
|
|
- batchCode: "",
|
|
|
- batchName: "",
|
|
|
+ transferAddr: "",
|
|
|
fieldCode: "",
|
|
|
};
|
|
|
this.nuedialog = true;
|