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
109
110
111
/**
* @Description: 工艺资源页自定义事件
* @author wx
* @date 2021/4/13
*/
import {
checkoutResourceOverride,
checkinResource,
undoCheckoutResourceOverride,
saveResource
} from '../../../api/resource'
export function changeCustomEvent(view) {
// #region 详情页主工具栏事件
// 检出
this['DxProcessResource-checkOut'] = function(e) {
if (!this.checkoutState.checkout) {
checkoutResourceOverride(this.modelName, e.el.propForm.id).then((res) => {
this.$utils.showMessageSuccess(res.message)
this.refreshNodeData(res.items)
}).catch((e) => {
})
} else {
this.$utils.showMessageWarning('此对象已检出!')
}
}.bind(view)
// 检入
this['DxProcessResource-checkIn'] = function(e) {
if (this.checkoutState.checkout) {
checkinResource(this.modelName, e.el.propForm.id)
.then((res) => {
this.$utils.showMessageSuccess(res.message)
this.refreshNodeData(res.items, 'checkIn')
})
.catch((e) => {
})
} else {
this.$utils.showMessageWarning('此对象不是检出状态!')
}
}.bind(view)
// 撤销检出
this['DxProcessResource-cancelCheckOut'] = function(e) {
if (this.checkoutState.checkout) {
undoCheckoutResourceOverride(this.modelName, e.el.propForm.id).then((res) => {
this.$utils.showMessageSuccess(res.message)
this.refreshNodeData(res.items)
}).catch((e) => {
})
} else {
this.$utils.showMessageWarning('此对象未检出!')
}
}.bind(view)
// 编辑
this['DxProcessResource-edit'] = function(e) {
if (!this.checkoutState.checkout) {
this.$utils.showMessageWarning('请先进行检出操作!')
return
}
if (!this.checkoutState.isCheckouter) {
this.$utils.showMessageWarning(`该对象由${this.checkoutState.lockerName}检出`)
return
}
this.$router.push({ path: '/resource/edit', query: { id: e.el.propForm.id, subTypeName: this.typeName || this.basicData.subTypeName, modelName: this.modelName }})
}.bind(view)
// 添加工艺资源相关零件
this['ResourceRelatedPartAdd'] = function(e) {
if (this.checkoutState.checkout) {
if (!this.checkoutState.isCheckouter) {
this.$utils.showMessageWarning(`该对象由${this.checkoutState.lockerName}检出`)
return
}
this.showDialog = true
this.dialogTitle = '添加工艺资源的相关零件'
this.componentName = 'deeAddModelCaseDialog'
this.obj = e.el
} else {
this.$utils.showMessageWarning('请先进行检出操作!')
}
}.bind(view)
// 移除工艺资源相关零件
this['ResourceRelatedPartRemove'] = function(e) {
if (this.checkoutState.checkout) {
if (!this.checkoutState.isCheckouter) {
this.$utils.showMessageWarning(`该对象由${this.checkoutState.lockerName}检出`)
return
}
if (e.el.selectedData.length < 1) {
this.$utils.showMessageWarning('请选择要删除的项')
return
}
const params = {
'operator': 'NO_CHANGE',
'id': this.basicData.id,
'sourceDxResPartLink': e.el.selectedData.map(r => {
return {
'operator': 'REMOVE',
'id': r.id
}
})
}
saveResource(params, this.basicData.subTypeName).then(res => {
this.$utils.showMessageSuccess('删除成功!')
e.el.selectedData = []
e.el.getTableData()
}).catch(e => {
})
} else {
this.$utils.showMessageWarning('请先进行检出操作!')
}
}.bind(view)
}