¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-modal |
| | | :title="title" |
| | | :width="1500" |
| | | :visible="visible" |
| | | :maskClosable="false" |
| | | @ok="handleOk" |
| | | cancelText="å
³é" |
| | | @cancel="handleCancel" |
| | | :confirmLoading="confirmLoading" |
| | | > |
| | | <a-spin :spinning="confirmLoading"> |
| | | <a-form :form="form"> |
| | | <a-row :gutter="24"> |
| | | <a-col :span="12"> |
| | | <a-form-item |
| | | label="æ åç¼ç " |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | > |
| | | <a-input |
| | | allowClear |
| | | :disabled="disableSubmit||isRevise" |
| | | :placeholder="disableSubmit?'':'请è¾å
¥æ åç¼ç '" |
| | | v-decorator="[ 'num', validatorRules.num]" |
| | | /> |
| | | </a-form-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-item |
| | | label="设å¤åç§°" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | > |
| | | <a-input-search |
| | | :disabled="disableSubmit" |
| | | placeholder="è¯·éæ©è®¾å¤" |
| | | enter-button |
| | | @search="onEquipmentList()" |
| | | :read-only="true" |
| | | v-decorator="['equipmentName', validatorRules.equipmentName]" |
| | | /> |
| | | </a-form-item> |
| | | </a-col> |
| | | <a-col |
| | | :span="12" |
| | | hidden |
| | | > |
| | | <!-- v-if="false" --> |
| | | <a-form-item |
| | | label="设å¤åç§°Id" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | > |
| | | <a-input |
| | | :disabled="disableSubmit" |
| | | placeholder="è¯·éæ©è®¾å¤åç§°Id" |
| | | enter-button |
| | | :read-only="true" |
| | | v-decorator="['equipmentId', {}]" |
| | | /> |
| | | </a-form-item> |
| | | </a-col> |
| | | <!-- <a-col :span="12"> |
| | | <a-form-item |
| | | label="对象é¨é¨" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | > |
| | | <j-dict-select-tag |
| | | allow-clear |
| | | :disabled="disableSubmit" |
| | | :placeholder="disableSubmit?'':'请对象é¨é¨'" |
| | | :triggerChange="true" |
| | | dictCode="sys_depart,depart_name,id,version = '7' and del_flag!='1'" |
| | | v-decorator="['departId', validatorRules.departId]" |
| | | @change="(e)=>handle2Change(e)" |
| | | /> |
| | | </a-form-item> |
| | | </a-col> --> |
| | | </a-row> |
| | | <a-row :gutter="24"> |
| | | <a-col :span="12"> |
| | | <a-form-item |
| | | label="对象é¨é¨" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | > |
| | | <j-dict-select-tag |
| | | allow-clear |
| | | :placeholder="disableSubmit?'':'è¯·éæ©å¯¹è±¡é¨é¨'" |
| | | :triggerChange="true" |
| | | :disabled="true" |
| | | dictCode="sys_depart,depart_name,id" |
| | | v-decorator="['departId', validatorRules.departId]" |
| | | /> |
| | | </a-form-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row :gutter="24"> |
| | | <a-col :span="12"> |
| | | <a-form-item |
| | | label="çæ¬" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | > |
| | | <a-input |
| | | allowClear |
| | | :disabled="true" |
| | | :placeholder="disableSubmit?'':'请è¾å
¥çæ¬å·'" |
| | | v-decorator="[ 'version', validatorRules.version]" |
| | | /> |
| | | </a-form-item> |
| | | </a-col> |
| | | <a-col |
| | | v-if="this.isRevise == true" |
| | | :span="12" |
| | | > |
| | | <a-form-item |
| | | label="åå²çæ¬" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | > |
| | | <a-input |
| | | allowClear |
| | | :disabled="true" |
| | | :placeholder="disableSubmit?'':'请è¾å
¥åå²çæ¬å·'" |
| | | v-decorator="[ 'historyVersion', validatorRules.historyVersion]" |
| | | /> |
| | | </a-form-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row :gutter="24"> |
| | | <a-col :span="24"> |
| | | <a-form-item |
| | | label="夿³¨" |
| | | :labelCol="{span:3}" |
| | | :wrapperCol="{span:21}" |
| | | > |
| | | <a-textarea |
| | | allowClear |
| | | :disabled="disableSubmit" |
| | | :placeholder="disableSubmit?'':'请è¾å
¥å¤æ³¨'" |
| | | v-decorator="[ 'remark', validatorRules.remark]" |
| | | /> |
| | | </a-form-item> |
| | | </a-col> |
| | | </a-row> |
| | | </a-form> |
| | | </a-spin> |
| | | <a-button |
| | | type="primary" |
| | | :style="{ marginRight: '8px',marginBottom:'8px' }" |
| | | :loading="confirmLoading" |
| | | @click="selectMaintenanceProjects()" |
| | | >ä¿å
»é¡¹ç®</a-button> |
| | | <a-table |
| | | ref="table" |
| | | bordered |
| | | :scroll="{ x: 'calc(1200px + 50%)', y: 900 }" |
| | | size="middle" |
| | | rowKey='id' |
| | | :columns="columns" |
| | | :dataSource="dataSource" |
| | | > |
| | | <template |
| | | v-for="col in columns" |
| | | :slot="col.dataIndex" |
| | | slot-scope='text, record, index' |
| | | > |
| | | <div :key="col.dataIndex"> |
| | | |
| | | <a-select |
| | | v-if="col.dataIndex == 'maintenanceCycleId'" |
| | | :value="text" |
| | | :options="record.maintenanceCycles" |
| | | @change="(e) => handleChange(e, record.key, col, index)" |
| | | style="width: 100%" |
| | | :disabled="false" |
| | | /> |
| | | <a-select |
| | | v-if="col.dataIndex == 'maintenanceMode'" |
| | | :value="text" |
| | | :options="record.maintenanceModes" |
| | | @change="(e) => handleChange(e, record.key, col, index)" |
| | | style="width: 100%" |
| | | :disabled="false" |
| | | /> |
| | | <a-textarea |
| | | :value="text" |
| | | v-if="col.dataIndex == 'maintenanceRequire'" |
| | | :maxLength="500" |
| | | auto-size |
| | | placeholder="请è¾å
¥å®å
¨è¦æ±" |
| | | @change="(e)=>handleChange(e, record.key, col, index)" |
| | | /> |
| | | <a-textarea |
| | | :value="text" |
| | | v-if="col.dataIndex == 'location'" |
| | | :maxLength="500" |
| | | auto-size |
| | | placeholder="请è¾å
¥ä¿å
»é¨ä½" |
| | | @change="(e)=>handleChange(e, record.key, col, index)" |
| | | :disabled="true" |
| | | /> |
| | | <j-image-upload |
| | | :value="text" |
| | | v-if="col.dataIndex == 'photo'" |
| | | :isMultiple="false" |
| | | auto-size |
| | | placeholder="请ä¸ä¼ å¾ç" |
| | | @change="(e)=>handleChange(e, record.key, col, index)" |
| | | ></j-image-upload> |
| | | </div> |
| | | </template> |
| | | |
| | | <span |
| | | slot="action" |
| | | slot-scope="text, record, index" |
| | | > |
| | | <a-popconfirm |
| | | title="ç¡®å®å é¤å?" |
| | | @confirm="() => handleDelete(text,record, index)" |
| | | > |
| | | <a>å é¤</a> |
| | | </a-popconfirm> |
| | | </span> |
| | | |
| | | <!-- <span |
| | | slot="photo" |
| | | 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.upload)" |
| | | > |
| | | é¢è§ |
| | | </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="handleUpload(record)" |
| | | >ä¸ä¼ </a> --> |
| | | <!-- </span> --> |
| | | </a-table> |
| | | <template slot="footer"> |
| | | <a-button |
| | | :style="{marginRight: '8px'}" |
| | | @click="handleCancel()" |
| | | > |
| | | å
³é |
| | | </a-button> |
| | | |
| | | <a-button |
| | | @click="handleOk()" |
| | | type="primary" |
| | | :loading="confirmLoading" |
| | | >ç¡®å®</a-button> |
| | | </template> |
| | | |
| | | <pdf-view ref="pdfview"></pdf-view> |
| | | <upload-model |
| | | ref="modalForm" |
| | | @ok="modalFormOk" |
| | | ></upload-model> |
| | | |
| | | <j-select-maintenance-standard-modal ref="maintenanceStandardModalForm"></j-select-maintenance-standard-modal> |
| | | <equipment-list |
| | | ref="EquipmentList" |
| | | @sendEquipmentRecord='sendEquipmentRecord' |
| | | ></equipment-list> |
| | | </a-modal> |
| | | |
| | | </template> |
| | | |
| | | <script> |
| | | import { getAction, postAction, requestPut, deleteAction } from '@/api/manage' |
| | | import pick from 'lodash.pick' |
| | | import JMultiSelectTag from '@/components/dict/JMultiSelectTag' |
| | | import { duplicateCheck } from '@/api/api' |
| | | import Tooltip from 'ant-design-vue/es/tooltip' |
| | | import JSelectMaintenanceStandardModal from './JSelectMaintenanceStandardModal' |
| | | import UploadModel from './UploadModel' |
| | | |
| | | 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 EquipmentList from './EquipmentList' |
| | | |
| | | export default { |
| | | name: "SpecialtyMaintenanceStandardModal", |
| | | components: { |
| | | JMultiSelectTag, |
| | | Tooltip, |
| | | JSelectMaintenanceStandardModal, |
| | | UploadModel, |
| | | PdfView, |
| | | preview, |
| | | EquipmentList |
| | | }, |
| | | data() { |
| | | return { |
| | | columns: [ |
| | | { |
| | | title: '#', |
| | | dataIndex: '', |
| | | key: 'rowIndex', |
| | | align: 'center', |
| | | customRender: function (t, r, index) { |
| | | return parseInt(index) + 1 |
| | | }, |
| | | width: 50, |
| | | }, |
| | | // { |
| | | // title: 'id', |
| | | // align: 'center', |
| | | // dataIndex: 'id' |
| | | // }, |
| | | { |
| | | title: 'ä¿å
»é¡¹ç®', |
| | | align: 'center', |
| | | dataIndex: 'name', |
| | | width: 100, |
| | | }, |
| | | |
| | | { |
| | | title: 'ä¿å
»æ å', |
| | | align: 'center', |
| | | dataIndex: 'standard', |
| | | width: 100, |
| | | }, |
| | | { |
| | | title: 'æ¹æ³', |
| | | align: 'center', |
| | | dataIndex: 'maintenanceMethodName', |
| | | width: 100, |
| | | }, |
| | | { |
| | | title: 'å·¥å
·', |
| | | align: 'center', |
| | | dataIndex: 'maintenanceTool', |
| | | width: 100, |
| | | }, |
| | | { |
| | | title: 'ç»´ä¿ä¸ä¸', |
| | | align: 'center', |
| | | dataIndex: 'maintenanceSpecialtyName', |
| | | width: 100, |
| | | }, |
| | | { |
| | | title: 'å®å
¨è¦æ±', |
| | | align: 'center', |
| | | dataIndex: 'maintenanceRequire', |
| | | scopedSlots: { customRender: 'maintenanceRequire' }, |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: 'å·¥æ¶å®é¢', |
| | | align: 'center', |
| | | dataIndex: 'workingHourQuota', |
| | | width: 100, |
| | | }, |
| | | { |
| | | title: '示æå¾', |
| | | align: 'center', |
| | | dataIndex: 'photo', |
| | | scopedSlots: { customRender: 'photo' }, |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: 'ä¿å
»é¨ä½', |
| | | align: 'center', |
| | | dataIndex: 'location', |
| | | scopedSlots: { customRender: 'location' }, |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '卿', |
| | | align: 'center', |
| | | dataIndex: 'maintenanceCycleId', |
| | | scopedSlots: { customRender: 'maintenanceCycleId' }, |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: 'ç»´ä¿æ¹å¼', |
| | | align: 'center', |
| | | dataIndex: 'maintenanceMode', |
| | | scopedSlots: { customRender: 'maintenanceMode' }, |
| | | width: 140, |
| | | }, |
| | | |
| | | { |
| | | title: 'æä½', |
| | | align: 'center', |
| | | dataIndex: 'action', |
| | | scopedSlots: { |
| | | customRender: 'action' |
| | | }, |
| | | width: 140, |
| | | } |
| | | ], |
| | | title: "æä½", |
| | | visible: false, |
| | | visible4Confirm: false, |
| | | disableSubmit: false, |
| | | codeDisable: true, |
| | | isRevise: false, |
| | | model: {}, |
| | | upload: {}, |
| | | maintenanceCycles: {}, |
| | | maintenanceModes: {}, |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 6 }, |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 18 }, |
| | | }, |
| | | confirmLoading: false, |
| | | form: this.$form.createForm(this), |
| | | validatorRules: { |
| | | num: { |
| | | rules: [ |
| | | { required: true, message: '请è¾å
¥ç¼ç !' }, |
| | | ] |
| | | }, |
| | | teamId: { |
| | | rules: [ |
| | | { required: true, message: 'è¯·éæ©è´£ä»»çç»!' }, |
| | | ] |
| | | }, |
| | | departId: { |
| | | rules: [ |
| | | { required: true, message: 'è¯·éæ©å¯¹è±¡é¨é¨!' }, |
| | | ] |
| | | }, |
| | | equipmentId: { |
| | | rules: [ |
| | | { required: true, message: 'è¯·éæ©è®¾å¤!' }, |
| | | ] |
| | | }, |
| | | equipmentName: { |
| | | rules: [ |
| | | { required: true, message: 'è¯·éæ©è®¾å¤!' }, |
| | | ] |
| | | }, |
| | | version: { |
| | | rules: [ |
| | | { required: true, message: '请è¾å
¥çæ¬!' }, |
| | | ] |
| | | }, |
| | | }, |
| | | url: { |
| | | list: "/eam/maintenanceStandardDetail/getMaintenanceStandardDetailListByIds", |
| | | add: "/eam/maintenanceStandard/add", |
| | | edit: "/eam/maintenanceStandard/edit", |
| | | addDetail: "/eam/maintenanceStandardDetail/add", |
| | | getMaintenanceCycle: "/eam/maintenanceStandardDetail/getMaintenanceCycle", |
| | | getMaintenanceMode: "/eam/maintenanceStandardDetail/getMaintenanceMode", |
| | | realDelete: "/eam/maintenanceStandardDetail/realDelete", |
| | | revise: '/eam/maintenanceStandard/revise', |
| | | getReviseVersion: "/eam/maintenanceStandard/getReviseVersion" |
| | | }, |
| | | |
| | | dataSource: [], |
| | | } |
| | | }, |
| | | |
| | | |
| | | mounted() { |
| | | this.$bus.$on('selectionRows', (data) => { |
| | | for (let i = 0; i < data.length; i++) { |
| | | let id = this.getUuiD(15); |
| | | this.dataSource.push({ |
| | | id: id, |
| | | maintenanceProjectId: data[i].id, |
| | | name: data[i].name, |
| | | standard: data[i].standard, |
| | | location: data[i].location, |
| | | maintenanceMethodName: data[i].maintenanceMethod_dictText, |
| | | maintenanceTool: data[i].maintenanceTool, |
| | | maintenanceSpecialtyName: data[i].maintenanceSpecialtyId_dictText, |
| | | maintenanceRequire: data[i].maintenanceRequire, |
| | | workingHourQuota: data[i].workingHourQuota, |
| | | upload: this.upload, |
| | | maintenanceCycles: this.maintenanceCycles, |
| | | maintenanceModes: this.maintenanceModes, |
| | | }) |
| | | |
| | | // let formData = {}; |
| | | // this.confirmLoading = true; |
| | | // formData.maintenanceStandardDetailList = this.dataSource |
| | | // postAction(this.url.addDetail, formData).then((res) => { |
| | | // if (res.success) { |
| | | // // this.$message.success(res.message); |
| | | // // this.$emit('ok'); |
| | | // } else { |
| | | // // this.$message.warning(res.message); |
| | | // } |
| | | // }).finally(() => { |
| | | // this.confirmLoading = false; |
| | | // }) |
| | | |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | created() { |
| | | var upload = {}; |
| | | upload.path = null; |
| | | upload.format = 'jpg'; |
| | | this.upload = upload; |
| | | }, |
| | | |
| | | |
| | | methods: { |
| | | |
| | | //éæ©ç¹æ£é¡¹ç® |
| | | selectMaintenanceProjects: function () { |
| | | let ids = []; |
| | | for (let i = 0; i < this.dataSource.length; i++) { |
| | | ids.push(this.dataSource[i].maintenanceProjectId); |
| | | } |
| | | this.$refs.maintenanceStandardModalForm.showModals(ids); |
| | | this.$refs.maintenanceStandardModalForm.title = 'éæ©ä¿å
»é¡¹ç®'; |
| | | this.$refs.maintenanceStandardModalForm.disableSubmit = false; |
| | | }, |
| | | |
| | | add() { |
| | | this.edit({ maintenanceStandardDetaillist: [] }) |
| | | |
| | | }, |
| | | |
| | | edit(record) { |
| | | let that = this; |
| | | this.getMaintenanceCycle() |
| | | this.getMaintenanceMode() |
| | | this.dataSource = []; |
| | | this.form.resetFields(); |
| | | this.model = Object.assign({}, record); |
| | | this.visible = true; |
| | | if (record.maintenanceStandardDetaillist != undefined) { |
| | | const temp = [...record.maintenanceStandardDetaillist]; |
| | | // for (let i = 0; i < temp.length; i++) { |
| | | // let r = temp[i].upload; |
| | | // r.src = this.getSrc(temp[i].upload); |
| | | // } |
| | | that.dataSource = temp; |
| | | } |
| | | that.$nextTick(() => { |
| | | that.form.setFieldsValue(pick(that.model, 'version', 'num', 'departId', 'teamId', 'equipmentId', 'equipmentName', 'remark')); |
| | | }); |
| | | if (record.id) { |
| | | that.codeDisable = true; |
| | | that.$nextTick(() => { |
| | | if (that.isRevise) { |
| | | requestPut(that.url.getReviseVersion, record).then((res) => { |
| | | if (res.success) { |
| | | that.form.setFieldsValue({ version: res.result, historyVersion: record.version }) |
| | | } |
| | | }) |
| | | } |
| | | }, 200); |
| | | } else { |
| | | that.codeDisable = false; |
| | | that.$nextTick(() => { |
| | | that.form.setFieldsValue({ "version": "1.0", }) |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | close() { |
| | | this.$emit('close'); |
| | | this.visible = false; |
| | | }, |
| | | |
| | | handleCancel() { |
| | | this.realDelete() |
| | | this.close(); |
| | | }, |
| | | |
| | | handleOk() { |
| | | const that = this; |
| | | this.form.validateFields((err, values) => { |
| | | if (!err) { |
| | | that.confirmLoading = true; |
| | | let formData = Object.assign(this.model, values); |
| | | console.log(formData) |
| | | if (that.dataSource.length === 0) { |
| | | that.$message.warning("è¯·éæ©ä¿å
»é¡¹ç®ï¼"); |
| | | that.confirmLoading = false; |
| | | return |
| | | } |
| | | for (var i = 0; i < that.dataSource.length; i++) { |
| | | if (that.dataSource[i].maintenanceRequire == null || that.dataSource[i].maintenanceRequire == undefined || that.dataSource[i].maintenanceRequire == '') { |
| | | this.$message.error("第" + (i + 1) + "è¡å®å
¨è¦æ±ä¸ºç©ºï¼è¯·å¡«å") |
| | | that.confirmLoading = false |
| | | return false; |
| | | } |
| | | if (that.dataSource[i].photo == null || that.dataSource[i].photo == undefined || that.dataSource[i].photo == '') { |
| | | this.$message.error("第" + (i + 1) + "è¡ç¤ºæå¾ä¸ºç©ºï¼è¯·ä¸ä¼ ") |
| | | that.confirmLoading = false |
| | | return false; |
| | | } |
| | | if (that.dataSource[i].location == null || that.dataSource[i].location == undefined || that.dataSource[i].location == '') { |
| | | this.$message.error("第" + (i + 1) + "è¡é¨ä½ä¸ºç©ºï¼è¯·å¡«å") |
| | | that.confirmLoading = false |
| | | return false; |
| | | } |
| | | if (that.dataSource[i].maintenanceCycleId == null || that.dataSource[i].maintenanceCycleId == undefined) { |
| | | this.$message.error("第" + (i + 1) + "è¡å¨æä¸ºç©ºï¼è¯·éæ©") |
| | | that.confirmLoading = false |
| | | return false; |
| | | } |
| | | if (that.dataSource[i].maintenanceMode == null || that.dataSource[i].maintenanceMode == undefined || that.dataSource[i].maintenanceMode == '') { |
| | | this.$message.error("第" + (i + 1) + "è¡ç»´ä¿æ¹å¼ä¸ºç©ºï¼è¯·éæ©") |
| | | that.confirmLoading = false |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | formData.maintenanceStandardDetaillist = that.dataSource; |
| | | formData.type = 'specialty'; |
| | | let obj; |
| | | if (!this.model.id) { |
| | | formData.versionStatus = '1' |
| | | obj = postAction(this.url.add, formData); |
| | | } else { |
| | | if (this.isRevise) { |
| | | formData.versionStatus = '1' |
| | | obj = postAction(this.url.revise, formData); |
| | | } else { |
| | | obj = requestPut(this.url.edit, formData, { id: this.model.id }); |
| | | } |
| | | } |
| | | obj.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(); |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | handleDelete(text, record, index) { |
| | | this.dataSource.splice(index, 1); |
| | | }, |
| | | |
| | | realDelete() { |
| | | var that = this |
| | | deleteAction(that.url.realDelete).then(res => { |
| | | if (res.success) { |
| | | //éæ°è®¡ç®å页é®é¢ |
| | | // that.reCalculatePage(1) |
| | | // that.$message.success(res.message) |
| | | // that.loadData() |
| | | } else { |
| | | // that.$message.warning(res.message) |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | getMaintenanceCycle() { |
| | | getAction(this.url.getMaintenanceCycle).then((res) => { |
| | | if (res.success) { |
| | | this.maintenanceCycles = res.result |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | getMaintenanceMode() { |
| | | getAction(this.url.getMaintenanceMode).then((res) => { |
| | | if (res.success) { |
| | | this.maintenanceModes = res.result |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | handle2Change(val) { |
| | | this.dataSource = []; |
| | | }, |
| | | |
| | | handleChange(value, key, column, index) { |
| | | let that = this; |
| | | const temp = [...that.dataSource]; |
| | | const target = temp.filter(item => key === item.key)[index]; |
| | | if (target) { |
| | | if (column.dataIndex == 'maintenanceCycleId') { |
| | | target[column.dataIndex] = value; |
| | | } |
| | | if (column.dataIndex == 'maintenanceRequire') { |
| | | target[column.dataIndex] = value.target.value; |
| | | } |
| | | if (column.dataIndex == 'location') { |
| | | target[column.dataIndex] = value.target.value; |
| | | } |
| | | if (column.dataIndex == 'maintenanceMode') { |
| | | target[column.dataIndex] = value; |
| | | } |
| | | if ('photo' == column.dataIndex) { |
| | | target['photo'] = value; |
| | | } |
| | | //æ¾ç¤ºå¸¦è¿æ¥çæ°æ® |
| | | that.dataSource = temp; |
| | | } |
| | | }, |
| | | |
| | | handleUpload: function (record) { |
| | | this.$refs.modalForm.edit(record); |
| | | this.$refs.modalForm.title = "æä»¶ä¸ä¼ "; |
| | | this.$refs.modalForm.disableSubmit = false; |
| | | }, |
| | | |
| | | modalFormOk() { |
| | | let ids = []; |
| | | for (let i = 0; i < this.dataSource.length; i++) { |
| | | ids.push(this.dataSource[i].id); |
| | | } |
| | | postAction(this.url.list, { ids: ids }).then(res => { |
| | | if (res.success) { |
| | | |
| | | this.dataSource = res.result.records || res.result |
| | | for (let i = 0; i < this.dataSource.length; i++) { |
| | | let r = this.dataSource[i].upload; |
| | | r.src = this.getSrc(this.dataSource[i].upload); |
| | | } |
| | | |
| | | } else { |
| | | this.$message.warning(res.message) |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | getSrc(record) { |
| | | |
| | | if (!record.path) { |
| | | return ''; |
| | | } |
| | | //æ¬å°ï¼local\Minioï¼minio\é¿éäºï¼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 { |
| | | //æ ¹æ®åå¸ç¶æä¿®æ¹https æ 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æ¥æææAPIçè®¿é®æéï¼é£é©å¾é«ã强ç建议æ¨å建并使ç¨RAMè´¦å·è¿è¡APIè®¿é®ææ¥å¸¸è¿ç»´ï¼è¯·ç»å½RAMæ§å¶å°å建RAMè´¦å·ã |
| | | accessKeyId: window._CONFIG['accessKeyId'], |
| | | accessKeySecret: window._CONFIG['accessKeySecret'], |
| | | bucket: window._CONFIG['bucket'], |
| | | }) |
| | | // object-key表示ä»OSSä¸è½½æä»¶æ¶éè¦æå®å
嫿件åç¼å¨å
ç宿´è·¯å¾ï¼ä¾å¦abc/efg/123.jpgã |
| | | return client.signatureUrl(record.path) |
| | | } |
| | | }, |
| | | |
| | | view(record) { |
| | | this.$refs.pdfview.showPdf(record.src); |
| | | }, |
| | | |
| | | getUuiD(randomLength) { |
| | | return Number( |
| | | Math.random() |
| | | .toString() |
| | | .substr(2, randomLength) + Date.now() |
| | | ).toString(36) |
| | | }, |
| | | onEquipmentList() { |
| | | this.$refs.EquipmentList.selectedDeparts = true; |
| | | this.$refs.EquipmentList.title = "éæ©è®¾å¤ä¿¡æ¯"; |
| | | this.$refs.EquipmentList.list(); |
| | | }, |
| | | sendEquipmentRecord(data) { |
| | | this.dataSource = []; |
| | | let record = data.record; |
| | | console.log(record.id) |
| | | this.form.setFieldsValue({ departId: record.useId, equipmentId: record.id, equipmentName: record.num + "/" + record.name + "/" + record.model }); |
| | | }, |
| | | |
| | | |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | /deep/ .frozenRowClass { |
| | | color: #c9c9c9; |
| | | } |
| | | .fontweight { |
| | | font-weight: bold; |
| | | } |
| | | .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> |