follow_project.html 33 KB

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