update 自定义比对-新增-表格
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<a-drawer
|
||||
:title="title"
|
||||
:width="width"
|
||||
placement="right"
|
||||
:closable="true"
|
||||
@close="handleCancel"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
class="custom-drawer-style">
|
||||
|
||||
<div class="custom-drawer-style-scroll">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form :form="form">
|
||||
<!--文本-->
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.split.text')">
|
||||
<a-input v-decorator="[`text`]"
|
||||
:maxLength="50"
|
||||
:placeholder="$t('pleaseEnter') + $t('docTool.split.text')"
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}" />
|
||||
</a-form-item>
|
||||
<!--相关附件-->
|
||||
<a-form-item :labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
:label="$t('docTool.customComparison.relatedAccessory')">
|
||||
<j-upload return-id v-decorator="[`fileId`]" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</div>
|
||||
|
||||
<div class="custom-drawer-style-bottom-btn">
|
||||
<a-button @click="handleOk" type="primary" style="margin-bottom: 0;" :loading="confirmLoading">
|
||||
{{ $t('preservation') }}
|
||||
</a-button>
|
||||
<a-button @click="handleCancel" style="margin-bottom: 0;" :loading="confirmLoading">{{ $t('close') }}</a-button>
|
||||
</div>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { editCell } from '../../../../api/documentToolApi'
|
||||
|
||||
export default {
|
||||
name: 'CustomComparisonCellDrawer',
|
||||
data () {
|
||||
return {
|
||||
title: this.$t('edit'),
|
||||
confirmLoading: false,
|
||||
width: 600,
|
||||
visible: false,
|
||||
form: this.$form.createForm(this),
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 4 }
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 18 }
|
||||
},
|
||||
model: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open (record) {
|
||||
this.visible = true
|
||||
this.model = Object.assign({}, record)
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(this.model)
|
||||
})
|
||||
},
|
||||
handleOk () {
|
||||
this.form.validateFields((errors, values) => {
|
||||
if (!errors) {
|
||||
this.confirmLoading = true
|
||||
const formData = Object.assign(this.model, values)
|
||||
editCell(formData).then(res => {
|
||||
if (res.success) {
|
||||
this.$message.success(res.message)
|
||||
this.close()
|
||||
this.$emit('ok')
|
||||
} else {
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
this.confirmLoading = false
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
close () {
|
||||
this.visible = false
|
||||
this.model = {}
|
||||
this.form.resetFields()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
@import '~@assets/less/common.less';
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user