|
| 1 | +function destroyWindow(window) { |
| 2 | + if (window) { |
| 3 | + window.destroy() |
| 4 | + } |
| 5 | +} |
| 6 | +function saveCpFlowConfig(btn) { |
| 7 | + const form = btn.up("window").down("[name=saveForm]") |
| 8 | + const values = form.getForm().getValues() |
| 9 | + values.routeId = values.routeIdName |
| 10 | + values.operationId = values.operationIdName |
| 11 | + values.cpTrimEvenSetInfo = { |
| 12 | + cpRrn: values.cpRrn, |
| 13 | + rowRrn: values.rowRrn, |
| 14 | + minMatchValue: values.minMatchValue, |
| 15 | + minTrimQty: values.minTrimQty, |
| 16 | + targetValue: values.targetValue, |
| 17 | + maxExceptionPoint: values.maxExceptionPoint, |
| 18 | + deadMaxRate: values.deadMaxRate |
| 19 | + } |
| 20 | + if (checkSaveValues(values)) { |
| 21 | + Ext.Ajax.request({ |
| 22 | + url: actionURL, |
| 23 | + requestMethod: "saveEvenConfig", |
| 24 | + params: values, |
| 25 | + success: function (response) { |
| 26 | + showSuccessAlert("保存成功!", function () { |
| 27 | + destroyWindow(btn.up("window")) |
| 28 | + refreshFlowConfigGrid() |
| 29 | + }) |
| 30 | + }, |
| 31 | + failure: function () {} |
| 32 | + }) |
| 33 | + } |
| 34 | +} |
| 35 | + |
| 36 | +function checkSaveValues(values) { |
| 37 | + if (isNull(values.productId)) { |
| 38 | + showErrorAlert("产品号不能为空!!") |
| 39 | + return false |
| 40 | + } |
| 41 | + if (isNull(values.processId)) { |
| 42 | + showErrorAlert("流程号不能为空!!") |
| 43 | + return false |
| 44 | + } |
| 45 | + if (isNull(values.processVersion)) { |
| 46 | + showErrorAlert("流程版本号不能为空!!") |
| 47 | + return false |
| 48 | + } |
| 49 | + if (isNull(values.routeId)) { |
| 50 | + showErrorAlert("工序号不能为空!!") |
| 51 | + return false |
| 52 | + } |
| 53 | + if (isNull(values.operationId)) { |
| 54 | + showErrorAlert("工步号不能为空!!") |
| 55 | + return false |
| 56 | + } |
| 57 | + if (isNull(values.type)) { |
| 58 | + showErrorAlert("类型不能为空!!") |
| 59 | + return false |
| 60 | + } |
| 61 | + const reg = /^-?(0|([1-9]\d*))(\.\d{1,4})?$/ |
| 62 | + const reg1 = /^(0|[1-9]\d*)$/ |
| 63 | + if (!reg.test(values.minMatchValue)) { |
| 64 | + showErrorAlert("最小匹配度值格式有误(请填写数字,最多四位小数!)") |
| 65 | + return false |
| 66 | + } |
| 67 | + if (!reg1.test(values.deadMaxRate)) { |
| 68 | + showErrorAlert("死点最大占比格式有误(请填写大于0小于100的整数值!)") |
| 69 | + return false |
| 70 | + } |
| 71 | + if (Number(values.deadMaxRate) <=0 || Number(values.deadMaxRate) >=100) { |
| 72 | + showErrorAlert("死点最大占比格式有误(请填写大于0小于100的整数值!)") |
| 73 | + return false |
| 74 | + } |
| 75 | + if (!reg.test(values.minTrimQty)) { |
| 76 | + showErrorAlert("最小trim量值格式有误(请填写数字,最多四位小数!)") |
| 77 | + return false |
| 78 | + } |
| 79 | + if (!reg.test(values.targetValue)) { |
| 80 | + showErrorAlert("氧化硅目标值格式有误(请填写数字,最多四位小数!)") |
| 81 | + return false |
| 82 | + } |
| 83 | + if (!reg1.test(values.maxExceptionPoint)) { |
| 84 | + showErrorAlert("最多异常点位数格式有误(请填写正整数!)") |
| 85 | + return false |
| 86 | + } |
| 87 | + return true |
| 88 | +} |
| 89 | + |
| 90 | +function refreshFlowConfigGrid() { |
| 91 | + const mainTabPanel = Ext.getCmp("mainTabPanel") |
| 92 | + const store = mainTabPanel.down("[name=listGrid]").getStore() |
| 93 | + store.currentPage = 1 |
| 94 | + store.load() |
| 95 | +} |
| 96 | + |
| 97 | +function delFlowConfig() { |
| 98 | + const mainTabPanel = Ext.getCmp("mainTabPanel") |
| 99 | + const listGrid = mainTabPanel.down("[name=listGrid]") |
| 100 | + const records = listGrid.getSelectionModel().getSelection() |
| 101 | + if (records.length <= 0) { |
| 102 | + showWarningAlert("至少选择一条删除!!!") |
| 103 | + return |
| 104 | + } |
| 105 | + Ext.MessageBox.confirm(i18n.labels.LBS_CONFIRM, "是否确认删除?", function (button) { |
| 106 | + if (button === "yes") { |
| 107 | + const rrns = [] |
| 108 | + for (let i = 0; i < records.length; i++) { |
| 109 | + rrns.push(records[i].data.cpRrn) |
| 110 | + } |
| 111 | + Ext.Ajax.request({ |
| 112 | + url: actionURL, |
| 113 | + requestMethod: "delCpConfigs", |
| 114 | + params: { |
| 115 | + rowRrns: rrns, |
| 116 | + type: type |
| 117 | + }, |
| 118 | + success: function (resp, opts) { |
| 119 | + showSuccessAlert("删除成功!") |
| 120 | + refreshFlowConfigGrid() |
| 121 | + }, |
| 122 | + failure: function (resp, opts) {} |
| 123 | + }) |
| 124 | + } |
| 125 | + }) |
| 126 | +} |
0 commit comments