unfinishedApplication.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <template>
  2. <view class="assign-container">
  3. <u-popup :show="popShow" @close="close">
  4. <view class="select-container">
  5. <view class="title">
  6. <text class="btn cancel" @tap="close">取消</text>
  7. 非完成报工
  8. <text class="btn confirm" @tap="submit">确定</text>
  9. </view>
  10. <view class="select-wrapper">
  11. <view class="col deptInp">
  12. <text class="label">部门:</text>
  13. <text class="input_text"
  14. @click="openPicker">{{ formData.executorDeptName ? formData.executorDeptName : '请选择' }}</text>
  15. </view>
  16. <view class="col userInp">
  17. <text class="label">接收人:</text>
  18. <zxz-uni-data-select :localdata="userList" v-model="formData.executorId"
  19. @change="handleUserChange"></zxz-uni-data-select>
  20. </view>
  21. <view class="col">
  22. <view class="label">处理说明:</view>
  23. <textarea class="textarea" v-model="formData.repairReportExplain"></textarea>
  24. </view>
  25. <view class="col">
  26. <view class="label">附件:</view>
  27. <fileMain v-model="formData.attachments"></fileMain>
  28. </view>
  29. </view>
  30. </view>
  31. </u-popup>
  32. <ba-tree-picker ref="treePicker" :multiple="false" @select-change="confirm" title="选择部门" :localdata="listData"
  33. valueKey="id" textKey="name" childrenKey="children" />
  34. </view>
  35. </template>
  36. <script>
  37. import {
  38. listOrganizations,
  39. getUserPage,
  40. workOrderRotate
  41. } from '@/api/myTicket/index.js'
  42. import {
  43. post,
  44. get,
  45. postJ
  46. } from '@/utils/api.js'
  47. import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
  48. import fileMain from "@/pages/doc/index.vue"
  49. import {
  50. loseReport
  51. } from '@/api/repair'
  52. export default {
  53. components: {
  54. baTreePicker,
  55. fileMain
  56. },
  57. props: {
  58. },
  59. data() {
  60. return {
  61. popShow: false,
  62. deptPickerShow: false,
  63. listData: [],
  64. userList: [],
  65. formData: {
  66. executorDeptName: '',
  67. executorName: '',
  68. executorId: '',
  69. repairReportExplain: '',
  70. attachments: []
  71. },
  72. selectList: [],
  73. newArr: [],
  74. sid: ''
  75. }
  76. },
  77. created() {
  78. this.getDept()
  79. },
  80. methods: {
  81. open(id) {
  82. this.sid = id;
  83. console.log(id)
  84. this.popShow = true
  85. },
  86. openPicker() {
  87. this.$refs.treePicker._show()
  88. },
  89. deWeight(arr4) {
  90. var obj = {}
  91. arr4 = arr4.reduce(function(a, b) {
  92. obj[b.userId] ? '' : (obj[b.userId] = true && a.push(b))
  93. return a
  94. }, [])
  95. return arr4
  96. },
  97. handleUserChange(obj) {
  98. this.formData.executorName = obj.text
  99. // const obj = this.userList.find(i => i.value === id)
  100. // this.formData.executorName = (obj && obj.text) || ''
  101. },
  102. close() {
  103. this.formData = {
  104. executorDeptName: '',
  105. executorName: '',
  106. executorId: '',
  107. repairReportExplain: '',
  108. attachments: []
  109. }
  110. this.popShow = false
  111. },
  112. submit() {
  113. if (!this.formData.executorId) {
  114. uni.showToast({
  115. icon: 'error',
  116. title: '请选择接收人'
  117. })
  118. return
  119. }
  120. let params = {
  121. workOrderId: this.sid,
  122. acceptUserId: this.formData.executorId,
  123. reason: this.formData.repairReportExplain,
  124. attachments: this.formData.attachments,
  125. }
  126. loseReport(params).then(() => {
  127. uni.showToast({
  128. title: '非报工成功',
  129. icon: 'success',
  130. duration: 2000
  131. })
  132. this.popShow = false;
  133. })
  134. },
  135. confirm(data, name) {
  136. console.log(data)
  137. console.log(name)
  138. this.formData.executorDeptName = name
  139. this.formData.executorDeptCode = data[0]
  140. this.formData.executorName = ''
  141. this.formData.executorId = ''
  142. this.getUser(data[0])
  143. },
  144. getDept() {
  145. listOrganizations(1).then(data => {
  146. console.log('listOrganizations-----------------------')
  147. console.log(data)
  148. this.listData = data
  149. })
  150. },
  151. getUser(deptCode) {
  152. getUserPage({
  153. pageNum: 1,
  154. size: -1,
  155. groupId: deptCode
  156. }).then(data => {
  157. this.userList = data.list.map(item => {
  158. item.text = item.name
  159. item.value = item.id
  160. return item
  161. })
  162. })
  163. }
  164. }
  165. }
  166. </script>
  167. <style lang="scss" scoped>
  168. .select-container {
  169. min-height: 60vh;
  170. .title {
  171. display: flex;
  172. justify-content: space-between;
  173. align-items: center;
  174. height: 100rpx;
  175. line-height: 100rpx;
  176. text-align: center;
  177. background-color: $j-primary-border-green;
  178. font-weight: bold;
  179. padding: 0 20rpx;
  180. position: relative;
  181. font-size: 32rpx;
  182. color: #fff;
  183. .btn {
  184. width: 80rpx;
  185. height: 32rpx;
  186. display: inline-block;
  187. font-size: 32rpx;
  188. border: 1px solid #fff;
  189. text-align: center;
  190. line-height: 30rpx;
  191. margin: 0;
  192. }
  193. }
  194. .select-wrapper {
  195. .col {
  196. display: flex;
  197. // min-height: 0rpx;
  198. margin-top: 22rpx;
  199. align-items: center;
  200. padding-right: 14rpx;
  201. .label {
  202. display: inline-block;
  203. width: 200rpx;
  204. text-align: right;
  205. }
  206. .input_text {
  207. flex: 1;
  208. height: 66rpx;
  209. line-height: 66rpx;
  210. padding: 0rpx 16rpx;
  211. box-sizing: border-box;
  212. font-size: 28rpx;
  213. border: 1px solid #eceeec;
  214. border-radius: 8rpx;
  215. }
  216. input {
  217. flex: 1;
  218. border: 1rpx solid #e5e5e5;
  219. height: 66rpx;
  220. border-radius: 8rpx;
  221. font-size: 28rpx;
  222. padding: 0rpx 16rpx;
  223. color: #6a6a6a;
  224. }
  225. textarea {
  226. border: 1rpx solid #e5e5e5;
  227. flex: 1;
  228. height: 100rpx;
  229. }
  230. .tab_box {
  231. display: flex;
  232. flex-direction: row;
  233. flex-wrap: wrap;
  234. width: 520rpx;
  235. .tab {
  236. display: flex;
  237. flex-direction: row;
  238. border: 2rpx solid #d9ecff;
  239. background-color: #f4f4f5;
  240. border-color: #e9e9eb;
  241. color: #909399;
  242. margin-left: 8rpx;
  243. margin-bottom: 8rpx;
  244. padding: 2rpx 8rpx;
  245. font-size: 28rpx;
  246. }
  247. .icon {
  248. margin-left: 6rpx;
  249. }
  250. }
  251. }
  252. }
  253. }
  254. </style>