配件新购优化
This commit is contained in:
parent
c870b2e079
commit
ae32826796
|
|
@ -70,4 +70,13 @@ export function getInBoundForm(query) {
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据id查3级树
|
||||||
|
export function getSelectPartListApi(query) {
|
||||||
|
return request({
|
||||||
|
url: '/material/part_lease/selectPartList',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -56,23 +56,40 @@
|
||||||
<span>%</span>
|
<span>%</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="类型规格" prop="deviceType">
|
<el-form-item label="类型名称" prop="deviceType">
|
||||||
<el-cascader
|
<el-cascader
|
||||||
:key="propsKey"
|
:key="propsKey"
|
||||||
v-model="deviceType"
|
v-model="deviceType"
|
||||||
:show-all-levels="false"
|
|
||||||
:options="equipmentTypeList"
|
:options="equipmentTypeList"
|
||||||
:props="deviceTypeTreeProps"
|
:props="deviceTypeTreeProps"
|
||||||
filterable
|
filterable
|
||||||
|
clearable
|
||||||
collapse-tags
|
collapse-tags
|
||||||
style="width: 240px"
|
style="width: 240px"
|
||||||
placeholder="请选择规格型号"
|
placeholder="请选择类型名称"
|
||||||
ref="deviceTypeCascader"
|
ref="deviceTypeCascader"
|
||||||
popper-class="popper-select"
|
popper-class="popper-select"
|
||||||
@change="deviceTypeChange"
|
@change="deviceTypeChange2"
|
||||||
></el-cascader>
|
></el-cascader>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="规格型号" prop="maType">
|
||||||
|
<el-select
|
||||||
|
v-model="maForm.maType"
|
||||||
|
placeholder="请选择规格型号"
|
||||||
|
filterable
|
||||||
|
style="width: 240px"
|
||||||
|
@change="maTypeChange"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in maTypeList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.paName"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="maForm.remark"
|
v-model="maForm.remark"
|
||||||
|
|
@ -124,7 +141,7 @@
|
||||||
<el-input
|
<el-input
|
||||||
v-model.number="scope.row.purchaseNum"
|
v-model.number="scope.row.purchaseNum"
|
||||||
controls-position="right" type="number"
|
controls-position="right" type="number"
|
||||||
style="width: 100%" :disabled="scope.row.status!=0"
|
style="width: 100%"
|
||||||
:min="0"
|
:min="0"
|
||||||
></el-input>
|
></el-input>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -139,7 +156,7 @@
|
||||||
v-model="scope.row.purchaseTaxPrice"
|
v-model="scope.row.purchaseTaxPrice"
|
||||||
controls-position="right"
|
controls-position="right"
|
||||||
style="width: 100%" @blur="scope.row.purchaseTaxPrice = scope.row.purchaseTaxPrice>0? scope.row.purchaseTaxPrice:0"
|
style="width: 100%" @blur="scope.row.purchaseTaxPrice = scope.row.purchaseTaxPrice>0? scope.row.purchaseTaxPrice:0"
|
||||||
:min="0" :step="1" :disabled="scope.row.status!=0"
|
:min="0" :step="1"
|
||||||
@change="purchaseTaxPriceChange(scope.row,scope.$index)"
|
@change="purchaseTaxPriceChange(scope.row,scope.$index)"
|
||||||
></el-input-number>
|
></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -170,7 +187,7 @@
|
||||||
v-model="scope.row.productionTime"
|
v-model="scope.row.productionTime"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
type="date" :disabled="scope.row.status!=0"
|
type="date"
|
||||||
placeholder="出厂日期"
|
placeholder="出厂日期"
|
||||||
clearable
|
clearable
|
||||||
></el-date-picker>
|
></el-date-picker>
|
||||||
|
|
@ -281,7 +298,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getTypeTree,addPartInfo,getPartTypeCheckInfo,updatePartInfo,getPartTypeFileList } from '@/api/part/partArrived';
|
import { getTypeTree,addPartInfo,getPartTypeCheckInfo,updatePartInfo,getPartTypeFileList, getSelectPartListApi } from '@/api/part/partArrived';
|
||||||
import { getListFacturer } from '@/api/ma/supplier';
|
import { getListFacturer } from '@/api/ma/supplier';
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
|
|
||||||
|
|
@ -371,7 +388,9 @@ export default {
|
||||||
purchaser: '',
|
purchaser: '',
|
||||||
remark: '',
|
remark: '',
|
||||||
purchaseNumber: '',
|
purchaseNumber: '',
|
||||||
|
maType: null
|
||||||
},
|
},
|
||||||
|
maTypeList: [],
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
defaultProps: {
|
defaultProps: {
|
||||||
|
|
@ -403,7 +422,7 @@ export default {
|
||||||
label: 'partName',
|
label: 'partName',
|
||||||
// multiple: false,
|
// multiple: false,
|
||||||
value: 'partId',
|
value: 'partId',
|
||||||
multiple: true,
|
multiple: false,
|
||||||
},
|
},
|
||||||
deviceType: [],
|
deviceType: [],
|
||||||
propsKey: 1000,
|
propsKey: 1000,
|
||||||
|
|
@ -478,16 +497,17 @@ export default {
|
||||||
this.equipmentTypeList.forEach((item, index) => {
|
this.equipmentTypeList.forEach((item, index) => {
|
||||||
if (item.children && item.children.length > 0) {
|
if (item.children && item.children.length > 0) {
|
||||||
item.children.forEach((item2, index2) => {
|
item.children.forEach((item2, index2) => {
|
||||||
if (item2.children && item2.children.length > 0) {
|
delete item2.children
|
||||||
item2.children.forEach((item3) => {
|
// if (item2.children && item2.children.length > 0) {
|
||||||
item2.children.forEach((item3) => {
|
// item2.children.forEach((item3) => {
|
||||||
item3.maTypeName = item2.partName
|
// item2.children.forEach((item3) => {
|
||||||
item3.specificationType = item3.partName
|
// item3.maTypeName = item2.partName
|
||||||
this.$set(item3, 'purchaseTaxPrice', 0)
|
// item3.specificationType = item3.partName
|
||||||
this.$set(item3, 'purchasePrice', 0)
|
// this.$set(item3, 'purchaseTaxPrice', 0)
|
||||||
})
|
// this.$set(item3, 'purchasePrice', 0)
|
||||||
})
|
// })
|
||||||
}
|
// })
|
||||||
|
// }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -572,6 +592,55 @@ export default {
|
||||||
this.equipmentList = []
|
this.equipmentList = []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
deviceTypeChange2(val) {
|
||||||
|
console.log('🚀 ~ deviceTypeChange2 ~ val:', val)
|
||||||
|
this.maTypeList = []
|
||||||
|
this.maForm.maType = ''
|
||||||
|
if (val.length > 0) {
|
||||||
|
this.getMaTypeList(val[1])
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async getMaTypeList(id) {
|
||||||
|
try {
|
||||||
|
const res = await getSelectPartListApi({ id: id })
|
||||||
|
console.log('🚀 ~ getMaTypeList ~ res:', res)
|
||||||
|
this.maTypeList = res.data
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.log('🚀 ~ getMaTypeList ~ error:', error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
maTypeChange (val) {
|
||||||
|
console.log('🚀 ~ maTypeChange ~ val:', this.maForm.maType)
|
||||||
|
if (val) {
|
||||||
|
const obj = this.maTypeList.find(item => item.id === val)
|
||||||
|
console.log('🚀 ~ maTypeChange ~ obj:', obj)
|
||||||
|
// 如果 当前 id 在this.equipmentList 已有 则提示 已添加并阻断
|
||||||
|
const isExist = this.equipmentList.find(item => item.id === obj.id || item.partId == obj.id)
|
||||||
|
console.log('🚀 ~ maTypeChange ~ isExist:', isExist)
|
||||||
|
if (isExist) {
|
||||||
|
this.$message({
|
||||||
|
message: `当前配件 ${obj.paName} 已添加`,
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
this.equipmentList.push({
|
||||||
|
...obj,
|
||||||
|
maTypeName: obj.partName,
|
||||||
|
partId: obj.id,
|
||||||
|
partName: obj.paName,
|
||||||
|
createTime: null,
|
||||||
|
productionTime: this.maForm.productionTime,
|
||||||
|
purchaseTaxPrice: 0,
|
||||||
|
purchaseNum: 0,
|
||||||
|
status: 0,
|
||||||
|
isExitFile: '1',
|
||||||
|
bmFileInfo:[]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
//选择出厂日期
|
//选择出厂日期
|
||||||
productionTimeChange(val){
|
productionTimeChange(val){
|
||||||
this.equipmentList.forEach(item=>{
|
this.equipmentList.forEach(item=>{
|
||||||
|
|
@ -613,12 +682,12 @@ export default {
|
||||||
this.$refs['maForm'].validate((valid) => {
|
this.$refs['maForm'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.maForm.taskId = this.taskId;
|
this.maForm.taskId = this.taskId;
|
||||||
let index =this.equipmentList.findIndex(item=>item.purchaseNum==0)
|
let index =this.equipmentList.findIndex(item=>item.purchaseNum == 0 || !item.purchaseNum)
|
||||||
let index2 =this.equipmentList.findIndex(item=>item.purchaseTaxPrice==0)
|
let index2 =this.equipmentList.findIndex(item=>item.purchaseTaxPrice == 0 || !item.purchaseTaxPrice)
|
||||||
if(index>-1){
|
if(index>-1){
|
||||||
this.$modal.msgError('采购数量不能为0!')
|
this.$modal.msgError(`第${index + 1}行采购数量不能为0!`)
|
||||||
}else if(index2>-1){
|
}else if(index2>-1){
|
||||||
this.$modal.msgError('含税单价不能为0!')
|
this.$modal.msgError(`第${index2 + 1}行采购含税价格不能为0!`)
|
||||||
}else {
|
}else {
|
||||||
this.$modal.confirm('是否确认保存当前页面').then(function () {})
|
this.$modal.confirm('是否确认保存当前页面').then(function () {})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
@ -635,7 +704,7 @@ export default {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
this.loading = false
|
this.loading = false
|
||||||
})
|
}).catch(() => { this.loading = false })
|
||||||
} else if (!this.isEdit) {
|
} else if (!this.isEdit) {
|
||||||
console.log('新增')
|
console.log('新增')
|
||||||
// console.log(this.equipmentList)
|
// console.log(this.equipmentList)
|
||||||
|
|
@ -650,7 +719,7 @@ export default {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
this.loading = false
|
this.loading = false
|
||||||
})
|
}).catch(() => { this.loading = false })
|
||||||
}
|
}
|
||||||
}).catch(() => {})
|
}).catch(() => {})
|
||||||
}
|
}
|
||||||
|
|
@ -913,12 +982,12 @@ export default {
|
||||||
this.$modal
|
this.$modal
|
||||||
.confirm('是否确认删除所选择的数据项?')
|
.confirm('是否确认删除所选择的数据项?')
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.deviceType.forEach((e, index) => {
|
// this.deviceType.forEach((e, index) => {
|
||||||
if (e[2] === row.partId) {
|
// if (e[2] === row.partId) {
|
||||||
this.deviceType.splice(index, 1)
|
// this.deviceType.splice(index, 1)
|
||||||
this.propsKey++
|
// this.propsKey++
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
this.equipmentList.forEach((item, index) => {
|
this.equipmentList.forEach((item, index) => {
|
||||||
if (item.partId == row.partId) {
|
if (item.partId == row.partId) {
|
||||||
this.equipmentList.splice(index, 1)
|
this.equipmentList.splice(index, 1)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue