fix:质检发货资料类型选择问题
This commit is contained in:
@@ -11,7 +11,13 @@
|
|||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
size="small"
|
size="small"
|
||||||
style="width: 240px;"/>
|
style="width: 240px;"/>
|
||||||
<el-select v-model="filter.materials_type" placeholder="资料类型" clearable size="small" style="width: 160px; margin-left: 10px;">
|
<el-select
|
||||||
|
v-model="filter.materials_type"
|
||||||
|
placeholder="资料类型"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
style="width: 160px; margin-left: 10px;"
|
||||||
|
@change="handleMaterialsTypeChange">
|
||||||
<el-option label="全部" value=""/>
|
<el-option label="全部" value=""/>
|
||||||
<el-option v-for="item in materials_type_list" :key="item.type_id" :label="item.type_name" :value="item.type_id"/>
|
<el-option v-for="item in materials_type_list" :key="item.type_id" :label="item.type_name" :value="item.type_id"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
@@ -228,6 +234,7 @@ export default {
|
|||||||
fileName: '',
|
fileName: '',
|
||||||
currentFileName: '',
|
currentFileName: '',
|
||||||
query_triggered: false,
|
query_triggered: false,
|
||||||
|
useDefaultMaterialsType: true,
|
||||||
total: 0,
|
total: 0,
|
||||||
currPage: 1,
|
currPage: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@@ -238,6 +245,7 @@ export default {
|
|||||||
newMaterials: {
|
newMaterials: {
|
||||||
materials_intro: '',
|
materials_intro: '',
|
||||||
create_time: '',
|
create_time: '',
|
||||||
|
materials_type: '',
|
||||||
project_id: 0
|
project_id: 0
|
||||||
},
|
},
|
||||||
editMaterials: {
|
editMaterials: {
|
||||||
@@ -254,9 +262,7 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.get_material_type_list()
|
this.get_material_type_list()
|
||||||
if (!Array.isArray(this.materials_type)) {
|
this.resetDefaultMaterialsType()
|
||||||
this.filter.materials_type = this.materials_type
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|
||||||
@@ -301,7 +307,7 @@ export default {
|
|||||||
},
|
},
|
||||||
handleReset() {
|
handleReset() {
|
||||||
this.filter.dateRange = null
|
this.filter.dateRange = null
|
||||||
this.filter.materials_type = ''
|
this.resetDefaultMaterialsType()
|
||||||
this.currPage = 1
|
this.currPage = 1
|
||||||
this.pageSize = 10
|
this.pageSize = 10
|
||||||
this.total = 0
|
this.total = 0
|
||||||
@@ -317,6 +323,37 @@ export default {
|
|||||||
this.currPage = val
|
this.currPage = val
|
||||||
this.get_materials_info_list()
|
this.get_materials_info_list()
|
||||||
},
|
},
|
||||||
|
handleMaterialsTypeChange() {
|
||||||
|
this.useDefaultMaterialsType = false
|
||||||
|
},
|
||||||
|
resetDefaultMaterialsType() {
|
||||||
|
this.useDefaultMaterialsType = true
|
||||||
|
this.filter.materials_type = Array.isArray(this.materials_type) ? '' : this.materials_type
|
||||||
|
},
|
||||||
|
hasSelectedMaterialType(value) {
|
||||||
|
return value !== '' && value !== undefined && value !== null
|
||||||
|
},
|
||||||
|
buildMaterialsQueryParams() {
|
||||||
|
const param = {
|
||||||
|
materials_owner: this.materials_owner,
|
||||||
|
materials_class: this.materials_class,
|
||||||
|
currPage: this.currPage,
|
||||||
|
pageSize: this.pageSize
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hasSelectedMaterialType(this.filter.materials_type)) {
|
||||||
|
param.materials_type = this.filter.materials_type
|
||||||
|
} else if (this.useDefaultMaterialsType && this.hasSelectedMaterialType(this.materials_type)) {
|
||||||
|
param.materials_type = this.materials_type
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.filter.dateRange && this.filter.dateRange.length === 2) {
|
||||||
|
param.start_time = this.filter.dateRange[0]
|
||||||
|
param.end_time = this.filter.dateRange[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
return param
|
||||||
|
},
|
||||||
confirmEdit() {
|
confirmEdit() {
|
||||||
const formData = {
|
const formData = {
|
||||||
materials_id: this.editMaterials.materials_id,
|
materials_id: this.editMaterials.materials_id,
|
||||||
@@ -429,12 +466,15 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
confirmAddMaterials() {
|
confirmAddMaterials() {
|
||||||
if (this.newMaterials.materials_intro.trim() === '') {
|
const materialsIntro = (this.newMaterials.materials_intro || '').trim()
|
||||||
|
const materialsUrl = (this.materials_url || '').trim()
|
||||||
|
|
||||||
|
if (materialsIntro === '') {
|
||||||
this.$message.warning('请输入文件描述')
|
this.$message.warning('请输入文件描述')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log(this.materials_url)
|
console.log(this.materials_url)
|
||||||
if (this.materials_url.trim() === '') {
|
if (materialsUrl === '') {
|
||||||
this.$message.warning('请选择文件')
|
this.$message.warning('请选择文件')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -443,7 +483,7 @@ export default {
|
|||||||
materials_class: this.materials_class,
|
materials_class: this.materials_class,
|
||||||
materials_owner: this.materials_owner,
|
materials_owner: this.materials_owner,
|
||||||
materials_type: this.newMaterials.materials_type,
|
materials_type: this.newMaterials.materials_type,
|
||||||
materials_intro: this.newMaterials.materials_intro,
|
materials_intro: materialsIntro,
|
||||||
materials_url: this.materials_url,
|
materials_url: this.materials_url,
|
||||||
materials_file_name: this.fileName,
|
materials_file_name: this.fileName,
|
||||||
create_time: this.newMaterials.create_time
|
create_time: this.newMaterials.create_time
|
||||||
@@ -468,23 +508,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
get_materials_info_list() {
|
get_materials_info_list() {
|
||||||
var param = {
|
var param = this.buildMaterialsQueryParams()
|
||||||
materials_owner: this.materials_owner,
|
|
||||||
materials_class: this.materials_class,
|
|
||||||
currPage: this.currPage,
|
|
||||||
pageSize: this.pageSize
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.filter.materials_type !== '') {
|
|
||||||
param.materials_type = this.filter.materials_type
|
|
||||||
} else if (!Array.isArray(this.materials_type)) {
|
|
||||||
param.materials_type = this.materials_type
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.filter.dateRange && this.filter.dateRange.length === 2) {
|
|
||||||
param.start_time = this.filter.dateRange[0]
|
|
||||||
param.end_time = this.filter.dateRange[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
material.GetMaterialsInfo(param).then(response => {
|
material.GetMaterialsInfo(param).then(response => {
|
||||||
const data = response.data.data
|
const data = response.data.data
|
||||||
|
|||||||
Reference in New Issue
Block a user