128 lines
4.1 KiB
Vue
128 lines
4.1 KiB
Vue
<template>
|
|
<j-modal
|
|
:title="title"
|
|
:maskClosable="false"
|
|
:width="width"
|
|
:visible="visible"
|
|
:confirm-loading="confirmLoading"
|
|
switchFullscreen
|
|
@ok="handleOk"
|
|
@cancel="handleCancel">
|
|
<a-spin :spinning="confirmLoading">
|
|
<a-form :form="form">
|
|
<!--标准编号-->
|
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('standardNumber')">
|
|
<a-input v-decorator="['standardNumber', validatorRules.standardNumber]"
|
|
:maxLength="50"
|
|
:placeholder="$t('pleaseEnter') + $t('standardNumber')"
|
|
@change="e => {e.target.value = (e.target.value + '').trim()}" />
|
|
<!--<standard-selection :placeholder="$t('pleaseSelect') + $t('standardNumber')"-->
|
|
<!-- v-decorator="['standardNumber', validatorRules.standardNumber]"-->
|
|
<!-- type="radio"-->
|
|
<!-- @nameChange="handleStandardChange" />-->
|
|
</a-form-item>
|
|
<!--标准名称-->
|
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('standardName')">
|
|
<a-input v-decorator="['standardName', validatorRules.standardName]"
|
|
:maxLength="50"
|
|
:placeholder="$t('pleaseEnter') + $t('standardName')"
|
|
@change="e => {e.target.value = (e.target.value + '').trim()}" />
|
|
</a-form-item>
|
|
<!--采购理由-->
|
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('workCenter.standardProcurementProcess.reasonForPurchase')">
|
|
<a-input v-decorator="['purchaseReason', validatorRules.purchaseReason]"
|
|
:maxLength="500"
|
|
type="textarea"
|
|
:placeholder="$t('pleaseEnter') + $t('workCenter.standardProcurementProcess.reasonForPurchase')"
|
|
@change="e => {e.target.value = (e.target.value + '').trim()}" />
|
|
</a-form-item>
|
|
</a-form>
|
|
</a-spin>
|
|
</j-modal>
|
|
</template>
|
|
|
|
<script>
|
|
import StandardSelection from '../../../../components/selection/StandardSelection'
|
|
|
|
export default {
|
|
name: 'TableFormModal',
|
|
components: { StandardSelection },
|
|
data () {
|
|
return {
|
|
title: this.$t('operation'),
|
|
width: 600,
|
|
visible: false,
|
|
confirmLoading: false,
|
|
form: this.$form.createForm(this),
|
|
labelCol: {
|
|
xs: { span: 24 },
|
|
sm: { span: 6 }
|
|
},
|
|
wrapperCol: {
|
|
xs: { span: 24 },
|
|
sm: { span: 16 }
|
|
},
|
|
model: {},
|
|
validatorRules: {
|
|
// 标准编号
|
|
standardNumber: {
|
|
rules: [{ required: true, message: this.$t('pleaseEnter') + this.$t('standardNumber') }],
|
|
validateTrigger: 'blur'
|
|
},
|
|
// 标准名称
|
|
standardName: {
|
|
rules: [{ required: true, message: this.$t('pleaseEnter') + this.$t('standardName') }],
|
|
validateTrigger: 'blur'
|
|
},
|
|
// 采购理由
|
|
purchaseReason: {
|
|
rules: [{ required: true, message: this.$t('pleaseEnter') + this.$t('workCenter.standardProcurementProcess.reasonForPurchase') }],
|
|
validateTrigger: 'blur'
|
|
}
|
|
},
|
|
dataIndex: null
|
|
}
|
|
},
|
|
methods: {
|
|
add () {
|
|
this.title = this.$t('newlyAdded')
|
|
this.dataIndex = null
|
|
this.visible = true
|
|
},
|
|
edit (record, index) {
|
|
this.title = this.$t('edit')
|
|
this.dataIndex = index
|
|
this.visible = true
|
|
this.model = Object.assign({}, record)
|
|
this.$nextTick(() => {
|
|
this.form.setFieldsValue(this.model)
|
|
})
|
|
},
|
|
handleOk () {
|
|
this.form.validateFields((errors, values) => {
|
|
if (!errors) {
|
|
const formData = Object.assign(this.model, values)
|
|
this.$emit('ok', formData, this.dataIndex)
|
|
this.close()
|
|
}
|
|
})
|
|
},
|
|
handleCancel () {
|
|
this.close()
|
|
},
|
|
close () {
|
|
this.visible = false
|
|
this.form.resetFields()
|
|
this.model = {}
|
|
},
|
|
handleStandardChange (name) {
|
|
this.form.setFieldsValue({ standardName: name })
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
|
|
</style>
|