<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"
|
: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="onDepartList()"
|
:read-only="true"
|
v-decorator="['useDepartName', validatorRules.useDepartName]"
|
/>
|
<a-tree-select
|
style="width: 100%"
|
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
:tree-data="treeData"
|
placeholder="请选择部门"
|
tree-default-expand-all
|
v-decorator="['departId', validatorRules.useId ]"
|
/>-->
|
|
<j-dict-select-tag
|
allow-clear
|
:disabled="disableSubmit"
|
:placeholder="disableSubmit?'':'请选择使用部门'"
|
:triggerChange="true"
|
dictCode="sys_depart,depart_name,id,del_flag!='1'"
|
v-decorator="['departId', {}]"
|
/>
|
</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="mom_eam_equipment,name,id,status!='0' and del_flag!='1'"
|
v-decorator="['equipmentId', validatorRules.equipmentId]"
|
@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"
|
>
|
<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">
|
<a-form-item
|
label="责任班组"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
>
|
<a-input
|
allow-clear
|
:disabled="true"
|
:placeholder="disableSubmit?'':'请输入责任班组'"
|
v-decorator="['teamName', {} ]"
|
/>
|
</a-form-item>
|
</a-col>
|
</a-row>
|
<a-row
|
hidden
|
:gutter="24"
|
>
|
<a-col :span="12">
|
<a-form-item
|
label="设备Id"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
>
|
<a-input
|
allow-clear
|
:disabled="true"
|
:placeholder="disableSubmit?'':'请输入统一编码/名称/型号'"
|
v-decorator="['equipmentId', validatorRules.equipmentId ]"
|
/>
|
</a-form-item>
|
</a-col>
|
<!-- <a-col :span="12">
|
<a-form-item
|
label="使用部门Id"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
>
|
<a-input
|
allow-clear
|
:disabled="true"
|
:placeholder="disableSubmit?'':'请输入使用部门id'"
|
v-decorator="['departId', validatorRules.useId ]"
|
/>
|
</a-form-item>
|
</a-col> -->
|
<a-col :span="12">
|
<a-form-item
|
label="班组Id"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
>
|
<a-input
|
allow-clear
|
:disabled="true"
|
:placeholder="disableSubmit?'':'请输入班组id'"
|
v-decorator="['teamId', validatorRules.teamId ]"
|
/>
|
</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
|
:disabled="disableSubmit"
|
:placeholder="disableSubmit?'':'请选择保养类型'"
|
:triggerChange="true"
|
dictCode="maintenance_type"
|
v-decorator="['maintenanceType', validatorRules.maintenanceType]"
|
/>
|
</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="assign_mode"
|
v-decorator="['assignMode', validatorRules.assignMode]"
|
/>
|
</a-form-item>
|
</a-col> -->
|
<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-row :gutter="24">
|
<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-col :span="12">
|
<a-form-item
|
label="责任班组"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
>
|
<a-input
|
allowClear
|
:disabled="disableSubmit"
|
:placeholder="disableSubmit?'':'请输入标准编码'"
|
v-decorator="[ 'teamId', validatorRules.teamId]"
|
/>
|
</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
|
size="middle"
|
rowKey='id'
|
:columns="columns"
|
:dataSource="dataSource"
|
:pagination="false"
|
>
|
<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-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>-->
|
<j-dict-select-tag
|
v-if="col.dataIndex == 'maintenanceRole'"
|
:value="text"
|
allow-clear
|
:triggerChange="true"
|
dictCode="maintenance_role"
|
placeholder="请选择保养角色"
|
@change="(e)=>handleChange(e, record.key, col, index)"
|
style="width: 100%"
|
/>
|
</div>
|
</template>
|
|
<span
|
slot="action"
|
slot-scope="text, record, index"
|
>
|
<a-popconfirm
|
title="确定删除吗?"
|
@confirm="() => handleDelete(text,record, index)"
|
>
|
<a>删除</a>
|
</a-popconfirm>
|
</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>
|
|
<equipment-list
|
ref="EquipmentList"
|
@sendEquipmentRecord='sendEquipmentRecord'
|
></equipment-list>
|
|
<depart-list
|
ref="DepartList"
|
@sendDepartRecord='sendDepartRecord'
|
></depart-list>
|
|
<j-select-maintenance-standard-modal ref="maintenanceStandardModalForm"></j-select-maintenance-standard-modal>
|
</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 '.././dailyInspectionStandard/EquipmentList'
|
import DepartList from '.././dailyInspectionStandard/DepartList'
|
|
export default {
|
name: "MaintenanceStandardModal",
|
components: {
|
JMultiSelectTag,
|
Tooltip,
|
JSelectMaintenanceStandardModal,
|
UploadModel,
|
PdfView,
|
preview,
|
EquipmentList,
|
DepartList
|
},
|
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: 'location',
|
// // scopedSlots: { customRender: 'location' },
|
// // width: 150,
|
// },
|
{
|
title: '保养角色',
|
align: 'center',
|
dataIndex: 'maintenanceRole',
|
scopedSlots: { customRender: 'maintenanceRole' },
|
},
|
{
|
title: '保养内容',
|
align: 'center',
|
dataIndex: 'name'
|
},
|
|
// {
|
// title: '验收标准',
|
// align: 'center',
|
// dataIndex: 'standard'
|
// },
|
// {
|
// title: '方法',
|
// align: 'center',
|
// dataIndex: 'maintenanceMethodName'
|
// },
|
// {
|
// title: '工具',
|
// align: 'center',
|
// dataIndex: 'maintenanceTool'
|
// },
|
// {
|
// title: '维保专业',
|
// align: 'center',
|
// dataIndex: 'maintenanceSpecialtyName'
|
// },
|
// {
|
// title: '安全要求',
|
// align: 'center',
|
// dataIndex: 'maintenanceRequire',
|
// scopedSlots: { customRender: 'maintenanceRequire' },
|
// width: 150,
|
// },
|
// {
|
// title: '工时定额',
|
// align: 'center',
|
// dataIndex: 'workingHourQuota'
|
// },
|
// {
|
// title: '示意图',
|
// align: 'center',
|
// dataIndex: 'photo',
|
// scopedSlots: { customRender: 'photo' },
|
// width: 150,
|
// },
|
|
// {
|
// title: '周期',
|
// align: 'center',
|
// dataIndex: 'maintenanceCycleId',
|
// scopedSlots: { customRender: 'maintenanceCycleId' },
|
// width: 150,
|
// },
|
|
{
|
title: '操作',
|
align: 'center',
|
dataIndex: 'action',
|
scopedSlots: {
|
customRender: 'action'
|
},
|
}
|
],
|
title: "操作",
|
visible: false,
|
visible4Confirm: false,
|
disableSubmit: false,
|
codeDisable: true,
|
isRevise: false,
|
model: {},
|
upload: {},
|
maintenanceCycles: {},
|
treeData: [],
|
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: '请输入编码!' },
|
]
|
},
|
teamName: {
|
rules: [
|
{ required: true, message: '请选择责任班组!' },
|
]
|
},
|
useDepartName: {
|
rules: [
|
{ required: true, message: '请选择使用部门!' },
|
]
|
},
|
equipmentName: {
|
rules: [
|
{ required: true, message: '请选择设备!' },
|
]
|
},
|
maintenanceType: {
|
rules: [
|
{ required: true, message: '请选择保养类型!' },
|
]
|
},
|
version: {
|
rules: [
|
{ required: true, message: '请输入版本!' },
|
]
|
},
|
historyVersion: {
|
rules: [
|
{ required: true, message: '请输入历史版本!' },
|
]
|
},
|
},
|
url: {
|
list: "/eam/maintenanceStandardDetail/getMaintenanceStandardDetailListByIds",
|
add: "/eam/maintenanceStandard/add",
|
edit: "/eam/maintenanceStandard/edit",
|
// addDetail: "/eam/maintenanceStandardDetail/add",
|
getMaintenanceCycle: "/eam/maintenanceStandardDetail/getPeriodicMaintenanceCycle",
|
realDelete: "/eam/maintenanceStandardDetail/realDelete",
|
revise: '/eam/maintenanceStandard/revise',
|
getReviseVersion: "/eam/maintenanceStandard/getReviseVersion",
|
loadOptions: '/sys/sysDepart/loadDepartTreeOptions',
|
getNum: '/eam/sysIdentity/getNumNew'
|
},
|
|
dataSource: [],
|
departId: '',
|
}
|
},
|
|
|
mounted() {
|
this.$bus.$on('selectionRows', (data) => {
|
for (let i = 0; i < data.length; i++) {
|
let id = this.getUuiD(15);
|
this.dataSource.push({
|
id: data[i].id,
|
maintenanceProjectId: data[i].id,
|
name: data[i].name,
|
standard: data[i].standard,
|
maintenanceMethodName: data[i].maintenanceMethod_dictText,
|
maintenanceTool: data[i].maintenanceTool,
|
location: data[i].location,
|
maintenanceSpecialtyName: data[i].maintenanceSpecialtyId_dictText,
|
maintenanceRequire: data[i].maintenanceRequire,
|
workingHourQuota: data[i].workingHourQuota,
|
// upload: this.upload,
|
// maintenanceCycles: this.maintenanceCycles,
|
})
|
|
// 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 {
|
// // that.$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: [] })
|
this.getSeq()
|
},
|
|
edit(record) {
|
let that = this;
|
// this.initOptions();
|
// this.getMaintenanceCycle()
|
this.dataSource = [];
|
this.form.resetFields();
|
this.model = Object.assign({}, record);
|
this.visible = true;
|
if (record.maintenanceStandardDetaillist != undefined) {
|
const temp = [...record.maintenanceStandardDetaillist];
|
that.dataSource = temp;
|
}
|
that.$nextTick(() => {
|
that.form.setFieldsValue(pick(that.model, 'num', 'departId', 'teamId', 'equipmentId', 'equipmentName', 'useDepartName', 'useId', 'maintenanceType', 'teamName', 'version', 'remark'));
|
});
|
if (record.id) {
|
// this.maintenanceCycles = []
|
// this.getMaintenanceCycle(this.model.equipmentId)
|
this.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 {
|
this.codeDisable = false;
|
that.$nextTick(() => {
|
that.form.setFieldsValue({ "version": "1.0", })
|
});
|
}
|
},
|
|
initOptions() {
|
getAction(this.url.loadOptions).then(res => {
|
if (res.success) {
|
this.treeData = res.result
|
} else {
|
this.$message.warning(res.message)
|
}
|
})
|
},
|
|
getSeq() {
|
getAction(this.url.getNum, { type: 'DailyMaintenanceStandard', length: 4 }).then(res => {
|
if (res.success) {
|
this.form.setFieldsValue({ "num": res.result })
|
}
|
})
|
},
|
|
onEquipmentList() {
|
let data = this.form.getFieldsValue(['departId']);
|
// if (data.departId == null || data.departId == "") {
|
// this.$message.warning("请先选择使用部门!");
|
// return
|
// }
|
this.$refs.EquipmentList.list(data.departId);
|
this.$refs.EquipmentList.title = "选择设备信息";
|
},
|
sendEquipmentRecord(data) {
|
this.dataSource = [];
|
let record = data.record;
|
// this.getMaintenanceCycle(record.id)
|
this.form.setFieldsValue({ equipmentId: record.id, equipmentName: record.num + "/" + record.name + "/" + record.model, teamId: record.teamId, teamName: record.teamId_dictText });
|
|
},
|
|
onDepartList() {
|
this.$refs.DepartList.list();
|
this.$refs.DepartList.title = "选择使用部门";
|
},
|
sendDepartRecord(data) {
|
this.dataSource = [];
|
let record = data.record;
|
this.form.setFieldsValue({ useId: record.id, useDepartName: record.departName, departId: record.id });
|
},
|
|
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);
|
if (that.dataSource.length === 0) {
|
that.$message.warning("请选择保养项目!");
|
that.confirmLoading = false;
|
return
|
}
|
formData.maintenanceStandardDetaillist = that.dataSource;
|
formData.type = 'daily';
|
formData.maintenanceType = '2';
|
let obj;
|
if (!this.model.id) {
|
formData.versionStatus = '1'
|
formData.approvalStatus = '1'
|
obj = postAction(this.url.add, formData);
|
} else {
|
if (this.isRevise) {
|
formData.versionStatus = '1'
|
formData.approvalStatus = '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(equipmentId) {
|
getAction(this.url.getMaintenanceCycle, { equipmentId: equipmentId }).then((res) => {
|
if (res.success) {
|
this.maintenanceCycles = 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 ('photo' == column.dataIndex) {
|
target['photo'] = value;
|
}
|
if (column.dataIndex == 'location') {
|
target[column.dataIndex] = value.target.value;
|
}
|
if (column.dataIndex == 'maintenanceRole') {
|
target[column.dataIndex] = 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)
|
},
|
|
},
|
}
|
</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>
|