add.html 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <div class="row">
  4. <div class="col-sm-12">
  5. <div class="ibox float-e-margins">
  6. <div class="ibox-title">
  7. <h5>{$meta_title}</h5>
  8. <div class="ibox-tools">
  9. <a class="toback" href="{:url('index')}">
  10. 返回上一页
  11. </a>
  12. </div>
  13. </div>
  14. <div class="ibox-content">
  15. <form method="post" action="{:url('add')}" class="form-horizontal">
  16. <input type="hidden" name="id" value="{$info['id']|default='0'}">
  17. <div class="form-group">
  18. <label class="col-sm-2 control-label">任务名称<span class="text-danger">*</span></label>
  19. <div class="col-sm-8">
  20. <input type="text" class="form-control" name="title" value="{$info.title|default=''}" placeholder="请输入任务名称">
  21. </div>
  22. </div>
  23. <div id="vue-plan">
  24. <div class="form-group">
  25. <label class="col-sm-2 control-label">检查内容<span class="text-danger">*</span></label>
  26. <div class="col-sm-8">
  27. <button class="btn btn-sm btn-primary" type="button" @click="addGroup">添加检查内容</button>
  28. <!-- <button class="btn btn-sm btn-primary" type="button" @click="selectAddr()">添加地点</button>-->
  29. <!-- <button class="btn btn-sm btn-primary" type="button" @click="selectForm()">设置检查内容</button>-->
  30. <!-- <button class="btn btn-sm btn-danger" type="button" @click="delAddrs">移除</button>-->
  31. <!-- <button class="btn btn-sm btn-primary" type="button" @click="sortAddrs">确定排序</button>-->
  32. </div>
  33. <div class="col-sm-12">
  34. <input type="hidden" name="group" value="{$info.addrForms_json|default=''}" id="groupbox">
  35. <table class="table table-bordered">
  36. <thead>
  37. <tr>
  38. <th style="width: 25%">检查内容</th>
  39. <th style="width: 25%">检查项</th>
  40. <th style="width: 15%">关联业务</th>
  41. <th style="width: 25%">业务项</th>
  42. <th style="width: 10%" class="text-center">操作</th>
  43. </tr>
  44. </thead>
  45. <tbody>
  46. <tr v-for="(item,index) in groups" :key="index">
  47. <td>
  48. <textarea v-model="item.title" rows="1" class="form-control" style="height: 100%"></textarea>
  49. </td>
  50. <td>
  51. <button type="button" :id="`formsbtn${index}`" :url="`{:url('QualityForm/selectforms',[],false,false)}/idx/${index}`" onclick="selectForms(this)" class="btn btn-sm btn-primary">选择表单项</button>
  52. <div v-if="item.forms.length > 0">
  53. <div v-for="(vo,idx) in item.forms" :key="idx" class="alert alert-success alert-dismissable" style="padding: 5px;margin-bottom: 5px;width: 90%;">
  54. <button class="close" @click="delForms(index,vo.id)" type="button">×</button>
  55. <span v-if="Number(vo.type) == 1">
  56. [选择框]{{vo.title}}
  57. </span>
  58. <span v-if="Number(vo.type) == 0">
  59. [输入框]{{vo.title}}
  60. </span>
  61. </div>
  62. </div>
  63. </td>
  64. <td>
  65. <select v-model="item.type" class="form-control" @change="changeType(index,item)">
  66. <option value="0">不关联业务</option>
  67. <option value="1">巡更</option>
  68. <option value="2">巡视</option>
  69. <option value="3">巡查</option>
  70. <option value="4">巡检</option>
  71. <option value="5">日常工作</option>
  72. <option value="6">设备台账</option>
  73. </select>
  74. </td>
  75. <td>
  76. <button type="button" :id="`bussbtn${index}`" :url="`{:url('QualityPlan/buslist',[],false,false)}/idx/${index}/type/${item.type}`" onclick="selectBuss(this)" class="btn btn-sm btn-primary">选择关联项</button>
  77. <div v-if="item.buss.length > 0">
  78. <div v-for="(vo,idx) in item.buss" :key="idx" class="alert alert-success alert-dismissable" style="padding: 5px;margin-bottom: 5px;width: 90%;">
  79. <button class="close" @click="delBuss(index,vo.id)" type="button">×</button>
  80. {{vo.title}}
  81. </div>
  82. </div>
  83. </td>
  84. <td class="text-center">
  85. <a href="javascript:;" @click="delGroup(index)" class="btn btn-danger btn-sm">删除</a>
  86. </td>
  87. </tr>
  88. </tbody>
  89. </table>
  90. </div>
  91. </div>
  92. <!--<div class="form-group">-->
  93. <!--<label class="col-sm-2 control-label">地点<span class="text-danger">*</span></label>-->
  94. <!--<div class="col-sm-8">-->
  95. <!--<input type="hidden" name="addrs" value="" id="addrForms">-->
  96. <!--<button class="btn btn-sm btn-primary" type="button" @click="selectAddr()">添加检查项</button>-->
  97. <!--&lt;!&ndash; <button class="btn btn-sm btn-primary" type="button" @click="selectForm()">设置检查项</button>&ndash;&gt;-->
  98. <!--<button class="btn btn-sm btn-danger" type="button" @click="delAddrs">移除</button>-->
  99. <!--<button class="btn btn-sm btn-primary" type="button" @click="sortAddrs">确定排序</button>-->
  100. <!--<el-table-->
  101. <!--v-if="tableData.length > 0"-->
  102. <!--:data="tableData"-->
  103. <!--height="250"-->
  104. <!--border-->
  105. <!--@selection-change="handleSelectionChange"-->
  106. <!--style="width: 100%">-->
  107. <!--<el-table-column-->
  108. <!--type="selection"-->
  109. <!--width="60">-->
  110. <!--</el-table-column>-->
  111. <!--<el-table-column-->
  112. <!--prop="addrTitle"-->
  113. <!--label="检查项">-->
  114. <!--</el-table-column>-->
  115. <!--<el-table-column prop="sorts" label="排序">-->
  116. <!--<template slot-scope="scope">-->
  117. <!--<input type="number" step="1" class="form-control" v-model="scope.row.sorts">-->
  118. <!--</template>-->
  119. <!--</el-table-column>-->
  120. <!--</el-table>-->
  121. <!--<el-dialog-->
  122. <!--title="选择地点"-->
  123. <!--:visible.sync="dialogVisibleAddr"-->
  124. <!--width="500px"-->
  125. <!--:before-close="handleClose"-->
  126. <!--&gt;-->
  127. <!--<el-input-->
  128. <!--placeholder="请输入"-->
  129. <!--v-model="addrkeyword"-->
  130. <!--@input="searchAddr"-->
  131. <!--clearable>-->
  132. <!--</el-input>-->
  133. <!--<el-table-->
  134. <!--ref="singleTable"-->
  135. <!--:data="addrs"-->
  136. <!--height="200"-->
  137. <!--@selection-change="handleSelectionChangeAddr"-->
  138. <!--style="width: 100%">-->
  139. <!--<el-table-column-->
  140. <!--type="selection"-->
  141. <!--width="60">-->
  142. <!--</el-table-column>-->
  143. <!--<el-table-column-->
  144. <!--property="title"-->
  145. <!--label="名称"-->
  146. <!--&gt;-->
  147. <!--</el-table-column>-->
  148. <!--</el-table>-->
  149. <!--<span slot="footer" class="dialog-footer">-->
  150. <!--<el-button @click="dialogVisibleAddr = false">取 消</el-button>-->
  151. <!--<el-button type="primary" @click="saveAddr">确 定</el-button>-->
  152. <!--</span>-->
  153. <!--</el-dialog>-->
  154. <!--<el-dialog-->
  155. <!--title="选择检查项"-->
  156. <!--:visible.sync="dialogVisibleForm"-->
  157. <!--width="500px"-->
  158. <!--:before-close="handleCloseForm"-->
  159. <!--&gt;-->
  160. <!--<el-input-->
  161. <!--placeholder="请输入"-->
  162. <!--v-model="formkeyword"-->
  163. <!--@input="searchForm"-->
  164. <!--clearable>-->
  165. <!--</el-input>-->
  166. <!--<el-table-->
  167. <!--ref="singleTable2"-->
  168. <!--:data="forms"-->
  169. <!--height="200"-->
  170. <!--@selection-change="handleCurrentChange"-->
  171. <!--style="width: 100%">-->
  172. <!--<el-table-column-->
  173. <!--type="selection"-->
  174. <!--width="60">-->
  175. <!--</el-table-column>-->
  176. <!--<el-table-column-->
  177. <!--property="title"-->
  178. <!--label="名称"-->
  179. <!--&gt;-->
  180. <!--</el-table-column>-->
  181. <!--</el-table>-->
  182. <!--<span slot="footer" class="dialog-footer">-->
  183. <!--<el-button @click="dialogVisibleAddr = false">取 消</el-button>-->
  184. <!--<el-button type="primary" @click="saveForm">确 定</el-button>-->
  185. <!--</span>-->
  186. <!--</el-dialog>-->
  187. <!--</div>-->
  188. <!--</div>-->
  189. </div>
  190. <div class="form-group">
  191. <label class="col-sm-2 control-label">检查人员<span class="text-danger">*</span></label>
  192. <div class="col-sm-8">
  193. {:widget_view('common/multiselect',['name'=>'user_ids','lists' =>$user, 'val' =>isset($info)?$info['task_user']:[]])}
  194. </div>
  195. </div>
  196. <div class="form-group">
  197. <label class="col-sm-2 control-label">开始时间<span class="text-danger">*</span></label>
  198. <div class="col-sm-8">
  199. <input class="form-control" id="date" readonly name="start_time" value="{$info.start_time|default=$start}">
  200. </div>
  201. </div>
  202. <div class="form-group">
  203. <label class="col-sm-2 control-label">结束时间<span class="text-danger">*</span></label>
  204. <div class="col-sm-8">
  205. <input class="form-control" id="date-one" readonly name="end_time" value="{$info.end_time|default=$end}">
  206. </div>
  207. </div>
  208. <div class="hr-line-dashed"></div>
  209. <div class="form-group">
  210. <div class="col-sm-8 col-sm-offset-2">
  211. <button class="btn btn-primary ajax-post" data-layer_c="1" target-form="form-horizontal" type="submit">确 定</button>
  212. <button class="btn cancel-btn btn-default" type="button">取 消</button>
  213. </div>
  214. </div>
  215. </form>
  216. </div>
  217. </div>
  218. </div>
  219. </div>
  220. {/block}
  221. {block name="script"}
  222. <script type="text/javascript" src="/static/layDate-v5.0.9/laydate.js"></script>
  223. <script>
  224. var time =new Date();
  225. //日期时间选择器
  226. laydate.render({
  227. elem: '#date',
  228. type: 'datetime',
  229. format:'yyyy-MM-dd HH:mm',
  230. trigger: 'click' ,
  231. theme:'#148d8f'
  232. // value:dateFormat(),
  233. });
  234. laydate.render({
  235. elem: '#date-one',
  236. type: 'datetime',
  237. trigger: 'click' ,
  238. format:'yyyy-MM-dd HH:mm',
  239. theme:'#148d8f'
  240. // value:dateFormatH(),
  241. });
  242. //当前日期格式化
  243. function dateFormat() {
  244. var year=time.getFullYear();
  245. var mouth=time.getMonth()+ 1;
  246. if(mouth < 10){
  247. var mouths='0'+mouth;
  248. }else {
  249. var mouths=mouth;
  250. }
  251. var day=time.getDate();
  252. if(day < 10){
  253. var days='0'+day;
  254. }else {
  255. var days=day;
  256. }
  257. var hour=time.getHours();
  258. if(hour < 10){
  259. var hours='0'+hour;
  260. }else {
  261. var hours=hour;
  262. }
  263. var minute=time.getMinutes();
  264. if(minute < 10){
  265. var minutes='0'+minute;
  266. }else {
  267. var minutes=minute;
  268. }
  269. var dateStr=year+'-'+mouths+'-'+days+' '+hours+':'+minutes;
  270. return dateStr;
  271. }
  272. function dateFormatH() {
  273. var year=time.getFullYear();
  274. var mouth=time.getMonth()+ 1;
  275. if(mouth < 10){
  276. var mouths='0'+mouth;
  277. }else {
  278. var mouths=mouth;
  279. }
  280. var day=time.getDate();
  281. if(day < 10){
  282. var days='0'+day;
  283. }else {
  284. var days=day;
  285. }
  286. var hour=time.getHours();
  287. if(hour < 10){
  288. var hours='0'+hour;
  289. }else {
  290. var hours=hour;
  291. }
  292. var minute=time.getMinutes()+20;
  293. var dateStr=year+'-'+mouths+'-'+days+' '+hours+':'+minute;
  294. return dateStr;
  295. }
  296. var ads = {:json_encode($patrolForm)};
  297. var frs = [];
  298. var addrForms = {:json_encode($info['addrForms'])};
  299. var lis = [];
  300. var vm = new Vue({
  301. el: '#vue-plan',
  302. data: function() {
  303. return {
  304. title: '',
  305. dialogVisible: false,
  306. step: 0,
  307. date: '',
  308. tableData: addrForms,
  309. groups: addrForms,
  310. selAddrForms: [], // 选择的地址表单
  311. addrs: ads,
  312. selAddrs:[], // 选择地址
  313. dialogVisibleAddr: false,
  314. addrkeyword: '',
  315. forms: frs,
  316. selForm: null,
  317. formkeyword: '',
  318. dialogVisibleForm: false,
  319. lines: lis,
  320. inOrder: 0
  321. }
  322. },
  323. watch: {
  324. nTableData(){
  325. console.log('nTableData1111');
  326. $('#addrForms').val(JSON.stringify(this.tableData));
  327. },
  328. nLines(){
  329. $('#addrFormsLines').val(JSON.stringify(this.lines));
  330. },
  331. inOrder(){
  332. $('#inOrder').val(this.inOrder);
  333. },
  334. addrIds() { // 以保存的地址id
  335. console.log('tableData',this.tableData);
  336. let lines1 = [];
  337. if(this.tableData.length >= 2){
  338. for (let i in this.tableData){
  339. if(i < this.tableData.length - 1){
  340. lines1.push({
  341. s: this.tableData[i].addrId,
  342. st: this.tableData[i].addrTitle,
  343. e: this.tableData[Number(i)+1].addrId,
  344. et: this.tableData[Number(i)+1].addrTitle,
  345. kd: 0,
  346. fd: 0,
  347. })
  348. }
  349. }
  350. }
  351. this.lines = JSON.parse(JSON.stringify(lines1));
  352. console.log('lines2222',this.lines);
  353. },
  354. allgroups(){
  355. if(this.groups.length > 0){
  356. $('#groupbox').val(JSON.stringify(this.groups));
  357. }else{
  358. $('#groupbox').val('');
  359. }
  360. }
  361. },
  362. computed: {
  363. addrIds() { // 以保存的地址id
  364. console.log('111ssss');
  365. let ids = [];
  366. this.tableData.forEach((item) => {
  367. ids.push(item.addrId);
  368. });
  369. return ids;
  370. },
  371. allgroups() {
  372. return JSON.parse(JSON.stringify(this.groups));
  373. },
  374. nTableData() { // 以保存的地址id
  375. return JSON.parse(JSON.stringify(this.tableData));
  376. },
  377. nLines() { // 以保存的地址id
  378. return JSON.parse(JSON.stringify(this.lines));
  379. },
  380. },
  381. created(){
  382. // this.tableData = addrForms;
  383. // this.lines = lis;
  384. $('#addrForms').val(JSON.stringify(this.tableData));
  385. // $('#addrFormsLines').val(JSON.stringify(this.lines));
  386. // $('#inOrder').val(this.inOrder);
  387. },
  388. methods: {
  389. handleSelectionChange(val){
  390. console.log(val);
  391. this.selAddrForms = val;
  392. },
  393. handleClose(){
  394. this.dialogVisibleAddr = false;
  395. },
  396. handleSelectionChangeAddr(val){
  397. console.log(val);
  398. this.selAddrs = val;
  399. },
  400. selectAddr(){
  401. console.log('aaaaaaaaaaa');
  402. this.dialogVisibleAddr = true;
  403. this.addrkeyword = '';
  404. this.addrs = ads.filter((item) => {
  405. return !this.addrIds.includes(item.id);
  406. });
  407. this.selAddrs = [];
  408. console.log('bbbbbbbbb',this.addrs);
  409. },
  410. sortAddrs(){
  411. let ll = JSON.parse(JSON.stringify(this.tableData));
  412. ll.sort((a, b) => {
  413. return Number(a.sorts) > Number(b.sorts) ? 1 : -1;
  414. });
  415. this.tableData = [];
  416. this.$nextTick(() => {
  417. this.tableData = JSON.parse(JSON.stringify(ll));
  418. });
  419. },
  420. searchAddr(){
  421. this.addrs= [];
  422. this.$nextTick(() => {
  423. if(this.addrkeyword){
  424. this.addrs = ads.filter((item) => {
  425. return item.title.indexOf(this.addrkeyword) !== -1;
  426. });
  427. }else{
  428. this.addrs = ads;
  429. }
  430. });
  431. },
  432. saveAddr(){
  433. const tbs = this.tableData;
  434. this.selAddrs.forEach((item) => {
  435. if(!this.addrIds.includes(item.id)){
  436. tbs.push({
  437. 'addrId': item.id,
  438. 'addrTitle': item.title,
  439. 'sorts': 0,
  440. });
  441. }
  442. });
  443. this.dialogVisibleAddr = false;
  444. this.$nextTick(() => {
  445. this.tableData = tbs;
  446. });
  447. },
  448. moveUp(idx,obj){
  449. console.log(idx,obj);
  450. if(idx > 0){
  451. let old = JSON.parse(JSON.stringify(this.tableData[idx]));
  452. let up = JSON.parse(JSON.stringify(this.tableData[idx - 1]));
  453. let tbs = this.tableData;
  454. this.tableData = [];
  455. this.$nextTick(() => {
  456. tbs[idx] = up;
  457. tbs[idx - 1] = old;
  458. this.tableData = tbs;
  459. })
  460. }
  461. console.log(this.tableData);
  462. },
  463. moveDown(idx,obj){ // 下移
  464. console.log(idx,obj);
  465. let length = this.tableData.length;
  466. if(idx < length - 1){
  467. let old = JSON.parse(JSON.stringify(this.tableData[idx]));
  468. let up = JSON.parse(JSON.stringify(this.tableData[idx + 1]));
  469. let tbs = this.tableData;
  470. this.tableData = [];
  471. this.$nextTick(() => {
  472. tbs[idx] = up;
  473. tbs[idx + 1] = old;
  474. this.tableData = tbs;
  475. })
  476. }
  477. },
  478. delBuss(idx,bidx){
  479. console.log(idx,bidx);
  480. let ggs = JSON.parse(JSON.stringify(this.groups));
  481. let ng = [];
  482. ggs.forEach((item,index) => {
  483. if(Number(idx) == Number(index)){
  484. let fggs = JSON.parse(JSON.stringify(item.buss));
  485. let fng = [];
  486. fggs.forEach((item2,index2) => {
  487. if(Number(bidx) != Number(item2.id)){
  488. fng.push(item2);
  489. }
  490. });
  491. item.buss = JSON.parse(JSON.stringify(fng));
  492. }
  493. ng.push(item);
  494. });
  495. this.groups = JSON.parse(JSON.stringify(ng));
  496. },
  497. delAddrs(){ // 移除
  498. let sids = [];
  499. this.selAddrForms.forEach((item) => {
  500. sids.push(item.addrId);
  501. });
  502. if(sids.length == 0){
  503. this.$message.error('未选择地点');
  504. return false;
  505. }
  506. let tbs = this.tableData;
  507. this.tableData = [];
  508. this.$nextTick(() => {
  509. this.tableData = tbs.filter((item) => {
  510. return !sids.includes(item.addrId);
  511. });
  512. this.selAddrForms = [];
  513. });
  514. console.log(this.selAddrForms,sids,this.tableData);
  515. },
  516. handleCurrentChange(val){ // 选中检查项
  517. console.log(val);
  518. this.selForm = val;
  519. },
  520. handleCloseForm(){
  521. this.dialogVisibleForm = false;
  522. },
  523. searchForm(){
  524. this.forms= [];
  525. this.$nextTick(() => {
  526. if(this.formkeyword){
  527. this.forms = frs.filter((item) => {
  528. return item.title.indexOf(this.formkeyword) !== -1;
  529. });
  530. }else{
  531. this.forms = frs;
  532. }
  533. });
  534. },
  535. saveForm(){
  536. console.log('1111');
  537. const tbs = this.tableData;
  538. this.tableData = [];
  539. let sids = [];
  540. this.selAddrForms.forEach((item) => {
  541. sids.push(item.addrId);
  542. });
  543. tbs.forEach((item) => {
  544. if(sids.includes(item.addrId)){
  545. // item.formId = this.selForm?this.selForm.id:0;
  546. // item.formTitle = this.selForm?this.selForm.title:'';
  547. const ffs = [];
  548. this.selForm.forEach((fitem) => {
  549. ffs.push({
  550. id: fitem.id,
  551. title: fitem.title
  552. });
  553. });
  554. item.forms = JSON.parse(JSON.stringify(ffs));
  555. }
  556. });
  557. this.dialogVisibleForm = false;
  558. this.$nextTick(() => {
  559. this.tableData = tbs;
  560. });
  561. },
  562. selectForm(idx,obj){
  563. console.log(111);
  564. console.log(idx,obj,this.groups);
  565. this.groups.forEach((item,index) => {
  566. if(Number(idx) == Number(index)){
  567. item.forms = obj;
  568. console.log(idx,index);
  569. }
  570. });
  571. let ids = [];
  572. obj.forEach((item) => {
  573. ids.push(item.id.toString());
  574. });
  575. if(ids.length > 0){
  576. $('#formsbtn'+idx).attr('data-ids',JSON.stringify(ids));
  577. }else{
  578. $('#formsbtn'+idx).attr('data-ids','');
  579. }
  580. localStorage.removeItem("selectids");
  581. },
  582. selectBuss(idx,obj){
  583. console.log(idx,obj,this.groups);
  584. this.groups.forEach((item,index) => {
  585. if(Number(idx) == Number(index)){
  586. item.buss = obj;
  587. console.log(idx,index,item);
  588. }
  589. });
  590. let ids = [];
  591. obj.forEach((item) => {
  592. ids.push(item.id.toString());
  593. });
  594. if(ids.length > 0){
  595. $('#bussbtn'+idx).attr('data-ids',JSON.stringify(ids));
  596. }else{
  597. $('#bussbtn'+idx).attr('data-ids','');
  598. }
  599. localStorage.removeItem("selectids");
  600. },
  601. changeType(idx,obj){
  602. let url = "{:url('QualityPlan/buslist',[],false,false)}/idx/"+idx+"/type/"+obj.type;
  603. console.log(obj);
  604. this.groups.forEach((item,index) => {
  605. if(Number(idx) == Number(index)){
  606. item.buss = [];
  607. }
  608. });
  609. $('#bussbtn'+idx).attr('data-ids','');
  610. $('#bussbtn'+idx).attr('url',url);
  611. },
  612. delGroup(idx){
  613. let ggs = JSON.parse(JSON.stringify(this.groups));
  614. let ng = [];
  615. ggs.forEach((item,index) => {
  616. if(Number(idx) != Number(index)){
  617. ng.push(item);
  618. }
  619. });
  620. this.groups = JSON.parse(JSON.stringify(ng));
  621. },
  622. addGroup(){
  623. this.groups.push({
  624. title: '',
  625. forms: [],
  626. type: 0,
  627. buss: []
  628. });
  629. },
  630. delForms(idx,fidx){
  631. console.log(idx,fidx);
  632. let ggs = JSON.parse(JSON.stringify(this.groups));
  633. let ng = [];
  634. ggs.forEach((item,index) => {
  635. if(Number(idx) == Number(index)){
  636. let fggs = JSON.parse(JSON.stringify(item.forms));
  637. let fng = [];
  638. fggs.forEach((item2,index2) => {
  639. if(Number(fidx) != Number(item2.id)){
  640. fng.push(item2);
  641. }
  642. });
  643. item.forms = JSON.parse(JSON.stringify(fng));
  644. }
  645. ng.push(item);
  646. });
  647. this.groups = JSON.parse(JSON.stringify(ng));
  648. },
  649. getDateAll(starDay, endDay) { // 获取两个时间段的所有日期
  650. var arr = [];
  651. var dates = [];
  652. // 设置两个日期UTC时间
  653. var db = new Date(starDay);
  654. var de = new Date(endDay);
  655. // 获取两个日期GTM时间
  656. var s = db.getTime() - 24 * 60 * 60 * 1000;
  657. var d = de.getTime() - 24 * 60 * 60 * 1000;
  658. // 获取到两个日期之间的每一天的毫秒数
  659. for (var i = s; i <= d; ) {
  660. i = i + 24 * 60 * 60 * 1000;
  661. arr.push(parseInt(i));
  662. }
  663. // 获取每一天的时间 YY-MM-DD
  664. for (var j in arr) {
  665. var time = new Date(arr[j]);
  666. var year = time.getFullYear(time);
  667. var mouth =
  668. time.getMonth() + 1 >= 10
  669. ? time.getMonth() + 1
  670. : "0" + (time.getMonth() + 1);
  671. var day =
  672. time.getDate() >= 10
  673. ? time.getDate()
  674. : "0" + time.getDate();
  675. var YYMMDD = year + "-" + mouth + "-" + day;
  676. dates.push(YYMMDD);
  677. }
  678. return dates;
  679. },
  680. getWeekByDay(dateString,t=0) { // 获取某天是周几
  681. var dateArray = dateString.split("-");
  682. date = new Date(dateArray[0], parseInt(dateArray[1] - 1), dateArray[2]);
  683. if(t == 1){
  684. return "周" + "日一二三四五六".charAt(date.getDay());
  685. }else{
  686. return date.getDay();
  687. }
  688. }
  689. }
  690. })
  691. function selectBuss(_self) {
  692. let ids = $(_self).attr('data-ids');
  693. if(ids){
  694. localStorage.setItem("selectids", ids);
  695. }else{
  696. localStorage.removeItem("selectids");
  697. }
  698. let url = $(_self).attr('url');
  699. if(!url){
  700. layer.msg('请选择关联业务');
  701. return false;
  702. }
  703. layer_open(_self,0);
  704. }
  705. function selectForms(_self) {
  706. let ids = $(_self).attr('data-ids');
  707. if(ids){
  708. localStorage.setItem("selectids", ids);
  709. }else{
  710. localStorage.removeItem("selectids");
  711. }
  712. layer_open(_self,0);
  713. }
  714. </script>
  715. {/block}