From f467836d9160df8d3446864408d126e87199d3f0 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期五, 02 六月 2023 16:06:20 +0800
Subject: [PATCH] #平库库位初始化
---
src/main/webapp/static/js/node/node.js | 368 ++++++++++++++++++++++++
src/main/webapp/views/node/node.html | 355 ++++-------------------
src/main/java/com/zy/asrs/controller/NodeController.java | 79 +++++
src/main/java/com/zy/asrs/entity/Node.java | 28 -
src/main/java/com/zy/asrs/entity/param/NodeInitPatam.java | 31 ++
5 files changed, 544 insertions(+), 317 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/NodeController.java b/src/main/java/com/zy/asrs/controller/NodeController.java
index c1eca92..9e5ad27 100644
--- a/src/main/java/com/zy/asrs/controller/NodeController.java
+++ b/src/main/java/com/zy/asrs/controller/NodeController.java
@@ -13,14 +13,20 @@
import com.core.common.DateUtils;
import com.core.common.R;
import com.core.exception.CoolException;
+import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.ManLocDetl;
import com.zy.asrs.entity.Node;
import com.zy.asrs.entity.param.InitPakoutParam;
+import com.zy.asrs.entity.param.LocMastInitParam;
+import com.zy.asrs.entity.param.NodeInitPatam;
import com.zy.asrs.entity.param.PakinParam;
+import com.zy.asrs.entity.result.KeyValueVo;
import com.zy.asrs.mapper.ManLocDetlMapper;
import com.zy.asrs.service.NodeService;
import com.zy.common.entity.NodeExcel;
import com.zy.common.entity.NodeExcelListener;
+import com.zy.common.entity.Parameter;
+import com.zy.common.model.Shelves;
import com.zy.common.utils.ListUtils;
import com.zy.common.utils.NodeUtils;
import com.zy.common.utils.TreeUtils;
@@ -337,4 +343,77 @@
return R.ok(node);
}
+ @RequestMapping(value = "/node/init/auth")
+ @ManagerAuth(memo = "鍒濆鍖栧簱浣�")
+// @Transactional
+ public R init(NodeInitPatam param) {
+ List<Node> list = new ArrayList<>();
+ EntityWrapper<Node> nodeEntityWrapper = new EntityWrapper<>();
+ nodeEntityWrapper.eq("id",param.getValue());
+ nodeEntityWrapper.eq("name",param.getName());
+ Node node = nodeService.selectOne(nodeEntityWrapper);
+ for (int r=param.getStartRow(); r<=param.getEndRow(); r++){
+ for (int b=param.getStartBay(); b<=param.getEndBay(); b++) {
+ for (int l=param.getStartLev(); l<=param.getEndLev(); l++) {
+ // 鑾峰彇搴撲綅鍙�
+ String locNo = String.format("%02d", r) + String.format("%02d", b) + String.format("%02d", l);
+
+ Date now = new Date();
+ Node node1 = new Node();
+ node1.setUuid(locNo);
+ node1.setName(locNo);
+ node1.setParentId(node.getId());
+ node1.setParentName(node.getName());
+ node1.setType(3);
+ node1.setPath(node.getPath()+","+node.getId());
+ node1.setNamePath(node.getNamePath()+","+node.getName());
+ node1.setLevel(3);
+ node1.setStatus(1);
+ node1.setCreateBy(getUserId());
+ node1.setCreateTime(now);
+ node1.setUpdateBy(getUserId());
+ node1.setUpdateTime(now);
+ node1.setRow1(r);
+ node1.setBay1(b);
+ node1.setLev1(l);
+ if (!nodeService.insert(node1)){
+ return R.error("鏁版嵁鎻掑叆澶辫触");
+ }
+
+ }
+ }
+ }
+//
+// nodeService.delete(new EntityWrapper<Node>().eq("parent_id",param.getValue()));
+
+// if (nodeService.insertBatch(list)){
+// return R.error("鏁版嵁鎻掑叆澶辫触");
+// }
+ return R.ok("鍒濆鍖栨垚鍔�");
+ }
+
+ @RequestMapping(value = "/node/init/pwd")
+ public R locMastInitPwd(@RequestParam(required = false) String pwd) {
+ if (Cools.isEmpty(pwd)) {
+ return R.error("璇疯緭鍏ュ彛浠�");
+ }
+ return R.ok().add(Parameter.get().getLocMastInitPwd().equals(pwd));
+ }
+
+ @RequestMapping(value = "/node/all/get/loc")
+ public R getarea(){
+ EntityWrapper<Node> nodeEntityWrapper = new EntityWrapper<>();
+ nodeEntityWrapper.eq("type",2);
+ List<Node> list = nodeService.selectList(nodeEntityWrapper);
+ List<KeyValueVo> keyValueVoList = new ArrayList<>();
+ for (Node node : list){
+ KeyValueVo vo = new KeyValueVo();
+ vo.setName(node.getName());
+ vo.setValue(node.getId());
+ keyValueVoList.add(vo);
+ }
+ return R.ok(keyValueVoList);
+
+ }
+
}
diff --git a/src/main/java/com/zy/asrs/entity/Node.java b/src/main/java/com/zy/asrs/entity/Node.java
index f408751..7bb77ec 100644
--- a/src/main/java/com/zy/asrs/entity/Node.java
+++ b/src/main/java/com/zy/asrs/entity/Node.java
@@ -11,11 +11,12 @@
import com.zy.system.service.HostService;
import com.zy.system.service.UserService;
import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
-
+@Data
@TableName("man_node")
public class Node implements Serializable {
private static final long serialVersionUID = 1L;
@@ -24,7 +25,7 @@
* ID
*/
@ApiModelProperty(value= "ID")
- @TableId(value = "id", type = IdType.AUTO)
+ @TableId(type = IdType.AUTO)
private Long id;
/**
@@ -165,29 +166,8 @@
@ApiModelProperty(value= "澶囨敞")
private String memo;
- public Node() {}
- public Node(Long hostId, String uuid,String name,Long parentId,String parentName,Integer type,String path,String namePath,Integer level,String leading,Integer sort,String barcode,Integer major,Integer status,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo) {
- this.hostId = hostId;
- this.uuid = uuid;
- this.name = name;
- this.parentId = parentId;
- this.parentName = parentName;
- this.type = type;
- this.path = path;
- this.namePath = namePath;
- this.level = level;
- this.leading = leading;
- this.sort = sort;
- this.barcode = barcode;
- this.major = major;
- this.status = status;
- this.createTime = createTime;
- this.createBy = createBy;
- this.updateTime = updateTime;
- this.updateBy = updateBy;
- this.memo = memo;
- }
+
// Node node = new Node(
// null, // 缂栧彿
diff --git a/src/main/java/com/zy/asrs/entity/param/NodeInitPatam.java b/src/main/java/com/zy/asrs/entity/param/NodeInitPatam.java
new file mode 100644
index 0000000..83662ed
--- /dev/null
+++ b/src/main/java/com/zy/asrs/entity/param/NodeInitPatam.java
@@ -0,0 +1,31 @@
+package com.zy.asrs.entity.param;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class NodeInitPatam {
+
+ private Integer startRow;
+
+ // 缁堟鎺�
+ private Integer endRow;
+
+ // 璧峰鍒�
+ private Integer startBay;
+
+ // 缁堟鍒�
+ private Integer endBay;
+
+ // 璧峰灞�
+ private Integer startLev;
+
+ // 缁堟灞�
+ private Integer endLev;
+
+ private Integer value;
+
+ private String name;
+
+}
diff --git a/src/main/webapp/static/js/node/node.js b/src/main/webapp/static/js/node/node.js
new file mode 100644
index 0000000..36cd056
--- /dev/null
+++ b/src/main/webapp/static/js/node/node.js
@@ -0,0 +1,368 @@
+var insTb;
+var admin;
+var areas;
+var matXmSelect;
+layui.config({
+ base: baseUrl + "/static/layui/lay/modules/"
+}).extend({
+ dropdown: 'dropdown/dropdown',
+}).use(['form','treeTable', 'admin', 'xmSelect', 'dropdown', 'element'], function() {
+ var $ = layui.jquery;
+ var layer = layui.layer;
+ var form = layui.form;
+ admin = layui.admin;
+ var treeTable = layui.treeTable;
+ var xmSelect = layui.xmSelect;
+ var tbDataList = [];
+
+ insTb = treeTable.render({
+ elem: '#node',
+ url: baseUrl+'/node/list/tree/auth',
+ headers: {token: localStorage.getItem('token')},
+ height: 'full-200',
+ toolbar: '#toolbar',
+ tree: {
+ iconIndex: 2, // 鎶樺彔鍥炬爣鏄剧ず鍦ㄧ鍑犲垪
+ isPidData: true, // 鏄惁鏄痠d銆乸id褰㈠紡鏁版嵁
+ idName: 'id', // id瀛楁鍚嶇О
+ pidName: 'parentId' // pid瀛楁鍚嶇О
+ },
+ cols: [[
+ {type: 'checkbox'},
+ {type: 'numbers'}
+ ,{field: 'name', align: 'left',title: '缂栧彿/鍚嶇О', minWidth: 150}
+ // ,{field: 'uuid', left: 'center',title: '缂栧彿/鍚嶇О', minWidth: 150}
+ ,{field: 'type$', align: 'center',title: '绫诲瀷', templet: '#typeTpl'}
+ // ,{field: 'leading', align: 'center',title: '璐熻矗浜�'}
+ // ,{field: 'img', align: 'center',title: '鍥剧墖', hide: true}
+ // ,{field: 'brief', align: 'center',title: '绠�瑕佹弿杩�'}
+ // ,{field: 'count', align: 'center',title: '鏁伴噺'}
+ // ,{field: 'sort', align: 'center',title: '鎺掑簭'}
+ ,{field: 'status$', align: 'center',title: '鐘舵��', hide: true}
+ ,{field: 'row1$', align: 'center',title: '鎺�'}
+ ,{field: 'bay1$', align: 'center',title: '鍒�'}
+ ,{field: 'lev1$', align: 'center',title: '灞�'}
+ ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'}
+ ,{field: 'updateBy$', align: 'center',title: '淇敼浜哄憳'}
+ ,{field: 'memo', align: 'center',title: '澶囨敞', hide: true}
+
+ ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:150}
+ ]],
+ done: function (data) {
+ console.log(data)
+ $('.ew-tree-table-box').css('height', '100%');
+ insTb.expandAll();
+ tbDataList = data;
+ }
+ });
+
+ /* 琛ㄦ牸澶村伐鍏锋爮鐐瑰嚮浜嬩欢 */
+ treeTable.on('toolbar(node)', function (obj) {
+ var checkRows = insTb.checkStatus();
+ if (obj.event === 'add') { // 娣诲姞
+ showEditModel();
+ } else if (obj.event === 'del') { // 鍒犻櫎
+ if (checkRows.length === 0) {
+ layer.msg('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁', {icon: 2});
+ return;
+ }
+ var ids = checkRows.map(function (d) {
+ if (!d.LAY_INDETERMINATE) {
+ return d.id;
+ } else {
+ return null;
+ }
+ });
+ doDel({ids: ids});
+ } else if (obj.event === 'printBatch') {
+ if (checkRows.length === 0) {
+ layer.msg('璇烽�夋嫨瑕佹墦鍗扮殑鏁版嵁', {icon: 2});
+ return;
+ }
+ var printContent = checkRows.map(function (d) {
+ if (!d.LAY_INDETERMINATE && d.type === 3) {
+ return d.name;
+ } else {
+ return null;
+ }
+ });
+ printBatch(printContent, 1);
+ }else if (obj.event === 'nodeInit'){
+ nodeInit();
+ }
+ });
+
+ /* 琛ㄦ牸鎿嶄綔鍒楃偣鍑讳簨浠� */
+ treeTable.on('tool(node)', function (obj) {
+ if (obj.event === 'edit') { // 淇敼
+ showEditModel(obj.data);
+ } else if (obj.event === 'del') { // 鍒犻櫎
+ doDel(obj);
+ }
+ });
+
+ /* 鏄剧ず琛ㄥ崟寮圭獥 */
+ function showEditModel(mData) {
+ admin.open({
+ type: 1,
+ area: '600px',
+ title: (mData ? '淇敼' : '娣诲姞') + '璐т綅',
+ content: $('#editDialog').html(),
+ success: function (layero, dIndex) {
+ // 鍥炴樉琛ㄥ崟鏁版嵁
+ form.val('detail', mData);
+ // 琛ㄥ崟鎻愪氦浜嬩欢
+ form.on('submit(editSubmit)', function (data) {
+ data.field.parentId = insXmSel.getValue('valueStr');
+ var loadIndex = layer.load(2);
+ $.ajax({
+ url: baseUrl+"/node/"+(mData?'update':'add')+"/auth",
+ headers: {'token': localStorage.getItem('token')},
+ data: data.field,
+ method: 'POST',
+ success: function (res) {
+ layer.close(loadIndex);
+ if (res.code === 200){
+ layer.close(dIndex);
+ layer.msg(res.msg, {icon: 1});
+ insTb.refresh();
+ } else if (res.code === 403){
+ top.location.href = baseUrl+"/";
+ }else {
+ layer.msg(res.msg, {icon: 2});
+ }
+ }
+ })
+ return false;
+ });
+ // 娓叉煋涓嬫媺鏍�
+ var insXmSel = xmSelect.render({
+ el: '#nodeParentSel',
+ height: '250px',
+ data: insTb.options.data,
+ initValue: mData ? [mData.parentId] : [],
+ model: {label: {type: 'text'}},
+ prop: {
+ name: 'name',
+ value: 'id'
+ },
+ radio: true,
+ clickClose: true,
+ tree: {
+ show: true,
+ indent: 15,
+ strict: false,
+ expandedKeys: true
+ }
+ });
+ // 寮圭獥涓嶅嚭鐜版粴鍔ㄦ潯
+ $(layero).children('.layui-layer-content').css('overflow', 'visible');
+ layui.form.render('select');
+ }
+ });
+ }
+
+ /* 鍒犻櫎 */
+ function doDel(obj) {
+ layer.confirm('纭畾瑕佸垹闄ら�変腑鏁版嵁鍚楋紵', {
+ skin: 'layui-layer-admin',
+ shade: .1
+ }, function (i) {
+ layer.close(i);
+ var loadIndex = layer.load(2);
+ var ids;
+ if (obj.data) {
+ ids = [];
+ ids[0] = obj.data.id;
+ } else {
+ ids = obj.ids;
+ }
+ $.ajax({
+ url: baseUrl+"/node/delete0/auth",
+ headers: {'token': localStorage.getItem('token')},
+ data: {ids: ids},
+ method: 'POST',
+ success: function (res) {
+ layer.close(loadIndex);
+ if (res.code === 200){
+ layer.msg(res.msg, {icon: 1});
+ insTb.refresh();
+ } else if (res.code === 403){
+ top.location.href = baseUrl+"/";
+ } else {
+ layer.msg(res.msg, {icon: 2});
+ }
+ }
+ })
+ });
+ }
+
+ // 鎵归噺鎵撳嵃
+ function printBatch(printMsgList, type) {
+ var data = [];
+ for (var i = 0; i<printMsgList.length; i ++) {
+ if (printMsgList[i] != null && printMsgList[i] !== '') {
+ var barcodeUrl;
+ if (type === 1) {
+ barcodeUrl = baseUrl+"/barcode/qrcode/auth?type="+type+"¶m="+printMsgList[i]+"&width="+200+"&height="+70;
+ } else {
+ barcodeUrl = baseUrl+"/barcode/qrcode/auth?type="+type+"¶m="+printMsgList[i]+"&width="+400+"&height="+180;
+ }
+ data.push({
+ item: printMsgList[i],
+ barcodeUrl: barcodeUrl
+ })
+ }
+ }
+ var tpl = $('#locPrintTpl').html();
+ var template = Handlebars.compile(tpl);
+ var html = template({data: data});
+ var box = $("#printBox");
+ box.html(html);
+ box.show();
+ box.print({mediaPrint:true});
+ box.hide();
+ }
+
+
+ function nodeInit(){
+ layer.prompt({title: '璇疯緭鍏ュ彛浠わ紝骞堕噸缃簱浣�', formType: 1, shadeClose: true}, function(pass, idx){
+ http.get(baseUrl+"/node/init/pwd", {pwd: pass}, function (res) {
+ if (res.data) {
+ layer.open({
+ type: 1,
+ title: '鍒濆鍖栧簱浣�',
+ area: ["400px"],
+ maxmin: true,
+ shadeClose: true,
+ content: $("#resetLocDiv"),
+ success: function (layero, index) {
+
+
+ // 娓叉煋鐗╂枡閫夋嫨
+ matXmSelect = xmSelect.render({
+ el: '#mat',
+ style: {
+ width: '200px' ,
+ height: 'auto'
+ },
+ autoRow: true,
+ toolbar: { show: true },
+ filterable: true,
+ remoteSearch: true,
+ radio: true,
+ clickClose: true,
+ remoteMethod: function(val, cb, show){
+ $.ajax({
+ url: baseUrl+"/node/all/get/loc",
+ headers: {'token': localStorage.getItem('token')},
+ method: 'POST',
+ success: function (res) {
+ if (res.code === 200){
+ cb(res.data)
+ } else {
+ cb([]);
+ layer.msg(res.msg, {icon: 2});
+ }
+ }
+ });
+ }
+ })
+ }
+ })
+ } else {
+ layer.msg("鍙d护閿欒");
+ }
+ layer.close(idx);
+ })
+ });
+ }
+
+ // 鍒濆鍖栦繚瀛�
+ form.on('submit(initDo)', function (data) {
+ areas = matXmSelect.getValue();
+ data.field.value = areas[0].value;
+ data.field.name = areas[0].name;
+ console.log(data.field);
+ $.ajax({
+ url: baseUrl+"/node/init/auth",
+ headers: {'token': localStorage.getItem('token')},
+ data: data.field,
+ method: 'POST',
+ async: false,
+ success: function (res) {
+ if (res.code === 200){
+ layer.msg(res.msg);
+ layer.closeAll();
+ // tableReload(false);
+ } else if (res.code === 403){
+ parent.location.href = "/";
+ }else {
+ layer.msg(res.msg)
+ }
+ }
+ })
+ });
+
+
+
+});
+
+// excel瀵煎叆妯℃澘涓嬭浇
+function excelMouldDownload(){
+ layer.load(1, {shade: [0.1,'#fff']});
+ location.href = baseUrl + "/node/excel/import/mould";
+ layer.closeAll('loading');
+}
+
+// excel瀵煎叆
+function importExcel() {
+ $("#importExcel").trigger("click");
+}
+function upload(obj){
+ if(!obj.files) {
+ return;
+ }
+ var file = obj.files[0];
+ admin.confirm('纭鍚屾 [' + file.name +'] 鏂囦欢鍚楋紵', function (index) {
+ layer.load(1, {shade: [0.1,'#fff']});
+ var url = baseUrl + "/node/excel/import/auth";
+ var form = new FormData();
+ form.append("file", file);
+ xhr = new XMLHttpRequest();
+ xhr.open("post", url, true); //post鏂瑰紡锛寀rl涓烘湇鍔″櫒璇锋眰鍦板潃锛宼rue 璇ュ弬鏁拌瀹氳姹傛槸鍚﹀紓姝ュ鐞嗐��
+ xhr.setRequestHeader('token', localStorage.getItem('token'));
+ xhr.onload = uploadComplete; //璇锋眰瀹屾垚
+ xhr.onerror = uploadFailed; //璇锋眰澶辫触
+ xhr.onloadend = function () { // // 涓婁紶瀹屾垚閲嶇疆鏂囦欢娴�
+ layer.closeAll('loading');
+ $("#importExcel").val("");
+ };
+ // xhr.upload.onprogress = progressFunction;//銆愪笂浼犺繘搴﹁皟鐢ㄦ柟娉曞疄鐜般��
+ xhr.upload.onloadstart = function(){//涓婁紶寮�濮嬫墽琛屾柟娉�
+ ot = new Date().getTime(); //璁剧疆涓婁紶寮�濮嬫椂闂�
+ oloaded = 0;//璁剧疆涓婁紶寮�濮嬫椂锛屼互涓婁紶鐨勬枃浠跺ぇ灏忎负0
+ };
+ xhr.send(form);
+ }, function(index){
+ $("#importExcel").val("");
+ });
+}
+function uploadComplete(evt) {
+ var res = JSON.parse(evt.target.responseText);
+ if(res.code === 200) {
+ layer.msg(res.msg, {icon: 1});
+ insTb.refresh();
+ } else {
+ layer.msg(res.msg, {icon: 2});
+ }
+}
+function uploadFailed(evt) {
+ var res = JSON.parse(evt.target.responseText);
+ layer.msg(res.msg, {icon: 2});
+}
+
+// excel瀵煎嚭
+function exportExcel() {
+
+}
\ No newline at end of file
diff --git a/src/main/webapp/views/node/node.html b/src/main/webapp/views/node/node.html
index 91d2c76..b049dd7 100644
--- a/src/main/webapp/views/node/node.html
+++ b/src/main/webapp/views/node/node.html
@@ -35,20 +35,8 @@
<button lay-event="add" class="layui-btn layui-btn-sm layui-btn-normal icon-btn"><i class="layui-icon"></i>娣诲姞</button>
<button lay-event="del" class="layui-btn layui-btn-sm layui-btn-danger icon-btn"><i class="layui-icon"></i>鍒犻櫎</button>
<button class="layui-btn layui-btn-sm" id="btn-print-batch" lay-event="printBatch">鎵归噺鎵撳嵃</button>
- <!-- 鍟嗗搧/鐗╂枡 鏁版嵁涓績 -->
- <div class="dropdown-menu" style="margin-left: 0">
- <button class="layui-btn layui-btn-sm icon-btn layui-btn-primary" style="margin-top: 2px"> 鏁版嵁鍚屾 <i class="layui-icon layui-icon-drop"></i></button>
- <ul class="dropdown-menu-nav dark">
- <div class="dropdown-anchor"></div>
- <li class="title">1st menu</li>
- <li><a onclick="excelMouldDownload()" style="font-size: 12px"><i class="layui-icon layui-icon-template-1"></i>妯℃澘涓嬭浇</a></li>
- <li><a onclick="importExcel()" style="font-size: 12px"><i class="layui-icon layui-icon-upload"></i>瀵煎叆 Excel</a></li>
- <li style="display: none"><input id="importExcel" type="file" onchange="upload(this)" ></li>
- <hr>
- <li class="title">2nd menu</li>
- <li><a onclick="exportExcel()" style="font-size: 12px"><i class="layui-icon layui-icon-export"></i>瀵煎嚭 Excel</a></li>
- </ul>
- </div>
+ <button class="layui-btn layui-btn-sm layui-btn-warm" id="btn-node-init" lay-event="nodeInit">搴撲綅鍒濆鍖�</button>
+
</div>
</script>
@@ -143,292 +131,73 @@
<script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
+<script type="text/javascript" src="../../static/js/node/node.js" charset="utf-8"></script>
-<script>
- var insTb;
- var admin;
- layui.config({
- base: baseUrl + "/static/layui/lay/modules/"
- }).extend({
- dropdown: 'dropdown/dropdown',
- }).use(['form','treeTable', 'admin', 'xmSelect', 'dropdown', 'element'], function() {
- var $ = layui.jquery;
- var layer = layui.layer;
- var form = layui.form;
- admin = layui.admin;
- var treeTable = layui.treeTable;
- var xmSelect = layui.xmSelect;
- var tbDataList = [];
+<!-- 閲嶇疆搴撲綅寮圭獥 -->
+<div id="resetLocDiv" style="margin: 20px 0 10px 30px; display: none">
+ <div class="layui-form layui-form-pane">
- insTb = treeTable.render({
- elem: '#node',
- url: baseUrl+'/node/list/tree/auth',
- headers: {token: localStorage.getItem('token')},
- height: 'full-200',
- toolbar: '#toolbar',
- tree: {
- iconIndex: 2, // 鎶樺彔鍥炬爣鏄剧ず鍦ㄧ鍑犲垪
- isPidData: true, // 鏄惁鏄痠d銆乸id褰㈠紡鏁版嵁
- idName: 'id', // id瀛楁鍚嶇О
- pidName: 'parentId' // pid瀛楁鍚嶇О
- },
- cols: [[
- {type: 'checkbox'},
- {type: 'numbers'}
- ,{field: 'name', align: 'left',title: '缂栧彿/鍚嶇О', minWidth: 150}
- // ,{field: 'uuid', left: 'center',title: '缂栧彿/鍚嶇О', minWidth: 150}
- ,{field: 'type$', align: 'center',title: '绫诲瀷', templet: '#typeTpl'}
- // ,{field: 'leading', align: 'center',title: '璐熻矗浜�'}
- // ,{field: 'img', align: 'center',title: '鍥剧墖', hide: true}
- // ,{field: 'brief', align: 'center',title: '绠�瑕佹弿杩�'}
- // ,{field: 'count', align: 'center',title: '鏁伴噺'}
- // ,{field: 'sort', align: 'center',title: '鎺掑簭'}
- ,{field: 'status$', align: 'center',title: '鐘舵��', hide: true}
- ,{field: 'row1$', align: 'center',title: '鎺�'}
- ,{field: 'bay1$', align: 'center',title: '鍒�'}
- ,{field: 'lev1$', align: 'center',title: '灞�'}
- ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'}
- ,{field: 'updateBy$', align: 'center',title: '淇敼浜哄憳'}
- ,{field: 'memo', align: 'center',title: '澶囨敞', hide: true}
+ <!-- 搴撲綅绫诲瀷 -->
+ <div class="layui-form-item">
+ <label class="layui-form-label">搴撳尯</label>
+ <div class="layui-input-inline">
+ <div id="mat" name="areaId">
+ </div>
+ </div>
+ </div>
- ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:150}
- ]],
- done: function (data) {
- console.log(data)
- $('.ew-tree-table-box').css('height', '100%');
- insTb.expandAll();
- tbDataList = data;
- }
- });
+ <!-- 鎺� -->
+ <div class="layui-form-item">
+ <div class="layui-inline">
+ <label class="layui-form-label">璧锋鎺�</label>
+ <div class="layui-input-inline" style="width: 100px;">
+ <input type="text" name="startRow" autocomplete="off" class="layui-input" lay-verify="required|number">
+ </div>
+ <div class="layui-form-mid">-</div>
+ <div class="layui-input-inline" style="width: 100px;">
+ <input type="text" name="endRow" autocomplete="off" class="layui-input" lay-verify="required|number">
+ </div>
+ </div>
+ </div>
+ <!-- 鍒� -->
+ <div class="layui-form-item">
+ <div class="layui-inline">
+ <label class="layui-form-label">璧锋鍒�</label>
+ <div class="layui-input-inline" style="width: 100px;">
+ <input type="text" name="startBay" autocomplete="off" class="layui-input" lay-verify="required|number">
+ </div>
+ <div class="layui-form-mid">-</div>
+ <div class="layui-input-inline" style="width: 100px;">
+ <input type="text" name="endBay" autocomplete="off" class="layui-input" lay-verify="required|number">
+ </div>
+ </div>
+ </div>
+ <!-- 灞� -->
+ <div class="layui-form-item">
+ <div class="layui-inline">
+ <label class="layui-form-label">璧锋灞�</label>
+ <div class="layui-input-inline" style="width: 100px;">
+ <input type="text" name="startLev" autocomplete="off" class="layui-input" lay-verify="required|number">
+ </div>
+ <div class="layui-form-mid">-</div>
+ <div class="layui-input-inline" style="width: 100px;">
+ <input type="text" name="endLev" autocomplete="off" class="layui-input" lay-verify="required|number">
+ </div>
+ </div>
+ </div>
- /* 琛ㄦ牸澶村伐鍏锋爮鐐瑰嚮浜嬩欢 */
- treeTable.on('toolbar(node)', function (obj) {
- var checkRows = insTb.checkStatus();
- if (obj.event === 'add') { // 娣诲姞
- showEditModel();
- } else if (obj.event === 'del') { // 鍒犻櫎
- if (checkRows.length === 0) {
- layer.msg('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁', {icon: 2});
- return;
- }
- var ids = checkRows.map(function (d) {
- if (!d.LAY_INDETERMINATE) {
- return d.id;
- } else {
- return null;
- }
- });
- doDel({ids: ids});
- } else if (obj.event === 'printBatch') {
- if (checkRows.length === 0) {
- layer.msg('璇烽�夋嫨瑕佹墦鍗扮殑鏁版嵁', {icon: 2});
- return;
- }
- var printContent = checkRows.map(function (d) {
- if (!d.LAY_INDETERMINATE && d.type === 3) {
- return d.name;
- } else {
- return null;
- }
- });
- printBatch(printContent, 1);
- }
- });
- /* 琛ㄦ牸鎿嶄綔鍒楃偣鍑讳簨浠� */
- treeTable.on('tool(node)', function (obj) {
- if (obj.event === 'edit') { // 淇敼
- showEditModel(obj.data);
- } else if (obj.event === 'del') { // 鍒犻櫎
- doDel(obj);
- }
- });
+ <div id="prompt" style="text-indent: 10px;">
+ <span class="not-null">鍒濆鍖栧簱浣嶅悗灏嗗垹闄ゅ簱瀛樻槑缁嗭紝璇疯皑鎱庢搷浣滐紒</span>
+ </div>
+ <!-- 鎸夐挳 -->
+ <div style="text-align: center; margin-top: 20px">
+ <button class="layui-btn layui-btn-radius layui-btn-normal" id="initDo" lay-submit lay-filter="initDo">纭畾</button>
+ </div>
+ </div>
+</div>
- /* 鏄剧ず琛ㄥ崟寮圭獥 */
- function showEditModel(mData) {
- admin.open({
- type: 1,
- area: '600px',
- title: (mData ? '淇敼' : '娣诲姞') + '璐т綅',
- content: $('#editDialog').html(),
- success: function (layero, dIndex) {
- // 鍥炴樉琛ㄥ崟鏁版嵁
- form.val('detail', mData);
- // 琛ㄥ崟鎻愪氦浜嬩欢
- form.on('submit(editSubmit)', function (data) {
- data.field.parentId = insXmSel.getValue('valueStr');
- var loadIndex = layer.load(2);
- $.ajax({
- url: baseUrl+"/node/"+(mData?'update':'add')+"/auth",
- headers: {'token': localStorage.getItem('token')},
- data: data.field,
- method: 'POST',
- success: function (res) {
- layer.close(loadIndex);
- if (res.code === 200){
- layer.close(dIndex);
- layer.msg(res.msg, {icon: 1});
- insTb.refresh();
- } else if (res.code === 403){
- top.location.href = baseUrl+"/";
- }else {
- layer.msg(res.msg, {icon: 2});
- }
- }
- })
- return false;
- });
- // 娓叉煋涓嬫媺鏍�
- var insXmSel = xmSelect.render({
- el: '#nodeParentSel',
- height: '250px',
- data: insTb.options.data,
- initValue: mData ? [mData.parentId] : [],
- model: {label: {type: 'text'}},
- prop: {
- name: 'name',
- value: 'id'
- },
- radio: true,
- clickClose: true,
- tree: {
- show: true,
- indent: 15,
- strict: false,
- expandedKeys: true
- }
- });
- // 寮圭獥涓嶅嚭鐜版粴鍔ㄦ潯
- $(layero).children('.layui-layer-content').css('overflow', 'visible');
- layui.form.render('select');
- }
- });
- }
- /* 鍒犻櫎 */
- function doDel(obj) {
- layer.confirm('纭畾瑕佸垹闄ら�変腑鏁版嵁鍚楋紵', {
- skin: 'layui-layer-admin',
- shade: .1
- }, function (i) {
- layer.close(i);
- var loadIndex = layer.load(2);
- var ids;
- if (obj.data) {
- ids = [];
- ids[0] = obj.data.id;
- } else {
- ids = obj.ids;
- }
- $.ajax({
- url: baseUrl+"/node/delete0/auth",
- headers: {'token': localStorage.getItem('token')},
- data: {ids: ids},
- method: 'POST',
- success: function (res) {
- layer.close(loadIndex);
- if (res.code === 200){
- layer.msg(res.msg, {icon: 1});
- insTb.refresh();
- } else if (res.code === 403){
- top.location.href = baseUrl+"/";
- } else {
- layer.msg(res.msg, {icon: 2});
- }
- }
- })
- });
- }
-
- // 鎵归噺鎵撳嵃
- function printBatch(printMsgList, type) {
- var data = [];
- for (var i = 0; i<printMsgList.length; i ++) {
- if (printMsgList[i] != null && printMsgList[i] !== '') {
- var barcodeUrl;
- if (type === 1) {
- barcodeUrl = baseUrl+"/barcode/qrcode/auth?type="+type+"¶m="+printMsgList[i]+"&width="+200+"&height="+70;
- } else {
- barcodeUrl = baseUrl+"/barcode/qrcode/auth?type="+type+"¶m="+printMsgList[i]+"&width="+400+"&height="+180;
- }
- data.push({
- item: printMsgList[i],
- barcodeUrl: barcodeUrl
- })
- }
- }
- var tpl = $('#locPrintTpl').html();
- var template = Handlebars.compile(tpl);
- var html = template({data: data});
- var box = $("#printBox");
- box.html(html);
- box.show();
- box.print({mediaPrint:true});
- box.hide();
- }
-
- });
-
- // excel瀵煎叆妯℃澘涓嬭浇
- function excelMouldDownload(){
- layer.load(1, {shade: [0.1,'#fff']});
- location.href = baseUrl + "/node/excel/import/mould";
- layer.closeAll('loading');
- }
-
- // excel瀵煎叆
- function importExcel() {
- $("#importExcel").trigger("click");
- }
- function upload(obj){
- if(!obj.files) {
- return;
- }
- var file = obj.files[0];
- admin.confirm('纭鍚屾 [' + file.name +'] 鏂囦欢鍚楋紵', function (index) {
- layer.load(1, {shade: [0.1,'#fff']});
- var url = baseUrl + "/node/excel/import/auth";
- var form = new FormData();
- form.append("file", file);
- xhr = new XMLHttpRequest();
- xhr.open("post", url, true); //post鏂瑰紡锛寀rl涓烘湇鍔″櫒璇锋眰鍦板潃锛宼rue 璇ュ弬鏁拌瀹氳姹傛槸鍚﹀紓姝ュ鐞嗐��
- xhr.setRequestHeader('token', localStorage.getItem('token'));
- xhr.onload = uploadComplete; //璇锋眰瀹屾垚
- xhr.onerror = uploadFailed; //璇锋眰澶辫触
- xhr.onloadend = function () { // // 涓婁紶瀹屾垚閲嶇疆鏂囦欢娴�
- layer.closeAll('loading');
- $("#importExcel").val("");
- };
- // xhr.upload.onprogress = progressFunction;//銆愪笂浼犺繘搴﹁皟鐢ㄦ柟娉曞疄鐜般��
- xhr.upload.onloadstart = function(){//涓婁紶寮�濮嬫墽琛屾柟娉�
- ot = new Date().getTime(); //璁剧疆涓婁紶寮�濮嬫椂闂�
- oloaded = 0;//璁剧疆涓婁紶寮�濮嬫椂锛屼互涓婁紶鐨勬枃浠跺ぇ灏忎负0
- };
- xhr.send(form);
- }, function(index){
- $("#importExcel").val("");
- });
- }
- function uploadComplete(evt) {
- var res = JSON.parse(evt.target.responseText);
- if(res.code === 200) {
- layer.msg(res.msg, {icon: 1});
- insTb.refresh();
- } else {
- layer.msg(res.msg, {icon: 2});
- }
- }
- function uploadFailed(evt) {
- var res = JSON.parse(evt.target.responseText);
- layer.msg(res.msg, {icon: 2});
- }
-
- // excel瀵煎嚭
- function exportExcel() {
-
- }
-
-</script>
</body>
</html>
--
Gitblit v1.9.1