|
@@ -1,167 +1,161 @@
|
|
|
<!DOCTYPE html>
|
|
|
<html lang="en">
|
|
|
-<head>
|
|
|
- <meta charset="UTF-8">
|
|
|
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
- <title>设备列表</title>
|
|
|
- <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
|
|
|
- <style>
|
|
|
- .box_header .project_info{
|
|
|
- display: flex;
|
|
|
- justify-content: left;
|
|
|
- width: 60%;
|
|
|
- }
|
|
|
+ <head>
|
|
|
+ <meta charset="UTF-8" />
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
|
+ <title>设备列表</title>
|
|
|
+ <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}" />
|
|
|
+ <style>
|
|
|
+ .box_header .project_info {
|
|
|
+ display: flex;
|
|
|
+ justify-content: left;
|
|
|
+ align-items: center;
|
|
|
+ width: 60%;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+ <script src="{{ url_for('static', filename='utils.js') }}"></script>
|
|
|
+ <script src="{{ url_for('static', filename='project_item_list.js') }}"></script>
|
|
|
+ <script>
|
|
|
+ function searchData() {
|
|
|
+ var keyword = document.getElementById('search_input').value
|
|
|
+ window.location.href = `{{ url_for('project.project_item_list', project_id=project.id) }}?k=` + keyword
|
|
|
+ }
|
|
|
+ function reSearchData() {
|
|
|
+ window.location.href = `{{ url_for('project.project_item_list', project_id=project.id) }}`
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ <div class="box">
|
|
|
+ <div class="box_header">
|
|
|
+ <div class="project_info">
|
|
|
+ <button class="btn btn-info btn-large" onclick="goTo(`{{ url_for('project.project_list') }}`)">返回</button>
|
|
|
+ <h3 class="box_title">设备列表</h3>
|
|
|
+ <span class="separator">|</span>
|
|
|
+ <dl>
|
|
|
+ <dt>项目编号:</dt>
|
|
|
+ <dd>{{ project.project_no }}</dd>
|
|
|
+ </dl>
|
|
|
+ <dl>
|
|
|
+ <dt>项目名称:</dt>
|
|
|
+ <dd>{{ project.project_name }}</dd>
|
|
|
+ </dl>
|
|
|
+ <dl>
|
|
|
+ <dt>标准版本:</dt>
|
|
|
+ <dd>
|
|
|
+ {% if project.standard_version == '1' %}
|
|
|
+ <span class="label label-warning">旧版</span>
|
|
|
+ {% elif project.standard_version == '2' %}
|
|
|
+ <span class="label label-info">新版</span>
|
|
|
+ {% endif %}
|
|
|
+ </dd>
|
|
|
+ </dl>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="box_header">
|
|
|
+ <div class="btn_box">
|
|
|
+ <button class="btn btn-success btn-large" onclick="addNewItem('{{ project.id}}')">添加</button>
|
|
|
+ </div>
|
|
|
+ <div class="search_box">
|
|
|
+ <input type="text" id="search_input" class="form-control" placeholder="请输入查询关键字" value="{{ keyword }}" />
|
|
|
+ <button type="button" class="btn btn-info btn-large" onclick="searchData()">查询</button>
|
|
|
+ <button type="button" class="btn btn-warning btn-large" onclick="reSearchData()">重置</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
- </style>
|
|
|
- <script src="{{ url_for('static', filename='utils.js') }}"></script>
|
|
|
- <script src="{{ url_for('static', filename='project_item_list.js') }}"></script>
|
|
|
- <script>
|
|
|
- function searchData(){
|
|
|
- var keyword = document.getElementById('search_input').value;
|
|
|
- window.location.href = '{{ url_for('project.project_item_list', project_id=project.id) }}?k=' + keyword;
|
|
|
- }
|
|
|
- function reSearchData(){
|
|
|
- window.location.href = '{{ url_for('project.project_item_list', project_id=project.id) }}';
|
|
|
- }
|
|
|
- </script>
|
|
|
-</head>
|
|
|
-<body>
|
|
|
-<div class="box">
|
|
|
- <div class="box_header">
|
|
|
- <div class="project_info">
|
|
|
- <button class="btn btn-info btn-large" onclick="goTo('{{ url_for('project.project_list') }}')">返回</button>
|
|
|
- <h3 style="margin-left:20px">设备列表</h3>
|
|
|
- <span style="margin:0 20px">|</span>
|
|
|
- <dl>
|
|
|
- <dt>项目编号:</dt>
|
|
|
- <dd>{{ project.project_no }}</dd>
|
|
|
- </dl>
|
|
|
- <dl>
|
|
|
- <dt>项目名称:</dt>
|
|
|
- <dd>{{ project.project_name }}</dd>
|
|
|
- </dl>
|
|
|
- <dl>
|
|
|
- <dt>标准版本:</dt>
|
|
|
- <dd>
|
|
|
- {% if project.standard_version == '1' %}
|
|
|
- <span class="label label-warning">旧版</span>
|
|
|
- {% elif project.standard_version == '2' %}
|
|
|
- <span class="label label-info">新版</span>
|
|
|
- {% endif %}
|
|
|
- </dd>
|
|
|
- </dl>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="box_header">
|
|
|
- <div class="btn_box">
|
|
|
- <button class="btn btn-success btn-large" onclick="addNewItem('{{ project.id}}')">添加</button>
|
|
|
- </div>
|
|
|
- <div class="search_box">
|
|
|
- <input type="text" id="search_input" class="form-control" placeholder="请输入查询关键字" value="{{ keyword }}">
|
|
|
- <button type="button" class="btn btn-info btn-large" onclick="searchData()">查询</button>
|
|
|
- <button type="button" class="btn btn-warning btn-large" onclick="reSearchData()">重置</button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="box_body">
|
|
|
- <table class="table">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th width="25%">名称</th>
|
|
|
- <th>规格型号</th>
|
|
|
- <th width="200px">数量</th>
|
|
|
- <th width="8%">单位</th>
|
|
|
- <th width="15%">定额编号</th>
|
|
|
- <th width="180px">操作</th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody>
|
|
|
- {% if project_items %}
|
|
|
- {% for item in project_items %}
|
|
|
- <tr>
|
|
|
- <td class="name">{{ item.device_name }}</td>
|
|
|
- <td class="model">{{ item.device_model }}</td>
|
|
|
- <td class="editable count">
|
|
|
- <span class="show">{{ item.device_count if item.device_count else '-' }}</span>
|
|
|
- <span class="edit">
|
|
|
- <input type="text" class="form-control" value="{{ item.device_count if item.device_count else '' }}">
|
|
|
- </span>
|
|
|
- </td>
|
|
|
- <td class="editable unit">
|
|
|
- <span class="show">{{ item.device_unit if item.device_unit else '-' }}</span>
|
|
|
- <span class="edit">
|
|
|
- <input type="text" class="form-control" value="{{ item.device_unit if item.device_unit else '' }}">
|
|
|
- </span>
|
|
|
- </td>
|
|
|
- <td class="editable standard_no">
|
|
|
- <span class="show">{{ item.standard_no if item.standard_no else '-' }}</span>
|
|
|
- <span class="edit">
|
|
|
- <input type="text" class="form-control" value="{{ item.standard_no if item.standard_no else '' }}">
|
|
|
- </span>
|
|
|
- </td>
|
|
|
- <td class="editable tool">
|
|
|
- <span class="show">
|
|
|
- <button class="btn btn-info" onclick="toggleEditMode(this.parentNode.parentNode.parentNode)">编辑</button>
|
|
|
- <button class="btn btn-danger" onclick="confirmItemDelete('{{ item.id }}')">删除</button>
|
|
|
- </span>
|
|
|
- <span class="edit">
|
|
|
- <button class="btn btn-success" onclick="saveItemEdit(this.parentNode.parentNode.parentNode, '{{ item.id }}')">保存</button>
|
|
|
- <button class="btn btn-warning" onclick="cancelChanges(this.parentNode.parentNode.parentNode)">取消</button>
|
|
|
- </span>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- {% endfor %}
|
|
|
- {% else %}
|
|
|
- <tr>
|
|
|
- <td colspan="15">没有找到设备数据</td>
|
|
|
- </tr>
|
|
|
- {% endif %}
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
- <div class="pagination">
|
|
|
- <div class="pagination-info">
|
|
|
- {% set total_pages = (total_count|int + per_page|int - 1)//per_page %}
|
|
|
- <span class="page">
|
|
|
- 总共 {{ total_count }} 条数据,每页 {{ per_page }} 条,当前第 {{ page }} 页 / 共 {{ total_pages }} 页
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- <div class="pagination-links">
|
|
|
- {% if page > 1 %}
|
|
|
- <a class="page page-link" href="{{ url_for('project.project_item_list', project_id=project.id, k=keyword, p=1, pp=per_page) }}">首页</a>
|
|
|
- {% endif %}
|
|
|
- {% if page > 1 %}
|
|
|
- <a class="page page-link" href="{{ url_for('project.project_item_list', project_id=project.id, k=keyword, p=page-1, pp=per_page) }}">上一页</a>
|
|
|
- {% endif %}
|
|
|
- {% set start_page = [1, page - 2]|max %}
|
|
|
- {% set end_page = [total_pages, page + 2]|min %}
|
|
|
- {% if start_page > 1 %}
|
|
|
- <a class="page page-link" href="{{ url_for('project.project_item_list', project_id=project.id, k=keyword, p=1, pp=per_page) }}">1</a>
|
|
|
- {% if start_page > 2 %}
|
|
|
- <span class="page">...</span>
|
|
|
- {% endif %}
|
|
|
- {% endif %}
|
|
|
- {% for p in range(start_page, end_page + 1) %}
|
|
|
- {% if p == page %}
|
|
|
- <a class="page page-link active" href="{{ url_for('project.project_item_list', project_id=project.id, k=keyword, p=p, pp=per_page) }}" >{{ p }}</a>
|
|
|
- {% else %}
|
|
|
- <a class="page page-link" href="{{ url_for('project.project_item_list', project_id=project.id, k=keyword, p=p, pp=per_page) }}" >{{ p }}</a>
|
|
|
- {% endif %}
|
|
|
- {% endfor %}
|
|
|
- {% if end_page < total_pages %}
|
|
|
- {% if end_page < total_pages - 1 %}
|
|
|
- <span class="page">...</span>
|
|
|
- {% endif %}
|
|
|
- <a class="page page-link" href="{{ url_for('project.project_item_list', project_id=project.id, k=keyword, p=total_pages, pp=per_page) }}">{{ total_pages }}</a>
|
|
|
- {% endif %}
|
|
|
- {% if page < total_pages %}
|
|
|
- <a class="page page-link" href="{{ url_for('project.project_item_list', project_id=project.id, k=keyword, p=page+1, pp=per_page) }}">下一页</a>
|
|
|
- {% endif %}
|
|
|
- {% if page < total_pages %}
|
|
|
- <a class="page page-link" href="{{ url_for('project.project_item_list', project_id=project.id, k=keyword, p=total_pages, pp=per_page) }}">末页</a>
|
|
|
- {% endif %}
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-</div>
|
|
|
-</body>
|
|
|
-</html>
|
|
|
+ <div class="box_body">
|
|
|
+ <table class="table">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th width="25%">名称</th>
|
|
|
+ <th>规格型号</th>
|
|
|
+ <th width="200px">数量</th>
|
|
|
+ <th width="8%">单位</th>
|
|
|
+ <th width="15%">定额编号</th>
|
|
|
+ <th width="180px">操作</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ {% if project_items %} {% for item in project_items %}
|
|
|
+ <tr>
|
|
|
+ <td class="editable name">
|
|
|
+ <span class="show">{{ item.device_name if item.device_name else '-' }}</span>
|
|
|
+ <span class="edit">
|
|
|
+ <input type="text" class="form-control" title="设备名称" value="{{ item.device_name if item.device_name else '' }}" />
|
|
|
+ </span>
|
|
|
+ </td>
|
|
|
+ <td class="editable model">
|
|
|
+ <span class="show">{{ item.device_model if item.device_model else '-' }}</span>
|
|
|
+ <span class="edit">
|
|
|
+ <input type="text" class="form-control" title="设备规格型号" value="{{ item.device_model if item.device_model else '' }}" />
|
|
|
+ </span>
|
|
|
+ </td>
|
|
|
+ <td class="editable count">
|
|
|
+ <span class="show">{{ item.device_count if item.device_count else '-' }}</span>
|
|
|
+ <span class="edit">
|
|
|
+ <input type="text" class="form-control" title="设备数量" value="{{ item.device_count if item.device_count else '' }}" />
|
|
|
+ </span>
|
|
|
+ </td>
|
|
|
+ <td class="editable unit">
|
|
|
+ <span class="show">{{ item.device_unit if item.device_unit else '-' }}</span>
|
|
|
+ <span class="edit">
|
|
|
+ <input type="text" class="form-control" title="设备单位" value="{{ item.device_unit if item.device_unit else '' }}" />
|
|
|
+ </span>
|
|
|
+ </td>
|
|
|
+ <td class="editable standard_no">
|
|
|
+ <span class="show">{{ item.standard_no if item.standard_no else '-' }}</span>
|
|
|
+ <span class="edit">
|
|
|
+ <input type="text" class="form-control" title="设备定额编号" value="{{ item.standard_no if item.standard_no else '' }}" />
|
|
|
+ </span>
|
|
|
+ </td>
|
|
|
+ <td class="editable tool">
|
|
|
+ <span class="show">
|
|
|
+ <button class="btn btn-info" onclick="toggleEditMode(this.parentNode.parentNode.parentNode)">编辑</button>
|
|
|
+ <button class="btn btn-danger" onclick="confirmItemDelete('{{ item.id }}')">删除</button>
|
|
|
+ </span>
|
|
|
+ <span class="edit">
|
|
|
+ <button class="btn btn-success" onclick="saveItemEdit(this.parentNode.parentNode.parentNode, '{{ item.id }}')">保存</button>
|
|
|
+ <button class="btn btn-warning" onclick="cancelChanges(this.parentNode.parentNode.parentNode)">取消</button>
|
|
|
+ </span>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ {% endfor %} {% else %}
|
|
|
+ <tr>
|
|
|
+ <td colspan="15">没有找到设备数据</td>
|
|
|
+ </tr>
|
|
|
+ {% endif %}
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ <div class="pagination">
|
|
|
+ <div class="pagination-info">
|
|
|
+ {% set total_pages = (total_count|int + per_page|int - 1)//per_page %}
|
|
|
+ <span class="page"> 总共 {{ total_count }} 条数据,每页 {{ per_page }} 条,当前第 {{ page }} 页 / 共 {{ total_pages }} 页 </span>
|
|
|
+ </div>
|
|
|
+ <div class="pagination-links">
|
|
|
+ {% if page > 1 %}
|
|
|
+ <a class="page page-link" href="{{ url_for('project.project_item_list', project_id=project.id, k=keyword, p=1, pp=per_page) }}">首页</a>
|
|
|
+ {% endif %} {% if page > 1 %}
|
|
|
+ <a class="page page-link" href="{{ url_for('project.project_item_list', project_id=project.id, k=keyword, p=page-1, pp=per_page) }}">上一页</a>
|
|
|
+ {% endif %} {% set start_page = [1, page - 2]|max %} {% set end_page = [total_pages, page + 2]|min %} {% if start_page > 1 %}
|
|
|
+ <a class="page page-link" href="{{ url_for('project.project_item_list', project_id=project.id, k=keyword, p=1, pp=per_page) }}">1</a>
|
|
|
+ {% if start_page > 2 %}
|
|
|
+ <span class="page">...</span>
|
|
|
+ {% endif %} {% endif %} {% for p in range(start_page, end_page + 1) %} {% if p == page %}
|
|
|
+ <a class="page page-link active" href="{{ url_for('project.project_item_list', project_id=project.id, k=keyword, p=p, pp=per_page) }}">{{ p }}</a>
|
|
|
+ {% else %}
|
|
|
+ <a class="page page-link" href="{{ url_for('project.project_item_list', project_id=project.id, k=keyword, p=p, pp=per_page) }}">{{ p }}</a>
|
|
|
+ {% endif %} {% endfor %} {% if end_page < total_pages %} {% if end_page < total_pages - 1 %}
|
|
|
+ <span class="page">...</span>
|
|
|
+ {% endif %}
|
|
|
+ <a class="page page-link" href="{{ url_for('project.project_item_list', project_id=project.id, k=keyword, p=total_pages, pp=per_page) }}">{{ total_pages }}</a>
|
|
|
+ {% endif %} {% if page < total_pages %}
|
|
|
+ <a class="page page-link" href="{{ url_for('project.project_item_list', project_id=project.id, k=keyword, p=page+1, pp=per_page) }}">下一页</a>
|
|
|
+ {% endif %} {% if page < total_pages %}
|
|
|
+ <a class="page page-link" href="{{ url_for('project.project_item_list', project_id=project.id, k=keyword, p=total_pages, pp=per_page) }}">末页</a>
|
|
|
+ {% endif %}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </body>
|
|
|
+</html>
|