Browse Source

feat: 信息价关键字表

vian 3 years ago
parent
commit
1e79b102ba

+ 8 - 0
web/maintain/price_info_lib/css/index.css

@@ -109,4 +109,12 @@ body {
     float: left;
     width: 59.9%;
     height: 100%;
+}
+
+.main .right .top {
+    height: 70%;
+}
+
+.main .right .bottom {
+    height: 30%;
 }

+ 2 - 1
web/maintain/price_info_lib/html/edit.html

@@ -50,7 +50,8 @@
                 </div>
             </div>
             <div class="right">
-                <div id="price-spread" style="width: 100%; height: 100%"></div>
+                <div class="top" id="price-spread"></div>
+                <div class="bottom" id="keyword-spread"></div>
             </div>
         </div>
     </div>

+ 36 - 0
web/maintain/price_info_lib/js/index.js

@@ -648,6 +648,33 @@ const CLASS_BOOK = (() => {
 
 })();
 
+// 关键字表
+const KEYWORD_BOOK = (() => {
+    const setting = {
+        header: [
+            { headerName: '关键字', headerWidth: 200, dataCode: 'keyword', dataType: 'String', hAlign: 'left', vAlign: 'center' },
+            { headerName: '关键字效果', headerWidth: 100, dataCode: 'coe', dataType: 'String', hAlign: 'center', vAlign: 'center' },
+            { headerName: '组别', headerWidth: 50, dataCode: 'group', dataType: 'String', hAlign: 'center', vAlign: 'center' },
+            { headerName: '选项号', headerWidth: 70, dataCode: 'optionCode', dataType: 'String', hAlign: 'center', vAlign: 'center' },
+        ],
+    };
+    // 初始化表格
+    const workBook = initSheet($('#keyword-spread')[0], setting);
+    workBook.options.allowUserDragDrop = false;
+    workBook.options.allowUserDragFill = false;
+    lockUtil.lockSpreads([workBook], true);
+    const sheet = workBook.getSheet(0);
+
+    // 显示关键字数据
+    const showKeywordData = (keywordList) => {
+        showData(sheet, keywordList, setting.header);
+    }
+
+    return {
+        showKeywordData 
+    }
+})();
+
 // 价格信息表
 const PRICE_BOOK = (() => {
     const setting = {
@@ -685,6 +712,9 @@ const PRICE_BOOK = (() => {
         try {
             cache = await ajaxPost('/priceInfo/getPriceData', { classIDList }, TIME_OUT);
             showData(sheet, cache, setting.header, 5);
+            const row = sheet.getActiveRowIndex();
+            const keywordList = cache[row] && cache[row].keywordList || [];
+            KEYWORD_BOOK.showKeywordData(keywordList);
         } catch (err) {
             cache = [];
             sheet.setRowCount(0);
@@ -786,6 +816,12 @@ const PRICE_BOOK = (() => {
         const changedCells = [{ row: info.row }];
         handleEdit(changedCells);
     });
+    sheet.bind(GC.Spread.Sheets.Events.SelectionChanged, function (e, info) {
+        const row = info.newSelections && info.newSelections[0] ? info.newSelections[0].row : 0;
+        // 显示关键字数据
+        const keywordList = cache[row] && cache[row].keywordList || [];
+        KEYWORD_BOOK.showKeywordData(keywordList);
+    });
     sheet.bind(GC.Spread.Sheets.Events.RangeChanged, function (e, info) {
         const changedRows = [];
         let preRow;