update 资料中心
This commit is contained in:
@@ -0,0 +1,148 @@
|
||||
<template>
|
||||
<j-modal
|
||||
:title="title"
|
||||
:maskClosable="false"
|
||||
:width="width"
|
||||
:visible="visible"
|
||||
:confirm-loading="confirmLoading"
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel">
|
||||
|
||||
<a-form :form="form">
|
||||
<!--文件名称-->
|
||||
<a-form-item :label="$t('fileName')" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input :placeholder="$t('pleaseEnter') + $t('fileName')"
|
||||
@change="event => event.target.value = event.target.value.trim()"
|
||||
:maxLength="50"
|
||||
v-decorator="['title', validatorRules.title]" />
|
||||
</a-form-item>
|
||||
<!--所属类型-->
|
||||
<a-form-item :label="$t('standardRegulationLibrary.profileCenter.typeOfOwnership')" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-tree-select v-decorator="['title', validatorRules.title]"
|
||||
:getPopupContainer="triggerNode=> triggerNode.parentNode"
|
||||
style="width: 100%"
|
||||
:tree-data="typeOfOwnershipTreeData"
|
||||
:label-in-value="false"
|
||||
:placeholder="$t('pleaseSelect')+$t('standardRegulationLibrary.profileCenter.typeOfOwnership')" />
|
||||
</a-form-item>
|
||||
<!--上传资料-->
|
||||
<a-form-item :label="$t('standardRegulationLibrary.profileCenter.uploadData')" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<j-upload v-decorator="['title', validatorRules.title]" return-id />
|
||||
</a-form-item>
|
||||
<!--推送范围-->
|
||||
<a-form-item :label="$t('standardRegulationLibrary.dynamicMessage.pushRange')" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<user-selection v-decorator="['title', validatorRules.title]"
|
||||
:placeholder="$t('pleaseSelect')+$t('standardRegulationLibrary.dynamicMessage.pushRange')" />
|
||||
</a-form-item>
|
||||
<!--文件说明-->
|
||||
<a-form-item :label="$t('fileDeclaration')" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input type="textarea"
|
||||
:placeholder="$t('pleaseEnter') + $t('fileDeclaration')"
|
||||
@change="event => event.target.value = event.target.value.trim()"
|
||||
:maxLength="500"
|
||||
v-decorator="['title', validatorRules.title]" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import UserSelection from '../../../../components/selection/UserSelection.vue'
|
||||
import { addProfileCenter, editProfileCenter } from '../../../../api/standardRegulationLibraryApi.js'
|
||||
|
||||
export default {
|
||||
name: 'ProfileCenterModal',
|
||||
components: { UserSelection },
|
||||
data () {
|
||||
return {
|
||||
title: this.$t('newlyAdded'),
|
||||
width: 600,
|
||||
visible: false,
|
||||
confirmLoading: false,
|
||||
modal: {},
|
||||
form: this.$form.createForm(this),
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 4 }
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 20 }
|
||||
},
|
||||
validatorRules: {
|
||||
// 文件名称
|
||||
title: {
|
||||
rules: [{ required: true, message: this.$t('pleaseEnter') + this.$t('fileName') }],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
// 所属类型
|
||||
project: {
|
||||
rules: [{ required: false, message: this.$t('pleaseSelect') + this.$t('standardRegulationLibrary.profileCenter.typeOfOwnership') }],
|
||||
validateTrigger: 'change'
|
||||
},
|
||||
// 上传资料
|
||||
standardNumber: {
|
||||
rules: [{ required: true, message: this.$t('uploadFile.pleaseUpload') + this.$t('uploadFile.file') }],
|
||||
validateTrigger: 'change'
|
||||
},
|
||||
// 推送范围
|
||||
problemOccurrenceTime: {
|
||||
rules: [{ required: false, message: this.$t('pleaseSelect') + this.$t('standardRegulationLibrary.dynamicMessage.pushRange') }],
|
||||
validateTrigger: 'change'
|
||||
},
|
||||
// 文件说明
|
||||
respondent: {
|
||||
rules: [{ required: false, message: this.$t('pleaseEnter') + this.$t('fileDeclaration') }],
|
||||
validateTrigger: 'blur'
|
||||
}
|
||||
},
|
||||
typeOfOwnershipTreeData: [] // 所属类型树形下拉
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.visible = true
|
||||
},
|
||||
edit (record) {
|
||||
this.modal = Object.assign({}, record)
|
||||
this.visible = true
|
||||
},
|
||||
handleOk () {
|
||||
this.form.validateFields((errors, values) => {
|
||||
if (!errors) {
|
||||
this.confirmLoading = true
|
||||
let submitFunc
|
||||
if (this.modal.id) {
|
||||
submitFunc = editProfileCenter
|
||||
} else {
|
||||
submitFunc = addProfileCenter
|
||||
}
|
||||
const formData = Object.assign(this.modal, values)
|
||||
submitFunc(formData).then(res => {
|
||||
if (res.success) {
|
||||
this.$message.success(res.message)
|
||||
this.$emit('ok')
|
||||
this.close()
|
||||
} else {
|
||||
this.$message.warn(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
this.confirmLoading = false
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
close () {
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user