123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- /*
- * @description: 创建报销单业务处理
- * @Author: CP
- * @Date: 2020-11-13 15:20:41
- * @FilePath: \cld\global\vue\fee\receipt_create_fn.js
- */
- // 验证费用表单
- function checkReceipt(event, obj) {
- let flag = false;
- //1.选择办事处费用
- if (obj.receiptTypeMenu[0].show) {
- if (obj.receiptTypeMenu[0].officeExplain[0].officeExplain == "") {
- obj.alertDia("请填写 办事处相关费用 报销说明");
- flag = true;
- }
- }
- //2.选择办事处费用
- if (obj.receiptTypeMenu[2].show) {
- if (obj.receiptTypeMenu[2].trainExplain[0].trainExplain == "") {
- obj.alertDia("请填写 内部培训费用 报销说明");
- flag = true;
- }
- }
- // 选择费用类型
- if (obj.receiptTypeMenu[0].show === false && obj.receiptTypeMenu[1].show === false && obj.receiptTypeMenu[2].show === false) {
- obj.alertDia("请选择 费用类型");
- flag = true;
- }
-
-
- // 设置参数
- // 1.办事处相关费用
- let officeData_input_dom = obj.$refs.officeData_input;
- officeData_input_dom.value="";
- if (obj.receiptTypeMenu[0].show) {
- officeData_input_dom.value=JSON.stringify(obj.receiptTypeMenu[0]);
- }
- // 2.差旅相关费用
- let traveData_input_dom = obj.$refs.traveData_input;
- traveData_input_dom.value="";
- if (obj.receiptTypeMenu[1].show) {
-
- traveData_input_dom.value=JSON.stringify(obj.receiptTypeMenu[1]);
- }
- // 3.差旅相关费用
- let trainData_input_dom = obj.$refs.trainData_input;
- trainData_input_dom.value="";
- if (obj.receiptTypeMenu[2].show) {
- trainData_input_dom.value=JSON.stringify(obj.receiptTypeMenu[2]);
- }
- // 4.附件内容相关
- let enclosurFiles_input_dom = obj.$refs.enclosurFiles_input;
- enclosurFiles_input_dom.value="";
- if(obj.enclosurFiles.length!=0){
- enclosurFiles_input_dom.value=JSON.stringify(obj.enclosurFiles);
- }
- // 校验设置后的参数
- if( obj.verifyId===""){
- obj.alertDia("请选择 审批组");
- flag = true;
- }
-
- if (flag) {
- event.preventDefault();
- }
-
- // // 1-2日常费用
- // let officeDailyData_input_dom = obj.$refs.officeDailyData_input;
- // // 1-2填写过金额
- // let daily = [];
- // obj.receiptTypeMenu[0].daily.forEach(element => {
- // if (element.price != 0) {
- // daily.push(element);
- // }
- // });
- // officeDailyData_input_dom.value = JSON.stringify(daily);
- // let officeOtherData_input_dom = obj.$refs.officeOtherData_input;
- // let other = [];
- // obj.receiptTypeMenu[0].other.forEach(element => {
- // if (element.price != 0) {
- // other.push(element);
- // }
- // });
- // officeOtherData_input_dom.value = JSON.stringify(other);
- // let officeExplain_input_dom = obj.$refs.officeExplain_input;
- // officeExplain_input_dom.value = obj.receiptTypeMenu[0].officeExplain[0].officeExplain;
-
- }
- // 办事处相关费用合计
- function officePrice(obj) {
- sum = 0;
- obj.daily.forEach(element => {
- sum += Number(element.price);
- });
- obj.other.forEach(element => {
- sum += Number(element.price);
- });
- return sum.toFixed(2);
- }
- // 差旅相关费用
- function travePrice(obj) {
- let sum = 0;
- obj.forEach(element => {
- element.tripList.forEach(elementlv2 => {
- elementlv2.tripItem.forEach(elementlv3 => {
- sum += Number(elementlv3.price);
- });
- });
- });
- return sum.toFixed(2);
- }
- // 内部培训费用
- function trainPrice(obj) {
- let sum = 0;
- obj.forEach(element => {
- sum += Number(element.price);
- });
- return sum.toFixed(2);
- }
- //
- function NewTraveItem() {
- let newTripItem = new Array();
- accountItem.trave.forEach(element => {
- newTripItem.push({
- "name": element.name,
- "price": 0.00,
- "remark": "",
- });
- });
- return newTripItem;
- }
- function toDecimal2(x) {
- var f = parseFloat(x);
- if (isNaN(f)) {
- return false;
- }
- var f = Math.round(x * 100) / 100;
- var s = f.toString();
- var rs = s.indexOf('.');
- if (rs < 0) {
- rs = s.length;
- s += '.';
- }
- while (s.length <= rs + 2) {
- s += '0';
- }
- return s;
- }
- function delEnclosurByKey(id){
-
- var url = "/ajaxRemEnclousur";
- $.ajax({
- url : url,
- type : "post",
- cache : false,
- dataType : "json",
- data : {
- key : id
- },
- global : true,
- success : function(data) {
-
- if (data.status == 1) {
- $('#'+id).remove();
- }
- },
- error : function(err) {
- }
- });
- }
|