| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- var id = helper.request.queryString("id");
- $(document).ready(function () {
- //获取详情
- getEquipmentDetails()
- //保存
- $('.customerSubmit').click(function() {
- saveCustomer();
- });
- })
- //设备详情
- function getEquipmentDetails() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "EquipmentNumber/GetDetails",
- dataType: "json",
- async: true,
- data: {
- token: $.cookie("token"),
- id: id,
- },
- success: function(data){
- if (data.state.toLowerCase() == "success") {
- var data = data.rows;
- displayEquipmentDetails(data);
- }
- }
- })
- }
- //回显
- function displayEquipmentDetails(data) {
- $("#addProduction").val(data.F_Production); //生产单位
- $("#addFactoryCode").val(data.F_FactoryCode); //工程代码
- $("#addLigatureMachineCode").val(data.F_LigatureMachineCode); //结扎机编号
- $("#addStretchFilmCode").val(data.F_StretchFilmCode); //拉伸膜包装机编号
- $("#addQCStaffCode").val(data.F_QCStaffCode); //品管员代码
- }
- //保存
- function saveCustomer() {
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "EquipmentNumber/Update",
- dataType: 'json',
- async: true,
- beforeSend: function() { //触发ajax请求开始时执行
- $('.customerSubmit').attr("disabled", true);
- $('.customerSubmit').text('确定中...');
- },
- data: {
- token: $.cookie("token"),
- F_ID: id,
- F_Production: $("#addProduction").val(),//生产单位
- F_FactoryCode: $("#addFactoryCode").val(),//工厂代码
- F_LigatureMachineCode: $("#addLigatureMachineCode").val(),//结扎机编号
- F_StretchFilmCode: $("#addStretchFilmCode").val(),//拉伸膜包装机编号
- F_QCStaffCode: $("#addQCStaffCode").val(),//品管员代码
- },
- success: function(data) {
- if (data.state.toLowerCase() == 'success') {
- $('.customerSubmit').attr("disabled", false);
- $('.customerSubmit').text('确定');
- var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- parent.layer.close(index); //再执行关闭
- parent.layer.msg("保存成功!");
- parent.initTable();
- } else {
- $('.customerSubmit').attr("disabled", false);
- $('.customerSubmit').text('确定');
- }
- }
- });
- }
|