fzq #31

Closed
fanzhiqin wants to merge 215 commits from fzq into test
5 changed files with 85 additions and 24 deletions
Showing only changes of commit 3f43f0c979 - Show all commits

View File

@ -261,6 +261,21 @@ export default {
}) })
} // end if (item.api) } // end if (item.api)
// relatedFielditem relatedField
if (item.relatedField) {
this.$watch(
function() {
return this.dataForm[item.name]
},
function(val, old) {
if (val && val !== old) {
this.$emit('select-change', { name: item.name, id: val })
}
},
{ deep: true, immediate: true }
)
}
if (item.required) { if (item.required) {
const requiredRule = { const requiredRule = {
required: true, required: true,
@ -308,7 +323,8 @@ export default {
/** 检查是否需要额外的组件 */ /** 检查是否需要额外的组件 */
this.configs.extraComponents && this.configs.extraComponents &&
this.configs.extraComponents.forEach(item => { this.configs.extraComponents.forEach(item => {
if (Object.hasOwn(this.dataForm, [item.name])) { // if (Object.hasOwn(this.dataForm, [item.name])) {
if (this.dataForm.hasOwnProperty(item.name)) {
return return
} else { } else {
this.$set(this.dataForm, [item.name], calDefault(item.fieldType)) this.$set(this.dataForm, [item.name], calDefault(item.fieldType))
@ -394,7 +410,8 @@ export default {
this.dataForm.files.forEach(file => { this.dataForm.files.forEach(file => {
// const fileName = file.fileUrl.split('/').pop() // const fileName = file.fileUrl.split('/').pop()
/** [1] 处理 fileList */ /** [1] 处理 fileList */
if (Object.hasOwn(this.fileList, file.typeCode)) { // if (Object.hasOwn(this.fileList, file.typeCode)) {
if (this.fileList.hasOwnProperty(file.typeCode)) {
/** 已存在 */ /** 已存在 */
// this.fileList[file.typeCode].push({ id: file.id, name: fileName, typeCode: file.typeCode }) // this.fileList[file.typeCode].push({ id: file.id, name: fileName, typeCode: file.typeCode })
this.fileList[file.typeCode].push(file) this.fileList[file.typeCode].push(file)
@ -404,7 +421,8 @@ export default {
} }
/** [2] 处理 fileForm */ /** [2] 处理 fileForm */
if (Object.hasOwn(this.fileForm, file.typeCode)) { // if (Object.hasOwn(this.fileForm, file.typeCode)) {
if (this.fileForm.hasOwnProperty(file.typeCode)) {
this.fileForm[file.typeCode].push(file.id) this.fileForm[file.typeCode].push(file.id)
} else { } else {
this.fileForm[file.typeCode] = [file.id] this.fileForm[file.typeCode] = [file.id]
@ -425,12 +443,17 @@ export default {
}) })
// console.log('create new, dataform', JSON.stringify(this.dataForm)) // console.log('create new, dataform', JSON.stringify(this.dataForm))
} }
this.shouldWait = null
}) })
} }
}) })
}, },
emitSelectChange(name, id) { emitSelectChange(name, id) {
const currentField = this.configs.fields.find(item => item.name === name)
if (currentField.relatedField) {
this.dataForm[currentField.relatedField] = null
}
this.$emit('select-change', { name, id }) this.$emit('select-change', { name, id })
}, },

View File

@ -8,7 +8,7 @@ import merge from 'lodash/merge'
const http = axios.create({ const http = axios.create({
// baseURL: window.SITE_CONFIG['apiURL'], // baseURL: window.SITE_CONFIG['apiURL'],
baseURL: '/api', baseURL: '/yd-monitor',
// baseURL: process.env.NODE_ENV === 'production' ? '/api' : '/yd-monitor', // baseURL: process.env.NODE_ENV === 'production' ? '/api' : '/yd-monitor',
timeout: 1000 * 180, timeout: 1000 * 180,
withCredentials: true withCredentials: true

View File

@ -30,7 +30,7 @@
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
></el-pagination> ></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> </div>
</template> </template>
@ -62,6 +62,7 @@ const tableConfigs = [
{ prop: 'groupName', name: i18n.t('eq.group') }, { prop: 'groupName', name: i18n.t('eq.group') },
{ prop: 'enName', name: i18n.t('enname') }, { prop: 'enName', name: i18n.t('enname') },
{ prop: 'abbr', name: i18n.t('abbr') }, { prop: 'abbr', name: i18n.t('abbr') },
{ prop: 'lineName', name: i18n.t('pl.title') },
{ prop: 'sectionName', name: i18n.t('ws.title') }, { prop: 'sectionName', name: i18n.t('ws.title') },
{ {
prop: 'details', prop: 'details',
@ -94,6 +95,14 @@ const addOrUpdateConfigs = {
type: 'select', type: 'select',
options: [] options: []
}, },
{
name: 'lineId',
label: i18n.t('pl.title'),
required: true,
type: 'select',
options: [],
relatedField: 'sectionId', // idlineIdsectionId
},
{ {
name: 'sectionId', name: 'sectionId',
label: i18n.t('ws.title'), label: i18n.t('ws.title'),
@ -283,19 +292,41 @@ export default {
console.log('activated') console.log('activated')
this.getDataList() this.getDataList()
this.getGroupList() this.getGroupList()
this.getWsList() this.getPlList()
this.getTypeList() this.getTypeList()
}, },
methods: { methods: {
// // 线
getWsList() { getPlList() {
this.$http({ this.$http({
url: this.$http.adornUrl('/monitoring/workshopSection/list'), url: this.$http.adornUrl('/monitoring/productionLine/list'),
method: 'get' method: 'get'
}).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 }) => { }).then(({ data: res }) => {
const wsConfig = this.addOrUpdateConfigs.fields.find(item => item.name === 'sectionId') const wsConfig = this.addOrUpdateConfigs.fields.find(item => item.name === 'sectionId')
wsConfig.options = wsConfig.options =
res.data?.map(item => ({ res.data?.list?.map(item => ({
value: item.id, value: item.id,
label: item.name label: item.name
})) || [] })) || []
@ -378,6 +409,13 @@ export default {
selectionChangeHandle(val) { selectionChangeHandle(val) {
this.dataListSelections = val this.dataListSelections = val
}, },
//
handleDialogSelectChange({ name, id }) {
switch (name) {
case 'lineId':
this.getWsList(id)
}
},
handleOperations({ type, data: id }) { handleOperations({ type, data: id }) {
switch (type) { switch (type) {
case 'view-detail': case 'view-detail':

View File

@ -39,7 +39,7 @@
<section class="attr-form-section" v-if="dataForm.id"> <section class="attr-form-section" v-if="dataForm.id">
<h3> <h3>
{{ $t('ws.eqbind') }} {{ $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> </h3>
<div class="table" v-if="!showAttrForm"> <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" /> <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 i18n from '@/i18n'
import BaseTable from '@/components/base-table' import BaseTable from '@/components/base-table'
import SmallTitle from '@/components/small-title' import SmallTitle from '@/components/small-title'
import { pick } from 'lodash/object' // import { pick } from 'lodash/object'
import TableOperateComponent from '@/components/base-table/components/operationComponent' // import TableOperateComponent from '@/components/base-table/components/operationComponent'
import AttrForm from './workshopSectionDialogAttrForm.vue' import AttrForm from './workshopSectionDialogAttrForm.vue'
import { calcMaxHeight } from '@/utils' import { calcMaxHeight } from '@/utils'
const tableProps = [ const tableProps = [
@ -79,14 +79,14 @@ const tableProps = [
}, },
{ name: i18n.t('eq.name'), prop: 'equipmentName' }, { name: i18n.t('eq.name'), prop: 'equipmentName' },
{ name: i18n.t('dept.sort'), prop: 'sort' }, { name: i18n.t('dept.sort'), prop: 'sort' },
{ // {
name: i18n.t('handle'), // name: i18n.t('handle'),
prop: 'operations', // prop: 'operations',
fixed: 'right', // fixed: 'right',
width: 180, // width: 180,
subcomponent: TableOperateComponent, // subcomponent: TableOperateComponent,
options: ['edit', 'delete'] // options: ['edit', 'delete']
} // }
] ]
export default { export default {

View File

@ -32,7 +32,7 @@ module.exports = {
target: 'http://india.mes.picaiba.com/' target: 'http://india.mes.picaiba.com/'
}, },
'/yd-monitor': { '/yd-monitor': {
target: 'http://192.168.1.20:8080/' // 开发地址 target: 'http://192.168.1.18:8080/' // 开发地址
}, },
'/ureport': { '/ureport': {
target: 'http://india.mes.picaiba.com/' // ureporter target: 'http://india.mes.picaiba.com/' // ureporter