index.jsx 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. import React, { Component } from "react";
  2. import { View, Image, Button, Input, Textarea } from "@tarojs/components";
  3. import Taro, { getCurrentInstance } from "@tarojs/taro";
  4. import {
  5. AtButton,
  6. AtCalendar,
  7. AtIcon,
  8. AtTextarea,
  9. AtModal,
  10. AtModalContent,
  11. AtModalAction,
  12. } from "taro-ui";
  13. import Skeleton from "taro-skeleton";
  14. import InquiryModal from "../../components/common/inquiryModal";
  15. import {
  16. projectAdd,
  17. } from "../../utils/servers/servers";
  18. import { resourceAddress } from "../../utils/config";
  19. import "./index.less";
  20. import "taro-ui/dist/style/components/icon.scss";
  21. import "taro-ui/dist/style/components/textarea.scss";
  22. import "taro-ui/dist/style/components/modal.scss";
  23. import "taro-ui/dist/style/components/timeline.scss";
  24. import "taro-ui/dist/style/components/icon.scss";
  25. import "taro-ui/dist/style/components/calendar.scss";
  26. import { getClockState, unique } from "../../utils/tools";
  27. class ProjectAdd extends Component {
  28. $instance = getCurrentInstance();
  29. constructor(props) {
  30. super(props);
  31. this.state = {
  32. };
  33. }
  34. componentDidMount() {
  35. }
  36. componentDidShow() {
  37. }
  38. // 新增
  39. Add(sta) {
  40. if (!this.state.opinion) {
  41. Taro.showToast({ title: "请填写审批意见", icon: "none" });
  42. return;
  43. }
  44. projectAdd({
  45. name: "",
  46. adminName:"",
  47. })
  48. .then((v) => {
  49. if (v.error.length === 0) {
  50. //如果在审核期间修改过
  51. if (
  52. v.data.updateTime != null &&
  53. this.state.dtails.updateTime !== v.data.updateTime
  54. ) {
  55. this.setState({
  56. isInquiryOpened: true,
  57. isNo: false,
  58. inquiryTitle: "提醒",
  59. inquiryContent: "当前公出申请已修改,请重新审核",
  60. });
  61. } else {
  62. sta === 2
  63. ? this.examinePublicRelease(2)
  64. : this.examinePublicRelease(0);
  65. }
  66. if (v.data) {
  67. let list = [];
  68. for (let i of v.data.annexUrl.split(",")) {
  69. if (i) {
  70. list.push({ url: resourceAddress + i });
  71. }
  72. }
  73. v.data.annexUrl = list;
  74. this.setState({
  75. dtails: v.data,
  76. selectArrderLocation: {
  77. longitude: parseFloat(v.data.prdList[0]?.longitude),
  78. latitude: parseFloat(v.data.prdList[0]?.latitude),
  79. name: v.data.prdList[0]?.districtName,
  80. },
  81. });
  82. } else {
  83. setTimeout(() => {
  84. Taro.switchTab({
  85. url: "/pages/punchClock/index",
  86. });
  87. }, 1800);
  88. Taro.showToast({
  89. title: "您没有权限查看此公出详情",
  90. icon: "none",
  91. duration: 1800,
  92. });
  93. }
  94. } else {
  95. Taro.showToast({ title: v.error[0].message, icon: "none" });
  96. }
  97. })
  98. .catch((err) => {
  99. Taro.showToast({ title: "系统错误,请稍后再试", icon: "none" });
  100. // console.log(err);
  101. });
  102. }
  103. render() {
  104. const { } = this.state;
  105. return (
  106. <View className="add">
  107. <View className="count">
  108. <View className="inputItem">
  109. <View className="title">项目名称</View>
  110. <Input />
  111. </View>
  112. <View className="inputItem">
  113. <View className="title">项目负责人</View>
  114. </View>
  115. <View className="inputItem">
  116. <View className="title">研发人员</View>
  117. </View>
  118. <View className="inputItem">
  119. <View className="title">项目说明</View>
  120. <Textarea />
  121. </View>
  122. </View>
  123. </View>
  124. );
  125. }
  126. }
  127. export default ProjectAdd;