| | |
| | | @refresh-change="refreshChange" |
| | | @on-load="onLoad" |
| | | @tree-load="treeLoad" |
| | | @row-del="rowDel" |
| | | @row-save="rowSave" |
| | | @row-update="rowUpdate" |
| | | @row-click="rowClick" |
| | | > |
| | | <template #menu-left> |
| | |
| | | <el-button :size="size" text icon="el-icon-delete" type="primary" @click="showDel(row)" placeholder="删除" title="删除"></el-button> |
| | | <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 == 70" 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 == 60" icon="el-icon-pie-chart" type="primary" @click="upgrade(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" ref="uploadRef"></avue-form> |
| | | <avue-form :option="uploadmodalOption" v-model="uploadmodalForm" @submit="uploadmodalSubmit" @reset-change="uploadmodalCancel" :upload-before="uploadBefore" :upload-after="uploadAfter"> |
| | | <template #fileList="{}" slot-scope="{ value }"> |
| | | <div v-for="(file, index) in fileList" :key="index" v-if="fileList.length != 0"> |
| | | {{ file.name }} |
| | | </div> |
| | | <div v-else>没有上传文件</div> |
| | | </template> |
| | | </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> |
| | | </div> --> |
| | | </template> |
| | | </basic-container> |
| | | </template> |
| | |
| | | }, |
| | | { |
| | | label: '零组件号/图号', |
| | | prop: 'partNo' |
| | | prop: 'drawingNo' |
| | | }, |
| | | { |
| | | label: '工序', |
| | |
| | | action: "/blade-mdm/program/ncfile/upload" |
| | | }, |
| | | { |
| | | label: '文件列表', |
| | | prop: 'fileList', |
| | | }, |
| | | { |
| | | label: '备注', |
| | | prop: 'remark', |
| | | type: "textarea", |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | downsend(row) { |
| | | |
| | | 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(); |
| | | this.file = file; |
| | | this.fileList.push(file); |
| | | //done(); 放开就上传了 |
| | | return false; |
| | | }, |
| | | uploadAfter() { |
| | | }, |
| | | uploadmodalSubmit(row,done) { |
| | | uploadmodalSubmit(row,done) { //上传提交接口 |
| | | if(this.file == null) { |
| | | this.$message.error('请上传文件'); |
| | | return; |
| | |
| | | res => { |
| | | this.loading = false; |
| | | this.uploadmodalBox = false; |
| | | this.addLocalTreeNode(row.parentId); //重新加载下一级 |
| | | this.addLocalTreeNode(row.id); //重新加载下一级 |
| | | done(); |
| | | } |
| | | ); |
| | |
| | | this.tabsType = tabs.prop; |
| | | }, |
| | | showUpload(row) { |
| | | this.fileList = []; |
| | | this.uploadmodalForm = row; |
| | | this.uploadmodalBox = true; |
| | | //获取文件内容 |
| | | this.loading = true; |
| | | axios({ |
| | | url: '/blade-mdm/program/ncfile/list-by-node', |
| | | method: 'get', |
| | | params: {nodeId: row.id}, |
| | | }).then( |
| | | res => { |
| | | this.loading = false; |
| | | this.fileList = res.data.data; |
| | | this.uploadmodalBox = true; |
| | | } |
| | | ); |
| | | }, |
| | | getFile(id) { //查看文件内容 |
| | | this.loading = true; |
| | |
| | | this.fileContent = res.data.data; |
| | | } |
| | | ); |
| | | }, |
| | | rowDel(row, index, done) { |
| | | done(row); |
| | | }, |
| | | rowSave (row, done) { |
| | | done(row); |
| | | }, |
| | | rowUpdate (row, index, done) { |
| | | done(row); |
| | | }, |
| | | showEdit(row,done) { |
| | | this.modalTitle = "修改"; |
| | |
| | | }).then( |
| | | res => { |
| | | this.loading = false; |
| | | this.$refs.crud.rowDel(row); |
| | | var nodeArr = this.$refs.crud.$refs.table.store.states.lazyTreeNodeMap.value[row.parentId]; |
| | | var arr = nodeArr.filter(item => item.id !== row.id); |
| | | this.$refs.crud.$refs.table.store.states.lazyTreeNodeMap.value[row.parentId] = arr; |
| | | } |
| | | ); |
| | | }) |
| | |
| | | }).then( |
| | | res => { |
| | | var children = res.data.data || []; |
| | | this.updateParentNodeChildren(parentId, children); |
| | | this.$refs.crud.$refs.table.store.states.lazyTreeNodeMap.value[parentId] = [...children]; |
| | | this.loading = false; |
| | | } |
| | | ); |
| | | }, |
| | | updateParentNodeChildren(parentId, newChildren) { //新增的方法 |
| | | const updateTree = (nodes) => { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | if (nodes[i].id === parentId) { |
| | | // 更新节点数据 |
| | | nodes[i].children = [...newChildren]; |
| | | this.data = [...this.data]; // 替换顶层引用 |
| | | return true; |
| | | } |
| | | if (Array.isArray(nodes[i].children) && nodes[i].children.length > 0) { |
| | | if (updateTree(nodes[i].children)) { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | }; |
| | | updateTree(this.data); |
| | | // this.upData = JSON.parse(JSON.stringify(this.data)); |
| | | // this.data = []; |
| | | // 强制刷新 |
| | | this.$nextTick(() => { |
| | | this.$refs.crud?.refreshTable(); |
| | | //this.data = this.upData; |
| | | }); |
| | | // 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; |
| | | } |
| | | ); |
| | | } |