bug
liuying
2024-04-25 0a69f79af938212890472de705f95afe650814a3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<template>
  <a-modal title="任务优先级调整" v-model="innerVisible" @ok="onConfirm" :afterClose="afterClose">
    <a-form :form="form" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
      <a-form-item label="优先级">
        <a-select v-decorator="rule" placeholder="请选择..." >
          <a-select-option :key="1" :value="1">1级</a-select-option>
          <a-select-option :key="2" :value="2">2级</a-select-option>
          <a-select-option :key="3" :value="3">3级</a-select-option>
          <a-select-option :key="4" :value="4">4级</a-select-option>
          <a-select-option :key="5" :value="5">5级</a-select-option>
          <a-select-option :key="6" :value="6">6级</a-select-option>
          <a-select-option :key="7" :value="7">7级</a-select-option>
          <a-select-option :key="8" :value="8">8级</a-select-option>
          <a-select-option :key="9" :value="9">9级</a-select-option>
          <a-select-option :key="10" :value="10">10级</a-select-option>
        </a-select>
      </a-form-item>
    </a-form>
  </a-modal>
</template>
 
<script>
import { WmsTaskUpdateLevel } from '@/api/modular/main/WmsTaskManage'
export default {
  name:'wmsTaskPriorityModal',
  emits:['update:visible','confirm'],
  props:{
    row:{
      type:Object,
      default:function(){
        return {}
      }
    },
    visible:{
      type:Boolean,
      default:false
    }
  },
  data(){
    return {
      title:'',
      labelText:'',
      innerVisible:false,
      form: this.$form.createForm(this, { name: 'choose-site-form' }),
      sites:[],
      rule:['Tasklevel',{rules:[
        { required: true, message: '请确认优先级' }
      ]}]
    }
  },
  watch:{
    visible(newVal,oldVal){
      this.changeInnerVisible()
    },
    innerVisible(newVal,oldVal){
      this.changeVisible()
    }
  },
  methods:{
    changeInnerVisible(){
      if (this.visible!==this.innerVisible){
        this.innerVisible = this.visible
        if (this.innerVisible) {
          this.$nextTick(()=>{
            this.opened()
          })
        }
      }
    },
    changeVisible(){
      if (this.innerVisible!==this.visible){
        this.$emit('update:visible',this.innerVisible)
      }
    },
    opened(){
      //this.getSites()
    },
    onConfirm(){
      this.form.validateFields((err, values) => {
        if (!err) {
          let params = {...values}
          params.Id = this.row.id;
          WmsTaskUpdateLevel(params).then(()=>{
            this.innerVisible = false;
            this.$message.success('操作成功')
            this.$emit('confirm')
          }).catch(()=>[
            
          ])
        } 
      });
    },
    afterClose(){
      try{
        this.form.resetFields()
      }catch(e){
        
      }
    }
  },
  created(){
    this.changeInnerVisible()
  }
}
</script>
 
<style>
</style>