|
|
@@ -1,123 +1,122 @@
|
|
|
<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
|
|
|
<div>
|
|
|
- <el-dialog
|
|
|
- :title="title"
|
|
|
- :close-on-click-modal="false"
|
|
|
- draggable
|
|
|
- width="1000px"
|
|
|
- height="500px"
|
|
|
- @close="close"
|
|
|
- append-to-body
|
|
|
- v-model="visible">
|
|
|
+ <el-dialog :title="title" :close-on-click-modal="false" draggable width="1000px" height="500px" @close="close"
|
|
|
+ append-to-body v-model="visible">
|
|
|
|
|
|
- <el-form :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''" :disabled="status === 'audit' || status === 'taskFormDetail'"
|
|
|
- label-width="135px" @submit.native.prevent>
|
|
|
- <el-row :gutter="0">
|
|
|
- </el-row>
|
|
|
- <el-row :gutter="0">
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="附件">
|
|
|
- <el-upload
|
|
|
- ref="upload"
|
|
|
- action=""
|
|
|
- :limit="1"
|
|
|
- :auto-upload="false"
|
|
|
- :on-change="beforeUploadDetail"
|
|
|
- :show-file-list="true">
|
|
|
+ <el-form :model="inputForm" ref="inputForm" v-loading="loading" :class="method === 'view' ? 'readonly' : ''"
|
|
|
+ :disabled="status === 'audit' || status === 'taskFormDetail'" label-width="135px"
|
|
|
+ @submit.native.prevent>
|
|
|
+ <el-row :gutter="0">
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="0">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="附件">
|
|
|
+ <el-upload ref="upload" action="" :limit="1" :auto-upload="false"
|
|
|
+ :on-change="beforeUploadDetail" :on-remove="onRemove" :show-file-list="true">
|
|
|
<el-button type="primary">导入全部</el-button>
|
|
|
</el-upload>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
|
|
|
- </el-form>
|
|
|
+ </el-form>
|
|
|
|
|
|
|
|
|
<template #footer>
|
|
|
- <span class="dialog-footer">
|
|
|
- <el-button type="warning" @click="downloadTpl()" plain>下载模板</el-button>
|
|
|
- <el-button @click="close()" icon="el-icon-circle-close">关闭</el-button>
|
|
|
- <el-button v-if="method !== 'view'" type="primary" icon="el-icon-circle-check" @click="doSubmit()">确定</el-button>
|
|
|
- </span>
|
|
|
- </template>
|
|
|
+ <span class="dialog-footer">
|
|
|
+ <el-button type="warning" @click="downloadTpl()" plain>下载模板</el-button>
|
|
|
+ <el-button @click="close()" icon="el-icon-circle-close">关闭</el-button>
|
|
|
+ <el-button v-if="method !== 'view'" type="primary" icon="el-icon-circle-check"
|
|
|
+ @click="doSubmit()">确定</el-button>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import financeInvoiceService from '@/api/cw/invoice/CwFinanceInvoiceService'
|
|
|
- export default {
|
|
|
- data(){
|
|
|
- return {
|
|
|
- visible: false,
|
|
|
- title: '',
|
|
|
- inputForm:{
|
|
|
- file:[]
|
|
|
- }
|
|
|
+import financeInvoiceService from '@/api/cw/invoice/CwFinanceInvoiceService'
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ visible: false,
|
|
|
+ title: '',
|
|
|
+ inputForm: {
|
|
|
+ file: []
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ init() {
|
|
|
+ this.visible = true
|
|
|
+ this.title = '发票导入'
|
|
|
+ this.inputForm = {
|
|
|
+ file: []
|
|
|
}
|
|
|
+ this.$forceUpdate()
|
|
|
},
|
|
|
- created () {
|
|
|
+
|
|
|
+ beforeUploadDetail(file) {
|
|
|
+ this.inputForm.file.push(file)
|
|
|
},
|
|
|
- components: {
|
|
|
+ onRemove(file, fileList) {
|
|
|
+ this.inputForm.file = fileList
|
|
|
},
|
|
|
- methods: {
|
|
|
- init(){
|
|
|
- this.visible = true
|
|
|
- this.title = '发票导入'
|
|
|
- this.inputForm={
|
|
|
- file:[]
|
|
|
+ // 下载模板
|
|
|
+ downloadTpl() {
|
|
|
+ this.loading = true
|
|
|
+ financeInvoiceService.exportFinanceTemplate().then((res) => {
|
|
|
+ // 将二进制流文件写入excel表,以下为重要步骤
|
|
|
+ this.$utils.downloadExcel(res, '发票导入模板' + ".xlsx")
|
|
|
+ this.loading = false
|
|
|
+ }).catch(function (err) {
|
|
|
+ this.loading = false
|
|
|
+ if (err.response) {
|
|
|
+ console.log(err.response)
|
|
|
}
|
|
|
- this.$forceUpdate()
|
|
|
- },
|
|
|
+ })
|
|
|
+ },
|
|
|
+ doSubmit() {
|
|
|
|
|
|
- beforeUploadDetail(file){
|
|
|
- this.inputForm.file.push(file)
|
|
|
- },
|
|
|
- // 下载模板
|
|
|
- downloadTpl () {
|
|
|
- this.loading = true
|
|
|
- financeInvoiceService.exportFinanceTemplate().then((res) => {
|
|
|
- // 将二进制流文件写入excel表,以下为重要步骤
|
|
|
- this.$utils.downloadExcel(res, '发票导入模板' + ".xlsx")
|
|
|
- this.loading = false
|
|
|
- }).catch(function (err) {
|
|
|
+ this.loading = true
|
|
|
+ const formBody = new FormData()
|
|
|
+ formBody.append('file', this.inputForm.file[0].raw)
|
|
|
+ financeInvoiceService.importFinance(formBody).then((data) => {
|
|
|
+ if (data) {
|
|
|
this.loading = false
|
|
|
- if (err.response) {
|
|
|
- console.log(err.response)
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- doSubmit(){
|
|
|
-
|
|
|
- const formBody = new FormData()
|
|
|
- formBody.append('file', this.inputForm.file[0].raw)
|
|
|
- financeInvoiceService.importFinance(formBody).then((data) =>{
|
|
|
- if (data){
|
|
|
- this.$message.success('导入成功')
|
|
|
- this.close()
|
|
|
- this.$emit("refreshDataList");
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- close(){
|
|
|
- this.visible = false
|
|
|
- this.$refs.inputForm.resetFields()
|
|
|
- this.$refs.upload.clearFiles();
|
|
|
- this.inputForm = {
|
|
|
- file:[]
|
|
|
+ this.$message.success('导入成功')
|
|
|
+ this.close()
|
|
|
+ this.$emit("refreshDataList");
|
|
|
}
|
|
|
+ }).catch((err) => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ close() {
|
|
|
+ this.visible = false
|
|
|
+ this.$refs.inputForm.resetFields()
|
|
|
+ this.$refs.upload.clearFiles();
|
|
|
+ this.inputForm = {
|
|
|
+ file: []
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
- /deep/ .el-input-number .el-input__inner {
|
|
|
- text-align: left;
|
|
|
- }
|
|
|
- .el-row {
|
|
|
- display: flex;
|
|
|
- align-items: center; /* 垂直居中 */
|
|
|
- }
|
|
|
+/deep/ .el-input-number .el-input__inner {
|
|
|
+ text-align: left;
|
|
|
+}
|
|
|
+
|
|
|
+.el-row {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ /* 垂直居中 */
|
|
|
+}
|
|
|
</style>
|