|
@@ -11,27 +11,57 @@
|
|
|
</el-button>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
- <el-button type="primary" class="button" @click="handleAdd">新增计划</el-button>
|
|
|
+ <el-button type="primary" class="button" @click="handleAdd(0)">新增计划</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</el-row>
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="12">
|
|
|
- <el-table v-loading="loading" :data="state.tableData" border stripe style="width: 100%" :height="tableHeight"
|
|
|
- highlight-current-row @current-change="handleCurrentRowChange"
|
|
|
+ <el-table v-loading="loading" :data="state.tcheck_tableData" border stripe style="width: 100%"
|
|
|
+ :height="tableHeight" highlight-current-row @current-change="handleCurrentRowChange"
|
|
|
:header-cell-style="{ background: '#606266', color: '#FFFFFF' }">
|
|
|
<el-table-column fixed type="index" width="50" align="center" />
|
|
|
<el-table-column fixed prop="checkName" label="计划名称" header-align="center" width="120" />
|
|
|
<el-table-column label="计划时间" header-align="center" width="100" />
|
|
|
- <el-table-column label="计划参数" header-align="center" min-width="100" />
|
|
|
- <el-table-column prop="createMan" label="创建人" header-align="center" width="140" />
|
|
|
- <el-table-column label="状态" header-align="center" width="90" />
|
|
|
+ <el-table-column label="计划参数" header-align="center" min-width="100">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-space direction="vertical" alignment="start">
|
|
|
+ <el-tag>计划时长(天):<span style="color: blue; font-size: large">{{
|
|
|
+ scope.row.cehckDays
|
|
|
+ }}</span></el-tag>
|
|
|
+ <el-tag>上传间隔(分):<span style="color: green; font-size: large">{{
|
|
|
+ scope.row.checkIntverl
|
|
|
+ }}</span>
|
|
|
+ </el-tag>
|
|
|
+ </el-space>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="createMan" label="创建人" header-align="center" width="90" />
|
|
|
+ <el-table-column label="状态" header-align="center" width="90">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-space alignment="start" :size="5">
|
|
|
+ <el-tag><span style="color: blue; font-size: large">{{
|
|
|
+ scope.row.startTime != undefined ? "执行中" : "未开始"
|
|
|
+ }}</span></el-tag>
|
|
|
+ </el-space>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
|
|
|
- <el-table-column fixed="right" label="" align="left" width="150">
|
|
|
+ <el-table-column fixed="right" label="" align="left" width="230">
|
|
|
<template #default="scope">
|
|
|
- <el-button type="text">合格证</el-button>
|
|
|
+ <el-button type="text" v-show="scope.row.startTime != undefined ? true : false"
|
|
|
+ @click="handleStart(scope.row)">开始拷机</el-button>
|
|
|
+ <el-button type="text" v-show="
|
|
|
+ scope.row.startTime != undefined
|
|
|
+ ? scope.row.endTime != undefined
|
|
|
+ ? false
|
|
|
+ : false
|
|
|
+ : false
|
|
|
+ " @click="handleStart(scope.row)">结束拷机</el-button>
|
|
|
+ <el-button type="text" v-show="scope.row.endTime != undefined ? true : false">合格证</el-button>
|
|
|
<el-button type="text" @click="handleEdit(scope.row)">编辑</el-button>
|
|
|
- <el-button type="text" @click="submitDeleteForm(scope.row)">删除</el-button>
|
|
|
+ <el-button type="text" v-show="scope.row.startTime != undefined ? true : false"
|
|
|
+ @click="submitDeleteForm(scope.row)">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -46,7 +76,7 @@
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-row>
|
|
|
- <el-table v-loading="loading" :data="state.tableData" border stripe style="width: 100%;" :height="300"
|
|
|
+ <el-table v-loading="loading" :data="state.tcheck_tableData" border stripe style="width: 100%" :height="300"
|
|
|
highlight-current-row @current-change="handleCurrentRowChange"
|
|
|
:header-cell-style="{ background: '#606266', color: '#FFFFFF' }">
|
|
|
<el-table-column fixed type="index" width="50" align="center" />
|
|
@@ -58,8 +88,9 @@
|
|
|
</el-table>
|
|
|
</el-row>
|
|
|
<el-row justify="center">
|
|
|
- <el-table v-loading="loading" :data="state.tableData" border stripe style="width: 100%" highlight-current-row
|
|
|
- @current-change="handleCurrentRowChange" :header-cell-style="{ background: '#606266', color: '#FFFFFF' }">
|
|
|
+ <el-table v-loading="loading" :data="state.tcheck_tableData" border stripe style="width: 100%"
|
|
|
+ highlight-current-row @current-change="handleCurrentRowChange"
|
|
|
+ :header-cell-style="{ background: '#606266', color: '#FFFFFF' }">
|
|
|
<el-table-column fixed type="index" width="50" align="center" />
|
|
|
<el-table-column fixed prop="deviceSn" label="设备SN" header-align="center" width="120" />
|
|
|
<el-table-column label="最新读书" header-align="center" width="100" />
|
|
@@ -72,12 +103,52 @@
|
|
|
<el-pagination v-model:currentPage="queryParams.pageNum" v-model:page-size="queryParams.pageSize"
|
|
|
:page-sizes="[10, 15, 20, 25, 100]" :small="state.small" :disabled="state.disabled"
|
|
|
:background="state.background" layout="total, sizes, prev, pager, next, jumper" :total="state.total"
|
|
|
- style="text-align: center; margin-top: 10px; height: 30px;" @size-change="handleSizeChange"
|
|
|
+ style="text-align: center; margin-top: 10px; height: 30px" @size-change="handleSizeChange"
|
|
|
@current-change="handleCurrentChange" />
|
|
|
</el-config-provider>
|
|
|
</el-row>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
+
|
|
|
+ <el-dialog :title="tcheck_dialog.title" v-model="tcheck_dialog.visible" width="450px" draggable center>
|
|
|
+ <el-form ref="editFormRef" :model="tcheck_formData" label-width="100px">
|
|
|
+ <el-form-item label="计划名称:">
|
|
|
+ <el-input v-model="tcheck_formData.checkName" placeholder="计划名称" width="120px" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="计划时长:">
|
|
|
+ <el-input v-model="tcheck_formData.cehckDays" placeholder="计划时长" width="120px" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="上传间隔:">
|
|
|
+ <el-input v-model="tcheck_formData.checkIntverl" placeholder="上传间隔" width="120px" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <span class="dialog-footer">
|
|
|
+ <el-button @click="cancel">取消</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm">确定</el-button>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog :title="tcheck_dialog.title" v-model="tcheck_dialog.visible" width="450px" draggable center>
|
|
|
+ <el-form ref="editFormRef" :model="tcheck_formData" label-width="100px">
|
|
|
+ <el-form-item label="计划名称:">
|
|
|
+ <el-input v-model="tcheck_formData.checkName" placeholder="计划名称" width="120px" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="计划时长:">
|
|
|
+ <el-input v-model="tcheck_formData.cehckDays" placeholder="计划时长" width="120px" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="上传间隔:">
|
|
|
+ <el-input v-model="tcheck_formData.checkIntverl" placeholder="上传间隔" width="120px" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <span class="dialog-footer">
|
|
|
+ <el-button @click="cancel">取消</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm">确定</el-button>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -86,20 +157,10 @@ import { reactive, toRefs, toRef, ref, onMounted } from "vue";
|
|
|
import { ElForm, ElMessage, ElMessageBox } from "element-plus";
|
|
|
import TCheckAction from "@/api/qualitymanagement/tcheck";
|
|
|
|
|
|
-import {
|
|
|
- TCheckQueryParam,
|
|
|
- TCheckModel,
|
|
|
- Dialog,
|
|
|
- PageResult
|
|
|
-} from "@/types";
|
|
|
+import { TCheckQueryParam, TCheckModel, TCheckDetailModel, Dialog, PageResult } from "@/types";
|
|
|
|
|
|
import zhCn from "element-plus/lib/locale/lang/zh-cn";
|
|
|
|
|
|
-const count = ref(0);
|
|
|
-const load = () => {
|
|
|
- count.value += 2;
|
|
|
-};
|
|
|
-
|
|
|
let locale = ref(zhCn);
|
|
|
|
|
|
const queryFormRef = ref(ElForm); // 属性名必须和元素的ref属性值一致
|
|
@@ -114,19 +175,23 @@ const loading = ref(false);
|
|
|
|
|
|
const state = reactive({
|
|
|
search_disabled: false,
|
|
|
- currentType: 0,
|
|
|
+ currentType: 0, //val =0 计划新增 =1 计划编辑 =2 明细新增 =3 明细编辑
|
|
|
queryParams: { pageNum: 1, pageSize: 10 } as TCheckQueryParam,
|
|
|
total: 0,
|
|
|
small: false,
|
|
|
background: false,
|
|
|
disabled: false,
|
|
|
- dialog: {} as Dialog,
|
|
|
- formData: {} as TCheckModel,
|
|
|
+ tcheck_dialog: {} as Dialog,
|
|
|
+ tcheck_formData: {} as TCheckModel,
|
|
|
+ tcheckdetail_dialog: {} as Dialog,
|
|
|
+ tcheckdetail_formData: {} as TCheckDetailModel,
|
|
|
RoleStateMap,
|
|
|
- tableData: [] as TCheckModel[],
|
|
|
+ tcheck_tableData: [] as TCheckModel[],
|
|
|
+ tcheckdetail_tableData: [] as TCheckDetailModel[],
|
|
|
});
|
|
|
|
|
|
-const { queryParams, dialog, formData, tableData } = toRefs(state);
|
|
|
+const { queryParams, tcheck_dialog, tcheck_formData, tcheck_tableData, tcheckdetail_tableData } =
|
|
|
+ toRefs(state);
|
|
|
|
|
|
const tableHeight = ref(document.documentElement.clientHeight - 275);
|
|
|
const currentRow = ref();
|
|
@@ -136,11 +201,38 @@ const handleCurrentRowChange = (val: TCheckModel | undefined) => {
|
|
|
};
|
|
|
|
|
|
const handleAdd = (val: number) => {
|
|
|
-
|
|
|
+ if (val === 0) {
|
|
|
+ state.currentType = 0;
|
|
|
+ state.tcheck_formData = {} as TCheckModel;
|
|
|
+ state.tcheck_dialog.title = "拷机计划";
|
|
|
+ state.tcheck_dialog.visible = true;
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
-const handleEdit = (val: number) => {
|
|
|
+const handleStart = (row: TCheckModel) => {
|
|
|
+ TCheckAction.StartTCheck(row.id)
|
|
|
+ .then((result) => {
|
|
|
+ if (result.status === 200) {
|
|
|
+ const { res, flag, errot } = result.data;
|
|
|
+ if (flag != undefined && flag == 1) {
|
|
|
+ } else {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ queryList();
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ //请求失败时的操作
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
+};
|
|
|
|
|
|
+const handleEdit = (row: TCheckModel) => {
|
|
|
+ state.currentType = 1;
|
|
|
+ state.tcheck_formData = row;
|
|
|
+ state.tcheck_dialog.title = "拷机计划";
|
|
|
+ state.tcheck_dialog.visible = true;
|
|
|
};
|
|
|
|
|
|
const handleSizeChange = (val: number) => {
|
|
@@ -161,7 +253,7 @@ const queryList = () => {
|
|
|
const { res, flag, errot } = result.data;
|
|
|
if (flag != undefined && flag == 1) {
|
|
|
const pageData = res as PageResult<TCheckModel[]>;
|
|
|
- state.tableData = pageData.list;
|
|
|
+ state.tcheck_tableData = pageData.list;
|
|
|
state.total = pageData.total;
|
|
|
} else {
|
|
|
}
|
|
@@ -176,14 +268,14 @@ const queryList = () => {
|
|
|
|
|
|
const submitForm = () => {
|
|
|
if (state.currentType == 0) {
|
|
|
- state.formData.createMan = "admin";
|
|
|
- TCheckAction.AddTCheck(state.formData).then((result) => {
|
|
|
+ state.tcheck_formData.createMan = localStorage.getItem("UserName") || "";
|
|
|
+ TCheckAction.AddTCheck(state.tcheck_formData).then((result) => {
|
|
|
ElMessage.success("新增成功");
|
|
|
cancel();
|
|
|
queryList();
|
|
|
});
|
|
|
- } else {
|
|
|
- TCheckAction.EditTCheck(state.formData).then((result) => {
|
|
|
+ } else if (state.currentType == 1) {
|
|
|
+ TCheckAction.EditTCheck(state.tcheck_formData).then((result) => {
|
|
|
ElMessage.success("编辑成功");
|
|
|
cancel();
|
|
|
queryList();
|
|
@@ -191,8 +283,8 @@ const submitForm = () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-const submitDeleteForm = (row: any) => {
|
|
|
- ElMessageBox.confirm(" 是否删除用户[" + row.userName + "]? ", "提示", {
|
|
|
+const submitDeleteForm = (row: TCheckModel) => {
|
|
|
+ ElMessageBox.confirm(" 是否拷机计划[" + row.checkName + "]? ", "提示", {
|
|
|
cancelButtonText: "取消",
|
|
|
confirmButtonText: "确认",
|
|
|
type: "warning",
|
|
@@ -204,6 +296,9 @@ const submitDeleteForm = (row: any) => {
|
|
|
queryList();
|
|
|
});
|
|
|
})
|
|
|
+ .then(() => {
|
|
|
+ queryList();
|
|
|
+ })
|
|
|
.catch(() => {
|
|
|
ElMessage({
|
|
|
type: "info",
|
|
@@ -212,13 +307,17 @@ const submitDeleteForm = (row: any) => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+//val =0 计划新增 =1 计划编辑 =2 明细新增 =3 明细编辑
|
|
|
const cancel = () => {
|
|
|
- dataFormRef.value.resetFields();
|
|
|
- state.formData = {} as TCheckModel;
|
|
|
- state.dialog.visible = false;
|
|
|
+ if (state.currentType === 0) {
|
|
|
+ state.tcheck_formData = {} as TCheckModel;
|
|
|
+ state.tcheck_dialog.visible = false;
|
|
|
+ } else if (state.currentType === 1) {
|
|
|
+ state.tcheck_formData = {} as TCheckModel;
|
|
|
+ state.tcheck_dialog.visible = false;
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
-
|
|
|
onMounted(() => {
|
|
|
window.onresize = function () {
|
|
|
tableHeight.value = document.documentElement.clientHeight - 275;
|