完善班组模型功能迁移
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled

This commit is contained in:
sheng
2026-06-25 22:33:17 +08:00
parent 257e3f4d08
commit 8f13054d68
6 changed files with 118 additions and 15 deletions

View File

@@ -62,6 +62,17 @@
<template slot-scope="scope"><el-button type="danger" size="mini" icon="el-icon-delete" @click="deleteMember(scope.row, scope.$index)">{{ $t(key('delete')) }}</el-button></template>
</el-table-column>
</el-table>
<el-pagination
v-if="memberPagination.total > memberPagination.size"
:current-page="memberPagination.current"
:page-size="memberPagination.size"
:page-sizes="[8, 20, 50, 100]"
:total="memberPagination.total"
layout="total, sizes, prev, pager, next, jumper"
class="member-pagination"
@size-change="onMemberSizeChange"
@current-change="onMemberCurrentChange"
/>
<span slot="footer">
<el-button @click="closeDialog">{{ $t(key('cancel')) }}</el-button>
<el-button type="primary" :loading="submitting" @click="submitDialog">{{ $t(key('confirm')) }}</el-button>
@@ -134,6 +145,7 @@ export default {
leaderIndex: undefined,
formData: { name: '', area_id: '', line_id: '' },
membersData: [],
memberPagination: { current: 1, size: 8, total: 0 },
importVisible: false,
importFileList: [],
importRows: [],
@@ -195,10 +207,15 @@ export default {
},
onSearchAreaChange (areaId) { this.search.line_id = ''; this.loadLines(areaId, 'searchLineOptions') },
onFormAreaChange (areaId) { this.formData.line_id = ''; this.loadLines(areaId, 'formLineOptions') },
buildSearchParams () {
const params = { ...this.search }
if (!Array.isArray(params.create_time) || !params.create_time.length) delete params.create_time
return params
},
async fetchData () {
this.loading = true
try {
const res = await getTeamList({ ...this.search, page_no: this.pagination.current, page_size: this.pagination.size })
const res = await getTeamList({ ...this.buildSearchParams(), page_no: this.pagination.current, page_size: this.pagination.size })
const { list, total } = readPageData(res)
this.tableData = list
this.pagination.total = total
@@ -212,12 +229,30 @@ export default {
this.handleType = 'edit'; this.dialogTitle = this.key('edit_team'); this.editId = row.id
this.formData = { name: row.name, area_id: row.area_id, line_id: row.line_id }
await this.loadLines(row.area_id, 'formLineOptions')
const res = await getTeamMemberList({ production_team_id: row.id, page_no: 1, page_size: 10000 })
this.memberPagination.current = 1
await this.loadMembers()
this.dialogVisible = true
},
async loadMembers () {
const res = await getTeamMemberList({
production_team_id: this.editId,
page_no: this.memberPagination.current,
page_size: this.memberPagination.size
})
const { list } = readPageData(res)
this.membersData = list.map(item => ({ ...item, is_main: Number(item.is_main) }))
this.memberPagination.total = readPageData(res).total
this.leaderIndex = this.membersData.findIndex(item => Number(item.is_main) === 1)
if (this.leaderIndex < 0) this.leaderIndex = undefined
this.dialogVisible = true
},
onMemberSizeChange (size) {
this.memberPagination.size = size
this.memberPagination.current = 1
if (this.editId) this.loadMembers()
},
onMemberCurrentChange (current) {
this.memberPagination.current = current
if (this.editId) this.loadMembers()
},
addMember () { this.membersData.push({ user_id: '', is_main: 0 }) },
onLeaderChange (val, index) {
@@ -228,7 +263,12 @@ export default {
else if (Number(val) === 1) this.leaderIndex = index
},
async deleteMember (row, index) {
if (row.id) { await deleteTeamMember({ id: [row.id] }); this.$message.success(this.$t(this.key('operation_successful'))) }
if (row.id) {
await deleteTeamMember({ id: [row.id] })
this.$message.success(this.$t(this.key('operation_successful')))
await this.loadMembers()
return
}
this.membersData.splice(index, 1)
},
submitDialog () {
@@ -244,7 +284,15 @@ export default {
} finally { this.submitting = false }
})
},
closeDialog () { this.dialogVisible = false; this.formData = { name: '', area_id: '', line_id: '' }; this.membersData = []; this.formLineOptions = []; this.leaderIndex = undefined; this.editId = '' },
closeDialog () {
this.dialogVisible = false
this.formData = { name: '', area_id: '', line_id: '' }
this.membersData = []
this.formLineOptions = []
this.memberPagination = { current: 1, size: 8, total: 0 }
this.leaderIndex = undefined
this.editId = ''
},
async handleDelete (row) {
const cancelled = await this.$confirmAction({ message: this.key('delete_team_confirm_message'), title: this.key('prompt'), confirmButtonText: this.key('confirm'), cancelButtonText: this.key('cancel') }, () => deleteTeam({ id: [row.id] }))
if (cancelled) return
@@ -273,7 +321,7 @@ export default {
this.$message.success(this.$t(this.key('operation_successful'))); this.importVisible = false; this.fetchData()
},
async handleExport () {
const cancelled = await this.$confirmAction({ message: this.key('export_confirm_message'), title: this.key('prompt'), confirmButtonText: this.key('confirm'), cancelButtonText: this.key('cancel') }, () => exportTeamTask({ ...this.search, action: 'download' }))
const cancelled = await this.$confirmAction({ message: this.key('export_confirm_message'), title: this.key('prompt'), confirmButtonText: this.key('confirm'), cancelButtonText: this.key('cancel') }, () => exportTeamTask({ ...this.buildSearchParams(), action: 'download' }))
if (cancelled) return
this.$message.success(this.$t(this.key('download_task_created')))
}
@@ -283,5 +331,6 @@ export default {
<style scoped>
.search-bar { padding: 10px 0; }
.member-pagination { margin-top: 12px; text-align: right; }
/deep/ .el-form-item--mini.el-form-item { margin-bottom: 4px; }
</style>