From ff9dfc15ef267fcc5e2343d7bbf6927394bd9948 Mon Sep 17 00:00:00 2001 From: qushaowei <qushaowei@163.com> Date: 星期三, 13 十二月 2023 14:50:57 +0800 Subject: [PATCH] 炉类设备报告上传 --- src/views/eam/modules/daily3MaintenanceOrder/StoveCategoryReportList.vue | 319 ++++++++++++++++++++++++ src/views/eam/Daily3MaintenanceOrderList.vue | 22 + src/views/eam/modules/daily3MaintenanceOrder/DailyMaintenanceOrderExeDrawer.vue | 19 + src/views/eam/modules/daily3MaintenanceOrder/StoveCategoryReportModal.vue | 382 +++++++++++++++++++++++++++++ 4 files changed, 741 insertions(+), 1 deletions(-) diff --git a/src/views/eam/Daily3MaintenanceOrderList.vue b/src/views/eam/Daily3MaintenanceOrderList.vue index 8fbd6d6..2e19354 100644 --- a/src/views/eam/Daily3MaintenanceOrderList.vue +++ b/src/views/eam/Daily3MaintenanceOrderList.vue @@ -306,6 +306,15 @@ type="vertical" /> <a + v-show="record.status === '5' && record.isNotStoveCategoryFlag == true && (record.stoveExemptStatus == '0' ||record.stoveExemptStatus == '1' ||record.stoveExemptStatus == '2')" + @click="handleStoveReport(record)" + v-has="'daily3MaintenanceOrder:StoveCategoryReport'" + >鐐夌被鎶ュ憡</a> + <a-divider + v-show="record.status === '5'&& record.isNotStoveCategoryFlag == true && (record.stoveExemptStatus == '0' ||record.stoveExemptStatus == '1' ||record.stoveExemptStatus == '2')" + type="vertical" + /> + <a v-show="record.status === '5' && record.isNotStoveCategoryFlag == false && record.precisionParameters != '1'" @click="handleTechnologyStatus(record)" v-has="'daily3MaintenanceOrder:TechnologyStatus'" @@ -387,6 +396,10 @@ ref="StoveCategoryModal" @ok="modalFormOk" ></stove-category-modal> + <stove-category-report-modal + ref="StoveCategoryReportModal" + @ok="modalFormOk" + ></stove-category-report-modal> <maintenance-order-assign-modal ref="MaintenanceOrderAssignModal" @ok="modalFormOk" @@ -420,6 +433,7 @@ import MaintenanceOrderChangeModal from './modules/dailyMaintenanceOrder/MaintenanceOrderChangeModal' import EquipmentPrecisionCheckOrderModal from './modules/daily3MaintenanceOrder/EquipmentPrecisionCheckOrderModal' import StoveCategoryModal from './modules/daily3MaintenanceOrder/StoveCategoryModal' +import StoveCategoryReportModal from './modules/daily3MaintenanceOrder/StoveCategoryReportModal' import MaintenanceOrderAssignModal from './modules/dailyMaintenanceOrder/MaintenanceOrderAssignModal' import DailyMaintenanceOrderExeDrawer from './modules/daily3MaintenanceOrder/DailyMaintenanceOrderExeDrawer' import EquipmentTechnologyStatusModal from './modules/daily3MaintenanceOrder/EquipmentTechnologyStatusModal' @@ -439,6 +453,7 @@ DailyMaintenanceOrderExeDrawer, MaintenanceOrderChangeModal, StoveCategoryModal, + StoveCategoryReportModal, EquipmentTechnologyStatusModal, TechnologyStatusAuthenticateModal, Maintenance3ReceiptModal, @@ -703,6 +718,13 @@ this.$refs.StoveCategoryModal.title = "娓╁害鍧囧寑鎬ф娴嬫潯浠剁‘璁よ〃"; this.$refs.StoveCategoryModal.disableSubmit = false; }, + handleStoveReport: function (record) { + this.$refs.StoveCategoryReportModal.add(); + this.$refs.StoveCategoryReportModal.title = "鐐夌被璁惧鎶ュ憡涓婁紶"; + this.$refs.StoveCategoryReportModal.disableSubmit = false; + this.$refs.StoveCategoryReportModal.maintenanceStandardId = record.id + this.$refs.StoveCategoryReportModal.equipmentId = record.equipmentId + }, handleOrderChange: function (record) { this.$refs.MaintenanceOrderChangeModal.edit(record); diff --git a/src/views/eam/modules/daily3MaintenanceOrder/DailyMaintenanceOrderExeDrawer.vue b/src/views/eam/modules/daily3MaintenanceOrder/DailyMaintenanceOrderExeDrawer.vue index b08f403..4c05333 100644 --- a/src/views/eam/modules/daily3MaintenanceOrder/DailyMaintenanceOrderExeDrawer.vue +++ b/src/views/eam/modules/daily3MaintenanceOrder/DailyMaintenanceOrderExeDrawer.vue @@ -286,6 +286,17 @@ ></actual-work-hours-edit-table> </div> </a-tab-pane> + <a-tab-pane + tab='鐐夌被鎶ュ憡' + key="7" + > + <div + class="table-operator" + style="margin:-16px" + > + <stove-category-report-list :maintenanceStandardId='this.model.id' /> + </div> + </a-tab-pane> </a-tabs> </a-card> </template> @@ -333,6 +344,7 @@ import MaintenanceStandardWorkInstruction from '../dailyMaintenanceOrder/MaintenanceStandardWorkInstruction' import ActualMaterialEditTable from '../dailyMaintenanceOrder/ActualMaterialEditTable.vue' import ActualWorkHoursEditTable from '../dailyMaintenanceOrder/ActualWorkHoursEditTable.vue' +import StoveCategoryReportList from './StoveCategoryReportList.vue' export default { name: 'DailyMaintenanceOrderExeDrawer', @@ -345,7 +357,8 @@ MaintenanceStandardSafetyRequirement, MaintenanceStandardWorkInstruction, ActualMaterialEditTable, - ActualWorkHoursEditTable + ActualWorkHoursEditTable, + StoveCategoryReportList }, data() { return { @@ -359,6 +372,7 @@ revocationDistable: false, currentNodeSelect: '', maintenanceStandardId: '-1', + maintenanceOrderId: '-1', loading: false, dataSource: [], model: {}, @@ -473,6 +487,7 @@ handleShow(record) { this.model = Object.assign({}, record); this.maintenanceStandardId = record.maintenanceStandardId + this.maintenanceOrderId = record.id this.dataSource = [] this.visible = true; this.queryParam.dailyMaintenanceOrderId = record.id @@ -522,6 +537,8 @@ return "background-color:rgba(127, 127, 127,0.08)"; }, handleCancel() { + debugger + this.maintenanceOrderId = '-1' this.$emit('ok'); this.alterFlag = new Date(); this.close() diff --git a/src/views/eam/modules/daily3MaintenanceOrder/StoveCategoryReportList.vue b/src/views/eam/modules/daily3MaintenanceOrder/StoveCategoryReportList.vue new file mode 100644 index 0000000..788d8b7 --- /dev/null +++ b/src/views/eam/modules/daily3MaintenanceOrder/StoveCategoryReportList.vue @@ -0,0 +1,319 @@ +<template> + <a-card + :bordered="false" + :class="'cust-erp-sub-tab'" + > + <!-- 鏌ヨ鍖哄煙 --> + <div class="table-page-search-wrapper"> + <a-form + layout="inline" + @keyup.enter.native="searchQuery" + > + <a-row :gutter="24"> + </a-row> + </a-form> + </div> + <div> + + <a-table + ref="table" + size="middle" + bordered + rowKey="id" + :scroll="{x:true}" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + @change="handleTableChange" + > + <span + slot="size" + slot-scope="text" + class="error" + > + {{sizeConvert(text)}} + </span> + <span + slot="action" + slot-scope="text, record" + > + + <Tooltip + placement="top" + title="棰勮鍥剧墖" + > + <img + v-if="record.upload.path && (record.upload.format.toLowerCase()=='jpg'||record.upload.format.toLowerCase()=='bmp'||record.upload.format.toLowerCase()=='png'||record.upload.format.toLowerCase()=='jpeg'||record.upload.format.toLowerCase()=='gif')" + width="30" + height="14" + border="1" + draggable="false" + preview="1" + :preview-text="''" + :src="record.upload.src" + /> + </Tooltip> + + <a + v-if="record.upload.path && record.upload.format.toLowerCase()=='pdf'" + href="javascript:;" + @click="view(record)" + > + 棰勮 + </a> + + <a-divider + v-if="record.upload.path && (record.upload.format.toLowerCase()=='jpg'||record.upload.format.toLowerCase()=='bmp'||record.upload.format.toLowerCase()=='png'||record.upload.format.toLowerCase()=='jpeg'||record.upload.format.toLowerCase()=='gif'||record.upload.format.toLowerCase()=='pdf')" + type="vertical" + /> + + <a + href="javascript:;" + @click="handleDownload(record)" + >涓嬭浇</a> + <!-- + <a-divider type="vertical" /> + <a-popconfirm + title="纭畾鍒犻櫎鍚�?" + @confirm="() => handleDelete(record.id)" + > + <a>鍒犻櫎</a> + </a-popconfirm> --> + + </span> + </a-table> + </div> + <pdf-view ref="pdfview"></pdf-view> + </a-card> +</template> + +<script> +import { JeecgListMixin } from '@/mixins/JeecgListMixin' +import { getAction, deleteAction, downFile } from '@/api/manage' +import Tooltip from 'ant-design-vue/es/tooltip' +import JInput from '@/components/jeecg/JInput' +import JEllipsis from "@/components/jeecg/JEllipsis"; + +import { preview } from 'vue-photo-preview' +import { ACCESS_TOKEN } from '@/store/mutation-types' +import Vue from 'vue' +import PdfView from '@views/common/PdfView' +import { getFileAccessHttpUrl } from '@/api/manage'; +import store from '@/store/' + +export default { + name: "MaintenanceStandardWorkInstruction", + components: { + Tooltip, + JInput, + JEllipsis, + PdfView, + preview, + }, + mixins: [JeecgListMixin], + props: { + maintenanceStandardId: { + type: String, + default: '-1', + required: false + } + }, + watch: { + maintenanceStandardId: { + immediate: true, + handler(val) { + if (!this.maintenanceStandardId) { + this.clearList() + } else { + this.queryParam['maintenanceStandardId'] = val; + this.queryParam['delFlag'] = 0; + this.loadData(1); + } + } + } + }, + data() { + return { + columns: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + width: 100, + align: "center", + customRender: function (t, r, index) { + return parseInt(index) + 1; + } + }, + { + title: '鎶ュ憡缂栫爜', + align: 'center', + dataIndex: 'num' + }, + + { + title: '鎶ュ憡鍚嶇О', + align: 'center', + dataIndex: 'name' + }, + // { + // title: '鎶ュ憡绫诲瀷', + // align: 'center', + // dataIndex: 'typeName' + // }, + { + title: '鎶ュ憡澶у皬', + align: 'center', + dataIndex: 'size', + scopedSlots: { customRender: 'size' }, + }, + { + title: '鎿嶄綔', + align: 'center', + dataIndex: 'action', + scopedSlots: { + customRender: 'action' + }, + } + ], + url: { + list: "/eam/maintenanceStandardWorkInstruction/getMaintenanceStandardWorkInstructionList", + urlDownload: window._CONFIG['staticDomainURL'], + download: '/sys/upload/downloadFile', + }, + } + }, + + methods: { + clearList() { + this.dataSource = [] + this.selectedRowKeys = [] + this.ipagination.current = 1 + }, + loadData(arg) { + if (!this.url.list) { + this.$message.error("璇疯缃畊rl.list灞炴��!") + return + } + //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭 + if (arg === 1) { + this.ipagination.current = 1; + } + var params = this.getQueryParams();//鏌ヨ鏉′欢 + this.loading = true; + getAction(this.url.list, params).then((res) => { + if (res.success) { + for (let i = 0; i < res.result.records.length; i++) { + let r = res.result.records[i].upload; + r.src = this.getSrc(res.result.records[i].upload); + } + this.dataSource = res.result.records || res.result; + if (res.result.total) { + this.ipagination.total = res.result.total; + } else { + this.ipagination.total = 0; + } + //update-end---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------ + } else { + this.$message.warning(res.message) + } + }).finally(() => { + this.loading = false + }) + }, + + handleDownload(record) { + downFile(this.url.download, { id: record.upload.id }).then((res) => { + if (!res) { + this.$message.warning('鏂囦欢涓嬭浇澶辫触') + return + } else { + let fileName = record.name; + if (typeof window.navigator.msSaveBlob !== 'undefined') { + window.navigator.msSaveBlob(new Blob([res]), fileName); + } else { + let url = window.URL.createObjectURL(new Blob([res])); + let link = document.createElement('a'); + link.style.display = 'none'; + link.href = url; + link.setAttribute('download', fileName); + document.body.appendChild(link); + link.click() + document.body.removeChild(link) //涓嬭浇瀹屾垚绉婚櫎鍏冪礌 + window.URL.revokeObjectURL(url) //閲婃斁鎺塨lob瀵硅薄 + } + } + }) + }, + + //鎷艰src + getSrc(record) { + + if (!record.path) { + return ''; + } + //鏈湴锛歭ocal\Minio锛歮inio\闃块噷浜戯細alioss + if (record.uploadType == 'local') { + + let ssoLoginFlag = Vue.ls.get("ssoLoginFlag"); + let deployMode = Vue.ls.get("deployMode"); + + if (ssoLoginFlag && deployMode == "container") { + var baseProject = Vue.ls.get("baseProject"); + console.log("baseProject==>" + baseProject) + + var hostname = window.location.protocol + "//" + window.location.host; + var url = hostname + '/' + baseProject + '/sys/common/static'; + return getFileAccessHttpUrl(record.path + record.encodeName, url, window._CONFIG['hyperTextTransfer']) + } else { + //鏍规嵁鍙戝竷鐘舵�佷慨鏀筯ttps 鎴� http + return getFileAccessHttpUrl(record.path + record.encodeName, this.url.urlDownload, window._CONFIG['hyperTextTransfer']) + } + + } else if (record.uploadType == 'alioss') { + + const OSS = require('ali-oss') + const client = new OSS({ + // region浠ユ澀宸炰负渚嬶紙oss-cn-hangzhou锛夛紝鍏朵粬region鎸夊疄闄呮儏鍐靛~鍐欍�� + region: window._CONFIG['region'], + // 闃块噷浜戜富璐﹀彿AccessKey鎷ユ湁鎵�鏈堿PI鐨勮闂潈闄愶紝椋庨櫓寰堥珮銆傚己鐑堝缓璁偍鍒涘缓骞朵娇鐢≧AM璐﹀彿杩涜API璁块棶鎴栨棩甯歌繍缁达紝璇风櫥褰昍AM鎺у埗鍙板垱寤篟AM璐﹀彿銆� + accessKeyId: window._CONFIG['accessKeyId'], + accessKeySecret: window._CONFIG['accessKeySecret'], + bucket: window._CONFIG['bucket'], + }) + // object-key琛ㄧず浠嶰SS涓嬭浇鏂囦欢鏃堕渶瑕佹寚瀹氬寘鍚枃浠跺悗缂�鍦ㄥ唴鐨勫畬鏁磋矾寰勶紝渚嬪abc/efg/123.jpg銆� + return client.signatureUrl(record.path) + } + }, + + + sizeConvert(limit) { + var size = ""; + if (limit < 0.1 * 1024) { + size = parseFloat(limit).toFixed(2) + "B";//灏忎簬0.1KB锛屽垯杞寲鎴怋 + } else if (limit < 0.1 * 1024 * 1024) { + size = (parseFloat(limit) / 1024).toFixed(2) + "KB";//灏忎簬0.1MB锛屽垯杞寲鎴怟B + } else if (limit < 0.1 * 1024 * 1024 * 1024) { + size = (parseFloat(limit) / (1024 * 1024)).toFixed(2) + "MB";//灏忎簬0.1GB锛屽垯杞寲鎴怣B + } else { + size = (parseFloat(limit) / (1024 * 1024 * 1024)).toFixed(2) + "GB";//鍏朵粬杞寲鎴怗B + } + var sizeStr = size + "";//杞垚瀛楃涓� + var index = sizeStr.indexOf(".");//鑾峰彇灏忔暟鐐瑰鐨勭储寮� + var dou = sizeStr.substr(index + 1, 2);//鑾峰彇灏忔暟鐐瑰悗涓や綅鐨勫�� + if (dou == "00") {//鍒ゆ柇鍚庝袱浣嶆槸鍚︿负00锛屽鏋滄槸鍒欏垹闄�00 + return sizeStr.substring(0, index) + sizeStr.substr(index + 3, 2); + } + return size; + }, + + view(record) { + this.$refs.pdfview.showPdf(record.src); + }, + } +} +</script> +<style scoped> +@import '~@assets/less/common.less'; +</style> diff --git a/src/views/eam/modules/daily3MaintenanceOrder/StoveCategoryReportModal.vue b/src/views/eam/modules/daily3MaintenanceOrder/StoveCategoryReportModal.vue new file mode 100644 index 0000000..57fa79c --- /dev/null +++ b/src/views/eam/modules/daily3MaintenanceOrder/StoveCategoryReportModal.vue @@ -0,0 +1,382 @@ +<template> + <a-modal + :title="title" + :width="850" + :visible="visible" + :maskClosable="false" + :confirmLoading="confirmLoading" + :okButtonProps="{ props: {disabled: disableSubmit} }" + @ok="handleOk" + @cancel="handleCancel" + cancelText="鍏抽棴" + > + <a-spin :spinning="confirmLoading"> + <a-form :form="form"> + <a-row :gutter="24"> + <a-col :span="24"> + <a-form-item + :labelCol="{span:4}" + :wrapperCol="{span:18}" + label="鎶ュ憡缂栫爜" + > + <a-input + :disabled="disableSubmit" + placeholder="璇疯緭鍏ユ姤鍛婄紪鐮�" + v-decorator="['num', validatorRules.num ]" + /> + </a-form-item> + </a-col> + </a-row> + <!-- <a-row :gutter="24"> + <a-col :span="24"> + <a-form-item + :labelCol="{span:4}" + :wrapperCol="{span:18}" + label="鎶ュ憡绫诲瀷" + > + <j-dict-select-tag + allow-clear + placeholder="璇烽�夋嫨鏂囨。绫诲瀷" + :triggerChange="true" + dictCode="mom_eam_document_type,name,id, del_flag!='1'" + v-decorator="['fileType', validatorRules.fileType ]" + /> + </a-form-item> + </a-col> + </a-row> --> + <a-row :gutter="24"> + <a-col :span="24"> + <a-form-item + :labelCol="{span:4}" + :wrapperCol="{span:18}" + label="鏂囦欢涓婁紶" + > + <a-upload-dragger + name="file" + :customRequest="customRequest" + @change="handleChange" + :file-list="fileList" + :multiple="false" + > + <p class="ant-upload-drag-icon"> + <a-icon type="inbox" /> + </p> + <p class="ant-upload-text"> + 鐐瑰嚮涓婁紶鎴栨嫋鎷芥枃浠惰嚦璇ュ尯鍩熻繘琛屼笂浼� + </p> + <p class="ant-upload-hint"> + 浠呮敮鎸佸崟鏂囦欢涓婁紶 + </p> + </a-upload-dragger> + </a-form-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="24"> + <a-form-item + :labelCol="{span:4}" + :wrapperCol="{span:18}" + label="鎶ュ憡鍚嶇О" + > + <a-input + :disabled="true " + placeholder="璇疯緭鍏ユ姤鍛婂悕绉�" + v-decorator="['name', validatorRules.name ]" + /> + </a-form-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="24"> + <a-form-model-item + label="鎶�鏈姸鎬�" + :labelCol="{span:4}" + :wrapperCol="{span:18}" + > + <j-dict-select-tag + allow-clear + placeholder="璇烽�夋嫨鎶�鏈姸鎬�" + :triggerChange="true" + dictCode="technology_status_stove" + v-decorator="['technologyStatus', validatorRules.technologyStatus ]" + /> + </a-form-model-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="24"> + <a-form-item + :labelCol="{span:4}" + :wrapperCol="{span:18}" + label="鎶ュ憡鎻忚堪" + > + <a-textarea + :disabled="disableSubmit" + placeholder="璇疯緭鍏ユ姤鍛婃弿杩�" + allow-clear + v-decorator="['description', validatorRules.description]" + /> + </a-form-item> + </a-col> + </a-row> + + </a-form> + </a-spin> + <template slot='footer'> + <a-button + :style="{marginRight: '8px'}" + @click="handleCancel" + :loading='confirmLoading' + > + 鍙栨秷 + </a-button> + <a-popconfirm + @confirm="() => handleOk()" + title="纭姝ゆ搷浣滐紵" + > + <a-button + type='primary' + :loading='confirmLoading' + :style="{marginRight: '8px'}" + > + 纭畾 + </a-button> + </a-popconfirm> + </template> + </a-modal> +</template> + +<script> +import { getAction, postAction, postFileAction } from '@/api/manage' +import Vue from 'vue' +import JInput from '@/components/jeecg/JInput' +import Tooltip from 'ant-design-vue/es/tooltip' +import JEllipsis from "@/components/jeecg/JEllipsis"; +import { ajaxGetDictItems } from '@/api/api' +import { ACCESS_TOKEN, TENANT_ID } from "@/store/mutation-types" + +export default { + name: "StoveCategoryReportModal", + components: { + JInput, + Tooltip, + JEllipsis, + }, + data() { + return { + title: "鎿嶄綔", + visible: false, + disableSubmit: false, + model: {}, + labelCol: { + xs: { span: 24 }, + sm: { span: 8 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + confirmLoading: false, + form: this.$form.createForm(this), + headers: {}, + validatorRules: { + num: { + rules: [ + { required: true, message: '璇疯緭鍏ョ紪鐮侊紒' }, + { min: 0, max: 150, message: '鏈�闀� 30 涓瓧绗�', trigger: 'blur' }, + ] + }, + fileType: { + rules: [ + { required: true, message: '璇疯緭鍏ラ�夋嫨绫诲瀷锛�' }, + ] + }, + name: { + rules: [ + { required: true, message: '璇疯緭鍏ュ悕绉帮紒' }, + ] + }, + technologyStatus: { + rules: [ + { required: true, message: '璇烽�夋嫨鎶�鏈姸鎬侊紒' }, + ] + }, + }, + url: { + add: "/eam/maintenanceStandardWorkInstruction/addStoveCategoryReport", + edit: "/eam/maintenanceStandardWorkInstruction/edit", + listByBusIdAndBusType: "/system/sysUploadRela/listByBusIdAndBusType", + }, + //鐢ㄤ簬灞曠ず鏂囦欢 + fileList: [], + fileObject: {}, + fileTypes: [], + //鐢ㄤ簬鍒ゆ柇闄勪欢鐨勭姸鎬� add锛氭柊澧為〉闈㈢殑闄勪欢 edit锛氱紪杈戦〉闈㈢殑闄勪欢涓鸿淇敼i editUpdate锛氱紪杈戦〉闈㈢殑闄勪欢琚慨鏀� + isFileChange: false, + uploadId: '', + maintenanceStandardId: '', + equipmentId: '', + } + }, + + methods: { + customRequest(val) { + if (this.fileList.length == 0) { + this.fileObject = val; + } + }, + + handleChange(info) { + //榛樿缁欓檮浠剁姸鎬侊紝浠呮帶鍒舵牱寮� + let file = info.file; + //鏂囦欢鏇存敼锛屾爣璁版洿鏂� + if (this.model.id) { + this.isFileChange = true; + } + //鍒犻櫎 + if (file.status == "removed") { + this.fileList = []; + this.fileObject.file = {}; + this.form.setFieldsValue({ name: '' }); + return false; + } + //鍗曟枃浠舵帶鍒� + if (this.fileList.length > 0) { + this.$message.warning("褰撳墠浠呭厑璁镐笂浼犱竴涓枃浠讹紒"); + return false; + } + file.status = 'done'; + //椤甸潰灞曠ず涓婁紶鏂囦欢 + this.fileList.push(file); + this.form.setFieldsValue({ name: file.name }); + }, + + add() { + this.edit({}) + }, + + edit(record) { + let that = this; + that.visible = true; + that.isFileChange = false; + that.model = Object.assign({}, record); + that.fileList = []; + that.form.resetFields(); + that.uploadId = '' + if (record.isNoPhotoFlag) { + //鑾峰彇褰撳墠鏂囦欢瀵瑰簲闄勪欢 + getAction(that.url.listByBusIdAndBusType, { busId: record.id, busType: 'maintenance_standard_work_instruction' }).then((res) => { + if (res.success) { + for (let i = 0; i < res.result.length; i++) { + that.fileList.push({ + uid: res.result[i].upload.id, + name: res.result[i].upload.name, + status: "done", + }) + that.$nextTick(() => { + that.form.setFieldsValue({ name: res.result[i].upload.name }); + }); + } + } + }) + } + }, + + close() { + this.$emit('close'); + this.visible = false; + }, + + handleOk() { + const that = this; + // 瑙﹀彂琛ㄥ崟楠岃瘉 + that.form.validateFields((err, values) => { + if (JSON.stringify(that.fileObject.file) == '{}' && that.uploadId == '' && that.fileList.length == 0) { + that.$message.warning("璇蜂笂浼犳枃浠�"); + return false + } + if (!err) { + that.confirmLoading = true; + let httpurl = '' + let method = '' + if (!that.model.id) { + httpurl += that.url.add; + method = 'post'; + } else { + httpurl += that.url.edit; + method = 'put'; + } + let formData = Object.assign(that.model, values); + + formData.type = "maintenance_standard_work_instruction"; + formData.uploadId = that.uploadId; + // formData.fileType = "7";//鏂囦欢绫诲瀷 7锛氬浘鐗� + formData.maintenanceStandardId = this.maintenanceStandardId; + formData.equipmentId = this.equipmentId + var saveDate = new FormData(); + + formData.isFileChange = that.isFileChange; + + saveDate.append("file", that.fileObject.file); + saveDate.append('data', JSON.stringify(formData)); + + postFileAction(httpurl, saveDate, this.headers).then((res) => { + if (res.success) { + that.$message.success(res.message); + that.$emit('ok'); + } else { + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + that.close(); + }) + } + }).catch((e) => { }) + }, + + handleCancel() { + this.close(); + }, + // initFileTypes() { + // ajaxGetDictItems("common_upload_type", null).then((res) => { + // if (res.success) { + // this.fileTypes = res.result; + // } + // }) + // }, + + }, + + created() { + // this.initFileTypes(); + const token = Vue.ls.get(ACCESS_TOKEN); + const tenantid = Vue.ls.get(TENANT_ID) + this.headers = { + 'Content-Type': 'multipart/form-data', + "X-Access-Token": token, + 'X-Access-Tenant': tenantid + }; + }, +} +</script> +<style scoped> +.ant-btn { + padding: 0 10px; + margin-left: 3px; +} + +.ant-form-item-control { + line-height: 0px; +} + +/** 涓昏〃鍗曡闂磋窛 */ +.ant-form .ant-form-item { + margin-bottom: 10px; +} + +/** Tab椤甸潰琛岄棿璺� */ +.ant-tabs-content .ant-form-item { + margin-bottom: 0px; +} +</style> \ No newline at end of file -- Gitblit v1.9.3