details.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <view style="padding: 20px;">
  3. <u--form labelPosition="left" :model="taskInfo" ref="form1" labelWidth="80">
  4. <u-form-item label="编号" prop="taskInfo.taskNo" borderBottom ref="taskInfo">
  5. <u-text size="18" :text="taskInfo.taskNo"></u-text>
  6. </u-form-item>
  7. <u-form-item label="标题" prop="taskInfo.taskTitle" borderBottom ref="taskInfo">
  8. <u-text size="18" :text="taskInfo.taskTitle"></u-text>
  9. </u-form-item>
  10. <u-form-item label="地点" prop="taskInfo.taskAddress" borderBottom ref="taskInfo">
  11. <u-text size="18" :text="taskInfo.taskAddress"></u-text>
  12. </u-form-item>
  13. <u-form-item label="开始" prop="taskInfo.planStartTime" borderBottom ref="taskInfo">
  14. <u-text size="18" :text="taskInfo.planStartTime"></u-text>
  15. </u-form-item>
  16. <u-form-item label="结束" prop="taskInfo.planEndTime" borderBottom ref="taskInfo">
  17. <u-text size="18" :text="taskInfo.planEndTime"></u-text>
  18. </u-form-item>
  19. <u-form-item label="主负责人" prop="taskInfo.belongMain" borderBottom ref="taskInfo">
  20. <u-tag type="success" :text="taskInfo.belongMain"></u-tag>
  21. </u-form-item>
  22. <u-form-item label="二级负责人" prop="taskInfo.remark" borderBottom ref="taskInfo">
  23. <view>
  24. <view class="belongs minor" v-for="(item,index) in taskInfo.belongMinors">
  25. {{item}}
  26. </view>
  27. </view>
  28. </u-form-item>
  29. <u-form-item label="执行人" prop="taskInfo.executors" borderBottom ref="taskInfo">
  30. <view>
  31. <view class="belongs executor" v-for="(item,index) in taskInfo.executors">
  32. {{item}}
  33. </view>
  34. </view>
  35. </u-form-item>
  36. <u-form-item label="说明" prop="taskInfo.remark" borderBottom ref="taskInfo">
  37. <u-text size="18" :text="taskInfo.remark"></u-text>
  38. </u-form-item>
  39. </u--form>
  40. <view class="btnBody" v-if="taskInfo.isOrder == 0">
  41. <view class="btn">
  42. <u-button v-if="taskInfo.isOrder === 0" type="success" text="接单" @click="btnOrder(1)"></u-button>
  43. </view>
  44. </view>
  45. <view class="btnBody" v-if="taskInfo.isOrder == 1">
  46. <view class="btn">
  47. <u-button v-if="taskInfo.userTaskStatus === 0" type="success" text="开始" @click="btnStatus(5)">
  48. </u-button>
  49. <u-button v-if="taskInfo.userTaskStatus === 5" type="primary" disabled text="进行中"></u-button>
  50. <u-button v-if="taskInfo.userTaskStatus === 2" type="success" disabled text="已结束"></u-button>
  51. <u-button v-if="taskInfo.userTaskStatus === 3" type="warning" disabled text="已挂起"></u-button>
  52. </view>
  53. <view class="btn">
  54. <u-button v-if="taskInfo.userTaskStatus == 5||taskInfo.userTaskStatus == 3" type="error" text="结束"
  55. @click="btnStatus(2)"></u-button>
  56. </view>
  57. <view class="btn">
  58. <u-button v-if="taskInfo.userTaskStatus === 5" type="warning" text="挂起" @click="btnStatus(3)">
  59. </u-button>
  60. <u-button v-if="taskInfo.userTaskStatus === 3" type="primary" text="取消挂起" @click="btnStatus(5)">
  61. </u-button>
  62. </view>
  63. <view class="btn">
  64. <u-button v-if="taskInfo.isOrder === 1" type="primary" text="退单" @click="btnOrder(0)"></u-button>
  65. </view>
  66. </view>
  67. </view>
  68. </template>
  69. <script>
  70. export default {
  71. data() {
  72. return {
  73. taskInfo: {}
  74. }
  75. },
  76. onLoad() {
  77. this.doReadGetInfo()
  78. },
  79. methods: {
  80. async doReadGetInfo() {
  81. const {
  82. data: res
  83. } = await this.$httpRequest({
  84. url: '/api/yq/clickTaskRead/?taskId=' + uni.getStorageSync("taskId") +
  85. '&userNo=' + uni.getStorageSync("setUserName"),
  86. method: 'get',
  87. })
  88. if (res.code == 200) {
  89. this.taskInfo = res.data
  90. } else {
  91. }
  92. },
  93. async clockIn(type) {
  94. const data = {
  95. userNo: uni.getStorageSync("setUserName"),
  96. taskId: uni.getStorageSync("taskId"),
  97. clockInType: type
  98. }
  99. const {
  100. data: res
  101. } = await this.$httpRequest({
  102. url: '/apiapi/ci/clockIn',
  103. method: 'post',
  104. data: data
  105. })
  106. if (res.code == 200) {
  107. uni.showToast({
  108. icon: "success"
  109. })
  110. } else {
  111. uni.showToast({
  112. icon: "none",
  113. title: res.msg
  114. })
  115. }
  116. },
  117. btnStatus(type) {
  118. const that = this
  119. if (type === 5) {
  120. that.updateStatus(type)
  121. } else if (type === 2) {
  122. uni.showModal({
  123. title: '提示',
  124. content: "确定结束当前任务吗?",
  125. success: function(res) {
  126. if (res.confirm) {
  127. that.updateStatus(type)
  128. } else if (res.cancel) {}
  129. }
  130. })
  131. } else if (type === 3) {
  132. uni.showModal({
  133. title: '提示',
  134. content: "确定挂起当前任务吗?",
  135. success: function(res) {
  136. if (res.confirm) {
  137. that.updateStatus(type)
  138. } else if (res.cancel) {}
  139. }
  140. })
  141. }
  142. },
  143. btnOrder(type) {
  144. var text = ''
  145. if (1 === type) {
  146. text = '确定接单吗?'
  147. } else {
  148. text = '确定退单并重置当前状态吗?'
  149. }
  150. const that = this
  151. uni.showModal({
  152. title: '提示',
  153. content: text,
  154. success: function(res) {
  155. if (res.confirm) {
  156. that.updateOrder(type)
  157. } else if (res.cancel) {}
  158. }
  159. })
  160. },
  161. async updateStatus(type) {
  162. const {
  163. data: res
  164. } = await this.$httpRequest({
  165. url: '/api/yq/uuStatus/?taskId=' + uni.getStorageSync("taskId") +
  166. '&userNo=' + uni.getStorageSync("setUserName") + "&status=" + type,
  167. method: 'get',
  168. })
  169. if (res.code == 200) {
  170. uni.showToast({
  171. icon: "success"
  172. })
  173. this.taskInfo.userTaskStatus = type
  174. } else {
  175. uni.showToast({
  176. icon: "none",
  177. title: res.msg
  178. })
  179. }
  180. },
  181. async updateOrder(type) {
  182. const {
  183. data: res
  184. } = await this.$httpRequest({
  185. url: '/api/yq/uOrder/?taskId=' + uni.getStorageSync("taskId") +
  186. '&userNo=' + uni.getStorageSync("setUserName") + "&status=" + type,
  187. method: 'get',
  188. })
  189. if (res.code == 200) {
  190. uni.showToast({
  191. icon: "success"
  192. })
  193. this.taskInfo.isOrder = type
  194. this.taskInfo.userTaskStatus = 0
  195. } else {
  196. uni.showToast({
  197. icon: "none",
  198. title: res.msg
  199. })
  200. }
  201. }
  202. }
  203. }
  204. </script>
  205. <style>
  206. page {
  207. background-color: #f7f7f7;
  208. }
  209. .btnBody {
  210. margin: 20px 0;
  211. }
  212. .btnBody {
  213. margin: 20px 0;
  214. }
  215. .btn {
  216. margin: 15px 0;
  217. }
  218. .belongs {
  219. margin: 5px;
  220. padding: 2px 5px;
  221. color: #ffffff;
  222. display: inline-block;
  223. border-radius: 5px;
  224. }
  225. .minor {
  226. background-color: #55aaff;
  227. }
  228. .executor {
  229. background-color: #ffaa00;
  230. }
  231. </style>