|
@@ -882,10 +882,9 @@
|
|
<script type="text/javascript" src="/web/rationLibEditor/js/ration.js"></script>
|
|
<script type="text/javascript" src="/web/rationLibEditor/js/ration.js"></script>
|
|
<script type="text/javascript" src="/web/rationLibEditor/js/rationGLJ.js"></script>
|
|
<script type="text/javascript" src="/web/rationLibEditor/js/rationGLJ.js"></script>
|
|
<script type="text/javascript" src="/public/web/treeDataHelper.js"></script>
|
|
<script type="text/javascript" src="/public/web/treeDataHelper.js"></script>
|
|
- <SCRIPT type="text/javascript">
|
|
|
|
-/*var rationName = getQueryString("rationname");*/
|
|
|
|
-var treeObj;
|
|
|
|
-var setting = {
|
|
|
|
|
|
+ <script type="text/javascript">
|
|
|
|
+
|
|
|
|
+ var setting = {
|
|
view: {
|
|
view: {
|
|
// showIcon: showIconForTree,//已存在*/
|
|
// showIcon: showIconForTree,//已存在*/
|
|
addHoverDom: zTreeOprObj.addHoverDom,
|
|
addHoverDom: zTreeOprObj.addHoverDom,
|
|
@@ -923,427 +922,7 @@ var setting = {
|
|
onRename: zTreeOprObj.onRename
|
|
onRename: zTreeOprObj.onRename
|
|
}
|
|
}
|
|
};
|
|
};
|
|
-var log, className = "dark";
|
|
|
|
-var properties = {
|
|
|
|
-}
|
|
|
|
-//点击树获取定额
|
|
|
|
-function SectionClick(event,treeId,treeNode){
|
|
|
|
- var sectionID = treeNode.id;
|
|
|
|
- properties.selectedSection =sectionID
|
|
|
|
- getRationItems(sectionID);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-function selectAll() {
|
|
|
|
- var zTree = $.fn.zTree.getZTreeObj("rationChapterTree");
|
|
|
|
- zTree.setting.edit.editNameSelectAll = $("#selectAll").attr("checked");
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-//新增定额事件
|
|
|
|
-$("#mkadd").click(function(){
|
|
|
|
- var section = treeObj.getSelectedNodes();
|
|
|
|
- if(!section.length){
|
|
|
|
- alert("请选择需要添加定额的章节!")
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-})
|
|
|
|
-$("#mkaddglj").click(function() {
|
|
|
|
- var s = $("#gljparam").val()
|
|
|
|
- if (!s) {
|
|
|
|
- alert("请选择需要添加工料机的定额!")
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-})
|
|
|
|
-$("#rationAdd").click(function(){
|
|
|
|
- var section = treeObj.getSelectedNodes();
|
|
|
|
- var rationItem = {};
|
|
|
|
- var code,name,danwei,jijia,xsname,qfzy;
|
|
|
|
- code = $("#code").val();name = $("#name").val();danwei=$("#danwei").val();jijia = $("#jijia").val();xsname = $("#xsname").val();qfzy=$("#qfzy").val();
|
|
|
|
- rationItem.RationCode = code;
|
|
|
|
- rationItem.RationName = name;
|
|
|
|
- rationItem.Unit = danwei;
|
|
|
|
- rationItem.BasePrice = Number(jijia);
|
|
|
|
- rationItem.SectionID = section[0].id;
|
|
|
|
- rationItem.ContentID = 0;
|
|
|
|
- rationItem.Caption = xsname;
|
|
|
|
- rationItem.FeeType = Number(qfzy)
|
|
|
|
- saveRationItem(rationItem);
|
|
|
|
-/* bindRationDelete()
|
|
|
|
- bindRationClick();*/
|
|
|
|
-})
|
|
|
|
-//保存定额条目Ajax函数
|
|
|
|
-function saveRationItem(obj){
|
|
|
|
- var rationItem = JSON.stringify(obj)
|
|
|
|
- $.ajax({
|
|
|
|
- type:"POST",
|
|
|
|
- url:"http://localhost:6060/rationLibEditor/saveRationItem",
|
|
|
|
- data:{"rationName":rationName,"rationItem":rationItem},
|
|
|
|
- dataType:"json",
|
|
|
|
- cache:false,
|
|
|
|
- timeout:1000,
|
|
|
|
- success:function(result){
|
|
|
|
- getRationItems(properties.selectedSection);
|
|
|
|
- },
|
|
|
|
- error: function(jqXHR, textStatus, errorThrown){
|
|
|
|
- var err = JSON.parse(jqXHR.responseText);
|
|
|
|
- alert(err.error);
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-//获取定额条目Ajax函数
|
|
|
|
-function getRationItems(sectionID){
|
|
|
|
- $("#rationTbody").html("")
|
|
|
|
- $.ajax({
|
|
|
|
- type:"POST",
|
|
|
|
- url:"http://localhost:6060/ration/getRationsBySectionID",
|
|
|
|
- data:{"rationName": rationName,"sectionID": sectionID},
|
|
|
|
- dataType:"json",
|
|
|
|
- cache:false,
|
|
|
|
- timeout:1000,
|
|
|
|
- success:function(result){
|
|
|
|
- if(result){
|
|
|
|
- showRationItems(result.data);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- error:function(){
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-//显示定额条目
|
|
|
|
-function showRationItems(data){
|
|
|
|
- //var RationJSONStr = JSON.stringify(data);
|
|
|
|
- var spread = $("#rationItemsSheet").data("workbook");
|
|
|
|
- spread.fromJSON(data);
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
-//绑定点击定额号
|
|
|
|
-function bindRationClick(){
|
|
|
|
- var tr = $("#rationTbody tr");
|
|
|
|
- var td = $("td:eq(1)",tr);
|
|
|
|
- td.each(function() {
|
|
|
|
- var a;
|
|
|
|
- a = $('a', $(this));
|
|
|
|
- var str = a.text();
|
|
|
|
- a.click(function(){
|
|
|
|
- $("#gljparam").val(str);
|
|
|
|
- properties.selectedRation = str;
|
|
|
|
- getRationGLJItems(str)
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-//获取定额工料机
|
|
|
|
-function getRationGLJItems(str){
|
|
|
|
- var GLJTags = [];
|
|
|
|
- $.ajax({
|
|
|
|
- type:"POST",
|
|
|
|
- url:"http://localhost:6060/ration/getRationGLJItems",
|
|
|
|
- async: false,
|
|
|
|
- data:{"rationName": rationName,"rationCode":str},
|
|
|
|
- dataType:"json",
|
|
|
|
- cache:false,
|
|
|
|
- timeout:1000,
|
|
|
|
- success:function(result,status){
|
|
|
|
- if(result){
|
|
|
|
- var rationGLJs = result.data;
|
|
|
|
- for(var i=0;i<rationGLJs.length;i++){
|
|
|
|
- var TagItem = {};
|
|
|
|
- TagItem.dexh = rationGLJs[i].Amount;
|
|
|
|
- var gljCode = rationGLJs[i].GLJCode;
|
|
|
|
- $.ajax({
|
|
|
|
- type:"POST",
|
|
|
|
- url:"http://localhost:6060/ration/getGLJItem",
|
|
|
|
- async: false,
|
|
|
|
- data:{"rationName": rationName,"GLJCode":gljCode},
|
|
|
|
- dataType:"json",
|
|
|
|
- cache:false,
|
|
|
|
- timeout:1000,
|
|
|
|
- success:function(result1){
|
|
|
|
- TagItem.GLJ = result1.data[0];
|
|
|
|
- GLJTags[i] = TagItem;
|
|
|
|
- },
|
|
|
|
- error:function(){
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- error:function(){
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- showRationGLJ(GLJTags)
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
-//为每条定额工料机绑定删除事件
|
|
|
|
-function bindRationGLJDelete(){
|
|
|
|
- $("#rationGLJTbody tr").each(function() {
|
|
|
|
- var td7, a1,td1,a2;
|
|
|
|
- td7 = $("td:eq(7)", $(this));
|
|
|
|
- td1 = $("td:eq(1)", $(this));
|
|
|
|
- var str = td1.text();
|
|
|
|
- a2 = $("a:eq(1)",td7);
|
|
|
|
- a2.click(function(){
|
|
|
|
- $("#delType").val("rationGLJ");
|
|
|
|
- $("#delParam").val(str);
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-//为每条定额绑定编辑事件
|
|
|
|
-function bindRationEdit(){
|
|
|
|
- $("#rationTbody tr").each(function() {
|
|
|
|
- var td7,td1,a2;
|
|
|
|
- td7 = $("td:eq(7)", $(this));
|
|
|
|
- td1 = $("td:eq(1)", $(this));
|
|
|
|
- var str = td1.text();
|
|
|
|
- a2 = $("a:eq(0)",td7);
|
|
|
|
- a2.click(function(){
|
|
|
|
- properties.Edit = "ration";
|
|
|
|
- properties.EditParam =str;
|
|
|
|
- $.ajax({
|
|
|
|
- type:"POST",
|
|
|
|
- url:"http://localhost:6060/ration/getRationByCode",
|
|
|
|
- data:{"rationName": rationName,"RationCode":str},
|
|
|
|
- dataType:"json",
|
|
|
|
- cache:false,
|
|
|
|
- timeout:5000,
|
|
|
|
- success:function(result){
|
|
|
|
- var ration = result.data[0];
|
|
|
|
- $("#ERcode").val(ration.RationCode).attr("disabled",true);
|
|
|
|
- $("#ERname").val(ration.RationName);
|
|
|
|
- $("#ERdanwei").find("option:selected").text(ration.Unit);
|
|
|
|
- $("#ERjijia").val(ration.BasePrice).attr("disabled",true);
|
|
|
|
- $("#ERxsmc").val(ration.Caption);
|
|
|
|
- $("#ERqfzy").val(ration.FeeType);
|
|
|
|
- },
|
|
|
|
- error:function(err){
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-//绑定定额消耗编辑事件
|
|
|
|
-function bindRGLJAmountEdit(){
|
|
|
|
- $("#rationGLJTbody tr").each(function() {
|
|
|
|
- var td5, td1, a2,amount;
|
|
|
|
- var value = $("#gljparam").val();
|
|
|
|
- td5 = $("td:eq(5)", $(this));
|
|
|
|
- td1 = $("td:eq(1)", $(this));
|
|
|
|
- var str = td1.text();
|
|
|
|
- a2 = $("input", td5);
|
|
|
|
-
|
|
|
|
- a2.blur(function () {
|
|
|
|
- if(isNaN(a2.val()))
|
|
|
|
- alert("请输入数值!");
|
|
|
|
- else
|
|
|
|
- $.ajax({
|
|
|
|
- type:"POST",
|
|
|
|
- url:"http://localhost:6060/ration/editRGLJAmount",
|
|
|
|
- dataType:"json",
|
|
|
|
- data:{"rationName":rationName,"GLJCode":str,"RationCode":value,"Amount":Number(a2.val())},
|
|
|
|
-
|
|
|
|
- cache:false,
|
|
|
|
- timeout:50000,
|
|
|
|
- success:function(result){
|
|
|
|
- // getRationItems(properties.selectedSection);
|
|
|
|
- getRationGLJItems(value);
|
|
|
|
- },
|
|
|
|
- error:function(iqXHR,textStatus,errorThrown){
|
|
|
|
- alert("error "+textStatus+" "+errorThrown);
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
-$("#Rbianji").click(function(){//设置定额号不可编辑
|
|
|
|
-
|
|
|
|
- var ERcode,ERname,ERdanwei,ERjijia,ERxsmc,ERqfzy,ration={};
|
|
|
|
- ERcode=$("#ERcode").val();
|
|
|
|
- ERname=$("#ERname").val();
|
|
|
|
- ERdanwei=$("#ERdanwei").val();
|
|
|
|
- ERjijia=$("#ERjijia").val();
|
|
|
|
- ERxsmc = $("#ERxsmc").val();
|
|
|
|
- ERqfzy=$("#ERqfzy").val();
|
|
|
|
- ration.RationCode = ERcode;
|
|
|
|
- ration.RationName = ERname;
|
|
|
|
- ration.Unit = ERdanwei;
|
|
|
|
- ration.BasePrice = Number(ERjijia);
|
|
|
|
- ration.SectionID = properties.selectedSection;
|
|
|
|
- ration.ContentID = 0;
|
|
|
|
- ration.Caption = ERxsmc;
|
|
|
|
- ration.FeeType =Number(ERqfzy);
|
|
|
|
- var rationItem = JSON.stringify(ration);
|
|
|
|
- $.ajax({
|
|
|
|
- type:"POST",
|
|
|
|
- url:"http://localhost:6060/ration/editRationItem",
|
|
|
|
- dataType:"json",
|
|
|
|
- data:{"rationName":rationName,"RationCode":properties.EditParam,"newRation":rationItem},
|
|
|
|
- cache:false,
|
|
|
|
- timeout:50000,
|
|
|
|
- success:function(result){
|
|
|
|
- getRationItems(properties.selectedSection);
|
|
|
|
- },
|
|
|
|
- error:function(iqXHR,textStatus,errorThrown){
|
|
|
|
- alert("error "+textStatus+" "+errorThrown);
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
-})
|
|
|
|
-//为每条定额绑定删除事件
|
|
|
|
-function bindRationDelete(){
|
|
|
|
- $("#rationTbody tr").each(function() {
|
|
|
|
- var td7, a1,td1,a2;
|
|
|
|
- td7 = $("td:eq(7)", $(this));
|
|
|
|
- td1 = $("td:eq(1)", $(this));
|
|
|
|
- var str = td1.text();
|
|
|
|
- a2 = $("a:eq(1)",td7);
|
|
|
|
- a2.click(function(){
|
|
|
|
- $("#delType").val("ration");
|
|
|
|
- $("#delParam").val(str);
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-//删除定额或定额工料机
|
|
|
|
-$("#shanchu").click(function(){
|
|
|
|
- var type = $("#delType").val();
|
|
|
|
- var value = $("#delParam").val();
|
|
|
|
- switch(type){
|
|
|
|
- case "ration":
|
|
|
|
- {$.ajax({
|
|
|
|
- type:"POST",
|
|
|
|
- url:"http://localhost:6060/ration/deleteRation",
|
|
|
|
- data:{"rationName": rationName,"type":type,"value":value},
|
|
|
|
- async:false,
|
|
|
|
- dataType:"json",
|
|
|
|
- cache:false,
|
|
|
|
- timeout:1000,
|
|
|
|
- success:function(result){
|
|
|
|
- getRationItems(properties.selectedSection);
|
|
|
|
- getRationGLJItems(value)
|
|
|
|
- },
|
|
|
|
- error:function(){
|
|
|
|
- alert("nima")
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- break;}
|
|
|
|
- case "rationGLJ":
|
|
|
|
- { $.ajax({
|
|
|
|
- type:"POST",
|
|
|
|
- url:"http://localhost:6060/ration/deleteRationGLJ",
|
|
|
|
- data:{"rationName": rationName,"type":type,"value":value},
|
|
|
|
- async:false,
|
|
|
|
- dataType:"json",
|
|
|
|
- cache:false,
|
|
|
|
- timeout:1000,
|
|
|
|
- success:function(result){
|
|
|
|
- var s = $("#gljparam").val();
|
|
|
|
- getRationGLJItems(s)
|
|
|
|
- },
|
|
|
|
- error:function(){
|
|
|
|
- alert("nima")
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- break;}
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-})
|
|
|
|
-//显示定额工料机条目
|
|
|
|
-function showRationGLJ(obj){
|
|
|
|
- $("#bglj tbody tr").html("");
|
|
|
|
- var Baseprice = 0;
|
|
|
|
- for(var i=0;i<obj.length;i++){
|
|
|
|
- var code,name,danwei,jijia,dexh,leixing;
|
|
|
|
- code = obj[i].GLJ.GLJCode;
|
|
|
|
- name = obj[i].GLJ.GLJName;
|
|
|
|
- danwei = obj[i].GLJ.Unit;
|
|
|
|
- jijia = obj[i].GLJ.BasePrice;
|
|
|
|
- dexh = obj[i].dexh;
|
|
|
|
- Baseprice = Baseprice + Number(jijia)*Number(dexh);
|
|
|
|
- leixing =obj[i].GLJ.Type;
|
|
|
|
- var $tr = $('<tr><td></td><td></td><td></td><td></td><td></td><td><input></td><td></td><td> <a href="javacript:void(0);" data-toggle="modal" data-target="#del" class="text-danger" title="删除"><i class="fa fa-remove"></i></a></td> </tr>')
|
|
|
|
- //<a href="javacript:void(0);" data-toggle="modal" data-target="#editBglj" title="编辑"><i class="fa fa-pencil-square-o"></i></a>
|
|
|
|
- var td0,td1,td2,td3,td4,td5,td6,a;
|
|
|
|
- td0 = $("td:eq(0)",$tr), td1 = $("td:eq(1)",$tr);td2 = $("td:eq(2)",$tr);td3 = $("td:eq(3)",$tr);td4 = $("td:eq(4)",$tr);td5 = $("td:eq(5)",$tr);a=$("input",td5);td6 = $("td:eq(6)",$tr);
|
|
|
|
- td0.text(i); td1.text(code);td2.text(name);td3.text(danwei);td4.text(jijia);a.val(dexh);td6.text(leixing)
|
|
|
|
- $tr.appendTo("#bglj tbody");
|
|
|
|
- }
|
|
|
|
- var s = $("#gljparam").val()
|
|
|
|
- $("#rationTbody tr").each(function(){
|
|
|
|
- var td = $("td:eq(1)",$(this))
|
|
|
|
- var s1 = td.text();
|
|
|
|
-
|
|
|
|
- if ( s == s1){
|
|
|
|
- td.next().next().next().text(Baseprice.toFixed(2));
|
|
|
|
- $.ajax({
|
|
|
|
- type:"POST",
|
|
|
|
- url:"http://localhost:6060/ration/setRationBasePrice",
|
|
|
|
- data:{"rationName": rationName,"rationCode":s,"BasePrice":Baseprice.toFixed(2)},
|
|
|
|
- dataType:"json",
|
|
|
|
- cache:false,
|
|
|
|
- timeout:1000,
|
|
|
|
- success:function(result){
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- error:function(err){
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- })
|
|
|
|
- bindRGLJAmountEdit();
|
|
|
|
- bindRationGLJDelete();
|
|
|
|
-}
|
|
|
|
-//添加定额工料机ajax函数
|
|
|
|
-$("#bt-glj").click(function(){
|
|
|
|
- var rationGLJ = {};
|
|
|
|
- rationGLJ.RationCode = $("#gljparam").val();
|
|
|
|
- rationGLJ.GLJCode = $("#bt-inputCode").val();
|
|
|
|
- rationGLJ.Amount =Number($("#gljxh").val());
|
|
|
|
- rationGLJ.Type = Number($("#gljlx").val()) ;
|
|
|
|
- var rationglj = JSON.stringify(rationGLJ);
|
|
|
|
- $.ajax({
|
|
|
|
- type:"POST",
|
|
|
|
- url:"http://localhost:6060/ration/saveRationGLJ",
|
|
|
|
- data:{"rationName": rationName,"rationGLJ":rationglj},
|
|
|
|
- dataType:"json",
|
|
|
|
- cache:false,
|
|
|
|
- timeout:1000,
|
|
|
|
- success:function(result){
|
|
|
|
- getRationGLJItems($("#gljparam").val())
|
|
|
|
- },
|
|
|
|
- error:function(err){
|
|
|
|
- var error = JSON.parse(err.responseText);
|
|
|
|
- alert(error.error);
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
-})
|
|
|
|
-//输入工料机编号自动获取工料机信息
|
|
|
|
-$("#bt-inputCode").blur(function(){
|
|
|
|
- var gljCode = $("#bt-inputCode").val();
|
|
|
|
- $.ajax({
|
|
|
|
- type:"POST",
|
|
|
|
- url:"http://localhost:6060/ration/getGLJByCode",
|
|
|
|
- data:{"rationName": rationName,"gljCode":gljCode},
|
|
|
|
- dataType:"json",
|
|
|
|
- cache:false,
|
|
|
|
- timeout:5000,
|
|
|
|
- success:function(result){
|
|
|
|
- var glj = result.data[0];
|
|
|
|
- $("#gljName").val(glj.GLJName).attr("disabled",true);
|
|
|
|
- $("#gljdw").find("option:selected").text(glj.Unit).attr("disabled","disabled");
|
|
|
|
- $("#gljdj").val(glj.BasePrice).attr("disabled",true);
|
|
|
|
- $("#gljlx").val(glj.Type).attr("disabled","disabled");
|
|
|
|
- },
|
|
|
|
- error:function(err){
|
|
|
|
- var error = JSON.parse(err.responseText);
|
|
|
|
- alert(error.error);
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
-})
|
|
|
|
- </SCRIPT>
|
|
|
|
|
|
+ </script>
|
|
</body>
|
|
</body>
|
|
<script type="text/javascript">
|
|
<script type="text/javascript">
|
|
autoFlashHeight();
|
|
autoFlashHeight();
|