<template>
|
<j-modal
|
:title='title'
|
:width='width'
|
:visible='visible'
|
:confirmLoading='confirmLoading'
|
switchFullscreen
|
@ok='handleOk'
|
@cancel='handleCancel'
|
cancelText='关闭'>
|
<a-spin :spinning='confirmLoading'>
|
<a-form-model ref='form' :model='model' :rules='validatorRules'>
|
|
<a-row style='width: 100%'>
|
<a-col :span='12'>
|
<a-form-model-item label='备件编码' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='spareNum'>
|
<a-input v-model='model.spareNum' placeholder='请输入备件编码'></a-input>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span='12'>
|
<a-form-model-item label='备件名称' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='spareNum'>
|
<a-input v-model='model.spareName' placeholder='请输备件名称'></a-input>
|
</a-form-model-item>
|
</a-col>
|
|
</a-row>
|
<a-row style='width: 100%'>
|
<a-col :span='12'>
|
<a-form-model-item label='规格' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='model'>
|
<a-input v-model='model.specification' placeholder='请输入规格'></a-input>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span='12'>
|
<a-form-model-item label='型号' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='model'>
|
<a-input v-model='model.model' placeholder='请输入规格型号' />
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
<a-row style='width: 100%'>
|
<a-col :span='12'>
|
<a-form-model-item label='单位' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='mainUnitId'>
|
<!-- <a-input v-model='model.mainUnitId' placeholder='请输入主单位' />-->
|
<j-dict-select-tag
|
allow-clear
|
:placeholder="'请选择单位'"
|
v-model='model.departId'
|
dictCode="mom_base_unit,name,id,del_flag!='1'"
|
/>
|
</a-form-model-item>
|
</a-col>
|
<!-- <a-col :span='12'>
|
<a-form-model-item label='辅单位' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='auxiliaryUnitId'>
|
<!– <a-input v-model='model.auxiliaryUnitId' placeholder='请输入辅单位' />–>
|
<j-dict-select-tag
|
allow-clear
|
:placeholder="'请选择辅单位'"
|
v-model='model.departId'
|
dictCode="mom_base_unit,name,id,del_flag!='1'"
|
/>
|
</a-form-model-item>
|
</a-col>-->
|
</a-row>
|
<a-row style='width: 100%'>
|
<a-col :span='12'>
|
<a-form-model-item label='主数量' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='mainQuantity'>
|
<a-input-number v-model='model.mainQuantity' placeholder='请输入主数量' />
|
</a-form-model-item>
|
</a-col>
|
<a-col :span='12'>
|
<a-form-model-item label='辅数量' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='auxiliaryQuantity'>
|
<a-input-number v-model='model.auxiliaryQuantity' placeholder='请输入辅数量' style='width: 100%' />
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
|
</a-form-model>
|
</a-spin>
|
</j-modal>
|
</template>
|
|
<script>
|
|
import { httpAction } from '@api/manage'
|
|
export default {
|
name: 'SpareRequirementSelectModal',
|
components: {},
|
props: {
|
mainId: {
|
type: String,
|
required: false,
|
default: ''
|
}
|
},
|
data() {
|
return {
|
title: '操作',
|
width: 800,
|
visible: false,
|
model: {},
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 6 }
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 18 }
|
},
|
|
confirmLoading: false,
|
validatorRules: {
|
physicalCountQuantity: [
|
{ required: false },
|
{ pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' }
|
],
|
quantityVariance: [
|
{ required: false },
|
{ pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' }
|
]
|
},
|
url: {
|
add: '/spare/sparePartScrap/add',
|
edit: '/spare/sparePartScrap/edit'
|
}
|
|
}
|
},
|
created() {
|
//备份model原始值
|
/* this.modelDefault = JSON.parse(JSON.stringify(this.model))*/
|
},
|
methods: {
|
add() {
|
this.edit(this.model)
|
},
|
edit(record) {
|
this.model = Object.assign({}, record)
|
this.visible = true
|
},
|
close() {
|
this.$emit('close')
|
this.visible = false
|
this.$refs.form.clearValidate()
|
},
|
|
handleOk() {
|
this.$bus.$emit('dataSource', this.model)
|
this.searchReset(0)
|
this.close()
|
},
|
|
/* handleOk() {
|
const that = this
|
// 触发表单验证
|
this.$refs.form.validate(valid => {
|
if (valid) {
|
that.confirmLoading = true
|
let httpurl = ''
|
let method = ''
|
if (!this.model.id) {
|
httpurl += this.url.add
|
method = 'post'
|
} else {
|
httpurl += this.url.edit
|
method = 'put'
|
}
|
this.model['sparePartScrapId'] = this.mainId
|
httpAction(httpurl, this.model, method).then((res) => {
|
if (res.success) {
|
that.$message.success(res.message)
|
that.$emit('ok')
|
} else {
|
that.$message.warning(res.message)
|
}
|
}).finally(() => {
|
that.confirmLoading = false
|
that.close()
|
})
|
} else {
|
return false
|
}
|
})
|
},*/
|
handleCancel() {
|
this.close()
|
},
|
popupCallback(value, row) {
|
this.model = Object.assign(this.model, row)
|
}
|
|
|
}
|
}
|
</script>
|