This commit is contained in:
BianLzhaoMin 2025-06-15 17:00:17 +08:00
parent ca70bb4959
commit 1b4bf1270b
2 changed files with 71 additions and 54 deletions

View File

@ -324,8 +324,9 @@ export default {
uploadUrl: process.env.VUE_APP_BASE_API + '/file/upload', // uploadUrl: process.env.VUE_APP_BASE_API + '/file/upload', //
upload: { upload: {
// //
headers: { Authorization: 'Bearer ' + getToken() }, headers: { Authorization: 'Bearer ' + getToken() }
} },
equipmentListTemp: []
} }
}, },
computed: { computed: {
@ -438,10 +439,13 @@ export default {
} else { } else {
const newItem = { const newItem = {
...typeData, ...typeData,
scrapNum: 0 scrapNum: 0,
isNew: true
} }
// //
this.equipmentList.unshift(newItem) this.equipmentList.unshift(newItem)
this.deviceType.push(lastSelected) this.deviceType.push(lastSelected)
this.$message({ this.$message({
message: `已添加 ${typeData.typeName}`, message: `已添加 ${typeData.typeName}`,
@ -451,6 +455,8 @@ export default {
this.getDeviceCodeOptions(newItem).then(options => { this.getDeviceCodeOptions(newItem).then(options => {
this.$set(newItem, 'deviceCodeOptions', options) this.$set(newItem, 'deviceCodeOptions', options)
}) })
console.log('this.equipmentList', this.equipmentList)
} }
} }
@ -489,6 +495,7 @@ export default {
deviceCodeOptions: [] // deviceCodeOptions: [] //
} }
}) })
// //
for (let i = 0; i < this.equipmentList.length; i++) { for (let i = 0; i < this.equipmentList.length; i++) {
if (this.equipmentList[i].manageType == '0') { if (this.equipmentList[i].manageType == '0') {
@ -511,6 +518,10 @@ export default {
// } // }
}, },
getEquipmentListTemp() {
return this.equipmentList
},
/** 保存按钮操作 */ /** 保存按钮操作 */
handleSave() { handleSave() {
// console.log(this.equipmentList) // console.log(this.equipmentList)
@ -765,17 +776,17 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const formatTime = (date) => { const formatTime = date => {
const year = date.getFullYear(); const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0'); const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0'); const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0'); const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0'); const seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}${month}${day}_${hours}${minutes}${seconds}`; return `${year}${month}${day}_${hours}${minutes}${seconds}`
}; }
const currentTime = formatTime(new Date()); const currentTime = formatTime(new Date())
this.download( this.download(
'/material/purchase_check_info/exportDetails', '/material/purchase_check_info/exportDetails',
{ taskId: this.taskId }, { taskId: this.taskId },

View File

@ -1,11 +1,7 @@
<template> <template>
<!-- 盘点报废管理 --> <!-- 盘点报废管理 -->
<div class="app-container"> <div class="app-container">
<PageHeaderApply <PageHeaderApply v-if="isShowComponent != 'Home'" :pageContent="pageContent" @goBack="goBack" />
v-if="isShowComponent != 'Home'"
:pageContent="pageContent"
@goBack="goBack"
/>
<component <component
:is="isShowComponent" :is="isShowComponent"
:isEdit="isEdit" :isEdit="isEdit"
@ -19,70 +15,80 @@
@editTools="editTools" @editTools="editTools"
@addToolsSuccess="addToolsSuccess" @addToolsSuccess="addToolsSuccess"
@queryTools="queryTools" @queryTools="queryTools"
:ref="`${isShowComponent}Ref`"
/> />
</div> </div>
</template> </template>
<script> <script>
import PageHeaderApply from "@/components/pageHeaderApply"; import PageHeaderApply from '@/components/pageHeaderApply'
import Home from "./component/homeApply.vue"; // import Home from './component/homeApply.vue' //
import AddTools from "./component/addToolsApply.vue"; // import AddTools from './component/addToolsApply.vue' //
import QueryTools from "./component/queryToolsApply.vue"; // import QueryTools from './component/queryToolsApply.vue' //
export default { export default {
name: "InventoryScrap", name: 'InventoryScrap',
components: { components: {
Home, Home,
PageHeaderApply, PageHeaderApply,
AddTools, AddTools,
QueryTools, QueryTools
}, },
data() { data() {
return { return {
isShowComponent: "Home", isShowComponent: 'Home',
pageContent: "盘点报废申请", pageContent: '盘点报废申请',
isEdit: false, isEdit: false,
editTaskId: "", editTaskId: '',
editId: "", editId: '',
queryId: "", queryId: '',
queryTaskId: "", queryTaskId: '',
isView: false, isView: false,
codingTaskId: "", codingTaskId: ''
}; }
}, },
methods: { methods: {
/* 新增工机具 */ /* 新增工机具 */
addTools() { addTools() {
this.isEdit = false; this.isEdit = false
this.editTaskId = ""; this.editTaskId = ''
this.queryTaskId = ""; this.queryTaskId = ''
this.pageContent = "报废新增"; this.pageContent = '报废新增'
this.isShowComponent = "AddTools"; this.isShowComponent = 'AddTools'
}, },
/* 新增成功 */ /* 新增成功 */
addToolsSuccess() { addToolsSuccess() {
this.isShowComponent = "Home"; this.isShowComponent = 'Home'
}, },
/* 编辑工机具 */ /* 编辑工机具 */
editTools(taskId, id) { editTools(taskId, id) {
this.isEdit = true; this.isEdit = true
this.pageContent = "报废编辑"; this.pageContent = '报废编辑'
this.editTaskId = taskId; this.editTaskId = taskId
this.editId = id; this.editId = id
this.isShowComponent = "AddTools"; this.isShowComponent = 'AddTools'
}, },
/* 查询工机具 */ /* 查询工机具 */
queryTools(taskId, id) { queryTools(taskId, id) {
this.isView = true; this.isView = true
this.pageContent = "详情信息"; this.pageContent = '详情信息'
this.queryTaskId = taskId; this.queryTaskId = taskId
this.queryId = id; this.queryId = id
this.isShowComponent = "QueryTools"; this.isShowComponent = 'QueryTools'
}, },
/* 返回按钮 */ /* 返回按钮 */
goBack() { goBack() {
this.isShowComponent = "Home"; if (this.isShowComponent === 'AddTools') {
}, const equipmentListTemp = this.$refs[`${this.isShowComponent}Ref`].getEquipmentListTemp()
}, const isNew = equipmentListTemp.some(item => item.isNew)
}; if (equipmentListTemp.length === 0 || isNew) {
this.$message.error('当前页面有未保存的报废信息,请先保存!')
return
}
} else {
this.isShowComponent = 'Home'
}
}
}
}
</script> </script>