assignOrder.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  1. // index.js
  2. // 获取应用实例
  3. const app = getApp();
  4. const util = require('../../../utils/jmsUtil.js');
  5. const api = require('../../../api/jms.js');
  6. import moment from 'moment'
  7. Page({
  8. data: {
  9. fullWorkers: [],
  10. failworker: '', //校验失败提升
  11. workerScheduleList: [], //被选全职的档期
  12. workerDayTimeRange: { //被选某天的档期
  13. workerTimeRangeList: [],
  14. },
  15. showFullworker: false,
  16. currmonth: '',
  17. monthArray: [],
  18. showMonth: false,
  19. showquanzhi: false,
  20. chooseRow: null, //{},改全职当前行
  21. skillVisible: false,
  22. tempIndex: '',
  23. gomaps: false, //点击地图
  24. closecusType: false, //点击客户信息
  25. closeWorker: false,
  26. serviceId: '',
  27. keywords: '',
  28. wholeList: [],
  29. workerList: [],
  30. scrollShow: false,
  31. orderInfo: { //上个页面参数
  32. fraId: '',
  33. serviceId: ''
  34. },
  35. bookDetailInfo: { //工单人员详情
  36. detailId: '',
  37. skillWorkerTotalList: [],
  38. workers: []
  39. },
  40. selectValue: '',
  41. selectVisible: false,
  42. selectKey: '',
  43. skillTimerange: [], //每个节能时长的时段
  44. timeList: [],
  45. currentDate: new Date().getTime(),
  46. },
  47. // 事件处理函数
  48. setThreeMonth() {
  49. let currmonth = moment(new Date()).format('YYYY-MM');
  50. let temparr = [];
  51. temparr.push(currmonth);
  52. for (var i = 0; i < 2; i++) {
  53. currmonth = util.getYearMonth(currmonth, '+');
  54. temparr.push(currmonth);
  55. }
  56. this.setData({
  57. currmonth: temparr[0],
  58. monthArray: temparr
  59. })
  60. },
  61. onLoad(options) {
  62. let orderInfo = app.globalData.orderInfo;
  63. console.log(orderInfo);
  64. let time = (orderInfo.bookStartTime ? (orderInfo.bookStartTime + '-' + orderInfo.bookEndTime) : '');
  65. orderInfo.time = time;
  66. this.setData({
  67. orderInfo: orderInfo
  68. });
  69. this.getBookDetail(); //工单详情
  70. this.getWorkerList(); //兼职人员
  71. this.getTimeList(); //服务时段
  72. this.setThreeMonth(); //未来3月
  73. },
  74. onshow() {
  75. // 页面显示
  76. // const location = chooseLocation.getLocation();
  77. // console.log(location);
  78. // if(location!=null){
  79. },
  80. getBookDetail() {
  81. //查询工单详情
  82. util.request(api.getDetailWorker, {
  83. detailId: this.data.orderInfo.serviceId
  84. }, 'GET').then(res => {
  85. if (res.errno == 0) {
  86. let tempData = res.data;
  87. tempData.workers2 = tempData.workers; //构造未修改信息
  88. // res.data.data.workers.forEach(p => {
  89. // if (p.bookStartTime != null && p.bookStartTime != '' && p.bookStartTime != 'null') {
  90. // }
  91. // })
  92. this.setData({
  93. bookDetailInfo: tempData
  94. })
  95. } else {
  96. wx.showToast({
  97. title: res.errmsg,
  98. icon: 'none'
  99. })
  100. }
  101. });
  102. },
  103. getWorkerList() {
  104. util.request(api.ServiceOrderPerson, {
  105. pageNo: 1,
  106. pageSize: 1000
  107. }, 'POST').then(res => {
  108. if (res.errno == 0) {
  109. this.setData({
  110. wholeList: res.data.list,
  111. workerList: res.data.list,
  112. });
  113. } else {
  114. wx.showToast({
  115. title: res.errmsg,
  116. icon: 'none'
  117. })
  118. }
  119. });
  120. },
  121. getTimeList() {
  122. util.request(api.GetGoodsTimeRange, {
  123. orderId: this.data.orderInfo.orderId
  124. }, 'GET').then(res => {
  125. if (res.errno == 0) {
  126. this.setData({
  127. skillTimerange: res.data,
  128. });
  129. } else {
  130. wx.showToast({
  131. title: res.errmsg,
  132. icon: 'none'
  133. })
  134. }
  135. });
  136. },
  137. inputClue(e) {
  138. let obj = e.currentTarget.dataset.obj;
  139. let item = `clueInfo.${obj}`;
  140. this.setData({
  141. [item]: e.detail.value
  142. });
  143. // console.log(this.data.clueInfo);
  144. },
  145. selectClue(e) {
  146. let obj = e.currentTarget.dataset.obj;
  147. this.setData({
  148. selectKey: obj,
  149. selectVisible: true
  150. });
  151. console.log(this.data.selectKey);
  152. },
  153. onPickerConfirm(e) {
  154. console.log(e);
  155. let obj = {
  156. label: e.detail.value.text,
  157. value: e.detail.value.value
  158. }
  159. if( e.detail.value.length==0){
  160. return;
  161. }
  162. let tempdata = this.data.bookDetailInfo.workers[this.data.tempIndex];
  163. tempdata.bookStartTime = e.detail.value.split('-')[0];
  164. tempdata.bookEndTime = e.detail.value.split('-')[1];
  165. this.setData({
  166. selectVisible: false,
  167. 'bookDetailInfo.workers': this.data.bookDetailInfo.workers,
  168. });
  169. },
  170. onPickerCancel() {
  171. this.setData({
  172. selectVisible: true
  173. });
  174. },
  175. inputWorker(e) {
  176. // console.log(e);
  177. let keywords = e.detail.value;
  178. let list = this.data.wholeList;
  179. let newList = [];
  180. if (keywords == '') {
  181. newList = this.data.wholeList;
  182. this.setData({
  183. 'orderInfo.workerId': ''
  184. });
  185. } else {
  186. list.forEach(item => {
  187. if (item.name.indexOf(keywords) > -1) {
  188. newList.push(item);
  189. }
  190. });
  191. }
  192. this.setData({
  193. workerList: newList
  194. });
  195. },
  196. selectWorker(e) {
  197. let tempIndex = e.target.dataset.index;
  198. let tempdata = this.data.bookDetailInfo.workers[tempIndex];
  199. if (tempdata.type == null || tempdata.type == 0) {
  200. //全职
  201. tempdata.workerName = '';
  202. tempdata.timeRange = '';
  203. let tempsklist = this.data.bookDetailInfo.skillWorkerTotalList;
  204. if (tempsklist != null && tempsklist.length == 1) { //单人服务设置默认技能
  205. tempdata.workerSkillId = tempsklist[0].skillId;
  206. tempdata.skillName = tempsklist[0].skillName;
  207. }
  208. this.setData({
  209. showquanzhi: true,
  210. chooseRow: tempdata,
  211. tempIndex: e.target.dataset.index,
  212. fullWorkers: [],
  213. workerScheduleList: [],
  214. workerDayTimeRange: {},
  215. });
  216. //加载全职人员信息
  217. this.getFullWorker();
  218. return;
  219. }
  220. this.setData({
  221. scrollShow: true,
  222. tempIndex: e.target.dataset.index,
  223. });
  224. },
  225. getFullWorker() {
  226. let r = this.data.chooseRow;
  227. if (r.workerSkillId == null || r.workerSkillId == '') { //等选择技能后再查询
  228. return;
  229. }
  230. let params = {
  231. serviceId: this.data.bookDetailInfo.detailId,
  232. month: this.data.currmonth,
  233. skillId: r.workerSkillId
  234. };
  235. util.request(api.getWorkersByServiceId,
  236. params, 'GET').then(res => {
  237. if (res.errno == 0) {
  238. this.setData({
  239. fullWorkers: res.data.workers,
  240. workerScheduleList: [],
  241. workerDayTimeRange: {}
  242. })
  243. } else {
  244. wx.showToast({
  245. title: res.errmsg,
  246. icon: 'none'
  247. })
  248. }
  249. }).catch(err => {
  250. console.log(err);
  251. });
  252. },
  253. closesCrollShow() {
  254. this.setData({
  255. scrollShow: false
  256. });
  257. },
  258. workerTap(e) {
  259. let id = e.currentTarget.dataset.id;
  260. let name = e.currentTarget.dataset.name;
  261. let workerTel = e.currentTarget.dataset.tel;
  262. let tempdata = this.data.bookDetailInfo.workers[this.data.tempIndex];
  263. tempdata.type = 1;
  264. tempdata.workerId = id;
  265. tempdata.workerName = name;
  266. tempdata.workerTel = workerTel;
  267. this.setData({
  268. scrollShow: false,
  269. 'bookDetailInfo.workers': this.data.bookDetailInfo.workers
  270. })
  271. },
  272. selectDateTime(e) {
  273. let tempdata = this.data.bookDetailInfo.workers[e.target.dataset.index];
  274. if (tempdata.type == null || tempdata.type == 0) {
  275. wx.showToast({
  276. title: '全职类型请选择改派操作',
  277. icon: 'none'
  278. })
  279. return
  280. }
  281. this.setData({
  282. dateTimeVisible: true,
  283. tempIndex: e.target.dataset.index,
  284. });
  285. },
  286. hidePicker() {
  287. this.setData({
  288. dateTimeVisible: false
  289. });
  290. },
  291. onDateTimeConfirm(e) {
  292. console.log(e);
  293. let tempdata = this.data.bookDetailInfo.workers[this.data.tempIndex];
  294. tempdata.bookDate = util.formetdate(new Date(e.detail));
  295. this.setData({
  296. currentDate: e.detail,
  297. 'bookDetailInfo.workers': this.data.bookDetailInfo.workers,
  298. dateTimeVisible: false
  299. });
  300. },
  301. selectDate(e) {
  302. let tempdata = this.data.bookDetailInfo.workers[e.target.dataset.index];
  303. if (tempdata.type == null || tempdata.type == 0) {
  304. wx.showToast({
  305. title: '全职类型请选择改派操作',
  306. icon: 'none'
  307. })
  308. return
  309. }
  310. let range = [];
  311. this.data.skillTimerange.forEach(e => {
  312. if (e.serviceLength == tempdata.serviceLength) {
  313. range = e.timeRange;
  314. }
  315. })
  316. this.setData({
  317. selectVisible: true,
  318. tempIndex: e.target.dataset.index,
  319. timeList: range
  320. });
  321. },
  322. onPickerCancel() {
  323. this.setData({
  324. selectVisible: false
  325. });
  326. },
  327. inputAddress(e) {
  328. this.setData({
  329. 'bookDetailInfo.bookAddress': e.detail.value,
  330. gomaps: true
  331. });
  332. },
  333. goMap() {
  334. this.setData({
  335. gomaps: true
  336. })
  337. // const key = "JA2BZ-XGOEU-UNZVD-46G64-S6MYJ-6BBF4";
  338. //使用在腾讯位置服务申请的key
  339. // const key = '6TRBZ-XXC6F-BWWJB-N75ME-BQNOF-YKFQY';
  340. // const referer = '鲸致生活'; //调用插件的app的名称
  341. // const category = '小区,生活服务,娱乐休闲';
  342. // wx.navigateTo({
  343. // url: 'plugin://chooseLocation/index?key=' + key + '&referer=' + referer + '&category=' + category
  344. // });
  345. let that = this;
  346. let lng = this.data.bookDetailInfo.lng;
  347. let lat = this.data.bookDetailInfo.lat;
  348. // if (lnglat.length > 0) {
  349. // lng = Number(lnglat[0]);
  350. // lat = Number(lnglat[1]);
  351. // }
  352. console.log(lng, lat);
  353. wx.chooseLocation({
  354. longitude: lng,
  355. latitude: lat,
  356. success: function (location) {
  357. console.log(location);
  358. if (location != null && location.address != '' && location.name != '') {
  359. that.setData({
  360. 'bookDetailInfo.bookAddress': location.address + location.name,
  361. 'bookDetailInfo.lng': location.longitude,
  362. 'bookDetailInfo.lat': location.latitude,
  363. });
  364. } else {
  365. wx.showToast({
  366. title: '请选择地图下方地址',
  367. icon: 'none'
  368. })
  369. }
  370. },
  371. fail: function () {
  372. console.log();
  373. }
  374. })
  375. },
  376. saveAddress() {
  377. if (this.data.bookDetailInfo.bookAddress == '' || this.data.bookDetailInfo.bookAddress.length < 12) {
  378. wx.showToast({
  379. title: '请选择或输入详细地址后再提交',
  380. icon: 'none'
  381. })
  382. this.setData({
  383. gomaps: false
  384. })
  385. return;
  386. }
  387. let lat = this.data.bookDetailInfo.lat + '';
  388. let lng = this.data.bookDetailInfo.lng + '';
  389. if (lat != null && lat.length > 9) {
  390. lat = lat.substring(0, 9)
  391. }
  392. if (lng != null && lng.length > 9) {
  393. lng = lng.substring(0, 9)
  394. }
  395. let params = {
  396. detailId: this.data.bookDetailInfo.detailId,
  397. bookName: this.data.bookDetailInfo.bookName,
  398. bookTel: this.data.bookDetailInfo.bookTel,
  399. bookAddress: this.data.bookDetailInfo.bookAddress,
  400. lat: lat,
  401. lng: lng
  402. };
  403. wx.showLoading({
  404. title: '加载中',
  405. })
  406. util.request(api.modifyBookAddress,
  407. params, 'POST').then(res => {
  408. wx.hideLoading();
  409. if (res.errno == 0) {
  410. this.getBookDetail();
  411. wx.showModal({
  412. title: '提示',
  413. content: '操作成功',
  414. showCancel: false,
  415. complete: (res) => {}
  416. })
  417. } else {
  418. wx.showToast({
  419. title: res.errmsg,
  420. icon: 'none'
  421. })
  422. }
  423. }).catch(err => {
  424. wx.hideLoading();
  425. });
  426. },
  427. validChooseWorker() {
  428. //如果条件任意一个没选,丢弃结果
  429. //校验预约时间不能小于当天,且预约日期要统一
  430. console.log(this.data.bookDetailInfo.workers);
  431. let validWorker = [];
  432. let failworker = '';
  433. let ss=this.data.bookDetailInfo.workers.filter(e=>{
  434. return e.bookDate!=null&&e.bookDate!=''&&e.bookStartTime!=null&&e.bookStartTime!='';
  435. })
  436. if(ss==null||ss.length==0){
  437. failworker = "至少选择一个预约日期;";
  438. return [];
  439. }
  440. this.data.bookDetailInfo.workers.forEach(e => {
  441. if (e.workerId != null && e.workerId != '' && e.workerName != null && e.workerName != '' &&
  442. (e.type == null || e.workerSkillId == null || e.workerSkillId == '' || e.workerName == null || e.workerName == ''
  443. )
  444. ) {
  445. failworker = failworker + e.workerName + " 服务技能未选;"
  446. }
  447. if(e.bookDate!=null&&e.bookDate!=''&&e.bookStartTime!=null&&e.bookStartTime!=''){
  448. validWorker.push(e);
  449. }
  450. // if (e.type != null && e.workerSkillId != null && e.workerSkillId != '' &&
  451. // e.workerId != null && e.workerId != '' && e.workerName != null && e.workerName != ''
  452. // ) {
  453. // validWorker.push(e);
  454. // // if (e.type == 0 && e.scheduleId != null && e.scheduleId != '') {
  455. // // } else {
  456. // // validWorker.push(e);
  457. // // }
  458. // }
  459. })
  460. this.setData({
  461. failworker: failworker
  462. })
  463. if (validWorker.length > 1) {
  464. //校验相同日期
  465. for (var i = 0; i < validWorker.length; i++) {
  466. let tm = validWorker[i].bookDate + validWorker[i].bookEndTime;
  467. let wk = validWorker[i].workerId;
  468. for (var k = 0; k < validWorker.length; k++) {
  469. let tm2 = validWorker[k].bookDate + validWorker[k].bookEndTime;
  470. let wk2 = validWorker[k].workerId;
  471. if (validWorker[i].bookDate != validWorker[k].bookDate) {
  472. this.setData({
  473. failworker: this.data.failworker + '多人服务时,日期不可跨天;'
  474. })
  475. return [];
  476. }
  477. if (validWorker[i].workerSkillId == validWorker[k].workerSkillId && tm != tm2) {
  478. this.setData({
  479. failworker: this.data.failworker + '相同技能,服务时间必须一致;'
  480. })
  481. return [];
  482. }
  483. }
  484. }
  485. }
  486. return validWorker;
  487. },
  488. confTap() {
  489. let worker = this.validChooseWorker();
  490. if (this.data.failworker != '') {
  491. wx.showToast({
  492. title: this.data.failworker,
  493. icon: 'none'
  494. });
  495. return;
  496. }
  497. wx.showLoading({
  498. title: '加载中',
  499. })
  500. let params = {
  501. detailId: this.data.bookDetailInfo.detailId,
  502. fraId: this.data.orderInfo.fraId,
  503. // bookDate: worker.length == 0 ? this.data.bookDetailInfo.bookDate : worker[0].bookDate,
  504. // bookStartTime: worker.length == 0 ? this.data.bookDetailInfo.bookStartTime : worker[0].bookStartTime,
  505. // bookEndTime: worker.length == 0 ? this.data.bookDetailInfo.bookEndTime : worker[0].bookEndTime,
  506. workerInfoList: worker.length==0?this.data.bookDetailInfo.workers2:worker
  507. }
  508. util.request(api.changeWorker,
  509. params, 'POST').then(res => {
  510. wx.hideLoading();
  511. if (res.errno == 0) {
  512. this.getBookDetail();
  513. wx.showModal({
  514. title: '提示',
  515. content: '操作成功',
  516. showCancel: false,
  517. complete: (res) => {
  518. if (res.cancel) {}
  519. if (res.confirm) {
  520. wx.navigateBack({
  521. delta: 1
  522. });
  523. }
  524. }
  525. })
  526. } else {
  527. wx.showToast({
  528. title: res.errmsg,
  529. icon: 'none'
  530. })
  531. }
  532. }).catch(err => {
  533. wx.hideLoading();
  534. });
  535. },
  536. closecus(e) {
  537. console.log(e);
  538. this.setData({
  539. closecusType: !this.data.closecusType
  540. })
  541. },
  542. closeWorker() {
  543. this.setData({
  544. closeWorker: !this.data.closeWorker
  545. })
  546. },
  547. workerTypeTab(e) {
  548. console.log(e);
  549. let index = e.target.dataset.index;
  550. let type = e.target.dataset.type;
  551. let tempdata = this.data.bookDetailInfo.workers[index];
  552. //兼职切全职,清除人员信息
  553. if (tempdata.type != null && ((tempdata.type == 0 && type == 1) || (tempdata.type == 1 && type == 0))) {
  554. tempdata.workerId = '';
  555. tempdata.workerName = '';
  556. tempdata.workerTel = '';
  557. }
  558. tempdata.type = type;
  559. this.setData({
  560. 'bookDetailInfo.workers': this.data.bookDetailInfo.workers
  561. })
  562. },
  563. skillTap(e) {
  564. let tempdata = this.data.bookDetailInfo.workers[e.target.dataset.index];
  565. if (tempdata.type == null || tempdata.type == 0) {
  566. wx.showToast({
  567. title: '全职类型请选择改派操作',
  568. icon: 'none'
  569. })
  570. return
  571. }
  572. this.setData({
  573. tempIndex: e.target.dataset.index,
  574. skillVisible: true,
  575. });
  576. },
  577. skillTapfullworker(e) {
  578. this.setData({
  579. tempIndex: e.target.dataset.index,
  580. skillVisible: true,
  581. });
  582. },
  583. skillTapCancel() {
  584. this.setData({
  585. skillVisible: false,
  586. });
  587. },
  588. skillTapConfirm(e) {
  589. console.log(e);
  590. let tempdata = this.data.bookDetailInfo.workers[this.data.tempIndex];
  591. tempdata.workerSkillId = e.detail.value.skillId;
  592. tempdata.skillName = e.detail.value.skillName;
  593. if (this.data.chooseRow != null) { //选择全职时,
  594. console.log('选了全职chooseRow', this.data.chooseRow);
  595. //修改技能要清除已选的人员
  596. let chooseRow = this.data.chooseRow;
  597. chooseRow.workerId = '';
  598. chooseRow.workerName = '';
  599. chooseRow.workerTel = '';
  600. chooseRow.scheduleId = '',
  601. this.setData({
  602. chooseRow: chooseRow,
  603. skillVisible: false,
  604. });
  605. this.getFullWorker();
  606. return; //最后确认再改派再更新值
  607. }
  608. this.setData({
  609. skillVisible: false,
  610. 'bookDetailInfo.workers': this.data.bookDetailInfo.workers
  611. });
  612. },
  613. showMonthTap() {
  614. this.setData({
  615. showMonth: true
  616. })
  617. },
  618. monthCancel() {
  619. this.setData({
  620. showMonth: false,
  621. })
  622. },
  623. monthConfirm(e) {
  624. this.data.chooseRow.workerId = '';
  625. this.data.chooseRow.workerName = '';
  626. this.data.chooseRow.workerTel = '';
  627. this.setData({
  628. showMonth: false,
  629. chooseRow: this.data.chooseRow,
  630. currmonth: e.detail.value
  631. })
  632. this.getFullWorker();
  633. },
  634. closesQuanzhi() {
  635. this.setData({
  636. showquanzhi: false,
  637. chooseRow: null
  638. })
  639. },
  640. confirmQuanzhi() {
  641. let tempdata = this.data.chooseRow;
  642. if (tempdata.workerId == '' || tempdata.workerTel == '' || tempdata.bookDate == '' || tempdata.timeRange == '' || tempdata.workerSkillId == '' ||
  643. tempdata.workerId == null || tempdata.workerTel == null || tempdata.bookDate == null || tempdata.timeRange == null || tempdata.workerSkillId == null) {
  644. wx.showToast({
  645. title: '请选择月份、人员,日期,时段后再确认操作',
  646. icon: 'none'
  647. })
  648. return;
  649. }
  650. tempdata = this.chooseRow;
  651. this.setData({
  652. showquanzhi: false,
  653. 'bookDetailInfo.workers': this.data.bookDetailInfo.workers,
  654. chooseRow: null
  655. })
  656. },
  657. selectFullWorker() {
  658. this.setData({
  659. showFullworker: true
  660. })
  661. },
  662. fullWorkerCancel() {
  663. this.setData({
  664. showFullworker: false
  665. })
  666. },
  667. fullWorkerConfirm(e) { //选择全职人员时
  668. let dt = e.detail.value;
  669. if (dt.length == 0) {
  670. this.setData({
  671. showFullworker: false
  672. })
  673. return;
  674. }
  675. let tempdata = this.data.bookDetailInfo.workers[this.data.tempIndex];
  676. tempdata.workerId = dt.workerId;
  677. tempdata.workerName = dt.workerName;
  678. tempdata.workerTel = dt.workerTel;
  679. // tempdata.scheduleId = '',
  680. this.setData({
  681. showFullworker: false,
  682. chooseRow: tempdata,
  683. workerScheduleList: dt.workerScheduleList,
  684. workerDayTimeRange: {}
  685. })
  686. if (dt.workerScheduleList.length > 0) {
  687. this.setData({
  688. workerDayTimeRange: dt.workerScheduleList[0]
  689. })
  690. }
  691. },
  692. chooseScheDay(e) {
  693. //点击某日档期
  694. console.log(e.currentTarget.dataset.index);
  695. let dayrange = this.data.workerScheduleList[e.currentTarget.dataset.index];
  696. this.data.chooseRow.scheduleId = '';
  697. this.data.chooseRow.timeRange = '';
  698. this.setData({
  699. workerDayTimeRange: dayrange,
  700. chooseRow: this.data.chooseRow
  701. })
  702. },
  703. chooseOccpy(e) {
  704. console.log(e.currentTarget.dataset.index);
  705. let chooseTime = this.data.workerDayTimeRange.workerTimeRangeList[e.currentTarget.dataset.index];
  706. let tm = chooseTime.timeRange.split('-');
  707. let row = this.data.chooseRow;
  708. row.type = 0;
  709. row.bookDate = this.data.workerDayTimeRange.formatDay;
  710. row.scheduleId = this.data.workerDayTimeRange.scheduleId;
  711. row.bookStartTime = tm[0];
  712. row.bookEndTime = tm[1];
  713. row.timeRange = chooseTime.timeRange;
  714. this.setData({
  715. chooseRow: this.data.chooseRow
  716. })
  717. }
  718. })