<template>
|
<div >
|
<el-row @contextmenu.prevent.native="">
|
<el-table
|
id="ncDocTable"
|
:data="ncTableData"
|
class="show_table"
|
highlight-current-row
|
@row-contextmenu="ncRightClick"
|
@row-click="handleCurrentChange"
|
border
|
:height="tableHeight"
|
size='mini'
|
>
|
<el-table-column
|
type="index"
|
label="序号"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="docName"
|
label="文件名称"
|
sortable
|
align="center"
|
class-name="left"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="docAlias"
|
label="代码版本"
|
sortable
|
class-name="left"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="pullStatus"
|
label="出库状态"
|
sortable
|
align="center"
|
>
|
<template slot-scope="scope">
|
{{pullStatusMap[scope.row.pullStatus]}}
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="docStatus"
|
label="状 态"
|
align="center"
|
sortable
|
>
|
<template slot-scope="scope">
|
{{productStatusMap[scope.row.docStatus]}}
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="publishVersion"
|
label="系统指定版本"
|
sortable
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="createTime"
|
label="上传时间"
|
sortable
|
align="center"
|
>
|
</el-table-column>
|
</el-table>
|
<el-pagination
|
@size-change="handleSizeChange"
|
@current-change="handlePageChange"
|
:current-page="pageData.page"
|
:page-sizes="pageData.pageSizeArr"
|
:page-size="pageData.size"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="pageData.total">
|
</el-pagination>
|
<div class="ncRightMenu">
|
<NContextMenu
|
@showDocEditDialog="showDocEditDialog"
|
@showAssignDeviceDialog="showAssignDeviceDialog"
|
@docDelete="docDelete"
|
@docDownload="docDownload"
|
@showBatchDeleteDialog="showBatchDeleteDialog"
|
@docPublish="docPublish"
|
@docRepublish="docRepublish"
|
@docPull="docPull"
|
@docCancelPull="docCancelPull"
|
@docPush="docPush"
|
@docPigeonhole="docPigeonhole"
|
@showUploadDialog="showUploadDialog"
|
ref="NContextMenu"
|
/>
|
</div>
|
</el-row>
|
<!--文档入库窗口-->
|
<el-dialog :visible.sync="ncDocPushVisible" :close-on-click-modal="false" title="文件上传" :before-close="closeDialog" width="480px">
|
<el-upload
|
class="upload-demo"
|
ref="upload"
|
action="string"
|
show-file-list
|
:before-remove="beforeRemove"
|
:on-exceed="handleExceed"
|
:http-request="handleRequest"
|
:limit="1"
|
:file-list="ncDocList"
|
:auto-upload="false">
|
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
|
<el-button style="margin-left: 10px;" size="small" type="success" @click="submitNCUpload">上传到服务器</el-button>
|
</el-upload>
|
</el-dialog>
|
<!--指派到设备-->
|
<el-dialog :visible.sync="assignVisible" :close-on-click-modal="false" title="文档指派" @close="closeAssignDialog" width="75%" top="60px">
|
<template>
|
<div style="display: flex;justify-content: space-between">
|
<el-tabs style="width: 72%">
|
<el-tab-pane label="文档列表">
|
<div style="display: flex;">
|
<el-form :model="ncParams" :inline="true" class="demo-form-inline">
|
<el-form-item label="文件名称">
|
<el-input type="text" v-model="ncParams.docName" show-word-limit placeholder="请输入文件名称" clearable></el-input>
|
</el-form-item>
|
<el-form-item label="上传时间">
|
<el-date-picker v-model="ncParams.startTime" placeholder="请选择开始时间" value-format="yyyy-MM-dd HH:mm:ss" type="datetime">
|
</el-date-picker>
|
<el-date-picker v-model="ncParams.endTime" placeholder="请选择结束时间" value-format="yyyy-MM-dd HH:mm:ss" type="datetime">
|
</el-date-picker>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="primary" @click="queryNCDocList" size="small" icon="el-icon-search">查询</el-button>
|
</el-form-item>
|
</el-form>
|
</div>
|
<el-table
|
class="show_table"
|
ref="multipleTable"
|
:data="tableData"
|
tooltip-effect="dark"
|
height="550"
|
style="width: 100%"
|
@selection-change="ncFileSelectionChange">
|
<el-table-column
|
type="selection"
|
width="55">
|
</el-table-column>
|
<el-table-column
|
type="index"
|
label="序号"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="docName"
|
label="文件名称"
|
sortable
|
align="center"
|
class-name="left"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="docCode"
|
label="设备编号"
|
sortable
|
class-name="left"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="pullStatus"
|
label="出库状态"
|
sortable
|
align="center"
|
>
|
<template slot-scope="scope">
|
{{pullStatusMap[scope.row.pullStatus]}}
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="docStatus"
|
label="状 态"
|
align="center"
|
sortable
|
>
|
<template slot-scope="scope">
|
{{productStatusMap[scope.row.docStatus]}}
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="createTime"
|
label="上传时间"
|
sortable
|
align="center"
|
>
|
</el-table-column>
|
</el-table>
|
</el-tab-pane>
|
</el-tabs>
|
|
<div style="width: 25%">
|
<el-tabs v-model="activeName">
|
<el-tab-pane label="设备列表" name="first">
|
<div class="treeType">
|
<div style="display: flex;">
|
<el-input
|
placeholder="输入关键字进行过滤"
|
v-model="filterDeviceCode">
|
</el-input>
|
<el-button style="margin-left: 10px" type="primary" @click="expand">展开/折叠</el-button>
|
</div>
|
|
<el-tree
|
class="filter-tree"
|
:data="deviceTreeData"
|
ref="deviceTreeData"
|
show-checkbox
|
node-key="id"
|
:default-expand-all="isExpand"
|
:filter-node-method="filterDevice"
|
/>
|
</div>
|
|
<el-form class="demo-form-inline" :model="assignForm" ref="assignForm" :rules="rules">
|
<el-form-item label="指派原因:" prop="applyReason">
|
<el-input type="textarea" v-model.trim="assignForm.applyReason" :rows=rows resize="none"></el-input>
|
</el-form-item>
|
</el-form>
|
</el-tab-pane>
|
</el-tabs>
|
|
</div>
|
</div>
|
|
<div slot="footer" class="dialog-footer">
|
<el-button @click.native="assignCommit" :loading="buttonLoading" type="primary" class="btn-custom">
|
<span>保 存</span>
|
</el-button>
|
<el-button @click="closeAssignDialog" class="btn-custom">
|
<span>取 消</span>
|
</el-button>
|
</div>
|
</template>
|
</el-dialog>
|
<!--批量删除文档-->
|
<el-dialog :visible.sync="docBatchDeleteVisible" :close-on-click-modal="false" title="批量删除" @close="closeDocDeleteDialog" width="1000px">
|
<el-form :model="delParams" :inline="true" class="demo-form-inline">
|
<el-form-item label="文件名称">
|
<el-input type="text" v-model="delParams.docName" show-word-limit placeholder="请输入文件名称" clearable></el-input>
|
</el-form-item>
|
<el-form-item label="上传时间">
|
<el-date-picker v-model="delParams.startTime" placeholder="请选择开始时间" value-format="yyyy-MM-dd HH:mm:ss" type="datetime">
|
</el-date-picker>
|
<el-date-picker v-model="delParams.endTime" placeholder="请选择结束时间" value-format="yyyy-MM-dd HH:mm:ss" type="datetime">
|
</el-date-picker>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="primary" @click="LogSearch" size="small" icon="el-icon-search">查询</el-button>
|
</el-form-item>
|
</el-form>
|
<template>
|
<el-table
|
:data="delDocList"
|
class="show_table"
|
ref="table"
|
highlight-current-row
|
border
|
height="410"
|
size='mini'
|
@selection-change="docSelectionChange"
|
>
|
<el-table-column
|
type="selection"
|
width="55">
|
</el-table-column>
|
<el-table-column
|
type="index"
|
label="序号"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="docName"
|
label="文件名称"
|
sortable
|
align="center"
|
class-name="left"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="docCode"
|
label="设备编号"
|
sortable
|
class-name="left"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="pullStatus"
|
label="出库状态"
|
sortable
|
align="center"
|
>
|
<template slot-scope="scope">
|
{{pullStatusMap[scope.row.pullStatus]}}
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="docStatus"
|
label="状 态"
|
align="center"
|
sortable
|
>
|
<template slot-scope="scope">
|
{{productStatusMap[scope.row.docStatus]}}
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="publishVersion"
|
label="系统指定版本"
|
sortable
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="createTime"
|
label="上传时间"
|
sortable
|
align="center"
|
>
|
</el-table-column>
|
</el-table>
|
<el-pagination
|
@size-change="handleDelSizeChange"
|
@current-change="handlerDelPageChange"
|
:current-page="pageDelData.page"
|
:page-sizes="pageDelData.pageSizeArr"
|
:page-size="pageDelData.size"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="pageDelData.total">
|
</el-pagination>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click.native="docBatchDelete" :loading="buttonLoading" type="primary" class="btn-custom">
|
<span>删 除</span>
|
</el-button>
|
<el-button @click="closeDocDeleteDialog" class="btn-custom">
|
<span>取 消</span>
|
</el-button>
|
</div>
|
</template>
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
<script>
|
import NContextMenu from '@/module/productManager/components/ncDocContexttMenu.vue'
|
import Bus from './bus.js'
|
import * as productApi from '../api/product'
|
import * as SystemApi from "../../../base/api/system";
|
export default {
|
name: "nc_file_table_info",
|
props:['nodeList'],
|
components:{
|
NContextMenu,
|
Bus
|
},
|
computed:{
|
pullStatusMap() {
|
let localeMap = JSON.parse(localStorage.getItem('pullStatusMap'));
|
if(!localeMap) {
|
return {};
|
}else {
|
return localeMap;
|
}
|
},
|
productStatusMap() {
|
let localeMap = JSON.parse(localStorage.getItem('productStatusMap'));
|
if(!localeMap) {
|
return {};
|
}else {
|
return localeMap;
|
}
|
},
|
},
|
data() {
|
return {
|
isExpand:false,
|
rows:3,
|
tableHeight:220,
|
buttonLoading:false,
|
ncDocPushVisible:false,
|
assignVisible:false,
|
assignBatchVisible:false,
|
docBatchDeleteVisible:false,
|
ncDocList:[],
|
ncTableData: [],
|
delDocList:[],
|
tableData:[],
|
deviceTreeData:[],
|
activeName:'first',
|
assignForm:{
|
applyReason: '',
|
},
|
rules:{
|
applyReason: [
|
{ required: false, message: '请输入指派原因', trigger: 'blur' }
|
],
|
},
|
pageData : {
|
page:1,
|
size : 10,
|
total:0,
|
pageSizeArr:[10, 20, 40]
|
},
|
pageDelData : {
|
page:1,
|
size : 10,
|
total:0,
|
pageSizeArr:[10, 20, 40]
|
},
|
ncParams: {
|
attributionType :'',//绑定类型
|
attributionId :'', //绑定类型对应的id
|
docClassCode:'NC', //文档类型为其他文档
|
docName:'', //文件名称
|
},
|
delParams:{
|
attributionType :'',//绑定类型
|
attributionId :'', //绑定类型对应的id
|
docClassCode:'NC', //文档类型为其他文档
|
docName:'', //文件名称
|
startTime:"",
|
endTime:""
|
},
|
deleteParam:{
|
id:''
|
},
|
contextQueryParams:{
|
flag:2, //查询按钮的范围 1 菜单 2 对象
|
param:'document', //查询参数,按类型而不同 1 菜单路径 2 对象权限码
|
objectId:null, //flag 为2时需要传递该参数 该参数与param对应数据id
|
relativeObjectId:null, //param 为process,document,file 时需要传该参数 该参数为关联树节点的id
|
relativeParam:null, //param 为process,document,file 时需要传该参数 该参数为关联树节点的对象权限码
|
},
|
nodeData: {
|
index: 6,
|
list: []
|
},
|
rightClickRow:null,
|
docUploadParams:{
|
attributionId:'',
|
attributionType:5,
|
docClassCode:'NC',
|
},
|
defaultAssignParams:{},
|
assignFileRequest:{
|
applyReason: "",
|
deviceList: [],
|
docId: [],
|
fileId: "",
|
processId: ""
|
},
|
docName:'',
|
productmap:{},
|
pullmap:{},
|
multipleSelection: [],
|
docSelectionAll:[],
|
docSelection:[],
|
idKey:'docId', // 标识列表数据中每一行的唯一键的名称
|
filterDeviceCode:''//过滤设备的查询关键字
|
}
|
},
|
methods: {
|
expand(){
|
console.log(this.isExpand);
|
this.isExpand = !this.isExpand;
|
const nodes = this.$refs.deviceTreeData.store._getAllNodes();
|
for(let i in nodes){
|
nodes[i].expanded = this.isExpand
|
}
|
},
|
dateFormat(row, column, cellValue, index){
|
const daterc = row[column.property]
|
if(daterc!=null){
|
const dateMat= new Date(daterc);
|
const year = dateMat.getFullYear();
|
const month = dateMat.getMonth() + 1;
|
const day = dateMat.getDate();
|
const hh = dateMat.getHours();
|
const mm = dateMat.getMinutes();
|
const ss = dateMat.getSeconds();
|
const timeFormat= year + "-" + month + "-" + day;
|
return timeFormat;
|
}
|
},
|
filterDevice(value, data) {
|
if (!value) return true;
|
return data.label.indexOf(value) !== -1;
|
},
|
docSelectionChange(val) {
|
this.docSelection = val;
|
},
|
showDocEditDialog(){
|
this.$emit('showDocEditDialog', this.rightClickRow);
|
},
|
LogSearch() {
|
this.LogQuery();
|
},
|
LogQuery() {
|
this.listLoading = true;
|
this.delParams=this.ncParams;
|
this.delParams.startTime=this.startTime;
|
this.delParams.endTime=this.endTime;
|
if ((this.delParams.docName!= null && this.delParams.docName !== '')||
|
(this.delParams.startTime != null && this.delParams.startTime !== '')||
|
(this.delParams.endTime!= null && this.delParams.endTime !== '')){
|
//重置分页参数
|
this.pageDelData.page = 1;
|
this.pageDelData.size = 10;
|
}
|
productApi.query_doc_list(this.pageDelData.page,this.pageDelData.size,this.delParams).then((res)=>{
|
if (res.success) {
|
this.pageDelData.total = res.page.total;
|
this.delDocList = res.page.records;
|
}
|
});
|
},
|
showUploadDialog(){
|
let paramList = this.nodeList.list;
|
this.docUploadParams.attributionId = JSON.parse(JSON.stringify(paramList)).processId;
|
this.$emit('showUploadDialog',this.docUploadParams)
|
},
|
showAssignDeviceDialog(){
|
this.assignFileRequest = JSON.parse(JSON.stringify(this.defaultAssignParams));
|
this.queryNCDocList();//查询文档列表,重置指派的设备选项
|
this.queryDeviceList();//查询设备列表,重置指派的设备选项
|
this.assignVisible = true;//打开指派设备弹窗
|
this.assignFileRequest.processId= this.rightClickRow.attributionId;
|
},
|
showBatchDeleteDialog(){
|
this.docBatchDeleteVisible = true;//打开批量删除文档弹窗
|
this.delParams=this.ncParams;
|
this.delParams.startTime=this.startTime;
|
this.delParams.endTime=this.endTime;
|
productApi.query_doc_list(this.pageDelData.page,this.pageDelData.size,this.delParams).then((res)=>{
|
if (res.success) {
|
this.pageDelData.total = res.page.total;
|
this.delDocList = res.page.records;
|
}
|
});
|
},
|
queryDeviceList(){
|
let nodeType ,paramId;
|
if (this.nodeList.list.partsId != null) {
|
nodeType = 3;
|
paramId = this.nodeList.list.partsId;
|
}else if (this.nodeList.list.componentId != null) {
|
nodeType = 2;
|
paramId = this.nodeList.list.componentId;
|
}
|
productApi.getDeviceTree(nodeType ,paramId).then((res) =>{
|
if (res.success) {
|
this.deviceTreeData = res.list;
|
}
|
})
|
},
|
queryNCDoc(){
|
if (this.nodeList.list != null && this.nodeList.list != '') {
|
let paramList = this.nodeList.list;
|
this.ncParams.attributionType = this.nodeList.index;
|
if (this.nodeList.index == 1) {
|
//this.ncParams.attributionId = JSON.parse(JSON.stringify(paramList)).productId;
|
}else if (this.nodeList.index == 2) {
|
//this.ncParams.attributionId = JSON.parse(JSON.stringify(paramList)).componentId;
|
}else if (this.nodeList.index == 3) {
|
//this.ncParams.attributionId = JSON.parse(JSON.stringify(paramList)).partsId;
|
}else if (this.nodeList.index == 4) {
|
//this.ncParams.attributionId = JSON.parse(JSON.stringify(paramList)).productId;
|
}else if (this.nodeList.index == 5) {
|
this.ncParams.attributionId = JSON.parse(JSON.stringify(paramList)).processId;
|
}
|
this.ncParams.docName = '';
|
productApi.query_doc_list(this.pageData.page,this.pageData.size,this.ncParams).then((res)=>{
|
if (res.success) {
|
this.pageData.total = res.page.total;
|
this.ncTableData = res.page.records;
|
setTimeout(()=>{
|
this.setSelectRow();
|
}, 50)
|
}
|
})
|
}
|
},
|
// 得到选中的所有数据
|
getAllSelectionData () {
|
// 再执行一次记忆勾选数据匹配,目的是为了在当前页操作勾选后直接获取选中数据
|
this.changePageCoreRecordData();
|
},
|
queryNCDocList(){
|
if (this.nodeList.list != null && this.nodeList.list != '') {
|
let paramList = this.nodeList.list;
|
this.ncParams.attributionType = this.nodeList.index;
|
this.ncParams.attributionId = JSON.parse(JSON.stringify(paramList)).processId;
|
productApi.query_process_doc(this.ncParams).then((res)=>{
|
if (res.success) {
|
this.tableData = res.list;
|
}
|
})
|
}
|
},
|
handleSizeChange(val) {
|
// 改变每页显示条数的时候调用一次
|
this.changePageCoreRecordData();
|
this.pageData.size = val;
|
this.queryNCDoc();
|
},
|
handlePageChange(val){
|
// 改变页的时候调用一次
|
this.changePageCoreRecordData();
|
this.pageData.page = val;
|
this.queryNCDoc();
|
},
|
handleDelSizeChange(val) {
|
// 改变每页显示条数的时候调用一次
|
this.changePageCoreRecordData();
|
this.pageDelData.size = val;
|
this.queryDocDel();
|
},
|
handlerDelPageChange(val) {
|
// 改变页的时候调用一次
|
this.changePageCoreRecordData();
|
this.pageDelData.page = val;
|
this.queryDocDel();
|
},
|
queryDocDel(){
|
if (this.nodeList.list != null && this.nodeList.list != '') {
|
let paramList = this.nodeList.list;
|
this.ncParams.attributionType = this.nodeList.index;
|
if (this.nodeList.index == 1) {
|
//this.ncParams.attributionId = JSON.parse(JSON.stringify(paramList)).productId;
|
}else if (this.nodeList.index == 2) {
|
//this.ncParams.attributionId = JSON.parse(JSON.stringify(paramList)).componentId;
|
}else if (this.nodeList.index == 3) {
|
//this.ncParams.attributionId = JSON.parse(JSON.stringify(paramList)).partsId;
|
}else if (this.nodeList.index == 4) {
|
//this.ncParams.attributionId = JSON.parse(JSON.stringify(paramList)).productId;
|
}else if (this.nodeList.index == 5) {
|
this.delParams.attributionId = JSON.parse(JSON.stringify(paramList)).processId;
|
}
|
productApi.query_doc_list(this.pageDelData.page,this.pageDelData.size,this.delParams).then((res)=>{
|
if (res.success) {
|
this.pageDelData.total = res.page.total;
|
this.delDocList = res.page.records;
|
setTimeout(()=>{
|
this.setSelectRow();
|
}, 50)
|
}
|
})
|
}
|
},
|
handleCurrentChange(val) {
|
this.nodeData.list = val;
|
this.$emit('indexChange', this.nodeData); // 调用父组件传递过来的方法,同时把数据传递出去
|
},
|
// 设置选中的方法
|
setSelectRow() {
|
if (!this.docSelectionAll || this.docSelectionAll.length <= 0) {
|
return;
|
}
|
// 标识当前行的唯一键的名称
|
let idKey = this.idKey;
|
let selectAllIds = [];
|
let that = this;
|
this.docSelectionAll.forEach(row=>{
|
selectAllIds.push(row[idKey]);
|
});
|
this.$refs.table.clearSelection();
|
for(var i = 0; i < this.ncTableData.length; i++) {
|
if (selectAllIds.indexOf(this.ncTableData[i][idKey]) >= 0) {
|
// 设置选中,记住table组件需要使用ref="table"
|
this.$refs.table.toggleRowSelection(this.ncTableData[i], true);
|
}
|
}
|
} ,
|
// 记忆选择核心方法
|
changePageCoreRecordData () {
|
// 标识当前行的唯一键的名称
|
let idKey = this.idKey;
|
let that = this;
|
// 如果总记忆中还没有选择的数据,那么就直接取当前页选中的数据,不需要后面一系列计算
|
if (this.docSelectionAll.length <= 0) {
|
this.docSelectionAll = this.docSelection;
|
return;
|
}
|
// 总选择里面的key集合
|
let selectAllIds = [];
|
this.docSelectionAll.forEach(row=>{
|
selectAllIds.push(row[idKey]);
|
})
|
let selectIds = []
|
// 获取当前页选中的id
|
this.docSelection.forEach(row=>{
|
selectIds.push(row[idKey]);
|
// 如果总选择里面不包含当前页选中的数据,那么就加入到总选择集合里
|
if (selectAllIds.indexOf(row[idKey]) < 0) {
|
that.docSelectionAll.push(row);
|
}
|
})
|
let noSelectIds = [];
|
// 得到当前页没有选中的id
|
this.ncTableData.forEach(row=>{
|
if (selectIds.indexOf(row[idKey]) < 0) {
|
noSelectIds.push(row[idKey]);
|
}
|
})
|
noSelectIds.forEach(id=>{
|
if (selectAllIds.indexOf(id) >= 0) {
|
for(let i = 0; i< that.docSelectionAll.length; i ++) {
|
if (that.docSelectionAll[i][idKey] == id) {
|
// 如果总选择中有未被选中的,那么就删除这条
|
that.docSelectionAll.splice(i, 1);
|
break;
|
}
|
}
|
}
|
})
|
},
|
ncRightClick(row, column, event) { // 鼠标右击触发事件
|
if (this.nodeList.index == 5) {
|
if (event != undefined) {
|
this.rightClickRow = row;
|
this.docName = row.docName;
|
if (this.nodeList.partsId == null) {
|
this.contextQueryParams.relativeParam ='component';
|
this.contextQueryParams.relativeObjectId = this.nodeList.list.componentId;
|
}else {
|
this.contextQueryParams.relativeParam ='parts';
|
this.contextQueryParams.relativeObjectId = this.nodeList.list.partsId;
|
}
|
this.contextQueryParams.objectId = row.processId;
|
this.$refs.NContextMenu.ncDocRightClick(row, column, event, this.contextQueryParams);
|
}
|
}
|
},
|
ncFileSelectionChange(val){
|
this.multipleSelection=val;
|
},
|
docDelete(){
|
this.$confirm('删除后不可取消,确认删除吗?', '提示', {}).then(() => {
|
this.deleteParam.id = this.rightClickRow.docId;
|
productApi.doc_delete(this.deleteParam).then((res) => {
|
if (res.success) {
|
let totalPage = Math.ceil((this.pageData.total-1)/this.pageData.size);
|
totalPage = (totalPage < 1 ? 1 : totalPage);
|
this.pageData.page = this.pageData.page > totalPage ? totalPage : this.pageData.page;
|
this.queryNCDoc();
|
Bus.$emit('setIndex',this.nodeList); // 调用组件传递过来的方法,同时把数据传递出去
|
this.$message({
|
message: res.message,
|
type: 'success'
|
});
|
} else if (res.message) {
|
this.$message({
|
message: res.message,
|
type: 'error'
|
});
|
}
|
});
|
});
|
},
|
/*NC文档,其他文档 下载*/
|
docDownload(){
|
productApi.doc_download(this.rightClickRow.docId).then((res) =>{
|
if(res.success){
|
}else{
|
this.$message({
|
message: res.message,
|
type: 'error'
|
});
|
}
|
}).catch((err)=>{ //上传失败 调用onError方法 //处理自己的逻辑
|
this.$message({
|
message: '下载失败',
|
type: 'error'
|
});
|
});
|
},
|
//批量删除
|
docBatchDelete(){
|
// 得到选中的所有数据
|
this.getAllSelectionData();
|
this.$confirm('删除后不可取消,确认删除吗?', '提示', {}).then(() => {
|
let docList = this.docSelectionAll;
|
let _this = this;
|
docList.forEach((v, k) => {
|
(function (value) {
|
setTimeout(()=> {
|
let mgs = value.docName;
|
_this.deleteParam.id = value.docId;
|
productApi.doc_delete(_this.deleteParam).then((res) => {
|
if(res.success){
|
_this.buttonLoading = false;
|
_this.$notify({
|
title: '成功',
|
message:'删除 '+ mgs + res.message,
|
type: 'success'
|
});
|
let totalPage = Math.ceil(( _this.pageDelData.total-1)/ _this.pageDelData.size);
|
totalPage = (totalPage < 1 ? 1 : totalPage);
|
_this.pageDelData.page = _this.pageDelData.page > totalPage ? totalPage : _this.pageDelData.page;
|
_this.docSelectionAll=[];
|
_this.queryDocDel();
|
}else{
|
_this.buttonLoading = false;
|
_this.$notify({
|
title: '警告',
|
message:'删除 '+ mgs + res.message,
|
type: 'warning',
|
duration: 0
|
});
|
}
|
});
|
},(k+1)*200)
|
})(docList[k]);
|
});
|
|
});
|
},
|
/*NC文档,其他文档 发布*/
|
docPublish(){
|
this.$confirm('确认发布吗?', '提示', {}).then(() => {
|
productApi.doc_publish(this.rightClickRow.docId).then((res) =>{
|
if(res.success){
|
Bus.$emit('queryFileList');
|
this.queryNCDoc();
|
this.$message({
|
message: res.message,
|
type: 'success'
|
});
|
}else if(res.message){
|
this.$message({
|
message: res.message,
|
type: 'error'
|
});
|
}
|
})
|
});
|
},
|
/*NC文档,其他文档 重发布*/
|
docRepublish(){
|
this.$confirm('确认重发布吗?', '提示', {}).then(() => {
|
productApi.doc_republish(this.rightClickRow.docId).then((res) =>{
|
if(res.success){
|
Bus.$emit('queryFileList');
|
this.$message({
|
message: res.message,
|
type: 'success'
|
});
|
this.queryNCDoc();
|
}else if(res.message){
|
this.$message({
|
message: res.message,
|
type: 'error'
|
});
|
}
|
})
|
});
|
},
|
/*NC文档,其他文档 出库*/
|
docPull(){
|
this.$confirm('确认出库吗?', '提示', {}).then(() => {
|
productApi.doc_pull(this.rightClickRow.docId).then((res) =>{
|
if(res.success){
|
this.$message({
|
message: res.message,
|
type: 'success'
|
});
|
}else {
|
this.$message({
|
message: res.message,
|
type: 'error'
|
});
|
}
|
});
|
this.queryNCDoc();
|
});
|
},
|
/*NC文档,其他文档 取消出库*/
|
docCancelPull(){
|
this.$confirm('确认取消出库吗?', '提示', {}).then(() => {
|
productApi.doc_cancel_pull(this.rightClickRow.docId).then((res) =>{
|
if(res.success){
|
this.$message({
|
message: res.message,
|
type: 'success'
|
});
|
this.queryNCDoc();
|
}else {
|
this.$message({
|
message: res.message,
|
type: 'error'
|
});
|
}
|
})
|
})
|
},
|
/*NC文档,其他文档 入库*/
|
docPush(){
|
this.ncDocList = [];
|
this.ncDocPushVisible = true;
|
},
|
/*NC文档,其他文档 归档*/
|
docPigeonhole(){
|
this.$confirm('归档后不可取消,确认归档吗?', '提示', {}).then(() => {
|
productApi.doc_pigeonhole(this.rightClickRow.docId).then((res) =>{
|
if(res.success){
|
this.$message({
|
message: res.message,
|
type: 'success'
|
});
|
this.queryNCDoc();
|
}else {
|
this.$message({
|
message: res.message,
|
type: 'error'
|
});
|
}
|
})
|
})
|
},
|
//上传
|
handleExceed(files, fileList) {
|
this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
|
},
|
beforeRemove(file, fileList) {
|
return this.$confirm(`确定移除 ${ file.name }?`);
|
},
|
submitNCUpload(){
|
this.$confirm('确认提交吗?', '提示', {}).then(() => {
|
this.$refs.upload.submit();
|
})
|
},
|
handleRequest(uploader){
|
let formData = new FormData();
|
formData.append("file", uploader.file);
|
productApi.doc_push(this.rightClickRow.docId,formData,uploader).then((res)=>{
|
if (res.success) {
|
//上传成功 调用onSuccess方法,否则没有完成图标 //处理自己的逻辑
|
uploader.onSuccess();
|
Bus.$emit('queryFileList')
|
}else {
|
this.$message({
|
message: res.message,
|
type: 'error'
|
});
|
}
|
}).catch((err)=>{ //上传失败 调用onError方法 //处理自己的逻辑
|
//uploader.onError();
|
})
|
},
|
closeDialog(){
|
this.ncDocPushVisible = false;
|
this.queryNCDoc();
|
},
|
closeAssignDialog(){
|
this.assignVisible = false;
|
this.assignBatchVisible = false;
|
this.assignForm.applyReason = '';
|
Bus.$emit('queryActivitList')
|
},
|
closeDocDeleteDialog(){
|
this.docBatchDeleteVisible = false;
|
this.docSelection = [];
|
this.docSelectionAll =[];
|
this.pageData = {
|
page:1,
|
size : 10,
|
total:0,
|
pageSizeArr:[10, 20, 40]
|
};
|
this.pageDelData={
|
page:1,
|
size : 10,
|
total:0,
|
pageSizeArr:[10, 20, 40]
|
};
|
this.queryNCDoc();
|
},
|
//指派到设备
|
assignCommit(){
|
this.$refs.assignForm.validate((valid) =>{
|
if (valid) {
|
this.$confirm('确认提交吗?', '提示', {}).then(() => {
|
let resMessage = [];
|
let devices = this.$refs['deviceTreeData'].getCheckedNodes(true);
|
let docList = this.multipleSelection;
|
let assignFileArr = [];
|
devices.forEach((d, i) => {
|
docList.forEach((doc, k) => {
|
assignFileArr.push({
|
applyReason: this.assignForm.applyReason,
|
deviceId: d['id'],
|
docId: doc['docId'],
|
fileId: doc['publishFileId'],
|
processId: this.assignFileRequest.processId});
|
resMessage.push(doc.docName + '==>'+ d.label+ ' ')
|
});
|
});
|
let _this = this;
|
assignFileArr.forEach((v, k) => {
|
(function (value) {
|
setTimeout(()=> {
|
let mgs = resMessage[k];
|
productApi.file_apply(value).then((res) => {
|
if(res.success){
|
_this.buttonLoading = false;
|
_this.$notify({
|
title: '成功',
|
message:mgs + res.message,
|
type: 'success'
|
});
|
}else{
|
_this.buttonLoading = false;
|
_this.$notify({
|
title: '警告',
|
message:mgs + res.message,
|
type: 'warning',
|
duration: 0
|
});
|
}
|
});
|
},(k+1)*500)
|
})(assignFileArr[k]);
|
})
|
});
|
}
|
})
|
}
|
},
|
//初始化 模板渲染前调用
|
created(){
|
this.defaultAssignParams = JSON.parse(JSON.stringify(this.assignFileRequest));
|
Bus.$off('queryNCDoc');
|
Bus.$on("queryNCDoc",()=>{
|
this.queryNCDoc()
|
});
|
|
},
|
mounted(){
|
let h = document.getElementById('filesTab').offsetHeight;
|
if (h > 0) {
|
this.$nextTick(function () {
|
this.tableHeight = h - 95;
|
})
|
}
|
},
|
//监听
|
watch:{
|
nodeList:{
|
deep: true, // 深度监听
|
handler(newValue, oldValue) {
|
this.pageData = {
|
page:1,
|
size : 10,
|
total:0,
|
pageSizeArr:[10, 20, 40]
|
};
|
this.queryNCDoc();
|
}
|
},
|
filterDeviceCode(val) {
|
this.$refs.deviceTreeData.filter(val);
|
}
|
},
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.menu_item {
|
line-height: 20px;
|
text-align: left;
|
margin-top: 10px;
|
}
|
#ncDocTable{
|
border: 1px solid #EBEEF5;
|
}
|
.menu {
|
height: 100px;
|
width: 80px;
|
position: absolute;
|
/* border-radius: 10px;*/
|
border: 1px solid #999999;
|
background-color: #f4f4f4;
|
}
|
|
li:hover {
|
background-color: #1790ff;
|
color: white;
|
}
|
li{
|
list-style-type:none;
|
font-size:15px
|
}
|
.contextmenu {
|
margin: 0;
|
background: #fff;
|
z-index: 99999;
|
position: absolute;
|
list-style-type: none;
|
padding: 5px 0;
|
border-radius: 4px;
|
font-size: 12px;
|
font-weight: 400;
|
color: #333;
|
box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, 0.3);
|
li {
|
margin: 0;
|
padding: 7px 16px;
|
cursor: pointer;
|
}
|
}
|
.ncRightMenu{
|
position: absolute;
|
top: 0;
|
height: 100%;
|
}
|
.tabDiv{
|
display: inline-block;
|
vertical-align: top;
|
width: 49%;
|
}
|
.treeType{
|
overflow: hidden;
|
.el-tree{
|
margin: 20px 0 10px;
|
height: 400px;
|
overflow: auto;
|
}
|
}
|
</style>
|