| | |
| | | :close-on-click-modal="false" |
| | | width="60%" |
| | | center |
| | | :show-close="false" |
| | | @close="resetForm('workForm')" |
| | | > |
| | | <el-upload |
| | | class="upload-demo" |
| | | action |
| | | :http-request="uploadFile" |
| | | :on-preview="handlePreview" |
| | | :on-remove="handleRemove" |
| | | :before-upload="beforeUpload" |
| | | :before-remove="beforeRemove" |
| | | multiple |
| | | :limit="1" |
| | | :on-exceed="handleExceed" |
| | | accept=".pdf, .doc, .docx" |
| | | :file-list="fileList"> |
| | | <div style="display: flex;align-items: center"> |
| | | <el-button type="primary" style="margin-right: 80px">检查内容上传</el-button> |
| | | <div slot="tip" class="el-upload__tip">只能上传doc/docx文件</div> |
| | | </div> |
| | | </el-upload> |
| | | <!-- <el-upload--> |
| | | <!-- class="upload-demo"--> |
| | | <!-- action--> |
| | | <!-- :http-request="uploadFile"--> |
| | | <!-- :on-preview="handlePreview"--> |
| | | <!-- :on-remove="handleRemove"--> |
| | | <!-- :before-upload="beforeUpload"--> |
| | | <!-- :before-remove="beforeRemove"--> |
| | | <!-- multiple--> |
| | | <!-- :limit="1"--> |
| | | <!-- :on-exceed="handleExceed"--> |
| | | <!-- accept=".pdf, .doc, .docx"--> |
| | | <!-- :file-list="fileList">--> |
| | | <!-- <div style="display: flex;align-items: center">--> |
| | | <!-- <el-button type="primary" style="margin-right: 80px">检查内容上传</el-button>--> |
| | | <!-- <div slot="tip" class="el-upload__tip">只能上传doc/docx文件</div>--> |
| | | <!-- </div>--> |
| | | <!-- </el-upload>--> |
| | | <el-form :model="workForm" :rules="rules" ref="workForm" label-width="80px"> |
| | | <el-form-item label="专项检查任务名称:" label-width="180px" prop="taskName"> |
| | | <el-input v-model="workForm.taskName"></el-input> |
| | |
| | | </el-form-item> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button type="warning" @click="cancleSend" plain>取消</el-button> |
| | | <!-- <el-button type="warning" @click="cancleSend" plain>取消</el-button>--> |
| | | <el-button @click="resetForm('workForm')">重置</el-button> |
| | | <el-button type="primary" v-stop-re-click @click="confirmSend('workForm')">确认下发</el-button> |
| | | </span> |
| | |
| | | |
| | | <script> |
| | | import {computePageCount} from "@/utils"; |
| | | import{sendCheckTask, uploadFile, delateFile} from "@/api/specialCheck" |
| | | import{sendCheckTask} from "@/api/specialCheck" |
| | | export default { |
| | | name: "sendWork", |
| | | data(){ |
| | | return{ |
| | | dialogVisible:false, |
| | | fileList: [], |
| | | fileType: ['pdf','doc','docx'], |
| | | workForm: { |
| | | taskName: '', |
| | | provinceWholesaleCheckTarget: null, |
| | |
| | | areaWholesaleCheckDeadline: '', |
| | | areaRetailCheckTarget: null, |
| | | areaRetailCheckDeadline: '', |
| | | enterpriseSelfCheckDeadline: '', |
| | | taskDescFileName: null |
| | | enterpriseSelfCheckDeadline: '' |
| | | }, |
| | | rules: { |
| | | taskName: [{ required: true, message: '请输入任务名称', trigger: 'blur' }], |
| | |
| | | }, |
| | | methods:{ |
| | | //上传文件的事件 |
| | | async uploadFile(item){ |
| | | const t = this |
| | | const loading = this.$loading({ |
| | | lock: true, |
| | | text: '正在上传文件...', |
| | | spinner: 'el-icon-loading' |
| | | }); |
| | | //上传文件的需要formdata类型;所以要转 |
| | | let FormDatas = new FormData() |
| | | FormDatas.append('taskDescFile',item.file); |
| | | const res = await uploadFile(FormDatas) |
| | | if(res.data.code == '200'){ |
| | | loading.close(); |
| | | t.$message({ |
| | | type:'success', |
| | | message: '上传成功' |
| | | }) |
| | | t.fileList.push(item.file) |
| | | console.log(t.fileList,'fileList') |
| | | t.workForm.taskDescFileName = res.data.result |
| | | }else{ |
| | | loading.close(); |
| | | t.$message({ |
| | | type:'warning', |
| | | message:res.data.message |
| | | }) |
| | | } |
| | | // async uploadFile(item){ |
| | | // const t = this |
| | | // const loading = this.$loading({ |
| | | // lock: true, |
| | | // text: '正在上传文件...', |
| | | // spinner: 'el-icon-loading' |
| | | // }); |
| | | // //上传文件的需要formdata类型;所以要转 |
| | | // let FormDatas = new FormData() |
| | | // FormDatas.append('taskDescFile',item.file); |
| | | // const res = await uploadFile(FormDatas) |
| | | // if(res.data.code == '200'){ |
| | | // loading.close(); |
| | | // t.$message({ |
| | | // type:'success', |
| | | // message: '上传成功' |
| | | // }) |
| | | // t.fileList.push(item.file) |
| | | // console.log(t.fileList,'fileList') |
| | | // t.workForm.taskDescFileName = res.data.result |
| | | // }else{ |
| | | // loading.close(); |
| | | // t.$message({ |
| | | // type:'warning', |
| | | // message:res.data.message |
| | | // }) |
| | | // } |
| | | // axios({ |
| | | // method: 'post', |
| | | // url: 'http://192.168.0.29:8100/checkTask/upload/taskDescFile', |
| | |
| | | // //this.handleSuccess(); |
| | | // } |
| | | // }) |
| | | }, |
| | | // }, |
| | | //上传文件之前 |
| | | beforeUpload(file){ |
| | | // beforeUpload(file){ |
| | | // const t = this |
| | | // if (file.type != "" || file.type != null || file.type != undefined){ |
| | | // //截取文件的后缀,判断文件类型 |
| | |
| | | // return false; |
| | | // } |
| | | // } |
| | | }, |
| | | async handleRemove(file, fileList) { |
| | | const t = this |
| | | const res = await delateFile({taskDescFileName: t.workForm.taskDescFileName}) |
| | | if(res.data.code == '200'){ |
| | | t.$message({ |
| | | type:'success', |
| | | message: '删除成功' |
| | | }) |
| | | t.fileList = [] |
| | | }else{ |
| | | t.$message({ |
| | | type:'warning', |
| | | message:res.data.message |
| | | }) |
| | | } |
| | | }, |
| | | handlePreview(file) { |
| | | console.log(file); |
| | | }, |
| | | handleExceed(files, fileList) { |
| | | this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`); |
| | | }, |
| | | beforeRemove(file, fileList) { |
| | | return this.$confirm(`确定移除 ${ file.name }?`); |
| | | }, |
| | | // }, |
| | | // async handleRemove(file, fileList) { |
| | | // const t = this |
| | | // const res = await delateFile({taskDescFileName: t.workForm.taskDescFileName}) |
| | | // if(res.data.code == '200'){ |
| | | // t.$message({ |
| | | // type:'success', |
| | | // message: '删除成功' |
| | | // }) |
| | | // t.fileList = [] |
| | | // }else{ |
| | | // t.$message({ |
| | | // type:'warning', |
| | | // message:res.data.message |
| | | // }) |
| | | // } |
| | | // }, |
| | | // handlePreview(file) { |
| | | // console.log(file); |
| | | // }, |
| | | // handleExceed(files, fileList) { |
| | | // this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`); |
| | | // }, |
| | | // beforeRemove(file, fileList) { |
| | | // return this.$confirm(`确定移除 ${ file.name }?`); |
| | | // }, |
| | | confirmSend(formName){ |
| | | const t = this |
| | | t.$refs[formName].validate((valid) => { |
| | |
| | | message:res.data.message |
| | | }) |
| | | } |
| | | t.fileList = [] |
| | | // t.fileList = [] |
| | | t.dialogVisible = false |
| | | t.$parent.getSpecialCheckTask(); |
| | | }).catch(() => { |
| | |
| | | } |
| | | }); |
| | | }, |
| | | cancleSend(){ |
| | | this.resetForm('workForm') |
| | | this.dialogVisible = false |
| | | }, |
| | | // cancleSend(){ |
| | | // this.resetForm('workForm') |
| | | // this.dialogVisible = false |
| | | // }, |
| | | async resetForm(formName) { |
| | | const t = this |
| | | if(t.workForm.taskDescFileName !== null){ |
| | | const res = await delateFile({taskDescFileName: t.workForm.taskDescFileName}) |
| | | if(res.data.code == '200'){ |
| | | t.$message({ |
| | | type:'success', |
| | | message: '已取消下发' |
| | | }) |
| | | }else{ |
| | | t.$message({ |
| | | type:'warning', |
| | | message:res.data.message |
| | | }) |
| | | } |
| | | } |
| | | // if(t.workForm.taskDescFileName !== null){ |
| | | // const res = await delateFile({taskDescFileName: t.workForm.taskDescFileName}) |
| | | // if(res.data.code == '200'){ |
| | | // t.$message({ |
| | | // type:'success', |
| | | // message: '已取消下发' |
| | | // }) |
| | | // }else{ |
| | | // t.$message({ |
| | | // type:'warning', |
| | | // message:res.data.message |
| | | // }) |
| | | // } |
| | | // } |
| | | t.$refs[formName].resetFields() |
| | | t.fileList = [] |
| | | // t.fileList = [] |
| | | } |
| | | }, |
| | | } |
| | |
| | | .el-divider__text{ |
| | | background-color: #fafafa; |
| | | color: #034EA2; |
| | | } |
| | | .upload-demo{ |
| | | margin-bottom: 20px; |
| | | background: #fafafa; |
| | | padding: 20px 15px; |
| | | border-radius: 8px; |
| | | |
| | | .el-upload__tip{ |
| | | font-size: 14px; |
| | | color: #999; |
| | | } |
| | | |
| | | .el-upload-list{ |
| | | background-color: #ccc !important; |
| | | } |
| | | } |
| | | .form-part{ |
| | | background: #fafafa; |