申请进货单

This commit is contained in:
zhonghua.li
2026-04-29 20:36:43 +08:00
parent 3890552611
commit a3d86b3fcd
6 changed files with 845 additions and 30 deletions

View File

@@ -0,0 +1,390 @@
<template>
<div class="app-container">
<el-card class="filter-container" shadow="never">
<el-form :model="queryParams" :inline="true" label-width="100px">
<el-form-item label="租户ID">
<el-input v-model="queryParams.tenantId" clearable placeholder="请输入租户ID" style="width: 180px" />
</el-form-item>
<el-form-item label="申请人">
<el-input v-model="queryParams.applicantName" clearable placeholder="请输入申请人" style="width: 180px" />
</el-form-item>
<el-form-item label="申请人电话">
<el-input v-model="queryParams.applicantPhone" clearable placeholder="请输入申请人电话" style="width: 180px" />
</el-form-item>
<el-form-item label="同事姓名">
<el-input v-model="queryParams.colleagueName" clearable placeholder="请输入同事姓名" style="width: 180px" />
</el-form-item>
<el-form-item label="团队长姓名">
<el-input v-model="queryParams.teamLeaderName" clearable placeholder="请输入团队长姓名" style="width: 180px" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
<el-button icon="el-icon-delete" @click="resetQuery">清空</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="action-container" shadow="never">
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
</el-card>
<el-card class="table-container" shadow="never">
<el-table v-loading="loading" :data="list" style="width: 100%">
<el-table-column label="租户ID" prop="tenantId" min-width="120" />
<el-table-column label="申请人" prop="applicantName" min-width="120" />
<el-table-column label="申请人电话" prop="applicantPhone" min-width="140" />
<el-table-column label="年龄" prop="applicantAge" min-width="80" />
<el-table-column label="从业经历" prop="workExperience" min-width="180" show-overflow-tooltip />
<el-table-column label="同事姓名" prop="colleagueName" min-width="120" />
<el-table-column label="同事电话" prop="colleaguePhone" min-width="140" />
<el-table-column label="团队长姓名" prop="teamLeaderName" min-width="130" />
<el-table-column label="申请时间" prop="applicationDatetime" min-width="170">
<template slot-scope="scope">
{{ formatDateTime(scope.row.applicationDatetime) }}
</template>
</el-table-column>
<el-table-column label="创建时间" prop="createdAt" min-width="170">
<template slot-scope="scope">
{{ formatDateTime(scope.row.createdAt) }}
</template>
</el-table-column>
<el-table-column label="更新时间" prop="updatedAt" min-width="170">
<template slot-scope="scope">
{{ formatDateTime(scope.row.updatedAt) }}
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="140">
<template slot-scope="scope">
<el-button type="text" @click="handleEdit(scope.row)">编辑</el-button>
<el-button type="text" style="color:#F56C6C;" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="queryParams.current"
:page-size="queryParams.size"
:page-sizes="[10, 20, 50, 100]"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-card>
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="760px" @close="resetForm">
<el-form ref="dataForm" :model="form" :rules="formRules" label-width="120px">
<el-row :gutter="16">
<el-col :span="12">
<el-form-item label="租户ID" prop="tenantId">
<el-input v-model="form.tenantId" placeholder="请输入租户ID" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="申请人" prop="applicantName">
<el-input v-model="form.applicantName" placeholder="请输入申请人" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="12">
<el-form-item label="申请人电话" prop="applicantPhone">
<el-input v-model="form.applicantPhone" placeholder="请输入申请人电话" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="年龄" prop="applicantAge">
<el-input-number v-model="form.applicantAge" :min="0" :controls="false" style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="12">
<el-form-item label="同事姓名" prop="colleagueName">
<el-input v-model="form.colleagueName" placeholder="请输入同事姓名" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="同事电话" prop="colleaguePhone">
<el-input v-model="form.colleaguePhone" placeholder="请输入同事电话" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="12">
<el-form-item label="团队长姓名" prop="teamLeaderName">
<el-input v-model="form.teamLeaderName" placeholder="请输入团队长姓名" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="申请时间" prop="applicationDatetime">
<el-date-picker
v-model="form.applicationDatetime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
clearable
placeholder="请选择申请时间"
style="width: 100%"
/>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="从业经历" prop="workExperience">
<el-input
v-model="form.workExperience"
type="textarea"
:rows="3"
placeholder="请输入从业经历"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" :loading="submitLoading" @click="handleSubmit">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
addLbAssessmentApply,
deleteLbAssessmentApply,
getLbAssessmentApplyList,
updateLbAssessmentApply
} from '@/api/lb-assessment-apply'
export default {
name: 'LbAssessmentApply',
data() {
return {
loading: false,
submitLoading: false,
list: [],
total: 0,
dialogVisible: false,
dialogTitle: '',
isEdit: false,
queryParams: {
current: 1,
size: 10,
tenantId: '',
applicantName: '',
applicantPhone: '',
colleagueName: '',
teamLeaderName: ''
},
form: {
id: '',
tenantId: '',
applicantName: '',
applicantPhone: '',
applicantAge: undefined,
workExperience: '',
colleagueName: '',
colleaguePhone: '',
teamLeaderName: '',
applicationDatetime: ''
},
formRules: {
tenantId: [{ required: true, message: '请输入租户ID', trigger: 'blur' }],
applicantName: [{ required: true, message: '请输入申请人', trigger: 'blur' }],
applicantPhone: [{ required: true, message: '请输入申请人电话', trigger: 'blur' }]
}
}
},
created() {
this.fetchList()
},
methods: {
fetchList() {
this.loading = true
getLbAssessmentApplyList(this.buildListParams())
.then((res) => {
if (res && (res.code === 20000 || res.code === 200 || res.success === true)) {
this.list = Array.isArray(res.data) ? res.data : []
this.total = typeof res.total === 'number'
? res.total
: (res.page && typeof res.page.total === 'number' ? res.page.total : this.list.length)
} else {
this.list = []
this.total = 0
}
})
.catch(() => {
this.list = []
this.total = 0
})
.finally(() => {
this.loading = false
})
},
buildListParams() {
const params = {
current: this.queryParams.current,
size: this.queryParams.size,
tenantId: this.queryParams.tenantId || undefined,
applicantName: this.queryParams.applicantName || undefined,
applicantPhone: this.queryParams.applicantPhone || undefined,
colleagueName: this.queryParams.colleagueName || undefined,
teamLeaderName: this.queryParams.teamLeaderName || undefined
}
Object.keys(params).forEach((key) => {
if (params[key] === undefined || params[key] === '') delete params[key]
})
return params
},
handleQuery() {
this.queryParams.current = 1
this.fetchList()
},
resetQuery() {
this.queryParams = {
current: 1,
size: 10,
tenantId: '',
applicantName: '',
applicantPhone: '',
colleagueName: '',
teamLeaderName: ''
}
this.fetchList()
},
handleSizeChange(size) {
this.queryParams.size = size
this.fetchList()
},
handleCurrentChange(current) {
this.queryParams.current = current
this.fetchList()
},
handleAdd() {
this.dialogTitle = '新增评估申请'
this.isEdit = false
this.resetFormData()
this.dialogVisible = true
this.$nextTick(() => {
this.$refs.dataForm && this.$refs.dataForm.clearValidate()
})
},
handleEdit(row) {
this.dialogTitle = '编辑评估申请'
this.isEdit = true
this.form = {
id: row.id || '',
tenantId: row.tenantId || '',
applicantName: row.applicantName || '',
applicantPhone: row.applicantPhone || '',
applicantAge: row.applicantAge === null || row.applicantAge === undefined ? undefined : Number(row.applicantAge),
workExperience: row.workExperience || '',
colleagueName: row.colleagueName || '',
colleaguePhone: row.colleaguePhone || '',
teamLeaderName: row.teamLeaderName || '',
applicationDatetime: row.applicationDatetime || ''
}
this.dialogVisible = true
this.$nextTick(() => {
this.$refs.dataForm && this.$refs.dataForm.clearValidate()
})
},
handleDelete(row) {
this.$confirm('确定删除这条评估申请记录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
return deleteLbAssessmentApply(row.id)
}).then((res) => {
this.$message.success((res && res.message) || '删除成功')
this.fetchList()
}).catch(() => {})
},
handleSubmit() {
this.$refs.dataForm.validate((valid) => {
if (!valid) return
const payload = this.buildPayload()
this.submitLoading = true
const req = this.isEdit ? updateLbAssessmentApply(payload) : addLbAssessmentApply(payload)
req.then((res) => {
this.$message.success((res && res.message) || (this.isEdit ? '更新成功' : '新增成功'))
this.dialogVisible = false
this.fetchList()
}).finally(() => {
this.submitLoading = false
})
})
},
buildPayload() {
const payload = {
tenantId: this.form.tenantId,
applicantName: this.form.applicantName,
applicantPhone: this.form.applicantPhone,
applicantAge: this.form.applicantAge,
workExperience: this.form.workExperience || undefined,
colleagueName: this.form.colleagueName || undefined,
colleaguePhone: this.form.colleaguePhone || undefined,
teamLeaderName: this.form.teamLeaderName || undefined,
applicationDatetime: this.form.applicationDatetime || undefined
}
if (this.isEdit) payload.id = this.form.id
Object.keys(payload).forEach((key) => {
if (payload[key] === undefined || payload[key] === '') delete payload[key]
})
return payload
},
resetForm() {
this.$refs.dataForm && this.$refs.dataForm.resetFields()
this.resetFormData()
},
resetFormData() {
this.form = {
id: '',
tenantId: '',
applicantName: '',
applicantPhone: '',
applicantAge: undefined,
workExperience: '',
colleagueName: '',
colleaguePhone: '',
teamLeaderName: '',
applicationDatetime: ''
}
},
formatDateTime(dateTime) {
if (!dateTime) return '-'
const date = new Date(String(dateTime).replace('T', ' '))
if (Number.isNaN(date.getTime())) return String(dateTime)
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
}
}
}
</script>
<style lang="scss" scoped>
.app-container {
.filter-container {
margin-bottom: 20px;
}
.action-container {
margin-bottom: 20px;
}
.table-container {
.el-pagination {
margin-top: 20px;
text-align: right;
}
}
}
</style>