add_change.html 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>新增批次</title>
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  9. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  10. <meta name="apple-mobile-web-app-capable" content="yes">
  11. <meta name="format-detection" content="telephone=no">
  12. <link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
  13. <link rel="stylesheet" type="text/css" href="../../css/common.css" />
  14. <link rel="stylesheet" type="text/css" href="../../css/inputTags.css" />
  15. <style type="text/css">
  16. .ui-required:before {
  17. content: "*";
  18. color: red;
  19. vertical-align: middle;
  20. }
  21. #roleSelectViwe .layui-form-item {
  22. margin-bottom: 0
  23. }
  24. #roleSelectViwe .layui-input-inline {
  25. width: calc(100% - 110px);
  26. margin-right: 0;
  27. }
  28. .region {
  29. padding-left: 10px;
  30. height: 38px;
  31. line-height: 38px;
  32. background-color: #fff;
  33. border-radius: 2px;
  34. border: 1px solid #e6e6e6;
  35. width: calc(100% - 132px) !important;
  36. }
  37. .userTip {
  38. color: #666;
  39. font-size: 12px;
  40. }
  41. .userTip b {
  42. color: #333;
  43. }
  44. .my-middle {
  45. line-height: 36px;
  46. }
  47. .my-button {
  48. width: 60%;
  49. margin-left: 20%;
  50. height: 40px;
  51. text-align: center;
  52. line-height: 40px;
  53. border: 1px dashed;
  54. border-radius: 5px;
  55. }
  56. .my-inline {
  57. display: inline-block;
  58. float: left;
  59. text-align: center;
  60. height: 38px;
  61. line-height: 38px;
  62. width: 10%;
  63. }
  64. .my-images-inline {
  65. display: inline-block;
  66. width: 104px;
  67. height: 104px;
  68. border: 1px dashed;
  69. border-radius: 5px;
  70. padding: 4px;
  71. vertical-align: top;
  72. margin: 4px;
  73. }
  74. .my-img {
  75. width: 100%;
  76. height: 100%;
  77. }
  78. .my-images-add {
  79. display: inline-block;
  80. text-align: center;
  81. line-height: 103px;
  82. font-size: 32px;
  83. cursor: pointer;
  84. background-color: #fbfbfb;
  85. }
  86. .my-del {
  87. background-color: black;
  88. color: white;
  89. }
  90. .button-delImage.button-delAssayImage {
  91. position: relative;
  92. left: -2px;
  93. top: -106px;
  94. }
  95. </style>
  96. </head>
  97. <body>
  98. <form class="layui-form" action="" lay-filter="addForm">
  99. <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  100. <ul class="layui-tab-title">
  101. <li class="layui-this" lay-id="1">基础信息</li>
  102. <li lay-id="2">原料生产</li>
  103. <li lay-id="3">加工流通</li>
  104. <li lay-id="4">检疫检验</li>
  105. </ul>
  106. <div class="layui-tab-content">
  107. <div class="layui-tab-item layui-show">
  108. <div class="layui-form-item">
  109. <label class="layui-form-label ui-required">产品名称</label>
  110. <div class="layui-input-block my-middle" id="goodsName">
  111. </div>
  112. </div>
  113. <div class="layui-form-item">
  114. <label class="layui-form-label ui-required">批次编码</label>
  115. <div class="layui-input-block">
  116. <input type="text" name="goodsBatchNo" lay-verify="required" maxlength="20" placeholder="请输入批次编码"
  117. autocomplete="off" class="layui-input">
  118. </div>
  119. </div>
  120. <div class="layui-form-item">
  121. <label class="layui-form-label ui-required">产品规格</label>
  122. <div class="layui-input-block">
  123. <input type="text" name="goodsUnit" lay-verify="required" maxlength="20" placeholder="请输入产品规格"
  124. autocomplete="off" class="layui-input">
  125. </div>
  126. </div>
  127. <div class="layui-form-item">
  128. <label class="layui-form-label ui-required">生产地</label>
  129. <div class="layui-input-block">
  130. <select name="fkFieldGuid" lay-verify="required" lay-filter="roles" id="rolesView"></select>
  131. </div>
  132. </div>
  133. <div class="layui-form-item">
  134. <label class="layui-form-label ui-required">生产日期</label>
  135. <div class="layui-input-block">
  136. <input type="text" name="productDateStr" id="goodsProductDate" lay-verify="required" maxlength="20"
  137. placeholder="请输入生产日期" autocomplete="off" class="layui-input">
  138. </div>
  139. </div>
  140. <div class="layui-form-item">
  141. <label class="layui-form-label ui-required">保质期</label>
  142. <div class="layui-input-block">
  143. <input type="text" name="goodsExpired" lay-verify="" maxlength="10" placeholder="请输入保质期"
  144. autocomplete="off" class="layui-input">
  145. </div>
  146. </div>
  147. <div class="layui-form-item">
  148. <label class="layui-form-label ui-required">产品标签</label>
  149. <div class="layui-input-block">
  150. <div class="tags" id="tags">
  151. <input type="text" id="inputTags" placeholder="回车生成标签" autocomplete="off">
  152. </div>
  153. </div>
  154. </div>
  155. <!-- <div class="layui-form-item">
  156. <label class="layui-form-label">销售网址</label>
  157. <div class="layui-input-block">
  158. <input type="text" name="goodsSaleUrl" lay-verify="" maxlength="300" placeholder="请输入在线销售网址" autocomplete="off"
  159. class="layui-input">
  160. </div>
  161. </div> -->
  162. <div class="layui-card">
  163. <div class="layui-card-header">自定义信息</div>
  164. <div class="layui-card-body">
  165. <div id="auxListDiv"></div>
  166. <div class="layui-form-item">
  167. <div class="my-button my-button-product">+添加</div>
  168. </div>
  169. </div>
  170. </div>
  171. <div class="layui-card">
  172. <div class="layui-card-header">产品图片</div>
  173. <div class="layui-card-body">
  174. <div id="imageListDiv"></div>
  175. 图片视频上传完毕后请记得按保存哦
  176. </div>
  177. </div>
  178. </div>
  179. <div class="layui-tab-item">
  180. <div class="layui-card">
  181. <div class="layui-card-header">原料信息</div>
  182. <div class="layui-card-body">
  183. <div style="display: flex;">
  184. <input class="layui-input" style="margin-right: 15px;" type="text" name="rawMaterial" />
  185. <button type="button" class="layui-btn" id="rawMaterialInfoAdd">新增</button>
  186. </div>
  187. <style type="text/css">
  188. #rawMaterialInfo li {
  189. display: inline-block;
  190. border: 1px solid rgba(0, 0, 0, .2);
  191. background: rgba(0, 0, 0, .1);
  192. border-radius: .2em;
  193. padding: .3em .6em;
  194. margin: 8px;
  195. }
  196. #rawMaterialInfo li i:hover {
  197. cursor: pointer;
  198. }
  199. </style>
  200. <script type="text/html" id='rawMaterialInfoTpl'>
  201. {{# layui.each(d,function(i,item){ }}
  202. <li>
  203. <div style="display: flex;align-items: center;">
  204. <span>{{item.inputsProcessName}}</span>
  205. <i data-bind="{{i||0}}" class="layui-icon layui-icon-close" style="margin-left: 5px;"></i>
  206. </div>
  207. </li>
  208. {{# });}}
  209. </script>
  210. <ol id="rawMaterialInfo"></ol>
  211. </div>
  212. </div>
  213. <div class="layui-card">
  214. <div class="layui-card-header">生产过程信息</div>
  215. <div class="layui-card-body">
  216. <div id="produceProcessInfoForm">
  217. <div class="layui-input-inline">
  218. <label class="layui-form-label">执行项</label>
  219. <div class="layui-input-inline">
  220. <input class="layui-input" style="margin-right: 15px;" type="text" name="processItem" />
  221. </div>
  222. </div>
  223. <div class="layui-input-inline">
  224. <label class="layui-form-label">执行人</label>
  225. <div class="layui-input-inline">
  226. <input class="layui-input" style="margin-right: 15px;" type="text" name="processUser" />
  227. </div>
  228. </div>
  229. <div class="layui-input-inline">
  230. <label class="layui-form-label">开始日期</label>
  231. <div class="layui-input-inline">
  232. <input class="layui-input" style="margin-right: 15px;" type="text" name="processTime"
  233. id="produceProcessInfoForm_processTime" />
  234. </div>
  235. </div>
  236. <div class="layui-input-inline">
  237. <label class="layui-form-label">执行描述</label>
  238. <div class="layui-input-inline">
  239. <input class="layui-input" style="margin-right: 15px;" type="text" name="processDesc" />
  240. </div>
  241. </div>
  242. <input type="hidden" name="processType" value="1" />
  243. <button type="button" class="layui-btn" id='produceProcessInfoAdd'>新增</button>
  244. <table class="layui-hide" id="produceProcessInfo" lay-filter="produceProcessInfo"></table>
  245. </div>
  246. </div>
  247. </div>
  248. </div>
  249. <div class="layui-tab-item" id="processingCirculationInfoForm">
  250. <div class="layui-input-inline">
  251. <label class="layui-form-label">执行项</label>
  252. <div class="layui-input-inline">
  253. <input class="layui-input" style="margin-right: 15px;" type="text" name="processItem" />
  254. </div>
  255. </div>
  256. <div class="layui-input-inline">
  257. <label class="layui-form-label">执行人</label>
  258. <div class="layui-input-inline">
  259. <input class="layui-input" style="margin-right: 15px;" type="text" name="processUser" />
  260. </div>
  261. </div>
  262. <div class="layui-input-inline">
  263. <label class="layui-form-label">开始日期</label>
  264. <div class="layui-input-inline">
  265. <input class="layui-input" style="margin-right: 15px;" type="text" name="processTime"
  266. id="processingCirculationInfoForm_processTime" />
  267. </div>
  268. </div>
  269. <div class="layui-input-inline">
  270. <label class="layui-form-label">执行描述</label>
  271. <div class="layui-input-inline">
  272. <input class="layui-input" style="margin-right: 15px;" type="text" name="processDesc" />
  273. </div>
  274. </div>
  275. <input type="hidden" name="processType" value="2" />
  276. <button type="button" class="layui-btn" id='processingCirculationInfoAdd'>新增</button>
  277. <table class="layui-hide" id="processingCirculationInfo" lay-filter="processingCirculationInfo"></table>
  278. </div>
  279. <div class="layui-tab-item">
  280. <div class="layui-card">
  281. <div class="layui-card-header">检验信息</div>
  282. <div class="layui-card-body">
  283. <div class="layui-form-item">
  284. <label class="layui-form-label">检验单位:</label>
  285. <div class="layui-input-block">
  286. <input type="text" name="assayDepartment" lay-verify="" maxlength="10" placeholder="请输入检验单位"
  287. autocomplete="off" class="layui-input">
  288. </div>
  289. </div>
  290. <div id="assayAuxListDiv"></div>
  291. <div class="layui-form-item">
  292. <div class="my-button my-button-assay">+添加</div>
  293. </div>
  294. </div>
  295. </div>
  296. <div class="layui-card">
  297. <div class="layui-card-header">检验报告</div>
  298. <div class="layui-card-body">
  299. <div id="assayImageListDiv"></div>
  300. 图片视频上传完毕后请记得按保存哦
  301. </div>
  302. </div>
  303. </div>
  304. </div>
  305. <div class="layui-form-item" style="text-align: center;padding: 25px;">
  306. <button class="layui-btn" lay-submit lay-filter="formDemo">保存</button>
  307. <button type="reset" class="layui-btn layui-btn-primary close-win">取消</button>
  308. </div>
  309. </div>
  310. </form>
  311. <script type="text/html" id="typeHtmlTpl">
  312. <option value="">请选择</option>
  313. {{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
  314. <option value="{{item.guid}}" oneMap="{{item.oneMap}}">{{item.fieldName}}</option>
  315. {{# }); }}
  316. </script>
  317. <script type="text/html" id="auxHtmlTpl">
  318. {{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
  319. <div class="layui-form-item">
  320. <label class="layui-form-label">自定义项{{index+1}}:</label>
  321. <div class="my-inline" style="width: 20%">
  322. <input type="text" name="auxItme" maxlength="20" lay-verify="required" placeholder="标题" autocomplete="off" class="layui-input" value="{{item.auxItme}}">
  323. </div>
  324. <div class="my-inline">--</div>
  325. <div class="my-inline" style="width: 40%">
  326. <input type="text" name="auxItmeVal" maxlength="100" lay-verify="required" placeholder="项" autocomplete="off" class="layui-input" value="{{item.auxItmeVal}}">
  327. </div>
  328. <div class="my-inline">
  329. <i class="layui-icon my-del button-delAux" data-bind="{{index}}" title="删除" data-icon="&#x1006;">&#x1006;</i>
  330. </div>
  331. </div>
  332. {{# }); }}
  333. </script>
  334. <script type="text/html" id="imageHtmlTpl">
  335. <div class="layui-form-item">
  336. {{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
  337. <div class="my-images-inline">
  338. {{#if ("jpg|jpeg|png|bmp".indexOf(item.substring(item.lastIndexOf(".")+1))==-1){}}
  339. <video class="my-img" src="{{window.hywa.config.href}}/{{item}}" autoplay loop></video>
  340. {{#}else{}}
  341. <img class="my-img" src="{{window.hywa.config.href}}/{{item}}">
  342. {{#} }}
  343. <i class="layui-icon my-del button-delImage" data-bind="{{index}}" title="删除" data-icon="&#x1006;">&#x1006;</i>
  344. </div>
  345. {{# }); }}
  346. <div class="my-images-inline my-images-add" id="imageUploadBtn">+</div>
  347. </div>
  348. </script>
  349. <script type="text/html" id="assayAuxHtmlTpl">
  350. {{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
  351. <div class="layui-form-item">
  352. <label class="layui-form-label">{{#if(index==0){}}检验数据:{{#} }}</label>
  353. <div class="my-inline" style="width: 20%">
  354. <input type="text" name="auxItme2" maxlength="20" placeholder="检验项名" autocomplete="off" class="layui-input" value="{{item.auxItme}}">
  355. </div>
  356. <div class="my-inline">--</div>
  357. <div class="my-inline" style="width: 40%">
  358. <input type="text" name="auxItmeVal2" maxlength="100" placeholder="数值和单位" autocomplete="off" class="layui-input" value="{{item.auxItmeVal}}">
  359. </div>
  360. <div class="my-inline">
  361. <i class="layui-icon my-del button-delAssay" data-bind="{{index}}" title="删除" data-icon="&#x1006;">&#x1006;</i>
  362. </div>
  363. </div>
  364. {{# }); }}
  365. </script>
  366. <script type="text/html" id="assayImageHtmlTpl">
  367. <div class="layui-form-item">
  368. {{# if(!d.list){d.list = []}; layui.each(d.list, function(index, item){ }}
  369. <div class="my-images-inline">
  370. {{#if ("jpg|jpeg|png|bmp".indexOf(item.substring(item.lastIndexOf(".")+1))==-1){}}
  371. <video class="my-img" src="{{window.hywa.config.href}}/{{item}}" autoplay loop></video>
  372. {{#}else{}}
  373. <img class="my-img" src="{{window.hywa.config.href}}/{{item}}">
  374. {{#} }}
  375. <i class="layui-icon my-del button-delAssayImage" data-bind="{{index}}" title="删除" data-icon="&#x1006;">&#x1006;</i>
  376. </div>
  377. {{# }); }}
  378. <div class="my-images-inline my-images-add" id="assayImageUploadBtn">+</div>
  379. </div>
  380. </script>
  381. <script type="text/javascript">
  382. function loadJS(url) {
  383. document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
  384. }
  385. loadJS("../../layui/layui.js");
  386. loadJS("../../js/ajaxhook.min.js");
  387. loadJS("../../js/config.js");
  388. </script>
  389. <script type="text/javascript">
  390. layui.config({
  391. base: "../../js/layuiPlugins/"
  392. }).use(["form", 'layer', 'laytpl', 'jquery', 'laydate', 'element', 'upload', 'table', 'inputTags'], function () {
  393. var form = layui.form,
  394. layer = layui.layer,
  395. laytpl = layui.laytpl,
  396. $ = layui.jquery,
  397. laydate = layui.laydate,
  398. element = layui.element,
  399. upload = layui.upload,
  400. inputTags = layui.inputTags
  401. table = layui.table;
  402. laydate.render({
  403. elem: '#goodsProductDate' //指定元素
  404. });
  405. laydate.render({
  406. type: 'datetime',
  407. elem: '#produceProcessInfoForm_processTime' //指定元素
  408. });
  409. laydate.render({
  410. type: 'datetime',
  411. elem: '#processingCirculationInfoForm_processTime' //指定元素
  412. });
  413. var funcName = "pdinfo";
  414. var rolesViewOnemapParam = "";
  415. var formData = {
  416. guid: (JSON.stringify(location.searchObj()) != "{}") ? location.searchObj().guid || null : null, //带参传入ID
  417. current: {
  418. auxList: [],
  419. imagesList: [],
  420. assayInfoForm: {
  421. imagesList: [],
  422. auxList: []
  423. }
  424. }, //当前表单数据
  425. select_data: "select_" + funcName, //查询用户
  426. save_data: (location.searchObj().guid ? 'edit' : 'add') + '_' + funcName, //查询用户
  427. formLayFilter: "addForm", //表单容器
  428. closeModal: function () { //关闭当前窗口
  429. parent.layer.close(parent.layer.getFrameIndex(window.name));
  430. }
  431. };
  432. var option = {
  433. elem: '#imageUploadBtn',
  434. url: 'uploadImage',
  435. accept: "file",
  436. exts: "jpg|jpeg|png|bmp|mp4|ogg|webm",
  437. size: 10240, //kb
  438. before: function () {
  439. uploadMsg = layer.msg('正在上传中……', {
  440. icon: 16,
  441. fixed: false,
  442. time: 0
  443. });
  444. },
  445. done: function (res) {
  446. layer.close(uploadMsg);
  447. formData.current.imagesList.push(res.data[0]);
  448. imageTpl({
  449. elem: "#imageListDiv",
  450. list: formData.current.imagesList
  451. });
  452. },
  453. error: function () { }
  454. };
  455. var assayOption = {
  456. elem: '#assayImageUploadBtn',
  457. url: 'uploadImage',
  458. accept: "file",
  459. exts: "jpg|jpeg|png|bmp|mp4|ogg|webm",
  460. size: 10240, //kb
  461. before: function () {
  462. uploadMsg = layer.msg('正在上传中……', {
  463. icon: 16,
  464. fixed: false,
  465. time: 0
  466. });
  467. },
  468. done: function (res) {
  469. layer.close(uploadMsg);
  470. formData.current.assayInfoForm.imagesList.push(res.data[0]);
  471. assayImageTpl({
  472. elem: "#assayImageListDiv",
  473. list: formData.current.assayInfoForm.imagesList
  474. });
  475. },
  476. error: function () { }
  477. };
  478. //自定义项列表模板
  479. function auxTpl(obj) {
  480. laytpl(auxHtmlTpl.innerHTML).render(obj, function (html) {
  481. $(obj.elem).html(html);
  482. $(".button-delAux").on("click", function (e) {
  483. var sortno = e.target.getAttribute("data-bind");
  484. for (var i = formData.current.auxList.length - 1; i >= 0; i--) {
  485. if ($("input[name='auxItme']")[i]) {
  486. formData.current.auxList[i].auxItme = $("input[name='auxItme']")[i].value;
  487. formData.current.auxList[i].auxItmeVal = $("input[name='auxItmeVal']")[i].value;
  488. }
  489. }
  490. formData.current.auxList.splice(sortno, 1);
  491. auxTpl({
  492. elem: "#auxListDiv",
  493. list: formData.current.auxList
  494. });
  495. });
  496. });
  497. }
  498. //检验数据列表模板
  499. function assayTpl(obj) {
  500. laytpl(assayAuxHtmlTpl.innerHTML).render(obj, function (html) {
  501. $(obj.elem).html(html);
  502. $(".button-delAssay").on("click", function (e) {
  503. var sortno = e.target.getAttribute("data-bind");
  504. var index = formData.current.assayInfoForm.auxList.length;
  505. for (var i = index - 1; i >= 0; i--) {
  506. if ($("input[name='auxItme2']")[i]) {
  507. formData.current.assayInfoForm.auxList[i].auxItme = $("input[name='auxItme2']")[i].value;
  508. formData.current.assayInfoForm.auxList[i].auxItmeVal = $("input[name='auxItmeVal2']")[i].value;
  509. }
  510. }
  511. formData.current.assayInfoForm.auxList.splice(sortno, 1);
  512. assayTpl({
  513. elem: "#assayAuxListDiv",
  514. list: formData.current.assayInfoForm.auxList
  515. });
  516. });
  517. });
  518. }
  519. //下拉列表模板
  520. function typeTpl(obj) {
  521. laytpl(typeHtmlTpl.innerHTML).render(obj, function (html) {
  522. $(obj.elem).html(html);
  523. form.render();
  524. });
  525. }
  526. //图片列表模板
  527. function imageTpl(obj) {
  528. laytpl(imageHtmlTpl.innerHTML).render(obj, function (html) {
  529. $(obj.elem).html(html);
  530. upload.render(option);
  531. $(".button-delImage").on("click", function (e) {
  532. formData.current.imagesList.splice(e.target.getAttribute("data-bind"), 1);
  533. imageTpl({
  534. elem: "#imageListDiv",
  535. list: formData.current.imagesList
  536. });
  537. });
  538. });
  539. }
  540. //检验图片列表模板
  541. function assayImageTpl(obj) {
  542. laytpl(assayImageHtmlTpl.innerHTML).render(obj, function (html) {
  543. $(obj.elem).html(html);
  544. upload.render(assayOption);
  545. $(".button-delAssayImage").on("click", function (e) {
  546. formData.current.assayInfoForm.imagesList.splice(e.target.getAttribute("data-bind"), 1);
  547. assayImageTpl({
  548. elem: "#assayImageListDiv",
  549. list: formData.current.assayInfoForm.imagesList
  550. });
  551. });
  552. });
  553. }
  554. //原料信息模板
  555. function rawMaterial(data) {
  556. laytpl(rawMaterialInfoTpl.innerHTML).render(data, function (html) {
  557. $('#rawMaterialInfo').html(html);
  558. });
  559. }
  560. $('#rawMaterialInfo').on("click", 'li i', function (e) { //删除
  561. if (formData.guid) {
  562. $.ajax({
  563. url: 'del_rawMaterialInfo',
  564. data: {
  565. guid: formData.current.inputsFormList[e.target.getAttribute("data-bind")].guid
  566. },
  567. success: function (res) {
  568. }
  569. });
  570. }
  571. formData.current.inputsFormList.splice(e.target.getAttribute("data-bind"), 1);
  572. rawMaterial(formData.current.inputsFormList);
  573. });
  574. $("#rawMaterialInfoAdd").on('click', function () {
  575. let val = $('input[name="rawMaterial"]').val();
  576. if (val) {
  577. formData.current.inputsFormList = formData.current.inputsFormList || [];
  578. formData.current.inputsFormList.push({
  579. inputsProcessName: val
  580. });
  581. rawMaterial(formData.current.inputsFormList);
  582. if (formData.guid) {
  583. formData.submitInfo('add_rawMaterialInfo', {
  584. fkGoodsBatchGuid: formData.guid,
  585. inputsProcessName: val
  586. }, function () {
  587. formData.getCurrent();
  588. });
  589. }
  590. }
  591. });
  592. //生产过程信息
  593. formData.current.materialList = formData.current.materialList || [];
  594. //编号
  595. for (let i in formData.current.materialList) {
  596. formData.current.materialList[i].index = i;
  597. }
  598. let produceProcessInfoOptions = {
  599. id: "produceProcessInfo",
  600. elem: '#produceProcessInfo',
  601. data: formData.current.materialList,
  602. cols: [
  603. [{
  604. field: 'processItem',
  605. title: '执行项',
  606. edit: 'text',
  607. event: 'edit',
  608. align: 'center'
  609. }, {
  610. field: 'processTime',
  611. title: '开始时间',
  612. edit: 'time',
  613. align: 'center',
  614. event: 'edit'
  615. }, {
  616. field: 'processUser',
  617. title: '执行人',
  618. edit: 'text',
  619. align: 'center',
  620. event: 'edit'
  621. }, {
  622. field: 'processDesc',
  623. title: '执行描述',
  624. edit: 'text',
  625. align: 'center',
  626. event: 'edit'
  627. }, {
  628. field: 'processImgs',
  629. title: '上传过程照片',
  630. // toolbar: `<div><a href="javascript:void(0);" lay-event="processImgsPreview">{{d.processImgs || ''}}</a></div>`,
  631. toolbar: `<div>
  632. <a class="layui-btn layui-btn-xs" lay-event="upload">上传</a>
  633. <a target="_blank" href="{{window.hywa.config.href}}/{{d.processImgs || ''}}" lay-event="aHref">{{d.processImgs || ''}}</a>
  634. </div>`,
  635. align: 'center'
  636. }, {
  637. title: '操作',
  638. toolbar: `<div>
  639. <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
  640. </div>`,
  641. align: 'center'
  642. }]
  643. ],
  644. page: true
  645. };
  646. let produceProcessInfoTable = table.render(produceProcessInfoOptions);
  647. //监听工具条
  648. table.on('tool(produceProcessInfo)', function (obj) {
  649. var data = obj.data;
  650. if (obj.event === 'detail') {
  651. layer.msg('ID:' + data.id + ' 的查看操作');
  652. } else if (obj.event === 'del') {
  653. debugger;
  654. layer.confirm('真的删除行么', function (index) {
  655. obj.del();
  656. formData.current.materialList.map(function (item, index) {
  657. item.index == obj.data.index && formData.current.materialList.splice(index, 1);
  658. });
  659. produceProcessInfoOptions.data = formData.current.materialList;
  660. // 刷新表格数据
  661. produceProcessInfoTable.reload(produceProcessInfoOptions);
  662. if (formData.guid) {
  663. $.ajax({
  664. url: 'del_produceProcessInfo',
  665. data: {
  666. guid: data.guid
  667. },
  668. success: function (res) {
  669. }
  670. });
  671. }
  672. layer.close(index);
  673. });
  674. } else if (obj.event === 'upload') {
  675. let upelem = document.createElement('input'),
  676. uploadMsg = 0;
  677. upload.render({
  678. elem: upelem, //绑定元素
  679. url: 'uploadImage',
  680. accept: "file",
  681. exts: "jpg|jpeg|png|bmp|avi|mp4|wma|rmvb|rm|3gp|flv|mp3",
  682. size: 10240,
  683. before: function () {
  684. uploadMsg = layer.msg('正在上传中……', {
  685. icon: 16,
  686. fixed: false,
  687. time: 0
  688. });
  689. },
  690. done: function (res) {
  691. layer.close(uploadMsg);
  692. if (!(res.code - 0)) {
  693. let a = obj.tr[0].querySelector('a[lay-event="aHref"]');
  694. a.href = window.hywa.config.href + '/' + res.data[0];
  695. a.innerHTML = res.data[0];
  696. let ggObj = {};
  697. formData.current.materialList.map(function (item, index) {
  698. if (item.index == obj.data.index) {
  699. formData.current.materialList[index].processImgs = res.data[0];
  700. ggObj = formData.current.materialList[index];
  701. }
  702. });
  703. if (formData.guid) {
  704. formData.submitInfo('edit_produceProcessInfo', ggObj, function () {
  705. formData.getCurrent();
  706. });
  707. }
  708. }
  709. },
  710. error: function () {
  711. }
  712. });
  713. upelem.click();
  714. } else if (obj.event === 'processImgsPreview') {
  715. let imageSrc = ((obj.data || {}).processImgs || '');
  716. if (imageSrc.indexOf("downloadDocument") != -1) {
  717. imageSrc = imageSrc;
  718. } else {
  719. imageSrc = window.hywa.config.href + imageSrc;
  720. }
  721. let processImgsPreviewDialog = '<div class="dialog-role f-dsn" id="processImgsPreviewDialog"><div style="text-align: center"><img id="processImgsPreviewDialogimg" src="' + imageSrc + '" style="width: 550px; height: 520px; margin: 10px;" /></div></div>';
  722. layer.open({
  723. type: 1,
  724. title: "图片预览",
  725. fixed: true,
  726. area: ['600px', '600px'],
  727. shadeClose: true,
  728. scrollbar: false,
  729. content: processImgsPreviewDialog
  730. });
  731. } else {
  732. return;
  733. }
  734. });
  735. table.on('edit(produceProcessInfo)', function (obj) {
  736. //修改后响应
  737. let ggObj = {};
  738. formData.current.materialList.map(function (item, index) {
  739. if (item.index == obj.data.index) {
  740. formData.current.materialList[index] = obj.data;
  741. ggObj = formData.current.materialList[index];
  742. }
  743. });
  744. if (formData.guid) {
  745. formData.submitInfo('edit_produceProcessInfo', ggObj, function () {
  746. formData.getCurrent();
  747. });
  748. }
  749. });
  750. //监听新增
  751. $('#produceProcessInfoAdd').on('click', function () {
  752. let input = $("#produceProcessInfoForm")[0].querySelectorAll('input');
  753. let obj = {};
  754. let ver = [];
  755. layui.each(input, function (i, item) {
  756. if (item.name) {
  757. obj[item.name] = item.value;
  758. ver.push(item.value);
  759. }
  760. });
  761. for (let i = 0; i < ver.length; i++) {
  762. if (!ver[i]) {
  763. layer.msg("全部都需要填写噢", {
  764. icon: 2
  765. });
  766. return false;
  767. }
  768. }
  769. if (formData.guid) {
  770. obj.fkGoodsBatchGuid = formData.guid;
  771. formData.submitInfo('add_produceProcessInfo', obj, function () {
  772. formData.getCurrent();
  773. });
  774. }
  775. formData.current.materialList.push(obj);
  776. //编号
  777. for (let i in formData.current.materialList) {
  778. formData.current.materialList[i].index = i;
  779. }
  780. table.reload("produceProcessInfo", {
  781. data: formData.current.materialList
  782. });
  783. });
  784. //加工流通
  785. formData.current.productList = formData.current.productList || [];
  786. //编号
  787. for (let i in formData.current.productList) {
  788. formData.current.productList[i].index = i;
  789. }
  790. table.render({
  791. id: "processingCirculationInfo",
  792. elem: '#processingCirculationInfo',
  793. data: formData.current.productList,
  794. cols: [
  795. [{
  796. field: 'processItem',
  797. title: '执行项',
  798. edit: 'text',
  799. event: 'edit',
  800. align: 'center'
  801. }, {
  802. field: 'processTime',
  803. title: '开始时间',
  804. edit: 'time',
  805. align: 'center',
  806. event: 'edit'
  807. }, {
  808. field: 'processUser',
  809. title: '执行人',
  810. edit: 'text',
  811. align: 'center',
  812. event: 'edit'
  813. }, {
  814. field: 'processDesc',
  815. title: '执行描述',
  816. edit: 'text',
  817. align: 'center',
  818. event: 'edit'
  819. }, {
  820. field: 'processImgs',
  821. title: '上传过程照片',
  822. toolbar: `<div>
  823. <a class="layui-btn layui-btn-xs" lay-event="upload">上传</a>
  824. <a target="_blank" href="{{window.hywa.config.href}}/{{d.processImgs || ''}}" lay-event="aHref">{{d.processImgs || ''}}</a>
  825. </div>`,
  826. align: 'center'
  827. }, {
  828. title: '操作',
  829. toolbar: `<div>
  830. <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
  831. </div>`,
  832. align: 'center'
  833. }]
  834. ],
  835. page: true
  836. });
  837. //监听工具条
  838. table.on('tool(processingCirculationInfo)', function (obj) {
  839. var data = obj.data;
  840. if (obj.event === 'detail') {
  841. layer.msg('ID:' + data.id + ' 的查看操作');
  842. } else if (obj.event === 'del') {
  843. layer.confirm('真的删除行么', function (index) {
  844. obj.del();
  845. formData.current.productList.map(function (item, index) {
  846. item.index == obj.data.index && formData.current.productList.splice(index, 1);
  847. });
  848. if (formData.guid) {
  849. $.ajax({
  850. url: 'del_processingCirculationInfo',
  851. data: {
  852. guid: data.guid
  853. },
  854. success: function (res) {
  855. }
  856. });
  857. }
  858. layer.close(index);
  859. });
  860. } else if (obj.event === 'upload') {
  861. let upelem = document.createElement('input'),
  862. uploadMsg = 0;
  863. upload.render({
  864. elem: upelem, //绑定元素
  865. url: 'uploadImage',
  866. accept: "file",
  867. exts: "jpg|jpeg|png|bmp|avi|mp4|wma|rmvb|rm|3gp|flv|mp3",
  868. size: 10240,
  869. before: function () {
  870. uploadMsg = layer.msg('正在上传中……', {
  871. icon: 16,
  872. fixed: false,
  873. time: 0
  874. });
  875. },
  876. done: function (res) {
  877. layer.close(uploadMsg);
  878. if (!(res.code - 0)) {
  879. let a = obj.tr[0].querySelector('a[lay-event="aHref"]');
  880. a.href = window.hywa.config.href + '/' + res.data[0];
  881. a.innerHTML = res.data[0];
  882. let ggObj = {};
  883. formData.current.productList.map(function (item, index) {
  884. if (item.index == obj.data.index) {
  885. formData.current.productList[index].processImgs = res.data[0];
  886. ggObj = formData.current.productList[index];
  887. }
  888. });
  889. if (formData.guid) {
  890. formData.submitInfo('edit_processingCirculationInfo', ggObj, function () {
  891. formData.getCurrent();
  892. });
  893. }
  894. }
  895. },
  896. error: function () {
  897. }
  898. });
  899. upelem.click();
  900. }
  901. });
  902. table.on('edit(processingCirculationInfo)', function (obj) {
  903. //修改后响应
  904. let ggObj = {};
  905. formData.current.productList.map(function (item, index) {
  906. if (item.index == obj.data.index) {
  907. formData.current.productList[index] = obj.data;
  908. ggObj = formData.current.productList[index];
  909. }
  910. });
  911. if (formData.guid) {
  912. formData.submitInfo('edit_processingCirculationInfo', ggObj, function () {
  913. formData.getCurrent();
  914. });
  915. }
  916. });
  917. //监听新增
  918. $('#processingCirculationInfoAdd').on('click', function () {
  919. let input = $("#processingCirculationInfoForm")[0].querySelectorAll('input');
  920. let obj = {};
  921. let ver = [];
  922. layui.each(input, function (i, item) {
  923. if (item.name) {
  924. obj[item.name] = item.value;
  925. ver.push(item.value);
  926. }
  927. });
  928. for (let i = 0; i < ver.length; i++) {
  929. if (!ver[i]) {
  930. layer.msg("全部都需要填写噢", {
  931. icon: 2
  932. });
  933. return false;
  934. }
  935. }
  936. if (formData.guid) {
  937. obj.fkGoodsBatchGuid = formData.guid;
  938. formData.submitInfo('add_processingCirculationInfo', obj, function () {
  939. formData.getCurrent();
  940. });
  941. }
  942. formData.current.productList.push(obj);
  943. //编号
  944. for (let i in formData.current.productList) {
  945. formData.current.productList[i].index = i;
  946. }
  947. table.reload("processingCirculationInfo", {
  948. data: formData.current.productList
  949. });
  950. });
  951. //初始化
  952. formData.main = function () {
  953. var _this = this;
  954. $("#goodsName").html(location.searchObj().pdName);
  955. this.current.fkGoodsGuid = location.searchObj().pid;
  956. this.current.goodsName = location.searchObj().pdName;
  957. $.ajax({
  958. url: "regionList",
  959. method: 'post',
  960. contentType: "application/json",
  961. data: JSON.stringify({
  962. page: 1,
  963. limit: 100
  964. }),
  965. success: function (res) {
  966. typeTpl({
  967. elem: "#rolesView",
  968. list: res.data
  969. });
  970. form.val(_this.formLayFilter, _this.current);
  971. }
  972. });
  973. if (this.guid) {
  974. _this.getCurrent(_this.guid); //获取并初始化表单角色信息
  975. } else {
  976. _this.initialization();
  977. imageTpl({
  978. elem: "#imageListDiv",
  979. list: _this.current.imagesList
  980. });
  981. assayImageTpl({
  982. elem: "#assayImageListDiv",
  983. list: _this.current.assayInfoForm.imagesList
  984. });
  985. }
  986. if (location.searchObj().event == "view") {
  987. var el = document.getElementsByTagName("INPUT");
  988. for (var i = 0; i < el.length; i++) {
  989. el[i].readOnly = true;
  990. }
  991. el = document.getElementsByTagName("SELECT");
  992. for (var i = 0; i < el.length; i++) {
  993. el[i].disabled = true;
  994. }
  995. el = document.getElementsByTagName("checkbox");
  996. for (var i = 0; i < el.length; i++) {
  997. el[i].disabled = true;
  998. }
  999. el = document.getElementsByTagName("button");
  1000. for (var i = 0; i < el.length; i++) {
  1001. if (el[i].innerText.replace(" ", "") == "保存") {
  1002. el[i].style.display = "none";
  1003. }
  1004. }
  1005. }
  1006. return this;
  1007. };
  1008. //初始化
  1009. formData.initialization = function () {
  1010. //标签初始化
  1011. let labelList = formData.current.labelList;
  1012. let productTags = []
  1013. if (labelList) {
  1014. for (let i = 0; i < labelList.length; i++) {
  1015. productTags.push(labelList[i].labelName)
  1016. }
  1017. }
  1018. var _this = this;
  1019. //监听提交
  1020. form.on('submit(formDemo)', function (obj) {
  1021. //必须return false;
  1022. return _this.fusionData(obj.field).submitInfo(); //获取选中权限变数组,提交变化===下拉
  1023. });
  1024. //关闭窗口
  1025. $(".close-win").on("click", function () {
  1026. _this.closeModal();
  1027. });
  1028. $(".my-button-product").on("click", function () {
  1029. _this.current.auxList.push({
  1030. i: _this.current.auxList.length + 1,
  1031. auxItme: "",
  1032. auxItmeVal: ""
  1033. }); //数据库里把item写成itme
  1034. for (var i = _this.current.auxList.length - 1; i >= 0; i--) {
  1035. if ($("input[name='auxItme']")[i]) {
  1036. _this.current.auxList[i].auxItme = $("input[name='auxItme']")[i].value;
  1037. _this.current.auxList[i].auxItmeVal = $("input[name='auxItmeVal']")[i].value;
  1038. }
  1039. }
  1040. auxTpl({
  1041. elem: "#auxListDiv",
  1042. list: _this.current.auxList
  1043. });
  1044. });
  1045. $(".my-button-assay").on("click", function () {
  1046. _this.current.assayInfoForm.auxList.push({
  1047. i: _this.current.assayInfoForm.auxList.length + 1,
  1048. auxItme: "",
  1049. auxItmeVal: ""
  1050. }); //数据库里把item写成itme
  1051. for (var i = _this.current.assayInfoForm.auxList.length - 1; i >= 0; i--) {
  1052. if ($("input[name='auxItme2']")[i]) {
  1053. _this.current.assayInfoForm.auxList[i].auxItme = $("input[name='auxItme2']")[i].value;
  1054. _this.current.assayInfoForm.auxList[i].auxItmeVal = $("input[name='auxItmeVal2']")[i].value;
  1055. }
  1056. }
  1057. assayTpl({
  1058. elem: "#assayAuxListDiv",
  1059. list: _this.current.assayInfoForm.auxList
  1060. });
  1061. });
  1062. inputTags.render({
  1063. elem: '#inputTags',//定义输入框input对象
  1064. content: productTags,//默认标签
  1065. aldaBtn: true,//是否开启获取所有数据的按钮
  1066. done: function (value) { //回车后的回调
  1067. formData.current.labelNames = value.toString();
  1068. },
  1069. del: function (value) {
  1070. formData.current.labelNames = value.toString();
  1071. }
  1072. })
  1073. return _this;
  1074. };
  1075. //获取当前信息
  1076. formData.getCurrent = function (id) {
  1077. var _this = this;
  1078. $.ajax({
  1079. url: this.select_data,
  1080. method: 'get',
  1081. data: {
  1082. guid: id || this.guid //当前ID
  1083. },
  1084. success: function (res) {
  1085. try {
  1086. res.data[0].productDateStr = res.data[0].goodsProductDate.substring(0, 10);
  1087. if (!res.data[0].auxList)
  1088. res.data[0].auxList = [];
  1089. if (!res.data[0].imagesList)
  1090. res.data[0].imagesList = [];
  1091. if (!res.data[0].assayInfoForm)
  1092. res.data[0].assayInfoForm = {};
  1093. if (!res.data[0].assayInfoForm.auxList)
  1094. res.data[0].assayInfoForm.auxList = [];
  1095. if (!res.data[0].assayInfoForm.imagesList)
  1096. res.data[0].assayInfoForm.imagesList = [];
  1097. res.data[0].assayDepartment = res.data[0].assayInfoForm.assayDepartment;
  1098. } catch (e) {
  1099. //TODO handle the exception
  1100. }
  1101. $("#goodsName").html(res.data[0].goodsName);
  1102. _this.current = res.data[0];
  1103. auxTpl({
  1104. elem: "#auxListDiv",
  1105. list: res.data[0].auxList
  1106. });
  1107. imageTpl({
  1108. elem: "#imageListDiv",
  1109. list: res.data[0].imagesList
  1110. });
  1111. assayTpl({
  1112. elem: "#assayAuxListDiv",
  1113. list: res.data[0].assayInfoForm.auxList
  1114. });
  1115. assayImageTpl({
  1116. elem: "#assayImageListDiv",
  1117. list: res.data[0].assayInfoForm.imagesList
  1118. });
  1119. _this.current.inputsFormList = _this.current.inputsFormList || [];
  1120. rawMaterial(_this.current.inputsFormList);
  1121. //生产过程信息
  1122. _this.current.materialList = formData.current.materialList || [];
  1123. //编号
  1124. for (let i in _this.current.materialList) {
  1125. _this.current.materialList[i].index = i;
  1126. }
  1127. table.reload("produceProcessInfo", {
  1128. data: _this.current.materialList
  1129. });
  1130. //加工流通信息
  1131. _this.current.productList = formData.current.productList || [];
  1132. //编号
  1133. for (let i in _this.current.productList) {
  1134. _this.current.productList[i].index = i;
  1135. }
  1136. table.reload("processingCirculationInfo", {
  1137. data: _this.current.productList
  1138. });
  1139. _this.initialization().formVal();
  1140. }
  1141. });
  1142. return _this;
  1143. };
  1144. //表单赋值
  1145. formData.formVal = function () {
  1146. var _this = this;
  1147. form.val(this.formLayFilter, this.current);
  1148. return this;
  1149. };
  1150. //合并表单内容
  1151. formData.fusionData = function (obj) {
  1152. for (var i = this.current.auxList.length - 1; i >= 0; i--) {
  1153. this.current.auxList[i].auxItme = $("input[name='auxItme']")[i].value;
  1154. this.current.auxList[i].auxItmeVal = $("input[name='auxItmeVal']")[i].value;
  1155. if (this.current.auxList[i].auxItme == "" && this.current.auxList[i].auxItmeVal == "")
  1156. this.current.auxList.splice(i, 1);
  1157. }
  1158. for (var i = this.current.assayInfoForm.auxList.length - 1; i >= 0; i--) {
  1159. this.current.assayInfoForm.auxList[i].auxItme = $("input[name='auxItme2']")[i].value;
  1160. this.current.assayInfoForm.auxList[i].auxItmeVal = $("input[name='auxItmeVal2']")[i].value;
  1161. if (this.current.assayInfoForm.auxList[i].auxItme == "" && this.current.assayInfoForm.auxList[i].auxItmeVal ==
  1162. "")
  1163. this.current.assayInfoForm.auxList.splice(i, 1);
  1164. }
  1165. this.current = $.extend(this.current, obj);
  1166. this.current.goodsBatchImages = this.current.imagesList.join(",");
  1167. this.current.assayInfoForm.assayImgs = this.current.assayInfoForm.imagesList.join(",");
  1168. this.current.assayInfoForm.assayDepartment = this.current.assayDepartment;
  1169. return this;
  1170. };
  1171. //提交新增修改
  1172. formData.submitInfo = function (url, data, fun) {
  1173. var _this = this;
  1174. $.ajax({
  1175. type: 'POST',
  1176. url: url || this.save_data, //+'?userId='+this.guid
  1177. data: JSON.stringify(data || this.current),
  1178. contentType: 'application/json',
  1179. success: function (res) {
  1180. if (!(res.code - 0)) {
  1181. parent.layer.msg(res.msg, {
  1182. icon: 1
  1183. });
  1184. typeof fun === 'function' && fun();
  1185. url || _this.closeModal();
  1186. } else {
  1187. layer.msg(res.msg, {
  1188. icon: 2
  1189. });
  1190. }
  1191. }
  1192. });
  1193. return false;
  1194. };
  1195. formData.main();
  1196. //验证规则
  1197. form.verify({
  1198. nickname: function (value) {
  1199. if (!new RegExp("^[a-zA-Z][a-zA-Z0-9_]*$").test(value)) {
  1200. return '账号必须以英文字母开头,只能包含英文字母、数字、下划线';
  1201. }
  1202. if (/(^\_)|(\__)|(\_+$)/.test(value)) {
  1203. return '账号首尾不能出现下划线\'_\'';
  1204. }
  1205. },
  1206. checkName: function (value) { },
  1207. phoneNumber: function (value) {
  1208. if (value) {
  1209. if (!(/^1[3|4|5|7|8]\d{9}$/).test(value)) {
  1210. return '请输入正确的手机号码';
  1211. }
  1212. }
  1213. return false;
  1214. },
  1215. password: function (value) {
  1216. if (location.searchObj().guid) {
  1217. if (value) {
  1218. if (!(/^[\S]{6,12}$/).test(value)) {
  1219. return '密码必须6到12位,且不能出现空格';
  1220. }
  1221. }
  1222. return false;
  1223. }
  1224. if (!(/^[\S]{6,12}$/).test(value)) {
  1225. return '密码必须6到12位,且不能出现空格';
  1226. }
  1227. },
  1228. resspaword: function (value) {
  1229. var pass = $('#L_pass').val();
  1230. if (value != pass) {
  1231. return '两次密码不一致';
  1232. }
  1233. },
  1234. ageLength: [
  1235. /^[0-9]{0,2}$/,
  1236. '年龄必须0到2位,且只能是数字'
  1237. ],
  1238. jobLength: [
  1239. /^[a-z\A-Z\u4e00-\u9fa5_]{0,10}$/,
  1240. '职务必须是0-10位,且不包含特殊字符与数字'
  1241. ],
  1242. workUnit: [
  1243. /^[0-9\a-z\A-Z\u4e00-\u9fa5_]{0,25}$/,
  1244. '工作单位必须是0-25位,且不包含特殊字符'
  1245. ],
  1246. vcode: [
  1247. /^[\w]{4,5}$/,
  1248. '验证码不符合规则'
  1249. ]
  1250. });
  1251. form.on('select(roles)', function (data) {
  1252. rolesViewOnemapParam = $("#rolesView option[value='" + data.value + "']").attr('oneMap');
  1253. });
  1254. /*element.on('tab(docDemoTabBrief)', function (data) {
  1255. if ('2' == this.getAttribute('lay-id')) {
  1256. if (rolesViewOnemapParam && null != rolesViewOnemapParam) {
  1257. let req = {
  1258. orchardId: rolesViewOnemapParam,
  1259. pageNo: 1,
  1260. pageSize: 10
  1261. };
  1262. $.ajax({
  1263. type: 'get',
  1264. url: 'getOrchardList' + '?orchardId=' + rolesViewOnemapParam + '&pageNo=1&pageSize=10',
  1265. success: function (res) {
  1266. formData.current.materialList = res.data;
  1267. formData.current.materialList.forEach(value => {
  1268. value.processType = 1;
  1269. });
  1270. table.reload("produceProcessInfo", {
  1271. data: formData.current.materialList
  1272. });
  1273. }
  1274. });
  1275. }
  1276. }
  1277. });*/
  1278. });
  1279. </script>
  1280. </body>
  1281. </html>