|
@@ -1,6 +1,21 @@
|
|
<template>
|
|
<template>
|
|
<Dialog v-model="dialogVisible" :title="t('iotMaintain.selectMaterials')"
|
|
<Dialog v-model="dialogVisible" :title="t('iotMaintain.selectMaterials')"
|
|
style="width: 1300px; min-height: 300px" :close-on-click-modal="false" @close="handleClose">
|
|
style="width: 1300px; min-height: 300px" :close-on-click-modal="false" @close="handleClose">
|
|
|
|
+
|
|
|
|
+ <!-- 新增设备分类和BOM节点信息显示 -->
|
|
|
|
+ <div style="margin: 0 0px 15px; background: #f5f7fa; padding: 12px 20px; border-radius: 4px;">
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <span style="font-weight: bold; margin-right: 10px;">设备分类:</span>
|
|
|
|
+ <span>{{ deviceCategoryName }}</span>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <span style="font-weight: bold; margin-right: 10px;">BOM节点:</span>
|
|
|
|
+ <span>{{ bomNodeName }}</span>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
<ContentWrap>
|
|
<ContentWrap>
|
|
<el-form
|
|
<el-form
|
|
class="-mb-15px"
|
|
class="-mb-15px"
|
|
@@ -50,6 +65,28 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
</ContentWrap>
|
|
</ContentWrap>
|
|
|
|
+
|
|
|
|
+ <!-- 新增:已选物料标签区域 -->
|
|
|
|
+ <ContentWrap v-if="selectedRows.length > 0"
|
|
|
|
+ style="margin: -10px 0px 10px; padding: 10px 15px; background: #f8fafc; border-radius: 4px; border: 1px solid #ebeef5;">
|
|
|
|
+ <div style="display: flex; align-items: center; flex-wrap: wrap; gap: 8px;">
|
|
|
|
+ <div style="font-weight: bold; color: #606266; margin-right: 10px;">已选物料:</div>
|
|
|
|
+ <el-tag
|
|
|
|
+ v-for="item in selectedRows"
|
|
|
|
+ :key="item.id"
|
|
|
|
+ closable
|
|
|
|
+ @close="removeTag(item)"
|
|
|
|
+ style="margin-bottom: 5px; position: relative; padding-right: 25px;"
|
|
|
|
+ >
|
|
|
|
+ {{ item.name }}-{{ item.code }}
|
|
|
|
+ <!-- 自定义关闭按钮 -->
|
|
|
|
+ <span class="close-icon" @click.stop="removeTag(item)">
|
|
|
|
+ <Icon icon="ep:close" style="font-size: 12px; position: absolute; right: 8px; top: 50%; transform: translateY(-50%);"/>
|
|
|
|
+ </span>
|
|
|
|
+ </el-tag>
|
|
|
|
+ </div>
|
|
|
|
+ </ContentWrap>
|
|
|
|
+
|
|
<ContentWrap>
|
|
<ContentWrap>
|
|
<el-table
|
|
<el-table
|
|
ref="tableRef"
|
|
ref="tableRef"
|
|
@@ -117,6 +154,9 @@ const total = ref(0) // 列表的总页数
|
|
const selectedRows = ref<MaterialApi.MaterialVO[]>([]); // 多选数据(存储所有选中行的数组)
|
|
const selectedRows = ref<MaterialApi.MaterialVO[]>([]); // 多选数据(存储所有选中行的数组)
|
|
const tableRef = ref();
|
|
const tableRef = ref();
|
|
|
|
|
|
|
|
+const deviceCategoryName = ref('') // 存储设备分类名称
|
|
|
|
+const bomNodeName = ref('') // 存储BOM节点名称
|
|
|
|
+
|
|
const queryParams = reactive({
|
|
const queryParams = reactive({
|
|
pageNo: 1,
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
@@ -146,7 +186,11 @@ const selectRow = (row) => {
|
|
const handleRowClick = (row) => {
|
|
const handleRowClick = (row) => {
|
|
selectRow(row);
|
|
selectRow(row);
|
|
};
|
|
};
|
|
-const open = async (type: string, id?: number) => {
|
|
|
|
|
|
+const open = async (row: any) => {
|
|
|
|
+ // 设置传递过来的设备分类名称和BOM节点名称
|
|
|
|
+ deviceCategoryName.value = row.deviceCategoryName || ''
|
|
|
|
+ bomNodeName.value = row.name || ''
|
|
|
|
+
|
|
queryParams.name = '';
|
|
queryParams.name = '';
|
|
queryParams.code = '';
|
|
queryParams.code = '';
|
|
dialogVisible.value = true
|
|
dialogVisible.value = true
|
|
@@ -170,6 +214,23 @@ const handleClose = () => {
|
|
emit('close')
|
|
emit('close')
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+// 新增:移除标签方法
|
|
|
|
+const removeTag = (material: MaterialApi.MaterialVO) => {
|
|
|
|
+ // 从已选列表中移除
|
|
|
|
+ const index = selectedRows.value.findIndex(item => item.id === material.id);
|
|
|
|
+ if (index !== -1) {
|
|
|
|
+ selectedRows.value.splice(index, 1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 如果当前行在当前页,取消其选中状态
|
|
|
|
+ const rowInTable = list.value.find(item => item.id === material.id);
|
|
|
|
+ if (rowInTable) {
|
|
|
|
+ const rowIndex = list.value.indexOf(rowInTable);
|
|
|
|
+ // 这里可以添加逻辑强制更新行状态(如果需要)
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+
|
|
// 确认选择
|
|
// 确认选择
|
|
const handleConfirm = () => {
|
|
const handleConfirm = () => {
|
|
if (selectedRows.value.length === 0) {
|
|
if (selectedRows.value.length === 0) {
|
|
@@ -235,4 +296,25 @@ onMounted(async () => {
|
|
border-color: #c2dca8;
|
|
border-color: #c2dca8;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// 新增标签样式
|
|
|
|
+.close-icon {
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ color: #999;
|
|
|
|
+ transition: color 0.2s;
|
|
|
|
+
|
|
|
|
+ &:hover {
|
|
|
|
+ color: #ff4d4f;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.el-tag {
|
|
|
|
+ position: relative;
|
|
|
|
+ padding-right: 25px;
|
|
|
|
+ transition: all 0.3s;
|
|
|
|
+
|
|
|
|
+ &:hover {
|
|
|
|
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
</style>
|
|
</style>
|