This commit is contained in:
gtz
2022-11-07 08:45:49 +08:00
commit 4d1231adc2
1222 changed files with 194552 additions and 0 deletions

View File

@@ -0,0 +1,390 @@
<template>
<el-dialog :visible.sync="visible" :title="(!dataForm.id ? 'btn.add' : (isDetail ? 'btn.detail' :'btn.edit')) | i18nFilter" class="dialog" @close="close">
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="80px"
@keyup.enter.native="dataFormSubmit()"
>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item
:label="this.$t('module.equipmentManager.inspectionManage.equipmentName')"
prop="equipmentId"
>
<el-select
v-model="dataForm.equipmentId"
filterable
:placeholder="this.$t('module.equipmentManager.inspectionManage.equipmentName')"
:disabled="isDetail || (dataForm.id ? true : false)"
@change="selectOrder()"
>
<el-option
v-for="item in list"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('module.equipmentManager.inspectionManage.equipmentCode')" prop="equipmentCode">
<el-input
v-model="dataForm.equipmentCode"
:placeholder="$i18nForm(['placeholder.input', $t('module.equipmentManager.inspectionManage.equipmentCode')])"
clearable
disabled
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item :label="$t('module.equipmentManager.inspectionManage.inspectionWorker')" prop="inspectionWorker">
<el-input
v-model="dataForm.inspectionWorker"
:placeholder="$i18nForm(['placeholder.input', $t('module.equipmentManager.inspectionManage.inspectionWorkerTip')])"
:disabled="isDetail"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('module.basicData.knowledge.time')" prop="timeStr">
<el-date-picker
v-model="dataForm.timeStr"
type="datetimerange"
range-separator="-"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-ddTHH:mm:ss"
:start-placeholder="$t('module.basicData.knowledge.startTime')"
:end-placeholder="$t('module.basicData.knowledge.endTime')"
:disabled="isDetail"
style="width:384px"
@change="selectSource"
@input="selectSource"
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item :label="$t('module.equipmentManager.inspectionManage.source')" prop="source">
<el-select
v-model="dataForm.source"
filterable
:placeholder="this.$t('module.equipmentManager.inspectionManage.source')"
:disabled="isDetail"
@change="selectSource"
>
<el-option
v-for="item in sourceList"
:key="item.dataCode"
:label="item.dataName"
:value="item.dataCode"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
v-if="dataForm.id ? false : true"
:label="this.$t('module.equipmentManager.inspectionManage.inspectionItem')"
prop="id"
>
<el-select
v-model="dataForm.itemList"
filterable
multiple
:placeholder="this.$t('module.equipmentManager.inspectionManage.inspectionItem')"
>
<el-option
v-for="item in itemList"
:key="item.id"
:label="item.inspectionItem"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="24">
<el-form-item :label="$t('module.equipmentManager.inspectionManage.totalDetail')" prop="inspectionWorker">
<el-input
v-model="dataForm.inspectionDesc"
type="textarea"
:autosize="{ minRows: 4, maxRows: 8}"
:placeholder="$i18nForm(['placeholder.input', $t('module.equipmentManager.inspectionManage.totalDetail')])"
:disabled="isDetail"
clearable
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="24">
<el-form-item :label="$t('module.basicData.knowledge.annex')">
<el-upload
v-if="!isDetail"
:multiple="false"
:data="dataObj"
name="files"
:headers="{ token }"
:on-success="succrssFun"
:on-error="errorFun"
:action="uploadPath"
:before-upload="annexBeforeUpload"
:show-file-list="false"
style="display: inline-block"
>
<el-button type="primary" :loading="showLoading">{{ 'btn.upload' | i18nFilter }}</el-button>
</el-upload>
<span v-if="dataForm.annexUrl" style="cursor: pointer; margin-left:20px;" @click="downloadFile">{{ $t('module.basicData.knowledge.download') }}</span>
</el-form-item>
</el-col>
</el-row>
<el-row style="text-align: right">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button v-if="!isDetail" type="primary" @click="dataFormSubmit()">{{ 'btn.save' | i18nFilter }}</el-button>
</el-row>
</el-form>
</el-dialog>
</template>
<script>
import { equipmentList, einspectionLog, geteinspectionLog, einspectionLogU, eInspectionItem, inspectionItemList } from '@/api/equipment/inspectionManager'
import { uploadPath } from '@/api/basic'
import { getToken } from '@/utils/auth'
export default {
data() {
return {
visible: false,
dataObj: { typeCode: 'file' },
uploadPath,
token: getToken(),
showLoading: false,
list: [],
itemList: [],
selectedItem: [],
sourceList: JSON.parse(localStorage.getItem('dictObj'))['1523941494259912706'],
dataForm: {
id: '',
equipmentId: '',
equipmentCode: '',
inspectionWorker: '',
timeStr: [],
inspectionEndTime: '',
inspectionStartTime: '',
source: '',
itemList: [],
inspectionDesc: '',
annexUrl: ''
},
dataRule: {
equipmentId: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.equipmentManager.inspectionManage.equipmentName')]),
trigger: 'blur'
}
]
},
isSubmit: true, // 是否允许提交,如果该设备未关联巡检项目不允许提交
isDetail: false // 详情(true)的话将输入框disabled的
}
},
methods: {
init(id, name) {
this.visible = true
this.getEquipmentList()
if (name === 'detail' || name === 'edit') {
this.dataForm.id = id
geteinspectionLog({
id: this.dataForm.id
}).then(res => {
if (res.data) {
this.dataForm = res.data
this.dataForm.source = res.data.source ? res.data.source + '' : ''
if (this.dataForm.inspectionStartTime && this.dataForm.inspectionEndTime) {
const arr = []
arr.push(this.dataForm.inspectionStartTime)
arr.push(this.dataForm.inspectionEndTime)
this.dataForm.timeStr = arr
}
}
})
}
if (name === 'detail') {
this.isDetail = true
} else if (name === 'edit') {
this.isSubmit = true
}
},
getEquipmentList() {
equipmentList({
current: 1,
size: 999
}).then(res => {
if (res.data) {
this.list = res.data
} else {
this.list = []
}
})
inspectionItemList({
current: 1,
size: 999,
type: 1
}).then(res => {
if (res.data) {
this.itemList = res.data
} else {
this.itemList = []
}
})
},
selectOrder() {
this.list.map(item => {
if (item.id === this.dataForm.equipmentId) {
this.dataForm.equipmentCode = item.code
}
})
eInspectionItem({
equipmentId: this.dataForm.equipmentId
}).then(res => {
if (res.data && res.data.length === 0) {
this.isSubmit = false
this.$message({
message: this.$t('module.equipmentManager.inspectionManage.einspectionLogTip'),
type: 'warning',
duration: 2000
})
} else {
const arr = res.data
this.isSubmit = true
this.selectedItem = []
arr.map(item => {
this.selectedItem.push(item.itemId)
})
}
})
},
selectSource() {
this.$forceUpdate()
},
annexBeforeUpload(file) {
const isRightSize = file.size / 1024 / 1024 < 10
if (!isRightSize) {
this.$message({
type: 'error',
message: this.$t('module.equipmentManager.inspectionManage.uploadError')
})
}
this.showLoading = true
return isRightSize
},
succrssFun(res) {
this.showLoading = false
if (res.code === 0) {
this.dataForm.annexUrl = res.data[0].id
} else {
this.$message({
type: 'error',
message: this.$t('module.equipmentManager.inspectionManage.uploadErrorTip')
})
}
},
errorFun() {
this.showLoading = false
},
downloadFile() {
window.open(`${location.origin}/api/common/attachment/downloadFile?type=file&attachmentId=${this.dataForm.annexUrl}`)
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate(valid => {
if (!this.isSubmit) {
this.$message({
message: this.$t('module.equipmentManager.inspectionManage.einspectionLogTip'),
type: 'warning',
duration: 2000
})
return false
}
if (valid) {
this.dataForm.inspectionEndTime = this.dataForm.timeStr.length > 0 ? this.dataForm.timeStr[1] : ''
this.dataForm.inspectionStartTime = this.dataForm.timeStr.length > 0 ? this.dataForm.timeStr[0] : ''
if (this.dataForm.id) {
einspectionLogU({
id: this.dataForm.id,
equipmentId: this.dataForm.equipmentId,
annexUrl: this.dataForm.annexUrl,
inspectionDesc: this.dataForm.inspectionDesc,
inspectionEndTime: this.dataForm.inspectionEndTime,
inspectionStartTime: this.dataForm.inspectionStartTime,
inspectionWorker: this.dataForm.inspectionWorker,
source: this.dataForm.source
}).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.close()
this.$emit('refreshDataList')
}
})
})
} else {
einspectionLog({
equipmentId: this.dataForm.equipmentId,
annexUrl: this.dataForm.annexUrl,
inspectionDesc: this.dataForm.inspectionDesc,
inspectionEndTime: this.dataForm.inspectionEndTime,
inspectionStartTime: this.dataForm.inspectionStartTime,
inspectionWorker: this.dataForm.inspectionWorker,
source: this.dataForm.source,
itemList: this.dataForm.itemList.concat(this.selectedItem)
}).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.close()
this.$emit('refreshDataList')
}
})
})
}
}
})
},
close() {
this.dataForm.id = ''
this.dataForm.equipmentId = ''
this.dataForm.equipmentCode = ''
this.dataForm.inspectionWorker = ''
this.dataForm.timeStr = []
this.dataForm.inspectionEndTime = ''
this.dataForm.inspectionStartTime = ''
this.dataForm.source = ''
this.dataForm.itemList = []
this.dataForm.inspectionDesc = ''
this.dataForm.annexUrl = ''
this.selectedItem = []
this.isDetail = false
this.visible = false
}
}
}
</script>
<style scoped>
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
</style>

View File

@@ -0,0 +1,186 @@
<template>
<el-dialog :visible.sync="visible" :title="(isDetail ? 'btn.detail' : 'btn.edit') | i18nFilter" class="dialog" @close="close">
<el-form
ref="dataForm"
:model="dataForm"
label-width="100px"
@keyup.enter.native="dataFormSubmit()"
>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item
:label="this.$t('module.equipmentManager.inspectionManage.inspectionContent')"
prop="inspectionContent"
>
<el-input
v-model="dataForm.inspectionContent"
:placeholder="$i18nForm(['placeholder.input', $t('module.equipmentManager.inspectionManage.inspectionContent')])"
clearable
disabled
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('module.equipmentManager.inspectionManage.inspectionContentCode')" prop="inspectionItem">
<el-input
v-model="dataForm.inspectionItem"
:placeholder="$i18nForm(['placeholder.input', $t('module.equipmentManager.inspectionManage.inspectionContentCode')])"
clearable
disabled
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="24">
<el-form-item :label="$t('module.equipmentManager.inspectionManage.detailrecord')" prop="description">
<el-input
v-model="dataForm.description"
type="textarea"
:autosize="{ minRows: 4, maxRows: 8}"
:placeholder="$i18nForm(['placeholder.input', $t('module.equipmentManager.inspectionManage.detailrecord')])"
clearable
:disabled="isDetail"
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="24">
<el-form-item :label="$t('module.basicData.knowledge.annex')">
<el-upload
v-if="!isDetail"
:multiple="false"
:data="dataObj"
name="files"
:headers="{ token }"
:on-success="succrssFun"
:on-error="errorFun"
:action="uploadPath"
:before-upload="annexBeforeUpload"
:show-file-list="false"
style="display: inline-block"
>
<el-button type="primary" :loading="showLoading">{{ 'btn.upload' | i18nFilter }}</el-button>
</el-upload>
<span v-if="dataForm.annexUrl" style="cursor: pointer; margin-left:20px;" @click="downloadFile">{{ $t('module.basicData.knowledge.download') }}</span>
</el-form-item>
</el-col>
</el-row>
<el-row style="text-align: right">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button v-if="!isDetail" type="primary" @click="dataFormSubmit()">{{ 'btn.save' | i18nFilter }}</el-button>
</el-row>
</el-form>
</el-dialog>
</template>
<script>
import { einspectionItemLogU, geteinspectionItemLog } from '@/api/equipment/inspectionManager'
import { uploadPath } from '@/api/basic'
import { getToken } from '@/utils/auth'
export default {
data() {
return {
visible: false,
isDetail: true, // true是详情
dataObj: { typeCode: 'file' },
uploadPath,
token: getToken(),
showLoading: false,
list: [],
dataForm: {
id: '',
inspectionContent: '',
inspectionItem: '',
description: '',
annexUrl: ''
}
}
},
methods: {
init(id, type) {
this.visible = true
if (type === 'edit') {
this.isDetail = false
} else {
this.isDetail = true
}
this.dataForm.id = id
geteinspectionItemLog({
id: this.dataForm.id
}).then(res => {
if (res.data) {
this.dataForm = res.data
}
})
},
annexBeforeUpload(file) {
const isRightSize = file.size / 1024 / 1024 < 10
if (!isRightSize) {
this.$message({
type: 'error',
message: this.$t('module.equipmentManager.inspectionManage.uploadError')
})
}
this.showLoading = true
return isRightSize
},
succrssFun(res) {
this.showLoading = false
if (res.code === 0) {
this.dataForm.annexUrl = res.data[0].id
} else {
this.$message({
type: 'error',
message: this.$t('module.equipmentManager.inspectionManage.uploadErrorTip')
})
}
},
errorFun() {
this.showLoading = false
},
downloadFile() {
window.open(`${location.origin}/api/common/attachment/downloadFile?type=file&attachmentId=${this.dataForm.annexUrl}`)
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate(valid => {
if (valid) {
if (this.dataForm.id) {
einspectionItemLogU({
id: this.dataForm.id,
annexUrl: this.dataForm.annexUrl,
description: this.dataForm.description
}).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.close()
this.$emit('refreshDataList')
}
})
})
}
}
})
},
close() {
this.dataForm.id = ''
this.dataForm.inspectionContent = ''
this.dataForm.inspectionItem = ''
this.dataForm.description = ''
this.dataForm.annexUrl = ''
this.visible = false
}
}
}
</script>
<style scoped>
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
</style>

View File

@@ -0,0 +1,182 @@
<template>
<el-dialog :visible.sync="visible" :title="(!dataForm.id ? 'btn.add' : 'btn.edit') | i18nFilter " class="dialog" @close="close">
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="100px"
@keyup.enter.native="dataFormSubmit()"
>
<el-form-item :label="$t('module.equipmentManager.inspectionManage.inspectionContentCode')" prop="code">
<el-input
v-model="dataForm.code"
:placeholder="$i18nForm(['placeholder.input', $t('module.equipmentManager.inspectionManage.inspectionContentCode')])"
clearable
/>
</el-form-item>
<el-form-item :label="$t('module.equipmentManager.inspectionManage.inspectionItem')" prop="inspectionItem">
<el-input
v-model="dataForm.inspectionItem"
:placeholder="$i18nForm(['placeholder.input', $t('module.equipmentManager.inspectionManage.inspectionItem')])"
clearable
/>
</el-form-item>
<el-form-item :label="$t('module.equipmentManager.inspectionManage.inspectionContent')" prop="inspectionContent">
<el-input
v-model="dataForm.inspectionContent"
:placeholder="$i18nForm(['placeholder.input', $t('module.equipmentManager.inspectionManage.inspectionContent')])"
clearable
/>
</el-form-item>
<el-form-item :label="$t('module.equipmentManager.inspectionManage.type')" prop="type">
<el-select
v-model="dataForm.type"
:placeholder="this.$t('module.equipmentManager.inspectionManage.type')"
>
<el-option
v-for="item in typeList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.equipmentManager.inspectionManage.remark')" prop="remark">
<el-input
v-model="dataForm.remark"
:placeholder="$i18nForm(['placeholder.input', $t('module.equipmentManager.inspectionManage.remark')])"
clearable
/>
</el-form-item>
</el-form>
<el-row style="text-align: right">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.save' | i18nFilter }}</el-button>
</el-row>
</el-dialog>
</template>
<script>
import { inspectionCode, getInspection, inspectionAdd, inspectionUpdate } from '@/api/equipment/inspectionManager'
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
code: '',
inspectionItem: '',
inspectionContent: '',
type: 0,
remark: ''
},
typeList: [
{ id: 0, name: '必选' },
{ id: 1, name: '非必选' }
],
dataRule: {
inspectionItem: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.equipmentManager.inspectionManage.inspectionItem')]),
trigger: 'blur'
}
],
inspectionContent: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.equipmentManager.inspectionManage.inspectionContent')]),
trigger: 'blur'
}
],
type: [
{
required: true,
message: this.$t('module.equipmentManager.inspectionManage.type'),
trigger: 'change'
}
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
if (this.dataForm.id) {
getInspection({
id: this.dataForm.id
}).then(res => {
this.dataForm.code = res.data.code
this.dataForm.inspectionItem = res.data.inspectionItem
this.dataForm.inspectionContent = res.data.inspectionContent
this.dataForm.type = res.data.type
this.dataForm.remark = res.data.remark
})
} else {
inspectionCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate(valid => {
if (valid) {
const data = {
code: this.dataForm.code,
inspectionItem: this.dataForm.inspectionItem,
inspectionContent: this.dataForm.inspectionContent,
remark: this.dataForm.remark,
type: this.dataForm.type,
id: this.dataForm.id
}
if (this.dataForm.id) {
inspectionUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.close()
this.$emit('refreshDataList')
}
})
})
} else {
inspectionAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.close()
this.$emit('refreshDataList')
}
})
})
}
}
})
},
close() {
this.dataForm.id = 0
this.dataForm.code = ''
this.dataForm.inspectionItem = ''
this.dataForm.inspectionContent = ''
this.dataForm.type = 0
this.dataForm.remark = ''
}
}
}
</script>
<style scoped>
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
</style>

View File

@@ -0,0 +1,121 @@
<template>
<el-dialog :visible.sync="visible" :title="'btn.add' | i18nFilter" class="dialog" @close="close">
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="100px"
@keyup.enter.native="dataFormSubmit()"
>
<el-form-item
:label="this.$t('module.equipmentManager.inspectionManage.equipmentName')"
prop="id"
>
<el-select
v-model="dataForm.id"
filterable
:placeholder="this.$t('module.equipmentManager.inspectionManage.equipmentName')"
@change="selectOrder()"
>
<el-option
v-for="item in list"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.equipmentManager.inspectionManage.equipmentCode')" prop="code">
<el-input
v-model="dataForm.code"
:placeholder="$i18nForm(['placeholder.input', $t('module.equipmentManager.inspectionManage.equipmentCode')])"
clearable
disabled
/>
</el-form-item>
</el-form>
<el-row style="text-align: right">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.save' | i18nFilter }}</el-button>
</el-row>
</el-dialog>
</template>
<script>
import { equipmentList, equipmentAdd } from '@/api/equipment/inspectionManager'
export default {
data() {
return {
visible: false,
list: [],
dataForm: {
id: '',
code: ''
},
dataRule: {
id: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.equipmentManager.inspectionManage.equipmentName')]),
trigger: 'blur'
}
]
}
}
},
methods: {
init() {
this.visible = true
this.$nextTick(() => {
equipmentList({
current: 1,
size: 999
}).then(res => {
if (res.data) {
this.list = res.data
} else {
this.list = []
}
})
})
},
selectOrder() {
this.list.map(item => {
if (item.id === this.dataForm.id) {
this.dataForm.code = item.code
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate(valid => {
if (valid) {
equipmentAdd({ equipmentId: this.dataForm.id }).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1000,
onClose: () => {
this.close()
this.$emit('refreshDataList')
}
})
})
}
})
},
close() {
this.dataForm.id = ''
this.dataForm.code = ''
this.visible = false
}
}
}
</script>
<style scoped>
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
</style>

View File

@@ -0,0 +1,138 @@
<template>
<el-dialog :visible.sync="visible" :title="'btn.edit' | i18nFilter" class="dialog" @close="close">
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="100px"
@keyup.enter.native="dataFormSubmit()"
>
<el-form-item
:label="this.$t('module.equipmentManager.inspectionManage.inspectionItem')"
prop="id"
>
<el-select
v-model="dataForm.id"
filterable
:placeholder="this.$t('module.equipmentManager.inspectionManage.inspectionItem')"
@change="selectOrder()"
>
<el-option
v-for="item in list"
:key="item.id"
:label="item.inspectionItem"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.equipmentManager.inspectionManage.inspectionContentCode')" prop="code">
<el-input
v-model="dataForm.code"
:placeholder="$i18nForm(['placeholder.input', $t('module.equipmentManager.inspectionManage.inspectionContentCode')])"
clearable
disabled
/>
</el-form-item>
<el-form-item :label="$t('module.equipmentManager.inspectionManage.inspectionContent')" prop="code">
<el-input
v-model="dataForm.content"
:placeholder="$i18nForm(['placeholder.input', $t('module.equipmentManager.inspectionManage.inspectionContent')])"
clearable
disabled
/>
</el-form-item>
</el-form>
<el-row style="text-align: right">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.save' | i18nFilter }}</el-button>
</el-row>
</el-dialog>
</template>
<script>
import { inspectionItemList, einspectionItemAdd } from '@/api/equipment/inspectionManager'
export default {
data() {
return {
visible: false,
list: [],
equipmentId: '',
dataForm: {
id: '',
code: '',
content: ''
},
dataRule: {
id: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.equipmentManager.inspectionManage.inspectionItem')]),
trigger: 'blur'
}
]
}
}
},
methods: {
init(id) {
this.visible = true
this.equipmentId = id
this.$nextTick(() => {
inspectionItemList({
current: 1,
size: 999,
type: 0
}).then(res => {
if (res.data) {
this.list = res.data
} else {
this.list = []
}
})
})
},
selectOrder() {
this.list.map(item => {
if (item.id === this.dataForm.id) {
this.dataForm.code = item.code
this.dataForm.content = item.inspectionContent
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate(valid => {
if (valid) {
einspectionItemAdd({
equipmentId: this.equipmentId,
itemId: this.dataForm.id
}).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.close()
this.$emit('refreshDataList')
}
})
})
}
})
},
close() {
this.dataForm.id = ''
this.dataForm.code = ''
this.dataForm.content = ''
this.equipmentId = ''
this.visible = false
}
}
}
</script>
<style scoped>
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
</style>

View File

@@ -0,0 +1,46 @@
<template>
<el-switch v-model="state" type="text" size="small" :disabled="readonly" @change="changeHandler" />
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
state: false,
payload: {}
}
},
computed: {
readonly() {
return !!this.injectData.readonly
}
},
mounted() {
this.mapToState()
},
methods: {
mapToState() {
if (this.injectData['status'] && this.injectData['status'] === '1') {
this.state = true
} else {
this.state = false
}
},
changeHandler() {
this.payload.id = this.injectData.id
this.payload.status = this.state ? '1' : '0'
this.$emit('emitData', {
action: 'toggle-enabled-action',
data: this.injectData.emitFullData ? { ...this.injectData, ...this.payload } : this.payload
})
}
}
}
</script>

View File

@@ -0,0 +1,43 @@
<template>
<div>
<el-tag size="medium" :type="tagType">{{ typeName }}</el-tag>
</div>
</template>
<script>
export default {
name: 'StatusTag',
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
tagType: '',
typeName: ''
}
},
watch: {
injectData(newVal, oldVal) {
if (oldVal.type !== newVal.type) {
this.init()
}
}
},
mounted() {
this.init()
},
methods: {
init() {
if (this.injectData.type === 1) {
this.typeName = '非必选'
this.tagType = 'warning'
} else {
this.typeName = '必选'
this.tagType = ''
}
}
}
}
</script>

View File

@@ -0,0 +1,201 @@
<template>
<div class="app-container">
<head-form :form-config="headFormConfig" @headBtnClick="btnClick" />
<base-table
:top-btn-config="topBtnConfig"
:page="listQuery.current"
:limit="listQuery.size"
:height="tableH"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
@clickTopBtn="clickTopBtn"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:method-list="tableBtn"
:width="trueWidth"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<inspection-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>
import HeadForm from '@/components/basicData/HeadForm'
import i18n from '@/lang'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { tableHeight } from '@/utils/index'
import { inspectionList, inspectionDel } from '@/api/equipment/inspectionManager'
import inspectionAdd from './components/inspectionAdd.vue'
import statusTag from './components/statusTag.vue'
const topBtnConfig = [
{
type: 'add',
btnName: 'btn.add'
}
]
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'inspectionItem',
label: i18n.t('module.equipmentManager.inspectionManage.inspectionItem')
},
{
prop: 'inspectionContent',
label: i18n.t('module.equipmentManager.inspectionManage.inspectionContent')
},
{
prop: 'code',
label: i18n.t('module.equipmentManager.inspectionManage.inspectionContentCode')
},
{
prop: 'type',
label: i18n.t('module.equipmentManager.inspectionManage.type'),
subcomponent: statusTag,
width: 100
},
{
prop: 'remark',
label: i18n.t('module.equipmentManager.inspectionManage.remark')
}
]
export default {
name: 'InspectionSetting',
components: { HeadForm, Pagination, BaseTable, MethodBtn, inspectionAdd },
data() {
return {
topBtnConfig,
tableBtn,
trueWidth: 100,
tableH: tableHeight(280),
list: [],
total: 0,
listLoading: false,
tableProps,
listQuery: {
current: 1,
size: 20
},
headFormConfig: [
{
type: 'input',
label: i18n.t('module.equipmentManager.inspectionManage.inspectionItem'),
placeholder: this.$t('module.equipmentManager.inspectionManage.inspectionItem'),
param: 'name'
},
{
type: 'select',
label: this.$t('module.equipmentManager.inspectionManage.type'),
selectOptions: [
{ id: 0, name: '必选' },
{ id: 1, name: '非必选' }
],
param: 'type',
width: 200
},
{
type: 'button',
btnName: 'btn.search',
name: 'search',
color: 'primary'
}
],
headFormValue: {},
addOrUpdateVisible: false
}
},
mounted() {
window.addEventListener('resize', () => {
this.tableH = tableHeight(280)
})
this.getList()
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.inspectionItem}]?`,
this.$t('module.basicData.visual.Tips'),
{
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}
)
.then(() => {
inspectionDel({
id: raw.data.id
}).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.listQuery.current = 1
this.getList()
}
})
})
})
.catch(() => { })
} else if (raw.type === 'edit') {
this.addNew(raw.data.id)
}
},
getList() {
this.listLoading = true
this.listQuery.inspectionItem = this.headFormValue.name
this.listQuery.type = this.headFormValue.type
inspectionList(this.listQuery).then(res => {
if (res.data.records) {
this.list = res.data.records
} else {
this.list = []
}
this.total = res.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
btnClick(val) {
this.headFormValue = val
// 如果点击的是搜索栏的其他按钮在这里继续写判断
if (this.headFormValue.btnName === 'search') {
this.listQuery.current = 1
this.getList()
}
},
clickTopBtn(val) {
if (val === 'add') {
this.addNew() // 新增
}
}
}
}
</script>

View File

@@ -0,0 +1,373 @@
<template>
<div class="app-container">
<!-- left -->
<div class="left-container">
<head-form :form-config="headFormConfig" @headBtnClick="btnClick" />
<base-table
:top-btn-config="topBtnConfig"
:page="listQuery.current"
:limit="listQuery.size"
:height="tableH"
:high-index="highIndex"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
@clickTopBtn="clickTopBtn"
@selectRow="selectRow"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:method-list="tableBtn"
:width="trueWidth"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
</div>
<!-- right -->
<div class="right-container">
<top-title :base-title="this.$t('module.equipmentManager.inspectionManage.inspectionItem')" style="font-size: 14px; padding-bottom: 14px;" />
<base-table
:page="1"
:limit="999"
:height="tableHR"
:table-config="tablePropsR"
:table-data="listR"
:is-loading="listLoading"
@emitFun="updateStatus"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:method-list="tableBtnR"
:width="trueWidthR"
@clickBtn="handleClickR"
/>
</base-table>
</div>
<einspectionitem-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
<einspectionitemlog-add v-if="addOrUpdateVisibleR" ref="addOrUpdateR" @refreshDataList="getInspectionItem" />
</div>
</template>
<script>
import HeadForm from '@/components/basicData/HeadForm'
import i18n from '@/lang'
import topTitle from '@/components/TopTitle'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { tableHeight } from '@/utils/index'
import { equipmentList, inspectionLog, einspectionLogD, einspectionItList, einspectionItemLogU } from '@/api/equipment/inspectionManager'
import einspectionitemAdd from './components/einspectionitemAdd.vue'
import einspectionitemlogAdd from './components/einspectionitemlogAdd.vue'
import { timeFormatter } from '@/filters'
import StatusBtn from './components/statusBtn.vue'
import statusTag from './components/statusTag.vue'
// import newBasicData from '@/filters/newBasicData'
const topBtnConfig = [
{
type: 'add',
btnName: 'btn.add'
}
]
const tableBtn = [
{
type: 'detail',
btnName: 'btn.detail'
},
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableBtnR = [
{
type: 'detail',
btnName: 'btn.detail'
},
{
type: 'edit',
btnName: 'btn.edit'
}
]
const tableProps = [
// {
// prop: 'createTime',
// label: i18n.t('module.equipmentManager.inspectionManage.addTime'),
// filter: timeFormatter
// },
{
prop: 'equipmentName',
label: i18n.t('module.equipmentManager.inspectionManage.equipmentName')
},
{
prop: 'inspectionStartTime',
label: i18n.t('module.equipmentManager.inspectionManage.startTime'),
filter: timeFormatter,
width: 160
},
{
prop: 'inspectionEndTime',
label: i18n.t('module.equipmentManager.inspectionManage.endTime'),
filter: timeFormatter,
width: 160
},
// {
// prop: 'source',
// label: i18n.t('module.equipmentManager.inspectionManage.source'),
// filter: newBasicData('1523941494259912706')
// },
{
prop: 'inspectionWorker',
label: i18n.t('module.equipmentManager.inspectionManage.inspectionWorker'),
width: 150
}
]
const tablePropsR = [
{
prop: 'inspectionItem',
label: i18n.t('module.equipmentManager.inspectionManage.inspectionItem')
},
{
prop: 'inspectionContent',
label: i18n.t('module.equipmentManager.inspectionManage.inspectionContent')
},
{
prop: 'status',
label: i18n.t('module.equipmentManager.inspectionManage.completion'),
subcomponent: StatusBtn,
emitFullData: true
},
{
prop: 'type',
label: i18n.t('module.equipmentManager.inspectionManage.type'),
subcomponent: statusTag,
width: 100
}
]
export default {
name: 'InspectionRecord',
components: { HeadForm, Pagination, BaseTable, MethodBtn, topTitle, einspectionitemAdd, einspectionitemlogAdd },
data() {
return {
topBtnConfig,
tableBtn,
trueWidth: 110,
trueWidthR: 80,
tableH: tableHeight(280),
highIndex: true,
list: [],
total: 0,
listLoading: false,
tableProps,
listQuery: {
current: 1,
size: 20,
equipmentId: '',
startTime: '',
endTime: ''
},
headFormConfig: [
{
type: 'select',
label: this.$t('module.equipmentManager.inspectionManage.equipmentName'),
selectOptions: [],
param: 'equipmentId',
width: 200,
filterable: true
},
{
type: 'datePicker',
label: this.$t('module.basicData.knowledge.time'),
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd',
rangeSeparator: '-',
startPlaceholder: this.$t('module.basicData.knowledge.startTime'),
endPlaceholder: this.$t('module.basicData.knowledge.endTime'),
param: 'searchTime'
},
{
type: 'button',
btnName: 'btn.search',
name: 'search',
color: 'primary'
}
],
headFormValue: {},
equipmentInspectionId: '',
tableHR: tableHeight(280),
tablePropsR,
listR: [],
tableBtnR,
addOrUpdateVisible: false,
addOrUpdateVisibleR: false
}
},
mounted() {
window.addEventListener('resize', () => {
this.tableH = tableHeight(280)
this.tableR = tableHeight(280)
})
this.getEquipmentList()
this.getList()
},
methods: {
// 获取设备list
getEquipmentList() {
equipmentList({
current: 1,
size: 999
}).then(res => {
if (res.data) {
this.headFormConfig[0].selectOptions = res.data
}
})
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.equipmentName}]?`,
this.$t('module.basicData.visual.Tips'),
{
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}
).then(() => {
einspectionLogD({
id: raw.data.id
}).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.listQuery.current = 1
this.getList()
}
})
})
}).catch(() => { })
} else if (raw.type === 'detail') {
this.addNew(raw.data.id, 'detail')
} else if (raw.type === 'edit') {
this.addNew(raw.data.id, 'edit')
}
},
getList() {
this.listLoading = true
this.listQuery.equipmentId = this.headFormValue.equipmentId
this.listQuery.startTime = this.headFormValue.searchTime ? this.headFormValue.searchTime[0] + 'T00:00:00' : ''
this.listQuery.endTime = this.headFormValue.searchTime ? this.headFormValue.searchTime[1] + 'T23:59:59' : ''
inspectionLog(this.listQuery).then(res => {
if (res.data.records) {
this.list = res.data.records
this.equipmentInspectionId = this.list[0].id
this.getInspectionItem()
} else {
this.list = []
this.listR.splice(0, this.listR.length)
}
this.total = res.data.total
this.listLoading = false
})
},
getInspectionItem() {
if (this.equipmentInspectionId) {
this.listR.splice(0, this.listR.length)
einspectionItList({
equipmentInspectionId: this.equipmentInspectionId
}).then(res => {
if (res.data) {
this.listR = res.data
} else {
this.listR.splice(0, this.listR.length)
}
})
}
},
selectRow(val) { // 点击左侧列表
this.equipmentInspectionId = val.id
this.getInspectionItem()
},
// 新增
addNew(id, name) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, name)
})
},
btnClick(val) {
this.headFormValue = val
// 如果点击的是搜索栏的其他按钮在这里继续写判断
if (this.headFormValue.btnName === 'search') {
this.listQuery.current = 1
this.getList()
}
},
clickTopBtn(val) {
if (val === 'add') {
this.addNew() // 新增
}
},
// 右侧切换启停状态
updateStatus(val) {
einspectionItemLogU({
id: val.data.id,
status: val.data.status
}).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getInspectionItem()
}
})
})
},
handleClickR(raw) {
if ((raw.type === 'detail') || (raw.type === 'edit')) {
this.addOrUpdateVisibleR = true
this.$nextTick(() => {
this.$refs.addOrUpdateR.init(raw.data.id, raw.type)
})
}
}
}
}
</script>
<style lang="scss" scoped>
.app-container {
padding-top: 0;
.left-container {
display: inline-block;
// width: 500px;
width: 50%;
border-right: 8px solid #f2f4f9;
height: 100%;
padding-top: 16px;
}
.right-container {
display: inline-block;
// width: calc(100% - 510px);
width: 49%;
vertical-align: top;
height: 100%;
padding-top: 23px;
}
}
</style>

View File

@@ -0,0 +1,13 @@
<template>
<div>功能待开发</div>
</template>
<script>
export default {
name: 'InspectionRecordPad',
data() {
return {
}
}
}
</script>

View File

@@ -0,0 +1,336 @@
<template>
<div class="app-container">
<!-- left -->
<div class="left-container">
<head-form :form-config="headFormConfig" @headBtnClick="btnClick" />
<base-table
:top-btn-config="topBtnConfig"
:page="listQuery.current"
:limit="listQuery.size"
:height="tableH"
:high-index="highIndex"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
@clickTopBtn="clickTopBtn"
@selectRow="selectRow"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:method-list="tableBtn"
:width="trueWidth"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
</div>
<!-- right -->
<div class="right-container">
<top-title :base-title="this.$t('module.equipmentManager.inspectionManage.inspectionItem')" style="font-size: 14px; padding-bottom: 14px;" />
<base-table
:top-btn-config="topBtnConfigR"
:page="1"
:limit="999"
:height="tableHR"
:table-config="tablePropsR"
:table-data="listR"
:is-loading="listLoading"
@clickTopBtn="clickTopBtnR"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:method-list="tableBtnR"
:width="trueWidth"
@clickBtn="handleClickR"
/>
</base-table>
</div>
<inspectioneq-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
<inspectionitems-add v-if="addOrUpdateVisibleR" ref="addOrUpdateR" @refreshDataList="getInspectionItem" />
</div>
</template>
<script>
import HeadForm from '@/components/basicData/HeadForm'
import i18n from '@/lang'
import topTitle from '@/components/TopTitle'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { tableHeight } from '@/utils/index'
import { equipmentList, equipmentPage, equipmentDel, eInspectionItem, einspectionItDel } from '@/api/equipment/inspectionManager'
import inspectioneqAdd from './components/inspectioneqAdd.vue'
import inspectionitemsAdd from './components/inspectionitemsAdd.vue'
const topBtnConfig = [
{
type: 'add',
btnName: 'btn.add'
}
]
const topBtnConfigR = [
{
type: 'add',
btnName: 'btn.add'
}
]
const tableBtn = [
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableBtnR = [
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'name',
label: i18n.t('module.equipmentManager.inspectionManage.equipmentName')
},
{
prop: 'code',
label: i18n.t('module.equipmentManager.inspectionManage.equipmentCode')
}
]
const tablePropsR = [
{
prop: 'inspectionItem',
label: i18n.t('module.equipmentManager.inspectionManage.inspectionItem')
},
{
prop: 'inspectionContent',
label: i18n.t('module.equipmentManager.inspectionManage.inspectionContent')
},
{
prop: 'code',
label: i18n.t('module.equipmentManager.inspectionManage.inspectionContentCode')
}
]
export default {
name: 'InspectionSetting',
components: { HeadForm, Pagination, BaseTable, MethodBtn, topTitle, inspectioneqAdd, inspectionitemsAdd },
data() {
return {
topBtnConfig,
tableBtn,
trueWidth: 80,
tableH: tableHeight(280),
highIndex: true,
list: [],
total: 0,
listLoading: false,
tableProps,
listQuery: {
current: 1,
size: 20
},
headFormConfig: [
{
type: 'select',
label: this.$t('module.equipmentManager.inspectionManage.equipmentName'),
selectOptions: [],
param: 'equipmentId',
width: 200,
filterable: true
},
{
type: 'button',
btnName: 'btn.search',
name: 'search',
color: 'primary'
}
],
headFormValue: {},
equipmentId: '',
topBtnConfigR,
tableHR: tableHeight(280),
tablePropsR,
listR: [],
tableBtnR,
addOrUpdateVisible: false,
addOrUpdateVisibleR: false
}
},
mounted() {
window.addEventListener('resize', () => {
this.tableH = tableHeight(280)
this.tableR = tableHeight(280)
})
this.getEquipmentList()
this.getList()
},
methods: {
// 获取设备list
getEquipmentList() {
equipmentList({
current: 1,
size: 999
}).then(res => {
if (res.data) {
this.headFormConfig[0].selectOptions = res.data
}
})
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`,
this.$t('module.basicData.visual.Tips'),
{
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}
).then(() => {
equipmentDel({
id: raw.data.id
}).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.listQuery.current = 1
this.getList()
}
})
})
})
.catch(() => { })
}
},
handleClickR(raw) {
if (raw.type === 'delete') {
this.$confirm(
`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.inspectionItem}]?`,
this.$t('module.basicData.visual.Tips'),
{
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}
).then(() => {
einspectionItDel({
id: raw.data.id
}).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getInspectionItem()
}
})
})
})
.catch(() => { })
}
},
getList() {
this.listLoading = true
this.listQuery.equipmentId = this.headFormValue.equipmentId
equipmentPage(this.listQuery).then(res => {
if (res.data.records) {
this.list = res.data.records
this.equipmentId = this.list[0].id
this.getInspectionItem()
} else {
this.list = []
this.listR.splice(0, this.listR.length)
}
this.total = res.data.total
this.listLoading = false
})
},
getInspectionItem() {
if (this.equipmentId) {
eInspectionItem({
equipmentId: this.equipmentId
}).then(res => {
if (res.data) {
this.listR = res.data
} else {
this.listR.splice(0, this.listR.length)
}
})
}
},
selectRow(val) { // 点击左侧列表
this.equipmentId = val.id
this.getInspectionItem()
},
// 新增
addNew() {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init()
})
},
addNewR(id) {
this.addOrUpdateVisibleR = true
this.$nextTick(() => {
this.$refs.addOrUpdateR.init(id)
})
},
btnClick(val) {
this.headFormValue = val
// 如果点击的是搜索栏的其他按钮在这里继续写判断
if (this.headFormValue.btnName === 'search') {
this.listQuery.current = 1
this.getList()
}
},
clickTopBtn(val) {
if (val === 'add') {
this.addNew() // 新增
}
},
clickTopBtnR(val) {
if (val === 'add') {
if (this.equipmentId) {
this.addNewR(this.equipmentId) // 新增
} else {
this.$message({
message: this.$t('module.equipmentManager.inspectionManage.selEquitment'),
type: 'warning',
duration: 1500
})
}
}
}
}
}
</script>
<style lang="scss" scoped>
.app-container {
padding-top: 0;
padding-right: 0;
.left-container {
display: inline-block;
// width: 500px;
width: 50%;
border-right: 8px solid #f2f4f9;
height: 100%;
padding-top: 16px;
}
.right-container {
display: inline-block;
// width: calc(100% - 510px);
width: 49%;
vertical-align: top;
height: 100%;
padding-top: 23px;
}
}
</style>