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
| <template>
| <a-modal
| title="优先级修改"
| width="300px"
| :visible="visible"
| dialogClass="zero-modal"
| @cancel="handleCancel"
| >
| <div class="shk-task-level-edit-modal">
| <a-select v-model="taskLevel" placeholder="请选择..." style="width:100%;">
| <a-select-option v-for="index of 10" :key="index" :value="index">{{index}}</a-select-option>
| </a-select>
| </div>
| <template slot="footer">
| <a-button key="back" @click="handleCancel">取消</a-button>
| <a-button type="primary" key="ok" @click="onConfirm">确认</a-button>
| </template>
| </a-modal>
| </template>
|
| <script>
| import { FoamingTaskLevelUpdate } from '@/api/modular/main/FoamingTaskManage'
| export default {
| name:'shkTaskLevelEditModal',
| emits:['update:visible','callback'],
| props:{
| visible:{
| type:Boolean,
| default:false
| },
| obj:{
| type:Object,
| default:function(){
| return {}
| }
| }
| },
| data(){
| return {
| taskLevel:1
| }
| },
| watch:{
| visible:{
| immediate:true,
| handler(newV,oldV){
| if (newV!==oldV){
| this.initShow()
| }
| }
| }
| },
| methods:{
| handleCancel(){
| this.$emit('update:visible',false)
| },
| initShow(){
| this.taskLevel = this.obj.taskLevel
| },
| onConfirm(){
| this.$loading.show()
| this.handleUpdateAjax((f)=>{
| this.$loading.hide()
| if (f) {
| this.$message.success('操作成功!');
| this.handleCancel()
| this.$emit('callback')
| }
| })
| },
| handleUpdateAjax(callback){
| let _params = {
| id:this.obj.id,
| taskLevel:this.taskLevel
| }
| FoamingTaskLevelUpdate(_params).then(()=>{
| callback(true)
| }).catch(()=>{
| callback(false)
| })
| }
| }
| }
| </script>
|
| <style lang="less" scoped>
| .shk-task-level-edit-modal{
| padding: 8px 16px;
| }
| </style>
|
|