<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="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>
|
</span> -->
|
|
<template
|
slot="photo"
|
slot-scope="text,record"
|
>
|
<span
|
v-if="!text"
|
style="font-size: 12px;font-style: italic;"
|
>无图片</span>
|
<img
|
v-else
|
:src="getImgView(text)"
|
:preview="record.id"
|
height="25px"
|
alt=""
|
style="max-width:80px;font-size: 12px;font-style: italic;"
|
/>
|
</template>
|
</a-table>
|
</div>
|
<pdf-view ref="pdfview"></pdf-view>
|
</a-card>
|
</template>
|
|
<script>
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import { getAction } from '@/api/manage'
|
import Tooltip from 'ant-design-vue/es/tooltip'
|
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';
|
|
export default {
|
name: "MaintenanceStandardModal",
|
components: {
|
Tooltip,
|
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: 'photo',
|
// scopedSlots: { customRender: 'photo' },
|
// },
|
{
|
title: '维修保养角色',
|
align: "center",
|
dataIndex: 'maintenanceRoleName',
|
},
|
{
|
title: '保养内容',
|
align: "center",
|
dataIndex: 'name',
|
|
},
|
// {
|
// title: '保养标准',
|
// align: "center",
|
// dataIndex: 'standard',
|
|
// },
|
// {
|
// title: '部位',
|
// align: "center",
|
// dataIndex: 'location',
|
// },
|
// {
|
// title: '方法',
|
// align: "center",
|
// dataIndex: 'maintenanceMethodName',
|
|
// },
|
// {
|
// title: '工具',
|
// align: "center",
|
// dataIndex: 'maintenanceTool',
|
// },
|
// {
|
// title: '安全要求',
|
// align: "center",
|
// dataIndex: 'maintenanceRequire',
|
// },
|
// {
|
// title: '工时定额',
|
// align: "center",
|
// dataIndex: 'workingHourQuota',
|
// },
|
{
|
title: '保养周期',
|
align: "center",
|
dataIndex: 'maintenanceCycleName',
|
},
|
// {
|
// title: '维保专业',
|
// align: "center",
|
// dataIndex: 'maintenanceSpecialtyName',
|
// },
|
|
|
],
|
url: {
|
list: "/eam/maintenanceStandardDetail/getMaintenanceStandardList",//数据来源mom_eam_daily_inspection_standard_detail
|
},
|
}
|
},
|
created() {
|
},
|
computed: {
|
},
|
methods: {
|
clearList() {
|
this.dataSource = []
|
this.selectedRowKeys = []
|
this.ipagination.current = 1
|
},
|
loadData(arg) {
|
if (!this.url.list) {
|
this.$message.error("请设置url.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) {
|
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);
|
// }
|
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
|
})
|
},
|
|
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);
|
},
|
|
}
|
}
|
</script>
|
<style scoped>
|
@import '~@assets/less/common.less';
|
</style>
|