| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- <template>
- <view class="assign-container">
- <u-popup :show="popShow" @close="close">
- <view class="select-container">
- <view class="title">
- <view class="btn-box">
- <text class="btn cancel" @tap="close">取消</text>
- <text class="btn confirm" @tap="submit">确定</text>
- </view>
- </view>
- <view class="select-wrapper">
- <view class="col deptInp">
- <text class="label">部门:</text>
- <input
- type="text"
- disabled
- :value="formData.deptVal"
- @tap="openPicker"
- placeholder="请选择"
- />
- </view>
- <view class="col userInp">
- <text class="label">接收人:</text>
- <uni-data-select
- :localdata="userList"
- @change="handleUserChange"
- v-model="formData.executorId"
- />
- </view>
- </view>
- </view>
- </u-popup>
- <ba-tree-picker
- ref="treePicker"
- :multiple="false"
- @select-change="confirm"
- title="选择部门"
- :localdata="listData"
- valueKey="code"
- textKey="name"
- childrenKey="children"
- />
- </view>
- </template>
- <script>
- import { post, get, postJ } from '@/utils/api.js'
- import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
- export default {
- components: {
- baTreePicker
- },
- data () {
- return {
- popShow: false,
- deptPickerShow: false,
- listData: [],
- userList: [],
- formData: {
- deptVal: '',
- executorName: '',
- executorId: ''
- }
- }
- },
- created () {
- this.getDept()
- },
- methods: {
- //工单id
- open (id) {
- this.popShow = true
- },
- openPicker () {
- this.$refs.treePicker._show()
- // this.deptPickerShow = true
- // console.log(1111);
- },
- handleUserChange (id) {
- console.log(id)
- const obj = this.userList.find(n => {
- return n.userId == id
- })
- this.formData.executorName = obj.trueName || ''
- },
- close () {
- this.formData = {
- deptVal: '',
- executorName: '',
- executorId: '',
- reassignExplain: ''
- }
- this.userList = []
- this.popShow = false
- },
- submit () {
- if (!this.formData.executorId) {
- uni.showToast({
- icon: 'error',
- title: '请选择接收人'
- })
- return
- }
- let currentUser = this.userList.find(n => {
- return n.userId == this.formData.executorId
- })
- this.$emit('submit', currentUser)
- },
- confirm (data, name) {
- this.formData.deptVal = name
- this.formData.executorName = ''
- this.formData.executorId = ''
- this.getUser(data[0])
- },
- getDept () {
- get(this.apiUrl + '/main/org/dept/effectiveTree').then(res => {
- if (res?.success) {
- this.listData = res.data
- }
- })
- },
- getUser (deptCode) {
- post(this.apiUrl + '/main/user/list', {
- deptCode,
- page: 1,
- size: 9999
- }).then(res => {
- if (res?.success) {
- this.userList = res.data.items.map(item => {
- item.text = item.trueName
- item.value = item.userId
- return item
- })
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .select-container {
- min-height: 60vh;
- .title {
- height: 70rpx;
- line-height: 70rpx;
- text-align: center;
- background-color: $j-primary-border-green;
- font-weight: bold;
- position: relative;
- font-size: 28rpx;
- color: #fff;
- .btn-box {
- position: absolute;
- top: 50%;
- right: 10rpx;
- transform: translateY(-50%);
- }
- .btn {
- width: 60rpx;
- height: 32rpx;
- display: inline-block;
- font-size: 28rpx;
- border: 1px solid #fff;
- text-align: center;
- line-height: 30rpx;
- }
- }
- .select-wrapper {
- .col {
- display: flex;
- // min-height: 0rpx;
- margin-top: 22rpx;
- align-items: center;
- padding-right: 14rpx;
- .label {
- display: inline-block;
- width: 200rpx;
- text-align: right;
- }
- input {
- flex: 1;
- border: 1rpx solid #e5e5e5;
- height: 66rpx;
- border-radius: 8rpx;
- font-size: 28rpx;
- padding: 8rpx 16rpx;
- box-sizing: border-box;
- color: #6a6a6a;
- }
- textarea {
- border: 1rpx solid #e5e5e5;
- flex: 1;
- height: 100rpx;
- }
- }
- }
- }
- </style>
|