follow_project.html 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870
  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. if(advent_time > 30){
  231. timestr = "<span style='color: red'>" + "待归档" + "</span>"
  232. }else{
  233. time = getDuration(advent_time);
  234. timestr = "<span style='color: red'>" + "逾期" + time + "</span>";
  235. }
  236. }
  237. var html;
  238. if (item.project_status == 8 || item.project_status == 9 ){
  239. html =
  240. "<div>" +
  241. layui.util.toDateString(item.project_start_time * 1000, 'yyyy-MM-dd') +
  242. "至" +
  243. layui.util.toDateString(item.project_end_time * 1000, 'yyyy-MM-dd') +
  244. "</div>";
  245. }else{
  246. html =
  247. "<div>" +
  248. layui.util.toDateString(item.project_start_time * 1000, 'yyyy-MM-dd') +
  249. "至" +
  250. layui.util.toDateString(item.project_end_time * 1000, 'yyyy-MM-dd') +
  251. "&nbsp;&nbsp;" + timestr +
  252. "</div>";
  253. }
  254. function getDuration(second) {
  255. var duration
  256. var days = Math.floor(second / 86400);
  257. var hours = Math.floor((second % 86400) / 3600);
  258. if (days > 0) duration = days + "天";
  259. else if (hours > 0) duration = "不足一天";
  260. else if (hours == 0) duration = "不足一天";
  261. return duration;
  262. }
  263. return html;
  264. }
  265. },
  266. {
  267. field: 'entrust_unit_name',
  268. title: '委托单位',
  269. align: 'center',
  270. width: 150,
  271. },
  272. {
  273. field: 'entrust_maker_name',
  274. title: '委托单位负责人',
  275. align: 'center',
  276. width: 150,
  277. },
  278. {
  279. field: 'entrust_phone',
  280. title: '委托单位负责人电话',
  281. align: 'center',
  282. width: 150,
  283. },
  284. {
  285. field: 'sent_review_unit_name',
  286. title: '送审单位',
  287. align: 'center',
  288. width: 150,
  289. },
  290. {
  291. field: 'sent_review_head_name',
  292. title: '送审单位负责人',
  293. align: 'center',
  294. width: 150,
  295. },
  296. {
  297. field: 'sent_review_phone',
  298. title: '送审单位负责人电话',
  299. align: 'center',
  300. width: 150,
  301. },
  302. {
  303. field: 'project_scale',
  304. title: '项目规模',
  305. align: 'center',
  306. width: 150,
  307. },
  308. {
  309. field: 'engineering_category',
  310. title: '工程类别',
  311. align: 'center',
  312. width: 150,
  313. },
  314. {
  315. field: 'engineering_type',
  316. title: '项目类型',
  317. align: 'center',
  318. width: 150,
  319. },
  320. {
  321. field: 'project_region',
  322. title: '项目区域',
  323. align: 'center',
  324. width: 150,
  325. },
  326. {
  327. field: 'fiscal_nature',
  328. title: '财政性质',
  329. align: 'center',
  330. width: 150,
  331. },
  332. {
  333. field: 'sent_review_cost',
  334. title: '送审服务费',
  335. align: 'center',
  336. width: 100,
  337. },
  338. {
  339. field: 'sent_review_amount',
  340. title: '送审金额',
  341. align: 'center',
  342. width: 150,
  343. },
  344. {
  345. field: 'authorize_amount',
  346. title: '审定金额',
  347. align: 'center',
  348. width: 150,
  349. },
  350. {
  351. field: 'review_add_amount',
  352. title: '审增额',
  353. align: 'center',
  354. width: 150,
  355. },
  356. {
  357. field: 'review_reduce_amount',
  358. title: '审减额',
  359. align: 'center',
  360. width: 150,
  361. },
  362. {
  363. field: 'review_add_reduce_rate',
  364. title: '审增减率',
  365. align: 'center',
  366. width: 150,
  367. },
  368. {
  369. field: 'report_time',
  370. title: '报告时间',
  371. align: 'center',
  372. width: 150,
  373. templet: function (d) {
  374. if (d.report_time) {
  375. return layui.util.toDateString(d.report_time * 1000, "yyyy-MM-dd")
  376. } else {
  377. return "";
  378. }
  379. }
  380. },
  381. {
  382. field: 'charge_standard',
  383. title: '收费标准',
  384. align: 'center',
  385. width: 150,
  386. },
  387. {
  388. field: 'operate_head_name',
  389. title: '作业负责人',
  390. align: 'center',
  391. width: 150,
  392. },
  393. {
  394. field: 'operate_team_names',
  395. title: '作业成员',
  396. align: 'center',
  397. width: 300,
  398. },
  399. {
  400. field: 'creator',
  401. title: '创建人',
  402. align: 'center',
  403. width: 150,
  404. },
  405. {
  406. field: 'create_time',
  407. title: '项目创建日期',
  408. align: 'center',
  409. width: 180,
  410. },
  411. {
  412. field: 'project_dead_time',
  413. title: '项目归档日期',
  414. align: 'center',
  415. width: 120,
  416. templet: function (d) {
  417. if (d.project_dead_time) {
  418. return layui.util.toDateString(d.project_dead_time * 1000, "yyyy-MM-dd")
  419. } else {
  420. return "";
  421. }
  422. }
  423. }
  424. ]
  425. ]
  426. });
  427. //监听表头工具栏事件
  428. table.on('toolbar(cost_project)', function (obj) {
  429. if (obj.event === 'add') {
  430. tool.side("/admin/project.cost_company/add");
  431. return false;
  432. }
  433. });
  434. //监听表格行工具事件
  435. table.on('tool(cost_project)', function (obj) {
  436. var data = obj.data;
  437. if (obj.event === 'read') {
  438. tool.side('/admin/project.cost_company/read?id=' + obj.data.id);
  439. } else if (obj.event === 'edit') {
  440. if (obj.data.project_status < 6) {
  441. tool.side('/admin/project.cost_company/edit?id=' + obj.data.id);
  442. } else {
  443. layer.msg("已归档/已退审")
  444. }
  445. } else if (obj.event === 'finish') {
  446. if (obj.data.project_status == 5 || obj.data.project_status == 4) {
  447. var ttxx = layer.prompt({
  448. title: '请输入<span style="color: red">归档</span>原因',
  449. formType: 2,
  450. area: ['35vw', '15vw']
  451. }, function (text, index) {
  452. let callback = function (e) {
  453. window.location.reload()
  454. layer.msg(e.msg);
  455. setTimeout(function () {
  456. layer.close(index);
  457. }, 2000)
  458. }
  459. if (text !== "") {
  460. tool.post("/admin/project.cost_company/finish", {
  461. id: data.id,
  462. finish_reason: text
  463. }, callback);
  464. } else {
  465. layer.msg("归档原因不能为空")
  466. }
  467. });
  468. } else {
  469. layer.msg("已归档/已退审")
  470. }
  471. } else if (obj.event === 'dismissal') {
  472. if (obj.data.project_status == 5 || obj.data.project_status == 4) {
  473. var ttxx = layer.prompt({
  474. title: '请输入<span style="color: red">退审</span>原因',
  475. formType: 2,
  476. area: ['35vw', '15vw']
  477. }, function (text, index) {
  478. let callback = function (e) {
  479. window.location.reload()
  480. layer.msg(e.msg);
  481. setTimeout(function () {
  482. layer.close(index);
  483. }, 2000)
  484. }
  485. if (text !== "") {
  486. tool.post("/admin/project.cost_company/dismissal", {
  487. id: data.id,
  488. dismissal_reason: text,
  489. }, callback);
  490. } else {
  491. layer.msg("退审原因不能为空")
  492. }
  493. });
  494. } else {
  495. layer.msg("已归档/已退审")
  496. }
  497. } else if (obj.event === 'more') {
  498. // 更多 - 下拉菜单
  499. dropdown.render({
  500. elem: this, // 触发事件的 DOM 对象
  501. show: true, // 外部事件触发即显示
  502. data: [
  503. {
  504. title: '状态',
  505. id: 'set_status',
  506. templet: function () {
  507. return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="set_status" class="dropbtn">状态</button>';
  508. }
  509. },{
  510. title: '归档',
  511. id: 'finish',
  512. templet: function () {
  513. return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="finish" class="dropbtn">归档</button>';
  514. }
  515. }, {
  516. title: '退审',
  517. id: 'dismissal',
  518. templet: function () {
  519. return '<button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="dismissal" class="dropbtn">退审</button>';
  520. }
  521. }
  522. ],
  523. click: function (menudata) {
  524. if (menudata.id === 'finish') {
  525. if (obj.data.project_status == 5 || obj.data.project_status == 4) {
  526. var ttxx = layer.prompt({
  527. title: '请输入<span style="color: red">归档</span>原因',
  528. formType: 2,
  529. area: ['35vw', '15vw']
  530. }, function (text, index) {
  531. let callback = function (e) {
  532. window.location.reload()
  533. layer.msg(e.msg);
  534. setTimeout(function () {
  535. layer.close(index);
  536. }, 2000)
  537. }
  538. if (text !== "") {
  539. tool.post("/admin/project.cost_company/finish", {
  540. id: data.id,
  541. finish_reason: text
  542. }, callback);
  543. } else {
  544. layer.msg("归档原因不能为空")
  545. }
  546. });
  547. } else {
  548. layer.msg("已归档/已退审")
  549. }
  550. } else if (menudata.id === 'dismissal') {
  551. if (obj.data.project_status == 5 || obj.data.project_status == 4) {
  552. var ttxx = layer.prompt({
  553. title: '请输入<span style="color: red">退审</span>原因',
  554. formType: 2,
  555. area: ['35vw', '15vw']
  556. }, function (text, index) {
  557. let callback = function (e) {
  558. window.location.reload()
  559. layer.msg(e.msg);
  560. setTimeout(function () {
  561. layer.close(index);
  562. }, 2000)
  563. }
  564. if (text !== "") {
  565. tool.post("/admin/project.cost_company/dismissal", {
  566. id: data.id,
  567. dismissal_reason: text,
  568. }, callback);
  569. } else {
  570. layer.msg("退审原因不能为空")
  571. }
  572. });
  573. } else {
  574. layer.msg("已归档/已退审")
  575. }
  576. }else if (menudata.id === 'set_status') {
  577. setStatus(data.id);
  578. }
  579. },
  580. align: 'center', // 右对齐弹出
  581. style: 'min-width: 0px' // 设置额外样式
  582. })
  583. }
  584. return false;
  585. });
  586. function setStatus(project_id) {
  587. layer.open({
  588. title: '选择状态',
  589. type:1,
  590. area: ['480px', '336px'],
  591. content: '<div class="picker-table"><div id="boxselect"></div></div>',
  592. success: function() {
  593. table_a = table.render({
  594. elem: '#boxselect',
  595. cols: [
  596. [{
  597. type: 'radio',
  598. title: '选择',
  599. width: 100
  600. }, {
  601. field: 'title',
  602. title: '状态'
  603. }]
  604. ],
  605. data: [{
  606. "type": "0",
  607. "title": "初稿中"
  608. },{
  609. "type": "1",
  610. "title": "对数中"
  611. }, {
  612. "type": "2",
  613. "title": "审定中"
  614. }]
  615. });
  616. },
  617. btn:['确定'],
  618. yes: function(index) {
  619. var checkStatus = table.checkStatus(table_a.config.id);
  620. var data = checkStatus.data;
  621. console.log(checkStatus,data);
  622. if (data.length > 0) {
  623. let callbacl = function (e) {
  624. layui.pageTable.reload();
  625. layer.msg(e.msg)
  626. }
  627. data = {project_id:project_id,report_status:data[0].type}
  628. tool.post("/admin/project.api/set_status",data,callbacl);
  629. layer.close(index);
  630. }
  631. else{
  632. layer.msg('选择合同性质');
  633. }
  634. }
  635. })
  636. }
  637. //监听搜索提交
  638. form.on('submit(webform)', function (data) {
  639. console.log(data.field)
  640. layui.pageTable.reload({where: data.field});
  641. return false;
  642. });
  643. form.on('submit(reset1)', function () {
  644. $(".layui-form").reset();
  645. layui.pageTable.reload();
  646. return false;
  647. });
  648. layui.use(['form', 'jquery'], function () {
  649. var form = layui.form;
  650. const $ = layui.jquery;
  651. let adress;
  652. $.ajax({
  653. type: "get", //使用get方式
  654. url: "/static/assets/layui/adress.json", //json文件相对于这个HTML的路径
  655. dataType: "json",
  656. async: false,
  657. success: function (data) {
  658. //这个data就是json数据
  659. adress = data
  660. var province = Object.keys(adress)
  661. var proStrs = '<option value="">省</option>';
  662. for (var i = 0; i < province.length; i++) {
  663. proStrs += '<option value="' + province[i] + '">' + province[i] + '</option>';
  664. }
  665. $("#province").html(proStrs);
  666. layui.form.render("select")
  667. },
  668. error: function () {
  669. layui.alert("地址请求失败!! ");
  670. }
  671. });
  672. function getFirstAttr(obj) {
  673. for (var k in obj) return k;
  674. }
  675. function selectOption(selectedProvince, selectedCity = '', selectedArea = '') {
  676. var proStr = '<option value="">省</option>', cityStr = '<option value="">市</option>',
  677. areaStr = '<option value="">县</option>';
  678. var pro = adress[selectedProvince], ci = adress[selectedProvince][selectedCity];
  679. for (var province in adress) {
  680. if (province == selectedProvince) proStr += '<option value="' + province + '" selected>' + province + '</option>';
  681. else proStr += '<option value="' + province + '">' + province + '</option>';
  682. }
  683. $("#province").html(proStr);
  684. for (var city in pro) {
  685. if (city == selectedCity) cityStr += '<option value="' + city + '" selected>' + city + '</option>';
  686. else cityStr += '<option value="' + city + '">' + city + '</option>';
  687. }
  688. $("#city").html(cityStr);
  689. for (var area in ci) {
  690. if (area == "remove") {
  691. continue;
  692. }
  693. if (ci[area] == selectedArea) areaStr += '<option value="' + ci[area] + '" selected>' + ci[area] + '</option>';
  694. else areaStr += '<option value="' + ci[area] + '">' + ci[area] + '</option>';
  695. }
  696. $("#area").html(areaStr);
  697. form.render();
  698. }
  699. /*selectOption(1,2, 3);*/
  700. form.on('select(province)', function (data) {
  701. let thisProvince = data.value;
  702. let thisCity = getFirstAttr(adress[thisProvince]);
  703. selectOption(data.value);
  704. });
  705. form.on('select(city)', function (data) {
  706. selectOption($("#province").val(), data.value, getFirstAttr(data.value));
  707. });
  708. window.hongdianselect = function () {
  709. let num = $(document).find('.hongdian').length
  710. console.log(num, '我是数量')
  711. if (num === 0) {
  712. parent.showhongdian()
  713. console.log('2执行了')
  714. }
  715. }
  716. })
  717. }
  718. </script>
  719. {/block}
  720. <!-- /脚本 -->