cl
2024-01-23 6dadf36ef118fbb3b2cd5aca94cde88e29fb55dc
提交 | 用户 | 时间
71e81e 1 /**
2  * 详情对话框
3  */
4 var ProductionOrderBatchInfoInfoDlg = {
5     data: {
6         id: "",
7         workOrderNo: "",
8         productionLine: "",
9         locationCode: "",
be26d5 10         status: "",
71e81e 11         spareField1: "",
12         spareField2: "",
13         createUser: "",
14         updateUser: "",
15         createTime: "",
16         updateTime: ""
17     }
18 };
19
20 layui.use(['form', 'admin', 'ax','laydate','upload','formSelects'], function () {
21     var $ = layui.jquery;
22     var $ax = layui.ax;
23     var form = layui.form;
24     var admin = layui.admin;
25     //获取详情信息,填充表单
26     var ajax = new $ax(Feng.ctxPath + "/productionOrderBatchInfo/detail?id=" + Feng.getUrlParam("id"));
27     var resultForm = ajax.start();
28     form.val('productionOrderBatchInfoForm', resultForm.data);
29     $(document).ready(function () {
30         $.ajax({
31             type: "POST",
32             contentType: "application/json;charset=UTF-8",
33             url: Feng.ctxPath + '/lineInfo/list',
34             success: function (result) {
35                 $.each(result.data, function (index, value) {
36                     $('#productionLine').append(new Option(value.lineCode));// 下拉菜单里添加元素
37                 });
38                 $('#productionLine').val(resultForm.data.productionLine);
39                 layui.form.render("select");//重新渲染 固定写法
40             },
41         });
42
43         $.ajax({
44             type: "POST",
45             contentType: "application/json;charset=UTF-8",
46             url: Feng.ctxPath + '/locationInfo/list?productionLineCode='+resultForm.data.productionLine,
47             success: function (result) {
48                 $.each(result.data, function (index, value) {
49                     $('#locationCode').append(new Option(value.locationCode));// 下拉菜单里添加元素
50                 });
51                 $('#locationCode').val(resultForm.data.locationCode);
52                 layui.form.render("select");//重新渲染 固定写法
53             },
54         });
55     });
56
57     form.on('select(productionLine)', function (data) {
58         console.log("11111");
59         $.ajax({
60             type: "POST",
61             contentType: "application/json;charset=UTF-8",
62             url: Feng.ctxPath + '/locationInfo/list?productionLineCode='+data.value,
63             success: function (result) {
64                 $('#locationCode').empty();
65                 $('#locationCode').append(new Option("请选择工位", ""));// 下拉菜单里添加元素
66
67                 $.each(result.data, function (index, value) {
68                     $('#locationCode').append(new Option(value.locationCode));// 下拉菜单里添加元素
69                 });
70                 layui.form.render("select");//重新渲染 固定写法
71             },
72         });
73     });
74
75     //表单提交事件
76     form.on('submit(btnSubmit)', function (data) {
77         var ajax = new $ax(Feng.ctxPath + "/productionOrderBatchInfo/editItem", function (data) {
78             Feng.success("更新成功!");
79             window.location.href = Feng.ctxPath + '/productionOrderBatchInfo'
80         }, function (data) {
81             Feng.error("更新失败!" + data.responseJSON.message)
82         });
83         ajax.set(data.field);
84         ajax.start();
85
86         return false;
87     });
88
89     $('#cancel').click(function(){
90         window.location.href = Feng.ctxPath + '/productionOrderBatchInfo'
91     });
92 });