<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="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="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="95%" top="60px">
|
<template>
|
<div style="display: flex;justify-content: space-between">
|
<el-tabs style="width: 49%">
|
<el-tab-pane label="文档列表">
|
<el-table
|
class="show_table"
|
ref="multipleTable"
|
:data="tableData"
|
tooltip-effect="dark"
|
height="600"
|
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
|
class-name="left"
|
>
|
</el-table-column>
|
</el-table>
|
</el-tab-pane>
|
</el-tabs>
|
<div style="width: 49%">
|
<el-tabs v-model="activeName" class="tabDiv">
|
<el-tab-pane label="设备列表" name="first">
|
<div class="treeType" style="width: 90%;">
|
<div style="display: flex;">
|
<el-input
|
placeholder="输入关键字进行过滤"
|
v-model="filterDeviceCode">
|
</el-input>
|
<el-button style="margin-left: 50px;margin-right: 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"
|
>
|
</el-tree>
|
</div>
|
</el-tab-pane>
|
</el-tabs>
|
<div class="tabDiv">
|
<el-form class="demo-form-inline" label-position="top" :model="assignForm" ref="assignForm"
|
:rules="rules">
|
<el-form-item label="密级为:" prop="secretLevel">
|
<el-select v-model="assignForm.secretLevel" style="width: 100%" placeholder="请选择">
|
<el-option
|
v-for="item in secretLevelOps"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="指派原因:" prop="applyReason">
|
<el-input type="textarea" v-model.trim="assignForm.applyReason" :rows="3" resize="none"></el-input>
|
</el-form-item>
|
</el-form>
|
</div>
|
</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="780px">
|
<template>
|
<el-table
|
:data="ncTableData"
|
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>
|
<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 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,
|
tableHeight: 220,
|
buttonLoading: false,
|
ncDocPushVisible: false,
|
assignVisible: false,
|
assignBatchVisible: false,
|
docBatchDeleteVisible: false,
|
ncDocList: [],
|
ncTableData: [],
|
tableData: [],
|
deviceTreeData: [],
|
activeName: 'first',
|
assignForm: {
|
secretLevel: '公开',
|
applyReason: '',
|
},
|
secretLevelOps: [{
|
value: '公开',
|
label: '公开'
|
}, {
|
value: '内部',
|
label: '内部'
|
}],
|
rules: {
|
applyReason: [
|
{required: false, message: '请输入指派原因', trigger: 'blur'}
|
],
|
},
|
pageData: {
|
page: 1,
|
size: 15,
|
total: 0,
|
pageSizeArr: [15, 30, 50]
|
},
|
ncParams: {
|
attributionType: '',//绑定类型
|
attributionId: '', //绑定类型对应的id
|
docClassCode: 'NC' //文档类型为其他文档
|
},
|
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
|
}
|
},
|
filterDevice(value, data) {
|
if (!value) return true;
|
return data.label.indexOf(value) !== -1;
|
},
|
docSelectionChange(val) {
|
this.docSelection = val;
|
},
|
showDocEditDialog() {
|
this.$emit('showDocEditDialog', this.rightClickRow);
|
},
|
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;//打开批量删除文档弹窗
|
},
|
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;
|
}
|
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)
|
Bus.$emit('sendNcTableData', this.ncTableData)
|
}
|
})
|
}
|
},
|
// 得到选中的所有数据
|
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;
|
this.$nextTick(() => {
|
for (let i = 0; i < this.tableData.length; i++) {
|
if (this.tableData[i].docId === this.rightClickRow.docId) {
|
this.$refs.multipleTable.toggleRowSelection(this.tableData[i], true)
|
}
|
}
|
})
|
}
|
})
|
}
|
},
|
handleSizeChange(val) {
|
// 改变每页显示条数的时候调用一次
|
this.changePageCoreRecordData();
|
this.pageData.size = val;
|
this.queryNCDoc();
|
},
|
handlePageChange(val) {
|
// 改变页的时候调用一次
|
this.changePageCoreRecordData();
|
this.pageData.page = val;
|
this.queryNCDoc();
|
},
|
handleCurrentChange(val) {
|
this.nodeData.index = 6;
|
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'
|
});
|
} else {
|
_this.buttonLoading = false;
|
_this.$notify({
|
title: '警告',
|
message: '删除 ' + mgs + res.message,
|
type: 'warning',
|
duration: 0
|
});
|
}
|
});
|
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();
|
}, (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: 15,
|
total: 0,
|
pageSizeArr: [15, 30, 50]
|
};
|
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,
|
secretLevel: this.assignForm.secretLevel,
|
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: 15,
|
total: 0,
|
pageSizeArr: [15, 30, 50]
|
};
|
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 {
|
max-height: 600px;
|
overflow: auto;
|
.el-tree {
|
height: 100%;
|
overflow: auto;
|
}
|
}
|
</style>
|