let action = null; layui.config({ base: "/js/", version: 2 }).use(['system'], function () { var form = layui.form, $ = layui.jquery, element = layui.element, table = layui.table, system = layui.system, sysU = new system.u(), sendData = null, areaName = "Distribution", controllerName = "BaseLocation", app = null, completState = 90; action = { queryOptions: function () { var options = { resetFrom: "form[lay-filter=listForm]", fromId: "listForm", urlExport: `/${areaName}/${controllerName}/Export`, urlQuery: `/${areaName}/${controllerName}/Load`, mainTable: app.data.tableIns } return options; }, rowClickOptions: function () { var options = { isDefault: false, customFn: function (obj) { var stationData = obj.data; //通知主页面 返回code给工序缓存 sysU.initParentEvent(stationData); } } return options; }, checkboxMethod: function (obj) { var page = "".GetUrlParam("page") var locationCode = "".GetUrlParam("locationCode") if (page == "LocationChoice") { var checkBoxData = { stationCode: null, endPositionCode: locationCode, checkeds: obj.checked, } if (obj.type == "all") { checkBoxData.stationCode = sysU.getTableAllData(app.data.tableElem).GetArrValue("locationCode"); } else { checkBoxData.stationCode = obj.data.locationCode; } var ajaxConfig = { data: checkBoxData, url: `/distribution/BaseLocation/OperateLocationStation`, success: function (result) { if (sysU.successBefore(result)) return false; layer.msg(result.Message); } }; sysU.ajax(ajaxConfig); } }, //所有动作成功之后 actionSuccess: (falg) => { app.data.tableIns.config.where = {}; app.data.tableIns.config.page.curr = 1; app.data.tableIns.reload(app.data.tableElem, {}); } } app = { data: { cols: [[ { checkbox: true, fixed: true }, { field: "id", width: 80, hide: true, title: "Id" }, { field: "keys", width: 80, hide: true, title: "Keys" }, { field: "locationCode", width: 250, title: "料点编码" }, { field: "locationName", width: 300, title: "料点名称" }, { field: "stationCode", width: 250, title: "工位编码" }, { field: "zoneCode", width: 100, title: "区域编码", templet: function (obj) { return "".GetState(window.top.EnumLocationZoneCode, obj.zoneCode); } } ]], tableIns: null, tableElem: "mainList", //下拉框配置 selectOption: { //station: { // SelType: "FromUrl", // SelFrom: `/${areaName}/${controllerName}/StationLineSelect`, // SelLabel: "workStationName", // SelValue: "workStationCode", // OptGroup: true, // Dom: [$("[name='stationCode']")] //}, //返回的数据 用于后续操作 selectData: { } } }, methods: { initTable: function () { var locationCode = "".GetUrlParam("locationCode"); var config = { "locationCode": locationCode }; let options = { elem: "#" + app.data.tableElem, url: `/${areaName}/${controllerName}/LoadData`, cols: sysU.columnRecord(app.data.tableElem, app.data.cols), toolbar: '#toolbarTable', where: config, doneExtend: function (res, obj) { var page = "".GetUrlParam("page"); //刷新选中 if (page == "LocationChoice") { let ajaxConfig = { data: { locationCode: locationCode }, url: `/distribution/BaseLocation/GetLocationChoiceByLocationCode`, success: function (result) { if (sysU.successBefore(result)) return false; var targetArrValue = result.Result.map(function (e) { return e.startPositionCode; }); var selectColKey = "".GetUrlParam("selectColKeyCustom"); sysU.SetTableCheck(targetArrValue, res, selectColKey, app.data.tableElem); } }; sysU.ajax(ajaxConfig); } } } app.data.tableIns = sysU.initTable(options); }, initSelectTable: function () { }, initFrom() { sysU.initSelect(app.data.selectOption); } }, registerEvent: function () { }, init: function () { app.methods.initTable(); app.methods.initFrom(); app.registerEvent(); } }; app.init(); });