|
@@ -26,44 +26,58 @@
|
|
<el-table-column label="物料名称" align="center" prop="name" />
|
|
<el-table-column label="物料名称" align="center" prop="name" />
|
|
<el-table-column label="单位" align="center" prop="unit" />
|
|
<el-table-column label="单位" align="center" prop="unit" />
|
|
<el-table-column label="单价" align="center" prop="price" />
|
|
<el-table-column label="单价" align="center" prop="price" />
|
|
- <el-table-column label="消耗数量" align="center" prop="depleteCount" />
|
|
|
|
|
|
+ <el-table-column label="消耗数量" align="center" prop="depleteCount" >
|
|
|
|
+ <template #default="scope">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="scope.row.depleteCount"
|
|
|
|
+ />
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
<el-table-column label="总库存数量" align="center" prop="totalCount" />
|
|
<el-table-column label="总库存数量" align="center" prop="totalCount" />
|
|
- <el-table-column label="备注" align="center" prop="remark" />
|
|
|
|
|
|
+ <el-table-column label="备注" align="center" prop="remark" >
|
|
|
|
+ <template #default="scope">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="scope.row.remark"
|
|
|
|
+ />
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
<el-table-column label="物料来源" align="center" prop="sourceType" />
|
|
<el-table-column label="物料来源" align="center" prop="sourceType" />
|
|
<el-table-column label="操作" align="center" min-width="120px">
|
|
<el-table-column label="操作" align="center" min-width="120px">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
- <div style="display: flex; justify-content: center;align-items: center;width: 100%">
|
|
|
|
|
|
+ <div style="display: flex; justify-content: center; align-items: center; width: 100%">
|
|
<div>
|
|
<div>
|
|
- <Icon style="vertical-align: middle;color: #ea3434" icon="ep:zoom-out"/>
|
|
|
|
- <el-button style="vertical-align: middle" link type="danger" @click="handleDelete(scope.row.code)"> 移除 </el-button>
|
|
|
|
|
|
+ <Icon style="vertical-align: middle; color: #ea3434" icon="ep:zoom-out" />
|
|
|
|
+ <el-button
|
|
|
|
+ style="vertical-align: middle"
|
|
|
|
+ link
|
|
|
|
+ type="danger"
|
|
|
|
+ @click="handleDelete(scope.row.code)"
|
|
|
|
+ >
|
|
|
|
+ 移除
|
|
|
|
+ </el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
- <!-- 分页 -->
|
|
|
|
-<!-- <Pagination-->
|
|
|
|
-<!-- :total="total"-->
|
|
|
|
-<!-- v-model:page="queryParams.pageNo"-->
|
|
|
|
-<!-- v-model:limit="queryParams.pageSize"-->
|
|
|
|
-<!-- @pagination="getList"-->
|
|
|
|
-<!-- />-->
|
|
|
|
</ContentWrap>
|
|
</ContentWrap>
|
|
|
|
|
|
<!-- 表单弹窗:添加/修改 -->
|
|
<!-- 表单弹窗:添加/修改 -->
|
|
- <ChooseMaterial ref="formRef" />
|
|
|
|
- <MaintainMaterialDrawer ref="showDrawer" :model-value="drawerVisible"
|
|
|
|
- @update:model-value="val => drawerVisible = val"
|
|
|
|
|
|
+ <ChooseMaterial ref="formRef" :deptId="props.deptId" @choose="selectChoose"/>
|
|
|
|
+ <MaintainMaterialDrawer
|
|
|
|
+ ref="showDrawer"
|
|
|
|
+ :model-value="drawerVisible"
|
|
|
|
+ @update:model-value="(val) => (drawerVisible = val)"
|
|
@add="handleChildSubmit"
|
|
@add="handleChildSubmit"
|
|
/>
|
|
/>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
-import download from '@/utils/download'
|
|
|
|
-import { IotMaintainMaterialApi, IotMaintainMaterialVO } from '@/api/pms/maintain/material'
|
|
|
|
-import IotMaintainMaterialForm from './IotMaintainMaterialForm.vue'
|
|
|
|
-import {ref} from "vue";
|
|
|
|
-import MaintainMaterialDrawer from "@/views/pms/maintain/material/MaintainMaterialDrawer.vue";
|
|
|
|
|
|
+import { IotMaintainMaterialVO } from '@/api/pms/maintain/material'
|
|
|
|
+import { ref } from 'vue'
|
|
|
|
+import MaintainMaterialDrawer from '@/views/pms/maintain/material/MaintainMaterialDrawer.vue'
|
|
|
|
+import {propTypes} from "@/utils/propTypes";
|
|
|
|
+import ChooseMaterial from "@/views/pms/maintain/material/ChooseMaterial.vue";
|
|
|
|
|
|
/** 工单物料 列表 */
|
|
/** 工单物料 列表 */
|
|
defineOptions({ name: 'IotMaintainMaterial' })
|
|
defineOptions({ name: 'IotMaintainMaterial' })
|
|
@@ -76,6 +90,9 @@ const drawerVisible = ref<boolean>(false)
|
|
const showDrawer = ref()
|
|
const showDrawer = ref()
|
|
const list = ref<IotMaintainMaterialVO[]>([]) // 列表的数据
|
|
const list = ref<IotMaintainMaterialVO[]>([]) // 列表的数据
|
|
const total = ref(0) // 列表的总页数
|
|
const total = ref(0) // 列表的总页数
|
|
|
|
+const props = defineProps({
|
|
|
|
+ deptId: propTypes.number.def(undefined)
|
|
|
|
+})
|
|
const queryParams = reactive({
|
|
const queryParams = reactive({
|
|
pageNo: 1,
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
@@ -91,23 +108,40 @@ const queryParams = reactive({
|
|
remark: undefined,
|
|
remark: undefined,
|
|
createTime: []
|
|
createTime: []
|
|
})
|
|
})
|
|
|
|
+const formData = ref({
|
|
|
|
+ id: undefined,
|
|
|
|
+ code: undefined,
|
|
|
|
+ name: undefined,
|
|
|
|
+ unit: undefined,
|
|
|
|
+ price: undefined,
|
|
|
|
+ sourceType: undefined,
|
|
|
|
+ depleteCount: undefined,
|
|
|
|
+ totalCount: undefined,
|
|
|
|
+ sapCode: undefined,
|
|
|
|
+ status: undefined,
|
|
|
|
+ remark: undefined,
|
|
|
|
+})
|
|
const queryFormRef = ref() // 搜索的表单
|
|
const queryFormRef = ref() // 搜索的表单
|
|
const exportLoading = ref(false) // 导出的加载中
|
|
const exportLoading = ref(false) // 导出的加载中
|
|
-
|
|
|
|
-const handleChildSubmit=(formData)=> {
|
|
|
|
- console.log('接收到的数据:', JSON.stringify(formData));
|
|
|
|
-
|
|
|
|
- const modified = removeOnesFromKeys(formData);
|
|
|
|
- list.value.push(modified);
|
|
|
|
|
|
+const selectChoose = (formData) => {
|
|
|
|
+ console.log('接收到的数据:', JSON.stringify(formData))
|
|
|
|
+ list.value.push(formData)
|
|
|
|
+}
|
|
|
|
+const handleChildSubmit = (formData) => {
|
|
|
|
+ const modified = removeOnesFromKeys(formData)
|
|
|
|
+ list.value.push(modified)
|
|
}
|
|
}
|
|
|
|
|
|
const removeOnesFromKeys = (obj: Record<string, any>) => {
|
|
const removeOnesFromKeys = (obj: Record<string, any>) => {
|
|
- return Object.keys(obj).reduce((acc, key) => {
|
|
|
|
- const newKey = key.replace(/1/g, ''); // 替换所有 1
|
|
|
|
- acc[newKey] = obj[key];
|
|
|
|
- return acc;
|
|
|
|
- }, {} as Record<string, any>);
|
|
|
|
-};
|
|
|
|
|
|
+ return Object.keys(obj).reduce(
|
|
|
|
+ (acc, key) => {
|
|
|
|
+ const newKey = key.replace(/1/g, '') // 替换所有 1
|
|
|
|
+ acc[newKey] = obj[key]
|
|
|
|
+ return acc
|
|
|
|
+ },
|
|
|
|
+ {} as Record<string, any>
|
|
|
|
+ )
|
|
|
|
+}
|
|
const handleView = () => {
|
|
const handleView = () => {
|
|
drawerVisible.value = true
|
|
drawerVisible.value = true
|
|
showDrawer.value.openDrawer()
|
|
showDrawer.value.openDrawer()
|
|
@@ -137,6 +171,10 @@ const resetQuery = () => {
|
|
/** 添加/修改操作 */
|
|
/** 添加/修改操作 */
|
|
const formRef = ref()
|
|
const formRef = ref()
|
|
const openForm = (type: string, id?: number) => {
|
|
const openForm = (type: string, id?: number) => {
|
|
|
|
+ if(!props.deptId) {
|
|
|
|
+ message.error("请选择设备")
|
|
|
|
+ return
|
|
|
|
+ }
|
|
formRef.value.open(type, id)
|
|
formRef.value.open(type, id)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -150,11 +188,11 @@ const handleDelete = async (id: number) => {
|
|
// message.success(t('common.delSuccess'))
|
|
// message.success(t('common.delSuccess'))
|
|
// // 刷新列表
|
|
// // 刷新列表
|
|
// await getList()
|
|
// await getList()
|
|
- const index = list.value.findIndex(item => item.code === id);
|
|
|
|
|
|
+ const index = list.value.findIndex((item) => item.code === id)
|
|
debugger
|
|
debugger
|
|
if (index !== -1) {
|
|
if (index !== -1) {
|
|
// 通过 splice 删除元素
|
|
// 通过 splice 删除元素
|
|
- list.value.splice(index, 1);
|
|
|
|
|
|
+ list.value.splice(index, 1)
|
|
}
|
|
}
|
|
} catch {}
|
|
} catch {}
|
|
}
|
|
}
|