|
@@ -50,6 +50,7 @@
|
|
|
<div v-if="!displayTable" class="headine" ref="headine">
|
|
|
<h3 ref="headHe" style="padding-left: 220px">{{shuz[ins]}}</h3>
|
|
|
<p style="float: right;margin-right: 25px;"><el-button type="primary" @click="submits" size="mini">提交</el-button></p>
|
|
|
+ <p style="float: right;margin-right: 25px;"><el-button type="primary" @click="submitUpload" size="mini">批量上传</el-button></p>
|
|
|
</div>
|
|
|
<!-- 上面部分 -->
|
|
|
<div ref="staff" style="margin: 20px 20px 0 220px; width: 81.5%" >
|
|
@@ -442,6 +443,23 @@
|
|
|
<el-button v-else type="primary" @click="dialog = false">确 定</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <!-- 批量上传 -->
|
|
|
+ <el-dialog title="批量上传" v-if="importDialog" :visible.sync="importDialog" customClass="customWidth" width="500px">
|
|
|
+ <p>1. 下载
|
|
|
+ <el-link type="primary" style="margin-left:5px;" :underline="false" href="./upload/费用报销导入模板.xlsx" download="费用报销导入模板.xlsx">费用报销导入模板.xlsx</el-link>
|
|
|
+ </p>
|
|
|
+ <p>2. 填写excel模板,并上传。</p>
|
|
|
+ <div style="padding-bottom:1em;">
|
|
|
+ <div style="width:300px;margin:0 auto">
|
|
|
+ <el-upload ref="upload" action="#" :auto-upload="false" multiple :on-change="fileListAdd" :on-remove="fileListDel">
|
|
|
+ <el-button slot="trigger" size="small" type="primary" style="">选取文件</el-button>
|
|
|
+ <el-button type="primary" size="small" style="margin-left:30px" :underline="false" :loading="importingData" @click="submitUploadSure" :disabled="fileList.length == 0">开始上传</el-button>
|
|
|
+ <el-button size="small" style="margin-left:30px" @click="fileListClear">清空</el-button>
|
|
|
+ </el-upload>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
</section>
|
|
|
</template>
|
|
|
|
|
@@ -452,6 +470,7 @@ export default {
|
|
|
props: {},
|
|
|
data() {
|
|
|
return {
|
|
|
+ fileList: [],
|
|
|
muHeight: document.documentElement.clientHeight || document.body.clientHeight,
|
|
|
imgs: [],
|
|
|
addFormRules: {ownerId: [{ required: true, message: "请选择报销人", trigger: "blur" }]},
|
|
@@ -497,7 +516,9 @@ export default {
|
|
|
shuz: ['一般费用填报', '差旅费用填报', '外包费用填报'],
|
|
|
ins: 0,
|
|
|
apl: '',
|
|
|
- diz: 'http://worktime.ttkuaiban.com'
|
|
|
+ diz: 'http://worktime.ttkuaiban.com',
|
|
|
+ importDialog: false,
|
|
|
+ importingData: false
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -545,6 +566,75 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ submitUpload(){
|
|
|
+ this.importDialog = true
|
|
|
+ },
|
|
|
+ fileListAdd(file,fileList){
|
|
|
+ let str = file.name.split(".");
|
|
|
+ let format = str[str.length - 1];
|
|
|
+ if (format != "xls" && format != "xlsx") {
|
|
|
+ this.$message({
|
|
|
+ message: "请选择.xls或.xlsx文件",
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ fileList.splice(fileList.length-1)
|
|
|
+ }
|
|
|
+ this.fileList = fileList
|
|
|
+ },
|
|
|
+ fileListDel(file,fileList){
|
|
|
+ this.fileList = fileList
|
|
|
+ },
|
|
|
+ fileListClear(){
|
|
|
+ this.$refs.upload.clearFiles();
|
|
|
+ this.fileList = []
|
|
|
+ },
|
|
|
+ submitUploadSure(){
|
|
|
+ this.$confirm('确认上传?','提示',{
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'success'
|
|
|
+ }).then(()=>{
|
|
|
+ let formData = new FormData();
|
|
|
+ for(let i in this.fileList){
|
|
|
+ formData.append("files", this.fileList[i].raw);
|
|
|
+ }
|
|
|
+
|
|
|
+ // let fileaaa = []
|
|
|
+ // for(let i in this.fileList){
|
|
|
+ // fileaaa[i] = this.fileList[i].raw
|
|
|
+ // }
|
|
|
+ // formData.append("files", fileaaa);
|
|
|
+ this.importingData = true
|
|
|
+ console.log(formData,this.fileList);
|
|
|
+ // return
|
|
|
+ this.http.uploadFile( '/expense-sheet/importData', formData,
|
|
|
+ res => {
|
|
|
+ if (res.code == "ok") {
|
|
|
+ this.importingData = false
|
|
|
+ this.$refs.upload.clearFiles();
|
|
|
+ this.fileList = []
|
|
|
+ this.$message({
|
|
|
+ message: "上传成功",
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.importingData = false
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },error => {
|
|
|
+ this.importingData = false
|
|
|
+ this.$message({
|
|
|
+ message: error,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }).catch(()=>{})
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
restrictNumber(targetId) {
|
|
|
let inpu = document.getElementById(targetId);
|
|
|
inpu.value = inpu.value.replace(/[^\d.]/g, ""); //仅保留数字和"."
|
|
@@ -770,7 +860,7 @@ export default {
|
|
|
},
|
|
|
//获取单据列表
|
|
|
getList() {
|
|
|
- console.log(this.date)
|
|
|
+ // console.log(this.date)
|
|
|
var stat = ''
|
|
|
var end = ''
|
|
|
if(this.date) {
|
|
@@ -1016,20 +1106,20 @@ export default {
|
|
|
}, 0)
|
|
|
},
|
|
|
zhi(e) {
|
|
|
- console.log('看看值', e)
|
|
|
+ // console.log('看看值', e)
|
|
|
var i = e
|
|
|
if(this.invoiceList[i].amount == null || this.invoiceList[i].amount == 'null' || this.invoiceList[i].taxPercent == null || this.invoiceList[i].taxPercent == 'null') {
|
|
|
return
|
|
|
}
|
|
|
this.invoiceList[i].taxValue = this.invoiceList[i].amount * this.invoiceList[i].taxPercent / 100
|
|
|
- console.log(this.invoiceList[i].amount, this.invoiceList[i].taxPercent)
|
|
|
+ // console.log(this.invoiceList[i].amount, this.invoiceList[i].taxPercent)
|
|
|
var shui = this.invoiceList[i].taxPercent / 100 // 税率
|
|
|
var zhi = this.invoiceList[i].amount / (1 + shui) * shui
|
|
|
this.invoiceList[i].taxValue = zhi.toFixed(2)
|
|
|
},
|
|
|
zhiNum(i, val) {
|
|
|
- console.log('看看值', i, val)
|
|
|
- console.log(this.ParticularsList.invoiceList)
|
|
|
+ // console.log('看看值', i, val)
|
|
|
+ // console.log(this.ParticularsList.invoiceList)
|
|
|
if(this.ParticularsList.invoiceList[i].amount == null || this.ParticularsList.invoiceList[i].amount == 'null' || this.ParticularsList.invoiceList[i].taxPercent == null || this.ParticularsList.invoiceList[i].taxPercent == 'null') {
|
|
|
return
|
|
|
}
|
|
@@ -1183,7 +1273,7 @@ export default {
|
|
|
|
|
|
});
|
|
|
|
|
|
- console.log(sums, 123)
|
|
|
+ // console.log(sums, 123)
|
|
|
this.$nextTick(()=>{ this.$refs.tab.doLayout()})
|
|
|
return sums;
|
|
|
}
|