|
@@ -1,7 +1,13 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
-
|
|
|
+ <el-form
|
|
|
+ :model="queryParams"
|
|
|
+ ref="queryForm"
|
|
|
+ size="small"
|
|
|
+ :inline="true"
|
|
|
+ v-show="showSearch"
|
|
|
+ label-width="68px"
|
|
|
+ >
|
|
|
<el-form-item label="测量批次" prop="measurementBatch">
|
|
|
<el-input
|
|
|
v-model="queryParams.measurementBatch"
|
|
@@ -19,8 +25,16 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-search"
|
|
|
+ size="mini"
|
|
|
+ @click="handleQuery"
|
|
|
+ >搜索</el-button
|
|
|
+ >
|
|
|
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
|
|
+ >重置</el-button
|
|
|
+ >
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
|
|
@@ -33,7 +47,8 @@
|
|
|
size="mini"
|
|
|
@click="handleAdd"
|
|
|
v-hasPermi="['meas:measBatch:add']"
|
|
|
- >新增</el-button>
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
@@ -44,7 +59,8 @@
|
|
|
:disabled="single"
|
|
|
@click="handleUpdate"
|
|
|
v-hasPermi="['meas:measBatch:edit']"
|
|
|
- >修改</el-button>
|
|
|
+ >修改</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
@@ -55,7 +71,8 @@
|
|
|
:disabled="multiple"
|
|
|
@click="handleDelete"
|
|
|
v-hasPermi="['meas:measBatch:remove']"
|
|
|
- >删除</el-button>
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
@@ -65,46 +82,65 @@
|
|
|
size="mini"
|
|
|
@click="handleExport"
|
|
|
v-hasPermi="['meas:measBatch:export']"
|
|
|
- >导出</el-button>
|
|
|
+ >导出</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ <right-toolbar
|
|
|
+ :showSearch.sync="showSearch"
|
|
|
+ @queryTable="getList"
|
|
|
+ ></right-toolbar>
|
|
|
</el-row>
|
|
|
|
|
|
- <el-table v-loading="loading" :data="measBatchList" @selection-change="handleSelectionChange">
|
|
|
+ <el-table
|
|
|
+ v-loading="loading"
|
|
|
+ :data="measBatchList"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ >
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
-
|
|
|
- <el-table-column label="测量批次" align="center" prop="measurementBatch" />
|
|
|
+
|
|
|
+ <el-table-column
|
|
|
+ label="测量批次"
|
|
|
+ align="center"
|
|
|
+ prop="measurementBatch"
|
|
|
+ />
|
|
|
<el-table-column label="发动机型号" align="center" prop="engineModel" />
|
|
|
<!-- <el-table-column label="创建人" align="center" prop="createBy" /> -->
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <el-table-column
|
|
|
+ label="操作"
|
|
|
+ align="center"
|
|
|
+ class-name="small-padding fixed-width"
|
|
|
+ >
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-edit"
|
|
|
- @click="handleUpdate(scope.row)"
|
|
|
+ @click="checkView(scope.row)"
|
|
|
v-hasPermi="['meas:measBatch:edit']"
|
|
|
- >查看</el-button>
|
|
|
+ >查看</el-button
|
|
|
+ >
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-edit"
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
v-hasPermi="['meas:measBatch:edit']"
|
|
|
- >修改</el-button>
|
|
|
+ >修改</el-button
|
|
|
+ >
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-delete"
|
|
|
@click="handleDelete(scope.row)"
|
|
|
v-hasPermi="['meas:measBatch:remove']"
|
|
|
- >删除</el-button>
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
-
|
|
|
+
|
|
|
<pagination
|
|
|
- v-show="total>0"
|
|
|
+ v-show="total > 0"
|
|
|
:total="total"
|
|
|
:page.sync="queryParams.pageNum"
|
|
|
:limit.sync="queryParams.pageSize"
|
|
@@ -112,23 +148,42 @@
|
|
|
/>
|
|
|
|
|
|
<!-- 添加或修改测量批次对话框 -->
|
|
|
- <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
+ <el-dialog
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :title="title"
|
|
|
+ :visible.sync="open"
|
|
|
+ width="500px"
|
|
|
+ append-to-body
|
|
|
+ >
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
<el-form-item label="发动机型号" label-width="110px" prop="engineId">
|
|
|
<!-- <el-input v-model.number="form.engineId" placeholder="请输入发动机型号ID" /> -->
|
|
|
- <el-select v-model="form.engineId" placeholder="请选择发动机型号" @change="engineChange">
|
|
|
- <el-option v-for="item in engineOptions" :key="item.id" :label="item.model"
|
|
|
- :value="item.id">
|
|
|
+ <el-select
|
|
|
+ v-model="form.engineId"
|
|
|
+ placeholder="请选择发动机型号"
|
|
|
+ @change="engineChange"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in engineOptions"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.model"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
<span style="float: left">{{ item.id }}</span>
|
|
|
- <span style="float: right; color: #8492a6; font-size: 13px">{{ item.model }}</span>
|
|
|
+ <span style="float: right; color: #8492a6; font-size: 13px">{{
|
|
|
+ item.model
|
|
|
+ }}</span>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="测量批次" prop="measurementBatch">
|
|
|
- <el-input v-model="form.measurementBatch" placeholder="请输入测量批次(测量年月日+发动机型号)" />
|
|
|
+ <el-input
|
|
|
+ v-model="form.measurementBatch"
|
|
|
+ placeholder="请输入测量批次(测量年月日+发动机型号)"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
+ <div v-show="!isCheck" slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
@@ -137,7 +192,13 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listMeasBatch, getMeasBatch, delMeasBatch, addMeasBatch, updateMeasBatch } from "@/api/meas/measBatch";
|
|
|
+import {
|
|
|
+ listMeasBatch,
|
|
|
+ getMeasBatch,
|
|
|
+ delMeasBatch,
|
|
|
+ addMeasBatch,
|
|
|
+ updateMeasBatch,
|
|
|
+} from "@/api/meas/measBatch";
|
|
|
import { listEngineModel } from "@/api/meas/engineModel";
|
|
|
|
|
|
export default {
|
|
@@ -174,13 +235,19 @@ export default {
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
engineId: [
|
|
|
- { required: true,type:'number', message: "发动机型号不能为空,且必须为数字", trigger: "blur" }
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ type: "number",
|
|
|
+ message: "发动机型号不能为空,且必须为数字",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
],
|
|
|
measurementBatch: [
|
|
|
- { required: true, message: "测量批次不能为空", trigger: "blur" }
|
|
|
+ { required: true, message: "测量批次不能为空", trigger: "blur" },
|
|
|
],
|
|
|
},
|
|
|
- engineOptions:[]
|
|
|
+ engineOptions: [],
|
|
|
+ isCheck: false,
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -190,31 +257,31 @@ export default {
|
|
|
/** 查询测量批次列表 */
|
|
|
getList() {
|
|
|
this.loading = true;
|
|
|
- const data = {}
|
|
|
- listEngineModel(data).then(response => {
|
|
|
+ const data = {};
|
|
|
+ listEngineModel(data).then((response) => {
|
|
|
this.engineOptions = response.rows;
|
|
|
});
|
|
|
- listMeasBatch(this.queryParams).then(response => {
|
|
|
+ listMeasBatch(this.queryParams).then((response) => {
|
|
|
this.measBatchList = response.rows;
|
|
|
this.total = response.total;
|
|
|
this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
- engineChange(val){
|
|
|
+ engineChange(val) {
|
|
|
let obj = {};
|
|
|
- obj = this.engineOptions.find((item)=>{
|
|
|
- return item.id === val;
|
|
|
+ obj = this.engineOptions.find((item) => {
|
|
|
+ return item.id === val;
|
|
|
});
|
|
|
- this.form.measurementBatch=this.getTime()+'-'+obj.model
|
|
|
+ this.form.measurementBatch = this.getTime() + "-" + obj.model;
|
|
|
},
|
|
|
getTime() {
|
|
|
const now = new Date();
|
|
|
const year = now.getFullYear();
|
|
|
- const month = ('0' + (now.getMonth() + 1)).slice(-2);
|
|
|
- const day = ('0' + now.getDate()).slice(-2);
|
|
|
- const hour = ('0' + now.getHours()).slice(-2);
|
|
|
- const minute = ('0' + now.getMinutes()).slice(-2);
|
|
|
- const second = ('0' + now.getSeconds()).slice(-2);
|
|
|
+ const month = ("0" + (now.getMonth() + 1)).slice(-2);
|
|
|
+ const day = ("0" + now.getDate()).slice(-2);
|
|
|
+ const hour = ("0" + now.getHours()).slice(-2);
|
|
|
+ const minute = ("0" + now.getMinutes()).slice(-2);
|
|
|
+ const second = ("0" + now.getSeconds()).slice(-2);
|
|
|
const time = year + month + day + hour + minute + second;
|
|
|
return time;
|
|
|
},
|
|
@@ -232,7 +299,7 @@ export default {
|
|
|
createBy: null,
|
|
|
createTime: null,
|
|
|
updateBy: null,
|
|
|
- updateTime: null
|
|
|
+ updateTime: null,
|
|
|
};
|
|
|
this.resetForm("form");
|
|
|
},
|
|
@@ -248,37 +315,43 @@ export default {
|
|
|
},
|
|
|
// 多选框选中数据
|
|
|
handleSelectionChange(selection) {
|
|
|
- this.ids = selection.map(item => item.id)
|
|
|
- this.single = selection.length!==1
|
|
|
- this.multiple = !selection.length
|
|
|
+ this.ids = selection.map((item) => item.id);
|
|
|
+ this.single = selection.length !== 1;
|
|
|
+ this.multiple = !selection.length;
|
|
|
},
|
|
|
/** 新增按钮操作 */
|
|
|
handleAdd() {
|
|
|
this.reset();
|
|
|
this.open = true;
|
|
|
},
|
|
|
+ checkView(row) {
|
|
|
+ debugger;
|
|
|
+ this.handleUpdate(row);
|
|
|
+ this.isCheck = true;
|
|
|
+ },
|
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
this.reset();
|
|
|
- const id = row.id || this.ids
|
|
|
- getMeasBatch(id).then(response => {
|
|
|
+ this.isCheck = false;
|
|
|
+ const id = row.id || this.ids;
|
|
|
+ getMeasBatch(id).then((response) => {
|
|
|
this.form = response.data;
|
|
|
this.open = true;
|
|
|
- this.title = this.isCheck?'查看测量批次数据':"修改测量批次数据";
|
|
|
+ this.title = this.isCheck ? "查看测量批次数据" : "修改测量批次数据";
|
|
|
});
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
|
submitForm() {
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
+ this.$refs["form"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
if (this.form.id != null) {
|
|
|
- updateMeasBatch(this.form).then(response => {
|
|
|
+ updateMeasBatch(this.form).then((response) => {
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
|
});
|
|
|
} else {
|
|
|
- addMeasBatch(this.form).then(response => {
|
|
|
+ addMeasBatch(this.form).then((response) => {
|
|
|
this.$modal.msgSuccess("新增成功");
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
@@ -290,19 +363,27 @@ export default {
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
const ids = row.id || this.ids;
|
|
|
- this.$modal.confirm('是否确认删除测量批次编号为"' + ids + '"的数据项?').then(function() {
|
|
|
- return delMeasBatch(ids);
|
|
|
- }).then(() => {
|
|
|
- this.getList();
|
|
|
- this.$modal.msgSuccess("删除成功");
|
|
|
- }).catch(() => {});
|
|
|
+ this.$modal
|
|
|
+ .confirm('是否确认删除测量批次编号为"' + ids + '"的数据项?')
|
|
|
+ .then(function () {
|
|
|
+ return delMeasBatch(ids);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.getList();
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
},
|
|
|
/** 导出按钮操作 */
|
|
|
handleExport() {
|
|
|
- this.download('meas/measBatch/export', {
|
|
|
- ...this.queryParams
|
|
|
- }, `measBatch_${new Date().getTime()}.xlsx`)
|
|
|
- }
|
|
|
- }
|
|
|
+ this.download(
|
|
|
+ "meas/measBatch/export",
|
|
|
+ {
|
|
|
+ ...this.queryParams,
|
|
|
+ },
|
|
|
+ `measBatch_${new Date().getTime()}.xlsx`
|
|
|
+ );
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|