format.js 70 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598
  1. (function ($) {
  2. //========= ts 时间戳转换
  3. // 年月日时分
  4. $.extend($.fn.fmatter, {
  5. ts: function (cellvalue, options, rowdata) {
  6. var date = new Date();
  7. date.setTime(cellvalue);
  8. var y = date.getFullYear();
  9. var m = date.getMonth() + 1;
  10. m = m < 10 ? ('0' + m) : m;
  11. var d = date.getDate();
  12. d = d < 10 ? ('0' + d) : d;
  13. var h = date.getHours();
  14. h = h < 10 ? ('0' + h) : h;
  15. var minute = date.getMinutes();
  16. var second = date.getSeconds();
  17. minute = minute < 10 ? ('0' + minute) : minute;
  18. second = second < 10 ? ('0' + second) : second;
  19. //如果是1900-1-1,就返回空
  20. // if (y == '1900' && m == '01' && d == '01')
  21. // return "";
  22. if (y == 1970)
  23. return "";
  24. if (y <= 1900)
  25. return "";
  26. if (y >= 2199)
  27. return "";
  28. // return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
  29. // return y + '-' + m + '-' + d;
  30. return y + '-' + m + '-' + d + ' ' + h + ':' + minute;
  31. }
  32. });
  33. $.extend($.fn.fmatter.ts, {
  34. unformat: function (cellvalue, options) {
  35. return (new Date(cellvalue)).valueOf();
  36. }
  37. });
  38. //========= ts 时间戳转换
  39. // 格式化年月日
  40. $.extend($.fn.fmatter, {
  41. tsymd: function (cellvalue, options, rowdata) {
  42. if (cellvalue == undefined || cellvalue == null || cellvalue == "")
  43. return "";
  44. var date = new Date();
  45. date.setTime(cellvalue);
  46. var y = date.getFullYear();
  47. var m = date.getMonth() + 1;
  48. m = m < 10 ? ('0' + m) : m;
  49. var d = date.getDate();
  50. d = d < 10 ? ('0' + d) : d;
  51. var h = date.getHours();
  52. h = h < 10 ? ('0' + h) : h;
  53. var minute = date.getMinutes();
  54. var second = date.getSeconds();
  55. minute = minute < 10 ? ('0' + minute) : minute;
  56. second = second < 10 ? ('0' + second) : second;
  57. //如果是1900-1-1,就返回空
  58. // if (y == '1900' && m == '01' && d == '01')
  59. // return "";
  60. if (y == 1970)
  61. return "";
  62. if (y <= 1900)
  63. return "";
  64. if (y >= 2199)
  65. return "";
  66. // return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
  67. return y + '-' + m + '-' + d;
  68. // return y + '-' + m + '-' + d + ' ' + h + ':' + minute;
  69. }
  70. });
  71. //========= ts 时间戳转换,只返回year
  72. $.extend($.fn.fmatter, {
  73. tsyyyy: function (cellvalue, options, rowdata) {
  74. if (cellvalue == undefined || cellvalue == null || cellvalue == "")
  75. return "";
  76. var date = new Date();
  77. date.setTime(cellvalue);
  78. var y = date.getFullYear();
  79. var m = date.getMonth() + 1;
  80. m = m < 10 ? ('0' + m) : m;
  81. var d = date.getDate();
  82. d = d < 10 ? ('0' + d) : d;
  83. var h = date.getHours();
  84. h = h < 10 ? ('0' + h) : h;
  85. var minute = date.getMinutes();
  86. var second = date.getSeconds();
  87. minute = minute < 10 ? ('0' + minute) : minute;
  88. second = second < 10 ? ('0' + second) : second;
  89. //如果是1900-1-1,就返回空
  90. // if (y == '1900' && m == '01' && d == '01')
  91. // return "";
  92. if (y == 1970)
  93. return "";
  94. if (y <= 1900)
  95. return "";
  96. if (y >= 2199)
  97. return "";
  98. return y;
  99. }
  100. });
  101. $.extend($.fn.fmatter.tsymd, {
  102. unformat: function (cellvalue, options) {
  103. return (new Date(cellvalue)).valueOf();
  104. }
  105. });
  106. // 格式化年月日时分秒
  107. $.extend($.fn.fmatter, {
  108. tsymds: function (cellvalue, options) {
  109. if (!cellvalue) {
  110. return "";
  111. }
  112. var timestamp = moment(new Date(parseInt(cellvalue)));
  113. return timestamp.format("YYYY-MM-DD HH:mm:ss");
  114. }
  115. });
  116. // 保留两位小数
  117. $.extend($.fn.fmatter, {
  118. decimalPlaces: function (cellvalue, options) {
  119. if (!cellvalue) {
  120. return "";
  121. }
  122. if (isNaN(cellvalue)) {
  123. return cellvalue;
  124. }
  125. return (cellvalue ? (parseFloat(cellvalue).toFixed(2) + '') : "");
  126. }
  127. });
  128. // 格式化金额千分位
  129. $.extend($.fn.fmatter, {
  130. thousands: function (cellvalue, options) {
  131. if (!cellvalue) {
  132. return "";
  133. }
  134. if (isNaN(cellvalue)) {
  135. return cellvalue;
  136. }
  137. return (cellvalue ? ('¥' + parseFloat(cellvalue).toFixed(2) + '').replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') : "");
  138. }
  139. });
  140. // 去掉小数后面的零,针对 BigDecimal 类型
  141. $.extend($.fn.fmatter, {
  142. formatZero: function (cellvalue, options) {
  143. if (!cellvalue) {
  144. return "";
  145. }
  146. return (cellvalue ? (parseFloat(cellvalue) + '') : "");
  147. }
  148. });
  149. //========= enable 转换
  150. $.extend($.fn.fmatter, {
  151. enable: function (cellvalue, options, rowdata) {
  152. switch ($.trim(cellvalue)) {
  153. case '1':
  154. return '启用';
  155. case '0':
  156. return '禁用';
  157. case '-1':
  158. return '删除';
  159. }
  160. return cellvalue;
  161. }
  162. });
  163. $.extend($.fn.fmatter.enable, {
  164. unformat: function (cellvalue, options) {
  165. if (cellvalue === '启用') {
  166. return 1;
  167. } else if (cellvalue === '禁用') {
  168. return 0;
  169. } else if (cellvalue === '删除') {
  170. return -1;
  171. }
  172. return cellvalue;
  173. }
  174. });
  175. //========= c1转换
  176. $.extend($.fn.fmatter, {
  177. c1: function (cellvalue, options, rowdata) {
  178. if (cellvalue) {
  179. return '#' + cellvalue;
  180. }
  181. return '';
  182. }
  183. });
  184. $.extend($.fn.fmatter.c1, {
  185. unformat: function (cellvalue, options) {
  186. if (cellvalue) {
  187. return cellvalue.slice(1);
  188. }
  189. return cellvalue.slice(1);
  190. }
  191. });
  192. //========= beAction 转换
  193. $.extend($.fn.fmatter, {
  194. ba: function (cellvalue, options, rowdata) {
  195. if (cellvalue === 'Y') {
  196. return '启用';
  197. } else if (cellvalue === 'N') {
  198. return '禁用';
  199. } else if (cellvalue === 'D') {
  200. return '删除';
  201. }
  202. return cellvalue;
  203. }
  204. });
  205. $.extend($.fn.fmatter.ba, {
  206. unformat: function (cellvalue, options) {
  207. if (cellvalue === '启用') {
  208. return 'Y';
  209. } else if (cellvalue === '禁用') {
  210. return 'N';
  211. } else if (cellvalue === '删除') {
  212. return 'D';
  213. }
  214. return cellvalue;
  215. }
  216. });
  217. //========= loginType登录类型转换
  218. $.extend($.fn.fmatter, {
  219. lt: function (cellvalue, options, rowdata) {
  220. if (cellvalue === 'pwd') {
  221. return '账号密码';
  222. }
  223. return cellvalue;
  224. }
  225. });
  226. $.extend($.fn.fmatter.lt, {
  227. unformat: function (cellvalue, options) {
  228. if (cellvalue === '账号密码') {
  229. return 'pwd';
  230. }
  231. return cellvalue;
  232. }
  233. });
  234. //========= double转换
  235. $.extend($.fn.fmatter, {
  236. double: function (cellvalue, options, rowdata) {
  237. if (cellvalue != null) {
  238. return parseFloat(cellvalue).toFixed(2);
  239. }
  240. return '';
  241. }
  242. });
  243. //========= 特殊字符的浮点 转换
  244. $.extend($.fn.fmatter, {
  245. doubleToFixed: function (cellvalue, options, rowdata) {
  246. if (cellvalue != null) {
  247. var res = parseFloat(cellvalue).toFixed(2);
  248. if (isNaN(res)) {
  249. return '';
  250. } else {
  251. return res;
  252. }
  253. }
  254. return '';
  255. }
  256. });
  257. //========= 是否 转换
  258. $.extend($.fn.fmatter, {
  259. yesOrNo: function (cellvalue, options, rowdata) {
  260. switch ($.trim(cellvalue)) {
  261. case '1':
  262. return '是';
  263. case '0':
  264. return '否';
  265. }
  266. return "";
  267. }
  268. });
  269. $.extend($.fn.fmatter.yesOrNo, {
  270. unformat: function (cellvalue, options) {
  271. if (cellvalue === '是') {
  272. return 1;
  273. } else if (cellvalue === '否') {
  274. return 0;
  275. }
  276. return "";
  277. }
  278. });
  279. $.extend($.fn.fmatter, {
  280. isMust: function (cellvalue, options, rowdata) {
  281. switch ($.trim(cellvalue)) {
  282. case '1':
  283. return '必换件';
  284. case '0':
  285. return '';
  286. }
  287. return "";
  288. }
  289. });
  290. //========= 取消、未取消 转换
  291. $.extend($.fn.fmatter, {
  292. cancel: function (cellvalue, options, rowdata) {
  293. switch ($.trim(cellvalue)) {
  294. case '1':
  295. return '取消';
  296. case '0':
  297. return '未取消';
  298. }
  299. return "";
  300. }
  301. });
  302. $.extend($.fn.fmatter.cancel, {
  303. unformat: function (cellvalue, options) {
  304. if (cellvalue === '取消') {
  305. return 1;
  306. } else if (cellvalue === '未取消') {
  307. return 0;
  308. }
  309. return "";
  310. }
  311. });
  312. //========= 2019-02-25
  313. $.extend($.fn.fmatter, {
  314. status: function (cellvalue, options, rowdata) {
  315. if (cellvalue == 1) {
  316. return "<span style='color: green;'>正常<span>";
  317. } else if (cellvalue == -1) {
  318. return "<span style='color: red;'>停用<span>";
  319. } else if (cellvalue == 0) {
  320. return '草稿';
  321. }
  322. return "";
  323. }
  324. });
  325. $.extend($.fn.fmatter, {
  326. matQc: function (cellvalue, options, rowdata) {
  327. if (cellvalue == 1) {
  328. return "<span style='color: green;'>正常<span>";
  329. } else if (cellvalue == 2) {
  330. return "<span style='color: #ff8205;'>超期<span>";
  331. } else if (cellvalue == 3) {
  332. return "<span style='color: red;'>报废<span>";
  333. }
  334. return "无";
  335. }
  336. });
  337. $.extend($.fn.fmatter, {
  338. stockupStatus: function (cellvalue, options, rowdata) {
  339. if (cellvalue == 1) {
  340. return "<span style='color: green;'>已完成<span>";
  341. } else if (cellvalue == 0) {
  342. return "未完成";
  343. }
  344. return "";
  345. }
  346. });
  347. $.extend($.fn.fmatter, {
  348. stockupStatusAll: function (cellvalue, options, rowdata) {
  349. var obj = $.yvan.sysDict('stockupStatusAll');
  350. for (i = 0; i < obj.data.length; i++) {
  351. if (cellvalue == obj.data[i].id) {
  352. // return obj.data[i].text;
  353. if (cellvalue == 6) {
  354. return "<span style='color: green;'>" + obj.data[i].text + "<span>";
  355. } else {
  356. return obj.data[i].text;
  357. }
  358. }
  359. }
  360. // return cellvalue;
  361. // if (cellvalue == 1) {
  362. // return "<span style='color: green;'>已完成<span>";
  363. // } else if (cellvalue == 0) {
  364. // return "未完成";
  365. // }
  366. return "";
  367. }
  368. });
  369. $.extend($.fn.fmatter, {
  370. scrapStatus: function (cellvalue, options, rowdata) {
  371. if (cellvalue == 0) {
  372. return "待处理";
  373. } else if (cellvalue == 1) {
  374. return "撤销";
  375. } else if (cellvalue == 2) {
  376. return "完成";
  377. }
  378. return "";
  379. }
  380. });
  381. $.extend($.fn.fmatter, {
  382. expStatus: function (cellvalue, options, rowdata) {
  383. if (cellvalue == 1) {
  384. return "<span style='color: green;'>正常<span>";
  385. } else if (cellvalue == 2) {
  386. return "<span style='color: blue'>预警<span>";
  387. } else if (cellvalue == 3) {
  388. return "<span style='color: red;'>紧急<span>";
  389. }
  390. return "";
  391. }
  392. });
  393. $.extend($.fn.fmatter.status, {
  394. unformat: function (cellvalue, options) {
  395. if (cellvalue === '正常') {
  396. return 1;
  397. } else if (cellvalue === '禁用') {
  398. return 0;
  399. } else if (cellvalue === '删除') {
  400. return -1;
  401. }
  402. return "";
  403. }
  404. });
  405. /*--add by sjq----------------------------------------------*/
  406. // one can consider to use $.type instead of some functions below (see http://api.jquery.com/jQuery.type/)
  407. /*var ffmatter = {};
  408. $.extend(ffmatter, {
  409. // one can consider to use $.type instead of some functions below (see http://api.jquery.com/jQuery.type/)
  410. isObject: function (o) {
  411. return (o && (typeof o === "object" || $.isFunction(o))) || false;
  412. },
  413. isNumber: function (o) {
  414. // probably Number.isFinite can be used instead.
  415. return typeof o === "number" && isFinite(o); // return false for +infinity, -infinity, or NaN
  416. },
  417. isValue: function (o) {
  418. return (this.isObject(o) || typeof o === "string" || this.isNumber(o) || typeof o === "boolean");
  419. },
  420. isEmpty: function (o) {
  421. if (typeof o !== "string" && this.isValue(o)) {
  422. return false;
  423. }
  424. if (!this.isValue(o)) {
  425. return true;
  426. }
  427. o = $.trim(o).replace(/&nbsp;/ig, "").replace(/&#160;/ig, "");
  428. return o === "";
  429. },
  430. NumberFormat: function (nData, opts) {
  431. var isNumber = ffmatter.isNumber;
  432. if (!isNumber(nData)) {
  433. nData *= 1;
  434. }
  435. if (isNumber(nData)) {
  436. var bNegative = (nData < 0);
  437. var sOutput = String(nData);
  438. var sDecimalSeparator = opts.decimalSeparator || ".";
  439. var nDotIndex;
  440. if (isNumber(opts.decimalPlaces)) {
  441. // Round to the correct decimal place
  442. var nDecimalPlaces = opts.decimalPlaces;
  443. // we use rounding described in http://www.jacklmoore.com/notes/rounding-in-javascript/
  444. sOutput = String(Number(Math.round(nData + "e" + nDecimalPlaces) + "e-" + nDecimalPlaces));
  445. nDotIndex = sOutput.lastIndexOf(".");
  446. if (nDecimalPlaces > 0) {
  447. // Add the decimal separator
  448. if (nDotIndex < 0) {
  449. sOutput += sDecimalSeparator;
  450. nDotIndex = sOutput.length - 1;
  451. } else if (sDecimalSeparator !== ".") { // Replace the "."
  452. sOutput = sOutput.replace(".", sDecimalSeparator);
  453. }
  454. // Add missing zeros
  455. while ((sOutput.length - 1 - nDotIndex) < nDecimalPlaces) {
  456. sOutput += "0";
  457. }
  458. }
  459. }
  460. if (opts.thousandsSeparator) {
  461. var sThousandsSeparator = opts.thousandsSeparator;
  462. nDotIndex = sOutput.lastIndexOf(sDecimalSeparator);
  463. nDotIndex = (nDotIndex > -1) ? nDotIndex : sOutput.length;
  464. // we cut the part after the point for integer numbers
  465. // it will prevent storing/restoring of wrong numbers during inline editing
  466. var sNewOutput = opts.decimalSeparator === undefined ? "" : sOutput.substring(nDotIndex);
  467. var nCount = -1, i;
  468. for (i = nDotIndex; i > 0; i--) {
  469. nCount++;
  470. if ((nCount % 3 === 0) && (i !== nDotIndex) && (!bNegative || (i > 1))) {
  471. sNewOutput = sThousandsSeparator + sNewOutput;
  472. }
  473. sNewOutput = sOutput.charAt(i - 1) + sNewOutput;
  474. }
  475. sOutput = sNewOutput;
  476. }
  477. return sOutput;
  478. }
  479. return nData;
  480. }
  481. });
  482. var insertPrefixAndSuffix = function (sOutput, opts) {
  483. // Prepend prefix
  484. sOutput = (opts.prefix) ? opts.prefix + sOutput : sOutput;
  485. // Append suffix
  486. return (opts.suffix) ? sOutput + opts.suffix : sOutput;
  487. },
  488. numberHelper = function (cellval, opts, formatType) {
  489. var colModel = opts.colModel, op = $.extend({}, opts[formatType]);
  490. if (colModel != null) {
  491. op = $.extend({}, op, colModel.formatoptions || {});
  492. }
  493. if (ffmatter.isEmpty(cellval)) {
  494. return insertPrefixAndSuffix(op.defaultValue, op);
  495. }
  496. return insertPrefixAndSuffix(ffmatter.NumberFormat(cellval, op), op);
  497. };
  498. integer = function (cellval, opts) {
  499. return numberHelper(cellval, opts, "integer");
  500. };
  501. number = function (cellval, opts) {
  502. return numberHelper(cellval, opts, "number");
  503. };
  504. currency = function (cellval, opts) {
  505. return numberHelper(cellval, opts, "currency");
  506. };*/
  507. // 格式化为整数
  508. $.extend($.fn.fmatter, {
  509. formatNumber: function (cellvalue, options, rowdata) {
  510. // cellvalue = 24001000.00;
  511. if (undefined == options) {
  512. // 在预览时,没有数据,需要初始化
  513. options = {};
  514. options.colModel = {};
  515. options.colModel.formatoptions = {};
  516. }
  517. options.colModel.formatoptions = {decimalSeparator: ".", decimalPlaces: 0, thousandsSeparator: ""};
  518. var tmp = $.fn.fmatter.number(cellvalue, options);
  519. // 此方法只能在grid中使用,$.fn.fmatter.number实际调用路径static/plugins/jqgrid_4.15.6/jquery.jqgrid.src.js
  520. // var tmp = number(cellvalue, options);
  521. // options.decimalSeparator,//小数分隔符,如"."
  522. // options.tousandsSwparator,//千分位分隔符,如","
  523. // options.decimalPlaces,//小数保留位数
  524. // options.defaulValue
  525. return undefined == tmp ? cellvalue : tmp;
  526. }
  527. });
  528. //去掉小数,小数后有值,保留小数
  529. $.extend($.fn.fmatter, {
  530. formatNumberBigDecimal: function (cellvalue, options, rowdata) {
  531. return parseFloat(cellvalue)
  532. }
  533. });
  534. //去掉小数,小数后有值,保留小数
  535. $.extend($.fn.fmatter, {
  536. formatNumberBigDecimalWhenNull: function (cellvalue, options, rowdata) {
  537. if (cellvalue == null) {
  538. return '';
  539. }
  540. return parseFloat(cellvalue)
  541. }
  542. });
  543. // 格式化为钱
  544. $.extend($.fn.fmatter, {
  545. formatCurrency: function (cellvalue, options, rowdata) {
  546. // cellvalue = 24001000.00;
  547. if (undefined == options) {
  548. // 在预览时,没有数据,需要初始化
  549. options = {};
  550. options.colModel = {};
  551. options.colModel.formatoptions = {};
  552. }
  553. var tmpcellvalue = cellvalue;
  554. if ("planPriceView" == options.colModel.name) {
  555. tmpcellvalue = options.rowData.planPrice;
  556. } else if ("planMoneyView" == options.colModel.name) {
  557. tmpcellvalue = options.rowData.planMoney;
  558. }
  559. options.colModel.formatoptions = {
  560. decimalSeparator: ".",
  561. thousandsSeparator: ",",
  562. decimalPlaces: 2,
  563. prefix: "¥"
  564. };
  565. var tmp = $.fn.fmatter.currency(tmpcellvalue, options);
  566. // var tmp = currency(cellvalue, options);
  567. // decimalSeparator,//小数分隔符,如"."
  568. // thousandsSeparator,//千分位分隔符,如","
  569. // decimalPlaces,//小数保留位数
  570. // defaulValue,
  571. // prefix//前缀,如加上"$"
  572. // suffix//后缀
  573. return undefined == tmp ? tmpcellvalue : tmp;
  574. }
  575. });
  576. $.extend($.fn.fmatter, {
  577. formatNumberWithColor: function (cellvalue, options, rowdata) {
  578. var tmp = $.fn.fmatter.formatNumber(cellvalue, options, rowdata);
  579. if (0 == tmp) {
  580. return "<span style='color:red;'>" + tmp + "</span>";
  581. } else {
  582. return tmp;
  583. }
  584. }
  585. });
  586. // xxxSrc命名的是原始的字段;xxxView的是加了html的字段
  587. // 1是0否
  588. $.extend($.fn.fmatter, {
  589. yesOrNoSrc: function (cellvalue, options, rowdata) {
  590. var obj = $.yvan.sysDict('yesOrNo');
  591. for (i = 0; i < obj.data.length; i++) {
  592. if (cellvalue == obj.data[i].id) {
  593. return obj.data[i].text;
  594. }
  595. }
  596. return cellvalue;
  597. }
  598. });
  599. // 信息是否完整
  600. // 1是0否
  601. $.extend($.fn.fmatter, {
  602. isFull: function (cellvalue, options, rowdata) {
  603. var obj = $.yvan.sysDict('isFull');
  604. for (i = 0; i < obj.data.length; i++) {
  605. if (cellvalue == obj.data[i].id) {
  606. return obj.data[i].text;
  607. }
  608. }
  609. return cellvalue;
  610. }
  611. });
  612. // 预警级别
  613. $.extend($.fn.fmatter, {
  614. lev: function (cellvalue, options, rowdata) {
  615. var obj = $.yvan.sysDict('lev');
  616. for (i = 0; i < obj.data.length; i++) {
  617. if (cellvalue == obj.data[i].id) {
  618. return obj.data[i].text;
  619. }
  620. }
  621. return cellvalue;
  622. }
  623. });
  624. // 三期是否正常
  625. // 1是0否
  626. $.extend($.fn.fmatter, {
  627. rExp: function (cellvalue, options, rowdata) {
  628. var obj = $.yvan.sysDict('rExp');
  629. for (i = 0; i < obj.data.length; i++) {
  630. if (cellvalue == obj.data[i].id) {
  631. return obj.data[i].text;
  632. }
  633. }
  634. return cellvalue;
  635. }
  636. });
  637. // 执行状态
  638. // 1是0否
  639. $.extend($.fn.fmatter, {
  640. exeStatus: function (cellvalue, options, rowdata) {
  641. var obj = $.yvan.sysDict('exeStatus');
  642. for (i = 0; i < obj.data.length; i++) {
  643. if (cellvalue == obj.data[i].id) {
  644. return obj.data[i].text;
  645. }
  646. }
  647. return cellvalue;
  648. }
  649. });
  650. //执行原因
  651. $.extend($.fn.fmatter, {
  652. exeType: function (cellvalue, options, rowdata) {
  653. var obj = $.yvan.sysDict('exeType');
  654. for (i = 0; i < obj.data.length; i++) {
  655. if (cellvalue == obj.data[i].id) {
  656. return obj.data[i].text;
  657. }
  658. }
  659. return cellvalue;
  660. }
  661. });
  662. // 数据是否相符
  663. // 1是0否
  664. $.extend($.fn.fmatter, {
  665. ifWrong: function (cellvalue, options, rowdata) {
  666. var obj = $.yvan.sysDict('ifWrong');
  667. for (i = 0; i < obj.data.length; i++) {
  668. if (cellvalue == obj.data[i].id) {
  669. return obj.data[i].text;
  670. }
  671. }
  672. return cellvalue;
  673. }
  674. });
  675. //物资单位类型
  676. $.extend($.fn.fmatter, {
  677. unitType: function (cellvalue, options, rowdata) {
  678. var obj = $.yvan.sysDict('unitType');
  679. for (i = 0; i < obj.data.length; i++) {
  680. if (cellvalue == obj.data[i].id) {
  681. return obj.data[i].text;
  682. }
  683. }
  684. return cellvalue;
  685. }
  686. });
  687. //账号类型
  688. $.extend($.fn.fmatter, {
  689. accType: function (cellvalue, options, rowdata) {
  690. var obj = $.yvan.sysDict('accType');
  691. for (i = 0; i < obj.data.length; i++) {
  692. if (cellvalue == obj.data[i].id) {
  693. return obj.data[i].text;
  694. }
  695. }
  696. return cellvalue;
  697. }
  698. });
  699. // 1男0女
  700. $.extend($.fn.fmatter, {
  701. genderSrc: function (cellvalue, options, rowdata) {
  702. var obj = $.yvan.sysDict('gender');
  703. for (i = 0; i < obj.data.length; i++) {
  704. if (cellvalue == obj.data[i].id) {
  705. return obj.data[i].text;
  706. }
  707. }
  708. return cellvalue;
  709. }
  710. });
  711. // 1抽查0普查
  712. $.extend($.fn.fmatter, {
  713. invTypeSrc: function (cellvalue, options, rowdata) {
  714. var obj = $.yvan.sysDict('invType');
  715. for (i = 0; i < obj.data.length; i++) {
  716. if (cellvalue == obj.data[i].id) {
  717. return obj.data[i].text;
  718. }
  719. }
  720. return cellvalue;
  721. }
  722. });
  723. // 1内部、2外部企业
  724. $.extend($.fn.fmatter, {
  725. corpTypeSrc: function (cellvalue, options, rowdata) {
  726. var obj = $.yvan.sysDict('corpType');
  727. for (i = 0; i < obj.data.length; i++) {
  728. if (cellvalue == obj.data[i].id) {
  729. return obj.data[i].text;
  730. }
  731. }
  732. return cellvalue;
  733. }
  734. });
  735. // 1内部、2外部企业
  736. $.extend($.fn.fmatter, {
  737. outStatus: function (cellvalue, options, rowdata) {
  738. var obj = $.yvan.sysDict('outStatus');
  739. for (i = 0; i < obj.data.length; i++) {
  740. if (cellvalue == obj.data[i].id) {
  741. return obj.data[i].text;
  742. }
  743. }
  744. return cellvalue;
  745. }
  746. });
  747. // 发布状态
  748. $.extend($.fn.fmatter, {
  749. statusPub: function (cellvalue, options, rowdata) {
  750. var obj = $.yvan.sysDict('statusPub');
  751. for (i = 0; i < obj.data.length; i++) {
  752. if (cellvalue == obj.data[i].id) {
  753. return obj.data[i].text;
  754. }
  755. }
  756. return cellvalue;
  757. }
  758. });
  759. // 盘存的6中状态
  760. $.extend($.fn.fmatter, {
  761. qita: function (cellvalue, options, rowdata) {
  762. var b = ['锈蚀霉变', '三期异常', '无登记卡', '无合格证', '包装破损', '物资混批'];
  763. for (var i = 0; i < 5; i++) {
  764. i = cellvalue.split(",");
  765. if (i > 0) {
  766. return b[i];
  767. }
  768. }
  769. for (i = 0; i < obj.data.length; i++) {
  770. if (cellvalue == obj.data[i].id) {
  771. return obj.data[i].text;
  772. }
  773. }
  774. return cellvalue;
  775. }
  776. });
  777. // 发布状态
  778. $.extend($.fn.fmatter, {
  779. allStatus: function (cellvalue, options, rowdata) {
  780. var obj = $.yvan.sysDict('allStatus');
  781. for (i = 0; i < obj.data.length; i++) {
  782. if (cellvalue == obj.data[i].id) {
  783. return obj.data[i].text;
  784. }
  785. }
  786. return cellvalue;
  787. }
  788. });
  789. // 是否当前记录
  790. $.extend($.fn.fmatter, {
  791. isCur: function (cellvalue, options, rowdata) {
  792. var obj = $.yvan.sysDict('isCur');
  793. for (i = 0; i < obj.data.length; i++) {
  794. if (cellvalue == obj.data[i].id) {
  795. return obj.data[i].text;
  796. }
  797. }
  798. return cellvalue;
  799. }
  800. });
  801. // 1邮箱、2手机、3工号、4IC卡ID
  802. $.extend($.fn.fmatter, {
  803. accTypeSrc: function (cellvalue, options, rowdata) {
  804. var obj = $.yvan.sysDict('accType');
  805. for (i = 0; i < obj.data.length; i++) {
  806. if (cellvalue == obj.data[i].id) {
  807. return obj.data[i].text;
  808. }
  809. }
  810. return cellvalue;
  811. }
  812. });
  813. //--Excel导入start-----------------------------------
  814. $.extend($.fn.fmatter, {
  815. tbNameSrc: function (cellvalue, options, rowdata) {
  816. var obj = $.yvan.sysDict('tbName');
  817. for (i = 0; i < obj.data.length; i++) {
  818. if (cellvalue == obj.data[i].id) {
  819. return obj.data[i].text;
  820. }
  821. }
  822. return cellvalue;
  823. }
  824. });
  825. //--Excel导入end-----------------------------------
  826. //--派工号start-----------------------------------
  827. // 0分类1机型
  828. $.extend($.fn.fmatter, {
  829. treeNodeSrc: function (cellvalue, options, rowdata) {
  830. var obj = $.yvan.sysDict('treeNode');
  831. for (i = 0; i < obj.data.length; i++) {
  832. if (cellvalue == obj.data[i].id) {
  833. return obj.data[i].text;
  834. }
  835. }
  836. return cellvalue;
  837. }
  838. });
  839. // 1主机2部附件
  840. $.extend($.fn.fmatter, {
  841. pghTypeSrc: function (cellvalue, options, rowdata) {
  842. var obj = $.yvan.sysDict('pghType');
  843. for (i = 0; i < obj.data.length; i++) {
  844. if (cellvalue == obj.data[i].id) {
  845. return obj.data[i].text;
  846. }
  847. }
  848. // 处理excel出错信息-999时给出错误返回
  849. if (-999 == cellvalue) {
  850. return "填写错误";
  851. }
  852. return cellvalue;
  853. }
  854. });
  855. // 1小保养2中保养3大保养
  856. $.extend($.fn.fmatter, {
  857. mfLevSrc: function (cellvalue, options, rowdata) {
  858. var obj = $.yvan.sysDict('mfLev');
  859. for (i = 0; i < obj.data.length; i++) {
  860. if (cellvalue == obj.data[i].id) {
  861. return obj.data[i].text;
  862. }
  863. }
  864. // 处理excel出错信息-999时给出错误返回
  865. if (-999 == cellvalue) {
  866. return "填写错误";
  867. }
  868. return cellvalue;
  869. }
  870. });
  871. /* //0草稿/1发布/2完成
  872. $.extend($.fn.fmatter, {
  873. pubStatusSrc: function (cellvalue, options, rowdata) {
  874. var tmp = options.rowData.pubStatus;
  875. var obj = $.yvan.sysDict('pubStatus');
  876. for (i = 0; i < obj.data.length; i++) {
  877. if (tmp == obj.data[i].id) {
  878. return obj.data[i].text;
  879. }
  880. }
  881. return cellvalue;
  882. }
  883. });*/
  884. //--派工号end-----------------------------------
  885. //--到货通知单start-----------------------------------
  886. $.extend($.fn.fmatter, {
  887. trackTypeSrc: function (cellvalue, options, rowdata) {
  888. if (0 == cellvalue) {
  889. return "";
  890. }
  891. var obj = $.yvan.sysDict('trackType');
  892. for (i = 0; i < obj.data.length; i++) {
  893. if (cellvalue == obj.data[i].id) {
  894. return obj.data[i].text;
  895. }
  896. }
  897. return cellvalue;
  898. }
  899. });
  900. //0草稿、1发布
  901. $.extend($.fn.fmatter, {
  902. pubStatusView: function (cellvalue, options, rowdata) {
  903. var tmp = cellvalue;
  904. if (options != undefined) {
  905. tmp = options.rowData.pubStatus;
  906. var color = tmp == 1 ? "green" : "";
  907. }
  908. var obj = $.yvan.sysDict('pubStatus');
  909. for (var i = 0; i < obj.data.length; i++) {
  910. if (tmp == obj.data[i].id) {
  911. if (options != undefined)
  912. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  913. else
  914. return obj.data[i].text;
  915. }
  916. }
  917. return cellvalue;
  918. }
  919. });
  920. //0草稿、1发布
  921. $.extend($.fn.fmatter, {
  922. billPubStatusView: function (cellvalue, options, rowdata) {
  923. var tmp = cellvalue;
  924. if (options != undefined) {
  925. tmp = options.rowData.billPubStatus;
  926. var color = tmp == 1 ? "green" : "";
  927. }
  928. var obj = $.yvan.sysDict('pubStatus');
  929. for (var i = 0; i < obj.data.length; i++) {
  930. if (tmp == obj.data[i].id) {
  931. if (options != undefined)
  932. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  933. else
  934. return obj.data[i].text;
  935. }
  936. }
  937. return cellvalue;
  938. }
  939. });
  940. //收货
  941. $.extend($.fn.fmatter, {
  942. inTypeSrc: function (cellvalue, options, rowdata) {
  943. var obj = $.yvan.sysDict('inType');
  944. for (i = 0; i < obj.data.length; i++) {
  945. if (cellvalue == obj.data[i].id) {
  946. return obj.data[i].text;
  947. }
  948. }
  949. return cellvalue;
  950. }
  951. });
  952. //收货
  953. $.extend($.fn.fmatter, {
  954. qcnoTypeSrc: function (cellvalue, options, rowdata) {
  955. var obj = $.yvan.sysDict('qcnoType');
  956. for (i = 0; i < obj.data.length; i++) {
  957. if (cellvalue == obj.data[i].id) {
  958. return obj.data[i].text;
  959. }
  960. }
  961. return cellvalue;
  962. }
  963. });
  964. //--到货通知单end-----------------------------------
  965. //检验三期阶段
  966. $.extend($.fn.fmatter, {
  967. qcstStage: function (cellvalue, options, rowdata) {
  968. if (!isNotNull(cellvalue))
  969. return "";
  970. var obj = $.yvan.sysDict('qcstStage');
  971. for (i = 0; i < obj.data.length; i++) {
  972. if (cellvalue == obj.data[i].id) {
  973. return obj.data[i].text;
  974. }
  975. }
  976. return cellvalue;
  977. }
  978. });
  979. //定检类型
  980. $.extend($.fn.fmatter, {
  981. qcstExp: function (cellvalue, options, rowdata) {
  982. var obj = $.yvan.sysDict('qcstExp');
  983. for (i = 0; i < obj.data.length; i++) {
  984. if (cellvalue == obj.data[i].id) {
  985. return obj.data[i].text;
  986. }
  987. }
  988. if (cellvalue == undefined || cellvalue == null || cellvalue == 0) {
  989. return "";
  990. }
  991. return cellvalue;
  992. }
  993. });
  994. //三期类型
  995. $.extend($.fn.fmatter, {
  996. qcstExpView: function (cellvalue, options, rowdata) {
  997. var tmp = options.rowData.qcstExp;
  998. var obj = $.yvan.sysDict('qcstExp');
  999. for (i = 0; i < obj.data.length; i++) {
  1000. if (tmp == obj.data[i].id) {
  1001. return obj.data[i].text;
  1002. }
  1003. }
  1004. if (tmp == undefined || tmp == null || tmp == 0) {
  1005. return "";
  1006. }
  1007. return tmp;
  1008. }
  1009. });
  1010. //物资类型
  1011. $.extend($.fn.fmatter, {
  1012. matType: function (cellvalue, options, rowdata) {
  1013. var obj = $.yvan.sysDict('matType');
  1014. for (i = 0; i < obj.data.length; i++) {
  1015. if (cellvalue == obj.data[i].id) {
  1016. return obj.data[i].text;
  1017. }
  1018. }
  1019. if (cellvalue == undefined || cellvalue == null || cellvalue == 0) {
  1020. return "";
  1021. }
  1022. return cellvalue;
  1023. }
  1024. });
  1025. //物流类型
  1026. $.extend($.fn.fmatter, {
  1027. allotTrackType: function (cellvalue, options, rowdata) {
  1028. var obj = $.yvan.sysDict('allotTrackType');
  1029. for (i = 0; i < obj.data.length; i++) {
  1030. if (cellvalue == obj.data[i].id) {
  1031. return obj.data[i].text;
  1032. }
  1033. }
  1034. if (cellvalue == undefined || cellvalue == null || cellvalue == 0) {
  1035. return "";
  1036. }
  1037. return cellvalue;
  1038. }
  1039. });
  1040. //单据类型
  1041. $.extend($.fn.fmatter, {
  1042. poolType: function (cellvalue, options, rowdata) {
  1043. var obj = $.yvan.sysDict('poolType');
  1044. for (i = 0; i < obj.data.length; i++) {
  1045. if (cellvalue == obj.data[i].id) {
  1046. return obj.data[i].text;
  1047. }
  1048. }
  1049. if (cellvalue == undefined || cellvalue == null || cellvalue == 0) {
  1050. return "";
  1051. }
  1052. return cellvalue;
  1053. }
  1054. });
  1055. //物资类型
  1056. $.extend($.fn.fmatter, {
  1057. matTypeOut: function (cellvalue, options, rowdata) {
  1058. var obj = $.yvan.sysDict('matTypeOut');
  1059. for (i = 0; i < obj.data.length; i++) {
  1060. if (cellvalue == obj.data[i].id) {
  1061. return obj.data[i].text;
  1062. }
  1063. }
  1064. if (cellvalue == undefined || cellvalue == null || cellvalue == 0) {
  1065. return "";
  1066. }
  1067. return cellvalue;
  1068. }
  1069. });
  1070. //需求阶段
  1071. $.extend($.fn.fmatter, {
  1072. outapType: function (cellvalue, options, rowdata) {
  1073. var obj = $.yvan.sysDict('outapType');
  1074. for (i = 0; i < obj.data.length; i++) {
  1075. if (cellvalue == obj.data[i].id) {
  1076. return obj.data[i].text;
  1077. }
  1078. }
  1079. return '';
  1080. }
  1081. });
  1082. //成套类型
  1083. $.extend($.fn.fmatter, {
  1084. pkgId: function (cellvalue, options, rowdata) {
  1085. var obj = $.yvan.sysDict('pkgId');
  1086. for (i = 0; i < obj.data.length; i++) {
  1087. if (cellvalue == obj.data[i].id) {
  1088. return obj.data[i].text;
  1089. }
  1090. }
  1091. return '';
  1092. }
  1093. });
  1094. $.extend($.fn.fmatter, {
  1095. pkgIdView: function (cellvalue, options, rowdata) {
  1096. var tmp = options.rowData.pkgId;
  1097. var obj = $.yvan.sysDict('pkgId');
  1098. for (i = 0; i < obj.data.length; i++) {
  1099. if (tmp == obj.data[i].id) {
  1100. return obj.data[i].text;
  1101. }
  1102. }
  1103. return '';
  1104. }
  1105. });
  1106. $.extend($.fn.fmatter, {
  1107. matapType: function (cellvalue, options, rowdata) {
  1108. var obj = $.yvan.sysDict('matapType');
  1109. for (i = 0; i < obj.data.length; i++) {
  1110. if (cellvalue == obj.data[i].id) {
  1111. return obj.data[i].text;
  1112. }
  1113. }
  1114. return '';
  1115. }
  1116. });
  1117. $.extend($.fn.fmatter, {
  1118. matapStep: function (cellvalue, options, rowdata) {
  1119. var obj = $.yvan.sysDict('matapStep');
  1120. for (i = 0; i < obj.data.length; i++) {
  1121. if (cellvalue == obj.data[i].id) {
  1122. if (cellvalue == 2) {
  1123. return "<span style='color:green;'>" + obj.data[i].text + "</span>";
  1124. } else {
  1125. return obj.data[i].text;
  1126. }
  1127. }
  1128. }
  1129. return cellvalue;
  1130. }
  1131. });
  1132. //配发状态
  1133. $.extend($.fn.fmatter, {
  1134. wkStatus: function (cellvalue, options, rowdata) {
  1135. var obj = $.yvan.sysDict('wkStatus');
  1136. for (i = 0; i < obj.data.length; i++) {
  1137. if (cellvalue == obj.data[i].id) {
  1138. return obj.data[i].text;
  1139. }
  1140. }
  1141. return cellvalue;
  1142. }
  1143. });
  1144. //是否允许混批
  1145. $.extend($.fn.fmatter, {
  1146. batchMix: function (cellvalue, options, rowdata) {
  1147. var obj = $.yvan.sysDict('batchMix');
  1148. for (i = 0; i < obj.data.length; i++) {
  1149. if (cellvalue == obj.data[i].id) {
  1150. return obj.data[i].text;
  1151. }
  1152. }
  1153. return cellvalue;
  1154. }
  1155. });
  1156. //送货方式
  1157. $.extend($.fn.fmatter, {
  1158. shipType: function (cellvalue, options, rowdata) {
  1159. var obj = $.yvan.sysDict('shipType');
  1160. for (i = 0; i < obj.data.length; i++) {
  1161. if (cellvalue == obj.data[i].id) {
  1162. return obj.data[i].text;
  1163. }
  1164. }
  1165. return cellvalue;
  1166. }
  1167. });
  1168. //送货方式
  1169. $.extend($.fn.fmatter, {
  1170. shipTypeView: function (cellvalue, options, rowdata) {
  1171. var obj = $.yvan.sysDict('shipType');
  1172. for (i = 0; i < obj.data.length; i++) {
  1173. if (options.rowData.shipType == obj.data[i].id) {
  1174. return obj.data[i].text;
  1175. }
  1176. }
  1177. return cellvalue;
  1178. }
  1179. });
  1180. //签收状态
  1181. $.extend($.fn.fmatter, {
  1182. signStatus: function (cellvalue, options, rowdata) {
  1183. var obj = $.yvan.sysDict('signStatus');
  1184. for (i = 0; i < obj.data.length; i++) {
  1185. if (cellvalue == obj.data[i].id) {
  1186. return obj.data[i].text;
  1187. }
  1188. }
  1189. return cellvalue;
  1190. }
  1191. });
  1192. //是否需要物流
  1193. $.extend($.fn.fmatter, {
  1194. isTrack: function (cellvalue, options, rowdata) {
  1195. var obj = $.yvan.sysDict('isTrack');
  1196. for (i = 0; i < obj.data.length; i++) {
  1197. if (cellvalue == obj.data[i].id) {
  1198. return obj.data[i].text;
  1199. }
  1200. }
  1201. return cellvalue;
  1202. }
  1203. });
  1204. //撤销状态
  1205. $.extend($.fn.fmatter, {
  1206. cancelStatus: function (cellvalue, options, rowdata) {
  1207. var obj = $.yvan.sysDict('cancelStatus');
  1208. for (i = 0; i < obj.data.length; i++) {
  1209. if (cellvalue == obj.data[i].id) {
  1210. return obj.data[i].text;
  1211. }
  1212. }
  1213. return cellvalue;
  1214. }
  1215. });
  1216. //合格证类型
  1217. $.extend($.fn.fmatter, {
  1218. hgzType: function (cellvalue, options, rowdata) {
  1219. var obj = $.yvan.sysDict('hgzType');
  1220. for (i = 0; i < obj.data.length; i++) {
  1221. if (cellvalue == obj.data[i].id) {
  1222. return obj.data[i].text;
  1223. }
  1224. }
  1225. return cellvalue;
  1226. }
  1227. });
  1228. //审核状态
  1229. $.extend($.fn.fmatter, {
  1230. auditStatus: function (cellvalue, options, rowdata) {
  1231. var obj = $.yvan.sysDict('auditStatus');
  1232. for (i = 0; i < obj.data.length; i++) {
  1233. if (cellvalue == obj.data[i].id) {
  1234. return obj.data[i].text;
  1235. }
  1236. }
  1237. return cellvalue;
  1238. }
  1239. });
  1240. //是否人工
  1241. $.extend($.fn.fmatter, {
  1242. isManual: function (cellvalue, options, rowdata) {
  1243. var obj = $.yvan.sysDict('isManual');
  1244. for (i = 0; i < obj.data.length; i++) {
  1245. if (cellvalue == obj.data[i].id) {
  1246. return obj.data[i].text;
  1247. }
  1248. }
  1249. return cellvalue;
  1250. }
  1251. });
  1252. //物资清册
  1253. $.extend($.fn.fmatter, {
  1254. matQingce: function (cellvalue, options, rowdata) {
  1255. var obj = $.yvan.sysDict('matQingce');
  1256. for (i = 0; i < obj.data.length; i++) {
  1257. if (cellvalue == obj.data[i].id) {
  1258. return obj.data[i].text;
  1259. }
  1260. }
  1261. return cellvalue;
  1262. }
  1263. });
  1264. //货区类型
  1265. $.extend($.fn.fmatter, {
  1266. workArea: function (cellvalue, options, rowdata) {
  1267. var obj = $.yvan.sysDict('workArea');
  1268. for (i = 0; i < obj.data.length; i++) {
  1269. if (cellvalue == obj.data[i].id) {
  1270. return obj.data[i].text;
  1271. }
  1272. }
  1273. return cellvalue;
  1274. }
  1275. });
  1276. //货区类型
  1277. $.extend($.fn.fmatter, {
  1278. workArea001: function (cellvalue, matQc) {
  1279. switch ($.trim(cellvalue)) {
  1280. case '1':
  1281. return '收货区';
  1282. case '2':
  1283. return '发货区';
  1284. case '3':
  1285. return '待检区';
  1286. case '4':
  1287. return '不合格品区';
  1288. case '5':
  1289. if (matQc == 1) {
  1290. return '货架区_正常';
  1291. } else if (matQc == 2) {
  1292. return '货架区_超期';
  1293. } else if (matQc == 3) {
  1294. return '货架区_报废';
  1295. }
  1296. case '6':
  1297. return '工作区';
  1298. }
  1299. return cellvalue;
  1300. }
  1301. });
  1302. //仓库类型
  1303. $.extend($.fn.fmatter, {
  1304. roomType: function (cellvalue, options, rowdata) {
  1305. var obj = $.yvan.sysDict('roomType');
  1306. for (i = 0; i < obj.data.length; i++) {
  1307. if (cellvalue == obj.data[i].id) {
  1308. return obj.data[i].text;
  1309. }
  1310. }
  1311. return cellvalue;
  1312. }
  1313. });
  1314. //物资编码方式
  1315. $.extend($.fn.fmatter, {
  1316. matCodeRule: function (cellvalue, options, rowdata) {
  1317. var obj = $.yvan.sysDict('matCodeRule');
  1318. for (i = 0; i < obj.data.length; i++) {
  1319. if (cellvalue == obj.data[i].id) {
  1320. return obj.data[i].text;
  1321. }
  1322. }
  1323. return cellvalue;
  1324. }
  1325. })
  1326. //件号管理
  1327. $.extend($.fn.fmatter, {
  1328. pnType: function (cellvalue, options, rowdata) {
  1329. var obj = $.yvan.sysDict('pnType');
  1330. for (i = 0; i < obj.data.length; i++) {
  1331. if (cellvalue == obj.data[i].id) {
  1332. return obj.data[i].text;
  1333. }
  1334. }
  1335. return cellvalue;
  1336. }
  1337. });
  1338. //物资编码方式
  1339. $.extend($.fn.fmatter, {
  1340. gbType: function (cellvalue, options, rowdata) {
  1341. var obj = $.yvan.sysDict('gbType');
  1342. for (i = 0; i < obj.data.length; i++) {
  1343. if (cellvalue == obj.data[i].id) {
  1344. return obj.data[i].text;
  1345. }
  1346. }
  1347. if (cellvalue == 0)
  1348. return "";
  1349. return cellvalue;
  1350. }
  1351. });
  1352. //物资编码方式
  1353. $.extend($.fn.fmatter, {
  1354. codeType: function (cellvalue, options, rowdata) {
  1355. var tmp = options.rowData.codeType;
  1356. var obj = $.yvan.sysDict('gbType');
  1357. for (i = 0; i < obj.data.length; i++) {
  1358. if (tmp == obj.data[i].id) {
  1359. return obj.data[i].text;
  1360. }
  1361. }
  1362. if (tmp == 0)
  1363. return "";
  1364. return tmp;
  1365. }
  1366. });
  1367. //形状状态
  1368. $.extend($.fn.fmatter, {
  1369. shapeStatus: function (cellvalue, options, rowdata) {
  1370. var obj = $.yvan.sysDict('shapeStatus');
  1371. for (i = 0; i < obj.data.length; i++) {
  1372. if (cellvalue == obj.data[i].id) {
  1373. return obj.data[i].text;
  1374. }
  1375. }
  1376. return cellvalue;
  1377. }
  1378. });
  1379. //形状是否可拆分
  1380. $.extend($.fn.fmatter, {
  1381. shapeCut: function (cellvalue, options, rowdata) {
  1382. var obj = $.yvan.sysDict('shapeCut');
  1383. for (i = 0; i < obj.data.length; i++) {
  1384. if (cellvalue == obj.data[i].id) {
  1385. return obj.data[i].text;
  1386. }
  1387. }
  1388. return cellvalue;
  1389. }
  1390. });
  1391. //存储状态
  1392. $.extend($.fn.fmatter, {
  1393. storStatus: function (cellvalue, options, rowdata) {
  1394. var obj = $.yvan.sysDict('storStatus');
  1395. for (i = 0; i < obj.data.length; i++) {
  1396. if (cellvalue == obj.data[i].id) {
  1397. return obj.data[i].text;
  1398. }
  1399. }
  1400. return cellvalue;
  1401. }
  1402. });
  1403. //领用状态
  1404. $.extend($.fn.fmatter, {
  1405. takeStatus: function (cellvalue, options, rowdata) {
  1406. var obj = $.yvan.sysDict('takeStatus');
  1407. for (i = 0; i < obj.data.length; i++) {
  1408. if (cellvalue == obj.data[i].id) {
  1409. return obj.data[i].text;
  1410. }
  1411. }
  1412. return cellvalue;
  1413. }
  1414. });
  1415. //领用单位类型
  1416. $.extend($.fn.fmatter, {
  1417. takeUnit: function (cellvalue, options, rowdata) {
  1418. var obj = $.yvan.sysDict('takeUnit');
  1419. for (i = 0; i < obj.data.length; i++) {
  1420. if (cellvalue == obj.data[i].id) {
  1421. return obj.data[i].text;
  1422. }
  1423. }
  1424. return cellvalue;
  1425. }
  1426. });
  1427. //检验不合格原因
  1428. $.extend($.fn.fmatter, {
  1429. qcChangeType: function (cellvalue, options, rowdata) {
  1430. var obj = $.yvan.sysDict('qcChangeType');
  1431. for (i = 0; i < obj.data.length; i++) {
  1432. if (cellvalue == obj.data[i].id) {
  1433. return obj.data[i].text;
  1434. }
  1435. }
  1436. return "";
  1437. }
  1438. });
  1439. //领用配送方式
  1440. $.extend($.fn.fmatter, {
  1441. takeMode: function (cellvalue, options, rowdata) {
  1442. var obj = $.yvan.sysDict('takeMode');
  1443. for (i = 0; i < obj.data.length; i++) {
  1444. if (cellvalue == obj.data[i].id) {
  1445. return obj.data[i].text;
  1446. }
  1447. }
  1448. return cellvalue;
  1449. }
  1450. });
  1451. //是否校对
  1452. $.extend($.fn.fmatter, {
  1453. isInfo: function (cellvalue, options, rowdata) {
  1454. var obj = $.yvan.sysDict('isInfo');
  1455. for (i = 0; i < obj.data.length; i++) {
  1456. if (cellvalue == obj.data[i].id) {
  1457. return obj.data[i].text;
  1458. }
  1459. }
  1460. return cellvalue;
  1461. }
  1462. });
  1463. //物资信息确认
  1464. $.extend($.fn.fmatter, {
  1465. isMatinfo: function (cellvalue, options, rowdata) {
  1466. var obj = $.yvan.sysDict('isMatinfo');
  1467. for (i = 0; i < obj.data.length; i++) {
  1468. if (cellvalue == obj.data[i].id) {
  1469. return obj.data[i].text;
  1470. }
  1471. }
  1472. return cellvalue;
  1473. }
  1474. });
  1475. //批次号类型
  1476. $.extend($.fn.fmatter, {
  1477. batchCodeType: function (cellvalue, options, rowdata) {
  1478. var obj = $.yvan.sysDict('batchCodeType');
  1479. for (i = 0; i < obj.data.length; i++) {
  1480. if (cellvalue == obj.data[i].id) {
  1481. return obj.data[i].text;
  1482. }
  1483. }
  1484. if (cellvalue == null || cellvalue == undefined || cellvalue == 0)
  1485. return "";
  1486. return cellvalue;
  1487. }
  1488. });
  1489. //当前步骤
  1490. $.extend($.fn.fmatter, {
  1491. step: function (cellvalue, options, rowdata) {
  1492. var obj = $.yvan.sysDict('step');
  1493. for (i = 0; i < obj.data.length; i++) {
  1494. if (cellvalue == obj.data[i].id) {
  1495. return obj.data[i].text;
  1496. }
  1497. }
  1498. return cellvalue;
  1499. }
  1500. });
  1501. //合并类型
  1502. $.extend($.fn.fmatter, {
  1503. equalType: function (cellvalue, options, rowdata) {
  1504. var obj = $.yvan.sysDict('equalType');
  1505. for (i = 0; i < obj.data.length; i++) {
  1506. if (cellvalue == obj.data[i].id) {
  1507. return obj.data[i].text;
  1508. }
  1509. }
  1510. return cellvalue;
  1511. }
  1512. });
  1513. //1启用/-1停用状态
  1514. $.extend($.fn.fmatter, {
  1515. statusView: function (cellvalue, options, rowdata) {
  1516. var tmp = options.rowData.status;
  1517. var color = tmp == 1 ? "green" : "red";
  1518. var obj = $.yvan.sysDict('status');
  1519. for (i = 0; i < obj.data.length; i++) {
  1520. if (tmp == obj.data[i].id) {
  1521. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1522. }
  1523. }
  1524. return tmp;
  1525. }
  1526. });
  1527. //1启用/-1停用状态
  1528. $.extend($.fn.fmatter, {
  1529. yjStatusView: function (cellvalue, options, rowdata) {
  1530. var tmp = options.rowData.yjStatus;
  1531. var color = tmp == 1 ? "green" : "red";
  1532. var obj = $.yvan.sysDict('yjStatus');
  1533. for (i = 0; i < obj.data.length; i++) {
  1534. if (tmp == obj.data[i].id) {
  1535. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1536. }
  1537. }
  1538. return tmp;
  1539. }
  1540. });
  1541. //1启用/-1停用状态
  1542. $.extend($.fn.fmatter, {
  1543. gbattrStatusView: function (cellvalue, options, rowdata) {
  1544. var tmp = options.rowData.gbattrStatus;
  1545. var color = tmp == 1 ? "green" : "red";
  1546. var obj = $.yvan.sysDict('status');
  1547. for (i = 0; i < obj.data.length; i++) {
  1548. if (tmp == obj.data[i].id) {
  1549. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1550. }
  1551. }
  1552. return tmp;
  1553. }
  1554. });
  1555. //1启用/-1停用状态
  1556. $.extend($.fn.fmatter, {
  1557. allStatusView: function (cellvalue, options, rowdata) {
  1558. var tmp = options.rowData.status;
  1559. var color = (tmp == 1) ? "green" : (tmp == -1 || tmp == -2) ? "red" : "";
  1560. var obj = $.yvan.sysDict('allStatus');
  1561. for (i = 0; i < obj.data.length; i++) {
  1562. if (tmp == obj.data[i].id) {
  1563. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1564. }
  1565. }
  1566. return tmp;
  1567. }
  1568. });
  1569. //1正常、2数据不完整/格式错误、3重复列、4数据已存在
  1570. $.extend($.fn.fmatter, {
  1571. excelStatusView: function (cellvalue, options, rowdata) {
  1572. var tmp = options.rowData.status;
  1573. var color = (tmp == 1) ? "green" : "red";
  1574. var obj = $.yvan.sysDict('excelStatus');
  1575. for (i = 0; i < obj.data.length; i++) {
  1576. if (tmp == obj.data[i].id) {
  1577. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1578. }
  1579. }
  1580. return tmp;
  1581. }
  1582. });
  1583. //1在职/-1离职状态
  1584. $.extend($.fn.fmatter, {
  1585. userQuitView: function (cellvalue, options, rowdata) {
  1586. var tmp = options.rowData.userQuit;
  1587. var color = tmp == 1 ? "green" : "red";
  1588. var obj = $.yvan.sysDict('userStatus');
  1589. for (i = 0; i < obj.data.length; i++) {
  1590. if (tmp == obj.data[i].id) {
  1591. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1592. }
  1593. }
  1594. return tmp;
  1595. }
  1596. });
  1597. //1在职/-1离职状态
  1598. $.extend($.fn.fmatter, {
  1599. userStatusView: function (cellvalue, options, rowdata) {
  1600. var tmp = options.rowData.status;
  1601. var color = tmp == 1 ? "green" : "red";
  1602. var obj = $.yvan.sysDict('userStatus');
  1603. for (i = 0; i < obj.data.length; i++) {
  1604. if (tmp == obj.data[i].id) {
  1605. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1606. }
  1607. }
  1608. return tmp;
  1609. }
  1610. });
  1611. //1在职/-1离职状态
  1612. $.extend($.fn.fmatter, {
  1613. accountStatusView: function (cellvalue, options, rowdata) {
  1614. var tmp = options.rowData.status;
  1615. var color = tmp == 1 ? "green" : "red";
  1616. var obj = $.yvan.sysDict('accountStatus');
  1617. for (i = 0; i < obj.data.length; i++) {
  1618. if (tmp == obj.data[i].id) {
  1619. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1620. }
  1621. }
  1622. return tmp;
  1623. }
  1624. });
  1625. //发布状态
  1626. $.extend($.fn.fmatter, {
  1627. statusPubView: function (cellvalue, options, rowdata) {
  1628. var tmp = options.rowData.statusPub;
  1629. var color = tmp == 1 ? "green" : tmp == -1 ? "red" : "black";
  1630. var obj = $.yvan.sysDict('statusPub');
  1631. for (i = 0; i < obj.data.length; i++) {
  1632. if (tmp == obj.data[i].id) {
  1633. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1634. }
  1635. }
  1636. return tmp;
  1637. }
  1638. });
  1639. //物资信息-发布状态
  1640. $.extend($.fn.fmatter, {
  1641. matStatusPubView: function (cellvalue, options, rowdata) {
  1642. var tmp = "";
  1643. if (isNotNull(options) && isNotNull(options.rowData.status)) {
  1644. tmp = options.rowData.status;
  1645. }
  1646. else {
  1647. tmp = cellvalue;
  1648. }
  1649. var color = tmp == 1 ? "green" : tmp == -1 ? "red" : "black";
  1650. var obj = $.yvan.sysDict('matStatusPub');
  1651. for (i = 0; i < obj.data.length; i++) {
  1652. if (tmp == obj.data[i].id) {
  1653. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1654. }
  1655. }
  1656. return tmp;
  1657. }
  1658. });
  1659. //必填/非必填状态
  1660. $.extend($.fn.fmatter, {
  1661. isMustView: function (cellvalue, options, rowdata) {
  1662. var tmp = options.rowData.isMust;
  1663. var color = tmp == 1 ? "green" : "red";
  1664. var obj = $.yvan.sysDict('isMust');
  1665. for (var i = 0; i < obj.data.length; i++) {
  1666. if (tmp == obj.data[i].id) {
  1667. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1668. }
  1669. }
  1670. return tmp;
  1671. }
  1672. });
  1673. //启用/停用状态
  1674. $.extend($.fn.fmatter, {
  1675. statusFixView: function (cellvalue, options, rowdata) {
  1676. var tmp = options.rowData.statusFix;
  1677. var color = tmp == 0 ? "green" : tmp == -1 ? "red" : "black";
  1678. var obj = $.yvan.sysDict('statusFix');
  1679. for (var i = 0; i < obj.data.length; i++) {
  1680. if (tmp == obj.data[i].id) {
  1681. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1682. }
  1683. }
  1684. return tmp;
  1685. }
  1686. });
  1687. //设备类型
  1688. $.extend($.fn.fmatter, {
  1689. termTypeView: function (cellvalue, options, rowdata) {
  1690. var tmp = options.rowData.termType;
  1691. var obj = $.yvan.sysDict('termType');
  1692. for (var i = 0; i < obj.data.length; i++) {
  1693. if (tmp == obj.data[i].id) {
  1694. return obj.data[i].text;
  1695. }
  1696. }
  1697. return tmp;
  1698. }
  1699. });
  1700. //标准实施状态:-1废止、1现行
  1701. $.extend($.fn.fmatter, {
  1702. gbStatusView: function (cellvalue, options, rowdata) {
  1703. var tmp = options.rowData.gbStatus;
  1704. var color = tmp == 1 ? "green" : "red";
  1705. var obj = $.yvan.sysDict('gbStatus');
  1706. for (var i = 0; i < obj.data.length; i++) {
  1707. if (tmp == obj.data[i].id) {
  1708. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1709. }
  1710. }
  1711. return tmp;
  1712. }
  1713. });
  1714. //标准整体状态:-2删除、-1作废、0草稿、1发布, 删除不显示
  1715. $.extend($.fn.fmatter, {
  1716. matGbStatusView: function (cellvalue, options, rowdata) {
  1717. var tmp = options.rowData.status;
  1718. var color = tmp == 1 ? "green" : tmp == -1 ? "red" : "black";
  1719. var obj = $.yvan.sysDict('matGbStatus');
  1720. for (var i = 0; i < obj.data.length; i++) {
  1721. if (tmp == obj.data[i].id) {
  1722. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1723. }
  1724. }
  1725. return tmp;
  1726. }
  1727. });
  1728. //附件业务类型
  1729. $.extend($.fn.fmatter, {
  1730. busiTypeView: function (cellvalue, options, rowdata) {
  1731. var tmp = "";
  1732. if (options.rowData != undefined && options.rowData != null) {
  1733. tmp = options.rowData.busiType;
  1734. }
  1735. else {
  1736. tmp = options.busiType;
  1737. }
  1738. // var color = tmp == 1 ? "green" : tmp == -1 ? "red" : "black";
  1739. var obj = $.yvan.sysDict('fileBusiType');
  1740. for (var i = 0; i < obj.data.length; i++) {
  1741. if (tmp == obj.data[i].id) {
  1742. return "<span>" + obj.data[i].text + "</span>";
  1743. // return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1744. }
  1745. }
  1746. return tmp;
  1747. }
  1748. });
  1749. //企业状态:1有效、-1无效
  1750. $.extend($.fn.fmatter, {
  1751. corpStatusView: function (cellvalue, options, rowdata) {
  1752. var tmp = options.rowData.status;
  1753. var color = tmp == 1 ? "green" : "red";
  1754. var obj = $.yvan.sysDict('corpStatus');
  1755. for (var i = 0; i < obj.data.length; i++) {
  1756. if (tmp == obj.data[i].id) {
  1757. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1758. }
  1759. }
  1760. return tmp;
  1761. }
  1762. });
  1763. //批次信息是否完整:1是、0否
  1764. $.extend($.fn.fmatter, {
  1765. isFullView: function (cellvalue, options, rowdata) {
  1766. var tmp = options.rowData.isFull;
  1767. var color = tmp == 1 ? "green" : "red";
  1768. var obj = $.yvan.sysDict('isFull');
  1769. for (var i = 0; i < obj.data.length; i++) {
  1770. if (tmp == obj.data[i].id) {
  1771. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1772. }
  1773. }
  1774. return tmp;
  1775. }
  1776. });
  1777. //批次状态:状态:-2删除、-1作废、0草稿、1发布
  1778. $.extend($.fn.fmatter, {
  1779. batchStatusView: function (cellvalue, options, rowdata) {
  1780. var tmp = options.rowData.status;
  1781. var color = tmp == 1 ? "green" : tmp == -1 ? "red" : "black";
  1782. var obj = $.yvan.sysDict('batchStatus');
  1783. for (var i = 0; i < obj.data.length; i++) {
  1784. if (tmp == obj.data[i].id) {
  1785. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1786. }
  1787. }
  1788. return tmp;
  1789. }
  1790. });
  1791. //批次混批
  1792. $.extend($.fn.fmatter, {
  1793. batchMixView: function (cellvalue, options, rowdata) {
  1794. var tmp = cellvalue;
  1795. if (options != undefined) {
  1796. tmp = options.rowData.pubStatus;
  1797. var color = tmp == 1 ? "green" : "";
  1798. }
  1799. var color = tmp == 1 ? "green" : tmp == -1 ? "red" : "black";
  1800. var obj = $.yvan.sysDict('batchMix');
  1801. for (var i = 0; i < obj.data.length; i++) {
  1802. if (tmp == obj.data[i].id) {
  1803. return obj.data[i].text;
  1804. }
  1805. }
  1806. return tmp;
  1807. }
  1808. });
  1809. //批次混批
  1810. $.extend($.fn.fmatter, {
  1811. matQingceView: function (cellvalue, options, rowdata) {
  1812. var tmp = cellvalue;
  1813. if (options != undefined) {
  1814. tmp = options.rowData.pubStatus;
  1815. var color = tmp == 1 ? "green" : "";
  1816. }
  1817. var color = tmp == 1 ? "green" : tmp == -1 ? "red" : "black";
  1818. var obj = $.yvan.sysDict('matQingce');
  1819. for (var i = 0; i < obj.data.length; i++) {
  1820. if (tmp == obj.data[i].id) {
  1821. return obj.data[i].text;
  1822. }
  1823. }
  1824. return tmp;
  1825. }
  1826. });
  1827. //批次步骤:0待发布、1审核中、2已审核、3完成
  1828. $.extend($.fn.fmatter, {
  1829. batchStepView: function (cellvalue, options, rowdata) {
  1830. var tmp = options.rowData.step;
  1831. var color = tmp == 3 ? "green" : tmp == -1 ? "red" : "black";
  1832. var obj = $.yvan.sysDict('step');
  1833. for (var i = 0; i < obj.data.length; i++) {
  1834. if (tmp == obj.data[i].id) {
  1835. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1836. }
  1837. }
  1838. return tmp;
  1839. }
  1840. });
  1841. $.extend($.fn.fmatter, {
  1842. treeNameView: function (cellvalue, options, rowdata, value) {
  1843. var tmp = cellvalue;
  1844. if ("orgNameView" == options.colModel.name) {
  1845. tmp = options.rowData.orgName;
  1846. } else if ("orgName" == options.colModel.name) {
  1847. tmp = options.rowData.orgName;
  1848. } else if ("corpNameView" == options.colModel.name) {
  1849. tmp = options.rowData.corpName;
  1850. } else if ("apmNameView" == options.colModel.name) {
  1851. tmp = options.rowData.apmName;
  1852. } else if ("matcNameView" == options.colModel.name) {
  1853. tmp = options.rowData.matcName;
  1854. } else if ("stepNameView" == options.colModel.name) {
  1855. tmp = options.rowData.stepName;
  1856. } else if ("menuNameView" == options.colModel.name) {
  1857. tmp = options.rowData.menuName;
  1858. } else if ("dictNameView" == options.colModel.name) {
  1859. tmp = options.rowData.dictName;
  1860. }
  1861. if (options == undefined || options.rowData == undefined || options.rowData.treeLev == undefined)
  1862. return cellvalue;
  1863. var html = "";
  1864. for (var i = 1; i < options.rowData.treeLev; i++) {
  1865. if (html == "")
  1866. html += "|----";
  1867. else
  1868. html += "----";
  1869. }
  1870. return html + " " + tmp;
  1871. }
  1872. });
  1873. //应用程序类型
  1874. $.extend($.fn.fmatter, {
  1875. appType: function (cellvalue, options, rowdata) {
  1876. var obj = $.yvan.sysDict('appType');
  1877. for (i = 0; i < obj.data.length; i++) {
  1878. if (cellvalue == obj.data[i].id) {
  1879. return obj.data[i].text;
  1880. }
  1881. }
  1882. return cellvalue;
  1883. }
  1884. });
  1885. //应用程序版本状态
  1886. $.extend($.fn.fmatter, {
  1887. appVerStatus: function (cellvalue, options, rowdata) {
  1888. var obj = $.yvan.sysDict('appVerStatus');
  1889. for (i = 0; i < obj.data.length; i++) {
  1890. if (cellvalue == obj.data[i].id) {
  1891. return obj.data[i].text;
  1892. }
  1893. }
  1894. return cellvalue;
  1895. }
  1896. });
  1897. //应用程序版本类型
  1898. $.extend($.fn.fmatter, {
  1899. appVerType: function (cellvalue, options, rowdata) {
  1900. var obj = $.yvan.sysDict('appVerType');
  1901. for (i = 0; i < obj.data.length; i++) {
  1902. if (cellvalue == obj.data[i].id) {
  1903. return obj.data[i].text;
  1904. }
  1905. }
  1906. return cellvalue;
  1907. }
  1908. });
  1909. //应用程序文件类型
  1910. $.extend($.fn.fmatter, {
  1911. appFileType: function (cellvalue, options, rowdata) {
  1912. var obj = $.yvan.sysDict('appFileType');
  1913. for (i = 0; i < obj.data.length; i++) {
  1914. if (cellvalue == obj.data[i].id) {
  1915. return obj.data[i].text;
  1916. }
  1917. }
  1918. return cellvalue;
  1919. }
  1920. });
  1921. //附件文件类型
  1922. $.extend($.fn.fmatter, {
  1923. fileType: function (cellvalue, options, rowdata) {
  1924. var obj = $.yvan.sysDict('fileType');
  1925. for (i = 0; i < obj.data.length; i++) {
  1926. if (cellvalue == obj.data[i].id) {
  1927. return obj.data[i].text;
  1928. }
  1929. }
  1930. return cellvalue;
  1931. }
  1932. });
  1933. //新物资申请-发布状态
  1934. $.extend($.fn.fmatter, {
  1935. newApplePubStatusView: function (cellvalue, options, rowdata) {
  1936. var tmp = options.rowData.pubStatus;
  1937. var color = tmp == 1 ? "green" : tmp == -1 ? "red" : "black";
  1938. var obj = $.yvan.sysDict('statusPub');
  1939. for (i = 0; i < obj.data.length; i++) {
  1940. if (tmp == obj.data[i].id) {
  1941. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1942. }
  1943. }
  1944. return tmp;
  1945. }
  1946. });
  1947. //任务执行步骤
  1948. $.extend($.fn.fmatter, {
  1949. taskStepView: function (cellvalue, options, rowdata) {
  1950. var tmp = options.rowData.taskStep;
  1951. var color = tmp == 3 ? "green" : "";
  1952. var obj = $.yvan.sysDict('taskStep');
  1953. for (var i = 0; i < obj.data.length; i++) {
  1954. if (tmp == obj.data[i].id) {
  1955. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1956. }
  1957. }
  1958. return cellvalue;
  1959. }
  1960. });
  1961. //任务作废状态
  1962. $.extend($.fn.fmatter, {
  1963. cancelStatusView: function (cellvalue, options, rowdata) {
  1964. var tmp = options.rowData.cancelStatus;
  1965. var color = tmp == 1 ? "red" : "";
  1966. var obj = $.yvan.sysDict('cancelStatus');
  1967. for (var i = 0; i < obj.data.length; i++) {
  1968. if (tmp == obj.data[i].id) {
  1969. // return obj.data[i].text;
  1970. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1971. }
  1972. }
  1973. return cellvalue;
  1974. }
  1975. });
  1976. //任务归档状态
  1977. $.extend($.fn.fmatter, {
  1978. hisStatusView: function (cellvalue, options, rowdata) {
  1979. var tmp = cellvalue;
  1980. if (options != undefined) {
  1981. tmp = options.rowData.hisStatus;
  1982. var color = tmp == 1 ? "green" : "";
  1983. }
  1984. var obj = $.yvan.sysDict('hisStatus');
  1985. for (var i = 0; i < obj.data.length; i++) {
  1986. if (tmp == obj.data[i].id) {
  1987. if (options != undefined)
  1988. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  1989. else
  1990. return obj.data[i].text;
  1991. }
  1992. }
  1993. return cellvalue;
  1994. }
  1995. });
  1996. //是否是样品
  1997. $.extend($.fn.fmatter, {
  1998. isSampleView: function (cellvalue, options, rowdata) {
  1999. var tmp = cellvalue;
  2000. var obj = $.yvan.sysDict('isSample');
  2001. for (var i = 0; i < obj.data.length; i++) {
  2002. if (tmp == obj.data[i].id) {
  2003. if (options != undefined)
  2004. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  2005. else
  2006. return obj.data[i].text;
  2007. }
  2008. }
  2009. return cellvalue;
  2010. }
  2011. });
  2012. //物資状态
  2013. $.extend($.fn.fmatter, {
  2014. matQcView: function (cellvalue, options, rowdata) {
  2015. var tmp = cellvalue;
  2016. if (options != undefined) {
  2017. tmp = options.rowData.matQc;
  2018. var color = tmp == 1 ? "green" : "";
  2019. }
  2020. var obj = $.yvan.sysDict('matQc');
  2021. for (var i = 0; i < obj.data.length; i++) {
  2022. if (tmp == obj.data[i].id) {
  2023. if (options != undefined)
  2024. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  2025. else
  2026. return obj.data[i].text;
  2027. }
  2028. }
  2029. return cellvalue;
  2030. }
  2031. });
  2032. //任务状态-仓储使用
  2033. $.extend($.fn.fmatter, {
  2034. taskStatusView: function (cellvalue, options, rowdata) {
  2035. var tmp = cellvalue;
  2036. if (options != undefined) {
  2037. tmp = options.rowData.taskStatus;
  2038. var color = tmp == 1 ? "green" : "";
  2039. }
  2040. var obj = $.yvan.sysDict('taskStatus');
  2041. for (var i = 0; i < obj.data.length; i++) {
  2042. if (tmp == obj.data[i].id) {
  2043. if (options != undefined)
  2044. // return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  2045. return obj.data[i].text;
  2046. else
  2047. return obj.data[i].text;
  2048. }
  2049. }
  2050. return cellvalue;
  2051. }
  2052. });
  2053. //任务状态-物资编码使用
  2054. $.extend($.fn.fmatter, {
  2055. taskStatusBillView: function (cellvalue, options, rowdata) {
  2056. var tmp = cellvalue;
  2057. if (options != undefined) {
  2058. tmp = options.rowData.taskStatus;
  2059. var color = tmp == 1 ? "green" : "";
  2060. }
  2061. var obj = $.yvan.sysDict('taskStatusBill');
  2062. for (var i = 0; i < obj.data.length; i++) {
  2063. if (tmp == obj.data[i].id) {
  2064. if (options != undefined)
  2065. // return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  2066. return obj.data[i].text;
  2067. else
  2068. return obj.data[i].text;
  2069. }
  2070. }
  2071. return cellvalue;
  2072. }
  2073. });
  2074. //检验状态
  2075. $.extend($.fn.fmatter, {
  2076. qcStatusView: function (cellvalue, options, rowdata) {
  2077. var tmp = cellvalue;
  2078. if (options != undefined) {
  2079. tmp = options.rowData.qcStatus;
  2080. var color = tmp == 1 ? "green" : "";
  2081. }
  2082. var obj = $.yvan.sysDict('qcStatus');
  2083. for (var i = 0; i < obj.data.length; i++) {
  2084. if (tmp == obj.data[i].id) {
  2085. if (options != undefined)
  2086. return obj.data[i].text;
  2087. else
  2088. return obj.data[i].text;
  2089. }
  2090. }
  2091. return cellvalue;
  2092. }
  2093. });
  2094. $.extend($.fn.fmatter, {
  2095. taskStatusInv: function (cellvalue, options, rowdata) {
  2096. var tmp = cellvalue;
  2097. if (cellvalue == 0 || cellvalue == undefined) {
  2098. tmp = '';
  2099. } else if (cellvalue == 1) {
  2100. tmp = '进行中'.fontcolor('brown');
  2101. } else if (cellvalue == 2) {
  2102. tmp = '已完成'.fontcolor('green');
  2103. }
  2104. return tmp;
  2105. }
  2106. });
  2107. $.extend($.fn.fmatter, {
  2108. taskStatusInvCmp: function (cellvalue, options, rowdata) {
  2109. var tmp = cellvalue;
  2110. if (cellvalue == 0 || cellvalue == undefined) {
  2111. tmp = '无';
  2112. } else if (cellvalue == 1) {
  2113. tmp = '未完成'.fontcolor('brown');
  2114. } else if (cellvalue == 2) {
  2115. tmp = '已完成'.fontcolor('green');
  2116. }
  2117. return tmp;
  2118. }
  2119. });
  2120. // 盘存状态
  2121. $.extend($.fn.fmatter, {
  2122. taskStatus001: function (cellvalue, options, rowdata) {
  2123. var tmp = cellvalue;
  2124. if (cellvalue == 0 || cellvalue == undefined) {
  2125. tmp = '未开始';
  2126. } else if (cellvalue == 1) {
  2127. tmp = '进行中'.fontcolor('brown');
  2128. } else if (cellvalue == 2) {
  2129. tmp = '已完成'.fontcolor('green');
  2130. }
  2131. return tmp;
  2132. }
  2133. });
  2134. // //工艺规程附录-编码类型
  2135. // $.extend($.fn.fmatter, {
  2136. // detaCodeType: function (cellvalue, options, rowdata) {
  2137. // var obj = $.yvan.sysDict('detaCodeType');
  2138. // for (i = 0; i < obj.data.length; i++) {
  2139. // if (cellvalue == obj.data[i].id) {
  2140. // return obj.data[i].text;
  2141. // }
  2142. // }
  2143. // //0是无效状态
  2144. // if (cellvalue != undefined && cellvalue == 0)
  2145. // return "";
  2146. // return cellvalue;
  2147. // }
  2148. // });
  2149. //工艺规程附录-对应状态
  2150. $.extend($.fn.fmatter, {
  2151. detaMatchStatus: function (cellvalue, options, rowdata) {
  2152. var obj = $.yvan.sysDict('detaMatchStatus');
  2153. for (i = 0; i < obj.data.length; i++) {
  2154. if (cellvalue == obj.data[i].id) {
  2155. return obj.data[i].text;
  2156. }
  2157. }
  2158. return cellvalue;
  2159. }
  2160. });
  2161. $.extend($.fn.fmatter, {
  2162. techDetaType: function (cellvalue, options, rowdata) {
  2163. var obj = $.yvan.sysDict('techDetaType');
  2164. for (i = 0; i < obj.data.length; i++) {
  2165. if (cellvalue == obj.data[i].id) {
  2166. return obj.data[i].text;
  2167. }
  2168. }
  2169. return cellvalue;
  2170. }
  2171. });
  2172. //工艺规程附录-是否必换件
  2173. $.extend($.fn.fmatter, {
  2174. mustReplace: function (cellvalue, options, rowdata) {
  2175. var obj = $.yvan.sysDict('mustReplace');
  2176. for (i = 0; i < obj.data.length; i++) {
  2177. if (cellvalue == obj.data[i].id) {
  2178. return obj.data[i].text;
  2179. }
  2180. }
  2181. return cellvalue;
  2182. }
  2183. });
  2184. //物资比对模板详情-模板类型
  2185. $.extend($.fn.fmatter, {
  2186. matchType: function (cellvalue, options, rowdata) {
  2187. var obj = $.yvan.sysDict('matchType');
  2188. for (i = 0; i < obj.data.length; i++) {
  2189. if (cellvalue == obj.data[i].id) {
  2190. return obj.data[i].text;
  2191. }
  2192. }
  2193. return cellvalue;
  2194. }
  2195. });
  2196. //物资比对模板详情-比对结果
  2197. $.extend($.fn.fmatter, {
  2198. errType: function (cellvalue, options, rowdata) {
  2199. var obj = $.yvan.sysDict('errType');
  2200. for (i = 0; i < obj.data.length; i++) {
  2201. if (cellvalue == obj.data[i].id) {
  2202. return obj.data[i].text;
  2203. }
  2204. }
  2205. return cellvalue;
  2206. }
  2207. });
  2208. //同步状态:0未同步、1已同步
  2209. $.extend($.fn.fmatter, {
  2210. isSyncView: function (cellvalue, options, rowdata) {
  2211. var tmp = options.rowData.isSync;
  2212. var color = tmp == 1 ? "green" : "red";
  2213. var obj = $.yvan.sysDict('isSync');
  2214. for (var i = 0; i < obj.data.length; i++) {
  2215. if (tmp == obj.data[i].id) {
  2216. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  2217. }
  2218. }
  2219. return tmp;
  2220. }
  2221. });
  2222. //仓库类型
  2223. $.extend($.fn.fmatter, {
  2224. roomType: function (cellvalue, options, rowdata) {
  2225. var obj = $.yvan.sysDict('roomType');
  2226. for (i = 0; i < obj.data.length; i++) {
  2227. if (cellvalue == obj.data[i].id) {
  2228. return obj.data[i].text;
  2229. }
  2230. }
  2231. if (cellvalue == null || cellvalue == undefined || cellvalue == 0)
  2232. return "";
  2233. return cellvalue;
  2234. }
  2235. });
  2236. // 损溢类型
  2237. $.extend($.fn.fmatter, {
  2238. syType: function (cellvalue, options, rowdata) {
  2239. var obj = $.yvan.sysDict('syType');
  2240. for (i = 0; i < obj.data.length; i++) {
  2241. if (cellvalue == obj.data[i].id) {
  2242. return obj.data[i].text;
  2243. }
  2244. }
  2245. return cellvalue;
  2246. }
  2247. });
  2248. //损溢原因
  2249. $.extend($.fn.fmatter, {
  2250. dutyRole: function (cellvalue, options, rowdata) {
  2251. var obj = $.yvan.sysDict('dutyRole');
  2252. for (i = 0; i < obj.data.length; i++) {
  2253. if (cellvalue == obj.data[i].id) {
  2254. return obj.data[i].text;
  2255. }
  2256. }
  2257. return cellvalue;
  2258. }
  2259. });
  2260. //责任对象
  2261. $.extend($.fn.fmatter, {
  2262. dutyCause: function (cellvalue, options, rowdata) {
  2263. var obj = $.yvan.sysDict('dutyCuse');
  2264. for (i = 0; i < obj.data.length; i++) {
  2265. if (cellvalue == obj.data[i].id) {
  2266. return obj.data[i].text;
  2267. }
  2268. }
  2269. return cellvalue;
  2270. }
  2271. });
  2272. //处理状态
  2273. $.extend($.fn.fmatter, {
  2274. taskStatus: function (cellvalue, options, rowdata) {
  2275. var obj = $.yvan.sysDict('taskStatus');
  2276. for (i = 0; i < obj.data.length; i++) {
  2277. if (cellvalue == obj.data[i].id) {
  2278. return obj.data[i].text;
  2279. }
  2280. }
  2281. return cellvalue;
  2282. }
  2283. });
  2284. // 盘存执行类型
  2285. $.extend($.fn.fmatter, {
  2286. exeRole: function (cellvalue, options, rowdata) {
  2287. var obj = $.yvan.sysDict('exeRole');
  2288. for (i = 0; i < obj.data.length; i++) {
  2289. if (cellvalue == obj.data[i].id) {
  2290. return obj.data[i].text;
  2291. }
  2292. }
  2293. return cellvalue;
  2294. }
  2295. });
  2296. //损溢上报处理状态
  2297. $.extend($.fn.fmatter, {
  2298. pubStatus: function (cellvalue, options, rowdata) {
  2299. var obj = $.yvan.sysDict('pubStatus');
  2300. for (i = 0; i < obj.data.length; i++) {
  2301. if (cellvalue == obj.data[i].id) {
  2302. return obj.data[i].text;
  2303. }
  2304. }
  2305. return cellvalue;
  2306. }
  2307. });
  2308. //列表,格式化小数值
  2309. $.extend($.fn.fmatter, {
  2310. float: function (cellvalue, options, rowdata) {
  2311. return formatFloat(cellvalue);
  2312. }
  2313. });
  2314. //件号使用状态
  2315. $.extend($.fn.fmatter, {
  2316. useStatus: function (cellvalue, options, rowdata) {
  2317. var obj = $.yvan.sysDict('useStatus');
  2318. for (var i = 0; i < obj.data.length; i++) {
  2319. if (cellvalue == obj.data[i].id) {
  2320. return obj.data[i].text;
  2321. }
  2322. }
  2323. return cellvalue;
  2324. }
  2325. });
  2326. //货位存放模式
  2327. $.extend($.fn.fmatter, {
  2328. storeMode: function (value, options, rowdata) {
  2329. var obj = $.yvan.sysDict('storeMode');
  2330. for (var i = 0; i < obj.data.length; i++) {
  2331. if (value == obj.data[i].id) {
  2332. return obj.data[i].text;
  2333. }
  2334. }
  2335. return "";
  2336. }
  2337. });
  2338. $.extend($.fn.fmatter, {
  2339. pubStatusJd: function (cellvalue, options, rowdata) {
  2340. var tmp = cellvalue;
  2341. if (options != undefined) {
  2342. tmp = options.rowData.pubStatus;
  2343. var color = tmp == 2 ? "green" : tmp == -1 ? "red" : "";
  2344. }
  2345. var obj = $.yvan.sysDict('pubStatus');
  2346. for (var i = 0; i < obj.data.length; i++) {
  2347. if (tmp == obj.data[i].id) {
  2348. if (options != undefined)
  2349. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  2350. else
  2351. return obj.data[i].text;
  2352. }
  2353. }
  2354. return cellvalue;
  2355. }
  2356. });
  2357. //一级一档
  2358. $.extend($.fn.fmatter, {
  2359. useStatusJd: function (cellvalue, options, rowdata) {
  2360. var tmp = cellvalue;
  2361. if (options != undefined) {
  2362. tmp = options.rowData.useStatus;
  2363. var color = tmp == 1 ? "red" : "";
  2364. }
  2365. var obj = $.yvan.sysDict('useStatus');
  2366. for (var i = 0; i < obj.data.length; i++) {
  2367. if (tmp == obj.data[i].id) {
  2368. if (options != undefined)
  2369. return "<span style='color:" + color + ";'>" + obj.data[i].text + "</span>";
  2370. else
  2371. return obj.data[i].text;
  2372. }
  2373. }
  2374. return "";
  2375. }
  2376. });
  2377. //一级一档
  2378. //物资编码-批次入库类型
  2379. $.extend($.fn.fmatter, {
  2380. batchInType: function (value, options, rowdata) {
  2381. var obj = $.yvan.sysDict('batchInType');
  2382. for (var i = 0; i < obj.data.length; i++) {
  2383. if (value == obj.data[i].id) {
  2384. return obj.data[i].text;
  2385. }
  2386. }
  2387. return "";
  2388. }
  2389. });
  2390. })
  2391. (jQuery);
  2392. // 去掉文本的html标签
  2393. var filterHTMLTag = function (msg) {
  2394. var msg = msg.replace(/<\/?[^>]*>/g, ''); //去除HTML Tag
  2395. msg = msg.replace(/[|]*\n/, '') //去除行尾空格
  2396. msg = msg.replace(/&npsp;/ig, ''); //去掉npsp
  2397. return msg;
  2398. }