diff --git a/src/locales/en.ts b/src/locales/en.ts
index 5031015a..b5b1c14a 100644
--- a/src/locales/en.ts
+++ b/src/locales/en.ts
@@ -1274,7 +1274,9 @@ export default {
dvId: 'Please select device',
qrcodeLoadError: 'Failed to load QR code',
qrcodeEmpty: 'No QR code',
- validatorDeviceCodeRequired: 'Code can not be empty'
+ validatorDeviceCodeRequired: 'Code can not be empty',
+ gjTitle: 'Select key components',
+ bjTitle: 'Select spare parts',
},
// Critical Component
EquipmentKeyItems: {
@@ -2753,7 +2755,9 @@ export default {
validatorNameRequired: 'Name can not be empty',
validatorTypeRequired: 'Type can not be empty',
validatorSampleMethodRequired: 'Sampling method can not be empty',
- validatorValRequired: 'Value can not be empty'
+ validatorValRequired: 'Value can not be empty',
+ atIntervals:'at intervals',
+ extraction:'extraction',
},
ZjTask: {
moduleName: 'Inspection Task',
diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts
index ca5fdaf0..17e8d759 100644
--- a/src/locales/zh-CN.ts
+++ b/src/locales/zh-CN.ts
@@ -1266,7 +1266,9 @@ export default {
dvId: '请选择设备',
qrcodeLoadError: '二维码加载失败',
qrcodeEmpty: '暂无二维码',
- validatorDeviceCodeRequired: '编码不能为空'
+ validatorDeviceCodeRequired: '编码不能为空',
+ gjTitle: '选择关键件',
+ bjTitle: '选择备件',
},
// 设备关键件
EquipmentKeyItems: {
@@ -2263,7 +2265,9 @@ export default {
validatorNameRequired: '名称不能为空',
validatorTypeRequired: '类型不能为空',
validatorSampleMethodRequired: '抽检方式不能为空',
- validatorValRequired: '值不能为空'
+ validatorValRequired: '值不能为空',
+ atIntervals:'每间隔',
+ extraction:'抽取',
},
ZjTask: {
moduleName: '检验任务',
diff --git a/src/views/erp/component/in/components/StockInItemForm.vue b/src/views/erp/component/in/components/StockInItemForm.vue
index a236694a..29f20352 100644
--- a/src/views/erp/component/in/components/StockInItemForm.vue
+++ b/src/views/erp/component/in/components/StockInItemForm.vue
@@ -247,7 +247,7 @@ const getSummaries = (param: SummaryMethodProps) => {
const handleAdd = () => {
const row = {
id: undefined,
- warehouseId: 11,
+ warehouseId: 10,
productId: undefined,
productUnitName: undefined, // 产品单位
productBarCode: undefined, // 产品条码
diff --git a/src/views/erp/product/unit/index.vue b/src/views/erp/product/unit/index.vue
index 62fdc3b5..1cb4ef60 100644
--- a/src/views/erp/product/unit/index.vue
+++ b/src/views/erp/product/unit/index.vue
@@ -54,7 +54,7 @@
type="warning"
plain
@click="handleImport"
- v-hasPermi="['system:user:import']"
+ v-hasPermi="['erp:product-unit:export']"
>
{{ t('FactoryModeling.ProductUnit.importButtonText') }}
@@ -148,7 +148,7 @@ import download from '@/utils/download'
import { ProductUnitApi, ProductUnitVO } from '@/api/erp/product/unit'
import ProductUnitForm from './ProductUnitForm.vue'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
-
+import ProductUnitImportForm from './ProductUnitImportForm.vue'
/** ERP 产品单位列表 */
defineOptions({ name: 'ErpProductUnit' })
diff --git a/src/views/mes/deviceledger/DeviceLedgerForm.vue b/src/views/mes/deviceledger/DeviceLedgerForm.vue
index c18c6c4e..ee14b64a 100644
--- a/src/views/mes/deviceledger/DeviceLedgerForm.vue
+++ b/src/views/mes/deviceledger/DeviceLedgerForm.vue
@@ -232,7 +232,7 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ t('common.query') }}
+
+
+
+ {{ t('common.reset') }}
+
+
+
+
+
+
+
+
+
+
+ {{ scope.row.zjTypeName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ t('common.cancel') }}
@@ -167,17 +233,30 @@
import { getDictOptions } from '@/utils/dict'
import { ZjSchemaApi, ZjSchemaVO } from '@/api/mes/zjschema'
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' })
+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([]) // 列表
const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗
-
+const loading = ref(true)
const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const formType = ref('') // 表单的类型:create - 新增;update - 修改
+const queryFormRef = ref()
const formData = ref({
type: 'All' 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' }],
})
const formRef = ref() // 表单 Ref
-
+const list = ref([])
+const selectedRows = ref([])
+const total = ref(0)
+const multipleTableRef = ref>()
+const selectedIds = ref([])
const isSampleType = computed(() => {
const type = formData.value.type
return type === 'Sample'
@@ -215,13 +298,13 @@ const isSampleType = computed(() => {
const isRateMethod = computed(() => formData.value.sampleMethod === 'Rate')
const isGapMethod = computed(() => formData.value.sampleMethod === 'Gap')
-const displayItemNames = computed(() => {
- if (!selectedItemIds.value.length) return ''
+const displayItemNames = computed( () => {
+ if (!ids.value.length)return ''
if (!itemList.value.length) {
return formData.value.item ? String(formData.value.item) : ''
}
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))
.filter((name) => name)
return names.join(',')
@@ -303,6 +386,15 @@ watch(
}
)
+// 方法1:直接监听 data
+watch(list, (newData, oldData) => {
+ // 可以在这里执行相关操作
+ if (newData.length > 0) {
+ // 数据加载完成后的操作
+ setDefaultSelections()
+ }
+}, { deep: true })
+
const openItemDialog = async () => {
itemDialogVisible.value = true
if (!itemList.value.length) {
@@ -320,18 +412,17 @@ const openItemDialog = async () => {
const initSelectedItemIds = () => {
if (!formData.value.item) {
- selectedItemIds.value = []
+ ids.value = []
return
}
- const ids = String(formData.value.item)
- .split(',')
- .map((v) => Number(v.trim()))
- .filter((v) => !Number.isNaN(v))
- selectedItemIds.value = ids
+ let s = formData.value.item.toString();
+ let allIds =formData.value.item!=undefined?formData.value.item.toString().split(','):[]
+ ids.value =allIds.map((id) => Number(id))
+ selectedItemIds.value = allIds.map((id) => Number(id))
}
const confirmSelectItems = () => {
- formData.value.item = selectedItemIds.value.join(',')
+ formData.value.item = ids.value.join(',')
itemDialogVisible.value = false
}
@@ -364,6 +455,7 @@ const open = async (type: string, id?: number) => {
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
+ initSelectedItems()
// 修改时,设置数据
if (id) {
formLoading.value = true
@@ -386,6 +478,8 @@ const open = async (type: string, id?: number) => {
} finally {
formLoading.value = false
}
+ }else{
+ ids.value=[]
}
}
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
@@ -449,6 +543,149 @@ const resetForm = () => {
targetCheckedKeys.value = []
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()
+})