zhangyanpeng
2024-08-04 ebed520250ddb28e668f8181485ca2a6c61747d7
module/config/page/criteria_rule_evaluation.html
New file
@@ -0,0 +1,327 @@
<!doctype html>
<html>
   <head>
      <meta charset="utf-8"><meta http-equiv="Expires" content="0"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-control" content="no-cache"><meta http-equiv="Cache" content="no-cache">
      <title>评估管理</title>
      <script type="text/javascript">
         var pageVue = null;
         function loadJsCss(callback) {
            var jscss_urls = [];
            window.top.initJsCss(document, jscss_urls, callback);
         };
         function initVue() {
            new ListVue({
               el: "#vbody",
               data: {
                  dataname: "md_org_account_criteria_rule",
                  title: "评估管理",
                  filterfieldClick: {},
                  tablefieldClick: {},
                  formfieldClick: {},
                  tablebuttonclick: [],
                  cbuttons_r: {},
                  filterTxt:"1=1 and type_code='Evaluation'",
                  filterObj: {},
                  filterObjBydefault: {},
               },
               created() {
               },
               mounted() {
                  var me = this;
                  if (window.top.tab.selected.option.page_id) {
                     // this.page_id = window.top.tab.selected.option.page_id;
                     getPageByPageId(window.top.tab.selected.option.page_id, function(result){
                        me.cbuttons_r = result.buttons_r;
                        //获取数据
                        me.initData();
                        me.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
                           hideLoading();
                        });
                     })
                  }
               },
               methods:{
                  initData() {
                     var me = this;
                     this.onQuery(function(result, callback) {//查询后的回调,用于获取字段的
                        me.filterObjBydefault = {}
                        if (result.meta && result.meta[me.dataname] && result.meta[me.dataname].fields) {
                           var metas = clone(result.meta[me.dataname].fields);
                           var filterFields_ = [];
                           var tableFields_ = [];
                           metas.map(f=>{
                              f.isshow = "T";
                              if (f.field == 'group_name' || f.field == 'group_batch_name' || f.field == 'content_before' ) {
                                 f.isfilter = true
                                 filterFields_.push(clone(f));
                              }
                              // if (f.isfilter) {
                              //    filterFields_.push(clone(f));
                              // }
                              else {
                                 var filter_f = clone(f);
                                 filter_f.isshow = "F";
                                 filterFields_.push(filter_f);
                              }
                              tableFields_.push(clone(f));
                           })
                           if (!me.filterFields || (me.filterFields && me.filterFields.length == 0)) {
                              me.filterFields = clone(filterFields_);
                              me.tableFields = clone(tableFields_);
                              //字段数组转字段obj,目的为了筛选时获取字段属性
                              me.fieldsToFieldsObj();
                              //设置字段事件
                              me.tableFieldClick();
                           }
                           me.tableButtonClick();
                        }
                        if (callback) {
                           callback();
                        }
                     });
                  },
                  tableButtonClick() {
                            var me = this;
                            var tablebuttonClick = [];
                            tablebuttonClick = [
                        {
                           isbuttonshow: true,type:"primary",
                           code: "add",isselected: false,classname: "",
                           onclick: function(obj) {
                              // me.onEditData('add', {})
                           }
                        },
                        {
                           isbuttonshow: true,type:"primary",
                           code: "edit", isselected: true, classname:"",
                           disabled: function(selectRowList) {
                                        var bo_ = true ;
                                        if (selectRowList[0]) {
                                            bo_ = false
                                        }
                                        return bo_;
                                    },
                           onclick: function(obj) {
                              // me.onEditData('edit', obj.selectedList[0]);
                           }
                        },
                     ]
                     this.tablebuttonclick = tablebuttonClick;
                  },
                  tableFieldClick() {
                  },
                  onSaveBUProduct(list) {
                     var me = this;
                     if (list.length) {
                        var row = list[0];
                        var param = {
                           dataname: "md_bu_product",
                           data: {},
                        }
                        param.data["md_bu_product"] = row;
                        Server.call("root/data/saveEntity", param, function(result) {
                           console.log(result);
                           if (result.success) {
                              list.remove(row);
                              me.onSaveBUProduct(list);
                           }
                        });
                     }
                     else {
                        me.initData();
                     }
                  },
                  onAllocation(bu_, callback) {
                     var me = this;
                     var config = {
                        totab: false, //true: 以Tab导航的方式打开
                        width: "400px",
                        height: "400px",
                        icon: "icon-product",
                        text: "产品分配",
                        url: "module/tool/page/popup_allocation.html",
                        data: bu_,
                        delta: {},
                        sceneCode: "add", //"add"//"browse",
                        callback: function(popupobj, popupcallback) {
                           callback(popupobj.row);
                           if (popupcallback) {
                              popupcallback();
                           }
                        }
                     };
                     me.doPopupByPublic(config);
                  },
                  onEditData(sceneCode, row) {
                     var me = this;
                     if (sceneCode == "edit" && !row.id) {
                        Root.message({
                           type: 'warning',
                           message: '请选择要编辑的数据'
                        });
                        return;
                     }
                     //3. popup
                     var config = {
                        totab: false, //true: 以Tab导航的方式打开
                        width: "500px",
                        height: "290px",
                        icon: "icon-product",
                        text: "产品编辑",
                        id: "product_edit" + row.id,//totab: true时需设置,用于判断是否已打开此页面
                        url: "module/md/page/product/page/product_edit.html",
                        data: row,
                        delta: null,
                        sceneCode: sceneCode,//"refuseedit",//"approval", //"add"//"browse",
                        callback: function(obj, callback) {
                           me.onQuery();
                           if (callback) {
                              callback();
                           }
                        }
                     };
                     me.doPopupByPublic(config);
                  },
                  onSaveData(type, row) {
                     var me = this;
                     var param = {
                        dataname: me.dataname,
                        data: {},
                     }
                     param.data[me.dataname] = row;
                     Server.call("root/data/saveEntity", param, function(result) {
                        console.log(result);
                        if (result.success) {
                           var message = "已生效"
                           if (type == "repeal") {
                              message = "已作废"
                           }
                           Root.message({
                              type: 'success',
                              message: message
                           });
                           me.onQuery();
                        }
                     });
                  },
                  onDeleteData(row) {
                     let me = this;
                     if (!row.id) {
                        Root.message({
                           type: 'warning',
                           message: '请先选择要删除的数据'
                        });
                        return
                     }
                     Root.confirm('确定删除' + row.name + '吗?', '删除提示', {
                       confirmButtonText: '删除',
                       cancelButtonText: '取消',
                       type: 'warning'
                     }).then(() => {
                        let param = {
                           id: row.id,
                           dataname: me.dataname,
                        }
                        Server.call("root/data/deleteEntity", param, function(result) {
                           Root.message({
                              type: 'success',
                              message: '删除成功!'
                           });
                           me.onQuery();
                        });
                     }).catch(() => {
                        Root.message({
                           type: 'info',
                           message: '已取消删除'
                        });
                     });
                  },
               }
            });
         };
         loadJsCss(function () {
            initVue();
         });
      </script>
      <style>
         /* 在vue.js中 v-cloak 这个指令是防止页面加载时出现 vuejs 的变量名而设计的 */
         [v-cloak] {
            display: none !important;
         }
      </style>
   </head>
   <body style="margin: 0px; ">
      <div v-cloak id="vbody">
         <div id="page_root">
            <div class="topbar">
               <span>{{title}}</span>
               <div :class="page_title == 'right' ? 'h_page_button_left' : 'h_page_button_right'">
                  <!-- <el-button-group style="margin-left: 3px;">
                  </el-button-group> -->
               </div>
            </div>
            <div class="h_dialog__body">
               <h-table
                  v-if="isRefresh && tableFields.length"
                  ref="table1"
                  :table-fields="tableFields"
                  :table-data="tableData"
                  :is-edit-table-data="isEditTableData"
                  :pagesize="pagesize"
                  :pagenum="pagenum"
                  :total="total"
                  :table-height="tableHeight"
                  :table-field-click="tablefieldClick"
                  :table-buttons-click="tablebuttonclick"
                  :tableloading="tableloading"
                  :isdraggableorder="false"
                  :is-highlight-row="true"
                  :filtersobj="filterObj"
                  v-on:get-data="getData"
                  v-on:row-click="rowClick"
               >
               </h-table>
            </div>
         </div>
      </div>
      <div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 50vh;">
         <div class="spinner">
           <div class="cube1"></div>
           <div class="cube2"></div>
         </div>
      </div>
   </body>
</html>