Browse Source

2025-11-10

物料档案管理质量检验模板页签增加批量删除
master
fengyuan_yang 2 months ago
parent
commit
7032f4f8d4
  1. 60
      src/views/modules/qc/qcPartAttribute.vue

60
src/views/modules/qc/qcPartAttribute.vue

@ -348,12 +348,20 @@
<el-button type="primary" @click="addFastModal()" icon="el-icon-plus">新增模板</el-button> <el-button type="primary" @click="addFastModal()" icon="el-icon-plus">新增模板</el-button>
<el-button v-if="!editBatchVisible" @click="editBatchModel">批量编辑</el-button> <el-button v-if="!editBatchVisible" @click="editBatchModel">批量编辑</el-button>
<el-button v-if="editBatchVisible" @click="batchModel" :loading="batchLoading">批量保存</el-button> <el-button v-if="editBatchVisible" @click="batchModel" :loading="batchLoading">批量保存</el-button>
<el-button v-if="!editBatchVisible" type="danger" @click="batchDeleteTemplates" :disabled="selectedTemplates.length === 0">批量删除</el-button>
</el-form> </el-form>
<el-table <el-table
ref="templateTable"
:data="detailList" :data="detailList"
:height="secondHeight - 68" :height="secondHeight - 68"
border border
@selection-change="handleTemplateSelectionChange"
style="width: 100%;"> style="width: 100%;">
<el-table-column
type="selection"
width="55"
align="center">
</el-table-column>
<el-table-column <el-table-column
v-for="(item,index) in columnDetailList" :key="index" v-for="(item,index) in columnDetailList" :key="index"
:sortable="item.columnSortable" :sortable="item.columnSortable"
@ -1352,6 +1360,7 @@
detailList: [], detailList: [],
defectTrackingList: [], defectTrackingList: [],
labelTemplateList: [], labelTemplateList: [],
selectedTemplates: [], //
dataListLoading: false, dataListLoading: false,
// //
columnList: [ columnList: [
@ -2453,6 +2462,57 @@
}) })
}, },
//
handleTemplateSelectionChange (val) {
this.selectedTemplates = val
},
//
batchDeleteTemplates () {
if (this.selectedTemplates.length === 0) {
this.$message.warning('请至少选择一项')
return
}
this.$confirm(`确认删除选中的 ${this.selectedTemplates.length} 个检验模板吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// Promise
const deletePromises = this.selectedTemplates.map(row => {
return deletePartAttributeDetails(row)
})
//
Promise.all(deletePromises).then(results => {
//
const allSuccess = results.every(({data}) => data && data.code === 0)
if (allSuccess) {
this.$message.success('批量删除成功')
} else {
this.$message.warning('部分删除失败,请重试')
}
//
searchPartAttributeDetails(this.detailData).then(({data}) => {
this.detailList = data.rows
})
//
this.$refs.templateTable.clearSelection()
this.selectedTemplates = []
}).catch(() => {
this.$message.error('批量删除失败')
//
searchPartAttributeDetails(this.detailData).then(({data}) => {
this.detailList = data.rows
})
})
})
},
// ==================== ==================== // ==================== ====================
// //

Loading…
Cancel
Save