特权查询
This commit is contained in:
@@ -30,3 +30,11 @@ export function deleteLbPurchaseApply(id) {
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function needPrivilegeRecommenders(params) {
|
||||||
|
return request({
|
||||||
|
url: '/lbPurchaseApply/needPrivilegeRecommenders',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -33,6 +33,18 @@
|
|||||||
|
|
||||||
<el-card class="action-container" shadow="never">
|
<el-card class="action-container" shadow="never">
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
|
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
|
||||||
|
<el-date-picker
|
||||||
|
v-model="privilegeDateRange"
|
||||||
|
type="daterange"
|
||||||
|
range-separator="至"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
style="width: 280px; margin-left: 12px"
|
||||||
|
/>
|
||||||
|
<el-button type="warning" icon="el-icon-view" :loading="privilegeLoading" @click="handleViewPrivilege">
|
||||||
|
查看特权
|
||||||
|
</el-button>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<el-card class="table-container" shadow="never">
|
<el-card class="table-container" shadow="never">
|
||||||
@@ -119,6 +131,22 @@
|
|||||||
<el-button type="primary" :loading="submitLoading" @click="handleSubmit">确定</el-button>
|
<el-button type="primary" :loading="submitLoading" @click="handleSubmit">确定</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog title="特权推荐人列表" :visible.sync="privilegeDialogVisible" width="760px" @close="resetPrivilegeDialog">
|
||||||
|
<el-table v-loading="privilegeLoading" :data="privilegeList" style="width: 100%">
|
||||||
|
<el-table-column type="index" label="#" width="60" />
|
||||||
|
<el-table-column label="申请人" prop="applyUser" min-width="120" show-overflow-tooltip />
|
||||||
|
<el-table-column label="申请电话" prop="applyPhone" min-width="140" show-overflow-tooltip />
|
||||||
|
<el-table-column label="同事姓名" prop="colleagueName" min-width="120" show-overflow-tooltip />
|
||||||
|
<el-table-column label="同事电话" prop="colleaguePhone" min-width="140" show-overflow-tooltip />
|
||||||
|
<el-table-column label="组长姓名" prop="teamLeader" min-width="120" show-overflow-tooltip />
|
||||||
|
<el-table-column label="申请日期" prop="applyDate" min-width="120" />
|
||||||
|
</el-table>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="privilegeDialogVisible = false">关闭</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -127,20 +155,26 @@ import {
|
|||||||
addLbPurchaseApply,
|
addLbPurchaseApply,
|
||||||
deleteLbPurchaseApply,
|
deleteLbPurchaseApply,
|
||||||
getLbPurchaseApplyList,
|
getLbPurchaseApplyList,
|
||||||
|
needPrivilegeRecommenders,
|
||||||
updateLbPurchaseApply
|
updateLbPurchaseApply
|
||||||
} from '@/api/lb-purchase-apply'
|
} from '@/api/lb-purchase-apply'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'LbPurchaseApply',
|
name: 'LbPurchaseApply',
|
||||||
data() {
|
data() {
|
||||||
|
const today = this.getCurrentDate()
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
submitLoading: false,
|
submitLoading: false,
|
||||||
list: [],
|
list: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
|
privilegeDialogVisible: false,
|
||||||
dialogTitle: '',
|
dialogTitle: '',
|
||||||
isEdit: false,
|
isEdit: false,
|
||||||
|
privilegeLoading: false,
|
||||||
|
privilegeDateRange: [today, today],
|
||||||
|
privilegeList: [],
|
||||||
queryParams: {
|
queryParams: {
|
||||||
current: 1,
|
current: 1,
|
||||||
size: 10,
|
size: 10,
|
||||||
@@ -168,6 +202,13 @@ export default {
|
|||||||
this.fetchList()
|
this.fetchList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getCurrentDate() {
|
||||||
|
const date = new Date()
|
||||||
|
const year = date.getFullYear()
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||||
|
const day = String(date.getDate()).padStart(2, '0')
|
||||||
|
return `${year}-${month}-${day}`
|
||||||
|
},
|
||||||
fetchList() {
|
fetchList() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
getLbPurchaseApplyList(this.buildListParams())
|
getLbPurchaseApplyList(this.buildListParams())
|
||||||
@@ -238,6 +279,57 @@ export default {
|
|||||||
this.$refs.dataForm && this.$refs.dataForm.clearValidate()
|
this.$refs.dataForm && this.$refs.dataForm.clearValidate()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
handleViewPrivilege() {
|
||||||
|
if (!Array.isArray(this.privilegeDateRange) || this.privilegeDateRange.length !== 2) {
|
||||||
|
this.$message.warning('请选择开始日期和结束日期')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const [startDate, endDate] = this.privilegeDateRange
|
||||||
|
if (!startDate || !endDate) {
|
||||||
|
this.$message.warning('请选择开始日期和结束日期')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.privilegeLoading = true
|
||||||
|
needPrivilegeRecommenders({ startDate, endDate })
|
||||||
|
.then((res) => {
|
||||||
|
const result = this.normalizePrivilegeResponse(res)
|
||||||
|
const isSuccess = result && (result.success === true || result.code === 200 || result.code === 20000)
|
||||||
|
if (!isSuccess) {
|
||||||
|
this.$message.error((result && result.message) || '查询失败')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const list = this.extractPrivilegeList(result)
|
||||||
|
this.privilegeList = list
|
||||||
|
this.privilegeDialogVisible = true
|
||||||
|
if (!list.length) {
|
||||||
|
this.$message.info('该日期范围内暂无需要添加特权的推荐人')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.privilegeLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
normalizePrivilegeResponse(res) {
|
||||||
|
if (!res || typeof res !== 'object') return {}
|
||||||
|
if (res.data && typeof res.data === 'object' && !Array.isArray(res.data)) {
|
||||||
|
if (res.data.success !== undefined || Array.isArray(res.data.data) || Array.isArray(res.data.list)) {
|
||||||
|
return res.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
},
|
||||||
|
extractPrivilegeList(res) {
|
||||||
|
let rawList = []
|
||||||
|
if (Array.isArray(res.data)) rawList = res.data
|
||||||
|
else if (res.data && Array.isArray(res.data.list)) rawList = res.data.list
|
||||||
|
else if (res.data && Array.isArray(res.data.rows)) rawList = res.data.rows
|
||||||
|
else if (res.data && Array.isArray(res.data.records)) rawList = res.data.records
|
||||||
|
else if (res.data && res.data.data && Array.isArray(res.data.data)) rawList = res.data.data
|
||||||
|
else if (Array.isArray(res.list)) rawList = res.list
|
||||||
|
else if (Array.isArray(res.rows)) rawList = res.rows
|
||||||
|
else if (Array.isArray(res.records)) rawList = res.records
|
||||||
|
return rawList
|
||||||
|
},
|
||||||
handleEdit(row) {
|
handleEdit(row) {
|
||||||
this.dialogTitle = '编辑进货申请'
|
this.dialogTitle = '编辑进货申请'
|
||||||
this.isEdit = true
|
this.isEdit = true
|
||||||
@@ -309,6 +401,9 @@ export default {
|
|||||||
applyDate: ''
|
applyDate: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
resetPrivilegeDialog() {
|
||||||
|
this.privilegeList = []
|
||||||
|
},
|
||||||
formatDateTime(dateTime) {
|
formatDateTime(dateTime) {
|
||||||
if (!dateTime) return '-'
|
if (!dateTime) return '-'
|
||||||
const date = new Date(String(dateTime).replace('T', ' '))
|
const date = new Date(String(dateTime).replace('T', ' '))
|
||||||
@@ -341,5 +436,6 @@ export default {
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user