publicContent.jsx 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469
  1. import React, { Component, Fragment } from "react";
  2. import Taro from "@tarojs/taro";
  3. import { Text, View, Button, Icon, Radio, RadioGroup } from "@tarojs/components";
  4. import dayjs from "dayjs";
  5. import "./index.less";
  6. import ImagePicker from "../../components/common/imagePicker";
  7. import { resourceAddress } from "../../utils/config";
  8. import { AtButton, AtTextarea, AtIcon, AtCalendar } from "taro-ui";
  9. import {
  10. updatePublicRelease,
  11. getWorkingHoursList,
  12. addPublicRelease,
  13. checkOrderNoDuration,
  14. getRestrictProjectUser,
  15. } from "../../utils/servers/servers";
  16. import {
  17. getHours,
  18. getNumHourse,
  19. getUserWordTimes,
  20. getNameList,
  21. isPublicity,
  22. } from "../../utils/tools";
  23. import "taro-ui/dist/style/components/form.scss";
  24. import "taro-ui/dist/style/components/button.scss";
  25. import "taro-ui/dist/style/components/loading.scss";
  26. import "taro-ui/dist/style/components/icon.scss";
  27. import "taro-ui/dist/style/components/icon.scss";
  28. import "taro-ui/dist/style/components/textarea.scss";
  29. import "taro-ui/dist/style/components/calendar.scss";
  30. import "./publicContent.less";
  31. import InquiryModal from "../../components/common/inquiryModal";
  32. import UserQuery from "../../components/common/userquery"; //选择协单人弹窗
  33. import CheckboxPicker from "../../components/common/CheckboxPicker";
  34. import { assistTypeList, assistContentList } from "../../utils/tools/config";
  35. class PublicContent extends Component {
  36. constructor(props) {
  37. super(props);
  38. this.state = {
  39. rangeStartVal: "",
  40. rangeEndVal: "",
  41. rangeEndMinuteVal: "",
  42. rangeStartMinuteVal: "",
  43. reason: "",
  44. plan: "",
  45. expectedEffect: "",
  46. imgs: [],
  47. validDates: [],
  48. totalDuration: 0,
  49. loading: false,
  50. workTypeList: [],
  51. workType: 0,
  52. isPickerRender: false,
  53. popup: false,
  54. coorderList: [],
  55. cList: [],
  56. isNewshow: false,
  57. alone: 1,
  58. assistType: '',
  59. assistTypeName: '',
  60. assistContentType: '',
  61. assistContentTypeName: '',
  62. assistContent: '',
  63. multiplePickerShow: false,
  64. multiplePickerType: '',
  65. multiplePickerTitle: '',
  66. multiplePickerOptions: [],
  67. multiplePickerCheckedList: [],
  68. };
  69. this.onSubmit = this.onSubmit.bind(this);
  70. this.selectArrder = this.selectArrder.bind(this);
  71. this.onChange = this.onChange.bind(this);
  72. this.getWorkingHoursList = this.getWorkingHoursList.bind(this);
  73. this.onPickerHide = this.onPickerHide.bind(this);
  74. this.onSetPickerTime = this.onSetPickerTime.bind(this);
  75. this.getNumHourse = this.getNumHourse.bind(this);
  76. this.handleOpenMultiplePicker = this.handleOpenMultiplePicker.bind(this)
  77. this.handleMultipleConfirm = this.handleMultipleConfirm.bind(this)
  78. }
  79. componentDidMount() {
  80. const { dtails, again = false } = this.props
  81. let arr = [];
  82. for (let i of this.props.dtails.annexUrl) {
  83. arr.push(i.url.split(resourceAddress).join(""));
  84. }
  85. let list = [];
  86. if (!dtails.assistAid) {
  87. list = []
  88. } else {
  89. let a = dtails.assistAid.split(",")
  90. let b = dtails.assistAidName.split(",")
  91. for (var i = 0; i < a.length; i++) {
  92. list.push({
  93. id: a[i],
  94. name: b[i],
  95. })
  96. }
  97. }
  98. if (again) {
  99. // 再次公出详情
  100. this.setState({
  101. imgs: arr,
  102. totalDuration: 0,
  103. reason: this.props.dtails.remarks,
  104. validDates: [],
  105. rangeEndVal: '',
  106. rangeEndMinuteVal: '',
  107. rangeStartVal: '',
  108. rangeStartMinuteVal: '',
  109. plan: this.props.dtails.plan || "",
  110. expectedEffect: this.props.dtails.expectedEffect || "",
  111. cList: list,
  112. coorderList: !dtails.assistAid ? [] : dtails.assistAid.split(","),
  113. alone: this.props.dtails.alone,
  114. })
  115. } else {
  116. let rangeStartMinuteVal = dayjs(this.props.dtails.releaseStarts).format("YYYY-MM-DD HH:mm:ss")
  117. let rangeEndMinuteVal = dayjs(this.props.dtails.releaseEnds).format("YYYY-MM-DD HH:mm:ss")
  118. let assistTypeName = ''
  119. let assistContentTypeName = ''
  120. if ([5, 6].indexOf(this.props.dtails.type) > -1 || this.props.dtails.type == 0 && list.length) {
  121. const assistType = this.props.dtails.assistType || ''
  122. const assistContentType = this.props.dtails.assistContentType || ''
  123. let currAssistTypeOption = assistTypeList.filter(item => assistType.indexOf(item.id) > -1)
  124. assistTypeName = currAssistTypeOption.map(item => item.title).join(',')
  125. let currAssistContentTypeOption = assistContentList.filter(item => assistContentType.indexOf(item.id) > -1)
  126. assistContentTypeName = currAssistContentTypeOption.map(item => item.title).join(',')
  127. }
  128. // 编辑详情
  129. this.setState({
  130. imgs: arr,
  131. totalDuration: this.props.dtails.duration,
  132. reason: this.props.dtails.remarks || '',
  133. validDates: JSON.parse(this.props.dtails.validDate),
  134. rangeEndVal: dayjs(this.props.dtails.releaseEnds).format("YYYY-MM-DD"),
  135. rangeEndMinuteVal,
  136. rangeStartVal: dayjs(this.props.dtails.releaseStarts).format("YYYY-MM-DD"),
  137. rangeStartMinuteVal,
  138. plan: this.props.dtails.plan || "",
  139. expectedEffect: this.props.dtails.expectedEffect || "",
  140. cList: list,
  141. coorderList: !dtails.assistAid ? [] : dtails.assistAid.split(","),
  142. alone: this.props.dtails.alone,
  143. assistType: this.props.dtails.assistType,
  144. assistTypeName,
  145. assistContentType: this.props.dtails.assistContentType,
  146. assistContentTypeName,
  147. assistContent: this.props.dtails.assistContent,
  148. });
  149. }
  150. this.getWorkingHoursList();
  151. }
  152. componentWillUnmount() {
  153. this.imagePickerRef && this.imagePickerRef.clear();
  154. this.setState({
  155. rangeStartVal: "",
  156. rangeEndVal: "",
  157. rangeEndMinuteVal: "",
  158. rangeStartMinuteVal: "",
  159. reason: "",
  160. plan: "",
  161. expectedEffect: "",
  162. imgs: [],
  163. validDates: [],
  164. totalDuration: 0,
  165. loading: false,
  166. });
  167. }
  168. getWorkingHoursList() {
  169. getWorkingHoursList({})
  170. .then((v) => {
  171. if (v.error.length === 0) {
  172. let obj = Taro.getStorageSync("userInfor");
  173. let index = v.data.findIndex(
  174. (value) => value.type === obj.workTimeInfor.type
  175. );
  176. this.setState({
  177. workType: index !== -1 ? index : 0,
  178. });
  179. this.setState({
  180. workTypeList: v.data,
  181. });
  182. } else {
  183. Taro.showToast({
  184. title: v.error[0].message,
  185. icon: "none",
  186. });
  187. }
  188. })
  189. .catch((err) => {
  190. //console.log(err);
  191. });
  192. }
  193. getNumHourse(startTime, endTime) {
  194. this.setState({
  195. totalDuration: getNumHourse(
  196. startTime,
  197. endTime,
  198. this.state.validDates.length
  199. ),
  200. });
  201. }
  202. // 增加 省 市 区拼接,地址带区域的则把区域去掉
  203. getArea() {
  204. const { locationInfor } = this.props
  205. let address = locationInfor.name;
  206. let defaultProvince = locationInfor.province || "";
  207. let defaultCity = locationInfor.city || "";
  208. let defaultDistrict = locationInfor.district || "";
  209. // 假设省市区的关键字有 "省", "市", "区"
  210. const provinceKeyword = '省';
  211. const cityKeyword = '市';
  212. const districtKeyword = '区';
  213. // 判断是否包含省市区关键字,如果不包含则进行补全
  214. if (address.indexOf(provinceKeyword) === -1) {
  215. address = `${defaultProvince}${address}`;
  216. }
  217. if (address.indexOf(cityKeyword) === -1) {
  218. address = address.replace(provinceKeyword, `${provinceKeyword}${defaultCity}`);
  219. }
  220. if (address.indexOf(districtKeyword) !== -1 && address.indexOf("小区") !== -1) {
  221. address = address.replace(cityKeyword, `${cityKeyword}${defaultDistrict}`);
  222. } else if (address.indexOf(districtKeyword) === -1) {
  223. address = address.replace(cityKeyword, `${cityKeyword}${defaultDistrict}`);
  224. }
  225. return address;
  226. }
  227. // 修改公出提交
  228. onSubmit() {
  229. const { dtails, locationInfor, isVerify = false } = this.props;
  230. let objectType = this.props.dtails.uids.indexOf(',') > -1 ? 1 : 0
  231. this.setState({
  232. loading: true,
  233. });
  234. let datas;
  235. let addressName = !!locationInfor.province ? locationInfor.province + locationInfor.city + locationInfor.district : "";
  236. if (this.props.dtails.type == 0) {
  237. datas = {
  238. id: this.props.dtails.id,
  239. uids: this.props.dtails.uids,
  240. releaseStarts: this.state.rangeStartMinuteVal,
  241. releaseEnds: this.state.rangeEndMinuteVal,
  242. remarks: this.state.reason,
  243. plan: this.state.plan,
  244. expectedEffect: this.state.expectedEffect,
  245. districtName: this.getArea(),
  246. addressName: addressName,
  247. longitude: locationInfor.longitude,
  248. latitude: locationInfor.latitude,
  249. annexUrl: this.state.imgs.length === 0 ? "" : this.state.imgs.join(","),
  250. duration: this.state.totalDuration,
  251. validDate: JSON.stringify(this.state.validDates),
  252. type: this.props.dtails.type,
  253. status: 1,
  254. alone: this.state.coorderList.length === 0 ? 0 : this.state.alone,
  255. assist: this.state.coorderList.length === 0 ? 0 : 1,
  256. assistAid: this.state.coorderList.length === 0 ? "" : this.state.coorderList.join(","),
  257. assistAidName: this.state.coorderList.length === 0 ? "" : getNameList(this.state.coorderList, this.state.cList).join(","),
  258. };
  259. if (this.state.cList.length) {
  260. datas.assistType = this.state.assistType
  261. datas.assistContentType = this.state.assistContentType
  262. datas.assistContent = this.state.assistContent
  263. }
  264. } else if (this.props.dtails.type == 2) {
  265. datas = {
  266. id: this.props.dtails.id,
  267. uids: this.props.dtails.uids,
  268. releaseStarts: this.state.rangeStartMinuteVal,
  269. releaseEnds: this.state.rangeEndMinuteVal,
  270. remarks: this.state.reason,
  271. // plan: this.state.plan,
  272. // expectedEffect: this.state.expectedEffect,
  273. districtName: this.getArea(),
  274. addressName: addressName,
  275. longitude: this.props.locationInfor.longitude,
  276. latitude: this.props.locationInfor.latitude,
  277. annexUrl: this.state.imgs.length === 0 ? "" : this.state.imgs.join(","),
  278. duration: this.state.totalDuration,
  279. validDate: JSON.stringify(this.state.validDates),
  280. type: this.props.dtails.type,
  281. status: 1,
  282. alone: this.state.coorderList.length === 0 ? 0 : this.state.alone,
  283. assist: this.state.coorderList.length === 0 ? 0 : 1,
  284. assistAid: this.state.coorderList.length === 0 ? "" : this.state.coorderList.join(","),
  285. assistAidName: this.state.coorderList.length === 0 ? "" : getNameList(this.state.coorderList, this.state.cList).join(","),
  286. };
  287. } else {
  288. datas = {
  289. id: this.props.dtails.id,
  290. uids: this.props.dtails.uids,
  291. releaseStarts: this.state.rangeStartMinuteVal,
  292. releaseEnds: this.state.rangeEndMinuteVal,
  293. remarks: this.state.reason,
  294. plan: this.state.plan,
  295. expectedEffect: this.state.expectedEffect,
  296. districtName: this.getArea(),
  297. addressName: addressName,
  298. longitude: this.props.locationInfor.longitude,
  299. latitude: this.props.locationInfor.latitude,
  300. annexUrl: this.state.imgs.length === 0 ? "" : this.state.imgs.join(","),
  301. duration: this.state.totalDuration,
  302. validDate: JSON.stringify(this.state.validDates),
  303. type: this.props.dtails.type,
  304. orderNo: this.props.dtails.orderNo,
  305. status: 1,
  306. alone: this.state.coorderList.length === 0 ? 0 : this.state.alone,
  307. assist: this.state.coorderList.length === 0 ? 0 : 1,
  308. assistAid: this.state.coorderList.length === 0 ? "" : this.state.coorderList.join(","),
  309. assistAidName: this.state.coorderList.length === 0 ? "" : getNameList(this.state.coorderList, this.state.cList).join(","),
  310. };
  311. }
  312. if (isVerify) {
  313. datas = { ...datas, ...{ reason: this.props.reason, objectType, } };
  314. }
  315. if([5, 6].indexOf(this.props.dtails.type) > -1) {
  316. datas.assistType = this.state.assistType
  317. datas.assistContentType = this.state.assistContentType
  318. datas.assistContent = this.state.assistContent
  319. datas.duration = 0
  320. }
  321. for (let key in datas) {
  322. if (datas[key] === undefined || datas[key] === 'undefined' || datas[key] === null || datas[key] === 'null') {
  323. delete datas[key];
  324. }
  325. }
  326. updatePublicRelease(datas)
  327. .then((v) => {
  328. this.setState({
  329. loading: false,
  330. });
  331. if (v.error.length === 0) {
  332. Taro.showToast({
  333. title: "修改成功",
  334. });
  335. Taro.eventCenter.trigger("listOperation", {
  336. type: this.props.permission,
  337. index: this.props.index,
  338. status: 1,
  339. districtName: this.props.locationInfor.name,
  340. releaseStarts: this.state.rangeStartMinuteVal,
  341. releaseEnds: this.state.rangeEndMinuteVal,
  342. });
  343. this.props.onClose();
  344. } else {
  345. Taro.showToast({
  346. title: v.error[0].message,
  347. icon: "none",
  348. });
  349. }
  350. })
  351. .catch(() => {
  352. this.setState({
  353. loading: false,
  354. });
  355. });
  356. }
  357. // 再次公出提交
  358. goAgain() {
  359. const { locationInfor } = this.props
  360. if (!this.state.rangeStartMinuteVal) {
  361. Taro.showToast({ title: "请选择公出时间", icon: "none" });
  362. return;
  363. }
  364. if (!this.state.rangeEndMinuteVal) {
  365. Taro.showToast({ title: "请选择公出时间", icon: "none" });
  366. return;
  367. }
  368. if (
  369. !(
  370. this.props.locationInfor.longitude &&
  371. this.props.locationInfor.latitude
  372. )
  373. ) {
  374. Taro.showToast({ title: "请选择公出地点", icon: "none" });
  375. return;
  376. }
  377. if (!this.state.reason) {
  378. Taro.showToast({ title: "请输入公出目标", icon: "none" });
  379. return;
  380. }
  381. if (!this.state.plan && this.props.dtails.type != 2) {
  382. Taro.showToast({ title: "请输入公出计划", icon: "none" });
  383. return;
  384. }
  385. if (!this.state.expectedEffect && this.props.dtails.type != 2) {
  386. Taro.showToast({ title: "请输入预计效果", icon: "none" });
  387. return;
  388. }
  389. if (this.state.totalDuration === 0) {
  390. Taro.showToast({
  391. title: "请选择公出时间,目前设置公出时间不足0.5小时",
  392. icon: "none",
  393. });
  394. return;
  395. }
  396. let info = Taro.getStorageSync("userInfor");
  397. if (this.props.dtails.type == 0 && this.state.totalDuration > info.workTimeInfor.minHours && this.state.imgs.length == 0) {
  398. Taro.showToast({ title: "请上传附件", icon: "none" });
  399. return
  400. }
  401. this.setState({
  402. loading: true,
  403. });
  404. let datas = {
  405. publicAgain: 1,
  406. uids: this.props.dtails.uids,
  407. objectType: this.props.dtails.uids.indexOf(',') > -1 ? 1 : 0,
  408. releaseStarts: this.state.rangeStartMinuteVal,
  409. releaseEnds: this.state.rangeEndMinuteVal,
  410. remarks: this.state.reason,
  411. districtName: this.getArea(),
  412. addressName: locationInfor.province + locationInfor.city + locationInfor.district,
  413. longitude: this.props.locationInfor.longitude,
  414. latitude: this.props.locationInfor.latitude,
  415. annexUrl: this.state.imgs.length === 0 ? "" : this.state.imgs.join(","),
  416. duration: this.state.totalDuration,
  417. type: this.props.dtails.type,
  418. validDate: JSON.stringify(this.state.validDates),
  419. alone: this.state.coorderList.length === 0 ? 0 : this.state.alone,
  420. assist: this.state.coorderList.length === 0 ? 0 : 1,
  421. assistAid: this.state.coorderList.length === 0 ? "" : this.state.coorderList.join(","),
  422. assistAidName: this.state.coorderList.length === 0 ? "" : getNameList(this.state.coorderList, this.state.cList).join(","),
  423. };
  424. if (this.props.dtails.type == 0) {
  425. datas = {
  426. ...datas,
  427. ...{
  428. plan: this.state.plan,
  429. expectedEffect: this.state.expectedEffect,
  430. }
  431. };
  432. } else if (this.props.dtails.type == 2) {
  433. datas = datas;
  434. } else {
  435. datas = {
  436. ...datas,
  437. ...{
  438. plan: this.state.plan,
  439. expectedEffect: this.state.expectedEffect,
  440. orderNo: this.props.dtails.orderNo,
  441. }
  442. };
  443. }
  444. addPublicRelease(datas)
  445. .then((v) => {
  446. this.setState({
  447. loading: false,
  448. });
  449. if (v.error.length === 0) {
  450. Taro.showToast({
  451. title: "申请成功",
  452. });
  453. // this.props.onClose();
  454. this.setState({
  455. isAgains: true,
  456. goId: v.data.data.id,
  457. goDatas: v.data.data,
  458. })
  459. } else {
  460. Taro.showToast({
  461. title: v.error[0].message,
  462. icon: "none",
  463. });
  464. }
  465. })
  466. .catch(() => {
  467. this.setState({
  468. loading: false,
  469. });
  470. });
  471. }
  472. selectArrder() {
  473. const key = "AWBBZ-GRAC2-JFYUO-CLA7I-JAHXK-YFFGT"; //使用在腾讯位置服务申请的key
  474. const referer = "科德打卡定位"; //调用插件的app的名称
  475. const category = "公司企业,房产小区";
  476. Taro.navigateTo({
  477. url:
  478. "plugin://chooseLocation/index?key=" +
  479. key +
  480. "&referer=" +
  481. referer +
  482. "&category=" +
  483. category,
  484. });
  485. }
  486. onChange(value, type) {
  487. let arr = this.state.imgs.concat([]);
  488. if (type === "add") {
  489. arr.push(value);
  490. } else if (type === "remove") {
  491. arr.splice(value, 1);
  492. }
  493. this.setState({
  494. imgs: arr,
  495. });
  496. }
  497. onPickerHide() {
  498. this.setState({
  499. isPickerRender: false,
  500. });
  501. }
  502. onSetPickerTime(val) {
  503. let data = val.detail;
  504. if([5, 6].indexOf(this.props.dtails.type) > -1) {
  505. data.selectStartTime = dayjs(data.selectStartTime).format('YYYY-MM-DD 08:30:00')
  506. data.selectEndTime = dayjs(data.selectEndTime).format('YYYY-MM-DD 17:30:00')
  507. data.startTime = dayjs(data.startTime).format('YYYY-MM-DD 08:30:00')
  508. data.endTime = dayjs(data.endTime).format('YYYY-MM-DD 17:30:00')
  509. }
  510. let rangeStartMinuteVal = data.selectStartTime;
  511. let rangeEndMinuteVal = data.selectEndTime;
  512. if ([5, 6].indexOf(this.props.dtails.type) > -1) {
  513. rangeStartMinuteVal = dayjs(data.selectStartTime).format('YYYY-MM-DD');
  514. rangeEndMinuteVal = dayjs(data.selectEndTime).format('YYYY-MM-DD');
  515. }
  516. this.setState({ rangeStartMinuteVal, rangeEndMinuteVal });
  517. let arr = [];
  518. if (data.startTime && data.endTime) {
  519. let a = dayjs(data.startTime);
  520. let b = dayjs(data.endTime);
  521. let num;
  522. if (a.hour() <= b.hour()) {
  523. num = b.diff(a, "day") + 1;
  524. } else {
  525. num = b.diff(a, "day") + 2;
  526. }
  527. let strAdd = data.startTime;
  528. for (let i = 0; i < num; i++) {
  529. let time = dayjs(strAdd).add(i, "days").format("YYYY-MM-DD");
  530. arr.push({ value: time });
  531. }
  532. }
  533. this.setState(
  534. {
  535. rangeEndVal: dayjs(data.endTime).format("YYYY-MM-DD"),
  536. rangeStartVal: dayjs(data.startTime).format("YYYY-MM-DD"),
  537. validDates: arr,
  538. },
  539. () => {
  540. let a1 = dayjs(dayjs(data.endTime).format("YYYY-MM-DD HH:mm:ss"));
  541. let b1 = dayjs(dayjs(data.startTime).format("YYYY-MM-DD HH:mm:ss"));
  542. this.getNumHourse(b1, a1);
  543. }
  544. );
  545. }
  546. // 新增技术协单
  547. setList(list, arr) {
  548. this.setState({
  549. cList: list,
  550. coorderList: arr
  551. })
  552. }
  553. // 弹窗开关
  554. popupClick() {
  555. this.setState({
  556. popup: !this.state.popup
  557. })
  558. }
  559. // 技术公出逻辑判断
  560. checkOrderNoDuration(type) {
  561. const _this = this
  562. if (this.state.totalDuration == 0) {
  563. Taro.showToast({ title: "请选择公出时间", icon: "none" });
  564. return
  565. }
  566. checkOrderNoDuration({
  567. id: this.props.dtails.id,
  568. duration: this.state.totalDuration,
  569. orderNo: this.props.dtails.orderNo,
  570. })
  571. .then((v) => {
  572. if (v.error.length == 0) {
  573. if (!v.data.code) {
  574. let obj = v.data.data
  575. _this.setState({
  576. isNewshow: true,
  577. isInquiryOpened: true,
  578. inquiryTitle: "提醒",
  579. inquiryContent: <View style={{ padding: "10px 15px" }}>
  580. <View>您准备公出<Text style={{ color: 'red' }}>{obj.userName}({obj.contractNo})</Text>,</View>
  581. <View>总计公出:<Text style={{ color: 'red' }}>{obj.peopleCount}人,{obj.timesCount}次,{obj.durationCount}时</Text>。</View>
  582. <View>
  583. <Text style={{ color: 'red' }}>
  584. {obj.amountName},{obj.amountType}
  585. </Text>。
  586. </View>
  587. <View>如需公出,需<Text style={{ color: 'red' }}>{obj.adminName}</Text>审核。</View>
  588. <View>请确定,是否发起公出申请!</View>
  589. </View>,
  590. inquiryFn: () => {
  591. type == 1
  592. ? _this.onSubmit() : type == 2
  593. ? _this.goAgain() : console.log("-")
  594. },
  595. })
  596. } else {
  597. _this.setState({
  598. isNewshow: false,
  599. isInquiryOpened: true,
  600. inquiryTitle: "提醒",
  601. inquiryContent: "您确定要提交此申请吗?",
  602. inquiryFn: () => {
  603. type == 1
  604. ? _this.onSubmit() : type == 2
  605. ? _this.goAgain() : console.log("-")
  606. },
  607. })
  608. }
  609. }
  610. })
  611. .catch(() => {
  612. this.setState({
  613. loading: false,
  614. });
  615. });
  616. }
  617. // 业务公出限定项目
  618. getRestrictProjectUser() {
  619. const _this = this
  620. getRestrictProjectUser({
  621. ids: this.props.dtails.uids,
  622. })
  623. .then((v) => {
  624. if (v.error.length === 0) {
  625. let arr = []
  626. if (v.data && v.data.length > 0) {
  627. v.data.forEach(e => {
  628. e.type == 1 && arr.push(e["userName"])
  629. })
  630. }
  631. this.setState({
  632. isInquiryOpened: true,
  633. inquiryTitle: "提醒",
  634. inquiryContent: arr.length > 0
  635. ? <View style={{ color: 'red' }}>您公出的{arr.toString()},为限定项目的企业,建议您由经理协助公出恰谈!</View>
  636. : "您确定要提交此申请吗?",
  637. inquiryFn: () => {
  638. _this.onSubmit();
  639. },
  640. });
  641. } else {
  642. Taro.showToast({
  643. title: v.error[0].message,
  644. icon: "none",
  645. });
  646. }
  647. })
  648. .catch((err) => {
  649. });
  650. }
  651. handleOpenMultiplePicker(type) {
  652. let multiplePickerOptions = [];
  653. let multiplePickerTitle = '';
  654. let multiplePickerCheckedList = [];
  655. const { assistType, assistContentType } = this.state;
  656. switch (type) {
  657. case 'assistType':
  658. // 协单项目类型
  659. multiplePickerOptions = assistTypeList;
  660. multiplePickerCheckedList = assistType ? assistType.toString().split(',') : []
  661. multiplePickerTitle = '请选择协单项目类型';
  662. break;
  663. case 'assistContentType':
  664. // 协单项目内容
  665. multiplePickerOptions = assistContentList;
  666. multiplePickerCheckedList = assistContentType ? assistContentType.toString().split(',') : []
  667. multiplePickerTitle = '请选择协单项目内容';
  668. break;
  669. default:
  670. break;
  671. }
  672. this.setState({
  673. multiplePickerShow: true,
  674. multiplePickerType: type,
  675. multiplePickerTitle,
  676. multiplePickerOptions,
  677. multiplePickerCheckedList: multiplePickerCheckedList
  678. })
  679. }
  680. handleMultipleConfirm(selectedIds, selectedLabels) {
  681. const { multiplePickerType } = this.state;
  682. switch (multiplePickerType) {
  683. case "assistType":
  684. // 协单项目类型
  685. this.setState({
  686. assistType: selectedIds.join(','),
  687. assistTypeName: selectedLabels.join(',')
  688. })
  689. break;
  690. case "assistContentType":
  691. // 协单项目内容
  692. this.setState({
  693. assistContentType: selectedIds.join(','),
  694. assistContentTypeName: selectedLabels.join(',')
  695. })
  696. break;
  697. default:
  698. break;
  699. }
  700. }
  701. render() {
  702. const { dtails, userList, type, again = false } = this.props;
  703. const { cList, coorderList, popup, } = this.state;
  704. const info = Taro.getStorageSync("userInfor");
  705. const isShow = dtails.type == 0
  706. ? isPublicity(userList, 0) : dtails.type == 1
  707. ? this.state.isNewshow : false;
  708. const tipList = isPublicity(userList, 1);
  709. return (
  710. <View className="publicContent">
  711. <View className="formItem">
  712. <View className="formName">公出企业:</View>
  713. <View className="formValue" style={{ flexDirection: "column", alignItems: "flex-end" }}>
  714. {/* {dtails.nickname} */}
  715. {
  716. !!dtails.userNames && dtails.userNames.indexOf(',') > -1
  717. ? dtails.userNames.split(',')?.map((item, index) => <View key={index}>{item}</View>)
  718. : dtails.userNames
  719. }
  720. </View>
  721. </View>
  722. {
  723. (dtails.type == 0 && isPublicity(userList, 0)) &&
  724. <View className="othersTips">您正在申请公出他人企业:需跟单员“
  725. {isPublicity(userList, 1).toString()}
  726. ”审核同意,您才可公出!</View>
  727. }
  728. <View className="formItem">
  729. <View className="formName">公出类型:</View>
  730. <View className="formValue">
  731. {dtails.type == 0
  732. ? "业务公出" : dtails.type == 1
  733. ? "技术公出" : dtails.type == 2
  734. ? "行政公出" : dtails.type == 3
  735. ? "协单助手" : dtails.type == 5
  736. ? "非公出协单" : dtails.type == 6
  737. ? "非公出协单" : ""}
  738. </View>
  739. </View>
  740. {dtails.contractNo && dtails.type == 1 ? (
  741. <View className="formItem">
  742. <View className="formName">合同编号:</View>
  743. <View className="formValue">{dtails.contractNo}</View>
  744. </View>
  745. ) : (
  746. ""
  747. )}
  748. {
  749. dtails.type != 5 ? (
  750. <View className="formItem">
  751. <View className="formName">作息时间类型:</View>
  752. <View className="formValue">
  753. <picker
  754. onChange={(e) => {
  755. this.setState({
  756. workType: e.detail.value,
  757. });
  758. if (this.state.workTypeList[e.detail.value]) {
  759. let obj = Taro.getStorageSync("userInfor");
  760. obj.workTimeInfor = this.state.workTypeList[e.detail.value];
  761. Taro.setStorageSync("userInfor", obj);
  762. this.setState({
  763. rangeStartVal: "",
  764. rangeStartMinuteVal: "",
  765. rangeEndMinuteVal: "",
  766. rangeEndVal: "",
  767. validDates: [],
  768. totalDuration: 0,
  769. });
  770. }
  771. }}
  772. value={this.state.workType}
  773. rangeKey="name"
  774. range={this.state.workTypeList}
  775. >
  776. <view style={{ display: "flex", alignItems: "center" }}>
  777. {this.state.workTypeList[this.state.workType]
  778. ? this.state.workTypeList[this.state.workType].name
  779. : ""}
  780. <AtIcon value="chevron-right" size="20" color="#bbbbbb" />
  781. </view>
  782. </picker>
  783. </View>
  784. </View>
  785. ) : null
  786. }
  787. <View className="formItem">
  788. <View className="formName">公出时间:</View>
  789. <View className="formValue">
  790. <View
  791. className="time"
  792. onClick={() => {
  793. this.setState({
  794. isPickerRender: true,
  795. });
  796. }}
  797. >
  798. {this.state.rangeStartMinuteVal &&
  799. this.state.rangeEndMinuteVal ? (
  800. <View className="timeContent">
  801. <View>开始时间:{this.state.rangeStartMinuteVal}</View>
  802. <View>结束时间:{this.state.rangeEndMinuteVal}</View>
  803. </View>
  804. ) : (
  805. "请选择公出时间"
  806. )}
  807. </View>
  808. <timePicker
  809. config={{
  810. endDate: true,
  811. column: [5, 6].indexOf(dtails.type) > -1 ? "day" : "minute",
  812. dateLimit: false,
  813. initStartTime: this.state.rangeStartMinuteVal, //默认开始时间
  814. initEndTime: this.state.rangeEndMinuteVal, //默认结束时间
  815. limitStartTime: dayjs()
  816. .subtract(3, "year")
  817. .format("YYYY-MM-DD HH:mm:ss"),
  818. limitEndTime: dayjs()
  819. .add(3, "year")
  820. .format("YYYY-MM-DD HH:mm:ss"),
  821. }}
  822. isPartition
  823. pickerShow={this.state.isPickerRender}
  824. onconditionaljudgment={(v) => {
  825. let formatTemp = [5, 6].indexOf(dtails.type) > -1 ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss"
  826. let selTimeStr = dayjs(v.detail.startTime).second(0).format(formatTemp)
  827. let selEndTimeStr = dayjs(v.detail.endTime).second(0).format(formatTemp)
  828. let startTimeD = dayjs([5, 6].indexOf(dtails.type) > -1 ? `${selTimeStr} 00:00:00` : selTimeStr);
  829. let endTimeD = dayjs([5, 6].indexOf(dtails.type) > -1 ? `${selEndTimeStr} 23:59:59` : selEndTimeStr);
  830. let now = dayjs()
  831. let currTime = [5, 6].indexOf(dtails.type) > -1 ? now.subtract(1, 'day').set('hour', 23).set('minute', 59).set('second', 59) : dayjs().second(0)
  832. let currTimeD = dayjs(currTime.format("YYYY-MM-DD HH:mm:ss"));
  833. if (!startTimeD.isAfter(currTimeD)) {
  834. Taro.showToast({
  835. title: "开始时间不能小于当前时间",
  836. icon: "none",
  837. });
  838. v.detail.setLv(false);
  839. } else if (!endTimeD.isAfter(startTimeD)) {
  840. Taro.showToast({
  841. title: "结束时间不能小于开始时间",
  842. icon: "none",
  843. });
  844. v.detail.setLv(false);
  845. }
  846. }}
  847. onhidepicker={() => {
  848. this.onPickerHide();
  849. }}
  850. onsetpickertime={(v) => {
  851. this.onSetPickerTime(v);
  852. }}
  853. />
  854. </View>
  855. </View>
  856. {
  857. dtails.type != 5 && (
  858. <View className="formItem">
  859. <View className="formName">总时长:</View>
  860. <View className="formValue">{this.state.totalDuration}小时</View>
  861. </View>
  862. )
  863. }
  864. {
  865. [0, 5].indexOf(dtails.type) > -1 &&
  866. <View className="formItem" style={{ alignItems: "flex-start" }}>
  867. <View className="formName">技术协单:</View>
  868. <View className="formValues">
  869. {
  870. cList.length === 0
  871. ? <Text>无</Text>
  872. : cList.map((item, index) =>
  873. <View className="fitems" key={index}>
  874. {item.name}
  875. <View className="fclose"
  876. onClick={() => {
  877. coorderList.includes(item.id) &&
  878. (
  879. cList.splice(coorderList.indexOf(item.id), 1),
  880. coorderList.splice(coorderList.indexOf(item.id), 1)
  881. )
  882. this.setState({
  883. cList,
  884. coorderList,
  885. })
  886. }}
  887. ><AtIcon value="close-circle" size="15" color="#bbbbbb" /></View>
  888. </View>
  889. )
  890. }
  891. {cList.length < 5 && <Button className="addbuttom" type='primary' onClick={this.popupClick.bind(this)}>新增技术协单</Button>}
  892. </View>
  893. </View>
  894. }
  895. {
  896. [0, 5].indexOf(dtails.type) > -1 &&
  897. <View className="tips">
  898. 请与技术协商后,再发起协单,协单将统计公出成本等
  899. </View>
  900. }
  901. {
  902. cList.length >= 1 &&
  903. <View
  904. className="formItem"
  905. style={{ paddingBottom: 0, marginTop: 10 }}
  906. >
  907. <View className="formName">
  908. <Text>本人公出:</Text>
  909. </View>
  910. <View>
  911. <RadioGroup
  912. onChange={e => {
  913. this.setState({
  914. alone: e.detail.value
  915. })
  916. }}
  917. >
  918. {[{ text: "是,一同公出", value: 1 },
  919. { text: "否,本人不公出", value: 2 }].map((item, i) => {
  920. return (
  921. <Radio
  922. style={{ marginLeft: 10 }}
  923. key={i}
  924. value={item.value}
  925. checked={item.value == this.state.alone}>
  926. {item.text}
  927. </Radio>
  928. )
  929. })}
  930. </RadioGroup>
  931. </View>
  932. </View>
  933. }
  934. {this.state.validDates.length !== 0 ? (
  935. <View
  936. className="formItem"
  937. style={{ display: "block", paddingTop: "15px" }}
  938. >
  939. <View className="formName">
  940. <View>去除放假时间:</View>
  941. <View className="tips">
  942. 绿色方块为公出时间,长按即可去除放假时间
  943. </View>
  944. </View>
  945. <AtCalendar
  946. currentDate={this.state.rangeStartVal}
  947. minDate={this.state.rangeStartVal}
  948. maxDate={this.state.rangeEndVal}
  949. isSwiper={false}
  950. validDates={this.state.validDates}
  951. onDayLongClick={(item) => {
  952. if (
  953. !(
  954. dayjs(item.value).isSame(this.state.rangeStartVal) ||
  955. dayjs(item.value).isSame(this.state.rangeEndVal)
  956. )
  957. ) {
  958. if (
  959. !(
  960. dayjs(item.value).isAfter(this.state.rangeStartVal) &&
  961. dayjs(item.value).isBefore(this.state.rangeEndVal)
  962. )
  963. ) {
  964. return;
  965. }
  966. } else {
  967. Taro.showToast({
  968. title: "开始结束时间不能取消",
  969. icon: "none",
  970. });
  971. return;
  972. }
  973. let index = this.state.validDates.findIndex((v) => {
  974. let lv = dayjs(v.value).isSame(item.value);
  975. return lv;
  976. });
  977. const { start, end } = getUserWordTimes();
  978. let totalDuration = getHours(
  979. dayjs().format("YYYY-MM-DD") + start,
  980. dayjs(dayjs().format("YYYY-MM-DD") + end)
  981. ); //一天工作时长
  982. if (index < 0) {
  983. let arr = item.value.split("-");
  984. this.state.validDates.push({ value: arr.join("-") });
  985. this.setState({
  986. validDates: this.state.validDates,
  987. totalDuration: this.state.totalDuration + totalDuration,
  988. });
  989. } else {
  990. this.state.validDates.splice(index, 1);
  991. this.setState({
  992. validDates: this.state.validDates,
  993. totalDuration: this.state.totalDuration - totalDuration,
  994. });
  995. }
  996. }}
  997. />
  998. </View>
  999. ) : null}
  1000. <View
  1001. className="formItem"
  1002. style={{
  1003. paddingBottom: 0,
  1004. }}
  1005. >
  1006. <View className="formName">公出地点:</View>
  1007. <View className="formValue" onClick={this.selectArrder}>
  1008. <Text className="formValueText">
  1009. {this.props.locationInfor.name}
  1010. </Text>
  1011. <AtIcon value="chevron-right" size="30" color="#bbbbbb" />
  1012. </View>
  1013. </View>
  1014. <View className="tips">
  1015. 以地图为中心100米范围为可打卡区域,移动红标只需要拖动地图即可
  1016. </View>
  1017. { [5, 6].indexOf(dtails.type) > -1 || (dtails.type == 0 && this.state.cList.length) ? (
  1018. <Fragment>
  1019. <View className="formItem">
  1020. <View className="formName">协单类型:</View>
  1021. <View className="formValue" onClick={() => this.handleOpenMultiplePicker('assistType')}>
  1022. <Text className="formValueText">
  1023. { this.state.assistTypeName }
  1024. </Text>
  1025. <AtIcon value="chevron-right" size="30" color="#bbbbbb" />
  1026. </View>
  1027. </View>
  1028. <View className="formItem">
  1029. <View className="formName">协单内容:</View>
  1030. <View className="formValue" onClick={() => this.handleOpenMultiplePicker('assistContentType')}>
  1031. <Text className="formValueText">
  1032. { this.state.assistContentTypeName }
  1033. </Text>
  1034. <AtIcon value="chevron-right" size="30" color="#bbbbbb" />
  1035. </View>
  1036. </View>
  1037. { (this.state.assistContentType || '').indexOf('0') > -1 ? (
  1038. <View className="formItem">
  1039. <View className="formName">内容说明:</View>
  1040. <View
  1041. className="formValue"
  1042. style={{ paddingTop: "10px", textAlign: "left" }}
  1043. >
  1044. <AtTextarea
  1045. height={46}
  1046. value={this.state.assistContent}
  1047. onChange={(v) => {
  1048. this.setState({
  1049. assistContent: v,
  1050. });
  1051. }}
  1052. count={false}
  1053. maxLength={1000}
  1054. placeholder="请输入协单内容说明"
  1055. />
  1056. </View>
  1057. </View>
  1058. ) : null }
  1059. </Fragment>
  1060. ) : null }
  1061. <View
  1062. className="formItem"
  1063. style={{ display: "block", paddingTop: "15px" }}
  1064. >
  1065. {/* 公出目标 */}
  1066. {[1, 2, 5, 6].indexOf(dtails.type) > -1 && (<View className="formName">
  1067. <Text>
  1068. <Text style={{ color: "red" }}>*</Text>
  1069. 公出目标:</Text>
  1070. <View
  1071. className="formValue"
  1072. style={{ paddingTop: "10px", textAlign: "left" }}
  1073. >
  1074. <AtTextarea
  1075. height={46}
  1076. value={this.state.reason}
  1077. onChange={(v) => {
  1078. this.setState({
  1079. reason: v,
  1080. });
  1081. }}
  1082. maxLength={200}
  1083. placeholder={
  1084. dtails.type == 2
  1085. ? "详细说明本次公出的内容,预计完成的内容"
  1086. : "本次公出目标,谈的思路与步骤?"
  1087. }
  1088. />
  1089. </View>
  1090. </View>)}
  1091. {/* 公出计划 */}
  1092. {[1, 5, 6].indexOf(dtails.type) > -1 && (
  1093. <View className="formName">
  1094. <Text>
  1095. <Text style={{ color: "red" }}>*</Text>
  1096. 公出计划:</Text>
  1097. <View
  1098. className="formValue"
  1099. style={{ paddingTop: "10px", textAlign: "left" }}
  1100. >
  1101. <AtTextarea
  1102. height={46}
  1103. value={this.state.plan}
  1104. onChange={(v) => {
  1105. this.setState({
  1106. plan: v,
  1107. });
  1108. }}
  1109. maxLength={200}
  1110. placeholder="本次公出准备工作"
  1111. />
  1112. </View>
  1113. </View>
  1114. )}
  1115. {/* 预计效果 */}
  1116. {[1, 5, 6].indexOf(dtails.type) > -1 && (
  1117. <View className="formName">
  1118. <Text>
  1119. <Text style={{ color: "red" }}>*</Text>
  1120. 预计效果:</Text>
  1121. <View
  1122. className="formValue"
  1123. style={{ paddingTop: "10px", textAlign: "left" }}
  1124. >
  1125. <AtTextarea
  1126. height={46}
  1127. value={this.state.expectedEffect}
  1128. onChange={(v) => {
  1129. this.setState({
  1130. expectedEffect: v,
  1131. });
  1132. }}
  1133. maxLength={200}
  1134. placeholder="预计本次公出效果"
  1135. />
  1136. </View>
  1137. </View>
  1138. )}
  1139. </View>
  1140. <View className="formItem" style={{ display: "block" }}>
  1141. <View className="formName">
  1142. {this.state.totalDuration > info.workTimeInfor.minHours && <Text style={{ color: "red" }}>*</Text>}
  1143. 附件:
  1144. </View>
  1145. {this.state.totalDuration > info.workTimeInfor.minHours &&
  1146. <View className="tips">
  1147. 请上传公出事由的凭证截图,如您与企业的对话截图等
  1148. </View>}
  1149. <View
  1150. className="formValue"
  1151. style={{ paddingTop: "10px", textAlign: "left" }}
  1152. >
  1153. {dtails.annexUrl && this.props.isOpened ? (
  1154. <ImagePicker
  1155. files={dtails.annexUrl}
  1156. showAddBtn={true}
  1157. ref={(ref) => (this.imagePickerRef = ref)}
  1158. url="/api/admin/release/upload"
  1159. onChange={this.onChange}
  1160. />
  1161. ) : null}
  1162. </View>
  1163. </View>
  1164. {/* again为再次公出按钮显示 */}
  1165. {
  1166. again
  1167. ? <View className="operation">
  1168. <AtButton
  1169. disabled={this.state.loading}
  1170. type="secondary"
  1171. circle
  1172. onClick={() => {
  1173. this.props.onClose();
  1174. }}
  1175. >
  1176. 取消
  1177. </AtButton>
  1178. <AtButton
  1179. type="primary"
  1180. loading={this.state.loading}
  1181. circle
  1182. onClick={() => {
  1183. dtails.type == 1
  1184. ? this.checkOrderNoDuration(2)
  1185. : this.setState({
  1186. isInquiryOpened: true,
  1187. inquiryTitle: "提醒",
  1188. inquiryContent: "您确定要提交此申请吗?",
  1189. inquiryFn: () => {
  1190. this.goAgain();
  1191. },
  1192. });
  1193. }}
  1194. >
  1195. 确定
  1196. </AtButton>
  1197. </View>
  1198. : <View className="operation">
  1199. {/* <AtButton
  1200. disabled={this.state.loading}
  1201. type="primary"
  1202. circle
  1203. onClick={() => {
  1204. this.props.onBack();
  1205. }}
  1206. >
  1207. 上一步
  1208. </AtButton> */}
  1209. <AtButton
  1210. disabled={this.state.loading}
  1211. type="secondary"
  1212. circle
  1213. onClick={() => {
  1214. this.props.onClose();
  1215. }}
  1216. >
  1217. 取消
  1218. </AtButton>
  1219. <AtButton
  1220. type="primary"
  1221. loading={this.state.loading}
  1222. circle
  1223. onClick={() => {
  1224. if (!this.props.dtails.uids) {
  1225. Taro.showToast({ title: "请选择公出企业", icon: "none" });
  1226. return;
  1227. }
  1228. if (!this.state.rangeStartMinuteVal) {
  1229. Taro.showToast({ title: "请选择公出时间", icon: "none" });
  1230. return;
  1231. }
  1232. if (!this.state.rangeEndMinuteVal) {
  1233. Taro.showToast({ title: "请选择公出时间", icon: "none" });
  1234. return;
  1235. }
  1236. if ([5, 6].indexOf(this.props.dtails.type) === -1 && !(this.props.locationInfor.longitude && this.props.locationInfor.latitude)) {
  1237. Taro.showToast({ title: "请选择公出地点", icon: "none" });
  1238. return;
  1239. }
  1240. if ([5, 6].indexOf(this.props.dtails.type) > -1 && !this.state.cList.length) {
  1241. Taro.showToast({ title: "请选择协单人", icon: "none" });
  1242. return;
  1243. }
  1244. if (([5, 6].indexOf(this.props.dtails.type) > -1 || (this.props.dtails.type == 0 && this.state.cList.length)) && !this.state.assistType) {
  1245. Taro.showToast({ title: "请选择协单类型", icon: "none" });
  1246. return;
  1247. }
  1248. if (([5, 6].indexOf(this.props.dtails.type) > -1 || (this.props.dtails.type == 0 && this.state.cList.length)) && !this.state.assistContentType) {
  1249. Taro.showToast({ title: "请选择协单内容", icon: "none" });
  1250. return;
  1251. }
  1252. if (!this.state.reason && this.props.dtails.type != 0) {
  1253. Taro.showToast({ title: "请输入公出目标", icon: "none" });
  1254. return;
  1255. }
  1256. if (!this.state.plan && [1, 5, 6].indexOf(this.props.dtails.type) > -1) {
  1257. Taro.showToast({ title: "请输入公出计划", icon: "none" });
  1258. return;
  1259. }
  1260. if (!this.state.expectedEffect && [1, 5, 6].indexOf(this.props.dtails.type) > -1) {
  1261. Taro.showToast({ title: "请输入预计效果", icon: "none" });
  1262. return;
  1263. }
  1264. if ([5, 6].indexOf(this.props.dtails.type) === -1 && this.state.totalDuration === 0) {
  1265. Taro.showToast({
  1266. title: "请选择公出时间,目前设置公出时间不足0.5小时",
  1267. icon: "none",
  1268. });
  1269. return;
  1270. }
  1271. let info = Taro.getStorageSync("userInfor");
  1272. if ([5, 6].indexOf(this.props.dtails.type) === -1 && this.state.totalDuration > info.workTimeInfor.minHours && this.state.imgs.length == 0) {
  1273. Taro.showToast({ title: "请上传附件", icon: "none" });
  1274. return
  1275. }
  1276. dtails.type == 1
  1277. ? this.checkOrderNoDuration(1)
  1278. : dtails.type == 0
  1279. ? this.getRestrictProjectUser()
  1280. : this.setState({
  1281. isInquiryOpened: true,
  1282. inquiryTitle: "提醒",
  1283. inquiryContent: "您确定要修改此申请吗?",
  1284. inquiryFn: () => {
  1285. this.onSubmit();
  1286. },
  1287. });
  1288. }}
  1289. >
  1290. 确定修改
  1291. </AtButton>
  1292. </View>
  1293. }
  1294. <InquiryModal
  1295. isOpened={this.state.isInquiryOpened}
  1296. title={this.state.inquiryTitle}
  1297. content={this.state.inquiryContent}
  1298. onClose={() => {
  1299. this.setState({
  1300. isInquiryOpened: false,
  1301. inquiryTitle: "",
  1302. inquiryContent: "",
  1303. });
  1304. }}
  1305. onDetermine={() => {
  1306. this.state.inquiryFn();
  1307. this.setState({
  1308. isInquiryOpened: false,
  1309. inquiryTitle: "",
  1310. inquiryContent: "",
  1311. inquiryFn: () => { },
  1312. });
  1313. }}
  1314. />
  1315. {popup &&
  1316. <UserQuery
  1317. isOpened={popup}
  1318. onDesc={this.popupClick.bind(this)}
  1319. cList={cList}
  1320. selList={dtails.assistantAid ? dtails.assistantAid.split(",") : []}
  1321. coorderList={coorderList}
  1322. setList={this.setList.bind(this)}
  1323. />
  1324. }
  1325. {/* 再次公出申请成功 */}
  1326. {
  1327. this.state.isAgains &&
  1328. <InquiryModal
  1329. isOpened={this.state.isAgains}
  1330. isNo={false}
  1331. isChildren={true}
  1332. onDetermine={() => {
  1333. this.props.onClose();
  1334. this.setState({
  1335. isAgains: false,
  1336. goId: "",
  1337. goDatas: {},
  1338. })
  1339. }}
  1340. onClose={() => {
  1341. this.props.onClose();
  1342. this.setState({
  1343. isAgains: false,
  1344. goId: "",
  1345. goDatas: {},
  1346. })
  1347. }}
  1348. >
  1349. <View className='result'>
  1350. <View className='resultIcon'>
  1351. {
  1352. <Icon size='80' type='success' />
  1353. // isShow
  1354. // ? <Icon size='80' type='warn' color='#ff9900' />
  1355. // : <Icon size='80' type='success' />
  1356. }
  1357. </View>
  1358. <View className='resultTitle'>
  1359. <View>申请成功
  1360. {/* {!isShow && ",可以打卡了!"} */}
  1361. </View>
  1362. <View className='resultError'></View>
  1363. </View>
  1364. {/* {
  1365. isShow && dtails.type != 1 &&
  1366. <View className="resultTips">公出他人企业,需跟单人员“
  1367. {tipList.toString()}
  1368. ”审核同意,才可以打卡!!!</View>
  1369. } */}
  1370. {
  1371. // isShow && dtails.type == 1 &&
  1372. <View className="resultTips">
  1373. 已发出公出申请!待审核通过,方可打卡!</View>
  1374. }
  1375. <View className='resultOperation'>
  1376. {/* {
  1377. (!isShow || dtails.type == 1) &&
  1378. <AtButton circle type='primary' onClick={() => {
  1379. this.props.onClose();
  1380. Taro.eventCenter.trigger("GoPunchIn", this.state.goDatas);
  1381. Taro.switchTab({
  1382. url: '/pages/punchClock/index',
  1383. })
  1384. }}>
  1385. 前往打卡
  1386. </AtButton>
  1387. } */}
  1388. <AtButton type='secondary' circle onClick={() => {
  1389. this.props.onClose();
  1390. this.state.goId &&
  1391. Taro.navigateTo({
  1392. url: '/pages/egressDetails/index?id=' + this.state.goId
  1393. })
  1394. }}>
  1395. 前往分享
  1396. </AtButton>
  1397. </View>
  1398. </View>
  1399. </InquiryModal>
  1400. }
  1401. {/* 多选框 */}
  1402. <CheckboxPicker
  1403. isOpened={this.state.multiplePickerShow}
  1404. title={this.state.multiplePickerTitle}
  1405. options={this.state.multiplePickerOptions}
  1406. checkedList={this.state.multiplePickerCheckedList}
  1407. onClose={() => { this.setState({ multiplePickerShow: false, multiplePickerCheckedList: [] }) }}
  1408. onConfirm={this.handleMultipleConfirm}
  1409. ></CheckboxPicker>
  1410. </View>
  1411. );
  1412. }
  1413. }
  1414. export default PublicContent;