datalist.html 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855
  1. {extend name="common/base"/}
  2. <!-- 主体 -->
  3. {block name="body"}
  4. <div class="p-3">
  5. <div class="gg-form-bar border-t border-x">
  6. <form id="taskForm" class="layui-form" lay-filter="barsearchform">
  7. <div class="layui-input-inline" style="width:100px;">
  8. <select name="project_status" lay-filter="status">
  9. <option value="">项目状态</option>
  10. <option value="1">立项中</option>
  11. <option value="2">审批中</option>
  12. <option value="3">待接收</option>
  13. <option value="4">分配中</option>
  14. <option value="5">作业中</option>
  15. <option value="6">归档中</option>
  16. <option value="7">退审中</option>
  17. <option value="8">已归档</option>
  18. <option value="9">已退审</option>
  19. </select>
  20. </div>
  21. <div class="layui-input-inline" style="width:100px;">
  22. <select id="province" lay-filter="province" name="province">
  23. <option value="">省</option>
  24. </select>
  25. </div>
  26. <div class="layui-input-inline" style="width:100px;">
  27. <select id="city" lay-filter="city" name="city">
  28. <option value="">市</option>
  29. </select>
  30. </div>
  31. <div class="layui-input-inline" style="width:100px;">
  32. <select id="area" lay-filter="area" name="area">
  33. <option value="">县</option>
  34. </select>
  35. </div>
  36. <div id="time_date" class="layui-input-inline" style="margin: 0;">
  37. <div class="layui-input-inline" style="width:150px;">
  38. <input type="text" id="start_time" name="project_start_time" readonly placeholder="起始日期"
  39. class="layui-input" value="">
  40. </div>
  41. <div class="layui-input-inline">-</div>
  42. <div class="layui-input-inline" style="width:150px;">
  43. <input type="text" id="end_time" name="project_end_time" readonly placeholder="截止日期"
  44. class="layui-input" value="">
  45. </div>
  46. </div>
  47. <div class="layui-input-inline" style="width:200px;">
  48. <input type="text" name="sent_review_unit_name" placeholder="送审单位" class="layui-input"
  49. autocomplete="off"/>
  50. </div>
  51. <div class="layui-input-inline" style="width:200px;">
  52. <input type="text" name="entrust_unit_name" placeholder="委托单位" class="layui-input"
  53. autocomplete="off"/>
  54. </div>
  55. <div class="layui-input-inline" style="width:200px;">
  56. <input type="text" name="keyword" placeholder="项目名称关键字" class="layui-input" autocomplete="off"/>
  57. </div>
  58. <div class="layui-input-inline" style="width:150px;">
  59. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform"><i
  60. class="layui-icon layui-icon-search mr-1"></i>搜索
  61. </button>
  62. <button class="layui-btn layui-btn-reset" lay-submit="" lay-filter="reset1">清空</button>
  63. </div>
  64. </form>
  65. </div>
  66. <table class="layui-hide" id="cost_project" lay-filter="cost_project"></table>
  67. </div>
  68. <script type="text/html" id="toolbarDemo">
  69. <div class="layui-btn-container">
  70. <span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加造价项目">+ 添加造价项目</span>
  71. </div>
  72. </script>
  73. <!--<script type="text/html" id="barDemo">-->
  74. <!-- <div class="layui-btn-group">-->
  75. <!-- <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>-->
  76. <!-- <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="finish">归档</a>-->
  77. <!-- <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="dismissal">退审</a>-->
  78. <!-- </div>-->
  79. <!--</script>-->
  80. <script type="text/html" id="barDemo">
  81. {{# if(d.project_status==4 || d.project_status==5){ }}
  82. <div class="layui-clear-space">
  83. <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
  84. <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="more">
  85. 更多
  86. <i class="layui-icon layui-icon-down"></i>
  87. </a>
  88. </div>
  89. {{# } else { }}
  90. <div class="layui-btn-group">
  91. </div>
  92. {{# } }}
  93. </script>
  94. {/block}
  95. <!-- /主体 -->
  96. <!-- 脚本 -->
  97. {block name="script"}
  98. <script>
  99. const moduleInit = ['tool'];
  100. const field = '<?=json_encode($field)?>';
  101. function gouguInit() {
  102. var table = layui.table, tool = layui.tool, form = layui.form;
  103. var dropdown = layui.dropdown;
  104. var allcount;
  105. layui.laydate.render({
  106. elem: '#time_date',
  107. range: ['#start_time', '#end_time'],
  108. rangeLinked: true
  109. });
  110. layui.pageTable = table.render({
  111. elem: '#cost_project',
  112. title: '造价项目',
  113. toolbar: '#toolbarDemo',
  114. url: '/admin/project.cost_company/datalist',
  115. page: true,
  116. limit: 20,
  117. parseData: function (res) { // 数据解析回调函数
  118. // 在这里可以获取数据总数
  119. allcount = res.count;
  120. return {
  121. code: res.code, // 数据状态码
  122. msg: res.msg, // 状态信息
  123. count: res.count, // 数据总数
  124. data: res.data // 当前页数据
  125. };
  126. },
  127. cols: [
  128. [
  129. {
  130. fixed: 'left', field: 'id', title: '编号', align: 'center', width: 80,
  131. templet: function (d) {
  132. return allcount - (d.LAY_NUM - 1);
  133. }
  134. },
  135. {
  136. fixed: 'left',
  137. field: 'project_status',
  138. title: '项目状态',
  139. align: 'center',
  140. width: 100,
  141. hide: field.project_status,
  142. templet: function (item) {
  143. var html;
  144. if (item.project_status === 5) {
  145. html = '<span class="layui-badge layui-bg-blue" style="background-color: #1e9fff !important">作业中</span> ';
  146. } else if (item.project_status === 4) {
  147. html = '<span class="layui-badge" style="background-color: #005fa8 !important">分配中</span> ';
  148. } else if (item.project_status === 6) {
  149. html = '<span class="layui-badge layui-bg-orange" style="background-color: #007244 !important">归档中</span> ';
  150. } else if (item.project_status === 8) {
  151. html = '<span class="layui-badge layui-bg-green" style="background-color: #16b777 !important">已归档</span> ';
  152. } else if (item.project_status === 7) {
  153. html = '<span class="layui-badge layui-bg-orange" style="background-color: #881f1f !important">退审中</span> ';
  154. } else if (item.project_status === 9) {
  155. html = '<span class="layui-badge layui-bg-green" style="background-color: #d81e06 !important">已退审</span> ';
  156. }
  157. return html;
  158. }
  159. },
  160. {
  161. fixed: 'left',
  162. field: 'report_status',
  163. title: '报告状态',
  164. align: 'center',
  165. width: 100,
  166. hide: false,
  167. templet: function (item) {
  168. var html;
  169. if (item.report_status === 0) {
  170. html = '<span>初稿中</span> ';
  171. } else if (item.report_status === 1) {
  172. html = '<span>对数中</span> ';
  173. } else if (item.report_status === 2) {
  174. html = '<span>审定中</span> ';
  175. } else if (item.report_status === 3) {
  176. html = '<span>已审定</span> ';
  177. }else {
  178. html = '<span >未知</span> ';
  179. }
  180. return html;
  181. }
  182. },
  183. {
  184. fixed: 'left',
  185. field: 'project_name',
  186. title: '项目名称',
  187. align: 'center',
  188. width: 400,
  189. hide: field.project_name,
  190. templet: function (d) {
  191. var html = "";
  192. if (d.red) {
  193. //判断是否有新消息,有就有new
  194. html = '<a class="side-a" lay-event="read" lay-event="read">' + d.project_name + ' <span class="layui-badge-dot hongdian"></span></a>';
  195. } else {
  196. html = '<a class="side-a" lay-event="read" lay-event="read">' + d.project_name + '</a>';
  197. }
  198. return '<div style="text-align:left">' + html + '</div>'
  199. }
  200. },
  201. {
  202. field: 'project_num',
  203. title: '项目编号',
  204. align: 'center',
  205. width: 150, hide: field.project_num,
  206. },
  207. {
  208. field: 'project_time',
  209. title: '项目周期',
  210. align: 'center',
  211. width: 270,
  212. hide: field.project_time,
  213. templet: function (item) {
  214. let outcome = Math.round(new Date().getTime() / 1000).toString();
  215. var advent_time = item.project_end_time - outcome
  216. var time = getDuration(advent_time);
  217. var timestr = "<span style='color: green'>" + "剩余" + time + "</span>";
  218. if (advent_time < 0) {
  219. advent_time = -advent_time
  220. time = getDuration(advent_time);
  221. timestr = "<span style='color: red'>" + "逾期" + time + "</span>";
  222. }
  223. var html;
  224. if (item.project_status == 8 || item.project_status == 9 ){
  225. html =
  226. "<div>" +
  227. layui.util.toDateString(item.project_start_time * 1000, 'yyyy-MM-dd') +
  228. "至" +
  229. layui.util.toDateString(item.project_end_time * 1000, 'yyyy-MM-dd') +
  230. "</div>";
  231. }else{
  232. html =
  233. "<div>" +
  234. layui.util.toDateString(item.project_start_time * 1000, 'yyyy-MM-dd') +
  235. "至" +
  236. layui.util.toDateString(item.project_end_time * 1000, 'yyyy-MM-dd') +
  237. "&nbsp;&nbsp;" + timestr +
  238. "</div>";
  239. }
  240. function getDuration(second) {
  241. var duration
  242. var days = Math.floor(second / 86400);
  243. var hours = Math.floor((second % 86400) / 3600);
  244. if (days > 0) duration = days + "天";
  245. else if (hours > 0) duration = "不足一天";
  246. else if (hours == 0) duration = "不足一天";
  247. return duration;
  248. }
  249. return html;
  250. }
  251. },
  252. {
  253. field: 'entrust_unit_name',
  254. title: '委托单位',
  255. align: 'center',
  256. width: 150,
  257. hide: field.entrust_unit,
  258. },
  259. {
  260. field: 'entrust_maker_name',
  261. title: '委托单位负责人',
  262. align: 'center',
  263. width: 150,
  264. hide: field.entrust_head,
  265. },
  266. {
  267. field: 'entrust_phone',
  268. title: '委托单位负责人电话',
  269. align: 'center',
  270. width: 150,
  271. hide: field.entrust_phone,
  272. },
  273. {
  274. field: 'sent_review_unit_name',
  275. title: '送审单位',
  276. align: 'center',
  277. width: 150,
  278. hide: field.sent_review_unit,
  279. },
  280. {
  281. field: 'sent_review_head_name',
  282. title: '送审单位负责人',
  283. align: 'center',
  284. width: 150,
  285. hide: field.sent_review_head,
  286. },
  287. {
  288. field: 'sent_review_phone',
  289. title: '送审单位负责人电话',
  290. align: 'center',
  291. width: 150,
  292. hide: field.sent_review_phone,
  293. },
  294. {
  295. field: 'project_scale',
  296. title: '项目规模',
  297. align: 'center',
  298. width: 150,
  299. hide: field.project_scale,
  300. },
  301. {
  302. field: 'engineering_category',
  303. title: '工程类别',
  304. align: 'center',
  305. width: 150,
  306. hide: field.engineering_category,
  307. },
  308. {
  309. field: 'engineering_type',
  310. title: '项目类型',
  311. align: 'center',
  312. width: 150,
  313. hide: field.engineering_type,
  314. },
  315. {
  316. field: 'project_region',
  317. title: '项目区域',
  318. align: 'center',
  319. width: 150,
  320. hide: field.project_region,
  321. },
  322. {
  323. field: 'fiscal_nature',
  324. title: '财政性质',
  325. align: 'center',
  326. width: 150,
  327. hide: field.fiscal_nature,
  328. },
  329. {
  330. field: 'sent_review_cost',
  331. title: '送审服务费',
  332. align: 'center',
  333. width: 100,
  334. hide: field.sent_review_cost,
  335. },
  336. {
  337. field: 'sent_review_amount',
  338. title: '送审金额',
  339. align: 'center',
  340. width: 150,
  341. hide: field.sent_review_amount,
  342. },
  343. {
  344. field: 'authorize_amount',
  345. title: '审定金额',
  346. align: 'center',
  347. width: 150,
  348. hide: field.authorize_amount,
  349. },
  350. {
  351. field: 'review_add_amount',
  352. title: '审增额',
  353. align: 'center',
  354. width: 150,
  355. hide: field.review_add_reduce_amount
  356. },
  357. {
  358. field: 'review_reduce_amount',
  359. title: '审减额',
  360. align: 'center',
  361. width: 150,
  362. hide: field.review_add_reduce_amount
  363. },
  364. {
  365. field: 'review_add_reduce_rate',
  366. title: '审增减率',
  367. align: 'center',
  368. width: 150,
  369. hide: field.review_add_reduce_rate,
  370. },
  371. {
  372. field: 'report_time',
  373. title: '报告时间',
  374. align: 'center',
  375. width: 150,
  376. hide: field.report_time,
  377. templet: function (d) {
  378. if (d.report_time) {
  379. return layui.util.toDateString(d.report_time * 1000, "yyyy-MM-dd")
  380. } else {
  381. return "";
  382. }
  383. }
  384. },
  385. {
  386. field: 'charge_standard',
  387. title: '收费标准',
  388. align: 'center',
  389. width: 150,
  390. hide: field.charge_standard,
  391. },
  392. {
  393. field: 'operate_head_name',
  394. title: '作业负责人',
  395. align: 'center',
  396. width: 150,
  397. hide: field.operate_name,
  398. },
  399. {
  400. field: 'operate_team_names',
  401. title: '作业成员',
  402. align: 'center',
  403. width: 300,
  404. hide: field.operate_team_names
  405. },
  406. {
  407. field: 'creator',
  408. title: '创建人',
  409. align: 'center',
  410. width: 150,
  411. },
  412. {
  413. field: 'create_time',
  414. title: '项目创建日期',
  415. align: 'center',
  416. width: 180,
  417. hide: field.create_time,
  418. },
  419. {
  420. field: 'project_dead_time',
  421. title: '项目归档日期',
  422. align: 'center',
  423. width: 120,
  424. hide: field.project_dead_time,
  425. templet: function (d) {
  426. if (d.project_dead_time) {
  427. return layui.util.toDateString(d.project_dead_time * 1000, "yyyy-MM-dd")
  428. } else {
  429. return "";
  430. }
  431. }
  432. },
  433. {fixed: 'right', title: '操作', align: 'center', width: 170, toolbar: '#barDemo'},
  434. ]
  435. ]
  436. });
  437. //监听表头工具栏事件
  438. table.on('toolbar(cost_project)', function (obj) {
  439. if (obj.event === 'add') {
  440. tool.side("/admin/project.cost_company/add");
  441. return false;
  442. }
  443. });
  444. //监听表格行工具事件
  445. table.on('tool(cost_project)', function (obj) {
  446. var data = obj.data;
  447. if (obj.event === 'read') {
  448. tool.side('/admin/project.cost_company/read?id=' + obj.data.id);
  449. } else if (obj.event === 'edit') {
  450. if (obj.data.project_status < 6) {
  451. tool.side('/admin/project.cost_company/edit?id=' + obj.data.id);
  452. } else {
  453. layer.msg("已归档/已退审")
  454. }
  455. } else if (obj.event === 'finish') {
  456. if (obj.data.project_status == 5 || obj.data.project_status == 4) {
  457. var ttxx = layer.prompt({
  458. title: '请输入<span style="color: red">归档</span>原因',
  459. formType: 2,
  460. area: ['35vw', '15vw']
  461. }, function (text, index) {
  462. let callback = function (e) {
  463. window.location.reload()
  464. layer.msg(e.msg);
  465. setTimeout(function () {
  466. layer.close(index);
  467. }, 2000)
  468. }
  469. if (text !== "") {
  470. tool.post("/admin/project.cost_company/finish", {
  471. id: data.id,
  472. finish_reason: text
  473. }, callback);
  474. } else {
  475. layer.msg("归档原因不能为空")
  476. }
  477. });
  478. } else {
  479. layer.msg("已归档/已退审")
  480. }
  481. } else if (obj.event === 'dismissal') {
  482. if (obj.data.project_status == 5 || obj.data.project_status == 4) {
  483. var ttxx = layer.prompt({
  484. title: '请输入<span style="color: red">退审</span>原因',
  485. formType: 2,
  486. area: ['35vw', '15vw']
  487. }, function (text, index) {
  488. let callback = function (e) {
  489. window.location.reload()
  490. layer.msg(e.msg);
  491. setTimeout(function () {
  492. layer.close(index);
  493. }, 2000)
  494. }
  495. if (text !== "") {
  496. tool.post("/admin/project.cost_company/dismissal", {
  497. id: data.id,
  498. dismissal_reason: text,
  499. }, callback);
  500. } else {
  501. layer.msg("退审原因不能为空")
  502. }
  503. });
  504. } else {
  505. layer.msg("已归档/已退审")
  506. }
  507. } else if (obj.event === 'more') {
  508. // 更多 - 下拉菜单
  509. dropdown.render({
  510. elem: this, // 触发事件的 DOM 对象
  511. show: true, // 外部事件触发即显示
  512. data: [
  513. {
  514. title: '状态',
  515. id: 'set_status',
  516. templet: function () {
  517. return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="set_status" class="dropbtn">状态</button>';
  518. }
  519. },{
  520. title: '归档',
  521. id: 'finish',
  522. templet: function () {
  523. return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="finish" class="dropbtn">归档</button>';
  524. }
  525. }, {
  526. title: '退审',
  527. id: 'dismissal',
  528. templet: function () {
  529. return '<button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="dismissal" class="dropbtn">退审</button>';
  530. }
  531. }
  532. ],
  533. click: function (menudata) {
  534. if (menudata.id === 'finish') {
  535. if (obj.data.project_status == 5 || obj.data.project_status == 4) {
  536. var ttxx = layer.prompt({
  537. title: '请输入<span style="color: red">归档</span>原因',
  538. formType: 2,
  539. area: ['35vw', '15vw']
  540. }, function (text, index) {
  541. let callback = function (e) {
  542. window.location.reload()
  543. layer.msg(e.msg);
  544. setTimeout(function () {
  545. layer.close(index);
  546. }, 2000)
  547. }
  548. if (text !== "") {
  549. tool.post("/admin/project.cost_company/finish", {
  550. id: data.id,
  551. finish_reason: text
  552. }, callback);
  553. } else {
  554. layer.msg("归档原因不能为空")
  555. }
  556. });
  557. } else {
  558. layer.msg("已归档/已退审")
  559. }
  560. } else if (menudata.id === 'dismissal') {
  561. if (obj.data.project_status == 5 || obj.data.project_status == 4) {
  562. var ttxx = layer.prompt({
  563. title: '请输入<span style="color: red">退审</span>原因',
  564. formType: 2,
  565. area: ['35vw', '15vw']
  566. }, function (text, index) {
  567. let callback = function (e) {
  568. window.location.reload()
  569. layer.msg(e.msg);
  570. setTimeout(function () {
  571. layer.close(index);
  572. }, 2000)
  573. }
  574. if (text !== "") {
  575. tool.post("/admin/project.cost_company/dismissal", {
  576. id: data.id,
  577. dismissal_reason: text,
  578. }, callback);
  579. } else {
  580. layer.msg("退审原因不能为空")
  581. }
  582. });
  583. } else {
  584. layer.msg("已归档/已退审")
  585. }
  586. }else if (menudata.id === 'set_status') {
  587. setStatus(data.id);
  588. }
  589. },
  590. align: 'center', // 右对齐弹出
  591. style: 'min-width: 0px' // 设置额外样式
  592. })
  593. }
  594. return false;
  595. });
  596. function setStatus(project_id) {
  597. layer.open({
  598. title: '选择状态',
  599. type:1,
  600. area: ['480px', '336px'],
  601. content: '<div class="picker-table"><div id="boxselect"></div></div>',
  602. success: function() {
  603. table_a = table.render({
  604. elem: '#boxselect',
  605. cols: [
  606. [{
  607. type: 'radio',
  608. title: '选择',
  609. width: 100
  610. }, {
  611. field: 'title',
  612. title: '状态'
  613. }]
  614. ],
  615. data: [{
  616. "type": "0",
  617. "title": "初稿中"
  618. },{
  619. "type": "1",
  620. "title": "对数中"
  621. }, {
  622. "type": "2",
  623. "title": "审定中"
  624. }]
  625. });
  626. },
  627. btn:['确定'],
  628. yes: function(index) {
  629. var checkStatus = table.checkStatus(table_a.config.id);
  630. var data = checkStatus.data;
  631. console.log(checkStatus,data);
  632. if (data.length > 0) {
  633. let callbacl = function (e) {
  634. layui.pageTable.reload();
  635. layer.msg(e.msg)
  636. }
  637. data = {project_id:project_id,report_status:data[0].type}
  638. tool.post("/admin/project.api/set_status",data,callbacl);
  639. layer.close(index);
  640. }
  641. else{
  642. layer.msg('选择合同性质');
  643. }
  644. }
  645. })
  646. }
  647. //监听搜索提交
  648. form.on('submit(webform)', function (data) {
  649. console.log(data.field)
  650. layui.pageTable.reload({where: data.field});
  651. return false;
  652. });
  653. form.on('submit(reset1)', function () {
  654. $(".layui-form").reset();
  655. layui.pageTable.reload();
  656. return false;
  657. });
  658. layui.use(['form', 'jquery'], function () {
  659. var form = layui.form;
  660. const $ = layui.jquery;
  661. let adress;
  662. $.ajax({
  663. type: "get", //使用get方式
  664. url: "/static/assets/layui/adress.json", //json文件相对于这个HTML的路径
  665. dataType: "json",
  666. async: false,
  667. success: function (data) {
  668. //这个data就是json数据
  669. adress = data
  670. var province = Object.keys(adress)
  671. var proStrs = '<option value="">省</option>';
  672. for (var i = 0; i < province.length; i++) {
  673. proStrs += '<option value="' + province[i] + '">' + province[i] + '</option>';
  674. }
  675. $("#province").html(proStrs);
  676. layui.form.render("select")
  677. },
  678. error: function () {
  679. layui.alert("地址请求失败!! ");
  680. }
  681. });
  682. function getFirstAttr(obj) {
  683. for (var k in obj) return k;
  684. }
  685. function selectOption(selectedProvince, selectedCity = '', selectedArea = '') {
  686. var proStr = '<option value="">省</option>', cityStr = '<option value="">市</option>',
  687. areaStr = '<option value="">县</option>';
  688. var pro = adress[selectedProvince], ci = adress[selectedProvince][selectedCity];
  689. for (var province in adress) {
  690. if (province == selectedProvince) proStr += '<option value="' + province + '" selected>' + province + '</option>';
  691. else proStr += '<option value="' + province + '">' + province + '</option>';
  692. }
  693. $("#province").html(proStr);
  694. for (var city in pro) {
  695. if (city == selectedCity) cityStr += '<option value="' + city + '" selected>' + city + '</option>';
  696. else cityStr += '<option value="' + city + '">' + city + '</option>';
  697. }
  698. $("#city").html(cityStr);
  699. for (var area in ci) {
  700. if (area == "remove") {
  701. continue;
  702. }
  703. if (ci[area] == selectedArea) areaStr += '<option value="' + ci[area] + '" selected>' + ci[area] + '</option>';
  704. else areaStr += '<option value="' + ci[area] + '">' + ci[area] + '</option>';
  705. }
  706. $("#area").html(areaStr);
  707. form.render();
  708. }
  709. /*selectOption(1,2, 3);*/
  710. form.on('select(province)', function (data) {
  711. let thisProvince = data.value;
  712. let thisCity = getFirstAttr(adress[thisProvince]);
  713. selectOption(data.value);
  714. });
  715. form.on('select(city)', function (data) {
  716. selectOption($("#province").val(), data.value, getFirstAttr(data.value));
  717. });
  718. window.hongdianselect = function () {
  719. let num = $(document).find('.hongdian').length
  720. console.log(num, '我是数量')
  721. if (num === 0) {
  722. parent.showhongdian()
  723. console.log('2执行了')
  724. }
  725. }
  726. })
  727. }
  728. </script>
  729. {/block}
  730. <!-- /脚本 -->