Yue 3 ماه پیش
والد
کامیت
d8f17206fe

+ 7 - 4
SourceCode/IntelligentRailwayCosting/app/routes/excel_test.py

@@ -42,15 +42,18 @@ def build_test_data(task_data):
     selected_zgs_id = task_data.get('selected_zgs_id', None) if task_data else 1
     zgs_code = ""
     zgs_list = task_data.get('zgs_list', None)
-    if not selected_zgs_id and zgs_list:
+    if  selected_zgs_id == -1 and zgs_list:
         selected_zgs = random.choice(zgs_list)
         selected_zgs_id = selected_zgs.get('zgs_id')
-        zgs_code = selected_zgs.get('zgs_code')
+        zgs_code = selected_zgs.get('zgs_name')
     elif zgs_list:
-        selected_zgs = zgs_list.filter(lambda x: x.get('zgs_id') == selected_zgs_id)
+        # 修改: 使用列表推导式进行过滤
+        selected_zgs = [x for x in zgs_list if x.get('zgs_id') == selected_zgs_id]
         if not selected_zgs:
             selected_zgs = random.choice(zgs_list)
-        zgs_code = selected_zgs.get('zgs_code')
+        else:
+            selected_zgs = selected_zgs[0]  # 取第一个匹配项
+        zgs_code = selected_zgs.get('zgs_name')
     
     file_excel = task_data.get('file_excel', None)
     # 从file_excel随机选择文件

+ 3 - 3
SourceCode/IntelligentRailwayCosting/app/routes/project_quota.py

@@ -22,9 +22,9 @@ def get_page_list(budget_id:int,project_id:str,item_code:str):
         return TableResponse.success(data,count)
     except Exception as e:
         return ResponseBase.error(f'获取定额条目列表失败:{str(e)}')
-@project_quota_api.route('/list/task/<int:task_id>', methods=['POST'])
+@project_quota_api.route('/list/task/<int:task_id>/<int:budget_id>/<project_id>/<item_code>', methods=['POST'])
 @Permission.authorize
-def get_quotas_by_task_paginated(task_id:int):
+def get_quotas_by_task_paginated(task_id:int,budget_id:int,project_id:str,item_code:str):
     try:
         data = request.get_json()
         page = int(data.get('pageNum', 1))
@@ -32,7 +32,7 @@ def get_quotas_by_task_paginated(task_id:int):
         keyword = data.get('keyword')
         # process_status = int(data.get('process_status')) if data.get('process_status') else None
         send_status = int(data.get('send_status')) if data.get('send_status') else None
-        data,count = quota_service.get_quotas_by_task_paginated( task_id,page, per_page, keyword, send_status)
+        data,count = quota_service.get_quotas_by_task_paginated(task_id, budget_id, project_id, item_code,page, per_page, keyword, send_status)
         return TableResponse.success(data,count)
     except Exception as e:
         return ResponseBase.error(f'获取任务定额条目列表失败:{str(e)}')

+ 4 - 1
SourceCode/IntelligentRailwayCosting/app/services/project_quota.py

@@ -48,10 +48,13 @@ class ProjectQuotaService:
             print(f"获取项目定额列表失败: {str(e)}")
             raise
 
-    def get_quotas_by_task_paginated(self, task_id: int, page: int = 1, page_size: int = 10,keyword: Optional[str]=None,send_status: Optional[int] = None):
+    def get_quotas_by_task_paginated(self, task_id: int, budget_id, project_id, item_code, page: int = 1, page_size: int = 10,keyword: Optional[str]=None,send_status: Optional[int] = None):
         try:
             data = self.store.get_quotas_by_task_paginated(
                 task_id=task_id,
+                budget_id=budget_id,
+                project_id=project_id,
+                item_code=item_code,
                 page=page,
                 page_size=page_size,
                 send_status=send_status,

+ 8 - 4
SourceCode/IntelligentRailwayCosting/app/services/project_task.py

@@ -237,7 +237,7 @@ class ProjectTaskService:
             delete_paths=[]
             for file_path in task.file_path.split(','):
                 if os.path.isfile(file_path):
-                    delete_dir = file_path.replace('upload_files/','delete_files/')
+                    delete_dir = os.path.dirname(file_path).replace('upload_files/', 'delete_files/')
                     os.makedirs(delete_dir, exist_ok=True)
                     # 处理文件名冲突
                     base_name = os.path.basename(file_path)
@@ -249,9 +249,13 @@ class ProjectTaskService:
                         counter += 1
                     os.rename(file_path, target_path)
                     delete_paths.append(target_path)
-            if len(delete_paths) > 0:
-                LogRecordHelper.log_success(OperationType.DELETE, OperationModule.TASK,
-                                            f"删除任务文件:{task.task_name}", utils.to_str(delete_paths))
+                    # 删除空目录
+                    original_dir = os.path.dirname(file_path)
+                    if not os.listdir(original_dir):
+                        os.rmdir(original_dir)
+        if len(delete_paths) > 0:
+            LogRecordHelper.log_success(OperationType.DELETE, OperationModule.TASK,
+                                        f"删除任务文件:{task.task_name}", utils.to_str(delete_paths))
 
         # file_paths = [] if delete_old or not task.file_path else task.file_path.split(',')
 

+ 4 - 1
SourceCode/IntelligentRailwayCosting/app/stores/railway_costing_sqlserver/project_quota.py

@@ -80,11 +80,14 @@ class ProjectQuotaStore:
                 'data': quotas
             }
 
-    def get_quotas_by_task_paginated(self, task_id: int, page: int = 1, page_size: int = 10,keyword: Optional[str]=None,send_status: Optional[int] = None):
+    def get_quotas_by_task_paginated(self, task_id: int, budget_id, project_id, item_code, page: int = 1, page_size: int = 10,keyword: Optional[str]=None,send_status: Optional[int] = None):
         with db_helper.sqlserver_query_session(self._database) as db_session:
             query = db_session.query(ProjectQuotaModel).filter(
                 and_(
                     ProjectQuotaModel.task_id == task_id,
+                    ProjectQuotaModel.budget_id == budget_id,
+                    ProjectQuotaModel.project_id == project_id,
+                    ProjectQuotaModel.item_code.like(f"{item_code}%"),
                     ProjectQuotaModel.is_del == 0
                 )
             )

+ 43 - 41
SourceCode/IntelligentRailwayCosting/app/views/static/account/login.js

@@ -1,56 +1,58 @@
-;(function () {
-    'use strict'
-    const form = document.getElementById('loginForm')
-    form.addEventListener('submit', async function (event) {
-        event.preventDefault()
-        if (!form.checkValidity()) {
-            event.stopPropagation()
-            form.classList.add('was-validated')
-            return
-        }
+const form = document.getElementById('loginForm')
+function Login() {
+    if (!form.checkValidity()) {
+        form.classList.add('was-validated')
+        return
+    }
 
-        const formData = {
-            username: document.getElementById('username').value,
-            password: document.getElementById('password').value,
-        }
+    const formData = {
+        username: document.getElementById('username').value,
+        password: document.getElementById('password').value,
+    }
 
-        try {
-            const response = await fetch('/api/auth/login', {
-                method: 'POST',
-                headers: {
-                    'Content-Type': 'application/json',
-                },
-                body: JSON.stringify(formData),
-            })
-            const data = await response.json()
+    fetch('/api/auth/login', {
+        method: 'POST',
+        headers: {
+            'Content-Type': 'application/json',
+        },
+        body: JSON.stringify(formData),
+    })
+        .then(response => response.json())
+        .then(data => {
             if (data.success) {
-                // 获取URL参数中的redirect_url
                 const urlParams = new URLSearchParams(window.location.search);
-                const redirectUrl = urlParams.get('redirect_url');
+                const redirectUrl = urlParams.get('next');
                 if (redirectUrl) {
-                    window.location.href =  redirectUrl;
+                    window.location.href = redirectUrl;
                 } else {
                     window.location.href = `${window.location.protocol}//${window.location.host}/`
                 }
             } else {
                 showAlert('danger', data.error || '登录失败,请检查用户名和密码')
             }
-        } catch (error) {
+        })
+        .catch(error => {
             console.error('登录请求失败:', error)
             showAlert('danger', '网络错误,请稍后重试')
-        }
-    })
+        })
+}
+
+function showAlert(type, message) {
+    const alertContainer = document.getElementById('alert-container')
+    const alertDiv = document.createElement('div')
+    alertDiv.className = `alert alert-${type} alert-dismissible fade show`
+    alertDiv.setAttribute('role', 'alert')
+    alertDiv.innerHTML = `
+        ${message}
+        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
+    `
+    alertContainer.innerHTML = ''
+    alertContainer.appendChild(alertDiv)
+}
 
-    function showAlert(type, message) {
-        const alertContainer = document.getElementById('alert-container')
-        const alertDiv = document.createElement('div')
-        alertDiv.className = `alert alert-${type} alert-dismissible fade show`
-        alertDiv.setAttribute('role', 'alert')
-        alertDiv.innerHTML = `
-            ${message}
-            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
-        `
-        alertContainer.innerHTML = ''
-        alertContainer.appendChild(alertDiv)
+form.addEventListener('keyup', function (event) {
+    if (event.key === 'Enter') {
+        event.preventDefault();
+        Login();
     }
-})()
+})

+ 1 - 5
SourceCode/IntelligentRailwayCosting/app/views/static/project/budget_info.js

@@ -143,11 +143,7 @@ function InitFileUpload(){
 }
 
 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')
-
+	$quotaBox.data("table-url",`/api/quota/list`)
 	$rightBoxHeader.find('[name="table_radio"]').prop("disabled",false).off('change.iwb')
 	$rightBoxHeader.find('[name="table_radio"]').on('change.iwb',function(){
 		const val = $(this).val()

+ 15 - 12
SourceCode/IntelligentRailwayCosting/app/views/static/project/quota_info.js

@@ -124,6 +124,8 @@ 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
+
 console.log(`加载项目:${project_id}`)
 InitBody()
 $(function () {
@@ -168,6 +170,11 @@ function InitBody(){
 						</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')
 }
 function  AdjustBoxHeight(){
 	const h= $('.app-wrapper').height()  - $('.app-body-header').height() - $('.app-footer').height() -5
@@ -225,9 +232,6 @@ function BuildChapterInfo(){
 
 function RenderRightBox(data){
 	console.log('RenderRightBox', arguments)
-	const $rightBox= $('#body_box .right-box'),
-		$rightBoxHeader = $('#body_box .right-box .box-header'),
-		$rightBoxBody = $('#body_box .right-box .box-body')
 	$rightBoxBody.data('data',data)
 	$rightBox.find('input[name="budget_id"]').val(data.budget_id);
 	$rightBox.find('input[name="project_id"]').val(project_id);
@@ -240,12 +244,10 @@ function RenderRightBox(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(){
-	const $rightBoxBody = $('#body_box .right-box .box-body'),
-		$taskBox = $rightBoxBody.find('.task'),
-		$quotaBox = $rightBoxBody.find('.quota')
 	$taskBox.hide()
 	if(!$quotaBox.find('#nav_tab').length){
 		$quotaBox.html(nav_template)
@@ -294,21 +296,22 @@ function RenderTabs(data){
 		console.log('TAB', e)
 		const tab_id = $(e.target).data('id'),
 			data = $("#body_box .right-box .box-body").data('data')
-		//
-		RenderQuotaTable(tab_id,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(budget_id,data){
+function RenderQuotaTable(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}`)
+	LoadQuotaTable($table)
 }
 
-function  LoadQuotaTable(table,url){
+function  LoadQuotaTable(table){
+	const url = `${$quotaBox.data("table-url")}/${budget_id}/${project_id}/${item_code}`
     IwbTable(table,{
 		url,
 		columns: [

+ 17 - 17
SourceCode/IntelligentRailwayCosting/app/views/templates/account/login.html

@@ -6,24 +6,24 @@
 {% block content %}
 <div class="container">
 	<div class="login-container">
-	<h2 class="login-title">{{app_name}}</h2>
-	<div id="alert-container"></div>
-	<form id="loginForm" class="needs-validation" novalidate>
-		<div class="form-floating">
-			<input type="text" class="form-control" id="username" name="username" placeholder="用户名/邮箱/手机号" required />
-			<label for="username">用户名/邮箱/手机号</label>
-			<div class="invalid-feedback">请输入用户名、邮箱或手机号</div>
-		</div>
-		<div class="form-floating">
-			<input type="password" class="form-control" id="password" name="password" placeholder="密码"/>
-			<label for="password">密码</label>
-			<div class="invalid-feedback">请输入密码</div>
-		</div>
-		<button type="submit" class="btn btn-info btn-login mt-3">登录</button>
-	</form>
-</div>
+		<h2 class="login-title">{{app_name}}</h2>
+		<div id="alert-container"></div>
+		<form id="loginForm" class="needs-validation" novalidate>
+			<div class="form-floating">
+				<input type="text" class="form-control" id="username" name="username" placeholder="用户名/邮箱/手机号" required />
+				<label for="username">用户名/邮箱/手机号</label>
+				<div class="invalid-feedback">请输入用户名、邮箱或手机号</div>
+			</div>
+			<div class="form-floating">
+				<input type="password" class="form-control" id="password" name="password" placeholder="密码" />
+				<label for="password">密码</label>
+				<div class="invalid-feedback">请输入密码</div>
+			</div>
+			<button type="button" class="btn btn-info btn-login mt-3" id="loginButton" onclick="Login()">登录</button>
+		</form>
+	</div>
 </div>
 {% endblock %}
 {% block scripts %}
 <script src="{{ url_for('static', filename='/account/login.js') }}"></script>
-{% endblock %}
+{% endblock %}

+ 19 - 18
SourceCode/IntelligentRailwayCosting/app/views/templates/base/base.html

@@ -1,20 +1,21 @@
 <!DOCTYPE html>
 <html lang="zh">
-	<head>
-		<meta charset="UTF-8" />
-		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
-		<title>{% block title %}{% endblock %} - IWB</title>
-		<link rel="stylesheet" href="{{ url_for('static', filename='base/plugins/plugins.bundle.css') }}" />
-		<link rel="stylesheet" href="{{ url_for('static', filename='base/css/style.bundle.css') }}" />
-		<link rel="icon" href="{{ url_for('static', filename='media/favicon.ico') }}" />
-		{% block head %}{% endblock %}
-	</head>
-	<body data-kt-app-layout="dark-header"
-		  data-kt-app-header-fixed="true"
-		  class="app-default">
-		{% block content %}{% endblock %}
-		<script src="{{ url_for('static', filename='base/plugins/plugins.bundle.js') }}"></script>
-		<script src="{{ url_for('static', filename='base/js/scripts.bundle.js') }}"></script>
-		{% block scripts %}{% endblock %}
-	</body>
-</html>
+
+<head>
+	<meta charset="UTF-8" />
+	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
+	<title>{% block title %}{% endblock %} - IWB</title>
+	<link rel="stylesheet" href="{{ url_for('static', filename='base/plugins/plugins.bundle.css') }}" />
+	<link rel="stylesheet" href="{{ url_for('static', filename='base/css/style.bundle.css') }}" />
+	<link rel="icon" href="{{ url_for('static', filename='media/favicon.ico') }}" />
+	{% block head %}{% endblock %}
+</head>
+
+<body data-kt-app-layout="dark-header" data-kt-app-header-fixed="true" class="app-default">
+	{% block content %}{% endblock %}
+	<script src="{{ url_for('static', filename='base/plugins/plugins.bundle.js') }}"></script>
+	<script src="{{ url_for('static', filename='base/js/scripts.bundle.js') }}"></script>
+	{% block scripts %}{% endblock %}
+</body>
+
+</html>

+ 14 - 12
SourceCode/IntelligentRailwayCosting/app/views/templates/base/layout.html

@@ -16,18 +16,19 @@
                     </a>
                 </div>
                 <div class="d-flex align-items-stretch justify-content-between flex-lg-grow-1">
-                    <div class="app-header-menu app-header-mobile-drawer align-items-stretch" >
+                    <div class="app-header-menu app-header-mobile-drawer align-items-stretch">
                         <div class="title mx-10 d-flex align-items-center flex-nowrap" style="white-space: nowrap">
-                           <h2 class="d-flex text-white fs-2 mb-0">数据转换推送系统</h2>
+                            <h2 class="d-flex text-white fs-2 mb-0">数据转换推送系统</h2>
                         </div>
-                        <div id="header_menu" class="menu menu-rounded menu-column menu-lg-row my-5 my-lg-0 align-items-stretch fw-semibold px-2 px-lg-0">
+                        <div id="header_menu"
+                            class="menu menu-rounded menu-column menu-lg-row my-5 my-lg-0 align-items-stretch fw-semibold px-2 px-lg-0">
                             <div class="menu-item here" id="project_menu">
                                 <a href="{{ url_for('project.index') }}" class="menu-link">
                                     <span class="menu-title">项目管理</span>
                                 </a>
                             </div>
                             {% if current_user.is_admin %}
-                             <div class="menu-item here" id="log_menu">
+                            <div class="menu-item here" id="log_menu">
                                 <a href="{{ url_for('log.index') }}" class="menu-link">
                                     <span class="menu-title">日志管理</span>
                                 </a>
@@ -36,7 +37,7 @@
                         </div>
                     </div>
                     <div class="app-navbar flex-shrink-0">
-    <!--						<div class="app-navbar-item align-items-stretch ms-1 ms-md-4"></div>-->
+                        <!--						<div class="app-navbar-item align-items-stretch ms-1 ms-md-4"></div>-->
                         {% include "base/user_info.html" %}
                     </div>
                 </div>
@@ -47,11 +48,12 @@
             <div class="app-main flex-column flex-row-fluid">
                 <div class="d-flex flex-column flex-column-fluid">
                     <div class="app-container flex-column-fluid">
-                       {% block page_content %}{% endblock %}
+                        {% block page_content %}{% endblock %}
                     </div>
                 </div>
                 <div class="app-footer">
-                    <div class="app-container container-fluid d-flex flex-column flex-md-row flex-center flex-md-stack py-3">
+                    <div
+                        class="app-container container-fluid d-flex flex-column flex-md-row flex-center flex-md-stack py-3">
                         <div class="text-gray-900 order-2 order-md-1">
                             <span class="text-muted fw-semibold me-1">2025&copy;</span>
                             <a href="#" target="_blank" class="text-gray-800 text-hover-primary">IWB</a>
@@ -61,11 +63,11 @@
             </div>
         </div>
         <div class="scrolltop" data-kt-scrolltop="true">
-			<i class="ki-duotone ki-arrow-up">
-				<span class="path1"></span>
-				<span class="path2"></span>
-			</i>
-		</div>
+            <i class="ki-duotone ki-arrow-up">
+                <span class="path1"></span>
+                <span class="path2"></span>
+            </i>
+        </div>
     </div>
 </div>
 {% endblock %}

+ 16 - 10
SourceCode/IntelligentRailwayCosting/app/views/templates/base/user_info.html

@@ -1,20 +1,26 @@
-
 <div class="app-navbar-item ms-1 ms-md-4">
-    <div class="cursor-pointer symbol symbol-35px  symbol-circle" data-kt-menu-trigger="{default: 'click', lg: 'hover'}" data-kt-menu-attach="parent" data-kt-menu-placement="bottom-end">
-          <div class="symbol-label fs-2 fw-semibold">{{ current_user.username[0].upper() if current_user and current_user.is_authenticated else ' '}}</div>
-<!--        <span class="bullet bullet-dot bg-success h-6px w-6px position-absolute translate-middle mb-1 bottom-0 start-100 animation-blink"></span>-->
+    <div class="cursor-pointer symbol symbol-35px  symbol-circle" data-kt-menu-trigger="{default: 'click', lg: 'hover'}"
+        data-kt-menu-attach="parent" data-kt-menu-placement="bottom-end">
+        <div class="symbol-label fs-2 fw-semibold">{{ current_user.username[0].upper() if current_user and
+            current_user.is_authenticated else ' '}}</div>
+        <!--        <span class="bullet bullet-dot bg-success h-6px w-6px position-absolute translate-middle mb-1 bottom-0 start-100 animation-blink"></span>-->
     </div>
-    <div class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-800 menu-state-bg menu-state-color fw-semibold py-4 fs-6 w-275px" data-kt-menu="true">
+    <div class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-800 menu-state-bg menu-state-color fw-semibold py-4 fs-6 w-275px"
+        data-kt-menu="true">
         <div class="menu-item px-3">
             <div class="menu-content d-flex align-items-center px-3">
                 <div class="symbol symbol-50px symbol-circle me-5">
-                      <div class="symbol-label fs-2 fw-semibold bg-info text-inverse-info">{{ current_user.username[0].upper() if current_user and current_user.is_authenticated  else ' '}}</div>
+                    <div class="symbol-label fs-2 fw-semibold bg-info text-inverse-info">{{
+                        current_user.username[0].upper() if current_user and current_user.is_authenticated else ' '}}
+                    </div>
                 </div>
                 <div class="d-flex flex-column">
-                    <div class="fw-bold d-flex align-items-center fs-5">{{ current_user.username if current_user else '未登录'}}
-                    <span class="badge badge-light-success fw-bold fs-8 px-2 py-1 ms-2">{{ current_user.specialty if current_user else '未登录'}}</span>
+                    <div class="fw-bold d-flex align-items-center fs-5">{{ current_user.username if current_user else
+                        '未登录'}}
+                        <span class="badge badge-light-success fw-bold fs-8 px-2 py-1 ms-2">{{ current_user.specialty if
+                            current_user else '未登录'}}</span>
                     </div>
-<!--                    <a href="#" class="fw-semibold text-muted text-hover-primary fs-7"></a>-->
+                    <!--                    <a href="#" class="fw-semibold text-muted text-hover-primary fs-7"></a>-->
                 </div>
             </div>
         </div>
@@ -29,4 +35,4 @@
             <a href="{{ url_for('auth.login') }}" class="menu-link px-5">注销登录</a>
         </div>
     </div>
-</div>
+</div>

+ 94 - 95
SourceCode/IntelligentRailwayCosting/app/views/templates/log/index.html

@@ -1,9 +1,7 @@
 {% extends "base/layout.html" %}
-
 {% block title %}日志查询{% endblock %}
-
 {% block page_content %}
- <div class="app-body-header h-50px">
+<div class="app-body-header h-50px">
     <h3>日志查询</h3>
     <ol class="breadcrumb breadcrumb-dot text-muted fs-6 fw-semibold ms-5">
         <li class="breadcrumb-item text-muted">日志查询</li>
@@ -16,25 +14,27 @@
             </div>
             <form class="search-box d-flex">
                 <div class="d-flex">
-                    <input type="text" class="form-control form-control-sm w-200px me-5" placeholder="请输入用户名" name="username" />
-                    <select class="form-select form-select-sm w-100 me-5" name="operationType" >
+                    <input type="text" class="form-control form-control-sm w-200px me-5" placeholder="请输入用户名"
+                        name="username" />
+                    <select class="form-select form-select-sm w-100 me-5" name="operationType">
                         <option value="">全部类型</option>
                         {% for op in operation_type_list %}
-                            <option value="{{ op }}">{{ op }}</option>
+                        <option value="{{ op }}">{{ op }}</option>
                         {% endfor %}
                     </select>
-                    <select class="form-select form-select-sm w-100 me-5" name="operationModule" >
+                    <select class="form-select form-select-sm w-100 me-5" name="operationModule">
                         <option value="">全部模块</option>
-                       {% for op in operation_module_list %}
-                            <option value="{{ op }}">{{ op }}</option>
+                        {% for op in operation_module_list %}
+                        <option value="{{ op }}">{{ op }}</option>
                         {% endfor %}
                     </select>
-                    <select class="form-select form-select-sm w-100 me-5" name="operationResult" >
+                    <select class="form-select form-select-sm w-100 me-5" name="operationResult">
                         <option value="">全部结果</option>
                         <option value="0">成功</option>
                         <option value="1">失败</option>
                     </select>
-                    <input type="text" class="form-control form-control-sm w-200px me-5" placeholder="请输入起始日期" name="date" id="date"/>
+                    <input type="text" class="form-control form-control-sm w-200px me-5" placeholder="请输入起始日期"
+                        name="date" id="date" />
                 </div>
                 <div class="btn-group ms-5">
                     <button type="button" class="btn btn-primary btn-sm" onclick="IwbTableSearch(this)">查询</button>
@@ -47,8 +47,6 @@
         <div class="pagination-row"></div>
     </div>
 </div>
-
-
 <div class="modal fade" id="modal" tabindex="-1" aria-hidden="true">
     <div class="modal-dialog modal-dialog-centered">
         <div class="modal-content rounded">
@@ -67,16 +65,18 @@
                         <input type="hidden" id="project_id" />
                         <div class="fv-row form-group mb-3">
                             <label for="project_name" class="form-label required">项目名称</label>
-                            <input type="text" class="form-control" name="project_name" id="project_name" placeholder="请输入" required />
+                            <input type="text" class="form-control" name="project_name" id="project_name"
+                                placeholder="请输入" required />
                         </div>
                         <div class="fv-row form-group mb-3">
                             <label for="project_desc" class="form-label">项目名称</label>
-                            <textarea type="text" class="form-control" name="project_desc" id="project_desc" placeholder="请输入" ></textarea>
+                            <textarea type="text" class="form-control" name="project_desc" id="project_desc"
+                                placeholder="请输入"></textarea>
                         </div>
                     </div>
                 </form>
             </div>
-             <div class="modal-footer">
+            <div class="modal-footer">
                 <button type="button" class="btn btn-light" data-bs-dismiss="modal">取消</button>
                 <button type="button" class="btn btn-primary" onclick="SaveProject()">保存</button>
             </div>
@@ -85,87 +85,86 @@
 </div>
 {% endblock %}
 {% block page_scripts %}
-    <script>
-        const table = '#table',
+<script>
+    const table = '#table',
         $modal = $("#modal");
-        ChangeHeadMenu("#{{page_active}}_menu")
-        $(function () {
-            InitRangeDate($('#date'))
-            IwbTable(table,{
-                url:'/api/log/list',
-                columns: [
-                    {
-                        title: 'ID',
-                        data: 'id',
-                        width: '80px'
-                    },
-                    {
-                        title: '用户名',
-                        data: 'username',
-                        width: '150px'
-                    },
-                    {
-                        title: '操作类型',
-                        data: 'operation_type',
-                        width: '120px',
-                        render: function (row) {
-                            let style = 'primary';
-                            if (row.operation_type === '新增'|| row.operation_type === '修改') {
-                                style = 'primary';
-                            } else if (row.operation_type === '删除') {
-                                style = 'danger';
-                            } else if (row.operation_type === '登录') {
-                               style = 'info';
-                            }else {
-                                style = 'success';
-                            }
-                            return `<span class="badge badge-${style}" title="${row.operation_type}">${row.operation_type}</span>`;
+    ChangeHeadMenu("#{{page_active}}_menu")
+    $(function () {
+        InitRangeDate($('#date'))
+        IwbTable(table, {
+            url: '/api/log/list',
+            columns: [
+                {
+                    title: 'ID',
+                    data: 'id',
+                    width: '80px'
+                },
+                {
+                    title: '用户名',
+                    data: 'username',
+                    width: '150px'
+                },
+                {
+                    title: '操作类型',
+                    data: 'operation_type',
+                    width: '120px',
+                    render: function (row) {
+                        let style = 'primary';
+                        if (row.operation_type === '新增' || row.operation_type === '修改') {
+                            style = 'primary';
+                        } else if (row.operation_type === '删除') {
+                            style = 'danger';
+                        } else if (row.operation_type === '登录') {
+                            style = 'info';
+                        } else {
+                            style = 'success';
                         }
-                    },
-                    {
-                        title: '操作模块',
-                        data: 'operation_model',
-                        width: '120px',
-                        render: function (row) {
-                            return `<span class="badge badge-primary" title="${row.operation_module}">${row.operation_module}</span>`;
+                        return `<span class="badge badge-${style}" title="${row.operation_type}">${row.operation_type}</span>`;
+                    }
+                },
+                {
+                    title: '操作模块',
+                    data: 'operation_model',
+                    width: '120px',
+                    render: function (row) {
+                        return `<span class="badge badge-primary" title="${row.operation_module}">${row.operation_module}</span>`;
+                    }
+                },
+                {
+                    title: '操作详情',
+                    data: 'description',
+                    width: 'auto',
+                    render: function (row) {
+                        const operation_data = row.operation_data ? row.operation_data : "";
+                        const data_changes = row.data_changes ? (operation_data ? '\n' : '') + row.data_changes : "";
+                        return `<span class="w-100" data-bs-toggle="tooltip" data-bs-placement="top"  title='${operation_data ? operation_data : ""}${data_changes ? data_changes : ""}'>${row.operation_desc}</span>`;
+                    }
+                },
+                {
+                    title: '操作IP',
+                    data: 'operation_ip',
+                    width: '180px'
+                },
+                {
+                    title: '操作结果',
+                    data: 'operation_result',
+                    width: '120px',
+                    render: function (row) {
+                        if (row.operation_result === 0) {
+                            return '<span class="badge badge-success">成功</span>';
+                        } else {
+                            return '<span class="badge badge-danger">失败</span>';
                         }
-                    },
-                    {
-                        title: '操作详情',
-                        data: 'description',
-                        width: 'auto',
-                        render: function (row) {
-                            const operation_data = row.operation_data ? row.operation_data : "";
-                            const data_changes = row.data_changes ? (operation_data? '\n': '')+ row.data_changes : "";
-                            return `<span class="w-100" data-bs-toggle="tooltip" data-bs-placement="top"  title='${operation_data ? operation_data:""}${data_changes ? data_changes:""}'>${row.operation_desc}</span>`;
-                        }
-                    },
-                    {
-                        title: '操作IP',
-                        data: 'operation_ip',
-                        width: '180px'
-                    },
-                    {
-                        title: '操作结果',
-                        data: 'operation_result',
-                        width: '120px',
-                        render: function (row) {
-                            if (row.operation_result === 0) {
-                                return '<span class="badge badge-success">成功</span>';
-                            } else {
-                                return '<span class="badge badge-danger">失败</span>';
-                            }
-                        }
-                    },
-                    {
-                        title: '操作时间',
-                        data: 'created_at',
-                        width: '180px'
-                    },
-                ]
-            })
-        });
-
-    </script>
+                    }
+                },
+                {
+                    title: '操作时间',
+                    data: 'created_at',
+                    width: '180px'
+                },
+            ]
+        })
+    });
 
+</script>
 {% endblock %}

+ 3 - 4
SourceCode/IntelligentRailwayCosting/app/views/templates/project/budget_info.html

@@ -26,7 +26,6 @@
 	ChangeHeadMenu('#{{page_active}}_menu')
 	const project_id = '{{project.project_id}}'
 </script>
-<script src="/static/project/quota_info.js"></script>
-<script src="/static/project/budget_info.js"></script>
-
-{% endblock %}
+<script src="{{ url_for('static', filename='project/quota_info.js') }}"></script>
+<script src="{{ url_for('static', filename='project/budget_info.js') }}"></script>
+{% endblock %}

+ 14 - 12
SourceCode/IntelligentRailwayCosting/app/views/templates/project/index.html

@@ -1,9 +1,7 @@
 {% extends "base/layout.html" %}
-
 {% block title %}项目管理{% endblock %}
-
 {% block page_content %}
- <div class="app-body-header h-50px">
+<div class="app-body-header h-50px">
     <h3>项目管理</h3>
     <ol class="breadcrumb breadcrumb-dot text-muted fs-6 fw-semibold ms-5">
         <li class="breadcrumb-item text-muted">项目管理</li>
@@ -17,8 +15,10 @@
             </div>
             <form class="search-box d-flex">
                 <div class="d-flex">
-                    <input type="text" class="form-control form-control-sm w-200px" placeholder="请输入关键字" name="keyword" />
-                    <input type="text" class="form-control form-control-sm w-200px ms-5" placeholder="请输入起始日期" name="date" id="date"/>
+                    <input type="text" class="form-control form-control-sm w-200px" placeholder="请输入关键字"
+                        name="keyword" />
+                    <input type="text" class="form-control form-control-sm w-200px ms-5" placeholder="请输入起始日期"
+                        name="date" id="date" />
                 </div>
                 <div class="btn-group ms-5">
                     <button type="button" class="btn btn-primary btn-sm" onclick="IwbTableSearch(this)">查询</button>
@@ -49,16 +49,18 @@
                         <input type="hidden" id="project_id" />
                         <div class="fv-row form-group mb-3">
                             <label for="project_name" class="form-label required">项目名称</label>
-                            <input type="text" class="form-control" name="project_name" id="project_name" placeholder="请输入" required />
+                            <input type="text" class="form-control" name="project_name" id="project_name"
+                                placeholder="请输入" required />
                         </div>
                         <div class="fv-row form-group mb-3">
                             <label for="project_desc" class="form-label">项目名称</label>
-                            <textarea type="text" class="form-control" name="project_desc" id="project_desc" placeholder="请输入" ></textarea>
+                            <textarea type="text" class="form-control" name="project_desc" id="project_desc"
+                                placeholder="请输入"></textarea>
                         </div>
                     </div>
                 </form>
             </div>
-             <div class="modal-footer">
+            <div class="modal-footer">
                 <button type="button" class="btn btn-light" data-bs-dismiss="modal">取消</button>
                 <button type="button" class="btn btn-primary" onclick="SaveProject()">保存</button>
             </div>
@@ -67,8 +69,8 @@
 </div>
 {% endblock %}
 {% block page_scripts %}
-    <script>
-        ChangeHeadMenu("#{{page_active}}_menu")
-    </script>
-    <script src="/static/project/project.js"></script>
+<script>
+    ChangeHeadMenu("#{{page_active}}_menu")
+</script>
+<script src="/static/project/project.js"></script>
 {% endblock %}

+ 10 - 60
SourceCode/IntelligentRailwayCosting/app/views/templates/project/quota_info.html

@@ -1,77 +1,27 @@
 {% extends "base/layout.html" %}
-
 {% block title %}定额输入管理{% endblock %}
 {% block page_head_plugins %}
 <link rel="stylesheet" href="{{ url_for('static', filename='base/plugins/jstree/jstree.bundle.css') }}" />
 <link rel="stylesheet" href="{{ url_for('static', filename='project/budget.css') }}" />
 {% endblock %}
 {% block page_content %}
- <div class="app-body-header h-50px">
+<div class="app-body-header h-50px">
     <h3>定额输入({{task.task_name}})</h3>
     <ol class="breadcrumb breadcrumb-dot text-muted fs-6 fw-semibold ms-5">
         <li class="breadcrumb-item"><a href="{{ url_for('project.index') }}" class="">项目管理</a></li>
-        <li class="breadcrumb-item"><a href="{{ url_for('project.budget_info',project_id=project.project_id) }}" class="">概算信息</a></li>
-		<li class="breadcrumb-item text-muted">定额输入</li>
+        <li class="breadcrumb-item"><a href="{{ url_for('project.budget_info',project_id=project.project_id) }}"
+                class="">概算信息</a></li>
+        <li class="breadcrumb-item text-muted">定额输入</li>
     </ol>
 </div>
 <div class="box w-100" id="body_box"></div>
-
-<!--<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">-->
-<!--        <div class="mx-10 my-5">-->
-<!--            <div class="table-box table-responsive">-->
-<!--                <section class="d-none">-->
-<!--                    <input type="hidden" name="project_id" value="{{project.project_id}}">-->
-<!--                    <input type="hidden" name="item_id" value="">-->
-<!--                    <input type="hidden" name="item_code" value="">-->
-<!--                </section>-->
-<!--                <div class="d-flex justify-content-between mb-5 mx-10">-->
-<!--                    <div>-->
-<!--        &lt;!&ndash;                <button class="btn btn-primary btn-sm" onclick="Add()">添加</button>&ndash;&gt;-->
-<!--                    </div>-->
-<!--                    <form class="search-box d-flex">-->
-<!--                        <div class="d-flex">-->
-<!--                            <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>-->
-<!--                            <select class="form-select form-select-sm me-5" name="budget_id">-->
-<!--                                    <option value="">全部概算单元</option>-->
-<!--                                    {% for budget in budgets %}-->
-<!--                                    <option value="{{ budget.budget_id }}">{{ budget.budget_code }}</option>-->
-<!--                                    {% endfor %}-->
-<!--                            </select>-->
-<!--                            <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">-->
-<!--                </table>-->
-<!--                <div class="pagination-row"></div>-->
-<!--            </div>-->
-<!--        </div>-->
-<!--    </div>-->
-<!--</div>-->
-
 {% endblock %}
 {% block page_scripts %}
-    <script src="{{ url_for('static', filename='base/plugins/jstree/jstree.bundle.js') }}"></script>
-    <script>
-        ChangeHeadMenu("#{{page_active}}_menu")
-	    const project_id = '{{project.project_id}}', task_id = '{{task.id}}'
-
-    </script>
-    <script src="/static/project/quota_info.js"></script>
+<script src="{{ url_for('static', filename='base/plugins/jstree/jstree.bundle.js') }}"></script>
+<script>
+    ChangeHeadMenu("#{{page_active}}_menu")
+    const project_id = '{{project.project_id}}', task_id = '{{task.id}}'
+</script>
+<script src="{{ url_for('static', filename='project/quota_info.js') }}"></script>
 
 {% endblock %}