unfinishedApplication.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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. data() {
  59. return {
  60. popShow: false,
  61. deptPickerShow: false,
  62. listData: [],
  63. userList: [],
  64. formData: {
  65. executorDeptName: '',
  66. executorName: '',
  67. executorId: '',
  68. repairReportExplain: '',
  69. attachments: []
  70. },
  71. selectList: [],
  72. newArr: [],
  73. sid: ''
  74. }
  75. },
  76. created() {
  77. this.getDept()
  78. },
  79. methods: {
  80. open(id) {
  81. this.sid = id;
  82. console.log(id)
  83. this.popShow = true
  84. },
  85. openPicker() {
  86. this.$refs.treePicker._show()
  87. },
  88. deWeight(arr4) {
  89. var obj = {}
  90. arr4 = arr4.reduce(function(a, b) {
  91. obj[b.userId] ? '' : (obj[b.userId] = true && a.push(b))
  92. return a
  93. }, [])
  94. return arr4
  95. },
  96. handleUserChange(obj) {
  97. this.formData.executorName = obj.text
  98. // const obj = this.userList.find(i => i.value === id)
  99. // this.formData.executorName = (obj && obj.text) || ''
  100. },
  101. close() {
  102. this.formData = {
  103. executorDeptName: '',
  104. executorName: '',
  105. executorId: '',
  106. repairReportExplain: '',
  107. attachments: []
  108. }
  109. this.popShow = false
  110. },
  111. submit() {
  112. if (!this.formData.executorId) {
  113. uni.showToast({
  114. icon: 'error',
  115. title: '请选择接收人'
  116. })
  117. return
  118. }
  119. let params = {
  120. workOrderId: this.sid,
  121. acceptUserId: this.formData.executorId,
  122. reason: this.formData.repairReportExplain,
  123. attachments: this.formData.attachments,
  124. }
  125. loseReport(params).then(() => {
  126. uni.showToast({
  127. title: '非报工成功',
  128. icon: 'success',
  129. duration: 2000
  130. })
  131. this.popShow = false;
  132. })
  133. },
  134. confirm(data, name) {
  135. console.log(data)
  136. console.log(name)
  137. this.formData.executorDeptName = name
  138. this.formData.executorDeptCode = data[0]
  139. this.formData.executorName = ''
  140. this.formData.executorId = ''
  141. this.getUser(data[0])
  142. },
  143. getDept() {
  144. listOrganizations(1).then(data => {
  145. console.log('listOrganizations-----------------------')
  146. console.log(data)
  147. this.listData = data
  148. })
  149. },
  150. getUser(deptCode) {
  151. getUserPage({
  152. pageNum: 1,
  153. size: -1,
  154. groupId: deptCode
  155. }).then(data => {
  156. this.userList = data.list.map(item => {
  157. item.text = item.name
  158. item.value = item.id
  159. return item
  160. })
  161. })
  162. }
  163. }
  164. }
  165. </script>
  166. <style lang="scss" scoped>
  167. .select-container {
  168. min-height: 60vh;
  169. .title {
  170. display: flex;
  171. justify-content: space-between;
  172. align-items: center;
  173. height: 100rpx;
  174. line-height: 100rpx;
  175. text-align: center;
  176. background-color: $j-primary-border-green;
  177. font-weight: bold;
  178. padding: 0 20rpx;
  179. position: relative;
  180. font-size: 32rpx;
  181. color: #fff;
  182. .btn {
  183. padding: 10rpx 20rpx;
  184. display: inline-block;
  185. font-size: 32rpx;
  186. border: 1px solid #fff;
  187. text-align: center;
  188. line-height: 30rpx;
  189. margin: 0;
  190. }
  191. }
  192. .select-wrapper {
  193. .col {
  194. display: flex;
  195. // min-height: 0rpx;
  196. margin-top: 22rpx;
  197. align-items: center;
  198. padding-right: 14rpx;
  199. .label {
  200. display: inline-block;
  201. width: 200rpx;
  202. text-align: right;
  203. }
  204. .input_text {
  205. flex: 1;
  206. height: 66rpx;
  207. line-height: 66rpx;
  208. padding: 0rpx 16rpx;
  209. box-sizing: border-box;
  210. font-size: 28rpx;
  211. border: 1px solid #eceeec;
  212. border-radius: 8rpx;
  213. }
  214. input {
  215. flex: 1;
  216. border: 1rpx solid #e5e5e5;
  217. height: 66rpx;
  218. border-radius: 8rpx;
  219. font-size: 28rpx;
  220. padding: 0rpx 16rpx;
  221. color: #6a6a6a;
  222. }
  223. textarea {
  224. border: 1rpx solid #e5e5e5;
  225. flex: 1;
  226. height: 100rpx;
  227. }
  228. .tab_box {
  229. display: flex;
  230. flex-direction: row;
  231. flex-wrap: wrap;
  232. width: 520rpx;
  233. .tab {
  234. display: flex;
  235. flex-direction: row;
  236. border: 2rpx solid #d9ecff;
  237. background-color: #f4f4f5;
  238. border-color: #e9e9eb;
  239. color: #909399;
  240. margin-left: 8rpx;
  241. margin-bottom: 8rpx;
  242. padding: 2rpx 8rpx;
  243. font-size: 28rpx;
  244. }
  245. .icon {
  246. margin-left: 6rpx;
  247. }
  248. }
  249. }
  250. }
  251. }
  252. </style>