From 29cfba4aa2e41fb15cacb500c3e2d9ae7c652d08 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期二, 21 十一月 2023 08:57:20 +0800
Subject: [PATCH] #
---
src/main/webapp/static/js/businessTrip/businessTripOther.js | 273 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 269 insertions(+), 4 deletions(-)
diff --git a/src/main/webapp/static/js/businessTrip/businessTripOther.js b/src/main/webapp/static/js/businessTrip/businessTripOther.js
index 76607ee..ae22229 100644
--- a/src/main/webapp/static/js/businessTrip/businessTripOther.js
+++ b/src/main/webapp/static/js/businessTrip/businessTripOther.js
@@ -3,7 +3,7 @@
base: baseUrl + "/static/layui/lay/modules/"
}).extend({
cascader: 'cascader/cascader',
-}).use(['table','laydate', 'form', 'admin', 'cascader', 'tree', 'dropdown'], function(){
+}).use(['table','laydate', 'form', 'admin', 'xmSelect', 'cascader', 'tree', 'dropdown'], function(){
var table = layui.table;
var $ = layui.jquery;
var layer = layui.layer;
@@ -89,16 +89,17 @@
,{field: 'userId$', align: 'center',title: '鐢宠浜�',hide: false}
,{field: 'deptId$', align: 'center',title: '鎵�灞為儴闂�',hide: true}
,{field: 'hostId', align: 'center',title: 'hostId',hide: true}
- ,{field: 'orderId', align: 'center',title: '璺熻釜椤圭洰',hide: false}
+ ,{field: 'orderId$', align: 'center',title: '璺熻釜椤圭洰',hide: false}
+ ,{field: 'orderId', align: 'center',title: '璺熻釜椤圭洰',hide: true}
,{field: 'settle$', align: 'center',title: '杩涘害', style: 'color: #1890ff;cursor:pointer', event: 'more',hide: false}
,{field: 'status$', align: 'center',title: '鐘舵��',hide: false}
,{field: 'businessTripType', align: 'center',title: '绫诲瀷',hide: true}
,{field: 'businessNotes', align: 'center',title: '鍑哄樊澶囨敞',hide: false}
- ,{field: 'createTime$', align: 'center',title: '鍒涘缓鏃堕棿',hide: false,width: 125}
+ ,{field: 'createTime$', align: 'center',title: '鍒涘缓鏃堕棿',hide: true,width: 125}
,{field: 'updateTime$', align: 'center',title: '鏇存柊鏃堕棿',hide: false,width: 125}
,{field: 'updateId$', align: 'center',title: '鏇存柊浜哄憳',hide: false}
- ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:180}
+ ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:280}
]],
request: {
pageName: 'curr',
@@ -199,6 +200,9 @@
table.on('tool(businessTripOther)', function(obj){
var data = obj.data;
switch (obj.event) {
+ case 'addBlank':
+ showEditModelBlank(data.id);
+ break;
case 'approval':
layer.confirm('瀹℃壒閫氳繃锛�', {
skin: 'layui-layer-admin',
@@ -372,6 +376,267 @@
});
}
+ // 鏄剧ず琛ㄥ崟寮圭獥
+ function showEditModelBlank(businessOtherId) {
+ admin.open({
+ type: 1,
+ title: '娣诲姞鎶ラ攢瀹℃壒',
+ content: $('#editDialog2').html(),
+ area: '2200px',
+ success: function (layero, dIndex) {
+ $(layero).children('.layui-layer-content').css('overflow', 'visible');
+ var isExpAdd = true;
+ // 鍥炴樉鏁版嵁
+ form.val('editForm', false);
+ // console.log(expTpe)
+ // if (expTpe) {
+ // // $('#orderNo').attr("disabled", "disabled");
+ // }
+ // 琛ㄥ崟鎻愪氦浜嬩欢
+ form.on('submit(orderEditSubmit)', function (data) {
+ // 缁勮鏁版嵁
+ if (xxDataList.length <= 0) {
+ layer.tips('璇锋坊鍔犳姤閿�鏄庣粏', '#matAddBtnComment', {tips: [1, '#ff4c4c']});
+ return false;
+ }
+ let nList = admin.util.deepClone(xxDataList);
+ for (let xi = 0; xi < nList.length; xi++) {
+ // if (nList[xi].anfme <= 0){
+ // layer.msg('鏄庣粏淇敼鏁伴噺涓嶅悎娉�', {icon: 2});
+ // return false;
+ // }
+ }
+ layer.load(2);
+ $.ajax({
+ url: baseUrl+"/reimburseOnline/from/" + (isExpAdd?"add":"modify") + "/auth",
+ headers: {'token': localStorage.getItem('token')},
+ data: JSON.stringify({
+ reimburseId: Number(data.field.id),
+ docType: Number(data.field.docType),
+ businessOtherId: businessOtherId,
+ templateName: data.field.templateName,
+ checkData: data.field.checkData,
+ reimburseOnlineDetls: nList
+ }),
+ contentType:'application/json;charset=UTF-8',
+ method: 'POST',
+ success: function (res) {
+ console.log(data)
+ layer.closeAll('loading');
+ if (res.code === 200){
+ layer.close(dIndex);
+ $(".layui-laypage-btn")[0].click();
+ layer.msg(res.msg, {icon: 1});
+ } else if (res.code === 403){
+ top.location.href = baseUrl+"/";
+ }else {
+ layer.msg(res.msg, {icon: 2});
+ }
+ }
+ })
+ return false;
+ });
+ // 鏄庣粏琛ㄦ牸
+ var xxDataList = [];
+ var tbOptions = {
+ elem: '#formSSXMTable',
+ headers: {token: localStorage.getItem('token')},
+ data: xxDataList,
+ page: true,
+ height: '350px;',
+ cellMinWidth: 100,
+ cols: [[
+ {type: 'numbers', title: '#'},
+ {field: 'occupation', title: '浜嬬敱', width: 100, style: 'color: blue;font-weight: bold', edit:true},
+ // {field: 'expenseType', title: '璐圭敤绫诲瀷', width: 100},
+ {field: 'expenseType$', title: '璐圭敤绫诲瀷', width: 100},
+ {field: 'taxRate', title: '绋庣巼', width: 60, edit: true},
+ {field: 'untaxedAmountInLocalCurrency', title: '鏈◣鏈竵閲戦', width: 120, edit: true},
+ {field: 'untaxedAmount', title: '鏈◣閲戦', width: 100, edit: true},
+ {field: 'taxAmount', title: '绋庨', width: 60, edit: true},
+ {field: 'invoiceValue', title: '鍙戠エ閲戦', width: 100, edit: true},
+ {field: 'invoiceAmountInLocalCurrency', title: '鍙戠エ鏈竵閲戦', width: 120, edit: true},
+ {field: 'reimbursementRatio', title: '鎶ラ攢姣斾緥', width: 100, edit: true},
+ {field: 'reimbursementAmount', title: '鎶ラ攢閲戦', width: 100, edit: true},
+ {field: 'reimbursementAmountInLocalCurrency', title: '鎶ラ攢鏈竵閲戦', width: 120, edit: true},
+ {field: 'cashierConfirmationAmount', title: '鍑虹撼纭閲戦', width: 120, edit: true},
+ {field: 'cashierCurrency', title: '鍑虹撼甯佺', width: 100, edit: true},
+ {field: 'departureTime', title: '鍑哄彂鏃ユ湡', width: 100},
+ {field: 'cashierConfirmationAmount', title: '鍑虹撼纭閲戦', width: 120, edit: true},
+ {field: 'userId', title: '鍒楁敮浜哄憳', width: 120},
+ {field: 'deptId', title: '鍒楁敮閮ㄩ棬', width: 120},
+ {field: 'updateTime', title: '鏇存柊鏃ユ湡', width: 100},
+ // {field: 'updateUserId', title: '鏇存柊浜哄憳ID', width: 160},
+ {field: 'updateUserName', title: '鏇存柊浜哄憳鍚嶅瓧'},
+ // {field: 'creationTime', title: '鍒涘缓鏃ユ湡', width: 160}
+ {align: 'center', title: '鎿嶄綔', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right'}
+ ]],
+ done: function (res, curr, count) {
+ $(layero).find('.layui-table-view').css('margin', '0');
+ var options = this;
+
+ // 鑾峰彇褰撳墠琛屾暟鎹�
+ table.getRowData = function(elem){
+ var index = $(elem).closest('tr').data('index');
+ return table.cache[options.id][index] || {};
+ };
+
+ $('.input-occupation').on('text', function(){
+ var value = this.value; // 鑾峰彇閫変腑椤� value
+ var data = table.getRowData(this);
+ console.log(value);
+ console.log("value------===");
+ xxDataList.forEach(res => {
+ if (data.id === res.id){
+ console.log(res)
+ res.occupation = value;
+ }
+ })
+
+ });
+ },
+ size: ''
+ };
+ var insTbSSXM = table.render(tbOptions);
+ // 宸ュ叿鏉$偣鍑讳簨浠�
+ table.on('tool(formSSXMTable)', function (obj) {
+ var data = obj.data;
+ var layEvent = obj.event;
+ if (layEvent === 'edit') {
+ showEditModel2(data);
+ } else if (layEvent === 'del') {
+ layer.confirm('纭畾瑕佸垹闄ゅ悧锛�', {
+ shade: .1,
+ skin: 'layui-layer-admin'
+ }, function (i) {
+ layer.close(i);
+ for (var j = 0; j < xxDataList.length; j++) {
+ if (xxDataList[j].matnr === data.matnr && xxDataList[j].batch === data.batch) {
+ xxDataList.splice(j, 1);
+ break;
+ }
+ }
+ insTbSSXM.reload({data: xxDataList, page: {curr: 1}});
+ });
+ }
+ });
+ // 鏄庣粏鏁版嵁淇敼
+ table.on('edit(formSSXMTable)', function (obj) {
+ let index = obj.tr.attr("data-index");
+ let data = xxDataList[index];
+ if (obj.field === 'anfme'){
+ let vle = Number(obj.value);
+ if (isNaN(vle)) {
+ layer.msg("璇疯緭鍏ユ暟瀛�", {icon: 2});
+ return false;
+ } else {
+ if (vle <= 0) {
+ layer.msg("鏁伴噺蹇呴』澶т簬闆�", {icon: 2});
+ return false;
+ }
+ }
+ }
+ data[obj.field] = obj.value;
+ insTbSSXM.reload({data: xxDataList});
+ });
+
+ $('#matAddBtnComment').click(function () {
+ showEditModel2();
+ });
+
+ // 鏄剧ず娣诲姞鏄庣粏琛ㄥ崟寮圭獥
+ function showEditModel2(exp) {
+ admin.open({
+ type: 1,
+ offset: '150px',
+ area: '680px',
+ title: (exp ? '淇敼' : '娣诲姞') + '鏄庣粏',
+ content: $('#matEditDialog').html(),
+ success: function (layero, dIndex) {
+ console.log("exp")
+ console.log(exp)
+ // 鍥炴樉鏁版嵁
+ form.val('matEditForm', exp);
+ // 琛ㄥ崟鎻愪氦浜嬩欢
+ form.on('submit(matEditSubmit)', function (data) {
+ let selectList = matXmSelect.getValue();
+ console.log("selectList")
+ console.log(selectList)
+ console.log(selectList)
+ for (let i = 0; i<selectList.length; i++) {
+ let item = selectList[i];
+ // 鏌ヨ鐗╂枡璇︽儏
+ $.ajax({
+ url: baseUrl+"/reimburseCostTypes/covert/"+item.value+"/auth",
+ headers: {'token': localStorage.getItem('token')},
+ method: 'GET',
+ async: false,
+ success: function (res) {
+ if (res.code === 200){
+ var bige=true;
+ // console.log("-------2.1-------")
+ // for (var j = 0; j < xxDataList.length; j++) {
+ // if (xxDataList[j].expenseType === res.data.expenseType && xxDataList[j].batch === res.data.batch) {
+ // bige=false;
+ // console.log("-------2.2-------")
+ // break;
+ // }
+ // }
+ if (bige){
+ // console.log("-------2.3-------")
+ xxDataList.push(res.data);
+ insTbSSXM.reload({data: xxDataList, page: {curr: 1}});
+ }
+ } else if (res.code === 403){
+ top.location.href = baseUrl+"/";
+ }else {
+ layer.msg(res.msg, {icon: 2})
+ }
+ }
+ })
+ }
+ layer.close(dIndex);
+ return false;
+ });
+ // 娓叉煋鐗╂枡閫夋嫨
+ var matXmSelect = xmSelect.render({
+ el: '#reimburseCostTypes',
+ style: {
+ width: '340px',
+ },
+ autoRow: true,
+ toolbar: { show: true },
+ filterable: true,
+ remoteSearch: true,
+ remoteMethod: function(val, cb, show){
+ $.ajax({
+ url: baseUrl+"/reimburseCostTypes/all/get/kv",
+ headers: {'token': localStorage.getItem('token')},
+ data: {
+ condition: val
+ },
+ method: 'POST',
+ success: function (res) {
+ if (res.code === 200){
+ cb(res.data)
+ } else {
+ cb([]);
+ layer.msg(res.msg, {icon: 2});
+ }
+ }
+ });
+ }
+ })
+ // 寮圭獥涓嶅嚭鐜版粴鍔ㄦ潯
+ $(layero).children('.layui-layer-content').css('overflow', 'visible');
+ layui.form.render('select');
+ }
+ });
+ }
+ }
+ });
+ }
+
function approval(planId, plannerId, dIdx) {
let loadIndex = layer.load(2);
$.ajax({
--
Gitblit v1.9.1