Browse Source

2026-06-15

RoHS优化
master
fengyuan_yang 3 days ago
parent
commit
6ac8942a24
  1. 3
      src/api/rohs/rohs.js
  2. 77
      src/views/modules/rohs/rohsRecord.vue

3
src/api/rohs/rohs.js

@ -27,6 +27,9 @@ export const issueRohs = data => createAPI(`/rohs/issue`, 'post', data);
// 审批提交(同意/驳回) // 审批提交(同意/驳回)
export const submitRohs = data => createAPI(`/rohs/submit`, 'post', data); export const submitRohs = data => createAPI(`/rohs/submit`, 'post', data);
// 删除(仅草稿)
export const deleteRohs = data => createAPI(`/rohs/delete`, 'post', data);
// 查询审批信息 // 查询审批信息
export const getRohsApprovalList = data => createAPI(`/rohs/approvalList`, 'post', data); export const getRohsApprovalList = data => createAPI(`/rohs/approvalList`, 'post', data);

77
src/views/modules/rohs/rohsRecord.vue

@ -28,6 +28,7 @@
<el-form-item :label="' '"> <el-form-item :label="' '">
<el-button v-if="authSearch" @click="getDataList">查询</el-button> <el-button v-if="authSearch" @click="getDataList">查询</el-button>
<el-button v-if="authUpdate" @click="addOrUpdateHandle()">新增</el-button> <el-button v-if="authUpdate" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="authDelete" type="danger" @click="deleteHandle()">删除</el-button>
<download-excel <download-excel
v-if="authSearch" v-if="authSearch"
:fields="exportFieldMap" :fields="exportFieldMap"
@ -57,8 +58,10 @@
:row-style="rowStyle" :row-style="rowStyle"
@row-click="changeClickRow" @row-click="changeClickRow"
@current-change="currentChange" @current-change="currentChange"
@selection-change="dataListSelectionChange"
v-loading="dataListLoading" v-loading="dataListLoading"
style="width: 100%;"> style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
<el-table-column prop="referenceNo" header-align="center" align="center" label="序列号" width="165"></el-table-column> <el-table-column prop="referenceNo" header-align="center" align="center" label="序列号" width="165"></el-table-column>
<el-table-column prop="status" header-align="center" align="center" label="单据状态" width="120"></el-table-column> <el-table-column prop="status" header-align="center" align="center" label="单据状态" width="120"></el-table-column>
<el-table-column prop="nodeId" header-align="center" align="center" label="当前节点ID" width="130"></el-table-column> <el-table-column prop="nodeId" header-align="center" align="center" label="当前节点ID" width="130"></el-table-column>
@ -1230,6 +1233,7 @@ export default {
}, },
projectMaterialList: [], projectMaterialList: [],
projectMaterialSelections: [], projectMaterialSelections: [],
dataListSelections: [],
materialSelections: [], materialSelections: [],
projectMaterialPageIndex: 1, projectMaterialPageIndex: 1,
projectMaterialPageSize: 20, projectMaterialPageSize: 20,
@ -2196,6 +2200,9 @@ export default {
this.approvalList = [] this.approvalList = []
} }
}, },
dataListSelectionChange (rows) {
this.dataListSelections = rows || []
},
applyCurrentRowData (detailData, fallbackData = {}) { applyCurrentRowData (detailData, fallbackData = {}) {
this.currentRow = detailData || {} this.currentRow = detailData || {}
if (!Array.isArray(this.currentRow.materialList)) { if (!Array.isArray(this.currentRow.materialList)) {
@ -2335,6 +2342,7 @@ export default {
getDataList () { getDataList () {
if (!this.authSearch) { if (!this.authSearch) {
this.dataList = [] this.dataList = []
this.dataListSelections = []
this.totalPage = 0 this.totalPage = 0
this.currentRow = {} this.currentRow = {}
this.approvalList = [] this.approvalList = []
@ -2374,8 +2382,12 @@ export default {
...item ...item
} }
}) })
this.dataListSelections = []
this.totalPage = data.page.totalCount this.totalPage = data.page.totalCount
this.$nextTick(() => { this.$nextTick(() => {
if (this.$refs.rohsTable) {
this.$refs.rohsTable.clearSelection()
}
if (this.$refs.rohsTable && this.dataList.length > 0) { if (this.$refs.rohsTable && this.dataList.length > 0) {
this.$refs.rohsTable.setCurrentRow(this.dataList[0]) this.$refs.rohsTable.setCurrentRow(this.dataList[0])
} else if (this.$refs.rohsTable) { } else if (this.$refs.rohsTable) {
@ -2384,12 +2396,14 @@ export default {
}) })
} else { } else {
this.dataList = [] this.dataList = []
this.dataListSelections = []
this.totalPage = 0 this.totalPage = 0
this.currentRow = {} this.currentRow = {}
this.approvalList = [] this.approvalList = []
} }
this.dataListLoading = false this.dataListLoading = false
}).catch(() => { }).catch(() => {
this.dataListSelections = []
this.currentRow = {} this.currentRow = {}
this.approvalList = [] this.approvalList = []
this.dataListLoading = false this.dataListLoading = false
@ -2807,6 +2821,69 @@ export default {
}) })
}) })
}, },
deleteHandle () {
if (!this.authDelete) {
this.$message.warning('没有删除权限')
return
}
const selectedRows = (this.dataListSelections || []).filter(item => item && item.site && item.referenceNo)
if (!selectedRows.length) {
this.$message.warning('请先勾选要删除的单据')
return
}
const nonDraftRows = selectedRows.filter(item => item.status !== '草稿')
if (nonDraftRows.length) {
const previewText = nonDraftRows.slice(0, 3).map(item => item.referenceNo).join('、')
const suffix = nonDraftRows.length > 3 ? (' 等' + nonDraftRows.length + '条') : ''
this.$message.warning('仅草稿状态的单据允许删除,当前勾选包含非草稿单据:' + previewText + suffix)
return
}
this.$confirm('确认删除选中的' + selectedRows.length + '条RoHS单据?删除后会同步删除材料和附件数据。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const deleteTasks = selectedRows.map(item => {
return api.deleteRohs({
site: item.site,
referenceNo: item.referenceNo
}).then(({data}) => {
if (data && data.code === 0) {
return {
success: true,
referenceNo: item.referenceNo
}
}
return {
success: false,
referenceNo: item.referenceNo,
msg: (data && data.msg) || '删除失败'
}
}).catch(() => {
return {
success: false,
referenceNo: item.referenceNo,
msg: '删除失败'
}
})
})
Promise.all(deleteTasks).then(results => {
const successRows = results.filter(item => item.success)
const failRows = results.filter(item => !item.success)
if (this.modalFlag && successRows.some(item => item.referenceNo === this.modalData.referenceNo)) {
this.modalFlag = false
}
if (!failRows.length) {
this.$message.success('删除成功,共' + successRows.length + '条')
} else if (!successRows.length) {
this.$message.error(failRows[0].msg || '删除失败')
} else {
this.$message.warning('已删除' + successRows.length + '条,失败' + failRows.length + '条')
}
this.getDataList()
})
}).catch(() => {})
},
openProjectMaterialDialog () { openProjectMaterialDialog () {
if (!this.canEditRohsMaterial()) { if (!this.canEditRohsMaterial()) {
this.$message.warning('当前状态不允许编辑材料') this.$message.warning('当前状态不允许编辑材料')

Loading…
Cancel
Save