update 设备信息新增编辑
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
></el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @select-change="handleDialogSelectChange" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -62,6 +62,7 @@ const tableConfigs = [
|
||||
{ prop: 'groupName', name: i18n.t('eq.group') },
|
||||
{ prop: 'enName', name: i18n.t('enname') },
|
||||
{ prop: 'abbr', name: i18n.t('abbr') },
|
||||
{ prop: 'lineName', name: i18n.t('pl.title') },
|
||||
{ prop: 'sectionName', name: i18n.t('ws.title') },
|
||||
{
|
||||
prop: 'details',
|
||||
@@ -94,6 +95,14 @@ const addOrUpdateConfigs = {
|
||||
type: 'select',
|
||||
options: []
|
||||
},
|
||||
{
|
||||
name: 'lineId',
|
||||
label: i18n.t('pl.title'),
|
||||
required: true,
|
||||
type: 'select',
|
||||
options: [],
|
||||
relatedField: 'sectionId', // 关联下面的id,在更换lineId时,会清空相应的sectionId选择结果
|
||||
},
|
||||
{
|
||||
name: 'sectionId',
|
||||
label: i18n.t('ws.title'),
|
||||
@@ -283,19 +292,41 @@ export default {
|
||||
console.log('activated')
|
||||
this.getDataList()
|
||||
this.getGroupList()
|
||||
this.getWsList()
|
||||
this.getPlList()
|
||||
this.getTypeList()
|
||||
},
|
||||
methods: {
|
||||
// 获取工段列表
|
||||
getWsList() {
|
||||
// 获取产线列表,用于刷新工段列表
|
||||
getPlList() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/workshopSection/list'),
|
||||
url: this.$http.adornUrl('/monitoring/productionLine/list'),
|
||||
method: 'get'
|
||||
}).then(({ data : res }) => {
|
||||
}).then(({ data: res }) => {
|
||||
const plConfig = this.addOrUpdateConfigs.fields.find(item => item.name === 'lineId')
|
||||
plConfig.options =
|
||||
res.data?.map(item => ({
|
||||
value: item.id,
|
||||
label: item.name
|
||||
})) || []
|
||||
})
|
||||
},
|
||||
// 获取工段列表
|
||||
getWsList(id) {
|
||||
let params = {
|
||||
page: 1,
|
||||
limit: 999
|
||||
}
|
||||
if (id) {
|
||||
params.lineId = id
|
||||
}
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/workshopSection/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams(params)
|
||||
}).then(({ data: res }) => {
|
||||
const wsConfig = this.addOrUpdateConfigs.fields.find(item => item.name === 'sectionId')
|
||||
wsConfig.options =
|
||||
res.data?.map(item => ({
|
||||
res.data?.list?.map(item => ({
|
||||
value: item.id,
|
||||
label: item.name
|
||||
})) || []
|
||||
@@ -378,6 +409,13 @@ export default {
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 对话框里的某个选择改变了
|
||||
handleDialogSelectChange({ name, id }) {
|
||||
switch (name) {
|
||||
case 'lineId':
|
||||
this.getWsList(id)
|
||||
}
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'view-detail':
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<section class="attr-form-section" v-if="dataForm.id">
|
||||
<h3>
|
||||
{{ $t('ws.eqbind') }}
|
||||
<el-button type="text" v-if="!showAttrForm" @click="addEq">{{ $t('add') }}</el-button>
|
||||
<!-- <el-button type="text" v-if="!showAttrForm" @click="addEq">{{ $t('add') }}</el-button> -->
|
||||
</h3>
|
||||
<div class="table" v-if="!showAttrForm">
|
||||
<base-table :page="page" :size="limit" :data="eqList" :table-head-configs="tableProps" :max-height="calcMaxHeight(8)" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
@@ -68,8 +68,8 @@
|
||||
import i18n from '@/i18n'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import SmallTitle from '@/components/small-title'
|
||||
import { pick } from 'lodash/object'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
// import { pick } from 'lodash/object'
|
||||
// import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import AttrForm from './workshopSectionDialogAttrForm.vue'
|
||||
import { calcMaxHeight } from '@/utils'
|
||||
const tableProps = [
|
||||
@@ -79,14 +79,14 @@ const tableProps = [
|
||||
},
|
||||
{ name: i18n.t('eq.name'), prop: 'equipmentName' },
|
||||
{ name: i18n.t('dept.sort'), prop: 'sort' },
|
||||
{
|
||||
name: i18n.t('handle'),
|
||||
prop: 'operations',
|
||||
fixed: 'right',
|
||||
width: 180,
|
||||
subcomponent: TableOperateComponent,
|
||||
options: ['edit', 'delete']
|
||||
}
|
||||
// {
|
||||
// name: i18n.t('handle'),
|
||||
// prop: 'operations',
|
||||
// fixed: 'right',
|
||||
// width: 180,
|
||||
// subcomponent: TableOperateComponent,
|
||||
// options: ['edit', 'delete']
|
||||
// }
|
||||
]
|
||||
|
||||
export default {
|
||||
|
||||
Reference in New Issue
Block a user