examineApprove.vue 4.0 KB

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