zoukankan      html  css  js  c++  java
  • BCS 字段显示格式化

    技术部分
    1.使用SPD添加外部数据源时保证,安装SPD的客户机在同一个域中,并且在管理中心给Business Data Connectivity Service 授权
     
    2.生成的外部数据没法再后台进行格式化,只能在SPD中对外部列表进行处理;
    日期类型会映射为时间类型(会显示时间部分),处理方式为在外部列表中修改 视图  和  新建  所有窗体:
    视图:修改
    时间字段:ddwrt:FormatDate(string($thisNode/@*[name()=current()/@Name]),2052,3)
    money字段:format-number($thisNode/@*[name()=current()/@Name],'0.00')

    窗体:删除新建

    1.显示窗体
    日期字段:<xsl:value-of select="ddwrt:FormatDate(string(@PublicDate),2052,3)"/>
    money类型会映射成Decimal(会显示4位小时),处理方式为在外部列表中新建显示页面,格式化成2位小数:<xsl:value-of select="format-number(@NB,'0.00')"/>
    2.新建窗体
    日期字段:通过脚本隐藏和赋默认值值
    <script type="text/javascript">                
      document.getElementById(g_strDateTimeControlIDs[&quot;SPPublicDate&quot;]).value= new Date().format(&quot;yyyy/MM/dd&quot;); 
      document.getElementById(g_strDateTimeControlIDs[&quot;SPPublicDate&quot;] + &quot;Hours&quot;).style.display = &quot;none&quot;;       
      document.getElementById(g_strDateTimeControlIDs[&quot;SPPublicDate&quot;] + &quot;Minutes&quot;).style.display = &quot;none&quot;;
      
      // 对Date的扩展,将 Date 转化为指定格式的String 
    // 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符, 
    // 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字) 
    // 例子: 
    // (new Date()).Format(&quot;yyyy-MM-dd hh:mm:ss.S&quot;) ==&gt; 2006-07-02 08:09:04.423 
    // (new Date()).Format(&quot;yyyy-M-d h:m:s.S&quot;)      ==&gt; 2006-7-2 8:9:4.18 
    Date.prototype.Format = function(fmt) 
    { //author: meizz 
      var o = { 
        &quot;M+&quot; : this.getMonth()+1,                 //月份 
        &quot;d+&quot; : this.getDate(),                    //日 
        &quot;h+&quot; : this.getHours(),                   //小时 
        &quot;m+&quot; : this.getMinutes(),                 //分 
        &quot;s+&quot; : this.getSeconds(),                 //秒 
        &quot;q+&quot; : Math.floor((this.getMonth()+3)/3), //季度 
        &quot;S&quot;  : this.getMilliseconds()             //毫秒 
      }; 
      if(/(y+)/.test(fmt)) 
        fmt=fmt.replace(RegExp.$1, (this.getFullYear()+&quot;&quot;).substr(4 - RegExp.$1.length)); 
      for(var k in o) 
        if(new RegExp(&quot;(&quot;+ k +&quot;)&quot;).test(fmt)) 
      fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : ((&quot;00&quot;+ o[k]).substr((&quot;&quot;+ o[k]).length))); 
      return fmt; 
    }
    </script>

    3.编辑窗体
    日期字段:通过脚本隐藏,无需赋值

    ////////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////
    应用部分
    1.适用于文本内容为主的信息,涉及到数字、时间类型就比较难处理;
    2.适用于查看信息,如果要对内容进行增删改操作则体验不好;




  • 相关阅读:
    寒假作业(二)
    关于寒假的自学计划
    关于Markdown格式转PDF格式
    关于‘1001.A+B Format (20)’的解题报告
    第一次撰写博客——一切的一切才刚刚开始
    第八章 Django框架——ORM介绍之多表操作
    第七章 Django框架——ORM介绍之单表操作
    第六章 Django框架——ORM介绍之创建表
    第五章 Django框架——模板层Templates
    第四章 Django框架——视图层views
  • 原文地址:https://www.cnblogs.com/ruijian/p/3291750.html
Copyright © 2011-2022 走看看