plm前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1147 lines
35 KiB

<template>
<div class="mod-config customer-tab">
<el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
<el-form-item label="工厂">
<el-input v-model="searchData.site" style="width: 160px"></el-input>
</el-form-item>
<el-form-item label="工具编码">
<el-input v-model="searchData.toolId" style="width: 160px"></el-input>
</el-form-item>
<el-form-item label="工具类型">
<span slot="label" style="" @click="getBaseList(1016)"><a herf="#">工具类型</a></span>
<el-input v-model="searchData.toolType" style="width: 160px"></el-input>
</el-form-item>
<el-form-item label=" ">
<el-button @click="search()" type="primary" style="margin-left: 2px;margin-top:0px">查询</el-button>
<el-button type="primary" @click="addToolInfoModal()">新增</el-button>
<!-- <el-button @click="addOrUpdateHandle('save')" type="primary" style="margin-left: 2px;margin-top: 0px">新增</el-button>-->
<download-excel
:fields="fields()"
:data="exportData"
type="xls"
:name="exportName"
:header="exportHeader"
:footer="exportFooter"
:fetch="createExportData"
:before-generate="startDownload"
:before-finish="finishDownload"
worksheet="导出信息"
class="el-button el-button--primary el-button--medium">
{{ '导出' }}
</download-excel>
</el-form-item>
</el-form>
<el-table
:height="height"
:data="dataList"
border
:row-style="rowToolStyle"
ref="mainTable"
@row-click="changeData"
highlight-current-row
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column
header-align="center"
align="center"
width="150"
fixed="right"
label="操作">
<template slot-scope="scope">
<a type="text" size="small" @click="editToolInfoModal(scope.row)">编辑 </a>
<a type="text" size="small" v-if = "scope.row.propertyNo && scope.row.propertyNo !== ''" @click="editToolInfoPropertyModal(scope.row)">属性 </a>
<a type="text" size="small" @click="deleteToolInfoConfirm(scope.row)">删除 </a>
</template>
</el-table-column>
<el-table-column
v-for="(item,index) in columnList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed==''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
:current-page="pageIndex"
:page-sizes="[20, 50, 100, 1000]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<el-tabs style="font-size: 12px;min-height: 330px" class="customer-tab" v-model="activeName" type="border-card" @tab-click="tabClick">
<el-tab-pane label="工具实例" name="detail" style="margin-left: -10px;">
<el-form label-position="top" style="margin-top: -15px; margin-left: 2px;">
<el-button type="primary" @click="addToolInstanceModal()">新增</el-button>
</el-form>
<el-table
:data="detailList"
height="240"
border
@row-click="changeInstanceData"
highlight-current-row
:row-style="rowToolInstanceStyle"
v-loading="dataListLoading"
style="width: 100%; ">
<el-table-column
v-for="(item,index) in columnDetailList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed==''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
<el-table-column
header-align="center"
align="center"
width="180"
fixed="right"
label="操作">
<template slot-scope="scope">
<a type="text" size="small" @click="editToolInstanceModal(scope.row)">编辑 </a>
<a type="text" size="small" v-if = "scope.row.propertyNo && scope.row.propertyNo !== ''" @click="editToolInstancePropertyModal(scope.row)">属性 </a>
<a type="text" size="small" @click="editToolInstanceDateModal(scope.row)">生命周期 </a>
<a type="text" size="small" @click="deleteToolInstanceConfirm(scope.row)">删除 </a>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
<!-- 选择组件 -->
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
<!-- 工具信息 -->
<toolInfoAddUpdate ref="toolInfoAddUpdate" :close-on-click-modal="false" @refreshTooInfoData="refreshTooInfoData" @changeCurrentToolInfo="changeCurrentToolInfo">
</toolInfoAddUpdate>
<!-- 工具实例信息 -->
<toolInstanceAddUpdate ref="toolInstanceAddUpdate" :close-on-click-modal="false" @refreshTooInstanceData="refreshTooInstanceData" @changeCurrentToolInstance="changeCurrentToolInstance">
</toolInstanceAddUpdate>
<!-- 工具实例生命周期信息 -->
<toolInstanceDateShow ref="toolInstanceDateShow" :close-on-click-modal="false" @refreshTooInstanceData="refreshTooInstanceData">
</toolInstanceDateShow>
<!-- 工具属性信息 -->
<toolPropertyShow ref="toolPropertyShow" :close-on-click-modal="false" >
</toolPropertyShow>
</div>
</template>
<script>
import {
getToolInfoList, // 工具信息查询
getToolInstanceList, //工具实例信息查询
removeToolInfo,/*删除工具信息*/
removeToolInstance,/*删除工具实例信息*/
} from '@/api/tool/tool_info.js'
/*组件*/
import Chooselist from '@/views/modules/common/Chooselist'; /*选择组件*/
import toolInfoAddUpdate from "./components/com_tool_info_add_update"; /*工具新增和修改组件*/
import toolInstanceAddUpdate from "./components/com_tool_instance_add_update"; /*工具实例新增和修改组件*/
import toolInstanceDateShow from "./components/com_tool_instance_date_show"; /*工具实例新增日期和修改组件*/
import toolPropertyShow from "./components/com_tool_property_show"; /*工具属性修改组件*/
/*組件*/
export default {
components: {
Chooselist,/*选择组件*/
toolInfoAddUpdate,/*工具新增和修改组件*/
toolInstanceAddUpdate,/*工具实例新增和修改组件*/
toolInstanceDateShow,/*工具实例新增日期和修改组件*/
toolPropertyShow,/*工具属性修改组件*/
},
data() {
return {
fileContentList: [],
activeName: 'detail',
searchData:{
pageIndex: 1,
pageSize: 100,
site:this.$store.state.user.site,
toolId:'',
toolType:'',
startDate:'',
endDate:'',
},
currentRow:{},
currentInstanceRow: {},
height: 200,
dataList:[],
detailList:[],
dataListLoading: false,
// 导出 start
exportData: [],
exportName: "工具信息" + this.dayjs().format('YYYYMMDDHHmmss'),
exportHeader: ["工具信息"],
exportFooter: [],
exportList:[],
tagNo:'',
pageIndex: 1,
pageSize: 100,
totalPage: 0,
// 导出 end
columnList: [
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table1Site',
tableId: "106003Table1",
tableName: "刀具信息主表",
columnProp: "site",
headerAlign: "center",
align: "left",
columnLabel: "工厂编码",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table1ToolId',
tableId: "106003Table1",
tableName: "刀具信息主表",
columnProp: "toolId",
headerAlign: "center",
align: "left",
columnLabel: "工具编码",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table1ToolDesc',
tableId: "106003Table1",
tableName: "刀具信息主表",
columnProp: "toolDesc",
headerAlign: "center",
align: "left",
columnLabel: "工具描述",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 160
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003TableToolType',
tableId: "106003Table1",
tableName: "刀具信息主表",
columnProp: "toolType",
headerAlign: "center",
align: "left",
columnLabel: "工具类型",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003TableCalendarId',
tableId: "106003Table1",
tableName: "刀具信息主表",
columnProp: "calendarId",
headerAlign: "center",
align: "left",
columnLabel: "日历标识",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003TablePropertyNo',
tableId: "106003Table1",
tableName: "刀具信息主表",
columnProp: "propertyNo",
headerAlign: "center",
align: "left",
columnLabel: "属性模版",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003TableSchedCapacity',
tableId: "106003Table1",
tableName: "刀具信息主表",
columnProp: "schedCapacity",
headerAlign: "center",
align: "left",
columnLabel: "计划能力",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003TableCalibrationControl',
tableId: "106003Table1",
tableName: "刀具信息主表",
columnProp: "calibrationControl",
headerAlign: "center",
align: "left",
columnLabel: "校对控制",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003TableCalibrationTime',
tableId: "106003Table1",
tableName: "刀具信息主表",
columnProp: "calibrationTime",
headerAlign: "center",
align: "left",
columnLabel: "校对间隔时间",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003TableLastUsed',
tableId: "106003Table1",
tableName: "刀具信息主表",
columnProp: "lastUsed",
headerAlign: "center",
align: "left",
columnLabel: "上次使用",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003TableAlternateToolId',
tableId: "106003Table1",
tableName: "刀具信息主表",
columnProp: "alternateToolId",
headerAlign: "center",
align: "left",
columnLabel: "备选工具标识号",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003TableEnabledForControlPlanDb',
tableId: "106003Table1",
tableName: "刀具信息主表",
columnProp: "enabledForControlPlanDb",
headerAlign: "center",
align: "left",
columnLabel: "为控制计划启用",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003TableNoteText',
tableId: "106003Table1",
tableName: "刀具信息主表",
columnProp: "noteText",
headerAlign: "center",
align: "left",
columnLabel: "备注",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 180
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table1CreatedBy',
tableId: "106003Table1",
tableName: "刀具信息主表",
columnProp: "createdBy",
headerAlign: "center",
align: "left",
columnLabel: "创建人",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table1CreateDate',
tableId: "106003Table1",
tableName: "刀具信息主表",
columnProp: "createDate",
headerAlign: "center",
align: "left",
columnLabel: "创建时间",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 90
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table1UpdatedBy',
tableId: "106003Table1",
tableName: "刀具信息主表",
columnProp: "updatedBy",
headerAlign: "center",
align: "left",
columnLabel: "修改人",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table1UpdatedDate',
tableId: "106003Table1",
tableName: "刀具信息主表",
columnProp: "updatedDate",
headerAlign: "center",
align: "left",
columnLabel: "修改时间",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 90
},
],
columnDetailList: [
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2ToolInstance',
tableId: '106003Table2',
tableName: '工具实例明细',
columnProp: 'toolInstance',
headerAlign: 'center',
align: 'center',
columnLabel: '工具实例',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 40
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2Description',
tableId: '106003Table2',
tableName: '工具实例明细',
columnProp: 'description',
headerAlign: 'center',
align: 'center',
columnLabel: '工具实例描述',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 70
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2ToolNo',
tableId: '106003Table2',
tableName: '工具实例明细',
columnProp: 'toolNo',
headerAlign: 'center',
align: 'center',
columnLabel: '工具编码',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 70
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2LastPropertyNo',
tableId: '106003Table2',
tableName: '工具实例明细',
columnProp: 'propertyNo',
headerAlign: 'center',
align: 'center',
columnLabel: '属性模版',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2LastCalibrationDate',
tableId: '106003Table2',
tableName: '工具实例明细',
columnProp: 'lastCalibrationDate',
headerAlign: 'center',
align: 'center',
columnLabel: '最近校准日期',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2ObjectId',
tableId: '106003Table2',
tableName: '工具实例明细',
columnProp: 'objectId',
headerAlign: 'center',
align: 'center',
columnLabel: '对象标识',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2NormalWorkCenterNo',
tableId: '106003Table2',
tableName: '工具实例明细',
columnProp: 'normalWorkCenterNo',
headerAlign: 'center',
align: 'center',
columnLabel: '工作中心',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 60
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2NormalWorkCenterDesc',
tableId: '106003Table2',
tableName: '工具实例明细',
columnProp: 'normalWorkCenterDesc',
headerAlign: 'center',
align: 'center',
columnLabel: '工作重心描述',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 60
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2NormalProductionLine',
tableId: '106003Table2',
tableName: '工具实例明细',
columnProp: 'normalProductionLine',
headerAlign: 'center',
align: 'center',
columnLabel: '生产线',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 50
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2NormalProductionLineDesc',
tableId: '106003Table2',
tableName: '工具实例明细',
columnProp: 'normalProductionLineDesc',
headerAlign: 'center',
align: 'center',
columnLabel: '生产线描述',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 60
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2NoteText',
tableId: '106003Table2',
tableName: '工具实例明细',
columnProp: 'noteText',
headerAlign: 'center',
align: 'center',
columnLabel: '备注',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 200
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2CreatedBy',
tableId: "106003Table2",
tableName: "工具实例明细",
columnProp: "createdBy",
headerAlign: "center",
align: "left",
columnLabel: "创建人",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2CreatedDate',
tableId: "106003Table2",
tableName: "工具实例明细",
columnProp: "createdDate",
headerAlign: "center",
align: "left",
columnLabel: "创建时间",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 90
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2UpdatedBy',
tableId: "106003Table2",
tableName: "工具实例明细",
columnProp: "updatedBy",
headerAlign: "center",
align: "left",
columnLabel: "修改人",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2UpdatedDate',
tableId: "106003Table2",
tableName: "刀具信息主表",
columnProp: "updatedDate",
headerAlign: "center",
align: "left",
columnLabel: "修改时间",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 90
},
],
}
},
watch: {
// columnList: {
// deep: true,
// handler: function (newV, oldV) {
// debugger
//
// }
// }
},
mounted() {
this.$nextTick(() => {
this.height = window.innerHeight - 520;
})
},
methods: {
// 获取基础数据列表S
getBaseList (val, type) {
this.tagNo = val
this.$nextTick(() => {
let strVal = ''
this.$refs.baseList.init(val, strVal)
})
},
/* 列表方法的回调 */
getBaseData (val) {
if (this.tagNo === 1016) {
this.searchData.toolType = val.tool_type;
}
},
//导出excel
async createExportData() {
this.searchData.limit = -1
this.searchData.page = 1
await getToolInfoList(this.searchData).then(({data}) => {
this.exportList= data.page.list;
})
return this.exportList;
},
startDownload() {
// this.exportData = this.dataList
},
finishDownload() {
},
fields() {
let json = "{"
this.columnList.forEach((item, index) => {
if (index == this.columnList.length - 1) {
json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
} else {
json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
}
})
json += "}"
let s = eval("(" + json + ")")
return s
},
/*刷新工具信息*/
refreshTooInfoData() {
this.searchData.pageSize = this.pageSize
this.searchData.pageIndex = this.pageIndex
getToolInfoList(this.searchData).then(({data}) => {
if (data.code == 200) {
this.dataList = data.rows;
this.totalPage = data.total;
}
this.dataListLoading = false
})
},
/*新增工具的modal*/
addToolInfoModal(){
//打开modal的页面
this.$nextTick(() => {
this.$refs.toolInfoAddUpdate.init(null, true)
});
},
/*编辑工具信息*/
editToolInfoModal(toolInfo){
//打开modal的页面
this.$nextTick(() => {
this.$refs.toolInfoAddUpdate.init(toolInfo, false)
});
},
/*工具属性的维护*/
editToolInfoPropertyModal(toolInfo){
//打开modal的页面
this.$nextTick(() => {
this.$refs.toolPropertyShow.init(toolInfo, 'TL');
});
},
/*工具实例属性的维护*/
editToolInstancePropertyModal(toolInfo){
//打开modal的页面
this.$nextTick(() => {
this.$refs.toolPropertyShow.init(toolInfo, 'TLI');
});
},
/*删除工具的确认选项*/
deleteToolInfoConfirm(toolInfo) {
this.$confirm('是否删除工具标识号:'+ toolInfo.toolId+'?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
removeToolInfo(toolInfo).then(({data}) => {
if (data.code === 200) {
this.$message.success('操作成功!');
this.refreshTooInfoData();
} else {
this.$message.error(data.msg);
}
})
})
},
/*新增工具实例的modal*/
addToolInstanceModal(){
//判断是否选择好数据
if(this.currentRow && Object.keys(this.currentRow).length > 0){
//打开modal的页面
this.$nextTick(() => {
this.$refs.toolInstanceAddUpdate.init(this.currentRow, true)
});
}else{
this.$message.error('请先选择工具信息再添加工具实例!');
}
},
/*修改工具实例的modal*/
editToolInstanceModal(row){
this.currentInstanceRow = row;
//判断是否选择好数据
if(Object.keys(this.currentInstanceRow).length > 0){
//打开modal的页面
this.$nextTick(() => {
this.$refs.toolInstanceAddUpdate.init(this.currentInstanceRow, false)
});
}else{
this.$message.error('请先选择工具实例再添加工具实例!');
}
},
/*刷新工具信息*/
refreshTooInstanceData() {
getToolInstanceList(this.currentRow).then(({data}) => {
if (data.code == 200) {
this.detailList = data.rows;
}
this.dataListLoading = false
})
},
/*删除工具实例确认*/
deleteToolInstanceConfirm(toolInfo){
this.$confirm('是否删除工具实例:'+ toolInfo.toolInstance+'?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
removeToolInstance(toolInfo).then(({data}) => {
if (data.code === 200) {
this.$message.success('操作成功!');
this.refreshTooInstanceData();
} else {
this.$message.error(data.msg);
}
})
})
},
/*工具实例的生命周期*/
editToolInstanceDateModal(toolInfo){
this.currentInstanceRow = toolInfo;
//添加工具分类和分类的描述信息
this.currentInstanceRow.toolType = this.currentRow.toolType;
this.currentInstanceRow.toolDesc = this.currentRow.toolDesc;
//判断是否选择好数据
if(Object.keys(this.currentInstanceRow).length > 0){
//打开modal的页面
this.$nextTick(() => {
this.$refs.toolInstanceDateShow.init(this.currentInstanceRow)
});
}else{
this.$message.error('请先选择工具实例再添加工具实例!');
}
},
//切换工具触发
changeData(row) {
this.currentRow = JSON.parse(JSON.stringify(row));
this.refreshCurrentTabTable ();
},
/*切换工具实例*/
changeInstanceData(row){
this.currentInstanceRow = JSON.parse(JSON.stringify(row));
},
// 获取数据列表
search () {
this.searchData.pageSize = this.pageSize
this.searchData.pageIndex = this.pageIndex
getToolInfoList(this.searchData).then(({data}) => {
if (data.code == 200) {
this.dataList = data.rows;
this.totalPage = data.total;
if(this.dataList.length > 0){
this.$refs.mainTable.setCurrentRow(this.dataList[0]);
//如果已经存在则 不修改默认数值 不然修改默认选择行为第一行
if(this.currentRow && Object.keys(this.currentRow).length > 0){
//已经存在 不需要修改
}else{
this.currentRow = JSON.parse(JSON.stringify(this.dataList[0]));
}
}else {
this.currentRow ={}
}
this.refreshCurrentTabTable ()
}
this.dataListLoading = false
})
},
tabClick (tab, event) {
// 刷新列表数据
this.refreshCurrentTabTable()
},
// 刷新页签的table数据
refreshCurrentTabTable () {
if (this.activeName == 'detail') {
this.refreshToolInstanceData();
}
},
/*刷新工具实例的信息*/
refreshToolInstanceData(){
getToolInstanceList(this.currentRow).then(({data}) => {
if (data.code == 200) {
this.detailList = data.rows;
}
this.dataListLoading = false
})
},
// 下载
downloadFile(row){
downLoadProjectFile(row)
.then(({data}) => {
// 不限制文件下载类型
const blob = new Blob([data], {type:'application/octet-stream;charset=utf-8'})
// 下载文件名称
const fileName = row.fileName
// a标签下载
const linkNode = document.createElement('a')
linkNode.download = fileName // a标签的download属性规定下载文件的名称
linkNode.style.display = 'none'
linkNode.href = URL.createObjectURL(blob) // 生成一个Blob URL
console.log(linkNode)
// if(val == 'Y'){
// this.pdfVisible = true
// this.pdfUrl = linkNode.href
// }else {
document.body.appendChild(linkNode)
linkNode.click() // 模拟在按钮上的一次鼠标单击
URL.revokeObjectURL(linkNode.href) // 释放URL 对象
document.body.removeChild(linkNode)
// }
})
// }else {
// this.$alert('没有权限下载这个项目的文件!', '错误', {
// confirmButtonText: '确定'
// })
// }
// })
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.search()
},
/*调整等待派工单的等待时间*/
changeCurrentToolInfo(tempData) {
//重置选择行
this.currentRow = JSON.parse(JSON.stringify(tempData));
},
/*调整等待派工单的等待时间*/
changeCurrentToolInstance(tempData) {
//重置选择行
this.currentInstanceRow = JSON.parse(JSON.stringify(tempData));
},
/*选中行的样式*/
rowToolStyle ({row}) {
if (this.currentRow.site === row.site && this.currentRow.toolId === row.toolId) {
return { 'background-color': '#D9EDF7', cursor: 'pointer' };
}
},
/*选中行的样式*/
rowToolInstanceStyle ({row}) {
if (this.currentInstanceRow.site === row.site && this.currentInstanceRow.toolInstance === row.toolInstance) {
return { 'background-color': '#D9EDF7', cursor: 'pointer' };
}
},
},
activated() {
},
}
</script>
<style >
/deep/ .customer-tab .el-tabs__content {
padding: 0px !important;
}
.el-transfer-panel {
border: 2px solid #17b3a3;
border-radius: 4px;
overflow: hidden;
background: #fff;
display: inline-block;
vertical-align: middle;
width: 200px;
max-height: 100%;
-webkit-box-sizing: border-box;
box-sizing: border-box;
position: relative;
}
.el-transfer-panel .el-transfer-panel__header {
height: 40px;
line-height: 40px;
background: #17b3a3;
margin: 0;
padding-left: 15px;
border-bottom: 1px solid #17b3a3;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: #000;
}
.el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label {
font-size: 14px;
color: #303133;
font-weight: 400;
}
</style>