|
|
@@ -73,21 +73,21 @@ const quota_modal_template = `
|
|
|
</div>
|
|
|
<div class="modal-footer">
|
|
|
<button type="button" class="btn btn-light" data-bs-dismiss="modal">取消</button>
|
|
|
- <button type="button" class="btn btn-primary" onclick="SaveQuota(true)">提交</button>
|
|
|
+ <button type="button" class="btn btn-light-success" onclick="SaveQuota(true)">提交</button>
|
|
|
<button type="button" class="btn btn-primary" onclick="SaveQuota()">保存草稿</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>`
|
|
|
$('.app-main .app-container').append(quota_modal_template)
|
|
|
-const nav_template = `<ul id="nav_tab" class="nav nav-tabs nav-line-tabs nav-line-tabs-2x fs-6"></ul><div class="tab-content" id="tab_content" style="height: calc(100% - 80px);"></div>`,
|
|
|
- nav_tab_template = `
|
|
|
+const nav_template = `<ul id="nav_tab" class="nav nav-tabs nav-line-tabs nav-line-tabs-2x fs-6"></ul><div class="tab-content" id="tab_content" style="height: calc(100% - 80px);"></div>`,
|
|
|
+ nav_tab_template = `
|
|
|
<li class="nav-item" data-id="{0}">
|
|
|
<button type="button" class="nav-link {2} btn-light-primary btn-active-color-primary" data-id="{0}" data-bs-toggle="tab" data-bs-target="#iwb_tab_{0}">{1}</button>
|
|
|
</li>`,
|
|
|
- tab_content_template = `<div class="tab-pane h-100" id="iwb_tab_{0}" role="tabpanel">{1}</div>`,
|
|
|
- table_add_quota_btn_template = `<button type="button" class="quota_add_btn btn btn-primary btn-sm" onclick="Send_Quota_Batch('{0}')">批量推送</button>` //`<button type="button" class="quota_add_btn btn btn-primary btn-sm" onclick="Add_Quota('{0}')">添加定额</button>`,
|
|
|
- table_run_select_template = `<select class="form-select form-select-sm me-5" name="process_status">
|
|
|
+ tab_content_template = `<div class="tab-pane h-100" id="iwb_tab_{0}" role="tabpanel">{1}</div>`,
|
|
|
+ table_add_quota_btn_template = `<button type="button" class="quota_add_btn btn btn-primary btn-sm" onclick="Send_Quota_Batch('{0}')">批量推送</button>` //`<button type="button" class="quota_add_btn btn btn-primary btn-sm" onclick="Add_Quota('{0}')">添加定额</button>`,
|
|
|
+table_run_select_template = `<select class="form-select form-select-sm me-5" name="process_status">
|
|
|
<option value="">全部运行状态</option>
|
|
|
<option value="0">草稿</option>
|
|
|
<option value="1">等待运行</option>
|
|
|
@@ -97,7 +97,7 @@ const nav_template = `<ul id="nav_tab" class="nav nav-tabs nav-line-tabs nav-lin
|
|
|
<option value="5">运行失败</option>
|
|
|
<!--<option value="4">已修改</option>-->
|
|
|
</select>`,
|
|
|
- table_send_select_template = `<select class="form-select form-select-sm me-5" name="send_status">
|
|
|
+ table_send_select_template = `<select class="form-select form-select-sm me-5" name="send_status">
|
|
|
<option value="">全部推送状态</option>
|
|
|
<option value="0">未推送</option>
|
|
|
<option value="1">推送中</option>
|
|
|
@@ -105,7 +105,7 @@ const nav_template = `<ul id="nav_tab" class="nav nav-tabs nav-line-tabs nav-lin
|
|
|
<option value="2">推送失败</option>
|
|
|
<option value="3">数据变更</option>
|
|
|
</select>`,
|
|
|
- table_template = `<div class="table-box table-responsive" data-id="{0}" id="table_box_{0}">
|
|
|
+ table_template = `<div class="table-box table-responsive" data-id="{0}" id="table_box_{0}">
|
|
|
<div class="d-flex justify-content-between my-5">
|
|
|
<div class="">{1}</div>
|
|
|
<form class="search-box d-flex">
|
|
|
@@ -125,17 +125,17 @@ const nav_template = `<ul id="nav_tab" class="nav nav-tabs nav-line-tabs nav-lin
|
|
|
</div>`
|
|
|
|
|
|
const $modalQuota = $('#modal_quota')
|
|
|
-let $rightBox, $rightBoxHeader , $rightBoxBody, $taskBox, $quotaBox, budget_id, item_code
|
|
|
+let $rightBox, $rightBoxHeader, $rightBoxBody, $taskBox, $quotaBox, budget_id, item_code
|
|
|
|
|
|
console.log(`加载项目:${project_id}`)
|
|
|
InitBody()
|
|
|
$(function () {
|
|
|
- BuildChapterInfo()
|
|
|
- $(window).on('resize', AdjustBoxHeight)
|
|
|
+ BuildChapterInfo()
|
|
|
+ $(window).on('resize', AdjustBoxHeight)
|
|
|
})
|
|
|
|
|
|
-function InitBody(){
|
|
|
- $('#body_box').html(`<div class="d-flex flex-row project-box w-100">
|
|
|
+function InitBody() {
|
|
|
+ $('#body_box').html(`<div class="d-flex flex-row project-box w-100">
|
|
|
<div class="flex-row-auto h-100 left-box">
|
|
|
<div class="tree-dom w-300px h-100 overflow-auto" id="js-tree"></div>
|
|
|
</div>
|
|
|
@@ -148,7 +148,7 @@ function InitBody(){
|
|
|
<input type="hidden" name="item_code" value="">
|
|
|
</section>
|
|
|
<span class="fw-bolder me-5 title fs-2"></span>
|
|
|
- <span class="badge d-none badge-primary fs-5 me-5"></span>
|
|
|
+ <span class="badge badge-primary fs-6 me-5"></span>
|
|
|
<div class="d-flex table_radio_box" >
|
|
|
<div class="form-check form-check-custom form-check-primary form-check-solid">
|
|
|
<input class="form-check-input" name="table_radio" type="radio" value="task" id="task_radio"/>
|
|
|
@@ -170,322 +170,334 @@ function InitBody(){
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>`)
|
|
|
- AdjustBoxHeight()
|
|
|
- $rightBox= $('#body_box .right-box'),
|
|
|
- $rightBoxHeader = $('#body_box .right-box .box-header'),
|
|
|
- $rightBoxBody = $('#body_box .right-box .box-body'),
|
|
|
- $taskBox = $rightBoxBody.find('.task'),
|
|
|
- $quotaBox = $rightBoxBody.find('.quota')
|
|
|
+ AdjustBoxHeight()
|
|
|
+ $rightBox = $('#body_box .right-box'),
|
|
|
+ $rightBoxHeader = $('#body_box .right-box .box-header'),
|
|
|
+ $rightBoxBody = $('#body_box .right-box .box-body'),
|
|
|
+ $taskBox = $rightBoxBody.find('.task'),
|
|
|
+ $quotaBox = $rightBoxBody.find('.quota')
|
|
|
}
|
|
|
-function AdjustBoxHeight(){
|
|
|
- const h= $('.app-wrapper').height() - $('.app-body-header').height() - $('.app-footer').height() -5
|
|
|
- $('#body_box .project-box').height(h)
|
|
|
+
|
|
|
+function AdjustBoxHeight() {
|
|
|
+ const h = $('.app-wrapper').height() - $('.app-body-header').height() - $('.app-footer').height() - 5
|
|
|
+ $('#body_box .project-box').height(h)
|
|
|
}
|
|
|
-function BuildChapterInfo(){
|
|
|
- const $tree = $(`#js-tree`)
|
|
|
- const opt = {
|
|
|
- core: {
|
|
|
- themes: {
|
|
|
- responsive: false,
|
|
|
- },
|
|
|
- strings:{
|
|
|
- 'Loading ...': '加载中...',
|
|
|
- },
|
|
|
- check_callback: true,
|
|
|
- data: function (node, callback) {
|
|
|
- // console.log('TREE_NODE', node)
|
|
|
- IwbAjax_1({
|
|
|
- url: `/api/project/chapter/${project_id}?c=${node?.data?.item_code || ''}`,
|
|
|
- success: res => {
|
|
|
- if (res.success) {
|
|
|
- console.log('TREE', res.data)
|
|
|
- callback(res.data)
|
|
|
- } else {
|
|
|
- console.error(res.message)
|
|
|
- }
|
|
|
- },
|
|
|
- })
|
|
|
- },
|
|
|
- },
|
|
|
- types: {
|
|
|
- default: {
|
|
|
- icon: 'ki-outline ki-folder text-primary',
|
|
|
- },
|
|
|
- file: {
|
|
|
- icon: 'ki-outline ki-file text-primary',
|
|
|
- },
|
|
|
- },
|
|
|
- plugins: ['dnd', 'types'],
|
|
|
- }
|
|
|
- // $tree.jstree('destroy')
|
|
|
- $tree.on('loaded.jstree', function(e, data){
|
|
|
- // console.log('TREE_LOADED', e, data)
|
|
|
- const inst = data.instance;
|
|
|
- const obj = inst.get_node(e.target.firstChild.firstChild.firstChild);
|
|
|
- inst.select_node(obj);
|
|
|
- })
|
|
|
- $tree.on('select_node.jstree', function (e, data) {
|
|
|
- console.log('TREE_SELECTED', e, data)
|
|
|
- RenderRightBox(data.node?.data)
|
|
|
- })
|
|
|
- $tree.jstree(opt)
|
|
|
+
|
|
|
+function BuildChapterInfo() {
|
|
|
+ const $tree = $(`#js-tree`)
|
|
|
+ const opt = {
|
|
|
+ core: {
|
|
|
+ themes: {
|
|
|
+ responsive: false,
|
|
|
+ },
|
|
|
+ strings: {
|
|
|
+ 'Loading ...': '加载中...',
|
|
|
+ },
|
|
|
+ check_callback: true,
|
|
|
+ data: function (node, callback) {
|
|
|
+ // console.log('TREE_NODE', node)
|
|
|
+ IwbAjax_1({
|
|
|
+ url: `/api/project/chapter/${project_id}?c=${node?.data?.item_code || ''}`,
|
|
|
+ success: res => {
|
|
|
+ if (res.success) {
|
|
|
+ console.log('TREE', res.data)
|
|
|
+ callback(res.data)
|
|
|
+ } else {
|
|
|
+ console.error(res.message)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
+ },
|
|
|
+ types: {
|
|
|
+ default: {
|
|
|
+ icon: 'ki-outline ki-folder text-primary',
|
|
|
+ },
|
|
|
+ file: {
|
|
|
+ icon: 'ki-outline ki-file text-primary',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ plugins: ['dnd', 'types'],
|
|
|
+ }
|
|
|
+ // $tree.jstree('destroy')
|
|
|
+ $tree.on('loaded.jstree', function (e, data) {
|
|
|
+ // console.log('TREE_LOADED', e, data)
|
|
|
+ const inst = data.instance;
|
|
|
+ const obj = inst.get_node(e.target.firstChild.firstChild.firstChild);
|
|
|
+ inst.select_node(obj);
|
|
|
+ })
|
|
|
+ $tree.on('select_node.jstree', function (e, data) {
|
|
|
+ console.log('TREE_SELECTED', e, data)
|
|
|
+ RenderRightBox(data.node?.data)
|
|
|
+ })
|
|
|
+ $tree.jstree(opt)
|
|
|
}
|
|
|
|
|
|
-function RenderRightBox(data){
|
|
|
- console.log('RenderRightBox', arguments)
|
|
|
- $rightBoxBody.data('data',data)
|
|
|
- $rightBox.find('input[name="budget_id"]').val(data.budget_id);
|
|
|
- $rightBox.find('input[name="project_id"]').val(project_id);
|
|
|
- $rightBox.find('input[name="item_id"]').val(data.item_id);
|
|
|
- $rightBox.find('input[name="item_code"]').val(data.item_code);
|
|
|
- const title = data.chapter ?`${data.chapter}、${data.project_name}`: data.section ?`${data.section}.${data.project_name}`: data.project_name
|
|
|
- $rightBoxHeader.find('.title').text(title)
|
|
|
- RenderRightBox_Custom(data)
|
|
|
- $rightBox.show()
|
|
|
+function RenderRightBox(data) {
|
|
|
+ console.log('RenderRightBox', arguments)
|
|
|
+ $rightBoxBody.data('data', data)
|
|
|
+ $rightBox.find('input[name="budget_id"]').val(data.budget_id);
|
|
|
+ $rightBox.find('input[name="project_id"]').val(project_id);
|
|
|
+ $rightBox.find('input[name="item_id"]').val(data.item_id);
|
|
|
+ $rightBox.find('input[name="item_code"]').val(data.item_code);
|
|
|
+ const title = data.chapter ? `${data.chapter}、${data.project_name}` : data.section ? `${data.section}.${data.project_name}` : data.project_name
|
|
|
+ $rightBoxHeader.find('.title').text(title)
|
|
|
+ RenderRightBox_Custom(data)
|
|
|
+ $rightBox.show()
|
|
|
}
|
|
|
-function RenderRightBox_Custom(data){
|
|
|
- $('.table_radio_box .form-check').hide()
|
|
|
- $quotaBox.data("table-url",`/api/quota/list/task/${task_id}`)
|
|
|
- QuotaNavTab(data)
|
|
|
+
|
|
|
+function RenderRightBox_Custom(data) {
|
|
|
+ $('.table_radio_box .form-check').hide()
|
|
|
+ $quotaBox.data("table-url", `/api/quota/list/task/${task_id}`)
|
|
|
+ QuotaNavTab(data)
|
|
|
}
|
|
|
-function QuotaNavTab(){
|
|
|
- $taskBox.hide()
|
|
|
- if(!$quotaBox.find('#nav_tab').length){
|
|
|
- $quotaBox.html(nav_template)
|
|
|
- BuildBudgetInfo()
|
|
|
- }else{
|
|
|
- const budget = $quotaBox.find('#nav_tab').data('budget-info') || {}
|
|
|
- $quotaBox.html(nav_template)
|
|
|
- RenderTabs(budget)
|
|
|
- }
|
|
|
- $quotaBox.find('.table-box').hide()
|
|
|
- $quotaBox.show()
|
|
|
+
|
|
|
+function QuotaNavTab() {
|
|
|
+ $taskBox.hide()
|
|
|
+ if (!$quotaBox.find('#nav_tab').length) {
|
|
|
+ $quotaBox.html(nav_template)
|
|
|
+ BuildBudgetInfo()
|
|
|
+ } else {
|
|
|
+ const budget = $quotaBox.find('#nav_tab').data('budget-info') || {}
|
|
|
+ $quotaBox.html(nav_template)
|
|
|
+ RenderTabs(budget)
|
|
|
+ }
|
|
|
+ $quotaBox.find('.table-box').hide()
|
|
|
+ $quotaBox.show()
|
|
|
}
|
|
|
|
|
|
function BuildBudgetInfo() {
|
|
|
- IwbAjax_1({
|
|
|
- url: `/api/project/budget/${project_id}`,
|
|
|
- success: function (res) {
|
|
|
- if (res.success) {
|
|
|
- RenderTabs(res.data)
|
|
|
- }else{
|
|
|
- console.error(res.message)
|
|
|
- }
|
|
|
- },
|
|
|
- })
|
|
|
+ IwbAjax_1({
|
|
|
+ url: `/api/project/budget/${project_id}`,
|
|
|
+ success: function (res) {
|
|
|
+ if (res.success) {
|
|
|
+ RenderTabs(res.data)
|
|
|
+ } else {
|
|
|
+ console.error(res.message)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
-function RenderTabs(data){
|
|
|
- console.log('RenderTabs', data)
|
|
|
- let str1 = '',
|
|
|
- str2 = ''
|
|
|
- if(data && data.length){
|
|
|
- for (let i = 0; i < data.length; i++) {
|
|
|
- const item = data[i]
|
|
|
- str1 += nav_tab_template.format(item.budget_id, item.budget_code)
|
|
|
- const tableStr = table_template.format(item.budget_id,table_add_quota_btn_template.format(item.budget_id),table_send_select_template)
|
|
|
- const tabContent = tab_content_template.format(item.budget_id, tableStr)
|
|
|
- // console.log('TAB_CONTENT', tabContent)
|
|
|
- str2 += tabContent
|
|
|
- }
|
|
|
- }
|
|
|
- const $tab = $('#nav_tab'),$content =$('#tab_content')
|
|
|
- $tab.html(str1).data('budget-info', data)
|
|
|
- $content.html(str2)
|
|
|
- const $tab_btn = $tab.find('li button[data-bs-toggle="tab"]')
|
|
|
- $tab_btn.on('shown.bs.tab',(e)=>{
|
|
|
- console.log('TAB', e)
|
|
|
- const tab_id = $(e.target).data('id'),
|
|
|
- data = $("#body_box .right-box .box-body").data('data')
|
|
|
- budget_id = tab_id
|
|
|
- item_code = data.item_code
|
|
|
- RenderQuotaTable(data)
|
|
|
- })
|
|
|
- const firstTab = new bootstrap.Tab($tab_btn.eq(0))
|
|
|
- firstTab.show()
|
|
|
+function RenderTabs(data) {
|
|
|
+ console.log('RenderTabs', data)
|
|
|
+ let str1 = '',
|
|
|
+ str2 = ''
|
|
|
+ if (data && data.length) {
|
|
|
+ for (let i = 0; i < data.length; i++) {
|
|
|
+ const item = data[i]
|
|
|
+ str1 += nav_tab_template.format(item.budget_id, item.budget_code)
|
|
|
+ const tableStr = table_template.format(item.budget_id, table_add_quota_btn_template.format(item.budget_id), table_send_select_template)
|
|
|
+ const tabContent = tab_content_template.format(item.budget_id, tableStr)
|
|
|
+ // console.log('TAB_CONTENT', tabContent)
|
|
|
+ str2 += tabContent
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const $tab = $('#nav_tab'), $content = $('#tab_content')
|
|
|
+ $tab.html(str1).data('budget-info', data)
|
|
|
+ $content.html(str2)
|
|
|
+ const $tab_btn = $tab.find('li button[data-bs-toggle="tab"]')
|
|
|
+ $tab_btn.on('shown.bs.tab', (e) => {
|
|
|
+ console.log('TAB', e)
|
|
|
+ const tab_id = $(e.target).data('id'),
|
|
|
+ data = $("#body_box .right-box .box-body").data('data')
|
|
|
+ budget_id = tab_id
|
|
|
+ item_code = data.item_code
|
|
|
+ RenderQuotaTable(data)
|
|
|
+ })
|
|
|
+ const firstTab = new bootstrap.Tab($tab_btn.eq(0))
|
|
|
+ firstTab.show()
|
|
|
}
|
|
|
|
|
|
-function RenderQuotaTable(data){
|
|
|
- console.log('RenderQuotaTable', budget_id, data)
|
|
|
- const $table = $quotaBox.find(`#table_${budget_id}`)
|
|
|
- LoadQuotaTable($table)
|
|
|
+function RenderQuotaTable(data) {
|
|
|
+ console.log('RenderQuotaTable', budget_id, data)
|
|
|
+ const $table = $quotaBox.find(`#table_${budget_id}`)
|
|
|
+ LoadQuotaTable($table)
|
|
|
}
|
|
|
|
|
|
-function LoadQuotaTable(table){
|
|
|
- const url = `${$quotaBox.data("table-url")}/${budget_id}/${project_id}/${item_code}`
|
|
|
- IwbTable(table,{
|
|
|
- url,
|
|
|
- checkBox: true,
|
|
|
- columns: [
|
|
|
- {
|
|
|
- title: '序号',
|
|
|
- data: 'id',
|
|
|
- width: '80px',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '工程或费用项目名称',
|
|
|
- data: 'entry_name',
|
|
|
- width: '210px',
|
|
|
- render: (row) => {
|
|
|
- return `<span class="one-line mw-200px" data-bs-toggle="tooltip" data-bs-placement="top" title="${row.entry_name}" >${row.entry_name}</span>`
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- title: '工程数量',
|
|
|
- data: 'amount',
|
|
|
- width: '100px',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '单位',
|
|
|
- data: 'units',
|
|
|
- width: '80px',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '定额编号',
|
|
|
- data: 'quota_code',
|
|
|
- width: '100px',
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'Excel文件',
|
|
|
- data: 'ex_file',
|
|
|
- width: '150px',
|
|
|
- render: (row) => {
|
|
|
- const path = row.ex_file
|
|
|
- if (!path) {
|
|
|
- return '-'
|
|
|
- }
|
|
|
- const names = path.split('/')
|
|
|
- const file_name = names[names.length - 1]
|
|
|
- return `<span class="one-line mw-150px"><a href="#" onclick="DownloadFile('/api/task/download?filename=${encodeURIComponent(path)}','${file_name}')" class="link link-info px-2">${file_name}</a></span>`
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'Excel整行内容',
|
|
|
- data: 'ex_row',
|
|
|
- width: 'auto',
|
|
|
- render: (row) => {
|
|
|
- return `<span class="one-line w-300px" data-bs-toggle="tooltip" data-bs-placement="top" title="${row.ex_row}" >${row.ex_row}</span>`
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'Excel数量',
|
|
|
- data: 'ex_amount',
|
|
|
- width: '100px',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '数量位置',
|
|
|
- data: 'ex_cell',
|
|
|
- width: '80px',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '数量单位',
|
|
|
- data: 'ex_unit',
|
|
|
- width: '80px',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '状态',
|
|
|
- data: 'status',
|
|
|
- width: '100px',
|
|
|
- render: (row) => {
|
|
|
- let str=''
|
|
|
- // if(row.process_status === 0){
|
|
|
- // str+= `<span class="badge badge-primary">未处理</span>`
|
|
|
- // }else if (row.process_status === 1){
|
|
|
- // str+= `<span class="badge badge-warning">处理中</span>`
|
|
|
- // }else if (row.process_status === 2){
|
|
|
- // str+= `<span class="badge badge-success">已处理</span>`
|
|
|
- // }else if (row.process_status === 3){
|
|
|
- // str+= `<span class="badge badge-danger">处理失败</span>`
|
|
|
- // }else if (row.process_status === 4){
|
|
|
- // str+= `<span class="badge badge-danger">数据变更</span>`
|
|
|
- // }
|
|
|
- if(row.send_status === 0){
|
|
|
- str+= `<span class="badge badge-primary ms-3">未推送</span>`
|
|
|
- }else if (row.send_status === 1){
|
|
|
- str+= `<span class="badge badge-warning ms-3">推送中</span>`
|
|
|
- }else if (row.send_status === 200){
|
|
|
- str+= `<span class="badge badge-success ms-3">推送成功</span>`
|
|
|
- }else if (row.send_status === 2){
|
|
|
- str+= `<span class="badge badge-danger ms-3">推送失败</span>`
|
|
|
- }else if (row.send_status === 3){
|
|
|
- str+= `<span class="badge badge-danger ms-3">数据变更</span>`
|
|
|
- }
|
|
|
+function LoadQuotaTable(table) {
|
|
|
+ const url = `${$quotaBox.data("table-url")}/${budget_id}/${project_id}/${item_code}`
|
|
|
+ IwbTable(table, {
|
|
|
+ url,
|
|
|
+ checkBox: true,
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ title: '序号',
|
|
|
+ data: 'id',
|
|
|
+ width: '80px',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '工程或费用项目名称',
|
|
|
+ data: 'entry_name',
|
|
|
+ width: '210px',
|
|
|
+ render: (row) => {
|
|
|
+ return `<span class="one-line mw-200px" data-bs-toggle="tooltip" data-bs-placement="top" title="${row.entry_name}" >${row.entry_name}</span>`
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '工程数量',
|
|
|
+ data: 'amount',
|
|
|
+ width: '100px',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '单位',
|
|
|
+ data: 'units',
|
|
|
+ width: '80px',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '定额编号',
|
|
|
+ data: 'quota_code',
|
|
|
+ width: '100px',
|
|
|
+ render: (row) => {
|
|
|
+ if (row.quota_id) {
|
|
|
+ return `<span class="badge badge-light-danger" data-bs-toggle="tooltip" data-bs-placement="top" title="可覆盖系统数据:${row.quota_id}" >${row.quota_code}</span>`
|
|
|
+ } else {
|
|
|
+ return `<span class="badge badge-light-primary" data-bs-toggle="tooltip" data-bs-placement="top" title="未关联系统数据" >${row.quota_code}</span>`
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: 'Excel文件',
|
|
|
+ data: 'ex_file',
|
|
|
+ width: '150px',
|
|
|
+ render: (row) => {
|
|
|
+ const path = row.ex_file
|
|
|
+ if (!path) {
|
|
|
+ return '-'
|
|
|
+ }
|
|
|
+ const names = path.split('/')
|
|
|
+ const file_name = names[names.length - 1]
|
|
|
+ return `<span class="one-line mw-150px"><a href="#" onclick="DownloadFile('/api/task/download?filename=${encodeURIComponent(path)}','${file_name}')" class="link link-info px-2">${file_name}</a></span>`
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: 'Excel整行内容',
|
|
|
+ data: 'ex_row',
|
|
|
+ width: 'auto',
|
|
|
+ render: (row) => {
|
|
|
+ return `<span class="one-line w-300px" data-bs-toggle="tooltip" data-bs-placement="top" title="${row.ex_row}" >${row.ex_row}</span>`
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: 'Excel数量',
|
|
|
+ data: 'ex_amount',
|
|
|
+ width: '100px',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '数量位置',
|
|
|
+ data: 'ex_cell',
|
|
|
+ width: '80px',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '数量单位',
|
|
|
+ data: 'ex_unit',
|
|
|
+ width: '80px',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '状态',
|
|
|
+ data: 'status',
|
|
|
+ width: '100px',
|
|
|
+ render: (row) => {
|
|
|
+ let str = ''
|
|
|
+ // if(row.process_status === 0){
|
|
|
+ // str+= `<span class="badge badge-primary">未处理</span>`
|
|
|
+ // }else if (row.process_status === 1){
|
|
|
+ // str+= `<span class="badge badge-warning">处理中</span>`
|
|
|
+ // }else if (row.process_status === 2){
|
|
|
+ // str+= `<span class="badge badge-success">已处理</span>`
|
|
|
+ // }else if (row.process_status === 3){
|
|
|
+ // str+= `<span class="badge badge-danger">处理失败</span>`
|
|
|
+ // }else if (row.process_status === 4){
|
|
|
+ // str+= `<span class="badge badge-danger">数据变更</span>`
|
|
|
+ // }
|
|
|
+ if (row.send_status === 0) {
|
|
|
+ str += `<span class="badge badge-primary ms-3">未推送</span>`
|
|
|
+ } else if (row.send_status === 1) {
|
|
|
+ str += `<span class="badge badge-warning ms-3">推送中</span>`
|
|
|
+ } else if (row.send_status === 200) {
|
|
|
+ str += `<span class="badge badge-success ms-3">推送成功</span>`
|
|
|
+ } else if (row.send_status === 2) {
|
|
|
+ str += `<span class="badge badge-danger ms-3" data-bs-toggle="tooltip" data-bs-placement="top" title="${row.send_error}">推送失败</span>`
|
|
|
+ } else if (row.send_status === 3) {
|
|
|
+ str += `<span class="badge badge-danger ms-3">数据变更</span>`
|
|
|
+ }
|
|
|
|
|
|
- return str
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- title: '操作',
|
|
|
- data: 'id',
|
|
|
- width: '120px',
|
|
|
- render: (row) => {
|
|
|
- let str=''
|
|
|
- // if (row.process_status === 0) {
|
|
|
- // str += `<button type="button" class="btn btn-icon btn-sm btn-light-primary" data-bs-toggle="tooltip" data-bs-placement="top" title="开始处理" onclick="StartProcessQuota(${row.id}, ${row.budget_id})"><i class="ki-duotone ki-book-square fs-1"><span class="path1"></span><span class="path2"></span><span class="path3"></span></i></button>`
|
|
|
- // } else if (row.process_status === 2) {
|
|
|
- // str += `<button type="button" class="btn btn-icon btn-sm btn-light-warning" data-bs-toggle="tooltip" data-bs-placement="top" title="重新处理" onclick="ReStartProcessQuota(${row.id}, ${row.budget_id})"><i class="ki-duotone ki-book-square fs-1"><span class="path1"></span><span class="path2"></span><span class="path3"></span></i></button>`
|
|
|
- //
|
|
|
- // } else if (row.process_status === 3) {
|
|
|
- // str += `<button type="button" class="btn btn-icon btn-sm btn-light-danger" data-bs-toggle="tooltip" data-bs-placement="top" title="重新处理" onclick="ReStartProcessQuota(${row.id}, ${row.budget_id})"><i class="ki-duotone ki-book-square fs-1"><span class="path1"></span><span class="path2"></span><span class="path3"></span></i></button>`
|
|
|
- // } else if (row.process_status === 4) {
|
|
|
- // str += `<button type="button" class="btn btn-icon btn-sm btn-light-info" data-bs-toggle="tooltip" data-bs-placement="top" title="重新处理" onclick="ReStartProcessQuota(${row.id}, ${row.budget_id})"><i class="ki-duotone ki-book-square fs-1"><span class="path1"></span><span class="path2"></span><span class="path3"></span></i></button>`
|
|
|
- // }
|
|
|
- if (row.send_status === 0) {
|
|
|
- str += `<button type="button" class="btn btn-icon btn-sm ${row.quota_id?'btn-primary':'btn-light-primary'}" data-bs-toggle="tooltip" data-bs-placement="top" title="开始推送" onclick="StartSendQuota(${row.id}, ${row.budget_id}, ${row.quota_id})"><i class="ki-duotone ki-send fs-3"><span class="path1"></span><span class="path2"></span></i></button>`
|
|
|
- } else if (row.send_status === 200) {
|
|
|
- str += `<button type="button" class="btn btn-icon btn-sm ${row.quota_id?'btn-warning':'btn-light-warning'}" data-bs-toggle="tooltip" data-bs-placement="top" title="重新推送" onclick="ReStartSendQuota(${row.id}, ${row.budget_id}, ${row.quota_id})"><i class="ki-duotone ki-send fs-3"><span class="path1"></span><span class="path2"></span></i></button>`
|
|
|
- } else if (row.send_status === 2) {
|
|
|
- str += `<button type="button" class="btn btn-icon btn-sm ${row.quota_id?'btn-danger':'btn-light-danger'}" data-bs-toggle="tooltip" data-bs-placement="top" title="重新推送" onclick="ReStartSendQuota(${row.id}, ${row.budget_id}, ${row.quota_id})"><i class="ki-duotone ki-send fs-3"><span class="path1"></span><span class="path2"></span></i></button>`
|
|
|
- } else if (row.send_status === 3) {
|
|
|
- str += `<button type="button" class="btn btn-icon btn-sm ${row.quota_id?'btn-info':'btn-light-info'}" data-bs-toggle="tooltip" data-bs-placement="top" title="重新推送" onclick="ReStartSendQuota(${row.id}, ${row.budget_id}, ${row.quota_id})"><i class="ki-duotone ki-send fs-3"><span class="path1"></span><span class="path2"></span></i></button>`
|
|
|
- }
|
|
|
- str+=`<button type="button" class="btn btn-icon btn-sm btn-light-primary" data-bs-toggle="tooltip" data-bs-placement="top" title="编辑" onclick="Edit_Quota(${row.id}, ${row.budget_id})"><i class="ki-duotone ki-message-edit fs-1"><span class="path1"></span><span class="path2"></span></i></button>`
|
|
|
- str+=`<button type="button" class="btn btn-icon btn-sm btn-light-danger" data-bs-toggle="tooltip" data-bs-placement="top" title="删除" onclick="Delete_Quota(${row.id}, ${row.budget_id})"><i class="ki-duotone ki-trash-square fs-1"><span class="path1"></span><span class="path2"></span><span class="path3"></span><span class="path4"></span></i></button>`
|
|
|
- return str
|
|
|
- }
|
|
|
- },
|
|
|
- ]
|
|
|
- }, true)
|
|
|
+ return str
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ data: 'id',
|
|
|
+ width: '120px',
|
|
|
+ render: (row) => {
|
|
|
+ let str = ''
|
|
|
+ // if (row.process_status === 0) {
|
|
|
+ // str += `<button type="button" class="btn btn-icon btn-sm btn-light-primary" data-bs-toggle="tooltip" data-bs-placement="top" title="开始处理" onclick="StartProcessQuota(${row.id}, ${row.budget_id})"><i class="ki-duotone ki-book-square fs-1"><span class="path1"></span><span class="path2"></span><span class="path3"></span></i></button>`
|
|
|
+ // } else if (row.process_status === 2) {
|
|
|
+ // str += `<button type="button" class="btn btn-icon btn-sm btn-light-warning" data-bs-toggle="tooltip" data-bs-placement="top" title="重新处理" onclick="ReStartProcessQuota(${row.id}, ${row.budget_id})"><i class="ki-duotone ki-book-square fs-1"><span class="path1"></span><span class="path2"></span><span class="path3"></span></i></button>`
|
|
|
+ //
|
|
|
+ // } else if (row.process_status === 3) {
|
|
|
+ // str += `<button type="button" class="btn btn-icon btn-sm btn-light-danger" data-bs-toggle="tooltip" data-bs-placement="top" title="重新处理" onclick="ReStartProcessQuota(${row.id}, ${row.budget_id})"><i class="ki-duotone ki-book-square fs-1"><span class="path1"></span><span class="path2"></span><span class="path3"></span></i></button>`
|
|
|
+ // } else if (row.process_status === 4) {
|
|
|
+ // str += `<button type="button" class="btn btn-icon btn-sm btn-light-info" data-bs-toggle="tooltip" data-bs-placement="top" title="重新处理" onclick="ReStartProcessQuota(${row.id}, ${row.budget_id})"><i class="ki-duotone ki-book-square fs-1"><span class="path1"></span><span class="path2"></span><span class="path3"></span></i></button>`
|
|
|
+ // }
|
|
|
+ if (row.send_status === 0) {
|
|
|
+ str += `<button type="button" class="btn btn-icon btn-sm ${row.quota_id ? 'btn-primary' : 'btn-light-primary'}" data-bs-toggle="tooltip" data-bs-placement="top" title="开始推送" onclick="StartSendQuota(${row.id}, ${row.budget_id}, ${row.quota_id})"><i class="ki-duotone ki-send fs-3"><span class="path1"></span><span class="path2"></span></i></button>`
|
|
|
+ } else if (row.send_status === 200) {
|
|
|
+ str += `<button type="button" class="btn btn-icon btn-sm ${row.quota_id ? 'btn-warning' : 'btn-light-warning'}" data-bs-toggle="tooltip" data-bs-placement="top" title="重新推送" onclick="ReStartSendQuota(${row.id}, ${row.budget_id}, ${row.quota_id})"><i class="ki-duotone ki-send fs-3"><span class="path1"></span><span class="path2"></span></i></button>`
|
|
|
+ } else if (row.send_status === 2) {
|
|
|
+ str += `<button type="button" class="btn btn-icon btn-sm ${row.quota_id ? 'btn-danger' : 'btn-light-danger'}" data-bs-toggle="tooltip" data-bs-placement="top" title="重新推送" onclick="ReStartSendQuota(${row.id}, ${row.budget_id}, ${row.quota_id})"><i class="ki-duotone ki-send fs-3"><span class="path1"></span><span class="path2"></span></i></button>`
|
|
|
+ } else if (row.send_status === 3) {
|
|
|
+ str += `<button type="button" class="btn btn-icon btn-sm ${row.quota_id ? 'btn-info' : 'btn-light-info'}" data-bs-toggle="tooltip" data-bs-placement="top" title="重新推送" onclick="ReStartSendQuota(${row.id}, ${row.budget_id}, ${row.quota_id})"><i class="ki-duotone ki-send fs-3"><span class="path1"></span><span class="path2"></span></i></button>`
|
|
|
+ }
|
|
|
+ str += `<button type="button" class="btn btn-icon btn-sm btn-light-primary" data-bs-toggle="tooltip" data-bs-placement="top" title="编辑" onclick="Edit_Quota(${row.id}, ${row.budget_id})"><i class="ki-duotone ki-message-edit fs-1"><span class="path1"></span><span class="path2"></span></i></button>`
|
|
|
+ str += `<button type="button" class="btn btn-icon btn-sm btn-light-danger" data-bs-toggle="tooltip" data-bs-placement="top" title="删除" onclick="Delete_Quota(${row.id}, ${row.budget_id})"><i class="ki-duotone ki-trash-square fs-1"><span class="path1"></span><span class="path2"></span><span class="path3"></span><span class="path4"></span></i></button>`
|
|
|
+ return str
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ }, true)
|
|
|
}
|
|
|
|
|
|
-function SetBudgetData($el){
|
|
|
- const $tableBox = $(`.table-box`)
|
|
|
- $el.find('[name="project_id"]').val($tableBox.find('input[name="project_id"]').val());
|
|
|
- $el.find('[name="item_id"]').val($tableBox.find('input[name="item_id"]').val());
|
|
|
- $el.find('[name="item_code"]').val($tableBox.find('input[name="item_code"]').val());
|
|
|
+function SetBudgetData($el) {
|
|
|
+ const $tableBox = $(`.table-box`)
|
|
|
+ $el.find('[name="project_id"]').val($tableBox.find('input[name="project_id"]').val());
|
|
|
+ $el.find('[name="item_id"]').val($tableBox.find('input[name="item_id"]').val());
|
|
|
+ $el.find('[name="item_code"]').val($tableBox.find('input[name="item_code"]').val());
|
|
|
}
|
|
|
+
|
|
|
function Add_Quota(budget_id,) {
|
|
|
- AddModal($modalQuota, () => {
|
|
|
- SetBudgetData($modalQuota)
|
|
|
- $modalQuota.find('[name="id"]').val('0');
|
|
|
- $modalQuota.find('[name="quota_id"]').val('0');
|
|
|
- $modalQuota.find('[name="task_id"]').val('0');
|
|
|
- $modalQuota.find('[name="budget_id"]').val(budget_id);
|
|
|
- $modalQuota.find('[name="is_cover"]').val('0')
|
|
|
- $modalQuota.find('.is_cover_box').hide()
|
|
|
- })
|
|
|
+ AddModal($modalQuota, () => {
|
|
|
+ SetBudgetData($modalQuota)
|
|
|
+ $modalQuota.find('[name="id"]').val('0');
|
|
|
+ $modalQuota.find('[name="quota_id"]').val('0');
|
|
|
+ $modalQuota.find('[name="task_id"]').val('0');
|
|
|
+ $modalQuota.find('[name="budget_id"]').val(budget_id);
|
|
|
+ $modalQuota.find('[name="is_cover"]').val('0')
|
|
|
+ $modalQuota.find('.is_cover_box').hide()
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
function Edit_Quota(id) {
|
|
|
- $modalQuota.find('.is_cover_box').hide()
|
|
|
- EditModal($modalQuota,()=>{
|
|
|
+ $modalQuota.find('.is_cover_box').hide()
|
|
|
+ EditModal($modalQuota, () => {
|
|
|
IwbAjax_1({
|
|
|
- url:`/api/quota/get/${id}`,
|
|
|
- success:res=>{
|
|
|
- if(!res.success){
|
|
|
- console.error(res.message)
|
|
|
- return
|
|
|
- }
|
|
|
- const data = res.data,
|
|
|
- // SetBudgetData(budget_id)
|
|
|
- quota_id = data.quota_id
|
|
|
- $modalQuota.find('[name="id"]').val(data.id);
|
|
|
- $modalQuota.find('[name="quota_id"]').val(quota_id);
|
|
|
- $modalQuota.find('[name="task_id"]').val(data.task_id);
|
|
|
- $modalQuota.find('[name="budget_id"]').val(data.budget_id);
|
|
|
- $modalQuota.find('[name="project_id"]').val(data.project_id);
|
|
|
- $modalQuota.find('[name="item_id"]').val(data.item_id);
|
|
|
- $modalQuota.find('[name="item_code"]').val(data.item_code);
|
|
|
+ url: `/api/quota/get/${id}`,
|
|
|
+ success: res => {
|
|
|
+ if (!res.success) {
|
|
|
+ console.error(res.message)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const data = res.data,
|
|
|
+ // SetBudgetData(budget_id)
|
|
|
+ quota_id = data.quota_id
|
|
|
+ $modalQuota.find('[name="id"]').val(data.id);
|
|
|
+ $modalQuota.find('[name="quota_id"]').val(quota_id);
|
|
|
+ $modalQuota.find('[name="task_id"]').val(data.task_id);
|
|
|
+ $modalQuota.find('[name="budget_id"]').val(data.budget_id);
|
|
|
+ $modalQuota.find('[name="project_id"]').val(data.project_id);
|
|
|
+ $modalQuota.find('[name="item_id"]').val(data.item_id);
|
|
|
+ $modalQuota.find('[name="item_code"]').val(data.item_code);
|
|
|
$modalQuota.find('[name="entry_name"]').val(data.entry_name);
|
|
|
$modalQuota.find('[name="amount"]').val(data.amount);
|
|
|
$modalQuota.find('[name="units"]').val(data.units);
|
|
|
@@ -494,115 +506,132 @@ function Edit_Quota(id) {
|
|
|
$modalQuota.find('#ex_amount').html(data.ex_amount);
|
|
|
$modalQuota.find('#ex_cell').html(data.ex_cell);
|
|
|
$modalQuota.find('#ex_unit').html(data.ex_unit);
|
|
|
- $modalQuota.find('[name="is_cover"]').val('0')
|
|
|
- if(quota_id){
|
|
|
- $modalQuota.find('.is_cover_box').show()
|
|
|
- }
|
|
|
+ $modalQuota.find('[name="is_cover"][value="0"]').prop('checked', true)
|
|
|
+ if (quota_id) {
|
|
|
+ $modalQuota.find('.is_cover_box').show()
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-function SaveQuota(isSubmit){
|
|
|
- const id = $modalQuota.find('[name="id"]').val(),
|
|
|
- quota_id = $modalQuota.find('[name="quota_id"]').val(),
|
|
|
- task_id = $modalQuota.find('[name="task_id"]').val(),
|
|
|
- budget_id = $modalQuota.find('[name="budget_id"]').val(),
|
|
|
- project_id = $modalQuota.find('[name="project_id"]').val(),
|
|
|
- item_id = $modalQuota.find('[name="item_id"]').val(),
|
|
|
- item_code = $modalQuota.find('[name="item_code"]').val(),
|
|
|
- entry_name = $modalQuota.find('[name="entry_name"]').val(),
|
|
|
- amount = $modalQuota.find('[name="amount"]').val(),
|
|
|
- units = $modalQuota.find('[name="units"]').val(),
|
|
|
- quota_code = $modalQuota.find('[name="quota_code"]').val(),
|
|
|
- is_cover = $modalQuota.find('[name="is_cover"]').val()
|
|
|
- IwbAjax({
|
|
|
- url:`/api/quota/save`,
|
|
|
- data:{
|
|
|
- id,
|
|
|
- quota_id,
|
|
|
- task_id,
|
|
|
- budget_id,
|
|
|
- project_id,
|
|
|
- item_id,
|
|
|
- item_code,
|
|
|
- entry_name,
|
|
|
- amount,
|
|
|
- units,
|
|
|
- quota_code,
|
|
|
- run_now: isSubmit?'true':'false',
|
|
|
- is_cover: is_cover?'true':'false'
|
|
|
- },
|
|
|
- modal:$modalQuota,
|
|
|
- table:`#table_${budget_id}`
|
|
|
- })
|
|
|
+function SaveQuota(isSubmit) {
|
|
|
+ const id = $modalQuota.find('[name="id"]').val(),
|
|
|
+ quota_id = $modalQuota.find('[name="quota_id"]').val(),
|
|
|
+ task_id = $modalQuota.find('[name="task_id"]').val(),
|
|
|
+ budget_id = $modalQuota.find('[name="budget_id"]').val(),
|
|
|
+ project_id = $modalQuota.find('[name="project_id"]').val(),
|
|
|
+ item_id = $modalQuota.find('[name="item_id"]').val(),
|
|
|
+ item_code = $modalQuota.find('[name="item_code"]').val(),
|
|
|
+ entry_name = $modalQuota.find('[name="entry_name"]').val(),
|
|
|
+ amount = $modalQuota.find('[name="amount"]').val(),
|
|
|
+ units = $modalQuota.find('[name="units"]').val(),
|
|
|
+ quota_code = $modalQuota.find('[name="quota_code"]').val(),
|
|
|
+ is_cover = $modalQuota.find('[name="is_cover"]:checked').val()
|
|
|
+ IwbAjax({
|
|
|
+ url: `/api/quota/save`,
|
|
|
+ data: {
|
|
|
+ id,
|
|
|
+ quota_id,
|
|
|
+ task_id,
|
|
|
+ budget_id,
|
|
|
+ project_id,
|
|
|
+ item_id,
|
|
|
+ item_code,
|
|
|
+ entry_name,
|
|
|
+ amount,
|
|
|
+ units,
|
|
|
+ quota_code,
|
|
|
+ run_now: isSubmit ? 'true' : 'false',
|
|
|
+ is_cover: is_cover === '1' || is_cover === 1 ? 'true' : 'false',
|
|
|
+ },
|
|
|
+ modal: $modalQuota,
|
|
|
+ table: `#table_${budget_id}`
|
|
|
+ })
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
-function Delete_Quota(id,budget_id){
|
|
|
- ConfirmUrl('确定删除吗?',`/api/quota/delete/${id}`,`#table_${budget_id}`)
|
|
|
+function Delete_Quota(id, budget_id) {
|
|
|
+ ConfirmUrl('确定删除吗?', `/api/quota/delete/${id}`, `#table_${budget_id}`)
|
|
|
}
|
|
|
|
|
|
-// function StartProcessQuota(id,budget_id){
|
|
|
-// ConfirmUrl('确定开始处理吗?',`/api/quota/start_process/${id}`,`#table_${budget_id}`)
|
|
|
-// }
|
|
|
-// function ReStartProcessQuota(id,budget_id){
|
|
|
-// ConfirmUrl('确定重新开始处理吗?',`/api/quota/start_process/${id}`,`#table_${budget_id}`)
|
|
|
-// }
|
|
|
-
|
|
|
-function StartSendQuota(ids,budget_id,is_cover){
|
|
|
- SendQuota('确定开始推送数据吗?',ids,budget_id,is_cover)
|
|
|
+function StartSendQuota(ids, budget_id, is_cover) {
|
|
|
+ SendQuota('确定开始推送数据吗?', ids, budget_id, is_cover)
|
|
|
}
|
|
|
-function ReStartSendQuota(ids,budget_id,is_cover){
|
|
|
- SendQuota('确定重新开始推送数据吗?',ids,budget_id,is_cover)
|
|
|
+
|
|
|
+function ReStartSendQuota(ids, budget_id, is_cover) {
|
|
|
+ SendQuota('确定重新开始推送数据吗?', ids, budget_id, is_cover)
|
|
|
}
|
|
|
-function Send_Quota_Batch(budget_id){
|
|
|
- const $table = `#table_${budget_id}`,
|
|
|
- select_ids = IwbTableGetSelectedIds($table)
|
|
|
- if(select_ids.length){
|
|
|
- const select_ids_str = select_ids.join(',')
|
|
|
- SendQuota(`确定批量推送这些数据吗?[${select_ids_str}]`,select_ids_str,budget_id,true)
|
|
|
- }else{
|
|
|
- MsgWarning('没有选择数据,请选择要推送的数据!')
|
|
|
- }
|
|
|
+
|
|
|
+function Send_Quota_Batch(budget_id) {
|
|
|
+ const $table = `#table_${budget_id}`,
|
|
|
+ selectedRows = IwbTableGetSelectedRows($table)
|
|
|
+ if (selectedRows.length) {
|
|
|
+ const ids = [], insert_ids = [], update_ids = []
|
|
|
+ for (let i = 0; i < selectedRows.length; i++) {
|
|
|
+ const row = selectedRows[i]
|
|
|
+ if (row.quota_id > 0) {
|
|
|
+ update_ids.push(row.id)
|
|
|
+ } else {
|
|
|
+ insert_ids.push(row.id)
|
|
|
+ }
|
|
|
+ ids.push(row.id)
|
|
|
+ }
|
|
|
+ const ids_str = ids.join(','), insert_ids_str = insert_ids.join(','), update_ids_str = update_ids.join(',')
|
|
|
+ let str = `<div class="">确定批量推送这些数据吗?部分数据只能新增,无法覆盖,请谨慎操作!</div>`
|
|
|
+ if (insert_ids_str) {
|
|
|
+ str += `<div class="text-primary d-flex align-items-center"><strong style="white-space: nowrap">新增ID:</strong>${insert_ids_str}</div>`
|
|
|
+ }
|
|
|
+ if (update_ids_str) {
|
|
|
+ str += `<div class="text-danger d-flex align-items-center"><strong style="white-space: nowrap">覆盖(修改)ID:</strong>${update_ids_str}</div>`
|
|
|
+ }
|
|
|
+ SendQuota(str, ids_str, budget_id, true, true)
|
|
|
+ } else {
|
|
|
+ MsgWarning('没有选择数据,请选择要推送的数据!')
|
|
|
+ }
|
|
|
}
|
|
|
-function SendQuota(title,ids,budget_id,is_cover){
|
|
|
- const opts={
|
|
|
+
|
|
|
+function SendQuota(title, ids, budget_id, is_cover, is_html) {
|
|
|
+ const opts = {
|
|
|
text: title,
|
|
|
icon: "info",
|
|
|
buttonsStyling: false,
|
|
|
- showCancelButton: true,
|
|
|
- showConfirmButton: true,
|
|
|
- showDenyButton: !!is_cover,
|
|
|
+ showCancelButton: true,
|
|
|
+ showConfirmButton: true,
|
|
|
+ showDenyButton: !!is_cover,
|
|
|
cancelButtonText: "取消",
|
|
|
confirmButtonText: "新增",
|
|
|
denyButtonText: "覆盖",
|
|
|
customClass: {
|
|
|
- cancelButton: "btn btn-light mx-2",
|
|
|
+ cancelButton: "btn btn-light mx-2",
|
|
|
confirmButton: "btn btn-primary mx-2",
|
|
|
denyButton: "btn btn-danger mx-2"
|
|
|
},
|
|
|
- toast:false
|
|
|
+ toast: false
|
|
|
+ }
|
|
|
+ if (is_html) {
|
|
|
+ opts.html = `${title}`
|
|
|
+ }
|
|
|
+ Swal.fire(opts).then((result) => {
|
|
|
+ console.log("CONFIRM", result)
|
|
|
+ if (result.isConfirmed) {
|
|
|
+ _send(false)
|
|
|
+ } else if (result.isDenied) {
|
|
|
+ _send(true)
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ function _send(is_cover) {
|
|
|
+ console.log("is_cover", is_cover, ids)
|
|
|
+ IwbAjax({
|
|
|
+ url: `/api/quota/start_send`,
|
|
|
+ data: {
|
|
|
+ ids: ids + "",
|
|
|
+ is_cover: is_cover ? 'true' : 'false'
|
|
|
+ },
|
|
|
+ modal: $modalQuota,
|
|
|
+ table: `#table_${budget_id}`
|
|
|
+ })
|
|
|
}
|
|
|
- Swal.fire(opts).then((result)=>{
|
|
|
- console.log("CONFIRM",result)
|
|
|
- if(result.isConfirmed){
|
|
|
- _send(false)
|
|
|
- }else if(result.isDenied){
|
|
|
- _send(true)
|
|
|
- }
|
|
|
- });
|
|
|
- function _send(is_cover){
|
|
|
- console.log("is_cover",is_cover,ids)
|
|
|
- IwbAjax({
|
|
|
- url:`/api/quota/start_send`,
|
|
|
- data:{
|
|
|
- ids,
|
|
|
- is_cover:is_cover?'true':'false'
|
|
|
- },
|
|
|
- modal:$modalQuota,
|
|
|
- table:`#table_${budget_id}`
|
|
|
- })
|
|
|
- }
|
|
|
}
|