Commit fe633b4e authored by jingnan's avatar jingnan 👀

ERP相关_报废领用界面配置及接口联调

parent 8c74c964
......@@ -104,7 +104,7 @@ export default {
{
'fieldName': 'sorties',
'operator': 'LIKE',
'value': this.form.sorties.split('+')[1] || ''
'value': this.form.sorties && this.form.sorties.includes('+') && this.form.sorties.split('+')[1] || this.form.sorties || ''
}
]
},
......
export default {
props: {},
layoutConfigData: [
{
title: '高级组件配置',
data: [
{
key: 'bindKey',
title: '绑定属性',
disabled: true,
component: {
defaultValue: 'sorties',
name: 'el-input'
}
},
{
key: 'relatedAttribute',
title: '受关联属性',
disabled: true,
component: {
defaultValue: '',
name: 'el-input'
}
}
]
}
],
data() {
return {
}
},
created() {
},
computed: {
},
methods: {
}
}
<template>
<div class="ERP_ScrapDocNoSelect">
<el-select
:value="selVal"
:loading="loading"
filterable
remote
clearable
:remote-method="remoteMethod"
:disabled="disabled"
:placeholder="!options.length?'至少输入三位进行查询':'暂无数据'"
@change="change"
@clear="clear"
>
<el-option
v-for="item in options"
:key="item.key"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
</template>
<script>
import config from './config'
import { post } from '@/utils/http'
export default {
name: 'ERPScrapDocNoSelect',
componentName: 'ERP_报废单号选择',
mixins: [config],
props: {
value: {
type: [String, Number],
default: ''
},
form: {
type: Object,
default: () => ({ sorties: '' })
},
disabled: {
type: Boolean,
default: false
},
item: {
type: Object,
default: () => {}
}
},
data() {
return {
loading: false,
options: [],
AllScrapNoticeDoc: [],
// linkageValue: '',
selVal: '',
remoteFlag: true
}
},
computed: {},
watch: {
'form.sorties': {
immediate: true,
handler(val) {
this.selVal = ''
}
},
value: {
immediate: true,
deep: true,
handler(v) {
if (v) {
this.selVal = this.value
}
}
}
},
methods: {
remoteMethod(query, id) {
if (!this.form || !this.form.sorties) return this.$utils.showMessageWarning('请选择架次后查询!')
if ((!query || query.length < 3) && !id) return
if (this.remoteFlag) {
this.remoteFlag = false
const params = {
pageFrom: 1,
pageSize: 9999,
searchItems: {
items: [
{
'fieldName': 'docNumber',
'operator': 'LIKE',
'value': query || ''
},
{
fieldName: 'sorties',
operator: 'EQ',
'value': this.form.sorties.split('+')[1] || ''
}
]
},
'openProps': [
],
sortItem: [{ fieldName: 'defCode', sortOrder: 'asc' }]
}
this.options = []
this.loading = true
this.$api.searchApi('ScrapNoticeDoc', params).then(res => {
if (res && res.items && res.items.content) {
this.AllScrapNoticeDoc = res.items.content
this.options = res.items.content.map(v => ({
key: v.id,
label: `${v.docNumber}`,
value: v.docNumber
}))
}
}).finally(() => {
this.loading = false
this.remoteFlag = true
})
} else {
this.$utils.showMessageWarning('上一步请求正在查询中,请稍后')
}
},
change(val) {
this.$emit('input', val)
const scrapNoticeDocObj = this.AllScrapNoticeDoc.find((item) => item.docNumber === val)
this.setFromData('scrapNoticeDoc', scrapNoticeDocObj)
this.getMaterial(val)
},
getMaterial(val) {
post(
`/ExtDxProcessMaterial/search`,
{
'pageFrom': 1,
'pageSize': 20,
'searchItems': {
'children': [
{
'items': [
{
'fieldName': 'resCode',
'operator': 'EQ',
'value': this.form.scrapNoticeDoc && this.form.scrapNoticeDoc.materialCode || ''
}
],
'operator': 'OR'
}
]
},
'openProps': [
{
'name': 'extUnit'
},
{
'name': 'resType2'
}
],
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
]
}
)
.then((res) => {
if (res.items && res.items.content && res.items.content.length) {
this.setFromData('extMaterial', res.items.content[0])
} else {
this.setFromData('extMaterial', {})
}
})
.catch((err) => {
console.log(err)
})
},
setFromData(key, value) {
this.$set(this.form, key, value)
},
clear() {
this.$emit('input')
this.setFromData('extMaterial', {})
this.setFromData('scrapNoticeDoc', {})
}
}
}
</script>
<style lang="scss">
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment