|
@@ -1,59 +1,98 @@
|
|
|
+const task_modal_template=`
|
|
|
+<div class="modal fade" id="modal" tabindex="-1" aria-hidden="true">
|
|
|
+ <div class="modal-dialog modal-dialog-centered">
|
|
|
+ <div class="modal-content rounded">
|
|
|
+ <div class="modal-header">
|
|
|
+ <h3 class="modal-title"><span class="prefix"></span>任务</h3>
|
|
|
+ <div class="btn btn-sm btn-icon btn-active-color-primary" data-bs-dismiss="modal">
|
|
|
+ <i class="ki-duotone ki-cross fs-1">
|
|
|
+ <span class="path1"></span>
|
|
|
+ <span class="path2"></span>
|
|
|
+ </i>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="modal-body">
|
|
|
+ <form>
|
|
|
+ <div class="form-group">
|
|
|
+<!-- <input type="hidden" name="budget_id" value="">-->
|
|
|
+ <input type="hidden" name="project_id" value="">
|
|
|
+ <input type="hidden" name="item_id" value="">
|
|
|
+ <input type="hidden" name="item_code" value="">
|
|
|
+ <input type="hidden" name="task_id" value="">
|
|
|
+ <div class="fv-row form-group mb-3">
|
|
|
+ <label for="task_name" class="form-label required">任务名称</label>
|
|
|
+ <input type="text" class="form-control" name="task_name" id="task_name" placeholder="请输入任务名称" required />
|
|
|
+ </div>
|
|
|
+ <div class="fv-row form-group mb-3">
|
|
|
+ <label for="budget_id" class="form-label">概算单元</label>
|
|
|
+ <select class="form-select" name="budget_id" id="budget_id"></select>
|
|
|
+ </div>
|
|
|
+ <div class="fv-row form-group mb-3">
|
|
|
+ <label for="task_sort" class="form-label">任务排序</label>
|
|
|
+ <input type="number" class="form-control" name="task_sort" id="task_sort" placeholder="请输入任务排序"/>
|
|
|
+ </div>
|
|
|
+ <div class="fv-row form-group mb-3">
|
|
|
+ <label for="task_desc" class="form-label">任务描述</label>
|
|
|
+ <textarea type="number" class="form-control" name="task_desc" id="task_desc" placeholder="请输入任务描述"></textarea>
|
|
|
+ </div>
|
|
|
+
|
|
|
+<!-- <div class="form-check mb-3" id="delete_file_box">-->
|
|
|
+<!-- <input class="form-check-input" type="checkbox" value="" id="delete_file" name="delete_file"/>-->
|
|
|
+<!-- <label class="form-check-label ms-5 text-primary " for="delete_file">-->
|
|
|
+<!-- 删除原数据文件-->
|
|
|
+<!-- </label>-->
|
|
|
+<!-- </div>-->
|
|
|
+ <div class="fv-row">
|
|
|
+ <div id="file_upload_dropzone">
|
|
|
+ <div class="dropzone">
|
|
|
+ <div class="dz-message dropzone-select">
|
|
|
+ <i class="ki-duotone ki-file-up fs-3x text-primary"><span class="path1"></span><span class="path2"></span></i>
|
|
|
+ <div class="ms-4">
|
|
|
+ <h3 class="fs-5 fw-bold text-gray-900 mb-1">将文件拖放到此处或单击上传。</h3>
|
|
|
+ <span class="fs-7 fw-semibold text-gray-500">最多可上传 5 个文件,文件最大10M</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="dropzone dropzone-queue">
|
|
|
+ <div class="dropzone-items wm-200px">
|
|
|
+ <div class="dropzone-item" style="display:none">
|
|
|
+ <div class="dropzone-file">
|
|
|
+ <div class="dropzone-filename" title="some_image_file_name.jpg">
|
|
|
+ <span data-dz-name>some_image_file_name.jpg</span>
|
|
|
+ <strong>(<span data-dz-size>340kb</span>)</strong>
|
|
|
+ </div>
|
|
|
+ <div class="dropzone-error" data-dz-errormessage></div>
|
|
|
+ </div>
|
|
|
+ <div class="dropzone-toolbar">
|
|
|
+ <span class="dropzone-delete" data-dz-remove><i class="bi bi-x fs-1"></i></span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+ <div class="modal-footer">
|
|
|
+ <button type="button" class="btn btn-light" data-bs-dismiss="modal">取消</button>
|
|
|
+ <button type="button" class="btn btn-success" onclick="SaveProject(true)">提交</button>
|
|
|
+ <button type="button" class="btn btn-primary" onclick="SaveProject()">保存草稿</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</div>`
|
|
|
+$('.app-main .app-container').append(task_modal_template)
|
|
|
+const table_add_task_btn_template = `<button type="button" class="task_add_btn btn btn-primary btn-sm" onclick="Add('{0}')">添加任务</button>`
|
|
|
+
|
|
|
const table = '#table',
|
|
|
$modal = $('#modal')
|
|
|
-InitBody()
|
|
|
+$modal.find('#budget_id').html($('#budget_id_options').html())
|
|
|
$(function () {
|
|
|
- BuildChapterInfo()
|
|
|
InitFileUpload()
|
|
|
})
|
|
|
|
|
|
|
|
|
-
|
|
|
-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_task_btn_template = `<button type="button" class="task_add_btn btn btn-primary btn-sm" onclick="Add('{0}')">添加任务</button>`,
|
|
|
- table_add_quota_btn_template = `` //`<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>
|
|
|
- <option value="2">运行中</option>
|
|
|
- <option value="200">运行成功</option>
|
|
|
- <option value="4">取消运行</option>
|
|
|
- <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">
|
|
|
- <option value="">全部发送状态</option>
|
|
|
- <option value="0">未发送</option>
|
|
|
- <option value="1">发送中</option>
|
|
|
- <option value="200">发送成功</option>
|
|
|
- <option value="2">发送失败</option>
|
|
|
- <option value="3">数据变更</option>
|
|
|
- </select>`,
|
|
|
- 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">
|
|
|
- <div class="d-flex">
|
|
|
- {2}
|
|
|
- <input type="text" class="form-control form-control-sm w-200px" placeholder="请输入关键字" name="keyword" />
|
|
|
- </div>
|
|
|
- <div class="btn-group ms-5">
|
|
|
- <button type="button" class="btn btn-primary btn-sm" onclick="IwbTableSearch(this)">查询</button>
|
|
|
- <button type="button" class="btn btn-danger btn-sm" onclick="IwbTableResetSearch(this)">重置</button>
|
|
|
- </div>
|
|
|
- </form>
|
|
|
- </div>
|
|
|
- <table class="table table-striped table-bordered table-hover table-rounded" id="table_{0}">
|
|
|
- </table>
|
|
|
- <div class="pagination-row"></div>
|
|
|
- </div>`
|
|
|
-
|
|
|
-
|
|
|
let _fileUploadDropzone = null;
|
|
|
|
|
|
function InitFileUpload(){
|
|
@@ -102,123 +141,31 @@ function InitFileUpload(){
|
|
|
// console.log('removedfile', file,_files)
|
|
|
// })
|
|
|
}
|
|
|
-function InitBody(){
|
|
|
- const h= $('.app-wrapper').height() - $('#breadcrumb_header').height() - $('.app-footer').height() -5
|
|
|
- $('#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>
|
|
|
- <div class="flex-row-fluid flex-column right-box" style="display: none">
|
|
|
- <div class="my-2 d-flex align-items-center box-header mt-5 flex-column-auto">
|
|
|
- <section class="d-none">
|
|
|
- <input type="hidden" name="budget_id" value="{0}">
|
|
|
- <input type="hidden" name="project_id" value="">
|
|
|
- <input type="hidden" name="item_id" value="">
|
|
|
- <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>
|
|
|
- <div class="d-flex">
|
|
|
- <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"/>
|
|
|
- <label class="form-check-label fw-bolder text-primary" for="task_radio">
|
|
|
- 任务列表
|
|
|
- </label>
|
|
|
- </div>
|
|
|
- <div class="form-check form-check-custom form-check-success form-check-solid ms-5">
|
|
|
- <input class="form-check-input" name="table_radio" type="radio" value="quota" id="quota_radio"/>
|
|
|
- <label class="form-check-label fw-bolder text-success" for="quota_radio">
|
|
|
- 定额输入
|
|
|
- </label>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="box-body flex-column-fluid">
|
|
|
- <div class="task w-100 h-100" style="display: none"></div>
|
|
|
- <div class="quota w-100 h-100" style="display: none"></div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>`)
|
|
|
- $('#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 RenderRightBox(data){
|
|
|
- console.log('RenderRightBox', arguments)
|
|
|
- const $rightBox= $('#body_box .right-box'),
|
|
|
- $rightBoxHeader = $('#body_box .right-box .box-header'),
|
|
|
+
|
|
|
+function RenderRightBox_Custom(data){
|
|
|
+ const $rightBoxHeader = $('#body_box .right-box .box-header'),
|
|
|
$rightBoxBody = $('#body_box .right-box .box-body'),
|
|
|
$taskBox = $rightBoxBody.find('.task'),
|
|
|
$quotaBox = $rightBoxBody.find('.quota')
|
|
|
- $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)
|
|
|
+
|
|
|
$rightBoxHeader.find('[name="table_radio"]').prop("disabled",false).off('change.iwb')
|
|
|
$rightBoxHeader.find('[name="table_radio"]').on('change.iwb',function(){
|
|
|
- const val = $(this).val()
|
|
|
- if (val === 'quota') {
|
|
|
- _quotaNavTab(data)
|
|
|
- } else {
|
|
|
- _taskTable(data)
|
|
|
- }
|
|
|
- })
|
|
|
+ const val = $(this).val()
|
|
|
+ if (val === 'quota') {
|
|
|
+ $taskBox.hide()
|
|
|
+ QuotaNavTab(data)
|
|
|
+ } else {
|
|
|
+ _taskTable(data)
|
|
|
+ }
|
|
|
+ })
|
|
|
if(data.children_count>0||data.chapter){
|
|
|
_renderTask(data)
|
|
|
}else{
|
|
|
- _renderQuota(data)
|
|
|
+ $rightBoxHeader.find('.badge').text('定额输入明细').removeClass('badge-primary').addClass('badge-success')
|
|
|
+ $rightBoxHeader.find('#task_radio').prop("disabled",true)
|
|
|
+ $rightBoxHeader.find('#quota_radio').prop("checked",true)
|
|
|
+ QuotaNavTab(data)
|
|
|
}
|
|
|
- $rightBox.show()
|
|
|
function _renderTask(data){
|
|
|
$rightBoxHeader.find('.badge').text('任务列表').removeClass('badge-success').addClass('badge-primary')
|
|
|
$rightBoxHeader.find('#task_radio').prop("checked",true)
|
|
@@ -357,7 +304,7 @@ function RenderRightBox(data){
|
|
|
}
|
|
|
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="Edit(${row.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-primary" data-bs-toggle="tooltip" data-bs-placement="top" title="编辑" onclick="Edit(${row.id})"><i class="ki-duotone ki-message-edit fs-1"><span class="path1"></span><span class="path2"></span></i></button>-->`
|
|
|
if (row.process_status === 2 || row.process_status ===200) {
|
|
|
str+=`<button type="button" class="btn btn-icon btn-sm btn-light-primary" data-bs-toggle="tooltip" data-bs-placement="top" title="定额输入列表" onclick="GoTo('/quota_info/${project_id}/${row.id}')"><i class="ki-duotone ki-eye fs-1"><span class="path1"></span><span class="path2"></span><span class="path3"></span><span class="path4"></span></i></button>`
|
|
@@ -370,81 +317,9 @@ function RenderRightBox(data){
|
|
|
},
|
|
|
]
|
|
|
}, true)
|
|
|
- setTimeout(function () {$taskBox.show()},500)
|
|
|
- }
|
|
|
- function _renderQuota(data){
|
|
|
- $rightBoxHeader.find('.badge').text('定额输入明细').removeClass('badge-primary').addClass('badge-success')
|
|
|
- $rightBoxHeader.find('#task_radio').prop("disabled",true)
|
|
|
- $rightBoxHeader.find('#quota_radio').prop("checked",true)
|
|
|
- _quotaNavTab(data)
|
|
|
+ $taskBox.find('.table-box').hide()
|
|
|
+ $taskBox.show()
|
|
|
}
|
|
|
- function _quotaNavTab(data){
|
|
|
- $taskBox.hide()
|
|
|
- if(!$quotaBox.find('#nav_tab').length){
|
|
|
- $quotaBox.html(nav_template)
|
|
|
- BuildBudgetInfo()
|
|
|
- }else{
|
|
|
- const data = $quotaBox.find('#nav_tab').data('budget-info') || {}
|
|
|
- $quotaBox.html(nav_template)
|
|
|
- RenderTabs(data)
|
|
|
- }
|
|
|
- // const $tab = $('#nav_tab li button[data-bs-toggle="tab"]')
|
|
|
- // if ($tab.length) {
|
|
|
- // const firstTab = new bootstrap.Tab($tab.eq(0))
|
|
|
- // firstTab.show()
|
|
|
- // }
|
|
|
- setTimeout(function () {$quotaBox.show()},500)
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-function BuildBudgetInfo() {
|
|
|
- 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')
|
|
|
- //
|
|
|
- RenderQuotaTable(tab_id,data)
|
|
|
- })
|
|
|
- const firstTab = new bootstrap.Tab($tab_btn.eq(0))
|
|
|
- firstTab.show()
|
|
|
-}
|
|
|
-
|
|
|
-function RenderQuotaTable(budget_id,data){
|
|
|
- console.log('RenderQuotaTable', budget_id, data)
|
|
|
- const $quotaBox = $('#body_box .right-box .box-body .quota')
|
|
|
- const $table = $quotaBox.find(`#table_${budget_id}`)
|
|
|
- LoadQuotaTable($table,`/api/quota/list/${budget_id}/${project_id}/${data.item_code}`)
|
|
|
}
|
|
|
|
|
|
function SetBudgetData($el){
|