init
This commit is contained in:
183
src/views/basicData/Equipment/EquipmentGroup.vue
Normal file
183
src/views/basicData/Equipment/EquipmentGroup.vue
Normal file
@@ -0,0 +1,183 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 15:41:11
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @LastEditTime: 2021-05-18 14:22:53
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-button type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button>
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
:is-loading="listLoading"
|
||||
>
|
||||
<method-btn
|
||||
slot="handleBtn"
|
||||
:width="trueWidth"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.current"
|
||||
:limit.sync="listQuery.size"
|
||||
@pagination="getList()"
|
||||
/>
|
||||
<equipmentGroup-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { equipmentGroupList, equipmentGroupDelete } from '@/api/basicData/Equipment/equipmentGroup'
|
||||
import equipmentGroupAdd from './components/equipmentGroup-add.vue'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
import { timeFormatter } from '@/filters'
|
||||
import i18n from '@/lang'
|
||||
/**
|
||||
* 表格表头配置项 TypeScript接口注释
|
||||
* tableConfig<ConfigItem> = []
|
||||
*
|
||||
* Interface ConfigItem = {
|
||||
* prop: string,
|
||||
* label: string,
|
||||
* width: string,
|
||||
* align: string,
|
||||
* subcomponent: function,
|
||||
* filter: function
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: i18n.t('module.basicData.factory.createTime'),
|
||||
filter: timeFormatter,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'groupName',
|
||||
label: i18n.t('module.basicData.equipment.groupName'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'groupCode',
|
||||
label: i18n.t('module.basicData.equipment.groupCode'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: i18n.t('module.basicData.visual.Remarks'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
name: 'EquipmentGroup',
|
||||
components: { Pagination, BaseTable, MethodBtn, equipmentGroupAdd },
|
||||
filters: {
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
published: 'success',
|
||||
draft: 'info',
|
||||
deleted: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyName: i18n.t('module.basicData.visual.keyword'),
|
||||
placeholderName: this.$t('module.basicData.factory.placeholderName'),
|
||||
addOrUpdateVisible: false,
|
||||
tableBtn,
|
||||
trueWidth: 200,
|
||||
tableProps,
|
||||
list: [],
|
||||
total: 0,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
handleClick(raw) {
|
||||
console.log(raw)
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.groupName}]?`, this.$t('module.basicData.visual.Tips'), {
|
||||
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
|
||||
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
equipmentGroupDelete(raw.data.id).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.addNew(raw.data.id)
|
||||
}
|
||||
},
|
||||
getList(key) {
|
||||
this.listLoading = true
|
||||
equipmentGroupList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
this.total = response.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.edit-input {
|
||||
padding-right: 100px;
|
||||
}
|
||||
.cancel-btn {
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
top: 10px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,259 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-05-31 08:45:53
|
||||
* @enName:
|
||||
-->
|
||||
<template>
|
||||
<div style="margin:20px">
|
||||
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px;margin:20px">{{ isdetail? 'btn.detail' : !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}</div>
|
||||
<div style="margin:0 15px">
|
||||
<el-form ref="dataForm" :inline="true" :model="dataForm" :rules="dataRule" label-width="160px" @keyup.enter.native="dataFormSubmit()">
|
||||
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.DetectionArea')" prop="detectDistributionAreaId">
|
||||
<el-select v-model="dataForm.detectDistributionAreaId" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipmentDetectInfo.DetectionArea')])" clearable>
|
||||
<el-option
|
||||
v-for="item in detectAreaArr"
|
||||
:key="item.id"
|
||||
:label="item.detectArea"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.equipmentDetectSystemName')" prop="detectSystemId">
|
||||
<el-select v-model="dataForm.detectSystemId" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipmentDetectInfo.equipmentDetectSystemName')])" clearable>
|
||||
<el-option
|
||||
v-for="item in SystemArr"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div style="margin:20px">
|
||||
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
|
||||
<el-button v-if="isdetail" type="primary" @click="goEdit()">{{ 'btn.edit' | i18nFilter }}</el-button>
|
||||
<span v-if="!isdetail">
|
||||
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.save' | i18nFilter }}</el-button>
|
||||
<el-button v-if="dataForm.id" type="primary" @click="addNew()">{{ $t('module.basicData.equipmentDetectInfo.AddEquipment') }}</el-button>
|
||||
</span>
|
||||
</div>
|
||||
<div style="height:380px;overflow:auto">
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
>
|
||||
<method-btn
|
||||
v-if="!isdetail"
|
||||
slot="handleBtn"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
</div>
|
||||
</div>
|
||||
<detectSystemSettings-attr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :detect-area-system-id="dataForm.id" @refreshDataList="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>import i18n from '@/lang'
|
||||
import { equipmentDetectAreaList } from '@/api/basicData/Equipment/equipmentDetectArea'
|
||||
import { equipmentDetectSystemList } from '@/api/basicData/Equipment/equipmentDetectSystem'
|
||||
import { equipmentDetectAreaSystemDetail, equipmentDetectAreaSystemUpdate, equipmentDetectAreaSystemAdd } from '@/api/basicData/Equipment/equipmentDetectAreaSystem'
|
||||
import { DetectAreaSystemAttrList, DetectAreaSystemAttrDelete } from '@/api/basicData/Equipment/equipmentDetectAreaSystemAttr'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
import detectSystemSettingsAttrAdd from './detectSystemSettingsAttr-add'
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'name',
|
||||
label: i18n.t('module.basicData.equipment.EquipmentName'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'code',
|
||||
label: i18n.t('module.basicData.equipment.EquipmentCode'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'function',
|
||||
label: i18n.t('module.basicData.equipmentDetectInfo.EquipmentFunction'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
components: { BaseTable, MethodBtn, detectSystemSettingsAttrAdd },
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateVisible: false,
|
||||
categoryArr: [],
|
||||
tableBtn,
|
||||
trueWidth: 200,
|
||||
tableProps,
|
||||
list: [],
|
||||
dataForm: {
|
||||
id: '',
|
||||
detectDistributionAreaId: '',
|
||||
detectSystemId: ''
|
||||
},
|
||||
dataRule: {
|
||||
detectDistributionAreaId: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipmentDetectInfo.DetectionArea')]), trigger: 'change' }
|
||||
],
|
||||
detectSystemId: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipmentDetectInfo.equipmentDetectSystemName')]), trigger: 'change' }
|
||||
]
|
||||
},
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 990,
|
||||
detectAreaSystemId: ''
|
||||
},
|
||||
detectAreaArr: [],
|
||||
SystemArr: [],
|
||||
isdetail: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.dataForm.id = this.$route.query.id
|
||||
this.listQuery.detectAreaSystemId = this.$route.query.id
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.isdetail = false
|
||||
this.isdetail = Boolean(this.$route.query.isdetail)
|
||||
this.list.splice(0, this.list.length)
|
||||
const data = {
|
||||
current: 1,
|
||||
size: 500
|
||||
}
|
||||
equipmentDetectAreaList(data).then(response => {
|
||||
if (response.data.records) {
|
||||
this.detectAreaArr = response.data.records
|
||||
} else {
|
||||
this.detectAreaArr.splice(0, this.detectAreaArr.length)
|
||||
}
|
||||
})
|
||||
equipmentDetectSystemList(data).then(response => {
|
||||
if (response.data.records) {
|
||||
this.SystemArr = response.data.records
|
||||
} else {
|
||||
this.SystemArr.splice(0, this.SystemArr.length)
|
||||
}
|
||||
})
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
equipmentDetectAreaSystemDetail(this.dataForm.id).then(res => {
|
||||
this.dataForm = res.data
|
||||
})
|
||||
DetectAreaSystemAttrList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
getList() {
|
||||
DetectAreaSystemAttrList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
})
|
||||
},
|
||||
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(() => {
|
||||
DetectAreaSystemAttrDelete(raw.data.id).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.addNew(raw.data.id)
|
||||
}
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = this.dataForm
|
||||
if (this.dataForm.id) {
|
||||
equipmentDetectAreaSystemUpdate(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
})
|
||||
} else {
|
||||
equipmentDetectAreaSystemAdd(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
this.dataForm.id = res.data.id
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
goEdit() {
|
||||
this.isdetail = false
|
||||
},
|
||||
goback() {
|
||||
this.$router.go(-1)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.drawer-footer {
|
||||
width: 100%;
|
||||
margin-top: 50px;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
padding: 10px 50px;
|
||||
text-align: left;
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,130 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-05-28 10:48:46
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
|
||||
:visible.sync="visible"
|
||||
>
|
||||
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="140px" @keyup.enter.native="dataFormSubmit()">
|
||||
<el-form-item :label="$t('module.basicData.equipment.EquipmentName')" prop="equipmentId">
|
||||
<el-select v-model="dataForm.equipmentId" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentName')])" clearable>
|
||||
<el-option
|
||||
v-for="item in equipmentArr"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="drawer-footer">
|
||||
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { DetectAreaSystemAttrDetail, DetectAreaSystemAttrUpdate, DetectAreaSystemAttrAdd } from '@/api/basicData/Equipment/equipmentDetectAreaSystemAttr'
|
||||
import { equipmentInfoList } from '@/api/basicData/Equipment/equipmentInfo'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
detectAreaSystemId: {
|
||||
type: String,
|
||||
default: () => {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
equipmentId: ''
|
||||
},
|
||||
equipmentArr: [],
|
||||
dataRule: {
|
||||
equipmentId: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.AttributeName')]), trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
equipmentInfoList({
|
||||
current: 1,
|
||||
size: 999,
|
||||
name: ''
|
||||
}).then(response => {
|
||||
this.equipmentArr = response.data.records
|
||||
})
|
||||
this.dataForm.id = id || ''
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
DetectAreaSystemAttrDetail(this.dataForm.id).then(res => {
|
||||
this.dataForm.equipmentId = res.data.equipmentId
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
'equipmentId': this.dataForm.equipmentId,
|
||||
'detectAreaSystemId': this.detectAreaSystemId,
|
||||
'id': this.dataForm.id
|
||||
}
|
||||
if (this.dataForm.id) {
|
||||
DetectAreaSystemAttrUpdate(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
DetectAreaSystemAttrAdd(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.drawer-footer {
|
||||
width: 100%;
|
||||
margin-top: 50px;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
padding: 10px 50px;
|
||||
text-align: left;
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,272 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-07-23 09:03:46
|
||||
* @enName:
|
||||
-->
|
||||
<template>
|
||||
<div style="margin:20px">
|
||||
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px;margin:20px">{{ isdetail? 'btn.detail' : !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}</div>
|
||||
<div style="margin:0 15px">
|
||||
<el-form ref="dataForm" :inline="true" :model="dataForm" :rules="dataRule" label-width="130px" @keyup.enter.native="dataFormSubmit()">
|
||||
<el-form-item :label="$t('module.basicData.equipment.WiredCode')" prop="code">
|
||||
<el-input v-model="dataForm.code" style="width:300px" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.WiredCode')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.DetectionArea')" prop="detectArea">
|
||||
<el-select v-model="dataForm.detectArea" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipmentDetectInfo.DetectionArea')])" clearable>
|
||||
<el-option
|
||||
v-for="item in detectAreaArr"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.IssueArea')" prop="distributionArea">
|
||||
<el-select v-model="dataForm.distributionArea" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipmentDetectInfo.IssueArea')])" clearable>
|
||||
<el-option
|
||||
v-for="item in distributionAreaArr"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div style="margin:20px">
|
||||
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
|
||||
<el-button v-if="isdetail" type="primary" @click="goEdit()">{{ 'btn.edit' | i18nFilter }}</el-button>
|
||||
<span v-if="!isdetail">
|
||||
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.save' | i18nFilter }}</el-button>
|
||||
<el-button v-if="false" type="primary" @click="addNew()">{{ $t('module.basicData.equipmentDetectInfo.AddEquipment') }}</el-button>
|
||||
<!-- //listQuery.detectDistributionAreaId -->
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="false" style="height:380px;overflow:auto">
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
>
|
||||
<method-btn
|
||||
v-if="!isdetail"
|
||||
slot="handleBtn"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
</div>
|
||||
</div>
|
||||
<equipmentDetectArea-attr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :detect-distribution-area-id="listQuery.detectDistributionAreaId" @refreshDataList="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>import i18n from '@/lang'
|
||||
import { equipmentDetectAreaDetail, equipmentDetectAreaUpdate, equipmentDetectAreaAdd, equipmentDetectAreaCode } from '@/api/basicData/Equipment/equipmentDetectArea'
|
||||
import { equipmentDetectAreaAttrList, equipmentDetectAreaAttrDelete } from '@/api/basicData/Equipment/equipmentDetectAreaAttr'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
import equipmentDetectAreaAttrAdd from './equipmentDetectAreaAttr-add'
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'name',
|
||||
label: i18n.t('module.basicData.equipment.EquipmentName'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'code',
|
||||
label: i18n.t('module.basicData.equipment.EquipmentCode'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'function',
|
||||
label: i18n.t('module.basicData.equipmentDetectInfo.EquipmentFunction'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
components: { BaseTable, MethodBtn, equipmentDetectAreaAttrAdd },
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateVisible: false,
|
||||
categoryArr: [],
|
||||
tableBtn,
|
||||
trueWidth: 200,
|
||||
tableProps,
|
||||
list: [],
|
||||
dataForm: {
|
||||
code: '',
|
||||
distributionArea: '',
|
||||
detectArea: ''
|
||||
},
|
||||
detectAreaArr: [{
|
||||
value: 'Backend',
|
||||
label: 'Backend'
|
||||
}, {
|
||||
value: 'Frontend',
|
||||
label: 'Frontend'
|
||||
}, {
|
||||
value: 'Midend',
|
||||
label: 'Midend'
|
||||
}],
|
||||
distributionAreaArr: [{
|
||||
value: '00A',
|
||||
label: '00A'
|
||||
}, {
|
||||
value: '00C',
|
||||
label: '00C'
|
||||
}, {
|
||||
value: 'PID24',
|
||||
label: 'PID24'
|
||||
}],
|
||||
dataRule: {
|
||||
code: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.WiredCode')]), trigger: 'blur' }
|
||||
],
|
||||
distributionArea: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipmentDetectInfo.IssueArea')]), trigger: 'change' }
|
||||
],
|
||||
detectArea: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipmentDetectInfo.DetectionArea')]), trigger: 'change' }
|
||||
]
|
||||
},
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 990,
|
||||
detectDistributionAreaId: ''
|
||||
},
|
||||
isdetail: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.listQuery.detectDistributionAreaId = this.$route.query.id
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.isdetail = false
|
||||
this.isdetail = Boolean(this.$route.query.isdetail)
|
||||
this.list.splice(0, this.list.length)
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.listQuery.detectDistributionAreaId) {
|
||||
equipmentDetectAreaDetail(this.listQuery.detectDistributionAreaId).then(res => {
|
||||
this.dataForm = res.data
|
||||
})
|
||||
equipmentDetectAreaAttrList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
equipmentDetectAreaCode().then(res => {
|
||||
this.dataForm.code = res.data
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
getList() {
|
||||
equipmentDetectAreaAttrList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
})
|
||||
},
|
||||
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(() => {
|
||||
equipmentDetectAreaAttrDelete(raw.data.id).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.addNew(raw.data.id)
|
||||
}
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
'code': this.dataForm.code,
|
||||
'detectArea': this.dataForm.detectArea,
|
||||
'distributionArea': this.dataForm.distributionArea,
|
||||
'id': this.listQuery.detectDistributionAreaId
|
||||
}
|
||||
if (this.listQuery.detectDistributionAreaId) {
|
||||
equipmentDetectAreaUpdate(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
})
|
||||
} else {
|
||||
equipmentDetectAreaAdd(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
this.listQuery.detectDistributionAreaId = res.data.id
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
goEdit() {
|
||||
this.isdetail = false
|
||||
},
|
||||
goback() {
|
||||
this.$router.go(-1)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.drawer-footer {
|
||||
width: 100%;
|
||||
margin-top: 50px;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
padding: 10px 50px;
|
||||
text-align: left;
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,130 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-05-28 10:12:01
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
|
||||
:visible.sync="visible"
|
||||
>
|
||||
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px" @keyup.enter.native="dataFormSubmit()">
|
||||
<el-form-item :label="$t('module.basicData.equipment.EquipmentName')" prop="equipmentId">
|
||||
<el-select v-model="dataForm.equipmentId" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentName')])" clearable>
|
||||
<el-option
|
||||
v-for="item in equipmentArr"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="drawer-footer">
|
||||
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { equipmentDetectAreaAttrDetail, equipmentDetectAreaAttrUpdate, equipmentDetectAreaAttrAdd } from '@/api/basicData/Equipment/equipmentDetectAreaAttr'
|
||||
import { equipmentInfoList } from '@/api/basicData/Equipment/equipmentInfo'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
detectDistributionAreaId: {
|
||||
type: String,
|
||||
default: () => {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
equipmentId: ''
|
||||
},
|
||||
equipmentArr: [],
|
||||
dataRule: {
|
||||
equipmentId: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.AttributeName')]), trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
equipmentInfoList({
|
||||
current: 1,
|
||||
size: 999,
|
||||
name: ''
|
||||
}).then(response => {
|
||||
this.equipmentArr = response.data.records
|
||||
})
|
||||
this.dataForm.id = id || ''
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
equipmentDetectAreaAttrDetail(this.dataForm.id).then(res => {
|
||||
this.dataForm.equipmentId = res.data.equipmentId
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
'equipmentId': this.dataForm.equipmentId,
|
||||
'detectDistributionAreaId': this.detectDistributionAreaId,
|
||||
'id': this.dataForm.id
|
||||
}
|
||||
if (this.dataForm.id) {
|
||||
equipmentDetectAreaAttrUpdate(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
equipmentDetectAreaAttrAdd(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.drawer-footer {
|
||||
width: 100%;
|
||||
margin-top: 50px;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
padding: 10px 50px;
|
||||
text-align: left;
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,234 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @LastEditTime: 2021-07-26 14:02:11
|
||||
* @enName:
|
||||
-->
|
||||
<template>
|
||||
<el-container style="margin:30px">
|
||||
<el-aside style="width:250px">
|
||||
<el-tree :data="menuList" :props="defaultProps" @node-click="getOrganization" />
|
||||
</el-aside>
|
||||
<el-main style="border:2px solid #E4E4E4;border-radius:10px;margin-left:10px">
|
||||
<el-form
|
||||
ref="dataForm"
|
||||
:model="listQuery"
|
||||
:inline="true"
|
||||
size="medium"
|
||||
label-position="left"
|
||||
>
|
||||
<el-form-item :label="$t('module.basicData.equipment.EquipmentName')+':'">
|
||||
<span style="color:#1890FF">{{ listQuery.detectEquipmentAreaName }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="keyName +':'" prop="name">
|
||||
<el-input v-model="listQuery.name" :placeholder="placeholderName" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getList()">{{ 'btn.search' | i18nFilter }}</el-button>
|
||||
<el-button v-if="listQuery.detectEquipmentAreaId" type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
>
|
||||
<method-btn
|
||||
slot="handleBtn"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
</el-main>
|
||||
<equipmentDetectParam-attr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :detect-equipment-area-id="listQuery.detectEquipmentAreaId" @refreshDataList="getList" />
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script>import i18n from '@/lang'
|
||||
import { equipmentDetectParamList, equipmentDetectParamDelete } from '@/api/basicData/Equipment/equipmentDetectParam'
|
||||
import { equipmentDetectTreeList } from '@/api/basicData/Equipment/equipmentDetectArea'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
import equipmentDetectParamAttrAdd from './equipmentDetectParamAttr-add'
|
||||
import basicData from '@/filters/basicData'
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'name',
|
||||
label: i18n.t('module.basicData.equipmentDetectInfo.TestParameterName'),
|
||||
align: 'center',
|
||||
width: '200px'
|
||||
},
|
||||
{
|
||||
prop: 'value',
|
||||
label: i18n.t('module.basicData.equipmentDetectInfo.ReferenceValue'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'distribution',
|
||||
label: i18n.t('module.basicData.equipmentDetectInfo.IssueOrNot'),
|
||||
filter: basicData('onDuty'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'testFrequency',
|
||||
label: i18n.t('module.basicData.equipmentDetectInfo.TestFrequency'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'testSystem',
|
||||
label: i18n.t('module.basicData.equipmentDetectInfo.TestSystem'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'description',
|
||||
label: i18n.t('module.basicData.visual.Description'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: i18n.t('module.basicData.visual.Remarks'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
components: { BaseTable, MethodBtn, equipmentDetectParamAttrAdd },
|
||||
data() {
|
||||
return {
|
||||
keyName: i18n.t('module.basicData.visual.keyword'),
|
||||
placeholderName: this.$t('module.basicData.equipmentDetectInfo.TestParameterName'),
|
||||
addOrUpdateVisible: false,
|
||||
menuList: [],
|
||||
tableBtn,
|
||||
trueWidth: 200,
|
||||
tableProps,
|
||||
list: [],
|
||||
listQuery: {
|
||||
detectEquipmentAreaId: '',
|
||||
detectEquipmentAreaName: '',
|
||||
name: '',
|
||||
current: 1,
|
||||
size: 10
|
||||
},
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
async init() {
|
||||
const TreeListQuery = {
|
||||
current: 1,
|
||||
size: 500
|
||||
}
|
||||
this.menuList.splice(0, this.menuList.length)
|
||||
this.menuList = [
|
||||
{
|
||||
'name': '全部',
|
||||
'children': []
|
||||
}
|
||||
]
|
||||
const res = await equipmentDetectTreeList(TreeListQuery)
|
||||
if (res.code === 0) {
|
||||
this.menuList[0].children = res.data
|
||||
if (this.menuList[0].children) {
|
||||
this.menuList[0].children.forEach(item => {
|
||||
item.name = item.detectArea
|
||||
if (item.detectSystemVoList) {
|
||||
item.children = item.detectSystemVoList
|
||||
item.detectSystemVoList.forEach(item1 => {
|
||||
if (item1.equipmentVoList) { item1.children = item1.equipmentVoList }
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
this.getList()
|
||||
},
|
||||
getList() {
|
||||
equipmentDetectParamList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
})
|
||||
},
|
||||
getOrganization(data) {
|
||||
if (data.detectEquipmentAreaId) {
|
||||
this.listQuery.detectEquipmentAreaId = data.detectEquipmentAreaId
|
||||
this.listQuery.detectEquipmentAreaName = data.name
|
||||
this.getList()
|
||||
} else {
|
||||
this.listQuery.detectEquipmentAreaId = ''
|
||||
this.listQuery.detectEquipmentAreaName = ''
|
||||
}
|
||||
},
|
||||
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(() => {
|
||||
equipmentDetectParamDelete(raw.data.id).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.addNew(raw.data.id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.drawer-footer {
|
||||
width: 100%;
|
||||
margin-top: 50px;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
padding: 10px 50px;
|
||||
text-align: left;
|
||||
background: #fff;
|
||||
}
|
||||
.el-container >>> .el-aside{
|
||||
border:2px solid #E4E4E4;
|
||||
border-radius:10px;
|
||||
background-color: white;
|
||||
min-height:550px;
|
||||
padding-top:20px
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,180 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @LastEditTime: 2021-07-26 14:03:06
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
|
||||
:visible.sync="visible"
|
||||
><el-row :gutter="10">
|
||||
<el-form
|
||||
ref="dataForm"
|
||||
:model="dataForm"
|
||||
:rules="rules"
|
||||
size="medium"
|
||||
label-width="180px"
|
||||
label-position="left"
|
||||
>
|
||||
<el-col :span="10">
|
||||
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.TestParameterName')" prop="name">
|
||||
<el-input v-model="dataForm.name" :placeholder="$t('module.basicData.equipmentDetectInfo.TestParameterName')" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.ReferenceValue')" prop="value">
|
||||
<el-input v-model="dataForm.value" :placeholder="$t('module.basicData.equipmentDetectInfo.ReferenceValue')" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.TestFrequency')" prop="testFrequency">
|
||||
<el-input v-model="dataForm.testFrequency" :placeholder="$t('module.basicData.equipmentDetectInfo.TestFrequency')" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.TestSystem')" prop="testSystem">
|
||||
<el-select v-model="dataForm.testSystem" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipmentDetectInfo.TestSystem')])" clearable>
|
||||
<el-option
|
||||
v-for="item in DetectSystemList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.name"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.IssueOrNot')" prop="distribution">
|
||||
<el-switch v-model="dataForm.distribution" active-value="1" inactive-value="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item :label="$t('module.basicData.visual.Description')" prop="description">
|
||||
<el-input v-model="dataForm.description" :placeholder="$t('module.basicData.visual.Description')" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
|
||||
<el-input v-model="dataForm.remark" :placeholder="$t('module.basicData.visual.Remarks')" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<div class="drawer-footer">
|
||||
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { equipmentDetectSystemList } from '@/api/basicData/Equipment/equipmentDetectSystem'
|
||||
import { equipmentDetectParamDetail, equipmentDetectParamUpdate, equipmentDetectParamAdd } from '@/api/basicData/Equipment/equipmentDetectParam'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
detectEquipmentAreaId: {
|
||||
type: String,
|
||||
default: () => {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
name: undefined,
|
||||
value: undefined,
|
||||
testFrequency: undefined,
|
||||
testSystem: undefined,
|
||||
distribution: false,
|
||||
description: undefined,
|
||||
remark: undefined
|
||||
},
|
||||
DetectSystemList: [],
|
||||
rules: {
|
||||
name: [],
|
||||
value: [],
|
||||
testFrequency: [],
|
||||
testSystem: [],
|
||||
description: [],
|
||||
remark: []
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
const params = {
|
||||
current: 1,
|
||||
size: 500
|
||||
}
|
||||
equipmentDetectSystemList(params).then(response => {
|
||||
if (response.data.records) {
|
||||
this.DetectSystemList = response.data.records
|
||||
} else {
|
||||
this.DetectSystemList.splice(0, this.DetectSystemList.length)
|
||||
}
|
||||
})
|
||||
this.dataForm.id = id || ''
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
equipmentDetectParamDetail(this.dataForm.id).then(res => {
|
||||
this.dataForm = res.data
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = this.dataForm
|
||||
data.detectEquipmentAreaId = this.detectEquipmentAreaId
|
||||
if (this.dataForm.id) {
|
||||
equipmentDetectParamUpdate(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
equipmentDetectParamAdd(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.drawer-footer {
|
||||
width: 100%;
|
||||
margin-top: 50px;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
padding: 10px 50px;
|
||||
text-align: left;
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,122 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-05-21 10:44:13
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
|
||||
:visible.sync="visible"
|
||||
>
|
||||
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="200px" @keyup.enter.native="dataFormSubmit()">
|
||||
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.equipmentDetectSystemName')" prop="name">
|
||||
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipmentDetectInfo.equipmentDetectSystemName')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.code')" prop="code">
|
||||
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipmentDetectInfo.code')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.equipmentDetectSystemAbbr')" prop="abbr">
|
||||
<el-input v-model="dataForm.abbr" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipmentDetectInfo.equipmentDetectSystemAbbr')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.equipment.FunctionDescription')" prop="description">
|
||||
<el-input v-model="dataForm.description" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.FunctionDescription')])" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { equipmentDetectSystemDetail, equipmentDetectSystemUpdate, equipmentDetectSystemAdd, equipmentDetectSystemCode } from '@/api/basicData/Equipment/equipmentDetectSystem'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
name: '',
|
||||
code: '',
|
||||
abbr: '',
|
||||
description: ''
|
||||
},
|
||||
dataRule: {
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipmentDetectInfo.equipmentDetectSystemName')]),
|
||||
trigger: 'blur' }
|
||||
],
|
||||
code: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipmentDetectInfo.code')]),
|
||||
trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || ''
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
equipmentDetectSystemDetail(this.dataForm.id).then(res => {
|
||||
this.dataForm = res.data
|
||||
})
|
||||
} else {
|
||||
equipmentDetectSystemCode().then(res => {
|
||||
this.dataForm.code = res.data
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
'name': this.dataForm.name,
|
||||
'code': this.dataForm.code,
|
||||
'abbr': this.dataForm.abbr,
|
||||
'description': this.dataForm.description,
|
||||
'id': this.dataForm.id
|
||||
}
|
||||
if (this.dataForm.id) {
|
||||
equipmentDetectSystemUpdate(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
equipmentDetectSystemAdd(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
113
src/views/basicData/Equipment/components/equipmentGroup-add.vue
Normal file
113
src/views/basicData/Equipment/components/equipmentGroup-add.vue
Normal file
@@ -0,0 +1,113 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @LastEditTime: 2021-05-13 14:33:42
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
|
||||
:visible.sync="visible"
|
||||
>
|
||||
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="110px" @keyup.enter.native="dataFormSubmit()">
|
||||
<el-form-item :label="$t('module.basicData.equipment.groupName')" prop="groupName">
|
||||
<el-input v-model="dataForm.groupName" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.groupName')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.equipment.groupCode')" prop="groupCode">
|
||||
<el-input v-model="dataForm.groupCode" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.groupCode')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
|
||||
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { equipmentGroupUpdate, equipmentGroupAdd, equipmentGroupDetail, equipmentGroupGetCode } from '@/api/basicData/Equipment/equipmentGroup'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
groupName: '',
|
||||
groupCode: '',
|
||||
remark: ''
|
||||
},
|
||||
dataRule: {
|
||||
groupName: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.factory.FactoryName')]),
|
||||
trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getCode()
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || ''
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
equipmentGroupDetail(this.dataForm.id).then(res => {
|
||||
this.dataForm = res.data
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
getCode() {
|
||||
equipmentGroupGetCode().then(res => {
|
||||
if (res.code === 0) {
|
||||
this.dataForm.groupCode = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = this.dataForm
|
||||
if (this.dataForm.id) {
|
||||
equipmentGroupUpdate(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
equipmentGroupAdd(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
664
src/views/basicData/Equipment/components/equipmentInfo-add.vue
Normal file
664
src/views/basicData/Equipment/components/equipmentInfo-add.vue
Normal file
@@ -0,0 +1,664 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
-->
|
||||
<template>
|
||||
<div style="margin:20px">
|
||||
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px;margin:20px">{{ isdetail? 'btn.detail' : !listQuery.equipmentId ? 'btn.add' : 'btn.edit' | i18nFilter }}</div>
|
||||
<div style="margin:0 15px">
|
||||
<el-form
|
||||
ref="dataForm"
|
||||
:model="dataForm"
|
||||
:rules="rules"
|
||||
size="medium"
|
||||
label-width="220px"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.equipment.EquipmentName')" prop="name">
|
||||
<el-input v-model="dataForm.name" autofocus :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentName')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.equipment.EquipmentCode')" prop="code">
|
||||
<el-input v-model="dataForm.code" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentCode')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.visual.EnglishName')" prop="enName">
|
||||
<el-input v-model="dataForm.enName" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.EnglishName')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.visual.Abbreviation')" prop="abbr">
|
||||
<el-input v-model="dataForm.abbr" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Abbreviation')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.equipment.EquipmentType')" prop="equipmentType">
|
||||
<el-select
|
||||
v-model="dataForm.equipmentType"
|
||||
:disabled="isdetail"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentType')])"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in equipmentTypeOption"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
:disabled="item.disabled"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.equipment.EquipmentGrouping')" prop="groupId">
|
||||
<el-select
|
||||
v-model="dataForm.groupId"
|
||||
:disabled="isdetail"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentGrouping')])"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in equipmentGroupOption"
|
||||
:key="index"
|
||||
:label="item.groupName"
|
||||
:value="item.id"
|
||||
:disabled="item.disabled"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.visual.Specs')" prop="spec">
|
||||
<el-input v-model="dataForm.spec" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Specs')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.visual.productionTime')" prop="productionTime">
|
||||
<el-date-picker
|
||||
v-model="dataForm.productionTime"
|
||||
:disabled="isdetail"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
:style="{width: '100%'}"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.productionTime')])"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.visual.enterTime')" prop="enterTime">
|
||||
<el-date-picker
|
||||
v-model="dataForm.enterTime"
|
||||
:disabled="isdetail"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
:style="{width: '100%'}"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.enterTime')])"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.visual.debugTime')" prop="debugTime">
|
||||
<el-date-picker
|
||||
v-model="dataForm.debugTime"
|
||||
:disabled="isdetail"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
:style="{width: '100%'}"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.debugTime')])"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.equipment.DebugPeriod')" prop="debugPeriod">
|
||||
<el-input v-model="dataForm.debugPeriod" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.DebugPeriod')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.visual.Manufacturer')" prop="manufacturer">
|
||||
<el-input
|
||||
v-model="dataForm.manufacturer"
|
||||
:disabled="isdetail"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Manufacturer')])"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.equipment.intellectualProperty')" prop="intellectualProperty">
|
||||
<el-input
|
||||
v-model="dataForm.intellectualProperty"
|
||||
:disabled="isdetail"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.intellectualProperty')])"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.equipment.rangeNumber')" prop="rangeNumber">
|
||||
<el-input-number
|
||||
v-model="dataForm.rangeNumber"
|
||||
:disabled="isdetail"
|
||||
:step="1"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.rangeNumber')])"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
|
||||
<el-input v-model="dataForm.remark" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.visual.Description')" prop="description">
|
||||
<el-input v-model="dataForm.description" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Description')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.equipment.plcVersion')" prop="plcVersion">
|
||||
<el-input v-model="dataForm.plcVersion" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.plcVersion')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.equipment.eapVersion')" prop="eapVersion">
|
||||
<el-input v-model="dataForm.eapVersion" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.eapVersion')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.equipment.maintenanceCycle')" prop="maintenanceCycle">
|
||||
<el-input v-model="dataForm.maintenanceCycle" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.maintenanceCycle')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.equipment.maintenanceTime')" prop="maintenanceTime">
|
||||
<el-input v-model="dataForm.maintenanceTime" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.maintenanceTime')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="4">
|
||||
<el-form-item :label="$t('module.basicData.equipment.E10Status')" prop="estatus">
|
||||
<el-switch
|
||||
v-model="dataForm.estatus"
|
||||
:disabled="isdetail"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#AAAAAA"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item :label="$t('module.basicData.equipment.activiation')" prop="activiation">
|
||||
<el-switch
|
||||
v-model="dataForm.activiation"
|
||||
:disabled="isdetail"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#AAAAAA"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item :label="$t('module.basicData.equipment.communication')" prop="communication">
|
||||
<el-switch
|
||||
v-model="dataForm.communication"
|
||||
:disabled="isdetail"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#AAAAAA"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item :label="$t('module.basicData.equipment.controlStatus')" prop="controlStatus">
|
||||
<el-switch
|
||||
v-model="dataForm.controlStatus"
|
||||
:disabled="isdetail"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
active-text="远程"
|
||||
inactive-text="本地"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#AAAAAA"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="9">
|
||||
<el-form-item v-if="listQuery.equipmentId && !isdetail" :label="$t('module.basicData.equipment.equipmentImg')" prop="eImg">
|
||||
<el-upload
|
||||
ref="eImg"
|
||||
name="files"
|
||||
:data="typeCode"
|
||||
:file-list="eImgfileList"
|
||||
:action="eImgAction"
|
||||
:before-upload="eImgBeforeUpload"
|
||||
accept="image/*"
|
||||
:on-success="saveUpload"
|
||||
>
|
||||
<el-button size="small" type="primary" icon="el-icon-upload">{{ 'btn.upload' | i18nFilter }}</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="isdetail" :label="$t('module.basicData.equipment.equipmentImg')" prop="upInfo">
|
||||
<div v-for="item in imgList" :key="item.id">
|
||||
{{ item.fileName }} <el-button size="small" type="primary" icon="el-icon-upload" @click="downloadFile(item.fileId)">{{ 'btn.download' | i18nFilter }}</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="9">
|
||||
<el-form-item v-if="listQuery.equipmentId && !isdetail" :label="$t('module.basicData.equipment.equipmentInfo')" prop="eInfo">
|
||||
<el-upload
|
||||
ref="eInfo"
|
||||
:on-success="saveUpload"
|
||||
name="files"
|
||||
:data="typeCode"
|
||||
:file-list="eInfofileList"
|
||||
:action="eInfoAction"
|
||||
multiple
|
||||
:before-upload="eInfoBeforeUpload"
|
||||
>
|
||||
<el-button size="small" type="primary" icon="el-icon-upload">{{ 'btn.upload' | i18nFilter }}</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="isdetail" :label="$t('module.basicData.equipment.equipmentInfo')" prop="upInfo">
|
||||
<div v-for="item in fileList" :key="item.id">
|
||||
{{ item.fileName }} <el-button size="small" type="primary" icon="el-icon-upload" @click="downloadFile(item.fileId)">{{ 'btn.download' | i18nFilter }}</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div style="margin:20px">
|
||||
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
|
||||
<el-button v-if="isdetail" type="primary" @click="goEdit()">{{ 'btn.edit' | i18nFilter }}</el-button>
|
||||
<span v-if="!isdetail">
|
||||
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.save' | i18nFilter }}</el-button>
|
||||
<el-button v-if="listQuery.equipmentId" type="primary" @click="addNew()">{{ 'btn.addattr' | i18nFilter }}</el-button>
|
||||
</span>
|
||||
</div>
|
||||
<div style="overflow:auto;height:380px">
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
:is-loading="listLoading"
|
||||
>
|
||||
<method-btn
|
||||
v-if="!isdetail"
|
||||
slot="handleBtn"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
</div>
|
||||
</div>
|
||||
<equipment-info-attr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :equipment-id="listQuery.equipmentId" @refreshDataList="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>import i18n from '@/lang'
|
||||
import {
|
||||
equipmentInfoDetail,
|
||||
equipmentInfoUpdate,
|
||||
equipmentInfoAdd,
|
||||
equipmentInfoCode,
|
||||
equipmentInfoFileAdd,
|
||||
getEquipmentInfoFile
|
||||
} from '@/api/basicData/Equipment/equipmentInfo'
|
||||
import { equipmentGroupList } from '@/api/basicData/Equipment/equipmentGroup'
|
||||
import { equipmentInfoAttrList, equipmentInfoAttrDelete } from '@/api/basicData/Equipment/equipmentInfoAttr'
|
||||
import { equipmentTypeList } from '@/api/basicData/Equipment/equipmentType'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
import equipmentInfoAttrAdd from './equipmentInfoAttr-add'
|
||||
import { uploadPath } from '@/api/basic'
|
||||
import { timeFormatter } from '@/filters'
|
||||
import { getUrl } from '@/api/file'
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: i18n.t('module.basicData.factory.createTime'),
|
||||
filter: timeFormatter,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'attrName',
|
||||
label: i18n.t('module.basicData.visual.AttributeName'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'attrValue',
|
||||
label: i18n.t('module.basicData.visual.AttributeValue'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: i18n.t('module.basicData.visual.Remarks'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
components: { BaseTable, MethodBtn, equipmentInfoAttrAdd },
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateVisible: false,
|
||||
tableBtn,
|
||||
trueWidth: 200,
|
||||
tableProps,
|
||||
list: [],
|
||||
listLoading: false,
|
||||
dataForm: {
|
||||
name: '',
|
||||
code: '',
|
||||
enName: '',
|
||||
abbr: '',
|
||||
equipmentType: '',
|
||||
spec: '',
|
||||
productionTime: '',
|
||||
enterTime: '',
|
||||
debugTime: '',
|
||||
debugPeriod: '',
|
||||
manufacturer: '',
|
||||
intellectualProperty: '',
|
||||
rangeNumber: '',
|
||||
remark: '',
|
||||
description: '',
|
||||
groupId: '',
|
||||
eImg: null,
|
||||
eInfo: null,
|
||||
communication: 0,
|
||||
controlStatus: 0,
|
||||
plcVersion: '',
|
||||
eapVersion: '',
|
||||
activiation: 0,
|
||||
estatus: 0,
|
||||
maintenanceTime: '',
|
||||
maintenanceCycle: ''
|
||||
},
|
||||
rules: {
|
||||
name: [{
|
||||
required: true,
|
||||
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.EquipmentName')]),
|
||||
trigger: 'blur'
|
||||
}],
|
||||
code: [{
|
||||
required: true,
|
||||
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.EquipmentCode')]),
|
||||
trigger: 'blur'
|
||||
}],
|
||||
equipmentType: [{
|
||||
required: true,
|
||||
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.EquipmentType')]),
|
||||
trigger: 'change'
|
||||
}],
|
||||
maintenanceCycle: [{
|
||||
required: true,
|
||||
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.maintenanceCycle')]),
|
||||
trigger: 'blur'
|
||||
}],
|
||||
maintenanceTime: [{
|
||||
required: true,
|
||||
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.maintenanceTime')]),
|
||||
trigger: 'blur'
|
||||
}]
|
||||
},
|
||||
typeCode: {},
|
||||
eImgAction: uploadPath,
|
||||
eImgfileList: [],
|
||||
eInfoAction: uploadPath,
|
||||
eInfofileList: [],
|
||||
equipmentTypeOption: [],
|
||||
equipmentGroupOption: [],
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 990,
|
||||
equipmentId: ''
|
||||
},
|
||||
isdetail: false,
|
||||
downloadList: [],
|
||||
fileList: [],
|
||||
imgList: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.listQuery.equipmentId = this.$route.query.id
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.isdetail = false
|
||||
this.isdetail = Boolean(this.$route.query.isdetail)
|
||||
if (this.isdetail) {
|
||||
const data =
|
||||
{
|
||||
'equipmentId': this.listQuery.equipmentId
|
||||
}
|
||||
getEquipmentInfoFile(data).then(res => {
|
||||
this.downloadList = res.data
|
||||
this.downloadList.forEach(item => {
|
||||
if (item.typeCode === 'equipmentInfoImage') {
|
||||
this.imgList.push(item)
|
||||
} else {
|
||||
this.fileList.push(item)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
this.list.splice(0, this.list.length)
|
||||
equipmentTypeList(this.listQuery).then(response => {
|
||||
this.equipmentTypeOption = response.data.records
|
||||
})
|
||||
equipmentGroupList(this.listQuery).then(response => {
|
||||
this.equipmentGroupOption = response.data.records
|
||||
})
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.listQuery.equipmentId) {
|
||||
this.listLoading = true
|
||||
equipmentInfoDetail(this.listQuery.equipmentId).then(res => {
|
||||
this.dataForm = res.data
|
||||
})
|
||||
equipmentInfoAttrList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
this.listLoading = false
|
||||
})
|
||||
} else {
|
||||
equipmentInfoCode().then(res => {
|
||||
this.dataForm.code = res.data
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
equipmentInfoAttrList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.attrName}]?`, this.$t('module.basicData.visual.Tips'), {
|
||||
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
|
||||
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
equipmentInfoAttrDelete(raw.data.id).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.addNew(raw.data.id)
|
||||
}
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
console.log(this.dataForm)
|
||||
console.log(this.dataForm.eInfo)
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = this.dataForm
|
||||
data.id = this.listQuery.equipmentId
|
||||
if (this.listQuery.equipmentId) {
|
||||
equipmentInfoUpdate(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
})
|
||||
} else {
|
||||
equipmentInfoAdd(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
this.listQuery.equipmentId = res.data.id
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
goback() {
|
||||
this.$router.go(-1)
|
||||
},
|
||||
goEdit() {
|
||||
this.isdetail = false
|
||||
},
|
||||
eImgBeforeUpload(file) {
|
||||
this.typeCode.typeCode = 'equipmentInfoImage'
|
||||
const isRightSize = file.size / 1024 / 1024 < 10
|
||||
if (!isRightSize) {
|
||||
this.$message.error(this.$t('upload.picSizeAlarm'))
|
||||
}
|
||||
const isAccept = new RegExp('image/*').test(file.type)
|
||||
if (!isAccept) {
|
||||
this.$message.error(this.$t('upload.picAlarm'))
|
||||
}
|
||||
return isRightSize && isAccept
|
||||
},
|
||||
eInfoBeforeUpload(file) {
|
||||
this.typeCode.typeCode = 'equipmentInfoFile'
|
||||
const isRightSize = file.size / 1024 / 1024 < 10
|
||||
if (!isRightSize) {
|
||||
this.$message.error(this.$t('upload.picSizeAlarm'))
|
||||
}
|
||||
return isRightSize
|
||||
},
|
||||
submitUpload() {
|
||||
this.$refs['eInfo'].submit()
|
||||
},
|
||||
saveUpload(res) {
|
||||
const data =
|
||||
{
|
||||
'equipmentId': this.listQuery.equipmentId,
|
||||
'fileId': res.data[0].id,
|
||||
'fileName': res.data[0].fileName,
|
||||
'fileUrl': res.data[0].fileUrl,
|
||||
'typeCode': this.typeCode.typeCode
|
||||
}
|
||||
console.log(data)
|
||||
equipmentInfoFileAdd(data).then(res => {
|
||||
console.log(res)
|
||||
})
|
||||
},
|
||||
downloadFile(id) {
|
||||
getUrl({
|
||||
attachmentId: id,
|
||||
type: 1
|
||||
}).then(response => {
|
||||
let fileName = ''
|
||||
const contentDisposition = response.headers['content-disposition']
|
||||
if (contentDisposition) {
|
||||
fileName = contentDisposition.slice(contentDisposition.indexOf('filename=') + 9)
|
||||
}
|
||||
const blob = new Blob([response.data])
|
||||
const reader = new FileReader()
|
||||
reader.readAsDataURL(blob)
|
||||
reader.onload = (e) => {
|
||||
const a = document.createElement('a')
|
||||
a.download = fileName
|
||||
a.href = e.target.result
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
document.body.removeChild(a)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.drawer-footer {
|
||||
width: 100%;
|
||||
margin-top: 50px;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
padding: 10px 50px;
|
||||
text-align: left;
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,135 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-03-25 16:31:46
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-drawer
|
||||
:append-to-body="true"
|
||||
:show-close="false"
|
||||
:visible.sync="visible"
|
||||
size="40%"
|
||||
>
|
||||
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px">
|
||||
{{ !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}
|
||||
</div>
|
||||
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="130px" @keyup.enter.native="dataFormSubmit()">
|
||||
<el-form-item :label="$t('module.basicData.visual.AttributeName')" prop="attrName">
|
||||
<el-input v-model="dataForm.attrName" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.AttributeName')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.visual.AttributeValue')" prop="attrValue">
|
||||
<el-input v-model="dataForm.attrValue" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.AttributeValue')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
|
||||
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="drawer-footer">
|
||||
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" :loading="btnLoading" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { equipmentInfoAttrDetail, equipmentInfoAttrUpdate, equipmentInfoAttrAdd } from '@/api/basicData/Equipment/equipmentInfoAttr'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
equipmentId: {
|
||||
type: String,
|
||||
default: () => {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
btnLoading: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
attrName: '',
|
||||
attrValue: '',
|
||||
remark: ''
|
||||
},
|
||||
dataRule: {
|
||||
attrName: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.AttributeName')]), trigger: 'blur' }
|
||||
],
|
||||
attrValue: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.AttributeValue')]), trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || ''
|
||||
this.btnLoading = false
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
equipmentInfoAttrDetail(this.dataForm.id).then(res => {
|
||||
this.dataForm = res.data
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.btnLoading = true
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
'attrName': this.dataForm.attrName,
|
||||
'attrValue': this.dataForm.attrValue,
|
||||
'remark': this.dataForm.remark,
|
||||
'equipmentId': this.equipmentId,
|
||||
'id': this.dataForm.id
|
||||
}
|
||||
if (this.dataForm.id) {
|
||||
equipmentInfoAttrUpdate(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
equipmentInfoAttrAdd(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.drawer-footer {
|
||||
width: 100%;
|
||||
margin-top: 50px;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
padding: 10px 50px;
|
||||
text-align: left;
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
542
src/views/basicData/Equipment/components/equipmentLink-add.vue
Normal file
542
src/views/basicData/Equipment/components/equipmentLink-add.vue
Normal file
@@ -0,0 +1,542 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-03-22 15:32:41
|
||||
* @enName:
|
||||
-->
|
||||
<template>
|
||||
<div style="margin:20px">
|
||||
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px;margin:20px">
|
||||
{{ isdetail? 'btn.detail' : !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}
|
||||
</div>
|
||||
<div style="margin:0 15px">
|
||||
<el-row :gutter="15">
|
||||
<el-form
|
||||
ref="dataForm"
|
||||
:model="dataForm"
|
||||
:rules="rules"
|
||||
size="medium"
|
||||
label-width="120px"
|
||||
label-position="right"
|
||||
>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.equipment.WiredEquipment')" prop="name">
|
||||
<el-input v-model="dataForm.name" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.WiredEquipment')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.equipment.WiredCode')" prop="code">
|
||||
<el-input v-model="dataForm.code" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.WiredCode')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.visual.EnglishName')" prop="enName">
|
||||
<el-input v-model="dataForm.enName" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.EnglishName')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.visual.Abbreviation')" prop="abbr">
|
||||
<el-input v-model="dataForm.abbr" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Abbreviation')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.visual.Manufacturer')" prop="manufacturer">
|
||||
<el-input
|
||||
v-model="dataForm.manufacturer"
|
||||
:disabled="isdetail"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Manufacturer')])"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.visual.Specs')" prop="spec">
|
||||
<el-input v-model="dataForm.spec" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Specs')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.visual.productionTime')" prop="productionTime">
|
||||
<el-date-picker
|
||||
v-model="dataForm.productionTime"
|
||||
:disabled="isdetail"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
:style="{width: '100%'}"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.productionTime')])"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.visual.enterTime')" prop="enterTime">
|
||||
<el-date-picker
|
||||
v-model="dataForm.enterTime"
|
||||
:disabled="isdetail"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
:style="{width: '100%'}"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.enterTime')])"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.visual.debugTime')" prop="debugTime">
|
||||
<el-date-picker
|
||||
v-model="dataForm.debugTime"
|
||||
:disabled="isdetail"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
:style="{width: '100%'}"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.debugTime')])"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.equipment.DebugPeriod')" prop="debugPeriod">
|
||||
<el-input v-model="dataForm.debugPeriod" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.DebugPeriod')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.equipment.connectUpperDevice')" prop="connectUpperDevice">
|
||||
<el-input
|
||||
v-model="dataForm.connectUpperDevice"
|
||||
:disabled="isdetail"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.connectUpperDevice')])"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.equipment.connectLowerDevice')" prop="connectLowerDevice">
|
||||
<el-input
|
||||
v-model="dataForm.connectLowerDevice"
|
||||
:disabled="isdetail"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.connectLowerDevice')])"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.visual.CurrentState')" prop="currentStatus">
|
||||
<el-select
|
||||
v-model="dataForm.currentStatus"
|
||||
:disabled="isdetail"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.CurrentState')])"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in currentStatusOptions"
|
||||
:key="index"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
:disabled="item.disabled"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
|
||||
<el-input v-model="dataForm.remark" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="9">
|
||||
<el-form-item v-if="listQuery.connectingDeviceId && !isdetail" :label="$t('module.basicData.equipment.equipmentImg')" prop="eImg">
|
||||
<el-upload
|
||||
ref="eImg"
|
||||
name="files"
|
||||
:data="typeCode"
|
||||
:file-list="eImgfileList"
|
||||
:action="eImgAction"
|
||||
:before-upload="eImgBeforeUpload"
|
||||
accept="image/*"
|
||||
:on-success="saveUpload"
|
||||
>
|
||||
<el-button size="small" type="primary" icon="el-icon-upload">{{ 'btn.upload' | i18nFilter }}</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="isdetail" :label="$t('module.basicData.equipment.equipmentImg')" prop="upInfo">
|
||||
<div v-for="item in imgList" :key="item.id">
|
||||
{{ item.fileName }} <el-button size="small" type="primary" icon="el-icon-upload" @click="downloadFile(item.fileId)">{{ 'btn.download' | i18nFilter }}</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="9">
|
||||
<el-form-item v-if="listQuery.connectingDeviceId && !isdetail" :label="$t('module.basicData.equipment.equipmentInfo')" prop="upInfo">
|
||||
<el-upload
|
||||
ref="upInfo"
|
||||
name="files"
|
||||
:data="typeCode"
|
||||
:file-list="upInfofileList"
|
||||
:action="upInfoAction"
|
||||
multiple
|
||||
:before-upload="upInfoBeforeUpload"
|
||||
:on-success="saveUpload"
|
||||
>
|
||||
<el-button size="small" type="primary" icon="el-icon-upload">{{ 'btn.upload' | i18nFilter }}</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="isdetail" :label="$t('module.basicData.equipment.equipmentInfo')" prop="upInfo">
|
||||
<div v-for="item in fileList" :key="item.id">
|
||||
{{ item.fileName }} <el-button size="small" type="primary" icon="el-icon-upload" @click="downloadFile(item.fileId)">{{ 'btn.download' | i18nFilter }}</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<div style="margin:20px">
|
||||
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
|
||||
<el-button v-if="isdetail" type="primary" @click="goEdit()">{{ 'btn.edit' | i18nFilter }}</el-button>
|
||||
<span v-if="!isdetail">
|
||||
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.save' | i18nFilter }}</el-button>
|
||||
<el-button v-if="listQuery.connectingDeviceId" type="primary" @click="addNew()">{{ 'btn.addattr' | i18nFilter }}</el-button>
|
||||
</span>
|
||||
</div>
|
||||
<div style="height:380px;overflow:auto">
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
>
|
||||
<method-btn
|
||||
v-if="!isdetail"
|
||||
slot="handleBtn"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
</div>
|
||||
</div>
|
||||
<equipment-link-attr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :connecting-device-id="listQuery.connectingDeviceId" @refreshDataList="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>import i18n from '@/lang'
|
||||
import {
|
||||
equipmentLinkDetail,
|
||||
equipmentLinkUpdate,
|
||||
equipmentLinkAdd,
|
||||
equipmentLinkCode,
|
||||
equipmentLinkFileAdd,
|
||||
getEquipmentLinkFile
|
||||
} from '@/api/basicData/Equipment/equipmentLink'
|
||||
import { equipmentLinkAttrList, equipmentLinkAttrDelete } from '@/api/basicData/Equipment/equipmentLinkAttr'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
import equipmentLinkAttrAdd from './equipmentLinkAttr-add'
|
||||
import { uploadPath } from '@/api/basic'
|
||||
import { timeFormatter } from '@/filters'
|
||||
import { getUrl } from '@/api/file'
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: i18n.t('module.basicData.factory.createTime'),
|
||||
filter: timeFormatter,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: i18n.t('module.basicData.visual.AttributeName'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'code',
|
||||
label: i18n.t('module.basicData.visual.AttributeCode'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: i18n.t('module.basicData.visual.Remarks'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
components: { BaseTable, MethodBtn, equipmentLinkAttrAdd },
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateVisible: false,
|
||||
tableBtn,
|
||||
trueWidth: 200,
|
||||
tableProps,
|
||||
list: [],
|
||||
dataForm: {
|
||||
id: 0,
|
||||
name: '',
|
||||
code: '',
|
||||
enName: '',
|
||||
abbr: '',
|
||||
manufacturer: '',
|
||||
spec: '',
|
||||
productionTime: '',
|
||||
enterTime: '',
|
||||
debugTime: '',
|
||||
debugPeriod: '',
|
||||
connectUpperDevice: '',
|
||||
connectLowerDevice: '',
|
||||
currentStatus: '',
|
||||
remark: '',
|
||||
eImg: null,
|
||||
upInfo: null
|
||||
},
|
||||
rules: {
|
||||
name: [{
|
||||
required: true,
|
||||
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.WiredEquipment')]),
|
||||
trigger: 'blur'
|
||||
}],
|
||||
code: [{
|
||||
required: true,
|
||||
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.WiredCode')]),
|
||||
trigger: 'blur'
|
||||
}]
|
||||
},
|
||||
typeCode: {},
|
||||
eImgAction: uploadPath,
|
||||
eImgfileList: [],
|
||||
upInfoAction: uploadPath,
|
||||
upInfofileList: [],
|
||||
currentStatusOptions: [{
|
||||
'label': '正常',
|
||||
'value': 0
|
||||
}, {
|
||||
'label': '暂停',
|
||||
'value': 1
|
||||
}, {
|
||||
'label': '维修',
|
||||
'value': 2
|
||||
}],
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 990,
|
||||
connectingDeviceId: ''
|
||||
},
|
||||
isdetail: false,
|
||||
downloadList: [],
|
||||
fileList: [],
|
||||
imgList: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.listQuery.connectingDeviceId = this.$route.query.id
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.isdetail = false
|
||||
this.isdetail = Boolean(this.$route.query.isdetail)
|
||||
if (this.isdetail) {
|
||||
const data =
|
||||
{
|
||||
'connectingDeviceId': this.listQuery.connectingDeviceId
|
||||
}
|
||||
getEquipmentLinkFile(data).then(res => {
|
||||
this.downloadList = res.data
|
||||
this.downloadList.forEach(item => {
|
||||
if (item.typeCode === 'equipmentLinkImage') {
|
||||
this.imgList.push(item)
|
||||
} else {
|
||||
this.fileList.push(item)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
this.list.splice(0, this.list.length)
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.listQuery.connectingDeviceId) {
|
||||
equipmentLinkDetail(this.listQuery.connectingDeviceId).then(res => {
|
||||
this.dataForm = res.data
|
||||
})
|
||||
equipmentLinkAttrList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
equipmentLinkCode().then(res => {
|
||||
this.dataForm.code = res.data
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
getList() {
|
||||
equipmentLinkAttrList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
})
|
||||
},
|
||||
handleClick(raw) {
|
||||
console.log(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(() => {
|
||||
equipmentLinkAttrDelete(raw.data.id).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.addNew(raw.data.id)
|
||||
}
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
'abbr': this.dataForm.abbr,
|
||||
'code': this.dataForm.code,
|
||||
'connectLowerDevice': this.dataForm.connectLowerDevice,
|
||||
'connectUpperDevice': this.dataForm.connectUpperDevice,
|
||||
'currentStatus': this.dataForm.currentStatus,
|
||||
'debugTime': this.dataForm.debugTime,
|
||||
'enName': this.dataForm.enName,
|
||||
'enterTime': this.dataForm.enterTime,
|
||||
'manufacturer': this.dataForm.manufacturer,
|
||||
'name': this.dataForm.name,
|
||||
'productionTime': this.dataForm.productionTime,
|
||||
'remark': this.dataForm.remark,
|
||||
'spec': this.dataForm.spec,
|
||||
'debugPeriod': this.dataForm.debugPeriod,
|
||||
'id': this.listQuery.connectingDeviceId
|
||||
}
|
||||
if (this.listQuery.connectingDeviceId) {
|
||||
equipmentLinkUpdate(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
})
|
||||
} else {
|
||||
equipmentLinkAdd(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
this.listQuery.connectingDeviceId = res.data.id
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
goback() {
|
||||
this.$router.go(-1)
|
||||
},
|
||||
goEdit() {
|
||||
this.isdetail = false
|
||||
},
|
||||
eImgBeforeUpload(file) {
|
||||
this.typeCode.typeCode = 'equipmentLinkImage'
|
||||
const isRightSize = file.size / 1024 / 1024 < 10
|
||||
if (!isRightSize) {
|
||||
this.$message.error(this.$t('upload.picSizeAlarm'))
|
||||
}
|
||||
const isAccept = new RegExp('image/*').test(file.type)
|
||||
if (!isAccept) {
|
||||
this.$message.error(this.$t('upload.picAlarm'))
|
||||
}
|
||||
return isRightSize && isAccept
|
||||
},
|
||||
upInfoBeforeUpload(file) {
|
||||
this.typeCode.typeCode = 'equipmentLinkFile'
|
||||
const isRightSize = file.size / 1024 / 1024 < 10
|
||||
if (!isRightSize) {
|
||||
this.$message.error(this.$t('upload.picSizeAlarm'))
|
||||
}
|
||||
return isRightSize
|
||||
},
|
||||
submitUpload() {
|
||||
this.$refs['upInfo'].submit()
|
||||
},
|
||||
saveUpload(res) {
|
||||
const data =
|
||||
{
|
||||
'connectingDeviceId': this.listQuery.connectingDeviceId,
|
||||
'fileId': res.data[0].id,
|
||||
'fileName': res.data[0].fileName,
|
||||
'fileUrl': res.data[0].fileUrl,
|
||||
'typeCode': this.typeCode.typeCode
|
||||
}
|
||||
equipmentLinkFileAdd(data).then(res => {
|
||||
console.log(res)
|
||||
})
|
||||
},
|
||||
downloadFile(id) {
|
||||
getUrl({
|
||||
attachmentId: id,
|
||||
type: 1
|
||||
}).then(response => {
|
||||
let fileName = ''
|
||||
const contentDisposition = response.headers['content-disposition']
|
||||
if (contentDisposition) {
|
||||
fileName = contentDisposition.slice(contentDisposition.indexOf('filename=') + 9)
|
||||
}
|
||||
const blob = new Blob([response.data])
|
||||
const reader = new FileReader()
|
||||
reader.readAsDataURL(blob)
|
||||
reader.onload = (e) => {
|
||||
const a = document.createElement('a')
|
||||
a.download = fileName
|
||||
a.href = e.target.result
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
document.body.removeChild(a)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.drawer-footer {
|
||||
width: 100%;
|
||||
margin-top: 50px;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
padding: 10px 50px;
|
||||
text-align: left;
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,141 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-03-25 16:31:54
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-drawer
|
||||
:append-to-body="true"
|
||||
:show-close="false"
|
||||
:visible.sync="visible"
|
||||
size="40%"
|
||||
>
|
||||
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px">
|
||||
{{ !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}
|
||||
</div>
|
||||
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px" @keyup.enter.native="dataFormSubmit()">
|
||||
<el-form-item :label="$t('module.basicData.visual.AttributeName')" prop="name">
|
||||
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.AttributeName')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.visual.AttributeCode')" prop="code">
|
||||
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.AttributeCode')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
|
||||
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="drawer-footer">
|
||||
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" :loading="btnLoading" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { equipmentLinkAttrDetail, equipmentLinkAttrUpdate, equipmentLinkAttrAdd, equipmentLinkAttrCode } from '@/api/basicData/Equipment/equipmentLinkAttr'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
connectingDeviceId: {
|
||||
type: String,
|
||||
default: () => {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
btnLoading: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
name: '',
|
||||
code: '',
|
||||
remark: ''
|
||||
},
|
||||
dataRule: {
|
||||
name: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.AttributeName')]), trigger: 'blur' }
|
||||
],
|
||||
code: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.AttributeCode')]), trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || ''
|
||||
this.btnLoading = false
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
equipmentLinkAttrDetail(this.dataForm.id).then(res => {
|
||||
this.dataForm.name = res.data.name
|
||||
this.dataForm.code = res.data.code
|
||||
this.dataForm.remark = res.data.remark
|
||||
})
|
||||
} else {
|
||||
equipmentLinkAttrCode().then(res => {
|
||||
this.dataForm.code = res.data
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.btnLoading = true
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
'name': this.dataForm.name,
|
||||
'code': this.dataForm.code,
|
||||
'remark': this.dataForm.remark,
|
||||
'connectingDeviceId': this.connectingDeviceId,
|
||||
'id': this.dataForm.id
|
||||
}
|
||||
if (this.dataForm.id) {
|
||||
equipmentLinkAttrUpdate(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
equipmentLinkAttrAdd(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.drawer-footer {
|
||||
width: 100%;
|
||||
margin-top: 50px;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
padding: 10px 50px;
|
||||
text-align: left;
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
248
src/views/basicData/Equipment/components/equipmentType-add.vue
Normal file
248
src/views/basicData/Equipment/components/equipmentType-add.vue
Normal file
@@ -0,0 +1,248 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-03-25 16:24:50
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="isdetail? 'btn.detail' : !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
|
||||
:visible.sync="visible"
|
||||
>
|
||||
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="180px" @keyup.enter.native="dataFormSubmit()">
|
||||
<el-form-item :label="$t('module.basicData.equipment.EquipmentTypeName')" prop="name">
|
||||
<el-input v-model="dataForm.name" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentTypeName')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.equipment.EquipmentTypeCode')" prop="code">
|
||||
<el-input v-model="dataForm.code" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentTypeCode')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.equipment.parentName')" prop="parentA">
|
||||
<el-cascader
|
||||
v-model="dataForm.parentA"
|
||||
:disabled="isdetail"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.parentName')])"
|
||||
:props="{ checkStrictly: true }"
|
||||
:options="parentArr"
|
||||
filterable
|
||||
clearable
|
||||
@change="setParent"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
|
||||
<el-input v-model="dataForm.remark" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="dataForm.id && !isdetail" :label="$t('module.basicData.visual.uploadInfo')" prop="upInfo">
|
||||
<el-upload
|
||||
ref="upInfo"
|
||||
name="files"
|
||||
:data="typeCode"
|
||||
:file-list="upInfofileList"
|
||||
:action="upInfoAction"
|
||||
multiple
|
||||
:before-upload="upInfoBeforeUpload"
|
||||
:on-success="saveUpload"
|
||||
>
|
||||
<el-button size="small" type="primary" icon="el-icon-upload">{{ 'btn.upload' | i18nFilter }}</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="isdetail" :label="$t('module.basicData.equipment.equipmentInfo')" prop="upInfo">
|
||||
<div v-for="item in fileList" :key="item.id">
|
||||
{{ item.fileName }} <el-button size="small" type="primary" icon="el-icon-upload" @click="downloadFile(item.fileId)">{{ 'btn.download' | i18nFilter }}</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
equipmentTypeDetail,
|
||||
equipmentTypeUpdate,
|
||||
equipmentTypeAdd,
|
||||
equipmentTypeCode,
|
||||
equipmentTypeListAll,
|
||||
equipmentTypeFileAdd,
|
||||
getEquipmentTypeFile
|
||||
} from '@/api/basicData/Equipment/equipmentType'
|
||||
import { uploadPath } from '@/api/basic'
|
||||
import { getUrl } from '@/api/file'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
parentArr: [],
|
||||
dataForm: {
|
||||
id: 0,
|
||||
name: '',
|
||||
code: '',
|
||||
parentA: '',
|
||||
parentName: '',
|
||||
parentId: '',
|
||||
remark: ''
|
||||
},
|
||||
typeCode: {},
|
||||
upInfoAction: uploadPath,
|
||||
upInfofileList: [],
|
||||
dataRule: {
|
||||
name: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.EquipmentTypeName')]), trigger: 'blur' }
|
||||
],
|
||||
code: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.EquipmentTypeCode')]), trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
isdetail: false,
|
||||
fileList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id, isdetail) {
|
||||
this.isdetail = false
|
||||
this.isdetail = isdetail
|
||||
if (this.isdetail) {
|
||||
const data =
|
||||
{
|
||||
'equipmentTypeId': id
|
||||
}
|
||||
getEquipmentTypeFile(data).then(res => {
|
||||
this.fileList = res.data
|
||||
this.fileList.forEach(item => {
|
||||
item.fileType = item.fileUrl.split('.')[1]
|
||||
})
|
||||
})
|
||||
}
|
||||
equipmentTypeCode().then(res => {
|
||||
this.dataForm.code = res.data
|
||||
})
|
||||
this.parentArr.splice(0, this.parentArr.length)
|
||||
equipmentTypeListAll().then(res => {
|
||||
res.data.forEach(item => {
|
||||
this.setArr(item)
|
||||
})
|
||||
this.parentArr = res.data
|
||||
})
|
||||
this.dataForm.id = id || ''
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
equipmentTypeDetail(this.dataForm.id).then(res => {
|
||||
this.dataForm = res.data
|
||||
this.dataForm.parentA = res.data.parentId + ',' + res.data.parentName
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
setArr(obj) {
|
||||
obj.value = obj.id + ',' + obj.name
|
||||
obj.label = obj.name
|
||||
if (obj.children) {
|
||||
obj.children.forEach(item => {
|
||||
this.setArr(item)
|
||||
})
|
||||
}
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
'name': this.dataForm.name,
|
||||
'code': this.dataForm.code,
|
||||
'remark': this.dataForm.remark,
|
||||
'id': this.dataForm.id,
|
||||
'parentId': this.dataForm.parentId,
|
||||
'parentName': this.dataForm.parentName
|
||||
}
|
||||
if (this.dataForm.id) {
|
||||
equipmentTypeUpdate(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
equipmentTypeAdd(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
setParent(key) {
|
||||
const str = key[key.length - 1]
|
||||
if (str) {
|
||||
this.dataForm.parentId = str.substring(0, str.indexOf(','))
|
||||
this.dataForm.parentName = str.substring(str.indexOf(',') + 1)
|
||||
}
|
||||
},
|
||||
upInfoBeforeUpload(file) {
|
||||
this.typeCode.typeCode = 'equipmentTypeFile'
|
||||
const isRightSize = file.size / 1024 / 1024 < 10
|
||||
if (!isRightSize) {
|
||||
this.$message.error(this.$t('upload.picSizeAlarm'))
|
||||
}
|
||||
return isRightSize
|
||||
},
|
||||
submitUpload() {
|
||||
this.$refs['upInfo'].submit()
|
||||
},
|
||||
saveUpload(res) {
|
||||
const data =
|
||||
{
|
||||
'equipmentTypeId': this.dataForm.id,
|
||||
'fileId': res.data[0].id,
|
||||
'fileName': res.data[0].fileName,
|
||||
'fileUrl': res.data[0].fileUrl,
|
||||
'typeCode': this.typeCode.typeCode
|
||||
}
|
||||
equipmentTypeFileAdd(data).then(res => {
|
||||
console.log(res)
|
||||
})
|
||||
},
|
||||
downloadFile(id) {
|
||||
getUrl({
|
||||
attachmentId: id,
|
||||
type: 1
|
||||
}).then(response => {
|
||||
let fileName = ''
|
||||
const contentDisposition = response.headers['content-disposition']
|
||||
if (contentDisposition) {
|
||||
fileName = contentDisposition.slice(contentDisposition.indexOf('filename=') + 9)
|
||||
}
|
||||
const blob = new Blob([response.data])
|
||||
const reader = new FileReader()
|
||||
reader.readAsDataURL(blob)
|
||||
reader.onload = (e) => {
|
||||
const a = document.createElement('a')
|
||||
a.download = fileName
|
||||
a.href = e.target.result
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
document.body.removeChild(a)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-03-12 16:29:08
|
||||
* @enName:
|
||||
-->
|
||||
<template>
|
||||
<el-drawer
|
||||
:visible.sync="visible"
|
||||
:show-close="false"
|
||||
:wrapper-closable="false"
|
||||
size="60%"
|
||||
>
|
||||
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px">{{ !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}</div>
|
||||
<div style="margin:0 15px">
|
||||
<el-form ref="dataForm" :model="dataForm" label-width="100px">
|
||||
<el-form-item :label="$t('module.basicData.equipment.EquipmentTypeName')" prop="name">
|
||||
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentTypeName')])" readonly />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.equipment.EquipmentTypeCode')" prop="code">
|
||||
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentTypeCode')])" readonly />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="drawer-footer">
|
||||
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
|
||||
<el-button v-if="listQuery.equipmentTypeId && !isDetail" type="primary" @click="addNew()">{{ 'btn.adddetail' | i18nFilter }}</el-button>
|
||||
</div>
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
>
|
||||
<method-btn
|
||||
v-if="!isDetail"
|
||||
slot="handleBtn"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
</div>
|
||||
<equipmentAlarm-attr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :equipment-type-id="listQuery.equipmentTypeId" @refreshDataList="getList" />
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script>import i18n from '@/lang'
|
||||
import { equipmentAlarmAttrList, equipmentAlarmAttrDelete } from '@/api/basicData/Equipment/equipmentAlarmAttr'
|
||||
import {
|
||||
equipmentTypeDetail
|
||||
} from '@/api/basicData/Equipment/equipmentType'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
import equipmentAlarmAttrAdd from './equipmentTypeAlarmAttr-add'
|
||||
import { timeFormatter } from '@/filters'
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: i18n.t('module.basicData.factory.createTime'),
|
||||
filter: timeFormatter,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'code',
|
||||
label: i18n.t('module.basicData.alarmManagement.AlarmCode'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'alarmType',
|
||||
label: i18n.t('module.basicData.alarmManagement.AlarmType'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'alarmGrade',
|
||||
label: i18n.t('module.basicData.alarmManagement.AlarmLevel'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'alarmContent',
|
||||
label: i18n.t('module.basicData.alarmManagement.AlarmContent'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
components: { BaseTable, MethodBtn, equipmentAlarmAttrAdd },
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
addOrUpdateVisible: false,
|
||||
categoryArr: [],
|
||||
tableBtn,
|
||||
trueWidth: 200,
|
||||
tableProps,
|
||||
list: [],
|
||||
dataForm: {
|
||||
id: 0,
|
||||
name: '',
|
||||
code: ''
|
||||
},
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 990,
|
||||
equipmentTypeId: ''
|
||||
},
|
||||
isDetail: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id, isDetail) {
|
||||
this.isDetail = false
|
||||
this.isDetail = isDetail
|
||||
this.dataForm.id = id || ''
|
||||
this.listQuery.equipmentTypeId = ''
|
||||
this.list.splice(0, this.list.length)
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
equipmentTypeDetail(this.dataForm.id).then(res => {
|
||||
this.dataForm = res.data
|
||||
})
|
||||
this.listQuery.equipmentTypeId = this.dataForm.id
|
||||
equipmentAlarmAttrList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
getList() {
|
||||
equipmentAlarmAttrList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
})
|
||||
},
|
||||
handleClick(raw) {
|
||||
console.log(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(() => {
|
||||
equipmentAlarmAttrDelete(raw.data.id).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.addNew(raw.data.id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
goback() {
|
||||
this.$emit('refreshDataList')
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.drawer-footer {
|
||||
width: 100%;
|
||||
margin-top: 50px;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
padding: 10px 50px;
|
||||
text-align: left;
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,138 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-03-25 16:32:09
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-drawer
|
||||
:append-to-body="true"
|
||||
:show-close="false"
|
||||
:visible.sync="visible"
|
||||
size="40%"
|
||||
>
|
||||
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px">{{ !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}</div>
|
||||
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px" @keyup.enter.native="dataFormSubmit()">
|
||||
<el-form-item :label="$t('module.basicData.alarmManagement.AlarmCode')" prop="code">
|
||||
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.AlarmCode')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.alarmManagement.AlarmType')" prop="alarmType">
|
||||
<el-input v-model="dataForm.alarmType" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.AlarmType')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.alarmManagement.AlarmLevel')" prop="alarmGrade">
|
||||
<el-input v-model="dataForm.alarmGrade" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.AlarmLevel')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.alarmManagement.AlarmContent')" prop="alarmContent">
|
||||
<el-input v-model="dataForm.alarmContent" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.AlarmContent')])" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="drawer-footer">
|
||||
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" :loading="btnLoading" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { equipmentAlarmAttrDetail, equipmentAlarmAttrUpdate, equipmentAlarmAttrAdd } from '@/api/basicData/Equipment/equipmentAlarmAttr'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
equipmentTypeId: {
|
||||
type: String,
|
||||
default: () => {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
btnLoading: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
alarmType: '',
|
||||
code: '',
|
||||
alarmGrade: '',
|
||||
alarmContent: ''
|
||||
},
|
||||
dataRule: {
|
||||
code: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.alarmManagement.AlarmCode')]), trigger: 'blur' }
|
||||
],
|
||||
alarmContent: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.alarmManagement.alarmContent')]), trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || ''
|
||||
this.btnLoading = false
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
equipmentAlarmAttrDetail(this.dataForm.id).then(res => {
|
||||
this.dataForm = res.data
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.btnLoading = true
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
'alarmType': this.dataForm.alarmType,
|
||||
'code': this.dataForm.code,
|
||||
'alarmGrade': this.dataForm.alarmGrade,
|
||||
'alarmContent': this.dataForm.alarmContent,
|
||||
'equipmentTypeId': this.equipmentTypeId,
|
||||
'id': this.dataForm.id
|
||||
}
|
||||
if (this.dataForm.id) {
|
||||
equipmentAlarmAttrUpdate(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
equipmentAlarmAttrAdd(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.drawer-footer {
|
||||
width: 100%;
|
||||
margin-top: 50px;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
padding: 10px 50px;
|
||||
text-align: left;
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,110 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-03-25 16:25:01
|
||||
* @enName:
|
||||
-->
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
|
||||
:visible.sync="visible"
|
||||
>
|
||||
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="160px" @keyup.enter.native="dataFormSubmit()">
|
||||
<el-form-item :label="$t('module.basicData.equipment.maintenancePeriod')" prop="maintenancePeriod">
|
||||
<el-input v-model="dataForm.maintenancePeriod" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.maintenancePeriod')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.equipment.PeriodCode')" prop="code">
|
||||
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.PeriodCode')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
|
||||
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { maintenanceCycleDetail, maintenanceCycleUpdate, maintenanceCycleAdd, maintenanceCycleCode } from '@/api/basicData/Equipment/maintenanceCycle'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
maintenancePeriod: '',
|
||||
code: '',
|
||||
remark: ''
|
||||
},
|
||||
dataRule: {
|
||||
maintenancePeriod: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.maintenancePeriod')]), trigger: 'blur' }
|
||||
],
|
||||
code: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.PeriodCode')]), trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
maintenanceCycleCode().then(res => {
|
||||
this.dataForm.code = res.data
|
||||
})
|
||||
this.dataForm.id = id || ''
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
maintenanceCycleDetail(this.dataForm.id).then(res => {
|
||||
this.dataForm = res.data
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
'maintenancePeriod': this.dataForm.maintenancePeriod,
|
||||
'code': this.dataForm.code,
|
||||
'remark': this.dataForm.remark,
|
||||
'id': this.dataForm.id
|
||||
}
|
||||
if (this.dataForm.id) {
|
||||
maintenanceCycleUpdate(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
maintenanceCycleAdd(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
118
src/views/basicData/Equipment/components/maintenanceType-add.vue
Normal file
118
src/views/basicData/Equipment/components/maintenanceType-add.vue
Normal file
@@ -0,0 +1,118 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-03-06 13:57:57
|
||||
* @enName:
|
||||
-->
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
|
||||
:visible.sync="visible"
|
||||
>
|
||||
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="150px" @keyup.enter.native="dataFormSubmit()">
|
||||
<el-form-item :label="$t('module.basicData.equipment.RepairTypeName')" prop="name">
|
||||
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.RepairTypeName')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.equipment.RepairTypeCode')" prop="code">
|
||||
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.RepairTypeCode')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.visual.EnglishName')" prop="enName">
|
||||
<el-input v-model="dataForm.enName" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.EnglishName')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
|
||||
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { maintenanceTypeDetail, maintenanceTypeUpdate, maintenanceTypeAdd, maintenanceTypeCode } from '@/api/basicData/Equipment/maintenanceType'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
name: '',
|
||||
code: '',
|
||||
enName: '',
|
||||
remark: ''
|
||||
},
|
||||
dataRule: {
|
||||
name: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.RepairTypeName')]), trigger: 'blur' }
|
||||
],
|
||||
code: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.RepairTypeCode')]), trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
maintenanceTypeCode().then(res => {
|
||||
this.dataForm.code = res.data
|
||||
})
|
||||
this.dataForm.id = id || ''
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
maintenanceTypeDetail(this.dataForm.id).then(res => {
|
||||
this.dataForm.name = res.data.name
|
||||
this.dataForm.code = res.data.code
|
||||
this.dataForm.enName = res.data.enName
|
||||
this.dataForm.remark = res.data.remark
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
'name': this.dataForm.name,
|
||||
'code': this.dataForm.code,
|
||||
'enName': this.dataForm.enName,
|
||||
'remark': this.dataForm.remark,
|
||||
'id': this.dataForm.id
|
||||
}
|
||||
if (this.dataForm.id) {
|
||||
maintenanceTypeUpdate(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
maintenanceTypeAdd(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
149
src/views/basicData/Equipment/components/spareParts-add.vue
Normal file
149
src/views/basicData/Equipment/components/spareParts-add.vue
Normal file
@@ -0,0 +1,149 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-03-25 16:25:17
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
|
||||
:visible.sync="visible"
|
||||
>
|
||||
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px" @keyup.enter.native="dataFormSubmit()">
|
||||
<el-form-item :label="$t('module.basicData.equipment.SparepartName')" prop="name">
|
||||
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.SparepartName')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.equipment.SparepartCode')" prop="code">
|
||||
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.SparepartCode')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.equipment.SparepartModel')" prop="model">
|
||||
<el-input v-model="dataForm.model" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.SparepartModel')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.visual.Specs')" prop="specifications">
|
||||
<el-input v-model="dataForm.specifications" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Specs')])" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.visual.unit')" prop="dictDataId">
|
||||
<el-select v-model="dataForm.dictDataId" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.unit')])" clearable>
|
||||
<el-option
|
||||
v-for="item in unitArr"
|
||||
:key="item.id"
|
||||
:label="item.dataName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="description">
|
||||
<el-input v-model="dataForm.description" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { sparePartsDetail, sparePartsUpdate, sparePartsAdd, sparePartsCode } from '@/api/basicData/Equipment/spareParts'
|
||||
import { ProductPoolUnit } from '@/api/basicData/ProductPool'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
name: '',
|
||||
code: '',
|
||||
description: '',
|
||||
model: '',
|
||||
specifications: '',
|
||||
dictDataId: ''
|
||||
},
|
||||
unitArr: [],
|
||||
dataRule: {
|
||||
name: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.SparepartName')]), trigger: 'blur' }
|
||||
],
|
||||
code: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.SparepartCode')]), trigger: 'blur' }
|
||||
],
|
||||
model: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.SparepartModel')]), trigger: 'blur' }
|
||||
],
|
||||
dictDataId: [
|
||||
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.unit')]), trigger: 'change' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || ''
|
||||
ProductPoolUnit().then(res => {
|
||||
this.unitArr = res.data
|
||||
})
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
sparePartsDetail(this.dataForm.id).then(res => {
|
||||
this.dataForm.name = res.data.name
|
||||
this.dataForm.code = res.data.code
|
||||
this.dataForm.description = res.data.description
|
||||
this.dataForm.model = res.data.model
|
||||
this.dataForm.specifications = res.data.specifications
|
||||
this.dataForm.dictDataId = res.data.dictDataId
|
||||
})
|
||||
} else {
|
||||
sparePartsCode().then(res => {
|
||||
this.dataForm.code = res.data
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
'name': this.dataForm.name,
|
||||
'code': this.dataForm.code,
|
||||
'description': this.dataForm.description,
|
||||
'model': this.dataForm.model,
|
||||
'specifications': this.dataForm.specifications,
|
||||
'dictDataId': this.dataForm.dictDataId,
|
||||
'id': this.dataForm.id
|
||||
}
|
||||
if (this.dataForm.id) {
|
||||
sparePartsUpdate(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
sparePartsAdd(data).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
206
src/views/basicData/Equipment/detectSystemSettings.vue
Normal file
206
src/views/basicData/Equipment/detectSystemSettings.vue
Normal file
@@ -0,0 +1,206 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 15:41:11
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-05-28 10:38:22
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :inline="true" @keyup.enter.native="getDataList()">
|
||||
<el-form-item :label="keyName">
|
||||
<el-select v-model="detectAreaId" :placeholder="placeholderName" clearable>
|
||||
<el-option
|
||||
v-for="item in detectAreaArr"
|
||||
:key="item.id"
|
||||
:label="item.detectArea"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getList()">{{ 'btn.search' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
:is-loading="listLoading"
|
||||
>
|
||||
<method-btn
|
||||
slot="handleBtn"
|
||||
:width="trueWidth"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.current"
|
||||
:limit.sync="listQuery.size"
|
||||
@pagination="getList()"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>import i18n from '@/lang'
|
||||
import { equipmentDetectAreaSystemList, equipmentDetectAreaSystemDelete } from '@/api/basicData/Equipment/equipmentDetectAreaSystem'
|
||||
import { equipmentDetectAreaList } from '@/api/basicData/Equipment/equipmentDetectArea'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
/**
|
||||
* 表格表头配置项 TypeScript接口注释
|
||||
* tableConfig<ConfigItem> = []
|
||||
*
|
||||
* Interface ConfigItem = {
|
||||
* prop: string,
|
||||
* label: string,
|
||||
* width: string,
|
||||
* align: string,
|
||||
* subcomponent: function,
|
||||
* filter: function
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
},
|
||||
{
|
||||
type: 'detail',
|
||||
btnName: 'btn.detail'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'detectArea',
|
||||
label: i18n.t('module.basicData.equipmentDetectInfo.DetectionArea'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: i18n.t('module.basicData.equipmentDetectInfo.equipmentDetectSystemName'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
name: 'DetectSystemSettings',
|
||||
components: { Pagination, BaseTable, MethodBtn },
|
||||
filters: {
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
published: 'success',
|
||||
draft: 'info',
|
||||
deleted: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyName: i18n.t('module.basicData.visual.keyword'),
|
||||
placeholderName: this.$t('module.basicData.equipmentDetectInfo.DetectionArea'),
|
||||
tableBtn,
|
||||
trueWidth: 240,
|
||||
tableProps,
|
||||
list: [],
|
||||
total: 0,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10
|
||||
},
|
||||
detectAreaId: '',
|
||||
detectAreaArr: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
handleClick(raw) {
|
||||
console.log(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(() => {
|
||||
equipmentDetectAreaSystemDelete(raw.data.id).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else if (raw.type === 'edit') {
|
||||
this.addNew(raw.data.id)
|
||||
} else {
|
||||
this.addNew(raw.data.id, true)
|
||||
}
|
||||
},
|
||||
getList() {
|
||||
const data = {
|
||||
current: 1,
|
||||
size: 500
|
||||
}
|
||||
equipmentDetectAreaList(data).then(response => {
|
||||
if (response.data.records) {
|
||||
this.detectAreaArr = response.data.records
|
||||
} else {
|
||||
this.detectAreaArr.splice(0, this.detectAreaArr.length)
|
||||
}
|
||||
})
|
||||
this.listLoading = true
|
||||
this.listQuery.detectDistributionAreaId = this.detectAreaId
|
||||
equipmentDetectAreaSystemList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
this.total = response.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id, isdetail) {
|
||||
this.$router.push({
|
||||
name: 'detectSystemSettingsAdd',
|
||||
query: {
|
||||
id: id,
|
||||
isdetail: isdetail
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.edit-input {
|
||||
padding-right: 100px;
|
||||
}
|
||||
.cancel-btn {
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
top: 10px;
|
||||
}
|
||||
</style>
|
||||
208
src/views/basicData/Equipment/equipmentDetectArea.vue
Normal file
208
src/views/basicData/Equipment/equipmentDetectArea.vue
Normal file
@@ -0,0 +1,208 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 15:41:11
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-07-23 09:04:12
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :inline="true" @keyup.enter.native="getDataList()">
|
||||
<el-form-item :label="keyName">
|
||||
<el-select v-model="detectArea" :placeholder="placeholderName" clearable>
|
||||
<el-option
|
||||
v-for="item in detectAreaArr"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getList()">{{ 'btn.search' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
:is-loading="listLoading"
|
||||
>
|
||||
<method-btn
|
||||
slot="handleBtn"
|
||||
:width="trueWidth"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.current"
|
||||
:limit.sync="listQuery.size"
|
||||
@pagination="getList()"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>import i18n from '@/lang'
|
||||
import { equipmentDetectAreaList, equipmentDetectAreaDelete } from '@/api/basicData/Equipment/equipmentDetectArea'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
/**
|
||||
* 表格表头配置项 TypeScript接口注释
|
||||
* tableConfig<ConfigItem> = []
|
||||
*
|
||||
* Interface ConfigItem = {
|
||||
* prop: string,
|
||||
* label: string,
|
||||
* width: string,
|
||||
* align: string,
|
||||
* subcomponent: function,
|
||||
* filter: function
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
}
|
||||
// {
|
||||
// type: 'detail',
|
||||
// btnName: 'btn.detail'
|
||||
// }
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'code',
|
||||
label: i18n.t('module.basicData.equipment.WiredCode'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'detectArea',
|
||||
label: i18n.t('module.basicData.equipmentDetectInfo.DetectionArea'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'distributionArea',
|
||||
label: i18n.t('module.basicData.equipmentDetectInfo.IssueArea'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
name: 'Material',
|
||||
components: { Pagination, BaseTable, MethodBtn },
|
||||
filters: {
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
published: 'success',
|
||||
draft: 'info',
|
||||
deleted: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyName: i18n.t('module.basicData.visual.keyword'),
|
||||
placeholderName: this.$t('module.basicData.equipmentDetectInfo.DetectionArea'),
|
||||
tableBtn,
|
||||
trueWidth: 240,
|
||||
tableProps,
|
||||
list: [],
|
||||
total: 0,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10
|
||||
},
|
||||
detectArea: '',
|
||||
detectAreaArr: [{
|
||||
value: 'Backend',
|
||||
label: 'Backend'
|
||||
}, {
|
||||
value: 'Frontend',
|
||||
label: 'Frontend'
|
||||
}, {
|
||||
value: 'Midend',
|
||||
label: 'Midend'
|
||||
}]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
handleClick(raw) {
|
||||
console.log(raw)
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.detectArea}]?`, this.$t('module.basicData.visual.Tips'), {
|
||||
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
|
||||
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
equipmentDetectAreaDelete(raw.data.id).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else if (raw.type === 'edit') {
|
||||
this.addNew(raw.data.id)
|
||||
} else {
|
||||
this.addNew(raw.data.id, true)
|
||||
}
|
||||
},
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
this.listQuery.detectArea = this.detectArea
|
||||
equipmentDetectAreaList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
this.total = response.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id, isdetail) {
|
||||
this.$router.push({
|
||||
name: 'equipmentDetectAreaAdd',
|
||||
query: {
|
||||
id: id,
|
||||
isdetail: isdetail
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.edit-input {
|
||||
padding-right: 100px;
|
||||
}
|
||||
.cancel-btn {
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
top: 10px;
|
||||
}
|
||||
</style>
|
||||
220
src/views/basicData/Equipment/equipmentDetectParam.vue
Normal file
220
src/views/basicData/Equipment/equipmentDetectParam.vue
Normal file
@@ -0,0 +1,220 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 15:41:11
|
||||
* @LastEditors: gtz
|
||||
* @LastEditTime: 2021-04-16 15:01:20
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :inline="true" @keyup.enter.native="getDataList()">
|
||||
<el-form-item :label="keyName">
|
||||
<el-select v-model="detectDistributionAreaId" :placeholder="placeholderName" clearable>
|
||||
<el-option
|
||||
v-for="item in distributionAreaArr"
|
||||
:key="item.id"
|
||||
:label="item.distributionArea"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getList()">{{ 'btn.search' | i18nFilter }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
:is-loading="listLoading"
|
||||
>
|
||||
<method-btn
|
||||
slot="handleBtn"
|
||||
:width="trueWidth"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.current"
|
||||
:limit.sync="listQuery.size"
|
||||
@pagination="getList()"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>import i18n from '@/lang'
|
||||
import { equipmentDetectAreaAttrList, equipmentDetectAreaAttrDelete } from '@/api/basicData/Equipment/equipmentDetectAreaAttr'
|
||||
import { equipmentDetectAreaList } from '@/api/basicData/Equipment/equipmentDetectArea'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
/**
|
||||
* 表格表头配置项 TypeScript接口注释
|
||||
* tableConfig<ConfigItem> = []
|
||||
*
|
||||
* Interface ConfigItem = {
|
||||
* prop: string,
|
||||
* label: string,
|
||||
* width: string,
|
||||
* align: string,
|
||||
* subcomponent: function,
|
||||
* filter: function
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
},
|
||||
{
|
||||
type: 'detail',
|
||||
btnName: 'btn.detail'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'distributionArea',
|
||||
label: i18n.t('module.basicData.equipmentDetectInfo.IssueArea'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'detectArea',
|
||||
label: i18n.t('module.basicData.equipmentDetectInfo.DetectionArea'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: i18n.t('module.basicData.equipment.EquipmentName'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'code',
|
||||
label: i18n.t('module.basicData.equipment.EquipmentCode'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'function',
|
||||
label: i18n.t('module.basicData.equipmentDetectInfo.EquipmentFunction'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
name: 'Material',
|
||||
components: { Pagination, BaseTable, MethodBtn },
|
||||
filters: {
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
published: 'success',
|
||||
draft: 'info',
|
||||
deleted: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyName: i18n.t('module.basicData.visual.keyword'),
|
||||
placeholderName: this.$t('module.basicData.equipmentDetectInfo.IssueArea'),
|
||||
tableBtn,
|
||||
trueWidth: 240,
|
||||
tableProps,
|
||||
list: [],
|
||||
total: 0,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10
|
||||
},
|
||||
detectDistributionAreaId: '',
|
||||
distributionAreaArr: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
handleClick(raw) {
|
||||
console.log(raw)
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.code}]?`, this.$t('module.basicData.visual.Tips'), {
|
||||
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
|
||||
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
equipmentDetectAreaAttrDelete(raw.data.id).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else if (raw.type === 'edit') {
|
||||
this.addNew(raw.data)
|
||||
} else {
|
||||
this.addNew(raw.data, true)
|
||||
}
|
||||
},
|
||||
getList() {
|
||||
const params = {
|
||||
current: 1,
|
||||
size: 550
|
||||
}
|
||||
equipmentDetectAreaList(params).then(response => {
|
||||
if (response.data.records) {
|
||||
this.distributionAreaArr = response.data.records
|
||||
} else {
|
||||
this.distributionAreaArr.splice(0, this.distributionAreaArr.length)
|
||||
}
|
||||
})
|
||||
this.listLoading = true
|
||||
this.listQuery.detectDistributionAreaId = this.detectDistributionAreaId
|
||||
equipmentDetectAreaAttrList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
this.total = response.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(data, isdetail) {
|
||||
this.$router.push({
|
||||
name: 'equipmentDetectParamAdd',
|
||||
query: {
|
||||
data: data,
|
||||
isdetail: isdetail
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.edit-input {
|
||||
padding-right: 100px;
|
||||
}
|
||||
.cancel-btn {
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
top: 10px;
|
||||
}
|
||||
</style>
|
||||
191
src/views/basicData/Equipment/equipmentDetectSystem.vue
Normal file
191
src/views/basicData/Equipment/equipmentDetectSystem.vue
Normal file
@@ -0,0 +1,191 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 15:41:11
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-05-21 10:11:11
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<head-form
|
||||
:placeholder-name="placeholderName"
|
||||
:key-name="keyName"
|
||||
@getDataList="getList"
|
||||
@add="addNew"
|
||||
/>
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
:is-loading="listLoading"
|
||||
>
|
||||
<method-btn
|
||||
slot="handleBtn"
|
||||
:width="trueWidth"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.current"
|
||||
:limit.sync="listQuery.size"
|
||||
@pagination="getList()"
|
||||
/>
|
||||
<equipmentDetectSystem-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { equipmentDetectSystemList, equipmentDetectSystemDelete } from '@/api/basicData/Equipment/equipmentDetectSystem'
|
||||
import equipmentDetectSystemAdd from './components/equipmentDetectSystem-add.vue'
|
||||
import HeadForm from '@/components/basicData/HeadForm'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
import i18n from '@/lang'
|
||||
/**
|
||||
* 表格表头配置项 TypeScript接口注释
|
||||
* tableConfig<ConfigItem> = []
|
||||
*
|
||||
* Interface ConfigItem = {
|
||||
* prop: string,
|
||||
* label: string,
|
||||
* width: string,
|
||||
* align: string,
|
||||
* subcomponent: function,
|
||||
* filter: function
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'code',
|
||||
label: i18n.t('module.basicData.equipmentDetectInfo.code'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: i18n.t('module.basicData.equipmentDetectInfo.equipmentDetectSystemName'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'abbr',
|
||||
label: i18n.t('module.basicData.equipmentDetectInfo.equipmentDetectSystemAbbr'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'description',
|
||||
label: i18n.t('module.basicData.equipment.FunctionDescription'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
name: 'EquipmentDetectSystem',
|
||||
components: { Pagination, BaseTable, MethodBtn, HeadForm, equipmentDetectSystemAdd },
|
||||
filters: {
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
published: 'success',
|
||||
draft: 'info',
|
||||
deleted: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyName: i18n.t('module.basicData.visual.keyword'),
|
||||
placeholderName: this.$t('module.basicData.equipmentDetectInfo.equipmentDetectSystemName'),
|
||||
addOrUpdateVisible: false,
|
||||
tableBtn,
|
||||
trueWidth: 200,
|
||||
tableProps,
|
||||
list: [],
|
||||
total: 0,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
name: '',
|
||||
code: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
handleClick(raw) {
|
||||
console.log(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(() => {
|
||||
equipmentDetectSystemDelete(raw.data.id).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.addNew(raw.data.id)
|
||||
}
|
||||
},
|
||||
getList(key) {
|
||||
this.listLoading = true
|
||||
this.listQuery.name = key
|
||||
this.listQuery.code = key
|
||||
equipmentDetectSystemList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
this.total = response.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.edit-input {
|
||||
padding-right: 100px;
|
||||
}
|
||||
.cancel-btn {
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
top: 10px;
|
||||
}
|
||||
</style>
|
||||
232
src/views/basicData/Equipment/equipmentInfo.vue
Normal file
232
src/views/basicData/Equipment/equipmentInfo.vue
Normal file
@@ -0,0 +1,232 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 15:41:11
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-07-08 09:46:10
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<head-form
|
||||
:placeholder-name="placeholderName"
|
||||
:key-name="keyName"
|
||||
@getDataList="getList"
|
||||
@add="addNew"
|
||||
/>
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
:is-loading="listLoading"
|
||||
>
|
||||
<method-btn
|
||||
slot="handleBtn"
|
||||
:width="trueWidth"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.current"
|
||||
:limit.sync="listQuery.size"
|
||||
@pagination="getList()"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>import i18n from '@/lang'
|
||||
import { equipmentInfoList, equipmentInfoDelete } from '@/api/basicData/Equipment/equipmentInfo'
|
||||
import HeadForm from '@/components/basicData/HeadForm'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
// import { timeFormatter } from '@/filters'
|
||||
// import dataDict from '@/filters/DataDict'
|
||||
/**
|
||||
* 表格表头配置项 TypeScript接口注释
|
||||
* tableConfig<ConfigItem> = []
|
||||
*
|
||||
* Interface ConfigItem = {
|
||||
* prop: string,
|
||||
* label: string,
|
||||
* width: string,
|
||||
* align: string,
|
||||
* subcomponent: function,
|
||||
* filter: function
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
},
|
||||
{
|
||||
type: 'detail',
|
||||
btnName: 'btn.detail'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
// {
|
||||
// prop: 'createTime',
|
||||
// label: i18n.t('module.basicData.factory.createTime'),
|
||||
// filter: timeFormatter,
|
||||
// align: 'center'
|
||||
// },
|
||||
{
|
||||
prop: 'name',
|
||||
label: i18n.t('module.basicData.equipment.EquipmentName'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'equipmentTypeName',
|
||||
label: i18n.t('module.basicData.equipment.EquipmentType'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'code',
|
||||
label: i18n.t('module.basicData.equipment.EquipmentCode'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'equipmentGroupName',
|
||||
label: i18n.t('module.basicData.equipment.EquipmentGrouping'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'enName',
|
||||
label: i18n.t('module.basicData.visual.EnglishName'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'maintenanceCycle',
|
||||
label: i18n.t('module.basicData.equipment.maintenanceCycle'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'maintenanceTime',
|
||||
label: i18n.t('module.basicData.equipment.maintenanceTime'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'description',
|
||||
label: i18n.t('module.basicData.equipment.FunctionDescription'),
|
||||
align: 'center'
|
||||
}
|
||||
// {
|
||||
// prop: 'abbr',
|
||||
// label: i18n.t('module.basicData.visual.Abbreviation'),
|
||||
// align: 'center'
|
||||
// }
|
||||
// {
|
||||
// prop: 'estatus',
|
||||
// label: i18n.t('module.basicData.visual.CurrentState'),
|
||||
// filter: dataDict('enableState'),
|
||||
// align: 'center'
|
||||
// }
|
||||
]
|
||||
|
||||
export default {
|
||||
name: 'EquipmentInfo',
|
||||
components: { Pagination, BaseTable, MethodBtn, HeadForm },
|
||||
filters: {
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
published: 'success',
|
||||
draft: 'info',
|
||||
deleted: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyName: i18n.t('module.basicData.visual.keyword'),
|
||||
placeholderName: this.$t('module.basicData.equipment.EquipmentName') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.equipment.EquipmentCode'),
|
||||
tableBtn,
|
||||
trueWidth: 240,
|
||||
tableProps,
|
||||
list: [],
|
||||
total: 0,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
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(() => {
|
||||
equipmentInfoDelete(raw.data.id).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else if (raw.type === 'edit') {
|
||||
this.addNew(raw.data.id)
|
||||
} else {
|
||||
this.addNew(raw.data.id, true)
|
||||
}
|
||||
},
|
||||
getList(key) {
|
||||
this.listLoading = true
|
||||
this.listQuery.name = key
|
||||
this.listQuery.code = key
|
||||
equipmentInfoList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
this.total = response.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id, isdetail) {
|
||||
this.$router.push({
|
||||
name: 'equipmentInfoAdd',
|
||||
query: {
|
||||
id: id,
|
||||
isdetail: isdetail
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.edit-input {
|
||||
padding-right: 100px;
|
||||
}
|
||||
.cancel-btn {
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
top: 10px;
|
||||
}
|
||||
</style>
|
||||
196
src/views/basicData/Equipment/equipmentLink.vue
Normal file
196
src/views/basicData/Equipment/equipmentLink.vue
Normal file
@@ -0,0 +1,196 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 15:41:11
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-03-11 16:45:38
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<head-form
|
||||
:placeholder-name="placeholderName"
|
||||
:key-name="keyName"
|
||||
@getDataList="getList"
|
||||
@add="addNew"
|
||||
/>
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
:is-loading="listLoading"
|
||||
>
|
||||
<method-btn
|
||||
slot="handleBtn"
|
||||
:width="trueWidth"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.current"
|
||||
:limit.sync="listQuery.size"
|
||||
@pagination="getList()"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>import i18n from '@/lang'
|
||||
import { equipmentLinkList, equipmentLinkDelete } from '@/api/basicData/Equipment/equipmentLink'
|
||||
import HeadForm from '@/components/basicData/HeadForm'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
import { timeFormatter } from '@/filters'
|
||||
/**
|
||||
* 表格表头配置项 TypeScript接口注释
|
||||
* tableConfig<ConfigItem> = []
|
||||
*
|
||||
* Interface ConfigItem = {
|
||||
* prop: string,
|
||||
* label: string,
|
||||
* width: string,
|
||||
* align: string,
|
||||
* subcomponent: function,
|
||||
* filter: function
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
},
|
||||
{
|
||||
type: 'detail',
|
||||
btnName: 'btn.detail'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: i18n.t('module.basicData.factory.createTime'),
|
||||
filter: timeFormatter,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'code',
|
||||
label: i18n.t('module.basicData.equipment.WiredCode'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: i18n.t('module.basicData.equipment.WiredEquipment'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'enName',
|
||||
label: i18n.t('module.basicData.visual.EnglishName'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
name: 'EquipmentLink',
|
||||
components: { Pagination, BaseTable, MethodBtn, HeadForm },
|
||||
filters: {
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
published: 'success',
|
||||
draft: 'info',
|
||||
deleted: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyName: i18n.t('module.basicData.visual.keyword'),
|
||||
placeholderName: this.$t('module.basicData.equipment.WiredEquipment') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.equipment.WiredCode'),
|
||||
tableBtn,
|
||||
trueWidth: 240,
|
||||
tableProps,
|
||||
list: [],
|
||||
total: 0,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
handleClick(raw) {
|
||||
console.log(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(() => {
|
||||
equipmentLinkDelete(raw.data.id).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else if (raw.type === 'edit') {
|
||||
this.addNew(raw.data.id)
|
||||
} else {
|
||||
this.addNew(raw.data.id, true)
|
||||
}
|
||||
},
|
||||
getList(key) {
|
||||
this.listLoading = true
|
||||
this.listQuery.name = key
|
||||
this.listQuery.code = key
|
||||
equipmentLinkList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
this.total = response.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id, isdetail) {
|
||||
this.$router.push({
|
||||
name: 'equipmentLinkAdd',
|
||||
query: {
|
||||
id: id,
|
||||
isdetail: isdetail
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.edit-input {
|
||||
padding-right: 100px;
|
||||
}
|
||||
.cancel-btn {
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
top: 10px;
|
||||
}
|
||||
</style>
|
||||
201
src/views/basicData/Equipment/equipmentType.vue
Normal file
201
src/views/basicData/Equipment/equipmentType.vue
Normal file
@@ -0,0 +1,201 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 15:41:11
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-03-11 16:59:29
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<head-form
|
||||
:placeholder-name="placeholderName"
|
||||
:key-name="keyName"
|
||||
@getDataList="getList"
|
||||
@add="addNew"
|
||||
/>
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
:is-loading="listLoading"
|
||||
>
|
||||
<method-btn
|
||||
slot="handleBtn"
|
||||
:width="trueWidth"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.current"
|
||||
:limit.sync="listQuery.size"
|
||||
@pagination="getList()"
|
||||
/>
|
||||
<equipmentType-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>import i18n from '@/lang'
|
||||
import { equipmentTypeList, equipmentTypeDelete } from '@/api/basicData/Equipment/equipmentType'
|
||||
import equipmentTypeAdd from './components/equipmentType-add.vue'
|
||||
import HeadForm from '@/components/basicData/HeadForm'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
import { timeFormatter } from '@/filters'
|
||||
/**
|
||||
* 表格表头配置项 TypeScript接口注释
|
||||
* tableConfig<ConfigItem> = []
|
||||
*
|
||||
* Interface ConfigItem = {
|
||||
* prop: string,
|
||||
* label: string,
|
||||
* width: string,
|
||||
* align: string,
|
||||
* subcomponent: function,
|
||||
* filter: function
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
},
|
||||
{
|
||||
type: 'detail',
|
||||
btnName: 'btn.detail'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: i18n.t('module.basicData.factory.createTime'),
|
||||
filter: timeFormatter,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: i18n.t('module.basicData.equipment.EquipmentTypeName'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'code',
|
||||
label: i18n.t('module.basicData.equipment.EquipmentTypeCode'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'parentName',
|
||||
label: i18n.t('module.basicData.equipment.parentName'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: i18n.t('module.basicData.visual.Remarks'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
name: 'EquipmentType',
|
||||
components: { Pagination, BaseTable, MethodBtn, HeadForm, equipmentTypeAdd },
|
||||
filters: {
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
published: 'success',
|
||||
draft: 'info',
|
||||
deleted: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyName: i18n.t('module.basicData.visual.keyword'),
|
||||
placeholderName: this.$t('module.basicData.equipment.EquipmentTypeName') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.equipment.EquipmentTypeCode'),
|
||||
addOrUpdateVisible: false,
|
||||
tableBtn,
|
||||
trueWidth: 240,
|
||||
tableProps,
|
||||
list: [],
|
||||
total: 0,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
handleClick(raw) {
|
||||
console.log(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(() => {
|
||||
equipmentTypeDelete(raw.data.id).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else if (raw.type === 'edit') {
|
||||
this.addNew(raw.data.id)
|
||||
} else {
|
||||
this.addNew(raw.data.id, true)
|
||||
}
|
||||
},
|
||||
getList(key) {
|
||||
this.listLoading = true
|
||||
this.listQuery.name = key
|
||||
this.listQuery.code = key
|
||||
equipmentTypeList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
this.total = response.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id, isdetail) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id, isdetail)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.edit-input {
|
||||
padding-right: 100px;
|
||||
}
|
||||
.cancel-btn {
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
top: 10px;
|
||||
}
|
||||
</style>
|
||||
176
src/views/basicData/Equipment/equipmentTypeAlarm.vue
Normal file
176
src/views/basicData/Equipment/equipmentTypeAlarm.vue
Normal file
@@ -0,0 +1,176 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 15:41:11
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-03-12 16:27:21
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<head-form
|
||||
:placeholder-name="placeholderName"
|
||||
:key-name="keyName"
|
||||
:show-add="showAdd"
|
||||
@getDataList="getList"
|
||||
@add="addNew"
|
||||
/>
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
:is-loading="listLoading"
|
||||
>
|
||||
<method-btn
|
||||
slot="handleBtn"
|
||||
:width="trueWidth"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.current"
|
||||
:limit.sync="listQuery.size"
|
||||
@pagination="getList()"
|
||||
/>
|
||||
<equipmentAlarm-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>import i18n from '@/lang'
|
||||
import { equipmentTypeList } from '@/api/basicData/Equipment/equipmentType'
|
||||
import equipmentAlarmAdd from './components/equipmentTypeAlarm-add.vue'
|
||||
import HeadForm from '@/components/basicData/HeadForm'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
import { timeFormatter } from '@/filters'
|
||||
/**
|
||||
* 表格表头配置项 TypeScript接口注释
|
||||
* tableConfig<ConfigItem> = []
|
||||
*
|
||||
* Interface ConfigItem = {
|
||||
* prop: string,
|
||||
* label: string,
|
||||
* width: string,
|
||||
* align: string,
|
||||
* subcomponent: function,
|
||||
* filter: function
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: i18n.t('module.basicData.equipment.SetAlarm')
|
||||
},
|
||||
{
|
||||
type: 'detail',
|
||||
btnName: 'btn.detail'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: i18n.t('module.basicData.factory.createTime'),
|
||||
filter: timeFormatter,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: i18n.t('module.basicData.equipment.EquipmentTypeName'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'code',
|
||||
label: i18n.t('module.basicData.equipment.EquipmentTypeCode'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: i18n.t('module.basicData.visual.Remarks'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
name: 'EquipmentAlarm',
|
||||
components: { Pagination, BaseTable, MethodBtn, HeadForm, equipmentAlarmAdd },
|
||||
filters: {
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
published: 'success',
|
||||
draft: 'info',
|
||||
deleted: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyName: i18n.t('module.basicData.visual.keyword'),
|
||||
placeholderName: this.$t('module.basicData.equipment.EquipmentTypeName') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.equipment.EquipmentTypeCode'),
|
||||
addOrUpdateVisible: false,
|
||||
tableBtn,
|
||||
showAdd: false,
|
||||
trueWidth: 200,
|
||||
tableProps,
|
||||
list: [],
|
||||
total: 0,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'detail') {
|
||||
this.addNew(raw.data.id, true)
|
||||
} else {
|
||||
this.addNew(raw.data.id)
|
||||
}
|
||||
},
|
||||
getList(key) {
|
||||
this.listLoading = true
|
||||
this.listQuery.category = key
|
||||
this.listQuery.code = key
|
||||
equipmentTypeList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
this.total = response.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id, detail) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id, detail)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.edit-input {
|
||||
padding-right: 100px;
|
||||
}
|
||||
.cancel-btn {
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
top: 10px;
|
||||
}
|
||||
</style>
|
||||
181
src/views/basicData/Equipment/maintenanceCycle.vue
Normal file
181
src/views/basicData/Equipment/maintenanceCycle.vue
Normal file
@@ -0,0 +1,181 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 15:41:11
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-03-11 16:45:55
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div style="margin:10px 50px"><el-button type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button></div>
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
:is-loading="listLoading"
|
||||
>
|
||||
<method-btn
|
||||
slot="handleBtn"
|
||||
:width="trueWidth"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.current"
|
||||
:limit.sync="listQuery.size"
|
||||
@pagination="getList()"
|
||||
/>
|
||||
<maintenanceCycle-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>import i18n from '@/lang'
|
||||
import { maintenanceCycleList, maintenanceCycleDelete } from '@/api/basicData/Equipment/maintenanceCycle'
|
||||
import maintenanceCycleAdd from './components/maintenanceCycle-add.vue'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
import { timeFormatter } from '@/filters'
|
||||
/**
|
||||
* 表格表头配置项 TypeScript接口注释
|
||||
* tableConfig<ConfigItem> = []
|
||||
*
|
||||
* Interface ConfigItem = {
|
||||
* prop: string,
|
||||
* label: string,
|
||||
* width: string,
|
||||
* align: string,
|
||||
* subcomponent: function,
|
||||
* filter: function
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: i18n.t('module.basicData.factory.createTime'),
|
||||
filter: timeFormatter,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'code',
|
||||
label: i18n.t('module.basicData.equipment.PeriodCode'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'maintenancePeriod',
|
||||
label: i18n.t('module.basicData.equipment.maintenancePeriod'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: i18n.t('module.basicData.visual.Remarks'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
name: 'MaintenanceCycle',
|
||||
components: { Pagination, BaseTable, MethodBtn, maintenanceCycleAdd },
|
||||
filters: {
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
published: 'success',
|
||||
draft: 'info',
|
||||
deleted: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyName: i18n.t('module.basicData.visual.keyword'),
|
||||
addOrUpdateVisible: false,
|
||||
tableBtn,
|
||||
trueWidth: 200,
|
||||
tableProps,
|
||||
list: [],
|
||||
total: 0,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.maintenancePeriod}]?`, this.$t('module.basicData.visual.Tips'), {
|
||||
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
|
||||
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
maintenanceCycleDelete(raw.data.id).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.addNew(raw.data.id)
|
||||
}
|
||||
},
|
||||
getList(key) {
|
||||
this.listLoading = true
|
||||
this.listQuery.name = key
|
||||
maintenanceCycleList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
this.total = response.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.edit-input {
|
||||
padding-right: 100px;
|
||||
}
|
||||
.cancel-btn {
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
top: 10px;
|
||||
}
|
||||
</style>
|
||||
194
src/views/basicData/Equipment/maintenanceType.vue
Normal file
194
src/views/basicData/Equipment/maintenanceType.vue
Normal file
@@ -0,0 +1,194 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 15:41:11
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-03-11 16:46:03
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<head-form
|
||||
:placeholder-name="placeholderName"
|
||||
:key-name="keyName"
|
||||
@getDataList="getList"
|
||||
@add="addNew"
|
||||
/>
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
:is-loading="listLoading"
|
||||
>
|
||||
<method-btn
|
||||
slot="handleBtn"
|
||||
:width="trueWidth"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.current"
|
||||
:limit.sync="listQuery.size"
|
||||
@pagination="getList()"
|
||||
/>
|
||||
<maintenanceType-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>import i18n from '@/lang'
|
||||
import { maintenanceTypeList, maintenanceTypeDelete } from '@/api/basicData/Equipment/maintenanceType'
|
||||
import maintenanceTypeAdd from './components/maintenanceType-add.vue'
|
||||
import HeadForm from '@/components/basicData/HeadForm'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
import { timeFormatter } from '@/filters'
|
||||
/**
|
||||
* 表格表头配置项 TypeScript接口注释
|
||||
* tableConfig<ConfigItem> = []
|
||||
*
|
||||
* Interface ConfigItem = {
|
||||
* prop: string,
|
||||
* label: string,
|
||||
* width: string,
|
||||
* align: string,
|
||||
* subcomponent: function,
|
||||
* filter: function
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: i18n.t('module.basicData.factory.createTime'),
|
||||
filter: timeFormatter,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: i18n.t('module.basicData.equipment.RepairTypeName'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'code',
|
||||
label: i18n.t('module.basicData.equipment.RepairTypeCode'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'enName',
|
||||
label: i18n.t('module.basicData.visual.EnglishName'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: i18n.t('module.basicData.visual.Remarks'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
name: 'MaintenanceType',
|
||||
components: { Pagination, BaseTable, MethodBtn, HeadForm, maintenanceTypeAdd },
|
||||
filters: {
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
published: 'success',
|
||||
draft: 'info',
|
||||
deleted: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyName: i18n.t('module.basicData.visual.keyword'),
|
||||
placeholderName: this.$t('module.basicData.equipment.RepairTypeName') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.equipment.RepairTypeCode'),
|
||||
addOrUpdateVisible: false,
|
||||
tableBtn,
|
||||
trueWidth: 200,
|
||||
tableProps,
|
||||
list: [],
|
||||
total: 0,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
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(() => {
|
||||
maintenanceTypeDelete(raw.data.id).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.addNew(raw.data.id)
|
||||
}
|
||||
},
|
||||
getList(key) {
|
||||
this.listLoading = true
|
||||
this.listQuery.name = key
|
||||
this.listQuery.code = key
|
||||
maintenanceTypeList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
this.total = response.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.edit-input {
|
||||
padding-right: 100px;
|
||||
}
|
||||
.cancel-btn {
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
top: 10px;
|
||||
}
|
||||
</style>
|
||||
197
src/views/basicData/Equipment/spareParts.vue
Normal file
197
src/views/basicData/Equipment/spareParts.vue
Normal file
@@ -0,0 +1,197 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 15:41:11
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-03-18 10:38:35
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<head-form
|
||||
:placeholder-name="placeholderName"
|
||||
:key-name="keyName"
|
||||
@getDataList="getList"
|
||||
@add="addNew"
|
||||
/>
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
:is-loading="listLoading"
|
||||
>
|
||||
<method-btn
|
||||
slot="handleBtn"
|
||||
:width="trueWidth"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.current"
|
||||
:limit.sync="listQuery.size"
|
||||
@pagination="getList()"
|
||||
/>
|
||||
<spareParts-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>import i18n from '@/lang'
|
||||
import { sparePartsList, sparePartsDelete } from '@/api/basicData/Equipment/spareParts'
|
||||
import sparePartsAdd from './components/spareParts-add.vue'
|
||||
import HeadForm from '@/components/basicData/HeadForm'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
/**
|
||||
* 表格表头配置项 TypeScript接口注释
|
||||
* tableConfig<ConfigItem> = []
|
||||
*
|
||||
* Interface ConfigItem = {
|
||||
* prop: string,
|
||||
* label: string,
|
||||
* width: string,
|
||||
* align: string,
|
||||
* subcomponent: function,
|
||||
* filter: function
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'code',
|
||||
label: i18n.t('module.basicData.equipment.SparepartCode'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: i18n.t('module.basicData.equipment.SparepartName'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'model',
|
||||
label: i18n.t('module.basicData.equipment.SparepartModel'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'unit',
|
||||
label: i18n.t('module.basicData.visual.unit'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'specifications',
|
||||
label: i18n.t('module.basicData.visual.Specs'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'description',
|
||||
label: i18n.t('module.basicData.visual.Remarks'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
name: 'SpareParts',
|
||||
components: { Pagination, BaseTable, MethodBtn, HeadForm, sparePartsAdd },
|
||||
filters: {
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
published: 'success',
|
||||
draft: 'info',
|
||||
deleted: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyName: i18n.t('module.basicData.visual.keyword'),
|
||||
placeholderName: this.$t('module.basicData.equipment.SparepartName') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.equipment.SparepartCode'),
|
||||
addOrUpdateVisible: false,
|
||||
tableBtn,
|
||||
trueWidth: 200,
|
||||
tableProps,
|
||||
list: [],
|
||||
total: 0,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
handleClick(raw) {
|
||||
console.log(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(() => {
|
||||
sparePartsDelete(raw.data.id).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.addNew(raw.data.id)
|
||||
}
|
||||
},
|
||||
getList(key) {
|
||||
this.listLoading = true
|
||||
this.listQuery.key = key
|
||||
sparePartsList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
this.total = response.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.edit-input {
|
||||
padding-right: 100px;
|
||||
}
|
||||
.cancel-btn {
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
top: 10px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user