138 lines
3.3 KiB
Vue
138 lines
3.3 KiB
Vue
<template>
|
|
<j-modal
|
|
:title="title"
|
|
:width="width"
|
|
:visible="visible"
|
|
:confirmLoading="confirmLoading"
|
|
switchFullscreen
|
|
@ok="handleOk"
|
|
@cancel="handleCancel"
|
|
cancelText="关闭">
|
|
<a-spin :spinning="confirmLoading">
|
|
<a-form :form="form">
|
|
<a-row>
|
|
<a-col>
|
|
<a-form-item label="文件" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
<j-upload file-type="all"
|
|
file-type-error-message="请上传文件"
|
|
:multiple="true"
|
|
:number="10"
|
|
:return-id="true"
|
|
v-decorator="['fileIds', validatorRules.fileIds]"
|
|
:trigger-change="true"></j-upload>
|
|
</a-form-item>
|
|
</a-col>
|
|
</a-row>
|
|
</a-form>
|
|
</a-spin>
|
|
</j-modal>
|
|
</template>
|
|
|
|
<script>
|
|
import pick from 'lodash.pick'
|
|
import { postAction } from '../../../api/manage'
|
|
import JUpload from '@comp/jero/JUpload'
|
|
|
|
export default {
|
|
name: 'DraftingGroupFileUploadModal',
|
|
components: { JUpload },
|
|
props: {
|
|
// 项目id
|
|
projectId: {
|
|
type: String,
|
|
required: false,
|
|
default: ''
|
|
},
|
|
// 项目类型:1--工作组;2--分标委
|
|
projectType: {
|
|
type: Number,
|
|
require: false,
|
|
default: null
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
title: '编辑',
|
|
width: 800,
|
|
visible: false,
|
|
confirmLoading: false,
|
|
form: this.$form.createForm(this),
|
|
model: {},
|
|
fileList: [],
|
|
labelCol: {
|
|
xs: { span: 24 },
|
|
sm: { span: 5 }
|
|
},
|
|
wrapperCol: {
|
|
xs: { span: 24 },
|
|
sm: { span: 17 }
|
|
},
|
|
validatorRules: {
|
|
fileIds: {
|
|
rules: [{ required: true, message: '请上传文件' }],
|
|
validateTrigger: 'change'
|
|
}
|
|
},
|
|
url: {
|
|
add: '/project/payWorkingGroupDataFile/add', // 资料上传
|
|
edit: '' // 资料和会议的编辑 post
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
add(data) {
|
|
this.edit({}, data)
|
|
},
|
|
edit(record, data) {
|
|
this.dataType = data // 接收数据类型
|
|
this.form.resetFields()
|
|
this.model = Object.assign({}, record)
|
|
this.visible = true
|
|
this.$nextTick(() => {
|
|
this.form.setFieldsValue(pick(this.model, 'dataId'))
|
|
})
|
|
},
|
|
close() {
|
|
this.$emit('close')
|
|
this.visible = false
|
|
},
|
|
handleOk() {
|
|
if (this.confirmLoading) {
|
|
return
|
|
}
|
|
this.confirmLoading = true
|
|
// 触发表单验证
|
|
this.form.validateFields((err, values) => {
|
|
if (!err) {
|
|
console.log(values)
|
|
let params = values
|
|
params.projectId = this.projectId
|
|
params.projectType = this.projectType
|
|
postAction(this.url.add, params).then((res) => {
|
|
if (res.success) {
|
|
this.$message.success(res.message)
|
|
this.$emit('ok')
|
|
this.close()
|
|
} else {
|
|
this.$message.warning(res.message)
|
|
}
|
|
}).finally(() => {
|
|
setTimeout(() => {
|
|
this.confirmLoading = false
|
|
}, 1000)
|
|
})
|
|
} else {
|
|
this.confirmLoading = false
|
|
}
|
|
})
|
|
},
|
|
handleCancel() {
|
|
this.close()
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style> |