/* * @description: 创建报销单 * @Author: CP * @Date: 2020-11-13 12:03:08 * @FilePath: \cld\global\vue\fee\receipt_create.js */ new Vue({ el: '#receipt_create', data: data, // mounted: function () { // SetReceiptData(this); // }, methods: { // 报销单选择菜单栏 selectReceipt: function (event, menu) { // 是否选中 selected = event.target.classList.toggle("active"); menu.show = !menu.show }, // 报销单导航栏 navigation: function (receiptTypeMenu, menu) { receiptTypeMenu.forEach(element => { element.active = false; }); menu.active = !menu.active; }, // 验证费用表单 checkReceipt: function (event) { checkReceipt(event, this); // dev 不提交 // event.preventDefault(); }, // 附件上传 enclosurFile: function (event) { let form_data = new FormData(); let file_data = event.target.files[0]; form_data.append("Filename", file_data.name); form_data.append("Filedata", file_data); // let index = this.enclosurFiles.length; let objData = this.enclosurFiles; $.ajax({ type: "POST", url: "/swfupload", dataType: "json", processData: false, contentType: false, data: form_data }).success(function (msg) { let file = { name: file_data.name, size: toDecimal2(file_data.size / 1024) + 'kb', path: msg.filename } objData.push(file); }).fail(function (msg) { this.alertDia("附件上传失败"); }); }, enclosurFileDel(index) { this.enclosurFiles.splice(index, 1) }, alertDia(msg) { this.displayStsates = 'block' this.aletMsg = msg // 延迟2秒后消失 自己可以更改时间 window.setTimeout(() => { this.displayStsates = 'none' }, 3500) }, }, computed: { receiptPrice: function () { let num = 0.00; if (this.receiptTypeMenu[0].show) { num += Number(officePrice(this.receiptTypeMenu[0])); } if (this.receiptTypeMenu[1].show) { num += Number(travePrice(this.receiptTypeMenu[1].traveList)); } if (this.receiptTypeMenu[2].show) { num += Number(trainPrice(this.receiptTypeMenu[2].train)); } return num.toFixed(2); } }, })