123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- <% include ./sub_menu.ejs %>
- <div class="panel-content">
- <div class="panel-title">
- <div class="title-main">
- <h2>API设置</h2>
- </div>
- </div>
- <div class="content-wrap">
- <div class="c-body">
- <div class="sjs-height-0">
- <nav class="nav nav-tabs m-3" role="tablist">
- <a class="nav-item nav-link active" data-toggle="tab" href="#user-purview" role="tab">业务配置</a>
- <a class="nav-item nav-link" data-toggle="tab" href="#user-list" role="tab">标段列表</a>
- </nav>
- <div class="m-3">
- <div class="tab-content">
- <div class="tab-pane active" id="user-purview">
- <div class="col-4">
- <legend>工序报验</legend>
- <table class="table table-hover table-bordered">
- <thead><tr><th>值</th><th>名称</th><th>允许计量</th><th>计量比例</th></tr></thead>
- <tbody id="gxby_list">
- <% for (const s of ctx.session.sessionProject.gxby_status) { %>
- <tr>
- <td><%- s.value %></td>
- <td><%- s.name %></td>
- <td>
- <div class="form-check form-check-inline">
- <input class="form-check-input" type="checkbox" id="inlineCheckbox-g<%- s.value %>" <% if (s.limit) { %>checked<% } %> status="<%- s.value %>" onchange="updateStatusLimit(this, 'gxby');">
- <label class="form-check-label" for="inlineCheckbox-g<%- s.value %>"></label>
- </div>
- </td>
- <% if (s.ratio === undefined) { %>
- <td>-</td>
- <% } else { %>
- <td>
- <div class="input-group input-group-sm" style="width:90px">
- <input type="number" class="form-control" max="100" min="0" step="2" value="<%- s.ratio || 0 %>" status="<%- s.value %>" onchange="updateStatusRatio(this, 'gxby');">
- <div class="input-group-append">
- <span class="input-group-text">%</span>
- </div>
- </div>
- </td>
- <% } %>
- </tr>
- <% } %>
- </tbody>
- </table>
- <legend>档案管理</legend>
- <table class="table table-hover table-bordered">
- <thead><tr><th>值</th><th>名称</th><th>允许计量</th><th>计量比例</th></tr></thead>
- <% for (const s of ctx.session.sessionProject.dagl_status) { %>
- <tbody id="dagl_list">
- <tr>
- <td><%- s.value %></td>
- <td><%- s.name %></td>
- <td>
- <div class="form-check form-check-inline">
- <input class="form-check-input" type="checkbox" id="inlineCheckbox-d<%- s.value %>" <% if (s.limit) { %>checked<% } %> status="<%- s.value %>" onchange="updateStatusLimit(this, 'dagl');">
- <label class="form-check-label" for="inlineCheckbox-d<%- s.value %>"></label>
- </div>
- </td>
- <% if (s.ratio === undefined) { %>
- <td>-</td>
- <% } else { %>
- <td>
- <div class="input-group input-group-sm" style="width:90px">
- <input type="number" class="form-control" max="100" min="0" step="2" value="<%- s.ratio || 0 %>" status="<%- s.value %>" onchange="updateStatusRatio(this, 'dagl');">
- <div class="input-group-append">
- <span class="input-group-text">%</span>
- </div>
- </div>
- </td>
- <% } %>
- </tr>
- <% } %>
- </tbody>
- </table>
- </div>
- </div>
- <div class="tab-pane" id="user-list">
- <!--没有标段数据-->
- <% if (tenders.length === 0) { %>
- <div class="jumbotron m-3">
- <h3 class="display-6">没有标段数据</h3>
- </div>
- <% } else { %>
- <table class="table table-hover table-bordered">
- <thead>
- <tr>
- <th class="text-center" >名称</th>
- <th class="text-center" >计量模式</th>
- <th class="text-center" >计量期数</th>
- <th class="text-center" >创建人</th>
- <th class="text-center" >标段创建时间/期审批时间</th>
- <th class="text-center">工序报验</th>
- <th class="text-center">档案管理</th>
- </tr>
- </thead>
- <% for (const t of tenders) { %>
- <tr tid="<%- t.id %>">
- <td><%- t.name %></td>
- <td><%- t.measure_type_str %></td>
- <td><%- t.stage_count_str %></td>
- <td><%- t.user_str %></td>
- <td><%- ctx.moment(t.show_time).format('YYYY-MM-DD HH:mm:ss') %></td>
- <td class="text-center">
- <div class="form-check form-check-inline">
- <input class="form-check-input" type="checkbox" id="inlineCheckbox1" <% if (t.s2b_gxby_check) { %>checked<% } %> name="gxby_check" onchange="updateS2bSetting(this);" value="<%- t.s2b_gxby_check %>">
- <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
- <label class="form-check-label" for="inlineCheckbox1">检查计量</label>
- </div>
- <div class="form-check form-check-inline">
- <input class="form-check-input" type="checkbox" id="inlineCheckbox2" <% if (t.s2b_gxby_limit) { %>checked<% } %> name="gxby_limit" onchange="updateS2bSetting(this);" value="<%- t.s2b_gxby_limit %>">
- <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
- <label class="form-check-label" for="inlineCheckbox2">限制上报</label>
- </div>
- </td>
- <td class="text-center">
- <div class="form-check form-check-inline">
- <input class="form-check-input" type="checkbox" id="inlineCheckbox3" <% if (t.s2b_dagl_check) { %>checked<% } %> name="dagl_check" onchange="updateS2bSetting(this);" value="<%- t.s2b_dagl_check %>">
- <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
- <label class="form-check-label" for="inlineCheckbox3">检查计量</label>
- </div>
- <div class="form-check form-check-inline">
- <input class="form-check-input" type="checkbox" id="inlineCheckbox4" <% if (t.s2b_dagl_limit) { %>checked<% } %> name="dagl_limit" onchange="updateS2bSetting(this);" value="<%- t.s2b_dagl_limit %>">
- <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
- <label class="form-check-label" for="inlineCheckbox4">限制上报</label>
- </div>
- </td>
- </tr>
- <% } %>
- </table>
- <% } %>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script>
- const updateStatusLimit = function (obj, type) {
- const data = { type };
- data.status = parseInt(obj.getAttribute('status'));
- data.limit = obj.checked;
- postData('api/update-status', data, function(result) {
- }, function () {
- obj.checked = !obj.checked;
- });
- }
- const updateStatusRatio = function (obj, type) {
- const data = { type };
- data.status = parseInt(obj.getAttribute('status'));
- try {
- data.ratio = parseFloat(obj.value);
- if (data.ratio > 100 || data.ratio < 0) throw '请输入0-100间的数字';
- } catch (error) {
- toastr.warning('请输入0-100间的数字');
- return;
- }
- postData('api/update-status', data, function(result) {
- obj.org = result.ratio;
- obj.value = result.ratio;
- }, function () {
- obj.value = obj.org;
- });
- }
- const updateS2bSetting = function (obj) {
- try {
- const name = obj.getAttribute('name');
- const tid = parseInt(obj.parentNode.parentNode.parentNode.getAttribute('tid'));
- if (!name) return;
- const data = { tid };
- data[name] = obj.checked;
- postData('api/update', data, function() {
- obj.setAttribute('value', obj.checked);
- }, function () {
- obj.checked = obj.getAttribute('value') === true;
- })
- } catch (err) {
- obj.checked = obj.getAttribute('value') === true;
- }
- }
- $(() => {
- autoFlashHeight();
- })
- </script>
|