2024-06-12 设备-检查项维护-导入

yangwl
A0010407 6 months ago
parent bae166014b
commit 52e26a4b28

@ -1,6 +1,13 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px"> <el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="90px"
>
<el-form-item label="检查项编码" prop="itemCode"> <el-form-item label="检查项编码" prop="itemCode">
<el-input <el-input
v-model="queryParams.itemCode" v-model="queryParams.itemCode"
@ -34,7 +41,11 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="维护类型" prop="itemType"> <el-form-item label="维护类型" prop="itemType">
<el-select v-model="queryParams.itemType" placeholder="请选择维护类型" clearable> <el-select
v-model="queryParams.itemType"
placeholder="请选择维护类型"
clearable
>
<el-option <el-option
v-for="dict in dict.type.device_item_type" v-for="dict in dict.type.device_item_type"
:key="dict.value" :key="dict.value"
@ -119,7 +130,8 @@
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
:picker-options="pickerOptions"> :picker-options="pickerOptions"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="更新人" prop="updateBy"> <el-form-item label="更新人" prop="updateBy">
@ -141,12 +153,21 @@
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
:picker-options="pickerOptions"> :picker-options="pickerOptions"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></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-item>
</el-form> </el-form>
@ -197,44 +218,153 @@
>导出 >导出
</el-button> </el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <el-col :span="1.5">
<div>
<el-button
type="warning"
plain
icon="el-icon-upload2"
size="mini"
@click="handleImport"
v-hasPermi="['device:item:import']"
>导入</el-button
>
</div>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="itemList" @selection-change="handleSelectionChange"> <el-table
<el-table-column type="selection" width="55" align="center"/> v-loading="loading"
<el-table-column v-if="false" label="主键" align="center" prop="itemId"/> :data="itemList"
<el-table-column width="60" align="center" label="序号" type="index"></el-table-column> @selection-change="handleSelectionChange"
<el-table-column width="120" label="检查项编码" align="center" prop="itemCode"/> >
<el-table-column width="200" label="部位" align="left" prop="itemName"/> <el-table-column type="selection" width="55" align="center" />
<el-table-column width="150" label="方法" align="left" prop="itemMethod"/> <el-table-column v-if="false" label="主键" align="center" prop="itemId" />
<el-table-column width="150" label="工具" align="left" prop="itemTools"/> <el-table-column
<el-table-column width="80" label="周期" align="center" prop="itemLoop"/> width="60"
<el-table-column width="80" label="周期类型" align="center" prop="itemLoopType"> align="center"
label="序号"
type="index"
></el-table-column>
<el-table-column
width="120"
label="检查项编码"
align="center"
prop="itemCode"
/>
<el-table-column width="200" label="部位" align="left" prop="itemName" />
<el-table-column
width="150"
label="方法"
align="left"
prop="itemMethod"
/>
<el-table-column width="150" label="工具" align="left" prop="itemTools" />
<el-table-column width="80" label="周期" align="center" prop="itemLoop" />
<el-table-column
width="80"
label="周期类型"
align="center"
prop="itemLoopType"
>
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.device_loop_type" :value="scope.row.itemLoopType"/> <dict-tag
:options="dict.type.device_loop_type"
:value="scope.row.itemLoopType"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column width="120" label="维护类型编码" align="center" prop="itemType"/> <el-table-column
<el-table-column width="120" label="维护类型" align="center" prop="itemTypeName"/> width="120"
<el-table-column width="200" label="备注" align="center" prop="itemRemark"/> label="维护类型编码"
<el-table-column v-if="false" label="工厂" align="center" prop="factoryCode"/> align="center"
<el-table-column v-if="false" label="备用字段1" align="center" prop="attr1"/> prop="itemType"
<el-table-column v-if="false" label="备用字段2" align="center" prop="attr2"/> />
<el-table-column v-if="false" label="备用字段3" align="center" prop="attr3"/> <el-table-column
<el-table-column v-if="false" label="删除标识" align="center" prop="delFlag"/> width="120"
<el-table-column width="180" label="创建时间" align="center" prop="createTime"> label="维护类型"
align="center"
prop="itemTypeName"
/>
<el-table-column
width="200"
label="备注"
align="center"
prop="itemRemark"
/>
<el-table-column
v-if="false"
label="工厂"
align="center"
prop="factoryCode"
/>
<el-table-column
v-if="false"
label="备用字段1"
align="center"
prop="attr1"
/>
<el-table-column
v-if="false"
label="备用字段2"
align="center"
prop="attr2"
/>
<el-table-column
v-if="false"
label="备用字段3"
align="center"
prop="attr3"
/>
<el-table-column
v-if="false"
label="删除标识"
align="center"
prop="delFlag"
/>
<el-table-column
width="180"
label="创建时间"
align="center"
prop="createTime"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column width="120" label="创建人" align="center" prop="createBy"/> <el-table-column
<el-table-column width="180" label="更新时间" align="center" prop="updateTime"> width="120"
label="创建人"
align="center"
prop="createBy"
/>
<el-table-column
width="180"
label="更新时间"
align="center"
prop="updateTime"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.updateTime, "{y}-{m}-{d}") }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column width="120" label="更新人" align="center" prop="updateBy"/> <el-table-column
<el-table-column width="180" label="操作" align="center" class-name="small-padding fixed-width" fixed="right"> width="120"
label="更新人"
align="center"
prop="updateBy"
/>
<el-table-column
width="180"
label="操作"
align="center"
class-name="small-padding fixed-width"
fixed="right"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
@ -257,7 +387,7 @@
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@ -265,7 +395,13 @@
/> />
<!-- 添加或修改检查项维护对话框 --> <!-- 添加或修改检查项维护对话框 -->
<el-dialog v-loading="itemLoading" :title="title" :visible.sync="open" width="1000px" append-to-body> <el-dialog
v-loading="itemLoading"
:title="title"
:visible.sync="open"
width="1000px"
append-to-body
>
<el-tabs v-model="activePage" type="border-card"> <el-tabs v-model="activePage" type="border-card">
<el-tab-pane name="check" label="标准配置"> <el-tab-pane name="check" label="标准配置">
<el-form ref="form" :model="form" :rules="rules" label-width="90px"> <el-form ref="form" :model="form" :rules="rules" label-width="90px">
@ -274,13 +410,20 @@
<!-- 第一列 --> <!-- 第一列 -->
<el-col :span="10"> <el-col :span="10">
<el-form-item label="检查项"> <el-form-item label="检查项">
<el-input v-model="form.itemName" placeholder="请输入检查项"></el-input> <el-input
v-model="form.itemName"
placeholder="请输入检查项"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 第二列 --> <!-- 第二列 -->
<el-col :span="8" :offset="1"> <el-col :span="8" :offset="1">
<el-form-item label="维护类型"> <el-form-item label="维护类型">
<el-select v-model="form.itemType" placeholder="请选择维护类型" clearable> <el-select
v-model="form.itemType"
placeholder="请选择维护类型"
clearable
>
<el-option <el-option
v-for="dict in dict.type.device_item_type" v-for="dict in dict.type.device_item_type"
:key="dict.value" :key="dict.value"
@ -294,19 +437,28 @@
<el-row> <el-row>
<el-col :span="10"> <el-col :span="10">
<el-form-item label="方法"> <el-form-item label="方法">
<el-input v-model="form.itemMethod" placeholder="请输入检查方法"></el-input> <el-input
v-model="form.itemMethod"
placeholder="请输入检查方法"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8" :offset="1"> <el-col :span="8" :offset="1">
<el-form-item label="工具"> <el-form-item label="工具">
<el-input v-model="form.itemTools" placeholder="请输入检查工具"></el-input> <el-input
v-model="form.itemTools"
placeholder="请输入检查工具"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="循环周期" prop="planLoop"> <el-form-item label="循环周期" prop="planLoop">
<el-input-number v-model="form.itemLoop" label=""></el-input-number> <el-input-number
v-model="form.itemLoop"
label=""
></el-input-number>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
@ -327,8 +479,12 @@
<el-row> <el-row>
<el-col :span="7"> <el-col :span="7">
<el-form-item label="标准类型"> <el-form-item label="标准类型">
<el-radio v-model="item.standardType" label="qualitative"></el-radio> <el-radio v-model="item.standardType" label="qualitative"
<el-radio v-model="item.standardType" label="quantify"></el-radio> >定性</el-radio
>
<el-radio v-model="item.standardType" label="quantify"
>定量</el-radio
>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -336,14 +492,29 @@
<el-row v-if="item.standardType === 'qualitative'"> <el-row v-if="item.standardType === 'qualitative'">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="标准名称"> <el-form-item label="标准名称">
<el-input type="textarea" autosize v-model="item.standardName" placeholder="请输入标准名称"></el-input> <el-input
type="textarea"
autosize
v-model="item.standardName"
placeholder="请输入标准名称"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 操作 --> <!-- 操作 -->
<el-col :span="4" class="my-dynamic-btn"> <el-col :span="4" class="my-dynamic-btn">
<el-button size="small" v-if="formStandard.length > 1" @click="removeStandard(index)" type="danger"> <el-button
size="small"
v-if="formStandard.length > 1"
@click="removeStandard(index)"
type="danger"
>删除
</el-button> </el-button>
<el-button size="small" v-if="index === formStandard.length - 1" @click="addStandard" type="primary"> <el-button
size="small"
v-if="index === formStandard.length - 1"
@click="addStandard"
type="primary"
>
添加 添加
</el-button> </el-button>
</el-col> </el-col>
@ -351,29 +522,61 @@
<el-row v-else> <el-row v-else>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="标准名称"> <el-form-item label="标准名称">
<el-input type="textarea" autosize v-model="item.standardName" placeholder="请输入标准名称"></el-input> <el-input
type="textarea"
autosize
v-model="item.standardName"
placeholder="请输入标准名称"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label-width="50px" label="上限"> <el-form-item label-width="50px" label="上限">
<el-input v-model="item.detailUpLimit" step="0.01" type="number" maxlength="9" oninput="value=value.replace(/[^\d.]/g, '')" placeholder="请输入上限"></el-input> <el-input
v-model="item.detailUpLimit"
step="0.01"
type="number"
maxlength="9"
oninput="value=value.replace(/[^\d.]/g, '')"
placeholder="请输入上限"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label-width="50px" label="下限"> <el-form-item label-width="50px" label="下限">
<el-input v-model="item.detailDownLimit" step="0.01" type="number" maxlength="9" oninput="value=value.replace(/[^\d.]/g, '')" placeholder="请输入下限"></el-input> <el-input
v-model="item.detailDownLimit"
step="0.01"
type="number"
maxlength="9"
oninput="value=value.replace(/[^\d.]/g, '')"
placeholder="请输入下限"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :offset="1" :span="6"> <el-col :offset="1" :span="6">
<el-form-item label-width="50px" label="单位"> <el-form-item label-width="50px" label="单位">
<el-input v-model="item.detailUnit" placeholder="请输入单位"></el-input> <el-input
v-model="item.detailUnit"
placeholder="请输入单位"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 操作 --> <!-- 操作 -->
<el-col :span="6" class="my-dynamic-btn"> <el-col :span="6" class="my-dynamic-btn">
<el-button size="small" v-if="formStandard.length > 1" @click="removeStandard(index)" type="danger"> <el-button
size="small"
v-if="formStandard.length > 1"
@click="removeStandard(index)"
type="danger"
>删除
</el-button> </el-button>
<el-button size="small" v-if="index === formStandard.length - 1" @click="addStandard" type="primary"> <el-button
size="small"
v-if="index === formStandard.length - 1"
@click="addStandard"
type="primary"
>
添加 添加
</el-button> </el-button>
</el-col> </el-col>
@ -381,7 +584,10 @@
</div> </div>
<!-- 备注 --> <!-- 备注 -->
<el-form-item label="备注"> <el-form-item label="备注">
<el-input v-model="form.itemRemark" placeholder="请输入备注"></el-input> <el-input
v-model="form.itemRemark"
placeholder="请输入备注"
></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-tab-pane> </el-tab-pane>
@ -389,12 +595,13 @@
<el-row> <el-row>
<el-col :span="24" :offset="1"> <el-col :span="24" :offset="1">
<el-transfer <el-transfer
:titles="['设备列表','已关联设备']" :titles="['设备列表', '已关联设备']"
filterable filterable
:filter-method="filterMethod" :filter-method="filterMethod"
filter-placeholder="请输入设备名称" filter-placeholder="请输入设备名称"
v-model="selectEquipmentList" v-model="selectEquipmentList"
:data="equipmentList"> :data="equipmentList"
>
</el-transfer> </el-transfer>
</el-col> </el-col>
</el-row> </el-row>
@ -405,6 +612,44 @@
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 用户导入对话框 -->
<el-dialog
:title="upload.title"
:visible.sync="upload.open"
width="400px"
append-to-body
>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<span>仅允许导入xlsxlsx格式文件</span>
<el-link
type="primary"
:underline="false"
style="font-size: 12px; vertical-align: baseline"
@click="importTemplate"
>下载模板
</el-link>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm"> </el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
@ -418,54 +663,80 @@ import {
addItem, addItem,
updateItem, updateItem,
} from "@/api/device/item"; } from "@/api/device/item";
import { Loading } from 'element-ui'; import { Loading } from "element-ui";
import { getToken } from "@/utils/auth";
export default { export default {
name: "Item", name: "Item",
dicts: ['device_item_type','device_loop_type'], dicts: ["device_item_type", "device_loop_type"],
data() { data() {
return { return {
activePage: 'check', //
upload: {
//
open: false,
//
title: "",
//
isUploading: false,
//
updateSupport: 0,
//
headers: {
poolName: localStorage.getItem("USER_POOL_NAME_CURRENT"),
Authorization: "Bearer " + getToken(),
},
//
url: process.env.VUE_APP_BASE_API + "/device/item/importFile",
},
activePage: "check",
// //
itemLoading: false, itemLoading: false,
// 穿 // 穿
equipmentList: [], equipmentList: [],
selectEquipmentList: [], selectEquipmentList: [],
// //
formStandard: [{ formStandard: [
standardType: 'qualitative', {
standardType: "qualitative",
standardName: null, standardName: null,
detailUpLimit: null, detailUpLimit: null,
detailDownLimit: null, detailDownLimit: null,
detailUnit: null, detailUnit: null,
}], },
],
// //
pickerOptions: { pickerOptions: {
shortcuts: [{ shortcuts: [
text: '最近一周', {
text: "最近一周",
onClick(picker) { onClick(picker) {
const end = new Date(); const end = new Date();
const start = new Date(); const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7); start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', [start, end]); picker.$emit("pick", [start, end]);
} },
}, { },
text: '最近一个月', {
text: "最近一个月",
onClick(picker) { onClick(picker) {
const end = new Date(); const end = new Date();
const start = new Date(); const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit('pick', [start, end]); picker.$emit("pick", [start, end]);
} },
}, { },
text: '最近三个月', {
text: "最近三个月",
onClick(picker) { onClick(picker) {
const end = new Date(); const end = new Date();
const start = new Date(); const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90); start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
picker.$emit('pick', [start, end]); picker.$emit("pick", [start, end]);
} },
}] },
],
}, },
// //
loading: true, loading: true,
@ -492,9 +763,9 @@ export default {
itemCode: null, itemCode: null,
itemName: null, itemName: null,
itemMethod: null, itemMethod: null,
itemTools:null, itemTools: null,
itemLoop:null, itemLoop: null,
itemLoopType:null, itemLoopType: null,
itemType: null, itemType: null,
itemTypeName: null, itemTypeName: null,
itemRemark: null, itemRemark: null,
@ -512,9 +783,9 @@ export default {
}, },
// //
form: { form: {
itemTools:null, itemTools: null,
itemLoop:null, itemLoop: null,
itemLoopType:null, itemLoopType: null,
itemName: null, itemName: null,
itemType: null, itemType: null,
itemMethod: null, itemMethod: null,
@ -523,7 +794,7 @@ export default {
equipmentCodeList: [], equipmentCodeList: [],
}, },
// //
rules: {} rules: {},
}; };
}, },
created() { created() {
@ -532,12 +803,16 @@ export default {
methods: { methods: {
// List-穿 // List-穿
setTransfer() { setTransfer() {
getEquipmentList().then(response => { getEquipmentList().then((response) => {
for (let i = 0; i < response.data.length; i++) { for (let i = 0; i < response.data.length; i++) {
this.equipmentList.push({ this.equipmentList.push({
label: response.data[i].equipmentName + '(' + response.data[i].equipmentCode + ')', label:
response.data[i].equipmentName +
"(" +
response.data[i].equipmentCode +
")",
key: response.data[i].equipmentCode, key: response.data[i].equipmentCode,
}) });
} }
}); });
}, },
@ -547,21 +822,21 @@ export default {
// //
addStandard() { addStandard() {
this.formStandard.push({ this.formStandard.push({
standardType: 'qualitative', standardType: "qualitative",
standardName: null, standardName: null,
detailUpLimit: null, detailUpLimit: null,
detailDownLimit: null, detailDownLimit: null,
detailUnit: null, detailUnit: null,
}) });
}, },
// //
removeStandard(index) { removeStandard(index) {
this.formStandard.splice(index, 1) this.formStandard.splice(index, 1);
}, },
/** 查询检查项维护列表 */ /** 查询检查项维护列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listItem(this.queryParams).then(response => { listItem(this.queryParams).then((response) => {
this.itemList = response.rows; this.itemList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
@ -592,15 +867,17 @@ export default {
updateTime: null, updateTime: null,
updateBy: null, updateBy: null,
formStandard: [], formStandard: [],
itemTools:null, itemTools: null,
}; };
this.formStandard = [{ this.formStandard = [
standardType: 'qualitative', {
standardType: "qualitative",
standardName: null, standardName: null,
detailUpLimit: null, detailUpLimit: null,
detailDownLimit: null, detailDownLimit: null,
detailUnit: null, detailUnit: null,
}]; },
];
this.selectEquipmentList = []; this.selectEquipmentList = [];
this.equipmentList = []; this.equipmentList = [];
this.resetForm("form"); this.resetForm("form");
@ -621,17 +898,17 @@ export default {
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.itemId) this.ids = selection.map((item) => item.itemId);
this.single = selection.length !== 1 this.single = selection.length !== 1;
this.multiple = !selection.length this.multiple = !selection.length;
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.setTransfer(); this.setTransfer();
this.form.itemLoop = 1; this.form.itemLoop = 1;
this.form.itemLoopType = 'day'; this.form.itemLoopType = "day";
this.activePage = 'check'; this.activePage = "check";
this.open = true; this.open = true;
this.title = "新增检查项"; this.title = "新增检查项";
}, },
@ -639,16 +916,16 @@ export default {
handleUpdate(row) { handleUpdate(row) {
this.loading = true; this.loading = true;
this.reset(); this.reset();
this.activePage = 'check'; this.activePage = "check";
this.setTransfer(); this.setTransfer();
const itemId = row.itemId || this.ids const itemId = row.itemId || this.ids;
getItem(itemId).then(response => { getItem(itemId).then((response) => {
this.form = response.data; this.form = response.data;
getEquipmentCodeList(row.itemCode).then(response => { getEquipmentCodeList(row.itemCode).then((response) => {
for (let i = 0; i < response.data.length; i++) { for (let i = 0; i < response.data.length; i++) {
this.selectEquipmentList.push(response.data[i]); this.selectEquipmentList.push(response.data[i]);
} }
}) });
this.formStandard = response.data.formStandard; this.formStandard = response.data.formStandard;
this.loading = false; this.loading = false;
@ -662,23 +939,23 @@ export default {
if (this.form.itemName == null) { if (this.form.itemName == null) {
this.$message({ this.$message({
message: "请输入检查项名称!", message: "请输入检查项名称!",
type: "warning" type: "warning",
}) });
return return;
} }
if (this.form.itemType == null) { if (this.form.itemType == null) {
this.$message({ this.$message({
message: "请选择维护类型!", message: "请选择维护类型!",
type: "warning" type: "warning",
}) });
return return;
} }
if (this.form.itemMethod == null) { if (this.form.itemMethod == null) {
this.$message({ this.$message({
message: "请输入检查方法!", message: "请输入检查方法!",
type: "warning" type: "warning",
}) });
return return;
} }
// if (this.selectEquipmentList.length == 0) { // if (this.selectEquipmentList.length == 0) {
// this.$message({ // this.$message({
@ -689,55 +966,55 @@ export default {
// } // }
for (let i = 0; i < this.formStandard.length; i++) { for (let i = 0; i < this.formStandard.length; i++) {
// //
if (this.formStandard[i].standardType == 'qualitative') { if (this.formStandard[i].standardType == "qualitative") {
if (this.formStandard[i].standardName == null) { if (this.formStandard[i].standardName == null) {
this.$message({ this.$message({
message: "请输入标准名称!", message: "请输入标准名称!",
type: "warning" type: "warning",
}) });
return return;
} }
} }
// //
if (this.formStandard[i].standardType == 'quantify') { if (this.formStandard[i].standardType == "quantify") {
if (this.formStandard[i].standardName == null) { if (this.formStandard[i].standardName == null) {
this.$message({ this.$message({
message: "请输入标准名称!", message: "请输入标准名称!",
type: "warning" type: "warning",
}) });
return return;
} }
if (this.formStandard[i].detailUpLimit == null) { if (this.formStandard[i].detailUpLimit == null) {
this.$message({ this.$message({
message: "请输入上限!", message: "请输入上限!",
type: "warning" type: "warning",
}) });
return return;
} }
if (this.formStandard[i].detailDownLimit == null) { if (this.formStandard[i].detailDownLimit == null) {
this.$message({ this.$message({
message: "请输入下限!", message: "请输入下限!",
type: "warning" type: "warning",
}) });
return return;
} }
if (this.formStandard[i].detailUnit == null) { if (this.formStandard[i].detailUnit == null) {
this.$message({ this.$message({
message: "请输入单位!", message: "请输入单位!",
type: "warning" type: "warning",
}) });
return return;
} }
} }
} }
this.$refs["form"].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
this.itemLoading = true; this.itemLoading = true;
if (this.form.itemId != null) { if (this.form.itemId != null) {
this.form.formStandard = this.formStandard; this.form.formStandard = this.formStandard;
this.form.equipmentCodeList = this.selectEquipmentList; this.form.equipmentCodeList = this.selectEquipmentList;
updateItem(this.form).then(response => { updateItem(this.form).then((response) => {
this.itemLoading = false; this.itemLoading = false;
if (response.code != 500) { if (response.code != 500) {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
@ -748,9 +1025,9 @@ export default {
} else { } else {
this.form.formStandard = this.formStandard; this.form.formStandard = this.formStandard;
this.form.equipmentCodeList = this.selectEquipmentList; this.form.equipmentCodeList = this.selectEquipmentList;
addItem(this.form).then(response => { addItem(this.form).then((response) => {
this.itemLoading = false; this.itemLoading = false;
if (response.code != 500){ if (response.code != 500) {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
@ -764,17 +1041,17 @@ export default {
handleDelete(row) { handleDelete(row) {
const itemIds = row.itemId || this.ids; const itemIds = row.itemId || this.ids;
var itemCodes = ''; var itemCodes = "";
// //
for (let i = 0; i < this.itemList.length; i++) { for (let i = 0; i < this.itemList.length; i++) {
for (let j = 0; j < itemIds.length; j++) { for (let j = 0; j < itemIds.length; j++) {
if (itemIds[j] == this.itemList[i].itemId) { if (itemIds[j] == this.itemList[i].itemId) {
itemCodes = itemCodes + this.itemList[i].itemCode + ','; itemCodes = itemCodes + this.itemList[i].itemCode + ",";
} }
} }
} }
if (itemCodes == '') { if (itemCodes == "") {
for (let i = 0; i < this.itemList.length; i++) { for (let i = 0; i < this.itemList.length; i++) {
if (itemIds == this.itemList[i].itemId) { if (itemIds == this.itemList[i].itemId) {
itemCodes = this.itemList[i].itemCode; itemCodes = this.itemList[i].itemCode;
@ -782,24 +1059,72 @@ export default {
} }
} }
this.$modal.confirm('是否确认删除检查项维护编号为"' + itemCodes + '"的数据项?').then(function () { this.$modal
.confirm('是否确认删除检查项维护编号为"' + itemCodes + '"的数据项?')
.then(function () {
return delItem(itemIds); return delItem(itemIds);
}).then(response => { })
.then((response) => {
if (response.code != 500) { if (response.code != 500) {
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
this.getList(); this.getList();
} }
}).catch(() => { })
}); .catch(() => {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('device/item/export', { this.download(
...this.queryParams "device/item/export",
}, `item_${new Date().getTime()}.xlsx`) {
} ...this.queryParams,
} },
`item_${new Date().getTime()}.xlsx`
);
},
// -
handleImport() {
console.log("导入按钮");
this.upload.title = "检查项导入";
this.upload.open = true;
},
// -
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
// -
handleFileSuccess(response, file, fileList) {
debugger;
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert(
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
response.msg +
"</div>",
"导入结果",
{ dangerouslyUseHTMLString: true }
);
this.getList();
},
// -
submitFileForm() {
this.$refs.upload.submit();
},
// -
importTemplate() {
this.download(
"/device/item/importTemplate",
{},
`item_template_${new Date().getTime()}.xlsx`
);
},
},
}; };
</script> </script>
<style> <style>

Loading…
Cancel
Save