From 44643b90b4b9648d402f6bf12ce3f6698c5288c7 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期日, 01 十二月 2019 12:55:52 +0800
Subject: [PATCH] 优化 单元房屋编辑时的显示

---
 WebService/src/main/resources/components/unitPackage/unit-select2/unitSelect2.js |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/WebService/src/main/resources/components/unitPackage/unit-select2/unitSelect2.js b/WebService/src/main/resources/components/unitPackage/unit-select2/unitSelect2.js
index 2fe199b..d81dd98 100644
--- a/WebService/src/main/resources/components/unitPackage/unit-select2/unitSelect2.js
+++ b/WebService/src/main/resources/components/unitPackage/unit-select2/unitSelect2.js
@@ -12,6 +12,7 @@
                 unitId: '-1',
                 unitNum: '',
                 unitName: '',
+                unitSelector:{}
             }
         },
         watch: {
@@ -37,7 +38,9 @@
             });
             vc.on('unitSelect2', 'setUnit', function (_param) {
                 vc.copyObject(_param, this.unitSelect2Info);
-                $(".unitSelector").val(_param.unitId).select2();
+               /* $(".unitSelector").val(_param.unitId).select2();*/
+                var option = new Option(_param.unitNum , _param.unitId, true, true);
+                this.unitSelect2Info.unitSelector.append(option);
             });
         },
         methods: {
@@ -46,8 +49,12 @@
                 $.fn.modal.Constructor.prototype.enforceFocus = function () {
                 };
                 $.fn.select2.defaults.set('width', '100%');
-                $('#unitSelector').select2({
+                this.unitSelect2Info.unitSelector = $('#unitSelector').select2({
                     placeholder: '蹇呭~锛岃閫夋嫨鍗曞厓',
+                    allowClear: true,//鍏佽娓呯┖
+                    escapeMarkup: function (markup) {
+                        return markup;
+                    }, // 鑷畾涔夋牸寮忓寲闃叉xss娉ㄥ叆
                     ajax: {
                         url: "/callComponent/unitSelect2/loadUnits",
                         dataType: 'json',

--
Gitblit v1.8.0