| | |
| | | <el-button :size="size" text v-if="row.nodeType < 60" icon="el-icon-document-add" type="primary" @click="showAdd(row)" placeholder="新增子级" title="新增子级"></el-button> |
| | | <el-button :size="size" text v-if="row.nodeType == 60" icon="el-icon-upload" type="primary" @click="showUpload(row)" placeholder="文件上传" title="文件上传"></el-button> |
| | | <el-button :size="size" text v-if="row.nodeType == 60" icon="el-icon-pie-chart" type="primary" @click="upgrade(row)" placeholder="升级" title="升级"></el-button> |
| | | <el-button :size="size" text v-if="row.nodeType == 60 && !isSM" icon="el-icon-position" type="primary" @click="downsend(row)" placeholder="下发" title="下发"></el-button> |
| | | <el-button :size="size" text v-if="row.nodeType == 70 && !isSM" icon="el-icon-position" type="primary" @click="downsend(row)" placeholder="下发" title="下发"></el-button> |
| | | </template> |
| | | </avue-crud> |
| | | <!-- 新增节点 --> |
| | |
| | | <avue-form :option="modalOption" v-model="modalForm" @submit="modalSubmit" @reset-change="modalCancel"/> |
| | | </el-dialog> |
| | | <el-dialog title="上传文件" append-to-body v-model="uploadmodalBox"> |
| | | <avue-form :option="uploadmodalOption" v-model="uploadmodalForm" @submit="uploadmodalSubmit" @reset-change="uploadmodalCancel" :upload-before="uploadBefore" :upload-after="uploadAfter"></avue-form> |
| | | <avue-form :option="uploadmodalOption" v-model="uploadmodalForm" @submit="uploadmodalSubmit" @reset-change="uploadmodalCancel" :upload-before="uploadBefore" :upload-after="uploadAfter" ref="uploadRef"></avue-form> |
| | | </el-dialog> |
| | | <avue-tabs :option="tabsOption" @change="tabsHandleChange" style="margin-top: 30px;" v-if="isShowTabs"></avue-tabs> |
| | | <avue-form v-if="tabsType == 'tab1'" :option="tabsFormOption" v-model="tabsForm"></avue-form> |
| | | <span v-else-if="tabsType == 'tab2'">版本信息</span> |
| | | <template v-else-if="tabsType == 'tab3'"> |
| | | 文件内容 |
| | | {{fileContent}} |
| | | <!-- <div v-for="item in fileList" v-if="fileList.length > 0" class="fileListStyle"> |
| | | <span>{{item.name}}</span> |
| | | <span class="delFile" @click="delFile(item)">X</span> |
| | |
| | | export default { |
| | | data() { |
| | | return { |
| | | file: null, |
| | | fileContent: "", |
| | | isSM: false, //是否是涉密网 ,工控网5个,涉密网4个 |
| | | isShowTabs: true, |
| | | nodeTypeList: [], |
| | |
| | | }, |
| | | { |
| | | label: '创建人', |
| | | prop: 'createUser', |
| | | prop: 'createUserName', |
| | | disabled: true, |
| | | placeholder: " " |
| | | }, |
| | |
| | | }, |
| | | { |
| | | label: '设备(机床)', |
| | | prop: 'abc' |
| | | prop: 'machineCode', |
| | | type: 'select', |
| | | dicUrl: '/blade-mdm/machine/page', |
| | | props: { |
| | | label: 'name', |
| | | value: 'code', |
| | | }, |
| | | dicFormatter(res) { |
| | | return res.data.records; |
| | | } |
| | | }, |
| | | { |
| | | label: '节点名称', |
| | |
| | | }, |
| | | { |
| | | label: '节点描述', |
| | | prop: 'abc', |
| | | prop: 'description', |
| | | hide: true |
| | | }, |
| | | { |
| | |
| | | total: 0, |
| | | }, |
| | | option: { |
| | | rowKey: "id", |
| | | treeProps: { |
| | | children: "children", |
| | | hasChildren: 'hasChildren', |
| | | }, |
| | | lazy: true, |
| | | rowKey: 'id', |
| | | addBtn: false, |
| | |
| | | }, |
| | | { |
| | | label: '类型', |
| | | prop: 'nodeType' |
| | | prop: 'nodeTypeName' |
| | | }, |
| | | { |
| | | label: '设备', |
| | | prop: 'abc' |
| | | prop: 'machineCode' |
| | | }, |
| | | { |
| | | label: '固化状态', |
| | |
| | | }, |
| | | { |
| | | label: '创建人', |
| | | prop: 'createUser', |
| | | prop: 'createUserName', |
| | | width: '180' |
| | | } |
| | | ], |
| | | }, |
| | | data: [], |
| | | upData: [] |
| | | }; |
| | | }, |
| | | computed: { |
| | |
| | | disabled: true |
| | | }, |
| | | { |
| | | label: '设备编号', |
| | | prop: 'machineCode', |
| | | type: 'select', |
| | | dicUrl: '/blade-mdm/machine/page', |
| | | props: { |
| | | label: 'name', |
| | | value: 'code', |
| | | }, |
| | | dicFormatter(res) { |
| | | return res.data.records; |
| | | } |
| | | }, |
| | | { |
| | | label: '零组件号/图号', |
| | | prop: 'drawingNo' |
| | | }, |
| | | { |
| | | label: '工序', |
| | | prop: 'processName' |
| | | }, |
| | | { |
| | | label: '工序版本', |
| | | prop: 'processEdition' |
| | | }, |
| | | { |
| | | label: '节点分类', |
| | | prop: 'category', |
| | | type: 'select', |
| | | dicUrl: '/blade-system/dict-biz/dictionary?code=node_file_type', |
| | | props: { |
| | | label: 'dictValue', |
| | | value: 'dictKey', |
| | | } |
| | | }, |
| | | { |
| | | label: '选择文件', |
| | | prop: 'uploadFile', |
| | | type: 'upload', |
| | |
| | | action: "", |
| | | showFileList: false, |
| | | span: 24, |
| | | tip: "请上传文件,将在提交时统一处理", |
| | | action: "/blade-mdm/program/ncfile/upload" |
| | | }, |
| | | { |
| | |
| | | }, |
| | | watch: { |
| | | uploadmodalBox(old) { |
| | | this.onLoad(); |
| | | //this.onLoad(); |
| | | } |
| | | }, |
| | | methods: { |
| | | downsend(row) { |
| | | |
| | | }, |
| | | uploadAfter() { |
| | | |
| | | downsend(row) { //下发 |
| | | // this.loading = true; |
| | | // axios({ |
| | | // url: '/program/ncfile/send-to-machine-by-nodeid', |
| | | // method: 'get', |
| | | // params: {nodeId:id}, |
| | | // }).then( |
| | | // res => { |
| | | |
| | | // } |
| | | // ); |
| | | }, |
| | | upgrade(row) { //升级 |
| | | this.loading = true; |
| | |
| | | ); |
| | | }, |
| | | uploadBefore(file,done,loading,column) { |
| | | done(); |
| | | //nodeId: this.tabsForm.id |
| | | //done(); |
| | | this.file = file; |
| | | return false; |
| | | }, |
| | | uploadAfter() { |
| | | }, |
| | | uploadmodalSubmit(row,done) { |
| | | if(this.file == null) { |
| | | this.$message.error('请上传文件'); |
| | | return; |
| | | } |
| | | var formData = new FormData(); |
| | | formData.append('file', this.file); |
| | | formData.append('nodeId', this.id); |
| | | Object.keys(this.uploadmodalForm).forEach(key => { |
| | | formData.append(key, this.uploadmodalForm[key]); |
| | | }); |
| | | this.loading = true; |
| | | axios({ |
| | | url: '/blade-mdm/program/ncfile/upload', |
| | | method: 'post', |
| | | data: formData, |
| | | }).then( |
| | | res => { |
| | | this.loading = false; |
| | | this.uploadmodalBox = false; |
| | | this.addLocalTreeNode(row.parentId); //重新加载下一级 |
| | | done(); |
| | | } |
| | | ); |
| | | }, |
| | | rowClick(row) { |
| | | this.tabsForm = row; |
| | |
| | | getFile(id) { //查看文件内容 |
| | | this.loading = true; |
| | | axios({ |
| | | url: '/blade-mdm/program/ncfile/content', |
| | | url: '/blade-mdm/program/ncfile/content-by-nodeid', |
| | | method: 'get', |
| | | params: {id}, |
| | | params: {nodeId:id}, |
| | | }).then( |
| | | res => { |
| | | this.loading = true; |
| | | console.log(res.data,123) |
| | | this.loading = false; |
| | | this.fileContent = res.data.data; |
| | | } |
| | | ); |
| | | }, |
| | | uploadmodalSubmit(row,done) { |
| | | this.uploadmodalBox = false; |
| | | this.addLocalTreeNode(row.parentId); //重新加载下一级 |
| | | done(); |
| | | }, |
| | | rowDel(row, index, done) { |
| | | done(row); |
| | |
| | | return false; |
| | | }; |
| | | updateTree(this.data); |
| | | // this.upData = JSON.parse(JSON.stringify(this.data)); |
| | | // this.data = []; |
| | | // 强制刷新 |
| | | this.$nextTick(() => { |
| | | this.$refs.crud?.refreshTable(); |
| | | //this.$refs.crud.toggleRowExpansion('0', true); |
| | | console.log(this.data,222) |
| | | // this.data = this.upData; |
| | | // this.option.defaultExpandAll = true; |
| | | }); |
| | | // setTimeout(()=> { |
| | | // this.data = this.upData; |
| | | // this.option.defaultExpandAll = true; |
| | | // console.log(this.data,222) |
| | | // },3000) |
| | | }, |
| | | updateLocalTreeNode(nodeData) { //修改的方法 |
| | | const updateNode = (nodes) => { |
| | |
| | | params: obj, |
| | | }).then( |
| | | res => { |
| | | resolve(res.data.data); |
| | | this.loading = false; |
| | | resolve(res.data.data); |
| | | } |
| | | ); |
| | | }, |
| | |
| | | params: obj, |
| | | }).then( |
| | | res => { |
| | | this.loading = false; |
| | | this.data = res.data.data; |
| | | if(this.data.length == 0) { |
| | | return; |
| | | } |
| | | this.tabsForm = res.data.data[0]; //节点信息 |
| | | this.nodeTypeList.forEach(item=> { |
| | | if(item.dictKey == this.data[0].nodeType) { |
| | | this.tabsForm.nodeTypeName = item.dictValue; |
| | | } |
| | | }) |
| | | this.loading = false; |
| | | } |
| | | ); |
| | | } |
| | |
| | | this.nodeTypeList = res.data.data; |
| | | } |
| | | ); |
| | | //判断版本 0:涉密网,1:工控网;//工控网5个,涉密网4个 |
| | | axios({url: '/blade-system/param/detail?paramKey=networkType',method: 'get'}).then(res => { |
| | | if(res.data.data.paramValue === "0") { |
| | | //判断版本 0:涉密网,1:工控网;//工控网5个,涉密网4个 |
| | | axios({url: '/blade-mdm/system/param/getValue?paramKey=networkType',method: 'get'}).then(res => { |
| | | if(res.data.data === "0") { |
| | | this.isSM = true; |
| | | } |
| | | } |