|
|
@@ -1,78 +1,90 @@
|
|
|
<!DOCTYPE html>
|
|
|
-<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
|
|
+<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
|
|
<head>
|
|
|
- <th:block th:include="include :: header('修改车间管理')" />
|
|
|
+ <th:block th:include="include :: header('修改车间管理')"/>
|
|
|
</head>
|
|
|
<body class="white-bg">
|
|
|
- <div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
|
|
- <form class="form-horizontal m" id="form-workshop-edit" th:object="${twinWorkshop}">
|
|
|
- <h4 class="form-header h4">车间管理信息</h4>
|
|
|
- <input name="wsId" th:field="*{wsId}" type="hidden">
|
|
|
- <div class="form-group">
|
|
|
- <label class="col-sm-3 control-label">车间名称:</label>
|
|
|
- <div class="col-sm-8">
|
|
|
- <input name="wsName" th:field="*{wsName}" class="form-control" type="text">
|
|
|
- </div>
|
|
|
+<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
|
|
+ <form class="form-horizontal m" id="form-workshop-edit" th:object="${twinWorkshop}">
|
|
|
+ <h4 class="form-header h4">车间管理信息</h4>
|
|
|
+ <input name="wsId" th:field="*{wsId}" type="hidden">
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label is-required">车间编码:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <input name="wsCode" th:field="*{wsCode}" class="form-control" type="text" required>
|
|
|
</div>
|
|
|
- <div class="form-group">
|
|
|
- <label class="col-sm-3 control-label">备注:</label>
|
|
|
- <div class="col-sm-8">
|
|
|
- <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label is-required">车间名称:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <input name="wsName" th:field="*{wsName}" class="form-control" type="text" required>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">备注:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
|
|
|
</div>
|
|
|
- <h4 class="form-header h4">车间能源管理信息</h4>
|
|
|
- <div class="row">
|
|
|
- <div class="col-sm-12">
|
|
|
- <button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>
|
|
|
- <button type="button" class="btn btn-white btn-sm" onclick="sub.delRow()"><i class="fa fa-minus"> 删除</i></button>
|
|
|
- <div class="col-sm-12 select-table table-striped">
|
|
|
- <table id="bootstrap-table"></table>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+ <h4 class="form-header h4">车间能源管理信息</h4>
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-sm-12">
|
|
|
+ <button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i>
|
|
|
+ </button>
|
|
|
+ <div class="col-sm-12 select-table table-striped">
|
|
|
+ <table id="bootstrap-table"></table>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </form>
|
|
|
- </div>
|
|
|
- <th:block th:include="include :: footer" />
|
|
|
- <script th:inline="javascript">
|
|
|
- var prefix = ctx + "biz/workshop";
|
|
|
- var energyTypeDatas = [[${@dict.getType('energy_type')}]];
|
|
|
- $("#form-workshop-edit").validate({
|
|
|
- focusCleanup: true
|
|
|
- });
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+</div>
|
|
|
+<th:block th:include="include :: footer"/>
|
|
|
+<script th:inline="javascript">
|
|
|
+ var prefix = ctx + "biz/workshop";
|
|
|
+ var energyTypeDatas = [[${@dict.getType('energy_type')}]];
|
|
|
+ $("#form-workshop-edit").validate({
|
|
|
+ focusCleanup: true
|
|
|
+ });
|
|
|
|
|
|
- function submitHandler() {
|
|
|
- if ($.validate.form()) {
|
|
|
- $.operate.save(prefix + "/edit", $('#form-workshop-edit').serialize());
|
|
|
- }
|
|
|
+ function submitHandler() {
|
|
|
+ if ($.validate.form()) {
|
|
|
+ $.operate.save(prefix + "/edit", $('#form-workshop-edit').serialize());
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- $(function() {
|
|
|
- var options = {
|
|
|
- data: [[${twinWorkshop.twinWorkshopEnergyList}]],
|
|
|
- pagination: false,
|
|
|
- showSearch: false,
|
|
|
- showRefresh: false,
|
|
|
- showToggle: false,
|
|
|
- showColumns: false,
|
|
|
- sidePagination: "client",
|
|
|
- columns: [{
|
|
|
- checkbox: true
|
|
|
+ $(function () {
|
|
|
+ var options = {
|
|
|
+ data: [[${twinWorkshop.twinWorkshopEnergyList}]],
|
|
|
+ pagination: false,
|
|
|
+ showSearch: false,
|
|
|
+ showRefresh: false,
|
|
|
+ showToggle: false,
|
|
|
+ showColumns: false,
|
|
|
+ sidePagination: "client",
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ field: 'energyId',
|
|
|
+ title: '能源设备ID',
|
|
|
+ formatter: function (value, row, index) {
|
|
|
+ let html = "<input type='hidden' name='twinWorkshopEnergyList[" + index + "].energyId' value='" + value + "'>";
|
|
|
+ return html+value;
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
field: 'index',
|
|
|
align: 'center',
|
|
|
title: "序号",
|
|
|
formatter: function (value, row, index) {
|
|
|
- var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
|
|
|
- return columnIndex + $.table.serialNumber(index);
|
|
|
+ let columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
|
|
|
+ return columnIndex + $.table.serialNumber(index);
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
field: 'energyName',
|
|
|
align: 'center',
|
|
|
title: '能源设备名称',
|
|
|
- formatter: function(value, row, index) {
|
|
|
- var html = $.common.sprintf("<input class='form-control' type='text' name='twinWorkshopEnergyList[%s].energyName' value='%s'>", index, value);
|
|
|
+ formatter: function (value, row, index) {
|
|
|
+ let html= $.common.sprintf("<input class='form-control' type='text' name='twinWorkshopEnergyList[%s].energyName' value='%s'>", index, value);
|
|
|
return html;
|
|
|
}
|
|
|
},
|
|
|
@@ -82,7 +94,7 @@
|
|
|
align: 'center',
|
|
|
title: '能源设备类型',
|
|
|
width: 60,
|
|
|
- formatter: function(value, row, index) {
|
|
|
+ formatter: function (value, row, index) {
|
|
|
var name = $.common.sprintf("twinWorkshopEnergyList[%s].energyType", index);
|
|
|
return $.common.dictToSelect(energyTypeDatas, value, name);
|
|
|
}
|
|
|
@@ -92,7 +104,7 @@
|
|
|
align: 'center',
|
|
|
title: '能源设备路径',
|
|
|
width: 600,
|
|
|
- formatter: function(value, row, index) {
|
|
|
+ formatter: function (value, row, index) {
|
|
|
var html = $.common.sprintf("<input class='form-control' type='text' name='twinWorkshopEnergyList[%s].energyPath' value='%s'>", index, value);
|
|
|
return html;
|
|
|
}
|
|
|
@@ -101,35 +113,70 @@
|
|
|
field: 'energyCode',
|
|
|
align: 'center',
|
|
|
title: '字段编码',
|
|
|
- formatter: function(value, row, index) {
|
|
|
+ width: 300,
|
|
|
+ formatter: function (value, row, index) {
|
|
|
var html = $.common.sprintf("<input class='form-control' type='text' name='twinWorkshopEnergyList[%s].energyCode' value='%s'>", index, value);
|
|
|
return html;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
+ field: 'coefficient',
|
|
|
+ align: 'center',
|
|
|
+ title: '计算系数',
|
|
|
+ width: 60,
|
|
|
+ formatter: function (value, row, index) {
|
|
|
+ var html = $.common.sprintf("<input class='form-control' type='text' name='twinWorkshopEnergyList[%s].coefficient' value='%s'>", index, value);
|
|
|
+ return html;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
title: '操作',
|
|
|
align: 'center',
|
|
|
- formatter: function(value, row, index) {
|
|
|
+ formatter: function (value, row, index) {
|
|
|
var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
|
|
|
- return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
|
|
|
+ // return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.energyId + '\')"><i class="fa fa-remove"></i>删除</a>';
|
|
|
+ return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="delRow(\'' + value + '\',\'' + row.energyId + '\')"><i class="fa fa-remove"></i>删除</a>';
|
|
|
}
|
|
|
}]
|
|
|
- };
|
|
|
- $.table.init(options);
|
|
|
- });
|
|
|
+ };
|
|
|
+ $.table.init(options);
|
|
|
+ });
|
|
|
+
|
|
|
+ function delRow(value, energyId) {
|
|
|
+ table.set();
|
|
|
+ if (energyId) {
|
|
|
+ $.modal.confirm("确定删除该条信息吗?", function () {
|
|
|
+ var url = ctx + "biz/energy/remove";
|
|
|
+ var data = {"ids": energyId};
|
|
|
+ $.operate.submit(url, "post", "json", data);
|
|
|
+ var currentId = table.options.id;
|
|
|
+ sub.editRow();
|
|
|
+ $("#" + currentId).bootstrapTable('remove', {field: "index", values: [value]});
|
|
|
+ sub.editRow();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ var currentId = table.options.id;
|
|
|
+ sub.editRow();
|
|
|
+ $("#" + currentId).bootstrapTable('remove', {field: "index", values: [value]});
|
|
|
+ sub.editRow();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- function addRow() {
|
|
|
- var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
|
|
- var row = {
|
|
|
- index: $.table.serialNumber(count),
|
|
|
- energyName: "",
|
|
|
- energyType: "",
|
|
|
- energyPath: "",
|
|
|
- energyCode: "",
|
|
|
- remark: "",
|
|
|
- }
|
|
|
- sub.addRow(row);
|
|
|
+ function addRow() {
|
|
|
+ var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
|
|
+ var row = {
|
|
|
+ index: $.table.serialNumber(count),
|
|
|
+ energyId: "",
|
|
|
+ energyName: "",
|
|
|
+ energyType: "",
|
|
|
+ energyPath: "",
|
|
|
+ energyCode: "",
|
|
|
+ coefficient: "",
|
|
|
+ remark: "",
|
|
|
}
|
|
|
- </script>
|
|
|
+ sub.addRow(row);
|
|
|
+ }
|
|
|
+</script>
|
|
|
</body>
|
|
|
</html>
|