|
@@ -31,10 +31,11 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { nextTick, ref, watch } from 'vue'
|
|
|
-import { getArrValue, getObjValue, getRandom } from 'js-fast-way'
|
|
|
+import { arrUnion, getArrValue, getObjValue, getRandom } from 'js-fast-way'
|
|
|
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,
|
|
@@ -64,6 +65,9 @@ const qualityMoadal = ref(props.qualityMoadal)
|
|
|
const cid = ref(props.cid)
|
|
|
const periodId = ref(props.periodId)
|
|
|
const selectId = ref(props.selectId)
|
|
|
+
|
|
|
+//之前节点选中的数据
|
|
|
+const oriCheckRows = ref([])
|
|
|
watch(() => [
|
|
|
props.qualityMoadal,
|
|
|
props.cid,
|
|
@@ -83,6 +87,8 @@ watch(qualityMoadal, (val) => {
|
|
|
nextTick(() => {
|
|
|
setSplitRef()
|
|
|
tableData.value = []
|
|
|
+ oriCheckRows.value = getStoreValue('checkRows')
|
|
|
+
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -135,6 +141,7 @@ const tableColumn = [
|
|
|
|
|
|
const qulModalClose = ()=>{
|
|
|
qualityMoadal.value = false
|
|
|
+ setStoreValue('checkRows', [])
|
|
|
emit('close')
|
|
|
}
|
|
|
|
|
@@ -201,12 +208,29 @@ const nodeElTreeClick = ({ node, data, keys })=>{
|
|
|
const tableKeys = ref([])
|
|
|
const tableSelection = (rows) => {
|
|
|
tableKeys.value = rows
|
|
|
+
|
|
|
}
|
|
|
+//之前选中的
|
|
|
const saveQualModal = ()=>{
|
|
|
if ( tableKeys.value.length > 0) {
|
|
|
qualityMoadal.value = false
|
|
|
emit('close')
|
|
|
- emit('finish', tableKeys.value)
|
|
|
+ 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)
|
|
|
+ setStoreValue('checkRows', alarr)
|
|
|
} else {
|
|
|
window.$message.warning('请先选择你要关联的质检资料')
|
|
|
emit('close')
|