|
|
|
@ -33,9 +33,9 @@
|
|
|
|
<span class="ml-8px">%</span>
|
|
|
|
<span class="ml-8px">%</span>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<template v-else-if="isGapMethod">
|
|
|
|
<template v-else-if="isGapMethod">
|
|
|
|
<span>每间隔</span>
|
|
|
|
<span>{{ t('QualityManagement.ZjSchema.atIntervals') }}</span>
|
|
|
|
<el-input-number v-model="gapInterval" :min="1" class="!w-120px mx-8px" :controls="false" />
|
|
|
|
<el-input-number v-model="gapInterval" :min="1" class="!w-120px mx-8px" :controls="false" />
|
|
|
|
<span>抽取</span>
|
|
|
|
<span>{{ t('QualityManagement.ZjSchema.extraction') }}</span>
|
|
|
|
<el-input-number v-model="gapCount" :min="1" class="!w-120px mx-8px" :controls="false" />
|
|
|
|
<el-input-number v-model="gapCount" :min="1" class="!w-120px mx-8px" :controls="false" />
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<template v-else>
|
|
|
|
@ -46,20 +46,23 @@
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item :label="t('QualityManagement.ZjSchema.item')" prop="item">
|
|
|
|
<el-form-item :label="t('QualityManagement.ZjSchema.item')" prop="item">
|
|
|
|
<el-row :gutter="8" class="w-full">
|
|
|
|
<el-input :model-value="displayItemNames" readonly clearable class="device-ledger-selection-input"
|
|
|
|
<el-col :span="22">
|
|
|
|
:placeholder="t('QualityManagement.ZjSchema.placeholderItem')"
|
|
|
|
<el-input
|
|
|
|
@click="openCriticalComponentDialog" @clear="clearBeijian" />
|
|
|
|
:model-value="displayItemNames"
|
|
|
|
<!-- <el-row :gutter="8" class="w-full">
|
|
|
|
:placeholder="t('QualityManagement.ZjSchema.placeholderItem')"
|
|
|
|
<el-col :span="22">
|
|
|
|
readonly
|
|
|
|
<el-input
|
|
|
|
/>
|
|
|
|
:model-value="displayItemNames"
|
|
|
|
</el-col>
|
|
|
|
:placeholder="t('QualityManagement.ZjSchema.placeholderItem')"
|
|
|
|
<el-col :span="2" class="text-right">
|
|
|
|
readonly
|
|
|
|
<el-button type="primary" @click="openItemDialog">
|
|
|
|
/>
|
|
|
|
{{ t('action.select') }}
|
|
|
|
</el-col>
|
|
|
|
</el-button>
|
|
|
|
<el-col :span="2" class="text-right">
|
|
|
|
</el-col>
|
|
|
|
<el-button type="primary" @click="openItemDialog">
|
|
|
|
</el-row>
|
|
|
|
{{ t('action.select') }}
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
</el-row>-->
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item :label="t('QualityManagement.ZjSchema.remark')" prop="remark">
|
|
|
|
<el-form-item :label="t('QualityManagement.ZjSchema.remark')" prop="remark">
|
|
|
|
<el-input
|
|
|
|
<el-input
|
|
|
|
@ -80,10 +83,10 @@
|
|
|
|
<el-dialog
|
|
|
|
<el-dialog
|
|
|
|
v-model="itemDialogVisible"
|
|
|
|
v-model="itemDialogVisible"
|
|
|
|
:title="t('QualityManagement.ZjSchema.selectItemDialogTitle')"
|
|
|
|
:title="t('QualityManagement.ZjSchema.selectItemDialogTitle')"
|
|
|
|
width="920px"
|
|
|
|
width="1300px"
|
|
|
|
draggable
|
|
|
|
draggable
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<div v-loading="itemLoading">
|
|
|
|
<!-- <div v-loading="itemLoading">
|
|
|
|
<div class="formula-config-picklist">
|
|
|
|
<div class="formula-config-picklist">
|
|
|
|
<div class="formula-config-panel">
|
|
|
|
<div class="formula-config-panel">
|
|
|
|
<div class="formula-config-panel__header">
|
|
|
|
<div class="formula-config-panel__header">
|
|
|
|
@ -152,7 +155,70 @@
|
|
|
|
</el-table>
|
|
|
|
</el-table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>-->
|
|
|
|
|
|
|
|
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" min-label-width="68px"
|
|
|
|
|
|
|
|
style="margin-bottom: 10px">
|
|
|
|
|
|
|
|
<el-form-item :label="t('QualityManagement.ZjItem.zjType')" prop="zjType">
|
|
|
|
|
|
|
|
<el-select
|
|
|
|
|
|
|
|
v-model="queryParams.zjType"
|
|
|
|
|
|
|
|
clearable
|
|
|
|
|
|
|
|
filterable
|
|
|
|
|
|
|
|
:placeholder="t('QualityManagement.ZjItem.placeholderZjType')"
|
|
|
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item :label="t('QualityManagement.ZjItem.name')" prop="name">
|
|
|
|
|
|
|
|
<el-input
|
|
|
|
|
|
|
|
v-model="queryParams.name"
|
|
|
|
|
|
|
|
:placeholder="t('QualityManagement.ZjItem.placeholderName')"
|
|
|
|
|
|
|
|
clearable
|
|
|
|
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
|
|
|
class="!w-240px" />
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item :label="t('QualityManagement.ZjItem.remark')" prop="remark">
|
|
|
|
|
|
|
|
<el-input
|
|
|
|
|
|
|
|
v-model="queryParams.remark"
|
|
|
|
|
|
|
|
:placeholder="t('QualityManagement.ZjItem.placeholderRemark')"
|
|
|
|
|
|
|
|
clearable
|
|
|
|
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
|
|
|
class="!w-240px" />
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item>
|
|
|
|
|
|
|
|
<el-button @click="handleQuery">
|
|
|
|
|
|
|
|
<Icon icon="ep:search" class="mr-5px" />
|
|
|
|
|
|
|
|
{{ t('common.query') }}
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
<el-button @click="resetQuery">
|
|
|
|
|
|
|
|
<Icon icon="ep:refresh" class="mr-5px" />
|
|
|
|
|
|
|
|
{{ t('common.reset') }}
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
<ContentWrap>
|
|
|
|
|
|
|
|
<el-table ref="multipleTableRef" v-loading="loading" :data="list" :stripe="true"
|
|
|
|
|
|
|
|
@selection-change="handleSelectionChange" @select="handleSelect" @select-all="handleSelectAll" :show-overflow-tooltip="true" row-key="id">
|
|
|
|
|
|
|
|
<el-table-column type="selection" width="55" :reserve-selection="true" />
|
|
|
|
|
|
|
|
<el-table-column :label="t('QualityManagement.ZjItem.name')" align="center" prop="name" sortable />
|
|
|
|
|
|
|
|
<el-table-column :label="t('QualityManagement.ZjItem.tool')" align="center" prop="tool" />
|
|
|
|
|
|
|
|
<el-table-column :label="t('QualityManagement.ZjItem.zjType')" align="center" prop="zjTypeName" sortable>
|
|
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
|
|
<el-tag>{{ scope.row.zjTypeName }}</el-tag>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
<el-table-column :label="t('QualityManagement.ZjItem.standardVal')" align="center" prop="standardVal" />
|
|
|
|
|
|
|
|
<el-table-column :label="t('QualityManagement.ZjItem.upperVal')" align="center" prop="upperVal" />
|
|
|
|
|
|
|
|
<el-table-column :label="t('QualityManagement.ZjItem.lowerVal')" align="center" prop="lowerVal" />
|
|
|
|
|
|
|
|
<el-table-column :label="t('QualityManagement.ZjItem.unit')" align="center" prop="unitName" sortable />
|
|
|
|
|
|
|
|
<el-table-column :label="t('QualityManagement.ZjItem.remark')" align="center" prop="remark" />
|
|
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Pagination :total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize"
|
|
|
|
|
|
|
|
@pagination="getList" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</ContentWrap>
|
|
|
|
|
|
|
|
|
|
|
|
<template #footer>
|
|
|
|
<template #footer>
|
|
|
|
<el-button @click="itemDialogVisible = false">
|
|
|
|
<el-button @click="itemDialogVisible = false">
|
|
|
|
{{ t('common.cancel') }}
|
|
|
|
{{ t('common.cancel') }}
|
|
|
|
@ -167,17 +233,30 @@
|
|
|
|
import { getDictOptions } from '@/utils/dict'
|
|
|
|
import { getDictOptions } from '@/utils/dict'
|
|
|
|
import { ZjSchemaApi, ZjSchemaVO } from '@/api/mes/zjschema'
|
|
|
|
import { ZjSchemaApi, ZjSchemaVO } from '@/api/mes/zjschema'
|
|
|
|
import { ZjItemApi, ZjItemVO } from '@/api/mes/zjitem'
|
|
|
|
import { ZjItemApi, ZjItemVO } from '@/api/mes/zjitem'
|
|
|
|
|
|
|
|
import {ref} from "vue";
|
|
|
|
|
|
|
|
import {ElTable} from "element-plus";
|
|
|
|
|
|
|
|
import {ZjTypeApi, ZjTypeVO} from "@/api/mes/zjtype";
|
|
|
|
/** 检验方案 表单 */
|
|
|
|
/** 检验方案 表单 */
|
|
|
|
defineOptions({ name: 'ZjSchemaForm' })
|
|
|
|
defineOptions({ name: 'ZjSchemaForm' })
|
|
|
|
|
|
|
|
const queryParams = reactive({
|
|
|
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
|
|
|
code: undefined as string | undefined,
|
|
|
|
|
|
|
|
name: undefined as string | undefined,
|
|
|
|
|
|
|
|
description: undefined as string | undefined,
|
|
|
|
|
|
|
|
remark: undefined as string | undefined,
|
|
|
|
|
|
|
|
createTime: [] as string[]
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const typeList = ref<ZjTypeVO[]>([]) // 列表
|
|
|
|
const { t } = useI18n() // 国际化
|
|
|
|
const { t } = useI18n() // 国际化
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
|
|
|
|
|
|
const loading = ref(true)
|
|
|
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
|
|
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
|
|
|
const dialogTitle = ref('') // 弹窗的标题
|
|
|
|
const dialogTitle = ref('') // 弹窗的标题
|
|
|
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
|
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
|
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
|
|
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
|
|
|
|
|
|
|
const queryFormRef = ref()
|
|
|
|
const formData = ref({
|
|
|
|
const formData = ref({
|
|
|
|
type: 'All' as string | undefined,
|
|
|
|
type: 'All' as string | undefined,
|
|
|
|
name: undefined as string | undefined,
|
|
|
|
name: undefined as string | undefined,
|
|
|
|
@ -206,7 +285,11 @@ const formRules = reactive({
|
|
|
|
val: [{ validator: (_: any, __: any, callback: any) => validateVal(callback), trigger: 'blur' }],
|
|
|
|
val: [{ validator: (_: any, __: any, callback: any) => validateVal(callback), trigger: 'blur' }],
|
|
|
|
})
|
|
|
|
})
|
|
|
|
const formRef = ref() // 表单 Ref
|
|
|
|
const formRef = ref() // 表单 Ref
|
|
|
|
|
|
|
|
const list = ref<ZjItemVO[]>([])
|
|
|
|
|
|
|
|
const selectedRows = ref<any[]>([])
|
|
|
|
|
|
|
|
const total = ref(0)
|
|
|
|
|
|
|
|
const multipleTableRef = ref<InstanceType<typeof ElTable>>()
|
|
|
|
|
|
|
|
const selectedIds = ref<number[]>([])
|
|
|
|
const isSampleType = computed(() => {
|
|
|
|
const isSampleType = computed(() => {
|
|
|
|
const type = formData.value.type
|
|
|
|
const type = formData.value.type
|
|
|
|
return type === 'Sample'
|
|
|
|
return type === 'Sample'
|
|
|
|
@ -215,13 +298,13 @@ const isSampleType = computed(() => {
|
|
|
|
const isRateMethod = computed(() => formData.value.sampleMethod === 'Rate')
|
|
|
|
const isRateMethod = computed(() => formData.value.sampleMethod === 'Rate')
|
|
|
|
const isGapMethod = computed(() => formData.value.sampleMethod === 'Gap')
|
|
|
|
const isGapMethod = computed(() => formData.value.sampleMethod === 'Gap')
|
|
|
|
|
|
|
|
|
|
|
|
const displayItemNames = computed(() => {
|
|
|
|
const displayItemNames = computed( () => {
|
|
|
|
if (!selectedItemIds.value.length) return ''
|
|
|
|
if (!ids.value.length)return ''
|
|
|
|
if (!itemList.value.length) {
|
|
|
|
if (!itemList.value.length) {
|
|
|
|
return formData.value.item ? String(formData.value.item) : ''
|
|
|
|
return formData.value.item ? String(formData.value.item) : ''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const map = new Map(itemList.value.map((item) => [item.id, item.name]))
|
|
|
|
const map = new Map(itemList.value.map((item) => [item.id, item.name]))
|
|
|
|
const names = selectedItemIds.value
|
|
|
|
const names = ids.value
|
|
|
|
.map((id) => map.get(id))
|
|
|
|
.map((id) => map.get(id))
|
|
|
|
.filter((name) => name)
|
|
|
|
.filter((name) => name)
|
|
|
|
return names.join(',')
|
|
|
|
return names.join(',')
|
|
|
|
@ -303,6 +386,15 @@ watch(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 方法1:直接监听 data
|
|
|
|
|
|
|
|
watch(list, (newData, oldData) => {
|
|
|
|
|
|
|
|
// 可以在这里执行相关操作
|
|
|
|
|
|
|
|
if (newData.length > 0) {
|
|
|
|
|
|
|
|
// 数据加载完成后的操作
|
|
|
|
|
|
|
|
setDefaultSelections()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, { deep: true })
|
|
|
|
|
|
|
|
|
|
|
|
const openItemDialog = async () => {
|
|
|
|
const openItemDialog = async () => {
|
|
|
|
itemDialogVisible.value = true
|
|
|
|
itemDialogVisible.value = true
|
|
|
|
if (!itemList.value.length) {
|
|
|
|
if (!itemList.value.length) {
|
|
|
|
@ -320,18 +412,17 @@ const openItemDialog = async () => {
|
|
|
|
|
|
|
|
|
|
|
|
const initSelectedItemIds = () => {
|
|
|
|
const initSelectedItemIds = () => {
|
|
|
|
if (!formData.value.item) {
|
|
|
|
if (!formData.value.item) {
|
|
|
|
selectedItemIds.value = []
|
|
|
|
ids.value = []
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const ids = String(formData.value.item)
|
|
|
|
let s = formData.value.item.toString();
|
|
|
|
.split(',')
|
|
|
|
let allIds =formData.value.item!=undefined?formData.value.item.toString().split(','):[]
|
|
|
|
.map((v) => Number(v.trim()))
|
|
|
|
ids.value =allIds.map((id) => Number(id))
|
|
|
|
.filter((v) => !Number.isNaN(v))
|
|
|
|
selectedItemIds.value = allIds.map((id) => Number(id))
|
|
|
|
selectedItemIds.value = ids
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const confirmSelectItems = () => {
|
|
|
|
const confirmSelectItems = () => {
|
|
|
|
formData.value.item = selectedItemIds.value.join(',')
|
|
|
|
formData.value.item = ids.value.join(',')
|
|
|
|
itemDialogVisible.value = false
|
|
|
|
itemDialogVisible.value = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -364,6 +455,7 @@ const open = async (type: string, id?: number) => {
|
|
|
|
dialogTitle.value = t('action.' + type)
|
|
|
|
dialogTitle.value = t('action.' + type)
|
|
|
|
formType.value = type
|
|
|
|
formType.value = type
|
|
|
|
resetForm()
|
|
|
|
resetForm()
|
|
|
|
|
|
|
|
initSelectedItems()
|
|
|
|
// 修改时,设置数据
|
|
|
|
// 修改时,设置数据
|
|
|
|
if (id) {
|
|
|
|
if (id) {
|
|
|
|
formLoading.value = true
|
|
|
|
formLoading.value = true
|
|
|
|
@ -386,6 +478,8 @@ const open = async (type: string, id?: number) => {
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
formLoading.value = false
|
|
|
|
formLoading.value = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
ids.value=[]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
|
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
|
|
@ -449,6 +543,149 @@ const resetForm = () => {
|
|
|
|
targetCheckedKeys.value = []
|
|
|
|
targetCheckedKeys.value = []
|
|
|
|
formRef.value?.resetFields()
|
|
|
|
formRef.value?.resetFields()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleQuery = () => {
|
|
|
|
|
|
|
|
queryParams.pageNo = 1
|
|
|
|
|
|
|
|
getList()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const resetQuery = () => {
|
|
|
|
|
|
|
|
queryFormRef.value.resetFields()
|
|
|
|
|
|
|
|
handleQuery()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
|
|
|
loading.value = true
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
const data = await ZjItemApi.getZjItemPage(queryParams)
|
|
|
|
|
|
|
|
list.value = data.list
|
|
|
|
|
|
|
|
total.value = data.total
|
|
|
|
|
|
|
|
// 数据加载后,重新设置选中状态
|
|
|
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
|
|
|
toggleSelection()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
loading.value = false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const initSelectedItems = async () => {
|
|
|
|
|
|
|
|
if (!itemList.value.length) {
|
|
|
|
|
|
|
|
itemLoading.value = true
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
itemList.value = await ZjItemApi.getZjItemList()
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
itemLoading.value = false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ids = ref([])
|
|
|
|
|
|
|
|
const handleSelectionChange = (rows: ZjItemVO[]) => {
|
|
|
|
|
|
|
|
selectedIds.value = rows.map((r) => r.id).filter((id): id is number => typeof id === 'number')
|
|
|
|
|
|
|
|
// 获取当前页所有行的 id
|
|
|
|
|
|
|
|
const currentPageIds = rows.map(item => item.id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 从已选中的数组中移除当前页的数据
|
|
|
|
|
|
|
|
selectedRows.value = selectedRows.value.filter(
|
|
|
|
|
|
|
|
item => !currentPageIds.includes(item.id)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
// 添加当前页新选中的数据
|
|
|
|
|
|
|
|
selectedRows.value.push(...rows)
|
|
|
|
|
|
|
|
let a=1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 存储当前已选中的行
|
|
|
|
|
|
|
|
const currentSelectedRows = ref([])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// select 事件:row 是当前操作的行,selected 是操作后的状态
|
|
|
|
|
|
|
|
const handleSelect = (selection, row) => {
|
|
|
|
|
|
|
|
// 判断是选中还是取消选中
|
|
|
|
|
|
|
|
const isSelected = selection.includes(row)
|
|
|
|
|
|
|
|
if (isSelected) {
|
|
|
|
|
|
|
|
// console.log(`✅ 行被选中: ID=${row.id}, Name=${row.name}`)
|
|
|
|
|
|
|
|
ids.value.push(row.id)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ids.value = ids.value.filter(
|
|
|
|
|
|
|
|
item => item !== row.id
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
// console.log(`❌ 行被取消选中: ID=${row.id}, Name=${row.name}`)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 更新当前选中状态
|
|
|
|
|
|
|
|
currentSelectedRows.value = selection
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleSelectAll = (selection) => {
|
|
|
|
|
|
|
|
let initIds=selection?.map((row) => row.id).filter((id) => id !== undefined) ?? []
|
|
|
|
|
|
|
|
ids.value =initIds.map((id) => Number(id))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const openCriticalComponentDialog = async () => {
|
|
|
|
|
|
|
|
itemDialogVisible.value = true
|
|
|
|
|
|
|
|
let initIds= formData.value.item!=undefined?formData.value.item.toString().split(","):[]
|
|
|
|
|
|
|
|
ids.value=initIds.map((id) => Number(id))
|
|
|
|
|
|
|
|
/* initSelectedItemIds()
|
|
|
|
|
|
|
|
sourceCheckedKeys.value = []
|
|
|
|
|
|
|
|
targetCheckedKeys.value = []*/
|
|
|
|
|
|
|
|
setDefaultSelections()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 切换选中状态
|
|
|
|
|
|
|
|
const toggleSelection = () => {
|
|
|
|
|
|
|
|
if (!multipleTableRef.value || !selectedRows.value.length) return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 遍历当前页的数据
|
|
|
|
|
|
|
|
list.value.forEach(row => {
|
|
|
|
|
|
|
|
// 检查这一行是否在已选中数组中
|
|
|
|
|
|
|
|
const isSelected = selectedRows.value.some(item => item.id === row.id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isSelected) {
|
|
|
|
|
|
|
|
// 如果应该选中,就选中
|
|
|
|
|
|
|
|
multipleTableRef.value!.toggleRowSelection(row, true)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 否则取消选中
|
|
|
|
|
|
|
|
multipleTableRef.value!.toggleRowSelection(row, false)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const clearBeijian = () => {
|
|
|
|
|
|
|
|
formData.value.item = ''
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置默认选中的行
|
|
|
|
|
|
|
|
const setDefaultSelections = () => {
|
|
|
|
|
|
|
|
// 等待DOM更新完成
|
|
|
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
|
|
|
if (!multipleTableRef.value) return
|
|
|
|
|
|
|
|
multipleTableRef.value.clearSelection()
|
|
|
|
|
|
|
|
// const rawSubjectIds = toRaw(formData.value.item!=undefined?formData.value.item.toString().split(","):[])
|
|
|
|
|
|
|
|
let initIds= formData.value.item!=undefined?formData.value.item.toString().split(","):[]
|
|
|
|
|
|
|
|
const rawSubjectIds =initIds.map((id) => Number(id))
|
|
|
|
|
|
|
|
if (rawSubjectIds.length != 0) {
|
|
|
|
|
|
|
|
let row = {
|
|
|
|
|
|
|
|
id: undefined
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
multipleTableRef.value.toggleRowSelection(row, true)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 遍历数据,找到需要选中的行
|
|
|
|
|
|
|
|
list.value.forEach(row => {
|
|
|
|
|
|
|
|
let id = row.id;
|
|
|
|
|
|
|
|
if (rawSubjectIds.includes(row.id)) {
|
|
|
|
|
|
|
|
multipleTableRef.value.toggleRowSelection(row, true)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 初始化 **/
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
|
|
|
typeList.value = await ZjTypeApi.getZjTypeList()
|
|
|
|
|
|
|
|
getList()
|
|
|
|
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
<style scoped>
|
|
|
|
|