cl
2024-01-23 6dadf36ef118fbb3b2cd5aca94cde88e29fb55dc
提交 | 用户 | 时间
71e81e 1 /**
2  * 添加或者修改页面
3  */
4 var ProductionOrdeInfoInfoDlg = {
5     data: {
6         id: "",
7         salesOrderNo: "",
8         workOrderNo: "",
9         productionLine: "",
10         drawingNo: "",
11         materialCode: "",
12         materialName: "",
13         planQty: "",
14         actualQty: "",
15         scrapQty: "",
16         repairQty: "",
17         actualOnlineQty: "",
18         onlineCompletionMark: "",
19         demandDate: "",
20         planStartTime: "",
21         planEndTime: "",
22         actualStartTime: "",
23         actualEndTime: "",
24         serialNumber: "",
25         orderStatus: "",
26         spareField1: "",
27         spareField2: "",
28         spareField3: "",
29         spareField4: "",
30         createTime: "",
31         updateTime: "",
32         createUser: "",
33         updateUser: "",
34         streamNumber: "",
35         custom: "",
36         marketAreaCode: "",
37         softwareVersionCode: "",
38         productCompanyCode: "",
39         remarks: ""
40
41     }
42 };
43
44 layui.use(['form', 'admin', 'ax','laydate','upload','formSelects'], function () {
45     var $ = layui.jquery;
46     var $ax = layui.ax;
47     var form = layui.form;
48     var admin = layui.admin;
49     var laydate = layui.laydate;
50     //初始化时间选择器
51     laydate.render({
52         elem: '#planStartTime',
53         // type: 'datetime'
54     });
55     //初始化时间选择器
56     laydate.render({
57         elem: '#planEndTime',
58         // type: 'datetime'
59     });
60
61     $('#custom').click(function () {
62         layer.open({
63             type: 2,
64             area: ['1000px', '600px'],
65             title: '客户配置',
66             content: Feng.ctxPath + '/productionOrdeInfo/customInfo',
67             end: function () {
68                 let msg = JSON.parse(window.localStorage.getItem('message'));
69                 console.log("选择工单_id", msg.id)
70                 console.log(msg)
71                 $('#custom').val(msg.customerCode);
72             }
73         });
74     });
75
76     $('#materialCode').click(function () {
77         layer.open({
78             type: 2,
79             area: ['1000px', '600px'],
80             title: '物料信息',
81             content: Feng.ctxPath + '/productionOrdeInfo/materialList',
82             success: function (layero, index) {
83                 window.materialType = '成品';
84             },
85             end: function () {
86                 let msg = JSON.parse(window.localStorage.getItem('message'));
87                 console.log(msg)
88                 $('#materialCode').val(msg.materialCode);
89                 $('#materialName').val(msg.materialName);
90             }
91         });
92     });
93
94     $(document).ready(function () {
95         $.ajax({
96             type: "POST",
97             contentType: "application/json;charset=UTF-8",
98             url: Feng.ctxPath + '/lineInfo/list',
99             success: function (result) {
100                 $.each(result.data, function (index, value) {
101                     $('#productionLine').append(new Option(value.lineCode));// 下拉菜单里添加元素
102                 });
103                 layui.form.render("select");//重新渲染 固定写法
104             },
105         });
106        /* $.ajax({
107             type: "POST",
108             contentType: "application/json;charset=UTF-8",
109             url: Feng.ctxPath + '/dict/listDictsByCode?dictTypeCode=MARKET_AREA_CODE',
110             success: function (result) {
111                 $.each(result.data, function (index, value) {
112                     $('#marketAreaCode').append(new Option(value.code));// 下拉菜单里添加元素
113                 });
114                 layui.form.render("select");//重新渲染 固定写法
115             },
116         });*/
117         $.ajax({
118             type: "POST",
119             contentType: "application/json;charset=UTF-8",
120             url: Feng.ctxPath + '/dict/listDictsByCode?dictTypeCode=PRODUCT_COMPANY_CODE',
121             success: function (result) {
122                 $.each(result.data, function (index, value) {
123                     $('#productCompanyCode').append(new Option(value.code));// 下拉菜单里添加元素
124                 });
125                 layui.form.render("select");//重新渲染 固定写法
126             },
127         });     $.ajax({
128             type: "POST",
129             contentType: "application/json;charset=UTF-8",
130             url: Feng.ctxPath + '/dict/listDictsByCode?dictTypeCode=SOFTWARE_VERSION_CODE',
131             success: function (result) {
132                 $.each(result.data, function (index, value) {
133                     $('#softwareVersionCode').append(new Option(value.code));// 下拉菜单里添加元素
134                 });
135                 layui.form.render("select");//重新渲染 固定写法
136             },
137         });
138     });
139
140     //表单提交事件
141     form.on('submit(btnSubmit)', function (data) {
142         var ajax = new $ax(Feng.ctxPath + "/productionOrdeInfo/addItem", function (data) {
143             Feng.success("添加成功!");
144             window.location.href = Feng.ctxPath + '/productionOrdeInfo'
145         }, function (data) {
146             Feng.error("添加失败!" + data.responseJSON.message)
147         });
148         ajax.set(data.field);
149         ajax.start();
150
151         return false;
152     });
153
154     $('#cancel').click(function(){
155         window.location.href = Feng.ctxPath + '/productionOrdeInfo'
156     });
157
158 });