diff --git a/src/views/system/VersionAdminView.vue b/src/views/system/VersionAdminView.vue index 7c808d3..e60be49 100644 --- a/src/views/system/VersionAdminView.vue +++ b/src/views/system/VersionAdminView.vue @@ -174,7 +174,34 @@ var publishTimePicker = $('#publishTime').datetimepicker({ export default { name: "VersionAdminView", setup() { - return {}; + + function setSelectOption(id, obj) { + var os = $(obj).val(); + var channel = $("#old_" + id).val(); + $.ajax({ + type: "get", + url: '/admin/version/getPlatform.action', + data: { + os: os + }, + dataType: 'json', + success: function (json) { + if (json.data) { + makeOption(id, json.data, channel); + if (channel != '' && channel != 'undefined') { + $('.selectpicker').selectpicker('val', channel); + } else { + $('.selectpicker').selectpicker('val', ''); + } + $('.selectpicker').selectpicker('refresh'); + } + } + }) + } + window.setSelectOption = setSelectOption; + return { + setSelectOption + }; }, created() { this.$nextTick(function () { @@ -196,7 +223,7 @@ export default { initTable(); }); - setSelectOption("platform_query", $("#os_query")); + window.setSelectOption("platform_query", $("#os_query")); $("#table").on("click", '.opt-remove', function () { var id = $(this).attr("data-id"); @@ -238,7 +265,7 @@ export default { $("#version").removeAttr("disabled", "disabled"); $("#platform").removeAttr("disabled", "disabled"); $('#save').attr("disabled", false); - setSelectOption("platform", $("#os")); + window.setSelectOption("platform", $("#os")); }); $("#multiDel").click(function () { @@ -405,7 +432,7 @@ export default { $("#description").val(json.entity.description); $("#status").val(json.entity.status); ComboboxHelper.setDef("#status", json.entity.status); - setSelectOption("platform", $("#os")); + window.setSelectOption("platform", $("#os")); $("#publishTime").val(publishDate); $("#downloadLink").val(json.entity.downloadLink); $("#fileMd5").val(json.entity.fileMd5); @@ -475,30 +502,6 @@ export default { } }; -function setSelectOption(id, obj) { - var os = $(obj).val(); - var channel = $("#old_" + id).val(); - $.ajax({ - type: "get", - url: '/admin/version/getPlatform.action', - data: { - os: os - }, - dataType: 'json', - success: function (json) { - if (json.data) { - makeOption(id, json.data, channel); - if (channel != '' && channel != 'undefined') { - $('.selectpicker').selectpicker('val', channel); - } else { - $('.selectpicker').selectpicker('val', ''); - } - $('.selectpicker').selectpicker('refresh'); - } - } - }) -} - function makeOption(id, data, channel) { console.log("id=" + id + ",channel=" + channel); var str = "";