| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function upload(data) { |
| | | return request({ |
| | | url: '/common/minioUploads', |
| | | method: 'post', |
| | | data: data, |
| | | headers: { |
| | | 'Content-Type': 'multipart/form-data' |
| | | } |
| | | }) |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-dialog |
| | | v-model="visible" |
| | | title="å¾çé¢è§" |
| | | width="800px" |
| | | destroy-on-close |
| | | align-center |
| | | > |
| | | <el-carousel |
| | | v-if="images.length" |
| | | height="450px" |
| | | indicator-position="outside" |
| | | arrow="always" |
| | | > |
| | | <el-carousel-item |
| | | v-for="(img, index) in images" |
| | | :key="index" |
| | | > |
| | | <el-image |
| | | :src="img" |
| | | fit="contain" |
| | | style="width: 100%; height: 100%" |
| | | :preview-src-list="images" |
| | | :initial-index="index" |
| | | preview-teleported |
| | | /> |
| | | </el-carousel-item> |
| | | </el-carousel> |
| | | |
| | | <div v-else class="empty"> |
| | | ææ å¾ç |
| | | </div> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed } from 'vue' |
| | | |
| | | const props = defineProps({ |
| | | modelValue: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | images: { |
| | | type: Array, |
| | | default: () => [] |
| | | } |
| | | }) |
| | | |
| | | const emit = defineEmits(['update:modelValue']) |
| | | |
| | | const visible = computed({ |
| | | get: () => props.modelValue, |
| | | set: val => emit('update:modelValue', val) |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .empty { |
| | | text-align: center; |
| | | color: #999; |
| | | padding: 80px 0; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-upload |
| | | class="image-upload" |
| | | list-type="picture-card" |
| | | :file-list="fileList" |
| | | action="#" |
| | | :http-request="customUpload" |
| | | :before-upload="beforeUpload" |
| | | :on-remove="handleRemove" |
| | | :on-preview="handlePreview" |
| | | :multiple="true" |
| | | > |
| | | <el-icon> |
| | | <Plus/> |
| | | </el-icon> |
| | | </el-upload> |
| | | </template> |
| | | |
| | | <script> |
| | | import {Plus} from '@element-plus/icons-vue' |
| | | import {upload} from "@/api/basicData/common.js"; |
| | | |
| | | export default { |
| | | name: 'ImageUpload', |
| | | emits: ['update:value'], |
| | | components: {Plus}, |
| | | props: { |
| | | value: { |
| | | type: Array, |
| | | default: () => [] |
| | | }, |
| | | type: { |
| | | type: Number, |
| | | required: true |
| | | }, |
| | | bucketName: { |
| | | type: String, |
| | | default: '' |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | fileList: [] |
| | | } |
| | | }, |
| | | watch: { |
| | | /** ç¼è¾åæ¾ */ |
| | | value: { |
| | | immediate: true, |
| | | handler(val) { |
| | | this.fileList = (val || []).map((item, index) => ({ |
| | | id: item.id, |
| | | name: item.originalFilename || `image_${index}`, |
| | | url: item.url, |
| | | status: 'success', |
| | | response: item |
| | | })) |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | beforeUpload(file) { |
| | | const isImage = file.type.startsWith('image/') |
| | | if (!isImage) { |
| | | this.$message.error('åªè½ä¸ä¼ å¾ç') |
| | | } |
| | | return isImage |
| | | }, |
| | | |
| | | customUpload({file, onSuccess, onError}) { |
| | | const formData = new FormData() |
| | | formData.append('file', file) |
| | | formData.append('bucketName', this.bucketName === '' ? undefined : this.bucketName) |
| | | formData.append('type', this.type) |
| | | |
| | | upload(formData).then(res => { |
| | | this.fileList.push({ |
| | | id: res.data[0].id, |
| | | name: res.data[0].originalFilename, |
| | | url: res.data[0].url, |
| | | status: 'success', |
| | | response: res.data[0] |
| | | }) |
| | | onSuccess(res.data) |
| | | this.emitChange() |
| | | }).catch(err => { |
| | | onError(err) |
| | | }) |
| | | }, |
| | | |
| | | handleRemove(file, fileList) { |
| | | this.fileList = fileList |
| | | this.emitChange() |
| | | }, |
| | | |
| | | handlePreview(file) { |
| | | window.open(file.url) |
| | | }, |
| | | |
| | | emitChange() { |
| | | this.$emit('update:value', this.fileList.map(item => item.response)) // v-model |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .image-upload ::v-deep(.el-upload--picture-card) { |
| | | width: 120px; |
| | | height: 120px; |
| | | } |
| | | </style> |
| | |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="è¿ç¨æè¿°"> |
| | | <el-input |
| | | v-model="form.maintenanceProcessDesc" |
| | | :rows="2" |
| | | type="textarea" |
| | | placeholder="请è¾å
¥è¿ç¨æè¿°" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="éä»¶"> |
| | | <image-upload v-model:value="form.files" :type="4"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | </template> |
| | |
| | | import useFormData from "@/hooks/useFormData"; |
| | | import { getDeviceLedger } from "@/api/equipmentManagement/ledger"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import ImageUpload from "@/components/ImageUpload/ImageUpload.vue"; |
| | | |
| | | defineOptions({ |
| | | name: "è®¾å¤æ¥ä¿®è¡¨å", |
| | |
| | | repairTime: undefined, // æ¥ä¿®æ¥æ |
| | | repairName: userStore.nickName, // æ¥ä¿®äºº |
| | | remark: undefined, // æ
éç°è±¡ |
| | | maintenanceProcessDesc: undefined, |
| | | files: [] |
| | | }); |
| | | |
| | | const setDeviceModel = (id) => { |
| | |
| | | form.repairTime = data.repairTime; |
| | | form.repairName = data.repairName; |
| | | form.remark = data.remark; |
| | | form.maintenanceProcessDesc = data.maintenanceProcessDesc; |
| | | form.files = data.files; |
| | | }; |
| | | |
| | | // onMounted(() => { |
| | |
| | | ç¼è¾ |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | text |
| | | icon="editPen" |
| | | @click="showImage(row)" |
| | | > |
| | | éä»¶ |
| | | </el-button> |
| | | <el-button |
| | | type="danger" |
| | | text |
| | | icon="delete" |
| | |
| | | </div> |
| | | <RepairModal ref="repairModalRef" @ok="getTableData" /> |
| | | <MaintainModal ref="maintainModalRef" @ok="getTableData" /> |
| | | <ImagePreviewDialog v-model:model-value="showImages" :images="imageUrls" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { usePaginationApi } from "@/hooks/usePaginationApi"; |
| | | import { getRepairPage, delRepair } from "@/api/equipmentManagement/repair"; |
| | | import {getRepairPage, delRepair, getRepairById} from "@/api/equipmentManagement/repair"; |
| | | import { onMounted, getCurrentInstance } from "vue"; |
| | | import RepairModal from "./Modal/RepairModal.vue"; |
| | | import { ElMessageBox, ElMessage } from "element-plus"; |
| | | import dayjs from "dayjs"; |
| | | import MaintainModal from "./Modal/MaintainModal.vue"; |
| | | import ImagePreviewDialog from "@/components/ImagePreview/ImagePreviewDialog.vue"; |
| | | |
| | | defineOptions({ |
| | | name: "è®¾å¤æ¥ä¿®", |
| | |
| | | // æ¨¡ææ¡å®ä¾ |
| | | const repairModalRef = ref(); |
| | | const maintainModalRef = ref(); |
| | | |
| | | const showImages = ref(false) |
| | | const imageUrls = ref([]) |
| | | |
| | | // è¡¨æ ¼å¤éæ¡éä¸é¡¹ |
| | | const multipleList = ref([]); |
| | |
| | | dataType: "slot", |
| | | slot: "operation", |
| | | align: "center", |
| | | width: "200px", |
| | | width: "300px", |
| | | }, |
| | | ] |
| | | ); |
| | |
| | | }); |
| | | }; |
| | | |
| | | const showImage = async (row) => { |
| | | const {data} = await getRepairById(row.id) |
| | | imageUrls.value = data?.files.map((item) => item.url) |
| | | showImages.value = true |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getTableData(); |
| | | }); |
| | |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="è¿ç¨æè¿°"> |
| | | <el-input |
| | | v-model="form.maintenanceProcessDesc" |
| | | :rows="2" |
| | | type="textarea" |
| | | placeholder="请è¾å
¥è¿ç¨æè¿°" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="éä»¶"> |
| | | <image-upload v-model:value="form.files" :type="5"/> |
| | | </el-form-item> |
| | | </el-form> |
| | | </template> |
| | | |
| | |
| | | import { getDeviceLedger } from "@/api/equipmentManagement/ledger"; |
| | | import { onMounted } from "vue"; |
| | | import dayjs from "dayjs"; |
| | | import ImageUpload from "@/components/ImageUpload/ImageUpload.vue"; |
| | | |
| | | defineOptions({ |
| | | name: "计å表å", |
| | |
| | | deviceName: undefined, // 设å¤åç§° |
| | | deviceModel: undefined, // è§æ ¼åå· |
| | | maintenancePlanTime: undefined, // 计åä¿å
»æ¥æ |
| | | maintenanceProcessDesc: undefined, |
| | | files: [], |
| | | }); |
| | | |
| | | const setDeviceModel = (id) => { |
| | |
| | | form.deviceLedgerId = data.deviceLedgerId; |
| | | form.deviceName = data.deviceName; |
| | | form.deviceModel = data.deviceModel; |
| | | form.maintenanceProcessDesc = data.maintenanceProcessDesc; |
| | | form.files = data.files; |
| | | form.maintenancePlanTime = dayjs(data.maintenancePlanTime).format( |
| | | "YYYY-MM-DD HH:mm:ss" |
| | | ); |
| | |
| | | <el-dialog |
| | | v-model="visible" |
| | | :title="modalOptions.title" |
| | | width="30%" |
| | | width="50%" |
| | | @close="close" |
| | | > |
| | | <PlanForm ref="planFormRef"></PlanForm> |
| | |
| | | ç¼è¾ |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | text |
| | | icon="editPen" |
| | | @click="showImage(row)" |
| | | > |
| | | éä»¶ |
| | | </el-button> |
| | | <el-button |
| | | type="danger" |
| | | text |
| | | icon="delete" |
| | |
| | | </div> |
| | | <PlanModal ref="planModalRef" @ok="getTableData" /> |
| | | <MaintenanceModal ref="maintainModalRef" @ok="getTableData" /> |
| | | <ImagePreviewDialog v-model:model-value="showImages" :images="imageUrls" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { usePaginationApi } from "@/hooks/usePaginationApi"; |
| | | import { getUpkeepPage, delUpkeep } from "@/api/equipmentManagement/upkeep"; |
| | | import {getUpkeepPage, delUpkeep, getUpkeepById} from "@/api/equipmentManagement/upkeep"; |
| | | import { onMounted, getCurrentInstance } from "vue"; |
| | | import PlanModal from "./Modal/PlanModal.vue"; |
| | | import MaintenanceModal from "./Modal/MaintenanceModal.vue"; |
| | | import ImagePreviewDialog from "@/components/ImagePreview/ImagePreviewDialog.vue"; |
| | | import dayjs from "dayjs"; |
| | | import { ElMessageBox, ElMessage } from "element-plus"; |
| | | |
| | |
| | | |
| | | // è¡¨æ ¼å¤éæ¡éä¸é¡¹ |
| | | const multipleList = ref([]); |
| | | |
| | | const showImages = ref(false) |
| | | const imageUrls = ref([]) |
| | | |
| | | // å¤éååä»ä¹ |
| | | const handleSelectionChange = (selectionList) => { |
| | |
| | | dataType: "slot", |
| | | slot: "operation", |
| | | align: "center", |
| | | width: "200px", |
| | | width: "300px", |
| | | }, |
| | | ]); |
| | | // type == 1å®é
ä¿å
»æ¶é´ 2计åä¿å
»æ¶é´ |
| | |
| | | }); |
| | | }; |
| | | |
| | | const showImage = async (row) => { |
| | | const {data} = await getUpkeepById(row.id) |
| | | imageUrls.value = data?.files.map((item) => item.url) |
| | | showImages.value = true |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getTableData(); |
| | | }); |