examineApprove.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <!-- 提交审批 -->
  3. <view class="assign-container">
  4. <u-popup :show="popShow" @close="close">
  5. <view class="select-container">
  6. <view class="title">
  7. <view class="btn-box">
  8. <text class="btn cancel" @tap="close">取消</text>
  9. <text class="btn confirm" @tap="submit">确定</text>
  10. </view>
  11. </view>
  12. <view class="select-wrapper">
  13. <view class="col deptInp">
  14. <text class="label">部门:</text>
  15. <input
  16. type="text"
  17. disabled
  18. :value="formData.deptVal"
  19. @tap="openPicker"
  20. placeholder="请选择"
  21. />
  22. </view>
  23. <view class="col userInp">
  24. <text class="label">审批人:</text>
  25. <uni-data-select
  26. :localdata="userList"
  27. @change="handleUserChange"
  28. v-model="formData.executorId"
  29. />
  30. </view>
  31. </view>
  32. </view>
  33. </u-popup>
  34. <ba-tree-picker
  35. ref="treePicker"
  36. :multiple="false"
  37. @select-change="confirm"
  38. title="选择部门"
  39. :localdata="listData"
  40. valueKey="code"
  41. textKey="name"
  42. childrenKey="children"
  43. />
  44. </view>
  45. </template>
  46. <script>
  47. import { post, get, postJ } from '@/utils/api.js'
  48. import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
  49. export default {
  50. components: {
  51. baTreePicker
  52. },
  53. data () {
  54. return {
  55. popShow: false,
  56. deptPickerShow: false,
  57. listData: [],
  58. userList: [],
  59. formData: {
  60. deptVal: '',
  61. executorName: '',
  62. executorId: ''
  63. }
  64. }
  65. },
  66. created () {
  67. this.getDept()
  68. },
  69. methods: {
  70. //工单id
  71. open (id) {
  72. this.popShow = true
  73. },
  74. openPicker () {
  75. this.$refs.treePicker._show()
  76. // this.deptPickerShow = true
  77. // console.log(1111);
  78. },
  79. handleUserChange (id) {
  80. console.log(id)
  81. const obj = this.userList.find(n => {
  82. return n.userId == id
  83. })
  84. this.formData.executorName = obj.trueName || ''
  85. },
  86. close () {
  87. this.formData = {
  88. deptVal: '',
  89. executorName: '',
  90. executorId: '',
  91. reassignExplain: ''
  92. }
  93. this.userList = []
  94. this.popShow = false
  95. },
  96. submit () {
  97. if (!this.formData.executorId) {
  98. this.$emit('submit', null)
  99. this.close()
  100. return
  101. }
  102. let currentUser = this.userList.find(n => {
  103. return n.userId == this.formData.executorId
  104. })
  105. this.$emit('submit', currentUser)
  106. this.close()
  107. },
  108. confirm (data, name) {
  109. this.formData.deptVal = name
  110. this.formData.executorName = ''
  111. this.formData.executorId = ''
  112. this.getUser(data[0])
  113. },
  114. getDept () {
  115. get(this.apiUrl + '/main/org/dept/effectiveTree').then(res => {
  116. if (res?.success) {
  117. this.listData = res.data
  118. }
  119. })
  120. },
  121. getUser (deptCode) {
  122. post(this.apiUrl + '/main/user/list', {
  123. deptCode,
  124. page: 1,
  125. size: 9999
  126. }).then(res => {
  127. if (res?.success) {
  128. this.userList = res.data.items.map(item => {
  129. item.text = item.trueName
  130. item.value = item.userId
  131. return item
  132. })
  133. }
  134. })
  135. }
  136. }
  137. }
  138. </script>
  139. <style lang="scss" scoped>
  140. .select-container {
  141. min-height: 60vh;
  142. .title {
  143. height: 70rpx;
  144. line-height: 70rpx;
  145. text-align: center;
  146. background-color: $j-primary-border-green;
  147. font-weight: bold;
  148. position: relative;
  149. font-size: 28rpx;
  150. color: #fff;
  151. .btn-box {
  152. position: absolute;
  153. top: 50%;
  154. right: 10rpx;
  155. transform: translateY(-50%);
  156. }
  157. .btn {
  158. width: 60rpx;
  159. height: 32rpx;
  160. display: inline-block;
  161. font-size: 28rpx;
  162. border: 1px solid #fff;
  163. text-align: center;
  164. line-height: 30rpx;
  165. }
  166. }
  167. .select-wrapper {
  168. .col {
  169. display: flex;
  170. // min-height: 0rpx;
  171. margin-top: 22rpx;
  172. align-items: center;
  173. padding-right: 14rpx;
  174. .label {
  175. display: inline-block;
  176. width: 200rpx;
  177. text-align: right;
  178. }
  179. input {
  180. flex: 1;
  181. border: 1rpx solid #e5e5e5;
  182. height: 66rpx;
  183. border-radius: 8rpx;
  184. font-size: 28rpx;
  185. padding: 8rpx 16rpx;
  186. box-sizing: border-box;
  187. color: #6a6a6a;
  188. }
  189. textarea {
  190. border: 1rpx solid #e5e5e5;
  191. flex: 1;
  192. height: 100rpx;
  193. }
  194. }
  195. }
  196. }
  197. </style>