diff --git a/src/api/EquipmentEntryApply/index.js b/src/api/EquipmentEntryApply/index.js
index e3840a00..cc1c4844 100644
--- a/src/api/EquipmentEntryApply/index.js
+++ b/src/api/EquipmentEntryApply/index.js
@@ -291,4 +291,55 @@ export const updateWarehousingApi = (data) => {
method: 'POST',
data
})
+}
+
+// 入库申请-工具详情
+export const getListByApplyIdApi = (data) => {
+ return request({
+ url: '/material-mall/toolApply/listByApplyId',
+ method: 'GET',
+ params: data,
+ })
+}
+
+// 工具删除
+export const deleteToolApi = (data) => {
+ return request({
+ url: '/material-mall/toolApply/deleteTool',
+ method: 'POST',
+ params: data
+ })
+}
+
+// 删除
+export const deleteByIdApi = (data) => {
+ return request({
+ url: '/material-mall/warehousing/deleteById',
+ method: 'POST',
+ params: data
+ })
+}
+
+// 批量/单个-提交
+export const batchSubmissionApi = (data) => {
+ return request({
+ url: `/material-mall/warehousing/batchSubmission/${data}`,
+ method: 'POST',
+ })
+}
+
+// 批量单个-审核
+export const batchApprovalApi = (data) => {
+ return request({
+ url: `/material-mall/warehousing/batchApproval/${data}`,
+ method: 'POST',
+ })
+}
+
+// 批量单个-驳回
+export const batchRejectionApi = (data) => {
+ return request({
+ url: `/material-mall/warehousing/batchRejection/${data}`,
+ method: 'POST',
+ })
}
\ No newline at end of file
diff --git a/src/components/FileImageUpload/index.vue b/src/components/FileImageUpload/index.vue
index cd53f114..a4fde74d 100644
--- a/src/components/FileImageUpload/index.vue
+++ b/src/components/FileImageUpload/index.vue
@@ -15,7 +15,7 @@
:headers="headers"
:file-list="fileList"
:on-preview="handlePictureCardPreview"
- :class="{ hide: this.fileList.length >= this.limit }"
+ :class="{ hide: fileList.length >= limit }"
>
@@ -236,6 +236,11 @@ export default {
return
}
+ if (!this.isImage(file)) {
+ window.open(url, '_blank')
+ return
+ }
+
this.dialogImageUrl = file.url
this.dialogVisible = true
},
diff --git a/src/views/EquipmentServicing/index.vue b/src/views/EquipmentServicing/index.vue
index 7e5e48b3..3f478588 100644
--- a/src/views/EquipmentServicing/index.vue
+++ b/src/views/EquipmentServicing/index.vue
@@ -213,7 +213,15 @@
-
+
@@ -397,8 +405,10 @@ import {
} from '@/api/EquipmentServicing/index'
import { getSelectEquipmentListAPI } from '@/api/EquipmentLedger/equ-out'
import { getToken } from '@/utils/auth' // 引入获取token的工具函数
+import FileImageUpload from '@/components/FileImageUpload'
export default {
+ components: { FileImageUpload },
data() {
return {
// 列表数据相关
@@ -461,7 +471,7 @@ export default {
},
// 文件上传相关
- fileList: [], // el-upload使用的文件列表
+ fileList: null, // el-upload使用的文件列表
uploadUrl: process.env.VUE_APP_BASE_API + '/file/upload',
warningDays: 0
}
@@ -730,6 +740,23 @@ export default {
this.addOrEditForm.fileInfoList = []
}
},
+ handleFileList(file) {
+ console.log('🚀 ~ file:', file)
+ if (!file) {
+ this.fileList = null
+ this.addOrEditForm.fileInfoList = []
+ return
+ }
+ this.fileList = file
+ const arr = file.split(',')
+ this.addOrEditForm.fileInfoList = arr.map((item) => {
+ const parts = item.split('/')
+ return {
+ fileName: parts[parts.length - 1],
+ fileUrl: item,
+ }
+ })
+ },
// 文件上传成功处理
handleUploadSuccess(response, file, fileList) {
diff --git a/src/views/stockManagement/entryApply/apply.vue b/src/views/stockManagement/entryApply/apply.vue
index f4e3284c..e7a07915 100644
--- a/src/views/stockManagement/entryApply/apply.vue
+++ b/src/views/stockManagement/entryApply/apply.vue
@@ -1,12 +1,12 @@
-
-
-
-
+
+
+
+
-
+
@@ -27,7 +27,8 @@ export default {
data() {
return {
isShowComponent: 'EquipmentAdd',
- activeName: 'equip',
+ activeName: 'EquipmentAdd',
+ leaving: false,
}
},
created() {
@@ -45,61 +46,71 @@ export default {
this.$tab.closePage({ path: '/stockManagement/entryApply/apply' })
})
},
- beforeClick(activeName, oldActiveName) {
- console.log('🚀 ~ oldActiveName:', oldActiveName)
- console.log('🚀 ~ activeName:', activeName)
- // this.$refs.componentRef
- console.log('🚀 ~ this.$refs.componentRef:', this.$refs.componentRef)
+ async beforeClick(activeName, oldActiveName) {
+ if (this.leaving) return false
// 如果是同一个 tab,直接放行
if (activeName === oldActiveName) return true
let isEmpty = false
let allHasOrderId = false
- if (oldActiveName == 'equip') {
+ if (oldActiveName == 'EquipmentAdd') {
const tableList = this.$refs.componentRef.tableData || []
isEmpty = tableList.length === 0
- allHasOrderId = tableList.every((item) => !!item.orderId)
- } else if (oldActiveName == 'toolNum') {
+ allHasOrderId = tableList.every((item) => !!item.maId)
+ } else if (oldActiveName == 'AddNum' || oldActiveName == 'AddCode') {
const tableList = this.$refs.componentRef.dialogList || []
isEmpty = tableList.length === 0
- allHasOrderId = tableList.every((item) => !!item.applyId)
- } else if (oldActiveName == 'toolCode') {
- const tableList = this.$refs.componentRef.dialogList || []
- isEmpty = tableList.length === 0
- allHasOrderId = tableList.every((item) => !!item.applyId)
+ allHasOrderId = tableList.every((item) => !!item.id)
}
- console.log('🚀 ~ isEmpty:', isEmpty)
- console.log('🚀 ~ allHasOrderId:', allHasOrderId)
+
if (isEmpty || allHasOrderId) {
- if (activeName == 'equip') {
- this.isShowComponent = 'EquipmentAdd'
- } else if (activeName == 'toolNum') {
- this.isShowComponent = 'AddNum'
- } else if (activeName == 'toolCode') {
- this.isShowComponent = 'AddCode'
- }
+ this.isShowComponent = activeName
return true
}
- return this.confirmLeave().then(async (res) => {
- console.log('🚀 ~ res-确定保存:', res)
- console.log('🚀 ~ 确定保存-->>>:')
- if (!res) {
- if (activeName == 'equip') {
- this.isShowComponent = 'EquipmentAdd'
- } else if (activeName == 'toolNum') {
- this.isShowComponent = 'AddNum'
- } else if (activeName == 'toolCode') {
- this.isShowComponent = 'AddCode'
- }
- return
- }
- if (oldActiveName == 'equip') {
+ const confirm = await this.confirmLeave()
+ if (!confirm) {
+ // ❌ 用户取消
+ this.isShowComponent = activeName
+ return true
+ }
+ try {
+ let result = null
+ if (oldActiveName == 'EquipmentAdd') {
// 调用保存
- // this.$refs.componentRef.submit()
- } else if (oldActiveName == 'toolNum') {
- } else if (oldActiveName == 'code') {
+ const tableList = this.$refs.componentRef.tableData || []
+
+ for (let i = 0; i < tableList.length; i++) {
+ const row = tableList[i]
+ const res = await this.$refs.componentRef.submitRow(row)
+ if (!res) {
+ result = false
+ break
+ }
+ }
+ } else if (oldActiveName == 'AddNum' || oldActiveName == 'AddCode') {
+ result = await this.$refs.componentRef.submit()
+ console.log('🚀 ~ result:', result)
}
- })
+ if (!result) {
+ setTimeout(() => {
+ this.leaving = true
+ this.activeName = oldActiveName
+ setTimeout(() => {
+ this.leaving = false
+ }, 200)
+ }, 200)
+ return false
+ } else {
+ this.isShowComponent = activeName
+ return true
+ }
+ } catch (error) {
+ console.log('error', error)
+ setTimeout(() => {
+ this.activeName = oldActiveName
+ }, 200)
+ return false
+ }
},
confirmLeave(message = '是否暂存已添加的装备?', title = '提示') {
return new Promise((resolve, reject) => {
@@ -118,19 +129,6 @@ export default {
})
})
},
- handleClick(tab, event) {
- console.log('🚀 ~ tab, event:', tab.index)
- // if (tab.index == 0) {
- // this.isShowComponent = 'EquipmentAdd'
- // } else if (tab.index == 1) {
- // this.isShowComponent = 'AddNum'
- // } else if (tab.index == 2) {
- // this.isShowComponent = 'AddCode'
- // }
- },
- isSubmit(val) {
- console.log('🚀 ~ val:', val)
- },
},
}
diff --git a/src/views/stockManagement/entryApply/components/AddCode.vue b/src/views/stockManagement/entryApply/components/AddCode.vue
index 981660c0..fc94c0b1 100644
--- a/src/views/stockManagement/entryApply/components/AddCode.vue
+++ b/src/views/stockManagement/entryApply/components/AddCode.vue
@@ -139,7 +139,12 @@
- 删除
@@ -290,7 +295,7 @@
import { getTreeSelectApi, addApplyCodeApi, addToolApi } from '@/api/toolsManage'
import { getManufacturerSelectApi } from '@/api/EquipmentLedger'
import { addFacturer } from '@/api/ma/supplier'
-import { addWarehousingApi, updateWarehousingApi } from '@/api/EquipmentEntryApply'
+import { addWarehousingApi, updateWarehousingApi, getListByApplyIdApi, deleteToolApi } from '@/api/EquipmentEntryApply'
import FileUpload from '@/components/FileImageUpload'
export default {
@@ -346,7 +351,7 @@ export default {
currentRow: null,
uploadTitle: '',
uploadVisible: false,
- fileList: [],
+ fileList: null,
viewVisible: false,
viewTitle: '',
viewList: [],
@@ -385,6 +390,8 @@ export default {
},
async getList() {
try {
+ const res = await getListByApplyIdApi({ applyId: this.dialogForm.applyId, manageType: 0 })
+ this.dialogList = res.rows
} catch (error) {
console.log('🚀 ~ error:', error)
}
@@ -463,12 +470,21 @@ export default {
})
}
},
- handleDelete(index) {
- this.dialogList.splice(index, 1)
- this.$message({
- type: 'success',
- message: '删除成功!',
- })
+ async handleDelete(row, index) {
+ try {
+ if (row.id) {
+ await deleteToolApi({ id: row.id })
+ this.getList()
+ } else {
+ this.dialogList.splice(index, 1)
+ }
+ this.$message({
+ type: 'success',
+ message: '删除成功!',
+ })
+ } catch (error) {
+ console.log('🚀 ~ error:', error)
+ }
},
// 获取厂家
async getManufacturerSelect() {
@@ -515,32 +531,53 @@ export default {
this.isLoading = true
this.dialogForm.applyId = this.$route.query.applyId || ''
if (!this.dialogForm.applyId) {
+ const routerParams = this.$route.query || {}
const res = await addApplyCodeApi()
this.dialogForm.applyId = res.data.id
// 更新路由传参
this.$router.replace({
query: {
- applyId: res.data.id,
+ id: routerParams.id || '',
+ applyId: this.dialogForm.applyId || '',
+ orderId: routerParams.orderId || '',
+ isAddVisible: routerParams.isAddVisible || '',
+ isApprovalVisible: routerParams.isApprovalVisible || '',
},
})
this.dialogList.forEach((item) => {
item.applyId = res.data.id
})
+ } else {
+ this.dialogList.forEach((item) => {
+ item.applyId = this.dialogForm.applyId
+ })
}
const orderId = this.$route.query.orderId || ''
- const isEdit = this.$route.query.isEdit || ''
const id = this.$route.query.id || ''
- if (isEdit && id) {
- await updateWarehousingApi({ orderId, applyId: this.dialogForm.applyId })
+
+ await addToolApi(this.dialogList)
+ if (id) {
+ await updateWarehousingApi({ id, orderId, applyId: this.dialogForm.applyId })
} else {
- await addToolApi(this.dialogList)
- await addWarehousingApi({ orderId, applyId: this.dialogForm.applyId })
+ const routerParams = this.$route.query || {}
+ const res = await addWarehousingApi({ orderId, applyId: this.dialogForm.applyId })
+ this.$router.replace({
+ query: {
+ id: res.data.id || '',
+ applyId: routerParams.applyId || '',
+ orderId: routerParams.orderId || '',
+ isAddVisible: routerParams.isAddVisible || '',
+ isApprovalVisible: routerParams.isApprovalVisible || '',
+ },
+ })
}
this.$message({
type: 'success',
message: '操作成功!',
})
+ this.getList()
this.dialogVisible = false
+ return true
// this.$emit('getList', { applyId: this.dialogForm.applyId })
} catch (error) {
} finally {
@@ -602,13 +639,13 @@ export default {
// this.currentRow = row
if (type == 2) {
this.uploadTitle = '合格证'
- this.fileList = this.currentRow.fileList2
+ this.fileList = this.joinFileUrls(this.currentRow.certificates)
} else if (type == 3) {
this.uploadTitle = '定期检验报告'
- this.fileList = this.currentRow.fileList3
+ this.fileList = this.joinFileUrls(this.currentRow.inspectionReports)
} else if (type == 4) {
this.uploadTitle = '采购发票'
- this.fileList = this.currentRow.fileList4
+ this.fileList = this.joinFileUrls(this.currentRow.purchaseInvoices)
}
this.uploadVisible = true
},
@@ -646,6 +683,14 @@ export default {
}
})
},
+ joinFileUrls(list) {
+ if (!Array.isArray(list) || list.length === 0) return ''
+
+ return list
+ .filter((item) => item && item.fileUrl)
+ .map((item) => item.fileUrl)
+ .join(',')
+ },
},
}
diff --git a/src/views/stockManagement/entryApply/components/AddNum.vue b/src/views/stockManagement/entryApply/components/AddNum.vue
index 53bdfcf8..eeac20e1 100644
--- a/src/views/stockManagement/entryApply/components/AddNum.vue
+++ b/src/views/stockManagement/entryApply/components/AddNum.vue
@@ -64,7 +64,12 @@
- 删除
@@ -134,7 +139,7 @@
diff --git a/src/views/stockManagement/entryApply/components/EquipmentAdd.vue b/src/views/stockManagement/entryApply/components/EquipmentAdd.vue
index fa0e853f..bc21b975 100644
--- a/src/views/stockManagement/entryApply/components/EquipmentAdd.vue
+++ b/src/views/stockManagement/entryApply/components/EquipmentAdd.vue
@@ -92,7 +92,7 @@
v-show="!isAddVisible"
:disabled="tableData.length == 0"
>
- 批量导入图片
+ 批量导入文件
item && item.fileUrl)
+ .map((item) => item.fileUrl)
+ .join(',')
+ },
importTemplate() {
this.download('/material-mall/order/template', {}, `装备信息导入模板_${new Date().getTime()}.xlsx`)
},
@@ -1305,10 +1323,13 @@ export default {
async addList() {
try {
if (!this.$route.query.orderId) {
+ const routerParams = this.$route.query || {}
const result = await getEquipmentAddIdApi()
this.orderId = result.data.id
this.$router.replace({
query: {
+ id: routerParams.id || '',
+ applyId: routerParams.applyId || '',
orderId: result.data.id,
isAddVisible: this.isAddVisible,
isApprovalVisible: this.isApprovalVisible,
diff --git a/src/views/stockManagement/entryApply/index.vue b/src/views/stockManagement/entryApply/index.vue
index a0069f40..71514b23 100644
--- a/src/views/stockManagement/entryApply/index.vue
+++ b/src/views/stockManagement/entryApply/index.vue
@@ -94,9 +94,11 @@
- 编辑
- 删除
- 提交
+ 编辑
+ 删除
+ 提交
@@ -113,7 +115,7 @@