Browse Source

报修图片添加

master
ljlong_2630 9 months ago
parent
commit
0f7190cc42
  1. 26
      src/utils/disposition/defaultButtons.ts
  2. 2
      src/views/eam/device/deviceInspectionMain/deviceInspectionMain.data.ts
  3. 12
      src/views/eam/device/deviceMaintainOrderMain/index.vue
  4. 5
      src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts
  5. 28
      src/views/eam/device/deviceMaintenanceMain/index.vue
  6. 11
      src/views/eam/device/deviceRepair/deviceRepair.data.ts
  7. 45
      src/views/eam/device/deviceRepair/index.vue
  8. 2
      src/views/eam/mold/moldInspectionMain/moldInspectionMain.data.ts
  9. 2
      src/views/eam/mold/moldMaintenanceMain/moldMaintenanceMain.data.ts

26
src/utils/disposition/defaultButtons.ts

@ -986,6 +986,32 @@ export function uploadFileBtn(option:any) {
})
}
// 主列表-完成
export function viewBtn(option:any) {
return __defaultBtnOption(option,{
label: '预览',
name: 'view',
hide: false,
type: 'success',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 主列表-完成
export function pictureBtn(option:any) {
return __defaultBtnOption(option,{
label: '照片',
name: 'picture',
hide: false,
type: 'success',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 默认按钮规则
function __defaultBtnOption(option:any,specific:any){

2
src/views/eam/device/deviceInspectionMain/deviceInspectionMain.data.ts

@ -310,7 +310,7 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
},
api: () => dutyUserList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userList.filter(item=>cellValue.includes(item.id)).map(cur=>cur.name).join(',')
return userList.filter(item=>cellValue?.includes(item.id)).map(cur=>cur.name).join(',')
},
form: {
component: 'Select',

12
src/views/eam/device/deviceMaintainOrderMain/index.vue

@ -92,6 +92,8 @@
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template>
<script setup lang="ts">
@ -116,8 +118,6 @@ const routeName = ref()
const formRef = ref()
routeName.value = route.name
const tableColumns = ref(DeviceMaintainOrderMain.allSchemas.tableColumns)
const apiPage = ref(DeviceMaintainOrderDetailApi.getDeviceMaintainOrderDetailPage)
const detailAllSchemas = ref(DeviceMaintainOrderDetail.allSchemas)
const tableData = ref([])
//
const updataTableColumns = (val) => {
@ -260,7 +260,11 @@ const onChange = (field, cur, item) => {
// -
const buttonTableClick = async (val, row) => {
DeviceMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = false
if (val == 'edit') {
if (val == 'view') {
showView.value = true
urls.value = row.filePathList
viewKey.value += 1
} else if (val == 'edit') {
//
openForm('update', row)
DeviceMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = true
@ -273,6 +277,8 @@ const buttonTableClick = async (val, row) => {
openForm('turnOrder', row)
} else if (val == 'finishOrder') {
finishOrder(row)
} else if (val == 'finishOrder') {
finishOrder(row)
}
}

5
src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts

@ -86,6 +86,9 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
width: '150',
},
api: () => factoryList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return factoryList.find((account) => account.id == cellValue)?.name
},
search: {
show: true,
component: 'Select',
@ -234,7 +237,7 @@ export const DeviceMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
api: () => userList,
formatter: (_: Recordable, __: TableColumn, cellValue) => {
return userList.filter(item=>cellValue.includes(item.id)).map(cur=>cur.name).join(',')
return userList.filter(item=>cellValue?.includes(item.id)).map(cur=>cur.name).join(',')
},
tableForm: {
type: 'Select',

28
src/views/eam/device/deviceMaintenanceMain/index.vue

@ -91,6 +91,18 @@
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
<Dialog
ref="basicFormViewRef"
v-model="showView"
:key="viewKey"
:closeOnClickModal="true"
:title="viewTitle"
>
<el-image v-for="url in urls" :key="url" :src="url" lazy />
</Dialog>
</template>
<script setup lang="ts">
@ -115,10 +127,11 @@ const routeName = ref()
const formRef = ref()
routeName.value = route.name
const tableColumns = ref(DeviceMaintenanceMain.allSchemas.tableColumns)
const apiPage = ref(DeviceMaintenanceDetailApi.getDeviceMaintenanceDetailPage)
const detailAllSchemas = ref(DeviceMaintenanceDetail.allSchemas)
const tableData = ref([])
const showView = ref(false)
const viewTitle = ref('图片预览')
const urls = ref([])
const viewKey = ref(0)
//
const updataTableColumns = (val) => {
tableColumns.value = val
@ -242,7 +255,10 @@ const butttondata = (row) => {
}), //
defaultButtons.finishOrderBtn({
hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id)
}) //
}), //
defaultButtons.pictureBtn({
hide: !(row.filePathList != null && row.filePathList.length > 0)
}) //
]
}
const onChange = (field, cur, item) => {
@ -270,6 +286,10 @@ const buttonTableClick = async (val, row) => {
acceptOrder(row)
} else if (val == 'turnOrder') {
openForm('turnOrder', row)
} else if (val == 'picture') {
showView.value = true
urls.value = row.filePathList
viewKey.value += 1
}
}

11
src/views/eam/device/deviceRepair/deviceRepair.data.ts

@ -172,6 +172,17 @@ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
component: 'Select',
},
},
{
label: '图片',
field: 'upload',
isForm: true,
form: {
component: 'UploadImgs',
componentProps: {
limit:3,
}
}
},
{
label: '操作',
field: 'action',

45
src/views/eam/device/deviceRepair/index.vue

@ -19,9 +19,13 @@
<span>{{ row.code }}</span>
</el-button>
</template>
<template #upload="{ row }">
<ButtonBase v-if="row.filePathList != null && row.filePathList.length != 0" :Butttondata="butttondataView(row)" @button-base-click="buttonTableClick($event, row)" />
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event, row)" />
</template>
</Table>
</ContentWrap>
@ -33,6 +37,16 @@
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceRepair.allSchemas" />
<Dialog
ref="basicFormViewRef"
v-model="showView"
:key="viewKey"
:closeOnClickModal="true"
:title="viewTitle"
>
<el-image v-for="url in urls" :key="url" :src="url" lazy />
</Dialog>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/device-repair/import" :importTemplateData="importTemplateData"
@success="importSuccess" />
@ -43,8 +57,6 @@ import download from '@/utils/download'
import { DeviceRepair, DeviceRepairRules } from './deviceRepair.data'
import * as DeviceRepairApi from '@/api/eam/device/deviceRepair'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { selectAllFactoryArea } from '@/api/system/dept'
import { getRowIdentity } from 'element-plus/es/components/table/src/util'
// import TableHead from '@/components/TableHead/src/TableHead.vue'
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
// import Detail from '@/components/Detail/src/Detail.vue'
@ -56,7 +68,10 @@ const { t } = useI18n() // 国际化
const route = useRoute() //
const routeName = ref()
const factoryAreaList = ref([])
const showView = ref(false)
const viewTitle = ref('图片预览')
const urls = ref([])
const viewKey = ref(0)
routeName.value = route.name
const tableColumns = ref(DeviceRepair.allSchemas.tableColumns)
@ -124,6 +139,15 @@ const butttondata = (row) => {
// defaultButtons.mainListEditBtn({hasPermi:'eam:deviceRepair:update'}), //
// defaultButtons.mainListDeleteBtn({ hasPermi: 'eam:deviceRepair:delete' }), //
defaultButtons.backoutBtn({ hide: row.result != 'PENDING' }), //
]
}
// -
const butttondataView = (row) => {
return [
defaultButtons.viewBtn(null),
]
}
@ -135,13 +159,23 @@ const buttonTableClick = async (val, row) => {
handleDelete(row.id)
} else if (val == 'backout') { //
handleBackout(row)
} else if (val == 'view') { //
openForm('view', row)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const basicFormViewRef = ref()
const openForm = (type: string, row?: any) => {
if (type == 'view') {
showView.value = true
urls.value = row.filePathList
viewKey.value += 1
} else {
basicFormRef.value.open(type, row)
}
}
// form
@ -159,6 +193,9 @@ const formsSuccess = async (formType, data) => {
if (data.expireTime == 0) data.expireTime = null;
data.type = 'DEVICE';
data.result = 'PENDING';
data.filePathList = data.upload.map((item: any) => {
return item.url
})
if (formType === 'create') {
await DeviceRepairApi.createDeviceRepair(data)
message.success(t('common.createSuccess'))
@ -253,3 +290,5 @@ onMounted(async () => {
})
</script>

2
src/views/eam/mold/moldInspectionMain/moldInspectionMain.data.ts

@ -310,7 +310,7 @@ export const MoldInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
},
api: () => dutyUserList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userList.filter(item=>cellValue.includes(item.id)).map(cur=>cur.name).join(',')
return userList.filter(item=>cellValue?.includes(item.id)).map(cur=>cur.name).join(',')
},
form: {
component: 'Select',

2
src/views/eam/mold/moldMaintenanceMain/moldMaintenanceMain.data.ts

@ -234,7 +234,7 @@ export const MoldMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
api: () => userList,
formatter: (_: Recordable, __: TableColumn, cellValue) => {
return userList.filter(item=>cellValue.includes(item.id)).map(cur=>cur.name).join(',')
return userList.filter(item=>cellValue?.includes(item.id)).map(cur=>cur.name).join(',')
},
tableForm: {
type: 'Select',

Loading…
Cancel
Save