<template>
|
<div>
|
<el-row @contextmenu.prevent.native>
|
<el-table
|
id="deviceDocTable"
|
:data="ncTableData"
|
class="show_table"
|
highlight-current-row
|
@current-change="handleCurrentChange"
|
@row-contextmenu="docRightClick"
|
:height="tableHeight"
|
size="mini"
|
style="width: 100%"
|
>
|
<el-table-column prop="docName" label="文档名称" sortable class-name="left"></el-table-column>
|
<el-table-column prop="docCode" label="设备编号" sortable 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="syncStatus"
|
label="同步状态"
|
sortable
|
align="center"
|
v-if="ncParams.docClassCode=='SEND'"
|
>
|
<template
|
slot-scope="scope"
|
>{{scope.row.syncStatus=='0'?'':docSyncStatusMap[scope.row.syncStatus]}}</template>
|
</el-table-column>
|
<el-table-column
|
prop="createTime"
|
label="上传时间"
|
sortable
|
align="center"
|
>
|
</el-table-column>
|
</el-table>
|
<el-pagination
|
@size-change="handleSizeChange"
|
@current-change="handlerPageChange"
|
: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">
|
<doc-context-menu
|
ref="DocContextMenu"
|
@showDocEditDialog="showDocEditDialog"
|
@docDelete="docDelete"
|
@docDownload="docDownload"
|
@showBatchDeleteDialog="showBatchDeleteDialog"
|
@docPublish="docPublish"
|
@docRepublish="docRepublish"
|
@docPull="docPull"
|
@docCancelPull="docCancelPull"
|
@docPush="docPush"
|
@docPigeonhole="docPigeonhole"
|
@showDocImportDialog="showDocImportDialog"
|
/>
|
</div>
|
</el-row>
|
<!--文档入库窗口-->
|
<el-dialog
|
:visible.sync="deviceDocPushVisible"
|
:close-on-click-modal="false"
|
title="文件上传"
|
:before-close="closeDialog"
|
width="480px"
|
>
|
<el-upload
|
class="upload-demo"
|
ref="upload"
|
action="string"
|
show-file-list
|
:on-change="handleUploadChange"
|
:before-remove="beforeRemove"
|
:on-exceed="handleExceed"
|
:http-request="handleRequest"
|
:limit="1"
|
:file-list="fileList"
|
: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="docFromVisible"
|
:close-on-click-modal="false"
|
title="编辑文档信息"
|
:before-close="closeDialog"
|
width="480px"
|
>
|
<el-form :model="docFrom" :rules="docFromRules" ref="docFrom" label-width="100px">
|
<el-form-item label="文档原名称" prop="docName">
|
<el-input placeholder="请输入文档原名称" v-model.trim="docFrom.docName"></el-input>
|
</el-form-item>
|
<el-form-item label="设备编号" prop="docCode">
|
<!--<el-input placeholder="请输入设备编号" v-model.trim="docFrom.docCode"></el-input>-->
|
<el-select v-model="docFrom.docCode" filterable clearable placeholder="请选择设备编号" style="width: 100%">
|
<el-option
|
v-for="item in treeDate"
|
:key="item.deviceNo"
|
:label="item.deviceNo"
|
:value="item.deviceNo">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="代码版本" prop="docAlias">
|
<el-input placeholder="请输入代码版本" v-model.trim="docFrom.docAlias"></el-input>
|
</el-form-item>
|
<el-form-item label="描述" prop="description">
|
<el-input
|
type="textarea"
|
placeholder="请输入文档描述"
|
rows="3"
|
resize="none"
|
v-model.trim="docFrom.description"
|
></el-input>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button
|
@click.native="docCommit"
|
:loading="buttonLoading"
|
type="primary"
|
class="btn-custom"
|
>
|
<span>保 存</span>
|
</el-button>
|
<el-button @click="closeDialog" class="btn-custom">
|
<span>取 消</span>
|
</el-button>
|
</div>
|
</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 * as deviceApi from "../api/device";
|
import Bus from "./bus.js";
|
import DocContextMenu from "@/module/deviceManager/components/doc_context_menu.vue";
|
import * as productApi from "../../productManager/api/product";
|
export default {
|
name: "doc_file_tab",
|
components: {
|
DocContextMenu,
|
Bus
|
},
|
props: ["baseNode", "docClassCode"],
|
computed: {
|
pullStatusMap: function() {
|
let localeMap = JSON.parse(localStorage.getItem("pullStatusMap"));
|
if (!localeMap) {
|
return {};
|
} else {
|
return localeMap;
|
}
|
},
|
productStatusMap: function() {
|
let localeMap = JSON.parse(localStorage.getItem("productStatusMap"));
|
if (!localeMap) {
|
return {};
|
} else {
|
return localeMap;
|
}
|
},
|
docSyncStatusMap: function() {
|
let localeMap = JSON.parse(localStorage.getItem("docSyncStatusMap"));
|
if (!localeMap) {
|
return {};
|
} else {
|
return localeMap;
|
}
|
}
|
},
|
|
data() {
|
return {
|
treeDate:[],
|
buttonLoading: false,
|
docFromVisible: false,
|
deviceDocPushVisible: false,
|
docBatchDeleteVisible:false,
|
ncTableData: [],
|
delDocList:[],
|
rightRow: [],
|
fileList: [],
|
fileLen: 0,
|
tableHeight: 220,
|
ncParams: {
|
attributionType: 4, //绑定类型
|
attributionId: "", //绑定类型对应的id
|
docClassCode: "SEND",//文档类型为其他文档
|
docName:'', //文件名称
|
},
|
delParams:{
|
attributionType :'',//绑定类型
|
attributionId :'', //绑定类型对应的id
|
docClassCode:'NC', //文档类型为其他文档
|
docName:'', //文件名称
|
startTime:"",
|
endTime:""
|
},
|
deleteParam: {
|
id: ""
|
},
|
docSelectionAll:[],
|
docSelection:[],
|
idKey:'docId', // 标识列表数据中每一行的唯一键的名称
|
pageData: {
|
page: 1,
|
size: 10,
|
total: 0,
|
pageSizeArr: [10, 20, 40]
|
},
|
pageDelData: {
|
page: 1,
|
size: 10,
|
total: 0,
|
pageSizeArr: [10, 20, 40]
|
},
|
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: 3,
|
list: ""
|
},
|
docStatus_obj: {},
|
docFrom: {
|
doc_id: "",
|
description: "",
|
docAlias: "",
|
docCode: "",
|
docName: ""
|
},
|
docFromRules: {
|
docName: [
|
{ required: true, message: "请输入文档原名称", trigger: "blur" }
|
],
|
docAlias: [
|
{ required: false, message: "请输入代码版本", trigger: "blur" }
|
],
|
docCode: [
|
{ required: false, message: "请输入设备编号", trigger: "blur" }
|
],
|
description: [
|
{ required: false, message: "请输入文档描述信息", trigger: "blur" }
|
]
|
}
|
};
|
},
|
methods: {
|
getDeviceList(){
|
deviceApi.getDeviceList().then((res)=>{
|
if (res.success && res.list && res.list.length > 0) {
|
this.treeDate = res.list;
|
}
|
})
|
},
|
docSelectionChange(val) {
|
this.docSelection = val;
|
},
|
showDocEditDialog() {
|
this.docFrom = Object.assign({}, this.rightRow);
|
this.docFromVisible = true;
|
},
|
showDocImportDialog() {
|
this.$emit("showDocImportDialog", this.ncParams); // 调用父组件传递过来的方法,同时把数据传递出去
|
},
|
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;
|
}
|
});
|
},
|
docCommit() {
|
this.docEdit();
|
},
|
//上传
|
handleUploadChange(file, fileList) {
|
this.fileLen = fileList.length;
|
},
|
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);
|
deviceApi
|
.doc_push(this.rightRow.docId, formData, uploader)
|
.then(res => {
|
if (res.success) {
|
//上传成功 调用onSuccess方法,否则没有完成图标 //处理自己的逻辑
|
uploader.onSuccess();
|
this.queryDoc();
|
} else {
|
this.$message({
|
message: res.message,
|
type: "error"
|
});
|
}
|
})
|
.catch(err => {
|
//上传失败 调用onError方法 //处理自己的逻辑
|
//uploader.onError();
|
});
|
},
|
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;
|
}
|
});
|
},
|
queryDoc() {
|
if (this.baseNode && this.baseNode.index === 2) {
|
this.ncParams.attributionId = this.baseNode.list.deviceId;
|
this.ncParams.docClassCode = this.docClassCode;
|
if (
|
this.ncParams.docClassCode &&
|
this.ncParams.docClassCode !== "" &&
|
this.ncParams.attributionId &&
|
this.ncParams.attributionId !== ""
|
) {
|
this.ncParams.docName="";
|
deviceApi.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)
|
}
|
});
|
}
|
}
|
},
|
handleSizeChange(val) {
|
// 改变每页显示条数的时候调用一次
|
this.changePageCoreRecordData();
|
this.pageData.size = val;
|
this.queryDoc();
|
},
|
handlerPageChange(val) {
|
// 改变页的时候调用一次
|
this.changePageCoreRecordData();
|
this.pageData.page = val;
|
this.queryDoc();
|
},
|
handleDelSizeChange(val) {
|
// 改变每页显示条数的时候调用一次
|
this.changePageCoreRecordData();
|
this.pageDelData.size = val;
|
this.queryDocDel();
|
},
|
handlerDelPageChange(val) {
|
// 改变页的时候调用一次
|
this.changePageCoreRecordData();
|
this.pageDelData.page = val;
|
this.queryDocDel();
|
},
|
queryDocDel() {
|
if (this.baseNode && this.baseNode.index === 2) {
|
this.delParams.attributionId = this.baseNode.list.deviceId;
|
this.delParams.docClassCode = this.docClassCode;
|
if (
|
this.delParams.docClassCode &&
|
this.delParams.docClassCode !== "" &&
|
this.delParams.attributionId &&
|
this.delParams.attributionId !== ""
|
) {
|
deviceApi
|
.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); // 调用父组件传递过来的方法,同时把数据传递出去
|
},
|
docRightClick(row, column, event) {
|
this.rightRow = row;
|
// 鼠标右击触发事件
|
if (this.baseNode.index == 2) {
|
if (event != undefined) {
|
if (this.baseNode.list.deviceId) {
|
this.contextQueryParams.relativeParam = "device";
|
this.contextQueryParams.relativeObjectId = this.baseNode.list.deviceId;
|
}
|
if (this.docClassCode == "SEND") {
|
this.contextQueryParams.objectId = row.docId;
|
this.$refs.DocContextMenu.sendDocRightClick(
|
row,
|
column,
|
event,
|
this.contextQueryParams
|
);
|
} else if (this.docClassCode == "REC") {
|
this.contextQueryParams.objectId = row.docId;
|
this.$refs.DocContextMenu.recDocRightClick(
|
row,
|
column,
|
event,
|
this.contextQueryParams
|
);
|
}
|
}
|
}
|
},
|
docEdit() {
|
this.$refs.docFrom.validate(valid => {
|
if (valid) {
|
this.$confirm("确认提交吗?", "提示", {}).then(() => {
|
this.buttonLoading = true;
|
deviceApi.doc_edit(this.docFrom.docId, this.docFrom).then(res => {
|
if (res.success) {
|
this.buttonLoading = false;
|
//NProgress.done();
|
this.$message({
|
message: res.message,
|
type: "success"
|
});
|
this.closeDialog();
|
this.queryDoc();
|
} else if (res.message) {
|
this.buttonLoading = false;
|
this.$message({
|
message: res.message,
|
type: "error"
|
});
|
}
|
});
|
});
|
}
|
});
|
},
|
closeDialog() {
|
this.docFromVisible = false;
|
this.deviceDocPushVisible = false;
|
this.queryDoc();
|
},
|
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.queryDoc();
|
},
|
docDelete() {
|
this.$confirm("删除后不可取消,确认删除吗??", "提示", {}).then(() => {
|
this.deleteParam.id = this.rightRow.docId;
|
let docid = this.deleteParam.id;
|
let deviceId = this.baseNode.list.deviceId;
|
deviceApi.doc_delete(docid, deviceId).then(res => {
|
if (res.success) {
|
Bus.$emit("setIndex", this.baseNode); // 调用组件传递过来的方法,同时把数据传递出去
|
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.queryDoc();
|
this.$message({
|
message: res.message,
|
type: "success"
|
});
|
} else if (res.message) {
|
this.$message({
|
message: res.message,
|
type: "error"
|
});
|
}
|
});
|
});
|
},
|
//批量删除
|
docBatchDelete(){
|
// 得到选中的所有数据
|
this.getAllSelectionData();
|
this.$confirm('删除后不可取消,确认删除吗?', '提示', {}).then(() => {
|
let docList = this.docSelectionAll;
|
let deviceId = this.baseNode.list.deviceId;
|
let _this = this;
|
docList.forEach((v, k) => {
|
(function (value) {
|
setTimeout(()=> {
|
let mgs = value.docName;
|
_this.deleteParam.id = value.docId;
|
deviceApi.doc_delete(value.docId,deviceId).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文档,其他文档 下载*/
|
docDownload(){
|
deviceApi.doc_download(this.rightRow.docId).then((res) =>{
|
if(res.success){
|
}else{
|
this.$message({
|
message: res.message,
|
type: 'error'
|
});
|
}
|
}).catch((err)=>{ //上传失败 调用onError方法 //处理自己的逻辑
|
this.$message({
|
message: '下载失败',
|
type: 'error'
|
});
|
});
|
},
|
// 得到选中的所有数据
|
getAllSelectionData () {
|
// 再执行一次记忆勾选数据匹配,目的是为了在当前页操作勾选后直接获取选中数据
|
this.changePageCoreRecordData();
|
},
|
// 设置选中的方法
|
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;
|
}
|
}
|
}
|
})
|
},
|
/*NC文档,其他文档 发布*/
|
docPublish() {
|
this.$confirm("确认发布吗?", "提示", {}).then(() => {
|
deviceApi.doc_publish(this.rightRow.docId).then(res => {
|
if (res.success) {
|
this.$message({
|
message: res.message,
|
type: "success"
|
});
|
this.queryDoc();
|
} else {
|
this.$message({
|
message: res.message,
|
type: "error"
|
});
|
}
|
});
|
});
|
},
|
/*NC文档,其他文档 重发布*/
|
docRepublish() {
|
this.$confirm("确认重发布吗?", "提示", {}).then(() => {
|
deviceApi.doc_republish(this.rightRow.docId).then(res => {
|
if (res.success) {
|
this.$message({
|
message: res.message,
|
type: "success"
|
});
|
this.queryDoc();
|
} else {
|
this.$message({
|
message: res.message,
|
type: "error"
|
});
|
}
|
});
|
});
|
},
|
/*NC文档,其他文档 出库*/
|
docPull() {
|
this.$confirm("确认出库吗?", "提示", {}).then(() => {
|
deviceApi.doc_pull(this.rightRow.docId).then(res => {
|
if (res.success) {
|
this.$message({
|
message: res.message,
|
type: "success"
|
});
|
} else {
|
this.$message({
|
message: res.message,
|
type: "error"
|
});
|
}
|
});
|
this.queryDoc();
|
});
|
},
|
/*NC文档,其他文档 取消出库*/
|
docCancelPull() {
|
this.$confirm("确认取消出库吗?", "提示", {}).then(() => {
|
deviceApi.doc_cancel_pull(this.rightRow.docId).then(res => {
|
if (res.success) {
|
this.$message({
|
message: res.message,
|
type: "success"
|
});
|
this.queryDoc();
|
} else {
|
this.$message({
|
message: res.message,
|
type: "error"
|
});
|
}
|
});
|
});
|
},
|
/*NC文档,其他文档 入库*/
|
docPush() {
|
this.fileList = [];
|
this.deviceDocPushVisible = true;
|
},
|
/*NC文档,其他文档 归档*/
|
docPigeonhole() {
|
this.$confirm("归档后不可取消,确认归档吗?", "提示", {}).then(() => {
|
deviceApi.doc_pigeonhole(this.rightRow.docId).then(res => {
|
if (res.success) {
|
this.$message({
|
message: res.message,
|
type: "success"
|
});
|
this.queryDoc();
|
} else {
|
this.$message({
|
message: res.message,
|
type: "error"
|
});
|
}
|
});
|
});
|
}
|
},
|
//发起后端请求,获取数据 模板渲染后调用
|
created() {
|
this.queryDoc();
|
Bus.$on("queryDoc", () => {
|
this.queryDoc();
|
});
|
},
|
mounted(){
|
this.getDeviceList();
|
let h = document.getElementById('filesTab').offsetHeight;
|
if (h > 0) {
|
this.$nextTick(function () {
|
this.tableHeight = h - 95;
|
})
|
}
|
},
|
//监听
|
watch: {
|
baseNode: {
|
deep: true, // 深度监听
|
handler(newValue, oldValue) {
|
this.pageData = {
|
page:1,
|
size : 10,
|
total:0,
|
pageSizeArr:[10, 20, 40]
|
};
|
this.queryDoc();
|
}
|
},
|
docClassCode: {
|
deep: true, // 深度监听
|
handler(newValue, oldValue) {
|
this.queryDoc();
|
}
|
}
|
}
|
};
|
</script>
|
|
|
<style scoped lang="scss">
|
.el-row {
|
border: 1px solid #ebeef5;
|
}
|
.menu_item {
|
line-height: 20px;
|
text-align: left;
|
margin-top: 10px;
|
}
|
|
.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%;
|
}
|
</style>
|
<style>
|
.el-tabs__content {
|
overflow: inherit;
|
position: relative;
|
}
|
</style>
|