123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <template>
- <view class="wrap">
- <uni-section :title="title" type="line">
- <uni-forms ref="form" :modelValue="formData" :rules="rules" :label-width="300" label-position="top">
- <uni-forms-item label="执行人" name="accountId" required>
- <uni-data-select v-model="accountId" :localdata="userList"></uni-data-select>
- </uni-forms-item>
- <uni-forms-item label="备注" name="remark">
- <uni-easyinput v-model="formData.taskDesc" type="textarea" :maxlength="-1" autoHeight placeholder="备注" />
- </uni-forms-item>
- </uni-forms>
- </uni-section>
- <button type="primary" @click="onSubmit" class="submit-BT">提交</button>
- </view>
- </template>
- <script>
- import {transferCheckTask} from '@/api/aqpt/task.js'
- import {getUserList,} from '@/api/system/user.js'
- export default {
- data() {
- return {
- userList:[],
- accountId:undefined,
- formData:{
- taskId: undefined,
- groupIdTo: undefined,
- positionIdTo: undefined,
- accountIdTo: undefined, // 执行人
- groupNameTo: undefined,
- positionNameTo: undefined,
- accountNameTo: undefined,
- taskDesc:""
- },
- rules:{},
- title:"任务转交"
- }
- },
- onBackPress() {
- },
- onLoad({tid,title}) {
- this.formData.taskId=tid;
- this.title=title;
- this.getUserList()
- },
- methods: {
- getUserList(){
- getUserList().then((res)=>{
- var userList=[]
- for (var i = 0; i < res.data.length; i++) {
- userList.push({
- value: -i,
- text: res.data[i].name,
- disable:true
- })
- for(let j = 0; j < res.data[i].children.length; j++){
- userList.push({
- ...res.data[i].children[j],
- value: res.data[i].children[j].accountId,
- text: res.data[i].children[j].accountName
- })
- }
- }
- this.userList=userList
- })
- },
- async onSubmit() {
- let user=this.userList.filter(item=>this.accountId===item.accountId)[0]
- this.handleUser(user)
- if(!this.accountId){
- uni.showToast({
- icon:'none',
- title:"请选择转交人员"
- })
- return
- }
- await transferCheckTask(this.formData).then(()=>{
- uni.showToast({
- icon:'none',
- title:"转交成功!",
- complete() {
- uni.switchTab({
- url:'/pages/index/index'
- })
- }
- })
- })
- .catch(()=>{
- uni.showToast({
- icon:'none',
- title:"提交失败!"
- })
- })
- },
- handleUser(user){
- this.formData.groupIdTo=user.groupId,
- this.formData.positionIdTo=user.positionId
- this.formData.accountIdTo=user.accountId
- this.formData.groupNameTo=user.groupName
- this.formData.positionNameTo=user.positionName
- this.formData.accountNameTo=user.accountName
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .wrap{
- padding: 20rpx;
- .submit-BT {
- width: 750rpx;
- color: #4D73FF;
- text-align: center;
- font-size: 32rpx;
- padding-bottom: 68rpx;
- background-color: #fff;
- position: fixed;
- left: 0;
- bottom: 0;
- z-index: 99;
- box-shadow: 0px 0px 12px 0px #0000000A;
- border-radius: 8px 8px 0px 0px
- }
- ::v-deep .uni-forms-item{
- .uni-forms-item__content{
- .uni-data-checkbox-wrap{
- height: 100%;
- display: flex;
- align-items: center;
- }
-
- }
- }
- }
- </style>
|