<template>
|
<div>
|
<el-dialog title="厂家密度绑定" :visible.sync="isShow" width="800px" @close="$emit('closeBindPartDialog')">
|
<div class="body" v-if="isShow" style="height: 500px;overflow-y: auto;padding: 5px 0;">
|
<!-- <ValueTable ref="bindPartComponent"-->
|
<!-- :url="searchUrl"-->
|
<!-- :upUrl="upUrl"-->
|
<!-- :delUrl="delUrl"-->
|
<!-- :componentData="bindPartComponent"-->
|
<!-- :key="upIndex"/>-->
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="$emit('closeBindPartDialog')">取 消</el-button>
|
<el-button type="primary" @click="addBindPart" :loading="addBindLoad">新 增</el-button>
|
</span>
|
</el-dialog>
|
<el-dialog title="新增厂家密度绑定" :visible.sync="addBindSupplierDensityDialog" width="400px" @close="closeBindPartDialog":close-on-click-modal="false" >
|
<div class="body" v-if="addBindSupplierDensityDialog">
|
<el-form label-position="right" label-width="80px"
|
ref="bindSupplierDensityData"
|
:rules="bindPartDataRules"
|
:model="bindSupplierDensityData">
|
<el-form-item label="型号:" prop="model">
|
<el-input v-model="bindSupplierDensityData.model" size="small"></el-input>
|
</el-form-item>
|
<el-form-item label="厂家:" prop="supplierName">
|
<el-input v-model="bindSupplierDensityData.supplierName" size="small"></el-input>
|
</el-form-item>
|
<el-form-item label="密度:" prop="densityValue">
|
<el-input v-model="bindSupplierDensityData.densityValue" size="small"></el-input>
|
</el-form-item>
|
</el-form>
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="closeBindPartDialog">取 消</el-button>
|
<el-button type="primary" @click="submitBind" :loading="bindLoad">确 认</el-button>
|
</span>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
// import ValueTable from "../../tool/value-table.vue";
|
|
export default {
|
name: "bindSupplierDensityDialog",
|
// import 引入的组件需要注入到对象中才能使用
|
components: {},
|
props: {
|
bindSupplierDensityDialog: {
|
type: Boolean,
|
default: () => false
|
},
|
currentRow : { // 选择本条数据的信息
|
type: Object,
|
default: () => {}
|
}
|
},
|
data() {
|
// 这里存放数据
|
return {
|
searchUrl: '', // 查询
|
upUrl: '', // 编辑
|
delUrl: '', // 删除
|
isShow: this.bindSupplierDensityDialog,
|
bindPartComponent: {
|
entity: {
|
orderBy: {
|
field: 'id',
|
order: 'asc'
|
}
|
},
|
isPage: true,
|
isIndex: true,
|
showSelect: false,
|
select: true,
|
do: [{
|
id: 'update',
|
font: '编辑',
|
type: 'text',
|
method: 'doDiy',
|
field: []
|
}, {
|
id: 'delete',
|
font: '删除',
|
type: 'text',
|
method: 'doDiy'
|
}],
|
tagField: {},
|
selectField: {},
|
requiredAdd: ['supplierName', 'densityValue'],
|
requiredUp: ['supplierName', 'densityValue'],
|
},
|
addBindSupplierDensityDialog: false,
|
bindSupplierDensityData: {
|
model: '', // 型号
|
supplierName: '', // 厂家
|
densityValue: '', // 密度
|
},
|
bindPartDataRules: {
|
supplierName: [
|
{ required: true, message: '请填写厂家名称', trigger: 'blur' }
|
],
|
densityValue: [
|
{ required: true, message: '请填写密度', trigger: 'blur' }
|
],
|
},
|
bindLoad: false,
|
upIndex: 0,
|
addBindLoad: false,
|
}
|
},
|
mounted() {
|
this.$set(this.bindPartComponent.entity, 'productId', this.currentRow.id)
|
},
|
// 方法集合
|
methods: {
|
addBindPart () {
|
this.addBindSupplierDensityDialog = true
|
},
|
// 提交零件绑定
|
submitBind () {
|
this.$refs['bindSupplierDensityData'].validate((valid) => {
|
if (valid) {
|
// 根据类型判断是检验对象零件绑定还是产品维护零件绑定
|
const params = {
|
productId: this.currentRow.id,
|
model: this.bindSupplierDensityData.model,
|
supplierName: this.bindSupplierDensityData.supplierName,
|
densityValue: this.bindSupplierDensityData.densityValue,
|
}
|
this.bindLoad = true
|
const url = this.$api.productSupplierDensity.addProductSupplierDensity
|
this.$axios.post(url, params, {
|
headers: {
|
'Content-Type': 'application/json'
|
}
|
}).then(res => {
|
this.bindLoad = false
|
if (res.code === 200) {
|
this.$refs['bindSupplierDensityData'].resetFields();
|
this.addBindSupplierDensityDialog = false
|
this.$message.success('操作成功')
|
this.$refs.bindPartComponent.selectList()
|
}
|
}).catch(err => {
|
this.bindLoad = false
|
console.log(err)
|
})
|
} else {
|
console.log('error submit!!');
|
return false;
|
}
|
})
|
},
|
closeBindPartDialog () {
|
this.$refs['bindSupplierDensityData'].resetFields();
|
this.addBindSupplierDensityDialog = false
|
},
|
},
|
}
|
</script>
|
|
<style scoped>
|
</style>
|