123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <template>
- <el-row style="margin-bottom: 20px;" v-loading="loading">
- <el-col :span="16">
- <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
- <el-row class="my-row">
- <el-form-item label="处理意见" prop="remark">
- <el-input type="textarea" v-model="dataForm.remark" placeholder="处理意见"></el-input>
- </el-form-item>
- </el-row>
- <el-row class="my-row">
- <upload-component :display-star="false" :title="'审批附件'" :accept="'*'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>
- </el-row>
- </el-form>
- </el-col>
- <el-col :span="8">
- <el-button style="margin-left: 20px" @click="dataFormSubmit(2)">不同意</el-button>
- <el-button type="primary" @click="dataFormSubmit(1)">同意</el-button>
- <el-button type="danger" @click="dataFormSubmit(3)">驳回</el-button>
- </el-col>
- </el-row>
- </template>
- <script>
- import UploadComponent from '../common/upload-component'
- export default {
- name: 'approve-component-batch',
- components: {UploadComponent},
- data () {
- return {
- dataForm: {},
- fileList: [],
- dataRule: {
- // remark: [{ required: true, message: '处理意见不能为空', trigger: 'blur' }]
- },
- loading: false
- }
- },
- methods: {
- async init (businessType, businessIds) {
- // console.log('[approve-component]businessType = ' + businessType)
- // console.log('[approve-component]businessId = ' + businessId)
- this.visible = true
- this.dataForm = {
- busiType: businessType || '',
- busiIds: businessIds || []
- }
- this.fileList = []
- },
- // 表单提交
- dataFormSubmit (val) {
- this.$refs['dataForm'].validate((valid) => {
- if (valid) {
- if (val !== '1') {
- if (!this.dataForm.remark) {
- this.$message.error('请填写审批意见')
- return
- }
- } else {
- this.dataForm.remark = this.dataForm.remark || '审批通过'
- }
- this.loading = true
- // 添加附件
- let fList = this.fileList
- if (fList.length > 0) {
- this.dataForm.attachList = []
- for (let i = 0; i < fList.length; i++) {
- this.dataForm.attachList.push({
- fileName: fList[i].name,
- url: fList[i].url
- })
- }
- }
- this.$http({
- url: this.$http.adornUrl(`/biz-service/business/batch/approval`),
- method: 'post',
- data: this.$http.adornData(
- {...this.dataForm,
- approvalType: val,
- userName: this.$store.state.user.name,
- orgId: this.$store.state.user.orgId
- })
- }).then(({data}) => {
- this.loading = false
- if (data && data.code === '200') {
- this.$message({
- message: '操作成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.visible = false
- this.$emit('approveFinished')
- }
- })
- } else {
- this.$message.error(data.msg)
- }
- }).catch(e => {
- this.loading = false
- })
- }
- })
- },
- validateField (type) {
- this.$refs.dataForm.validateField(type)
- },
- uploadSuccess (fileList) {
- this.fileList = fileList
- }
- }
- }
- </script>
- <style scoped>
- </style>
|