|
|
@ -44,6 +44,7 @@ |
|
|
<el-button type="primary" @click="resetQuery">重置</el-button> |
|
|
<el-button type="primary" @click="resetQuery">重置</el-button> |
|
|
<el-button type="primary" @click="openAddDialog">新增</el-button> |
|
|
<el-button type="primary" @click="openAddDialog">新增</el-button> |
|
|
<el-button type="primary" :loading="exportLoading" @click="exportFile">{{ exportLoading ? '导出中...' : '导出' }}</el-button> |
|
|
<el-button type="primary" :loading="exportLoading" @click="exportFile">{{ exportLoading ? '导出中...' : '导出' }}</el-button> |
|
|
|
|
|
<el-button type="danger" :loading="deleteLoading" @click="deleteCurrentRecord">{{ deleteLoading ? '删除中...' : '删除' }}</el-button> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-form> |
|
|
</el-form> |
|
|
|
|
|
|
|
|
@ -262,7 +263,8 @@ import { |
|
|
queryAddMainList, |
|
|
queryAddMainList, |
|
|
queryAddDetailList, |
|
|
queryAddDetailList, |
|
|
saveAddRecord, |
|
|
saveAddRecord, |
|
|
updateRecord |
|
|
|
|
|
|
|
|
updateRecord, |
|
|
|
|
|
deleteRecord |
|
|
} from '@/api/report/qcSubPart' |
|
|
} from '@/api/report/qcSubPart' |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
@ -279,6 +281,7 @@ export default { |
|
|
detailLoading: false, |
|
|
detailLoading: false, |
|
|
addMainLoading: false, |
|
|
addMainLoading: false, |
|
|
exportLoading: false, |
|
|
exportLoading: false, |
|
|
|
|
|
deleteLoading: false, |
|
|
headerList: [], |
|
|
headerList: [], |
|
|
detailList: [], |
|
|
detailList: [], |
|
|
currentHeader: null, |
|
|
currentHeader: null, |
|
|
@ -450,6 +453,38 @@ export default { |
|
|
this.exportLoading = false |
|
|
this.exportLoading = false |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
deleteCurrentRecord () { |
|
|
|
|
|
if (!this.currentHeader || !this.currentHeader.recordNo) { |
|
|
|
|
|
this.$message.warning('请先选择一条主表记录') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.$confirm('确定删除当前主表及其全部明细吗?', '提示', { |
|
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
|
type: 'warning' |
|
|
|
|
|
}).then(() => { |
|
|
|
|
|
const payload = { |
|
|
|
|
|
site: this.currentHeader.site || this.queryForm.site || this.extractSiteFromBuKey(this.queryForm.citemCode), |
|
|
|
|
|
recordNo: this.currentHeader.recordNo, |
|
|
|
|
|
username: this.$store.state.user.name |
|
|
|
|
|
} |
|
|
|
|
|
this.deleteLoading = true |
|
|
|
|
|
deleteRecord(payload).then(({ data }) => { |
|
|
|
|
|
if (data && data.code === 200) { |
|
|
|
|
|
this.$message.success(data.msg || '删除成功') |
|
|
|
|
|
this.currentHeader = null |
|
|
|
|
|
this.detailList = [] |
|
|
|
|
|
this.queryHeader() |
|
|
|
|
|
} else { |
|
|
|
|
|
this.$message.error((data && data.msg) || '删除失败') |
|
|
|
|
|
} |
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
this.$message.error('删除失败') |
|
|
|
|
|
}).finally(() => { |
|
|
|
|
|
this.deleteLoading = false |
|
|
|
|
|
}) |
|
|
|
|
|
}).catch(() => {}) |
|
|
|
|
|
}, |
|
|
onHeaderCurrentChange (row) { |
|
|
onHeaderCurrentChange (row) { |
|
|
this.currentHeader = row |
|
|
this.currentHeader = row |
|
|
if (!row) { |
|
|
if (!row) { |
|
|
|