|
@@ -1,6 +1,9 @@
|
|
|
<!-- -->
|
|
|
<template>
|
|
|
- <hc-new-dialog v-model="qualityMoadal" is-table title="关联质检资料" widths="1200px" :loading="saveModalLoading" @close="qulModalClose" @save="saveQualModal">
|
|
|
+ <hc-new-dialog
|
|
|
+ v-model="qualityMoadal" is-table title="关联质检资料" widths="1200px" :loading="saveModalLoading"
|
|
|
+ @close="qulModalClose" @save="saveQualModal"
|
|
|
+ >
|
|
|
<hc-new-card>
|
|
|
<div class="relative h-full flex">
|
|
|
<div :id="`hc_tree_card_${uuid}`" v-loading="treeLoading" class="hc_tree_card_border relative">
|
|
@@ -10,7 +13,8 @@
|
|
|
</div>
|
|
|
<div :id="`hc_table_card_${uuid}`" class="relative flex-1">
|
|
|
<HcTable
|
|
|
- ref="qualTable" :column="tableColumn" :datas="tableData" is-new is-check is-reserve-selection :loading="tableLoading" row-key="selectId"
|
|
|
+ ref="qualTable" :column="tableColumn" :datas="tableData" is-new is-check is-reserve-selection
|
|
|
+ :loading="tableLoading" row-key="selectId"
|
|
|
@select="tableSelect"
|
|
|
@selection-change="tableSelection"
|
|
|
@select-all="tableSelectAll"
|
|
@@ -41,38 +45,39 @@ import { useAppStore } from '~src/store'
|
|
|
import unitApi from '~api/project/debit/contract/unit'
|
|
|
import { queryWbsTreeData } from '~api/other'
|
|
|
import { getStoreValue, setStoreValue } from '~src/utils/storage'
|
|
|
+
|
|
|
const props = defineProps({
|
|
|
qualityMoadal: {
|
|
|
type: Boolean,
|
|
|
default: false,
|
|
|
},
|
|
|
- cid:{
|
|
|
- type:String,
|
|
|
- default:'',
|
|
|
+ cid: {
|
|
|
+ type: String,
|
|
|
+ default: '',
|
|
|
},
|
|
|
- periodId:{
|
|
|
- type:String,
|
|
|
- default:'',
|
|
|
+ periodId: {
|
|
|
+ type: String,
|
|
|
+ default: '',
|
|
|
},
|
|
|
- selectId:{
|
|
|
- type:String,
|
|
|
- default:'',
|
|
|
+ selectId: {
|
|
|
+ type: String,
|
|
|
+ default: '',
|
|
|
},
|
|
|
- isRemianOldCheck:{
|
|
|
+ isRemianOldCheck: {
|
|
|
type: Boolean,
|
|
|
default: true,
|
|
|
},
|
|
|
- saveModalLoading:{
|
|
|
+ saveModalLoading: {
|
|
|
type: Boolean,
|
|
|
default: false,
|
|
|
},
|
|
|
- disabled:{
|
|
|
+ disabled: {
|
|
|
type: Boolean,
|
|
|
default: false,
|
|
|
},
|
|
|
|
|
|
})
|
|
|
-const emit = defineEmits([ 'close', 'finish'])
|
|
|
+const emit = defineEmits(['close', 'finish'])
|
|
|
const useAppState = useAppStore()
|
|
|
const contractInfo = ref(useAppState.getContractInfo)
|
|
|
const projectId = ref(useAppState.getProjectId || '')
|
|
@@ -112,15 +117,15 @@ const uuid = getRandom(4)
|
|
|
watch(qualityMoadal, (val) => {
|
|
|
if (val) {
|
|
|
nextTick(() => {
|
|
|
- setSplitRef()
|
|
|
- tableData.value = []
|
|
|
- oriCheckRows.value = getStoreValue('checkRows') || []
|
|
|
- if (!isRemianOldCheck.value) {
|
|
|
- oriCheckRows.value = []
|
|
|
- }
|
|
|
+ setSplitRef()
|
|
|
+ tableData.value = []
|
|
|
+ oriCheckRows.value = getStoreValue('checkRows') || []
|
|
|
+ if (!isRemianOldCheck.value) {
|
|
|
+ oriCheckRows.value = []
|
|
|
+ }
|
|
|
|
|
|
- })
|
|
|
- }
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
})
|
|
|
//初始化设置拖动分割线
|
|
@@ -156,7 +161,7 @@ const treeLoadNode = async ({ node, item, level }, resolve) => {
|
|
|
primaryKeyId,
|
|
|
parentId,
|
|
|
classifyType: classifyType.value,
|
|
|
- tableOwner:classifyType.value,
|
|
|
+ tableOwner: classifyType.value,
|
|
|
|
|
|
})
|
|
|
treeLoading.value = false
|
|
@@ -169,7 +174,7 @@ const tableColumn = [
|
|
|
{ key: 'appStatusName', name: '资料审核状态' },
|
|
|
]
|
|
|
|
|
|
-const qulModalClose = ()=>{
|
|
|
+const qulModalClose = () => {
|
|
|
qualityMoadal.value = false
|
|
|
setStoreValue('checkRows', [])
|
|
|
cancelcheck.value = []
|
|
@@ -195,12 +200,12 @@ const getTableData = async () => {
|
|
|
tableLoading.value = true
|
|
|
const { data } = await unitApi.getCurrentNodeAllForm({
|
|
|
...searchForm.value,
|
|
|
- contractId:cid.value,
|
|
|
- projectId:projectId.value,
|
|
|
- nodeId:curTree.value.pKeyId,
|
|
|
- contractIdRelation:curTree.value?.contractIdRelation || '',
|
|
|
+ contractId: cid.value,
|
|
|
+ projectId: projectId.value,
|
|
|
+ nodeId: curTree.value.pKeyId,
|
|
|
+ contractIdRelation: curTree.value?.contractIdRelation || '',
|
|
|
classifyType: classifyType.value,
|
|
|
- selectIds:selectId.value,
|
|
|
+ selectIds: selectId.value,
|
|
|
|
|
|
})
|
|
|
tableData.value = getArrValue(data['records'])
|
|
@@ -209,13 +214,13 @@ const getTableData = async () => {
|
|
|
|
|
|
let defaultarr = []
|
|
|
tableData.value.forEach((item) => {
|
|
|
- if (item.isSelect === 1) {
|
|
|
- defaultarr.push(item)
|
|
|
+ if (item.isSelect === 1) {
|
|
|
+ defaultarr.push(item)
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- tabtoggleSelection(defaultarr)
|
|
|
- })
|
|
|
+ tabtoggleSelection(defaultarr)
|
|
|
+ })
|
|
|
|
|
|
}
|
|
|
const tabtoggleSelection = (rows) => {
|
|
@@ -230,7 +235,7 @@ const tabtoggleSelection = (rows) => {
|
|
|
}
|
|
|
}
|
|
|
const curTree = ref(null)
|
|
|
-const nodeElTreeClick = ({ data })=>{
|
|
|
+const nodeElTreeClick = ({ data }) => {
|
|
|
curTree.value = data
|
|
|
searchForm.value.current = 1
|
|
|
getTableData()
|
|
@@ -243,63 +248,60 @@ const tableSelection = (rows) => {
|
|
|
|
|
|
}
|
|
|
const cancelcheck = ref([])
|
|
|
-const tableSelect = (rows)=>{
|
|
|
- const { selection, row } = rows
|
|
|
+const tableSelect = (rows) => {
|
|
|
+ const { selection, row } = rows
|
|
|
|
|
|
- const { appStatusName } = row
|
|
|
+ const { appStatusName } = row
|
|
|
|
|
|
|
|
|
- if (appStatusName !== '已审批') {
|
|
|
- window.$message.warning('只能勾选已审批的数据')
|
|
|
- qualTable.value?.toggleRowSelection(row, false)
|
|
|
- }
|
|
|
+ if (appStatusName !== '已审批') {
|
|
|
+ window.$message.warning('只能勾选已审批的数据')
|
|
|
+ qualTable.value?.toggleRowSelection(row, false)
|
|
|
+ }
|
|
|
|
|
|
- const isDel = isArrIndex( selection, 'selectId', row.selectId)
|
|
|
- if (!isDel) {
|
|
|
- cancelcheck.value.push( row.selectId)
|
|
|
- }
|
|
|
+ const isDel = isArrIndex(selection, 'selectId', row.selectId)
|
|
|
+ if (!isDel) {
|
|
|
+ cancelcheck.value.push(row.selectId)
|
|
|
+ }
|
|
|
}
|
|
|
-const tableSelectAll = (rows)=>{
|
|
|
- console.log(rows, 'rows')
|
|
|
- let arr = rows.filter(obj => obj.appStatusName !== '已审批')
|
|
|
- console.log(arr, 'arr')
|
|
|
- if (arr.length > 0) {
|
|
|
- window.$message.warning('只能勾选已审批的数据')
|
|
|
- qualTable.value?.clearSelection()
|
|
|
- return
|
|
|
- }
|
|
|
+const tableSelectAll = (rows) => {
|
|
|
+ console.log(rows, 'rows')
|
|
|
+ let arr = rows.filter(obj => obj.appStatusName !== '已审批')
|
|
|
+ console.log(arr, 'arr')
|
|
|
+ if (arr.length > 0) {
|
|
|
+ window.$message.warning('只能勾选已审批的数据')
|
|
|
+ qualTable.value?.clearSelection()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|
|
|
//之前选中的
|
|
|
-const saveQualModal = ()=>{
|
|
|
+const saveQualModal = () => {
|
|
|
if (disabled.value) {
|
|
|
window.$message.warning('自动计量的数据,不允许重新编辑修改关联质检资料')
|
|
|
return
|
|
|
}
|
|
|
- qualityMoadal.value = false
|
|
|
- emit('close')
|
|
|
- let alarr = arrUnion(tableKeys.value, oriCheckRows.value)
|
|
|
- // 使用reduce方法进行去重
|
|
|
- const uniqueArray = alarr.reduce((acc, current) => {
|
|
|
+ qualityMoadal.value = false
|
|
|
+ emit('close')
|
|
|
+ let alarr = arrUnion(tableKeys.value, oriCheckRows.value)
|
|
|
+ // 使用reduce方法进行去重
|
|
|
+ const uniqueArray = alarr.reduce((acc, current) => {
|
|
|
// 检查当前对象的某个字段是否已存在于累积数组中
|
|
|
const x = acc.find(item => item.selectId === current.selectId)
|
|
|
-
|
|
|
// 如果不存在,则将其添加到累积数组中
|
|
|
if (!x) {
|
|
|
return acc.concat([current])
|
|
|
} else {
|
|
|
return acc
|
|
|
}
|
|
|
- }, [])
|
|
|
-
|
|
|
- alarr = uniqueArray
|
|
|
- emit('finish', alarr, cancelcheck.value)
|
|
|
- setStoreValue('checkRows', alarr)
|
|
|
-
|
|
|
-
|
|
|
+ }, [])
|
|
|
+ alarr = uniqueArray
|
|
|
+ emit('finish', alarr, cancelcheck.value)
|
|
|
+ setStoreValue('checkRows', alarr)
|
|
|
+ window.$message.success('关联成功!')
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style lang='scss' scoped>
|
|
|
+<style lang="scss" scoped>
|
|
|
</style>
|