From 0e27057384bfb081f29562668aeadc2722151898 Mon Sep 17 00:00:00 2001
From: zhang_li <2235006734@qqq.com>
Date: Sun, 4 Feb 2024 15:44:17 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=8F=B0=E8=B4=A6=E8=AF=A6?=
=?UTF-8?q?=E6=83=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/eam/device/deviceAccounts/index.ts | 3 +-
src/api/eam/upload/index.ts | 5 +
.../Detail/src/DetailDeviceLedger.vue | 185 +++++++++---
src/components/UploadFile/src/UploadImg.vue | 2 +-
src/components/UploadFile/src/UploadImgs.vue | 2 +-
src/utils/dict.ts | 1 +
src/utils/disposition/tabsList.ts | 7 +-
.../deviceAccounts/deviceAccounts.data.ts | 35 ++-
src/views/eam/device/deviceAccounts/index.vue | 270 +++++++++++++-----
.../deviceMaintenanceMain.data.ts | 1 +
10 files changed, 385 insertions(+), 126 deletions(-)
create mode 100644 src/api/eam/upload/index.ts
diff --git a/src/api/eam/device/deviceAccounts/index.ts b/src/api/eam/device/deviceAccounts/index.ts
index ed79b44..3c0ed6e 100644
--- a/src/api/eam/device/deviceAccounts/index.ts
+++ b/src/api/eam/device/deviceAccounts/index.ts
@@ -62,4 +62,5 @@ export const importTemplate = () => {
// 查询设备台账列表
export const getDeviceAccountsNoPage = async (params) => {
return await request.get({ url: `/eam/device-accounts/selectData`, params })
-}
\ No newline at end of file
+}
+
diff --git a/src/api/eam/upload/index.ts b/src/api/eam/upload/index.ts
new file mode 100644
index 0000000..8bf3ee9
--- /dev/null
+++ b/src/api/eam/upload/index.ts
@@ -0,0 +1,5 @@
+import request from '@/config/axios'
+// 上传图片
+export const uploadImage = async (data) => {
+ return await request.post({ url: `/eam/attachment-file/upload`, data })
+}
\ No newline at end of file
diff --git a/src/components/Detail/src/DetailDeviceLedger.vue b/src/components/Detail/src/DetailDeviceLedger.vue
index 2a13d8a..d475014 100644
--- a/src/components/Detail/src/DetailDeviceLedger.vue
+++ b/src/components/Detail/src/DetailDeviceLedger.vue
@@ -40,15 +40,40 @@
:allSchemas="detailAllSchemas"
/>
-
+ /> -->
+
+
+ 点击上传
+
+
+
+
+ 点击上传
+
+
-
- {{ item }}
+
+ {{ item }}
{
+ default: () => {
return []
}
},
// 针对基础数据tabs扩展 显示table列表 默认false
tabsExtend: {
- type: Boolean,
+ type: Number,
required: false,
- default: false
+ default: 1
},
// tableObject 数据过滤条件 针对 详情扩展标签页 传入不同条件
tableObjectExtend: {
@@ -251,17 +290,42 @@ const props = defineProps({
default: null
},
// 子列表 新增 编辑 删除的展示与隐藏,默认展示
- detailButtonIsShow:{
+ detailButtonIsShow: {
type: Boolean,
required: false,
default: false
+ },
+ // 详情上传图片
+ upImageRules: {
+ type: Array,
+ required: false,
+ default: null
+ },
+ imageFormAllSchemas: {
+ type: Object,
+ required: true,
+ default: null
+ },
+ // 详情上传文件
+ upFileRules: {
+ type: Array,
+ required: false,
+ default: null
+ },
+ fileFormAllSchemas: {
+ type: Object,
+ required: true,
+ default: null
}
})
const isShowDrawer = ref(false)
const detailLoading = ref(false)
const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : '')))
+const subTabsList = ref(JSON.parse(JSON.stringify(props.subTabs ? props.subTabs : '')))
-
+const imageFormSchemas = ref(props.imageFormAllSchemas?.formSchema)
+const fileFormSchemas = ref(props.fileFormAllSchemas?.formSchema)
+console.log('imageFormSchemas', imageFormSchemas.value)
// Tabs当前选择
const current = ref(0)
@@ -272,7 +336,7 @@ const change = (item, index) => {
//主表所需的参数
const masterParmas = ref({
- number: '', //主表id
+ number: '' //主表id
// number: '', //主表单据号
// status: '' //主表状态 用于控制子表新增编辑按钮显示情况
})
@@ -290,15 +354,18 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
titleNameRef.value = titleName
titleValueRef.value = titleValue
// 加载明细列表
- if (!props.isBasic) {
+ if (!props.isBasic || (props.isBasic && props.tabsExtend)) {
// 设置主表id
masterParmas.value.number = row.number
// masterParmas.value.number = row.number
// masterParmas.value.status = row.status
- tableObjectRef.value.params = {
- number: row.number
+
+ if (!props.isBasic) {
+ tableObjectRef.value.params = {
+ number: row.number
+ }
+ await getList()
}
- await getList()
}
isShowDrawer.value = true
if (row) {
@@ -311,7 +378,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
defaultButtons.defaultFilterBtn(null) // 筛选
]
} else {
- if(!props.detailButtonIsShow){
+ if (!props.detailButtonIsShow) {
HeadButttondata.value = [
defaultButtons.defaultAddBtn({
hide: isShowMainButton(row, ['1'])
@@ -327,41 +394,43 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
}) // 新增
]
}
- //盘点计划详情筛选
- if (props.fromeWhere == 'putawayRequest') {
+ //盘点计划详情筛选
+ if (props.fromeWhere == 'putawayRequest') {
HeadButttondata.value = [
- defaultButtons.defaultFilterBtn(null) // 筛选
+ defaultButtons.defaultFilterBtn(null) // 筛选
]
}
- //盘点调整申请筛选
- if (props.fromeWhere == 'countadjustRequest') {
+ //盘点调整申请筛选
+ if (props.fromeWhere == 'countadjustRequest') {
HeadButttondata.value = [
- defaultButtons.defaultFilterBtn(null) // 筛选
+ defaultButtons.defaultFilterBtn(null) // 筛选
]
}
- //采购收货详情筛选
- if (props.fromeWhere == 'purchasereceipt') {
+ //采购收货详情筛选
+ if (props.fromeWhere == 'purchasereceipt') {
HeadButttondata.value = [
- defaultButtons.defaultFilterBtn(null) // 筛选
+ defaultButtons.defaultFilterBtn(null) // 筛选
]
}
//客户收货详情筛选
if (props.fromeWhere == 'customerreceipt') {
HeadButttondata.value = [
- defaultButtons.defaultFilterBtn(null) // 筛选
+ defaultButtons.defaultFilterBtn(null) // 筛选
]
}
}
// 动态显示操作列按钮
- if(!props.detailButtonIsShow){
- buttondata.value = [...[
- defaultButtons.mainListEditBtn({
- hide: isShowMainButton(row, ['1'])
- }), // 编辑
- defaultButtons.mainListDeleteBtn({
- hide: isShowMainButton(row, ['1'])
- })], // 删除
+ if (!props.detailButtonIsShow) {
+ buttondata.value = [
+ ...[
+ defaultButtons.mainListEditBtn({
+ hide: isShowMainButton(row, ['1'])
+ }), // 编辑
+ defaultButtons.mainListDeleteBtn({
+ hide: isShowMainButton(row, ['1'])
+ })
+ ], // 删除
...props.buttondataTable
]
}
@@ -372,7 +441,6 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
}
defineExpose({ openDetail }) // 提供 open 方法,用于打开弹窗
-
const tableObjectRef = ref()
const tableMethodsRef = ref()
const detailAllSchemasRef = ref()
@@ -434,7 +502,7 @@ const buttonTableClick = async (val, row) => {
// 删除
handleDelete(row.id)
} else {
- emit('tableFormButton',val, row)
+ emit('tableFormButton', val, row)
}
}
/** 添加/修改操作 */
@@ -475,7 +543,10 @@ const emit = defineEmits([
'selectChangeDetail',
'detailOpenForm',
'tableFormButton',
- 'openImage'
+ 'openImage',
+ 'uploadImage',
+ 'subTabsChick',
+ 'uploadFile'
])
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
@@ -521,9 +592,45 @@ const selectChangeDetail = (field, val) => {
emit('selectChangeDetail', field, val)
}
// 打开图片
-const openImage=(item)=>{
+const openImage = (item) => {
emit('openImage', item)
}
+const imageFormRef = ref()
+// 上传图片
+const uploadImage =async () => {
+ console.log(imageFormRef)
+ const elForm = unref(imageFormRef)?.getElFormRef()
+ // 校验表单
+ if (!elForm) return
+ const valid = await elForm.validate()
+ if (!valid) return
+ emit(
+ 'uploadImage',
+ masterParmas.value.number,
+ imageFormRef.value.formModel.filePath.map((item) => item.url)
+ )
+}
+// 选择二级tabs
+const handleTabsChange=(e)=>{
+ console.log(e)
+ emit('subTabsChick',e)
+}
+// 上传文件
+const fileFormRef = ref()
+const uploadFile=async(e,index)=>{
+ console.log(proxy.$refs)
+ console.log(proxy.$refs['fileFormRef'+(index+1)))
+ const elForm = unref(fileFormRef)?.getElFormRef()
+ // 校验表单
+ if (!elForm) return
+ const valid = await elForm.validate()
+ if (!valid) return
+ emit(
+ 'uploadFile',
+ masterParmas.value.number,
+ fileFormRef.value.formModel.filePath.map((item) => item.url)
+ )
+}
//监视属性
watch(
() => props.apiPage,
@@ -534,7 +641,7 @@ watch(
tableObject.params.number = masterParmas.value.number
detailAllSchemasRef.value = props.detailAllSchemas
if (props.tableObjectExtend) {
- props.tableObjectExtend.forEach(item => {
+ props.tableObjectExtend.forEach((item) => {
tableObject.params[item.key] = item.value
})
}
diff --git a/src/components/UploadFile/src/UploadImg.vue b/src/components/UploadFile/src/UploadImg.vue
index 100736b..31571e2 100644
--- a/src/components/UploadFile/src/UploadImg.vue
+++ b/src/components/UploadFile/src/UploadImg.vue
@@ -1,7 +1,7 @@
([
table: {
width: 200,
fixed: 'right'
- }
+ },
+ isDetail: false,
}
]))
+// 表单校验
+export const UpImageRules = reactive({
+ filePath: [required],
+})
+export const UpImage = useCrudSchemas(reactive([
+ {
+ label: '上传图片',
+ field: 'filePath',
+ sort: 'custom',
+ isForm: true,
+ form:{
+ component:'UploadImgs',
+
+ }
+ },
+]))
+// 表单校验
+export const UpFileRules = reactive({
+ filePath: [required],
+})
+export const UploadFile = useCrudSchemas(reactive([
+ {
+ label: '上传文件',
+ field: 'filePath',
+ sort: 'custom',
+ isForm: true,
+ form:{
+ component:'UploadFile',
+
+ }
+ },
+]))
\ No newline at end of file
diff --git a/src/views/eam/device/deviceAccounts/index.vue b/src/views/eam/device/deviceAccounts/index.vue
index c2e4176..85473ec 100644
--- a/src/views/eam/device/deviceAccounts/index.vue
+++ b/src/views/eam/device/deviceAccounts/index.vue
@@ -1,18 +1,22 @@
-
+
-
-
+
+
@@ -27,13 +31,13 @@
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
-
+
{{ row.number }}
-
+
@@ -49,43 +53,62 @@
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
-
-
-
+
-
-
+
diff --git a/src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts b/src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts
index 39eda72..65b9618 100644
--- a/src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts
+++ b/src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts
@@ -199,6 +199,7 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive([
isDetail:false
}
]))
+
export const DeviceMaintenanceDetail = useCrudSchemas(reactive([
{
label: '故障描述',