index.vue
5.51 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<!-- 物料订单管理 -->
<template>
<d2-container>
<el-form
:inline="true"
:model="searchForm"
label-width="85px"
slot="header"
>
<el-form-item label="订单编号">
<el-input v-model="searchForm.orderCode" placeholder="请输入订单编号" clearable></el-input>
</el-form-item>
<el-form-item label="订单类型">
<el-select v-model="searchForm.orderType" placeholder="请选择订单类型" clearable filterable>
<el-option label="物料申请" value="1"></el-option>
<el-option label="物料报废" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="申请人">
<el-input v-model="searchForm.userName" placeholder="请输入申请人" clearable></el-input>
</el-form-item>
<el-form-item label="订单状态">
<el-select v-model="searchForm.status" placeholder="请选择订单状态" clearable filterable>
<el-option
v-for="(item, index) in statusArr"
:key="index"
:value="item.value"
:label="item.label"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="createTime"
type="daterange"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" :id="tableParams.btnId">查询</el-button>
</el-form-item>
</el-form>
<d2-table-header title="订单列表"><auth-button category="Button"></auth-button></d2-table-header>
<d2-table
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
>
<auth-button
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
></auth-button>
</d2-table>
<detail-dialog
:isVisible="detailVisible"
:title="dialogTitle"
:pdfUrl="pdfUrl"
@closeDialog="handleDetailClose"
></detail-dialog>
</d2-container>
</template>
<script>
import DetailDialog from './detailDialog'
import { getListApi, detailApi, removeApi, exportApi } from '@api/materiaOrderManagement'
import notice from '@/common/notice'
import util from '@/libs/util'
export default {
name: 'fimsMateriaOrderManagement',
components: {
DetailDialog
},
data() {
return {
detailVisible: false,
dialogTitle: '',
pdfUrl: '',
// 搜索
createTime: '',
searchForm: {
orderCode: '',
orderType: '',
status: '',
userName: '',
startTime: '',
endTime: ''
},
statusArr: [{
value: 1,
label: '审批中'
}, {
value: 2,
label: '审批完成'
}, {
value: 3,
label: '已驳回'
}, {
value: 4,
label: '待签收'
}, {
value: 5,
label: '已完成'
}],
// 表格参数
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'orderList',
tag: Object.freeze({
type: ['', '', 'info', 'danger', 'warning', 'success'],
label: ['', '审批中', '审批完成', '已驳回', '待签收', '已完成']
}),
tableOption: true,
tableColumns: [{
label: '订单编号',
prop: 'orderCode',
minWidth: '200'
}, {
label: '创建时间',
prop: 'createTime',
minWidth: '180'
}, {
label: '类型',
prop: 'orderType',
width: '120',
formatter: (cellValue) => {
if (cellValue.orderType) {
return {
1: '物料申请',
2: '物料报废'
}[cellValue.orderType]
}
}
}, {
label: '申请人',
prop: 'userName',
width: '140'
}, {
label: '状态',
prop: 'status',
tagLabel: true,
width: '140'
}]
},
getListApi: getListApi
}
},
watch: {
'createTime'(value) {
Object.assign(this.searchForm, util.formatTime(this.createTime))
}
},
mounted() {},
methods: {
/* 接口请求-start */
exportFile() {
const params = _.cloneDeep(this.searchForm)
!params.orderCode && delete params.orderCode
exportApi(params).then(res => {
this.$open(res.url)
notice.okTips()
}).catch(() => {
notice.errorTips()
})
},
/* 接口请求-end */
handleDetailClose() {
this.pdfUrl = ''
this.detailVisible = false
},
// 表格-查看详情
handleDetail(row) {
detailApi({
orderCode: row.orderCode
}).then(res => {
this.dialogTitle = row.orderType === 1 ? '物料申请' : '物料报废'
this.pdfUrl = res.url
this.detailVisible = true
}).catch(() => {
notice.errorTips()
})
},
handleDelete(row) {
this.$confirm('确认删除?', '删除', {
comfirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
removeApi({
orderCode: row.orderCode
}).then(() => {
notice.okTips()
}).catch(() => {
notice.errorTips()
})
}).catch(() => {})
}
}
}
</script>
<style scoped>
</style>