This commit is contained in:
‘937886381’ 2024-11-14 13:42:29 +08:00
parent 43d0a2668d
commit 511a00d0a3
2 changed files with 106 additions and 158 deletions

View File

@ -6,155 +6,95 @@
* @Description: * @Description:
--> -->
<template> <template>
<el-drawer <el-drawer :visible.sync="visible" :show-close="false" :wrapper-closable="true" :before-close="beforeClose"
:visible.sync="visible" class="drawer" size="60%">
:show-close="false" <small-title slot="title" :no-padding="true">
:wrapper-closable="true" {{ isdetail ? '详情' : !dataForm.id ? '新增' : '编辑' }}
:before-close="beforeClose" </small-title>
class="drawer" <div class="content">
size="60%"> <div class="visual-part">
<small-title slot="title" :no-padding="true"> <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
{{ isdetail ? '详情' : !dataForm.id ? '新增' : '编辑' }} label-width="100px" label-position="top">
</small-title> <el-row :gutter="20">
<div class="content"> <el-col :span="8">
<div class="visual-part"> <el-form-item label="巡检单名称" prop="name">
<el-form <el-input v-model="dataForm.name" :disabled="isdetail" placeholder="请输入巡检单名称" />
:model="dataForm" </el-form-item>
:rules="dataRule" </el-col>
ref="dataForm" <el-col :span="8">
@keyup.enter.native="dataFormSubmit()" <el-form-item label="部门" prop="departmentId">
label-width="100px" <el-select v-model="dataForm.departmentId" :disabled="isdetail" :placeholder="`请选择部门`"
label-position="top"> style="width: 100%">
<el-row :gutter="20"> <el-option v-for="opt in departmentOptions" :key="opt.id" :label="opt.name" :value="opt.id" />
<el-col :span="8"> </el-select>
<el-form-item label="巡检单名称" prop="name"> </el-form-item>
<el-input v-model="dataForm.name" :disabled="isdetail" placeholder="请输入巡检单名称" /> </el-col>
</el-form-item> <el-col :span="8">
</el-col> <el-form-item label="班次" prop="groupClass">
<el-col :span="8"> <el-select v-model="dataForm.groupClass" filterable clearable multiple :disabled="isdetail"
<el-form-item label="部门" prop="departmentId"> style="width: 100%" placeholder="请选择班次">
<el-select <el-option v-for="d in groupOptions" :key="d.id" :label="d.label" :value="d.label" />
v-model="dataForm.departmentId" </el-select>
:disabled="isdetail" </el-form-item>
:placeholder="`请选择部门`" </el-col>
style="width: 100%"> </el-row>
<el-option <el-row :gutter="20">
v-for="opt in departmentOptions" <el-col :span="8">
:key="opt.id" <el-form-item label="巡检人" prop="checkPerson">
:label="opt.name" <!-- <el-input v-model="dataForm.checkPerson" :disabled="isdetail" placeholder="请输入巡检人" /> -->
:value="opt.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="班次" prop="groupClass">
<el-select
v-model="dataForm.groupClass"
filterable
clearable
multiple
:disabled="isdetail"
style="width: 100%"
placeholder="请选择班次">
<el-option
v-for="d in groupOptions"
:key="d.id"
:label="d.label"
:value="d.label" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="巡检人" prop="checkPerson">
<el-select
v-model="dataForm.checkPerson"
:placeholder="`请选择巡检人`"
multiple
clearable
:disabled="isdetail"
filterable
style="width: 100%">
<el-option
v-for="opt in inspectorOptions"
:key="opt.value"
:label="opt.label"
:value="opt.label" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="实际巡检时间" prop="actualCheckTime">
<el-date-picker
v-model="dataForm.actualCheckTime"
type="datetime"
:disabled="isdetail"
placeholder="请选择实际巡检时间"
value-format="timestamp"
style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div v-if="idAttrShow"> <el-select v-model="dataForm.checkPerson" :placeholder="`请选择巡检人`" multiple clearable
<small-title> :disabled="isdetail" filterable style="width: 100%">
巡检内容 <el-option v-for="opt in inspectorOptions" :key="opt.value" :label="opt.label" :value="opt.label" />
</small-title> </el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="实际巡检时间" prop="actualCheckTime">
<el-date-picker v-model="dataForm.actualCheckTime" type="datetime" :disabled="isdetail"
placeholder="请选择实际巡检时间" value-format="timestamp" style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div v-if="!isdetail" style="display: flex"> <div v-if="idAttrShow">
<SearchBar <small-title>
:formConfigs="searchBarFormConfig" 巡检内容
ref="attr-search-bar" </small-title>
@headBtnClick="handleSearchBarBtnClick" />
<!-- <div class="action_btn"> -->
<el-button type="text" class="action_btn" @click="addNew()">
<span style="display: inline-block;">
<svg-icon style="width: 14px; height: 14px" class="item-icon" icon-class="table_add" />
<span class="add">添加内容</span>
</span>
</el-button>
<!-- </div> -->
</div>
<base-table
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="detList">
<method-btn
v-if="!isdetail"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
v-show="listQuery.total > 0"
:total="listQuery.total"
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:page-sizes="[5, 10, 15]"
@pagination="getList" />
</div>
</div> <div v-if="!isdetail" style="display: flex">
<SearchBar :formConfigs="searchBarFormConfig" ref="attr-search-bar" @headBtnClick="handleSearchBarBtnClick" />
<!-- <div class="action_btn"> -->
<el-button type="text" class="action_btn" @click="addNew()">
<span style="display: inline-block;">
<svg-icon style="width: 14px; height: 14px" class="item-icon" icon-class="table_add" />
<span class="add">添加内容</span>
</span>
</el-button>
<!-- </div> -->
</div>
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
:table-data="detList">
<method-btn v-if="!isdetail" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination v-show="listQuery.total > 0" :total="listQuery.total" :page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize" :page-sizes="[5, 10, 15]" @pagination="getList" />
</div>
<div v-if="!isdetail" class="drawer-body__footer"> </div>
<el-button @click="goback()">取消</el-button>
<!-- <el-button :disabled="isdetail" @click="init(dataForm.id)">重置</el-button> -->
<el-button v-if="isshowConfirm" type="primary" @click="confirmIns()">保存</el-button>
<el-button v-else type="primary" @click="dataFormSubmit()">保存</el-button>
</div>
<attr-add <div v-if="!isdetail" class="drawer-body__footer">
v-if="addOrUpdateVisible" <el-button @click="goback()">取消</el-button>
ref="addOrUpdate" <!-- <el-button :disabled="isdetail" @click="init(dataForm.id)">重置</el-button> -->
:order-id="dataForm.id" <el-button v-if="isshowConfirm" type="primary" @click="confirmIns()">保存</el-button>
@refreshDataList="getList" /> <el-button v-else type="primary" @click="dataFormSubmit()">保存</el-button>
</el-drawer> </div>
<attr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :order-id="dataForm.id" @refreshDataList="getList" />
</el-drawer>
</template> </template>
<script> <script>
@ -305,15 +245,15 @@ export default {
})) }))
); );
} }
const workerlist = await this.$axios('/base/core-worker/listAll'); // const workerlist = await this.$axios('/base/core-worker/listAll');
if (workerlist.code == 0) { // if (workerlist.code == 0) {
inspectorList = inspectorList.concat( // inspectorList = inspectorList.concat(
workerlist.data.map((item) => ({ // workerlist.data.map((item) => ({
label: item.name, // label: item.name,
value: item.id, // value: item.id,
})) // }))
); // );
} // }
this.inspectorOptions = inspectorList; this.inspectorOptions = inspectorList;
// const res1 = await groupClassesListAll(); // const res1 = await groupClassesListAll();
// this.groupOptions = res1.data || []; // this.groupOptions = res1.data || [];

View File

@ -17,7 +17,7 @@
<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="24"> <el-col :span="24">
<el-form-item label="默认巡检结果" prop="resultType"> <el-form-item label="默认巡检结果" prop="resultType">
<el-select v-model="dataForm.resultType" placeholder="请选择默认保养结果"> <el-select v-model="dataForm.resultType" placeholder="请选择默认保养结果" @change="handleClear">
<el-option v-for="dict in resultList" :key="dict.id" :label="dict.name" :value="dict.id" /> <el-option v-for="dict in resultList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -38,13 +38,16 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row v-else-if="dataForm.resultType === 2" :gutter="24"> <el-row v-else-if="dataForm.resultType === 2" :gutter="24">
<el-col :span="12"> <el-col :span="11">
<el-form-item prop="minValue"> <el-form-item prop="minValue">
<el-input oninput="value=value.replace(/[^\-\d.]/g, '')" v-model="dataForm.minValue" placeholder="请输入最小值" /> <el-input oninput="value=value.replace(/[^\-\d.]/g, '')" v-model="dataForm.minValue" placeholder="请输入最小值" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="4">
<el-form-item prop="maxValue">
</el-col>
<el-col :span="9">
<el-form-item prop="maxValue" label-width="20">
<el-input @change="handleChange" oninput="value=value.replace(/[^\-\d.]/g, '')" v-model="dataForm.maxValue" <el-input @change="handleChange" oninput="value=value.replace(/[^\-\d.]/g, '')" v-model="dataForm.maxValue"
placeholder="请输入最大值" /> placeholder="请输入最大值" />
</el-form-item> </el-form-item>
@ -113,7 +116,12 @@ export default {
this.getDict() this.getDict()
console.log('我看看', this.dataForm) console.log('我看看', this.dataForm)
}, },
methods: { methods: {
handleClear() {
this.dataForm.minValue = undefined
this.dataForm.maxValue = undefined
this.dataForm.maintainResult = undefined
},
async getDict() { async getDict() {
// //
const res = await getList(); const res = await getList();