| | |
| | | delQueById:"/techniqueModel/delQueById",//删除 |
| | | delAllQue:"/techniqueModel/delAllQue",//批量删除 |
| | | selecQueById:"/techniqueModel/selecQueById",//编辑 |
| | | writeQueById:"/techniqueModel/writeQueById",//编辑传参 |
| | | |
| | | } |
| | | const url = { |
| | |
| | | placeholder="请输入搜索内容" |
| | | size="small" |
| | | clearable @input="query" ></el-input> |
| | | <el-tree :data="list" ref="tree" :props="{children: 'children',label: 'father'}" node-key="name" default-expand-all |
| | | <el-tree :data="list" ref="tree" :props="{children: 'children',label: 'father'}" style="height: 500px;overflow-y: auto;" node-key="name" default-expand-all |
| | | @node-click="handleNodeClick" highlight-current |
| | | > |
| | | <div class="custom-tree-node" slot-scope="{ node, data }"> |
| | |
| | | <div class="right"> |
| | | <el-table |
| | | :data="tableData" |
| | | style="width: 100%;margin-bottom: 20px;" |
| | | style="width: 100%;margin-bottom: 20px; height: 580px;overflow: auto;" |
| | | row-key="name" |
| | | border |
| | | @select="selectTr" |
| | | @selection-change="handleSelectionChange" |
| | | default-expand-all |
| | | ref="multipleTable" |
| | | :tree-props="{children: 'children', hasChildren: 'hasChildren'}"> |
| | | <el-table-column |
| | | type="selection" |
| | |
| | | unit:'', |
| | | id:'', |
| | | |
| | | } |
| | | }, |
| | | isAllSelect:false, |
| | | } |
| | | |
| | | }, |
| | |
| | | |
| | | }, |
| | | methods:{ |
| | | // 表格树全部选中配置 |
| | | // 全选/取消选操作 |
| | | selectAll(val) { |
| | | this.isAllSelect = !this.isAllSelect; |
| | | let data = this.tableData; |
| | | this.toggleSelect(data, this.isAllSelect, "all"); |
| | | }, |
| | | //选择某行 |
| | | selectTr(selection, row) { |
| | | console.log(selection,row); |
| | | this.$set(row, "isChecked", !row.isChecked); |
| | | this.$nextTick(() => { |
| | | this.isAllSelect = row.isChecked; |
| | | this.toggleSelect(row, row.isChecked, "tr"); |
| | | }); |
| | | }, |
| | | //递归子级 |
| | | toggleSelect(data, flag, type) { |
| | | if (type === "all") { |
| | | console.log('222'); |
| | | if (data.length > 0) { |
| | | data.forEach((item) => { |
| | | this.toggleSelection(item, flag); |
| | | if (item.children && item.children.length > 0) { |
| | | this.toggleSelect(item.children, flag, type); |
| | | } |
| | | }); |
| | | } |
| | | } else { |
| | | if (data.children && data.children.length > 0) { |
| | | data.children.forEach((item) => { |
| | | item.isChecked = !item.isChecked; |
| | | this.$refs.multipleTable.toggleRowSelection(item, flag); |
| | | this.toggleSelect(item, flag, type); |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | handleClose(){ |
| | | |
| | | }, |
| | |
| | | // rows.splice(index, 1); |
| | | // }, |
| | | handleSelectionChange(val) { |
| | | console.log(val); |
| | | this.selects = val; |
| | | }, |
| | | //编辑 |
| | |
| | | <div class="right"> |
| | | <el-table |
| | | :data="tableData" |
| | | style="width: 100%;margin-bottom: 20px;" |
| | | style="width: 100%;margin-bottom: 20px;height: 600px;overflow: auto;" |
| | | row-key="name" |
| | | border |
| | | @select="selectTr" |
| | | @selection-change="handleSelectionChange" |
| | | default-expand-all |
| | | ref="multipleTable" |
| | | :tree-props="{children: 'children', hasChildren: 'hasChildren'}"> |
| | | <el-table-column |
| | | type="selection" |
| | |
| | | width="200px"> |
| | | <template slot-scope="scope" style="text-align: center;"> |
| | | <div v-if="!scope.row.children"> |
| | | <el-button type="text" size="mini" @click="childrenClick(scope.row)">编辑</el-button> |
| | | <!-- <el-button type="text" size="mini" @click="childrenClick(scope.row)">编辑</el-button> --> |
| | | <el-button type="text" size="mini" @click="deleteRow(scope.$index, scope.row)">删除</el-button> |
| | | </div> |
| | | </template> |
| | |
| | | console.log(this.upData.id); |
| | | this.delQueById() |
| | | }, |
| | | handleSelectionChange(val) { |
| | | this.selects = val |
| | | }, |
| | | //批量删除 |
| | | delAllQue() { |
| | | this.$axios.post(this.$api.url.delAllQue,{ |
| | |
| | | // // filterNode(){ |
| | | |
| | | // }, |
| | | handleSelectionChange(val) { |
| | | this.deleteList = []; |
| | | val.forEach((v) => { |
| | | if (v.id !== undefined) { |
| | | this.deleteList.push(v.id); |
| | | } |
| | | }); |
| | | }, |
| | | // 表格树全部选中配置 |
| | | // 全选/取消选操作 |
| | | selectAll(val) { |
| | | this.isAllSelect = !this.isAllSelect; |
| | | let data = this.tableData; |
| | | this.toggleSelect(data, this.isAllSelect, "all"); |
| | | }, |
| | | //选择某行 |
| | | selectTr(selection, row) { |
| | | console.log(selection,row); |
| | | this.$set(row, "isChecked", !row.isChecked); |
| | | this.$nextTick(() => { |
| | | this.isAllSelect = row.isChecked; |
| | | this.toggleSelect(row, row.isChecked, "tr"); |
| | | }); |
| | | }, |
| | | //递归子级 |
| | | toggleSelect(data, flag, type) { |
| | | if (type === "all") { |
| | | console.log('222'); |
| | | if (data.length > 0) { |
| | | data.forEach((item) => { |
| | | this.toggleSelection(item, flag); |
| | | if (item.children && item.children.length > 0) { |
| | | this.toggleSelect(item.children, flag, type); |
| | | } |
| | | }); |
| | | } |
| | | } else { |
| | | if (data.children && data.children.length > 0) { |
| | | data.children.forEach((item) => { |
| | | item.isChecked = !item.isChecked; |
| | | this.$refs.multipleTable.toggleRowSelection(item, flag); |
| | | this.toggleSelect(item, flag, type); |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | } |
| | | } |
| | |
| | | <el-form-item label="设备用途" prop="type"> |
| | | <el-select |
| | | v-model="ruleForm.type" |
| | | @change="selectinstall" |
| | | placeholder="请选择设备用途" |
| | | > |
| | | <el-option label="生产设备" value="1"></el-option> |
| | |
| | | :data="towTree" |
| | | ref="tree" |
| | | :props="{ children: 'children', label: 'father' }" |
| | | node-key="id" |
| | | node-key="father" |
| | | default-expand-all |
| | | highlight-current |
| | | style="margin-top: 20px;" |
| | | @node-click="handleNodeClick" |
| | | |
| | | > |
| | | <div class="custom-tree-node" slot-scope="{ node, data }"> |
| | | <span |
| | |
| | | name: "LaboratoryManagement", |
| | | data() { |
| | | return { |
| | | |
| | | value: "", |
| | | dialogVisible: false, |
| | | checkTreeNode:{}, |
| | | isCollapse: true, //默认为展开 |
| | | radio1: "true", // 分类切换 |
| | | tableData: [], // 主页表格数据 |
| | |
| | | staue_value: "", // 主页表格上方的状态选择 |
| | | // BOM树数据结构 |
| | | towTree: [], |
| | | equipment: '', |
| | | equipment: '1', |
| | | equaip:'', |
| | | ruleForm: { |
| | | // 新增仪器表单 |
| | |
| | | name: "", |
| | | rawInsProductId: "", |
| | | type: "", |
| | | treedata:{ |
| | | father:'设备组1', |
| | | }, |
| | | // treedata:{ |
| | | // father:'设备组1', |
| | | // }, |
| | | equr:'', |
| | | |
| | | }, |
| | | delete:{}, |
| | | equip:1, |
| | |
| | | this.twoTreeApi(); |
| | | // 初始化调用表格数据 |
| | | // this.tableDataApi(); |
| | | this.selectDevice()//右边 |
| | | // this.selectDevice() |
| | | }, |
| | | methods: { |
| | | selectDevice() {//右边数据 |
| | | console.log(this.ruleForm.treedata.father); |
| | | console.log(this.equip); |
| | | this.$axios.get(this.$api.url.selectDevice,{ |
| | | params:{ |
| | | father:this.ruleForm.treedata.father, |
| | | type:this.equip, |
| | | } |
| | | }).then(res =>{ |
| | | console.log(res); |
| | | this.tableData = res.data |
| | | }, { |
| | | headers: { |
| | | "Content-Type": "application/json" |
| | | } |
| | | }) |
| | | handleNodeClick(val) { |
| | | this.checkTreeNode = val |
| | | console.log(this.checkTreeNode); |
| | | this.selectDevice() |
| | | }, |
| | | |
| | | staueValueChange() { |
| | | this.selectDevice() |
| | | // this.tableData = []; |
| | | // let val = 1; |
| | | // if (this.radio1 === "false") { |
| | | // val = 2; |
| | | // } |
| | | // this.$axios |
| | | // .get(this.$api.url.tableDeviceList, { |
| | | // params: { type: val, deviceStatue: this.staue_value } |
| | | // }) |
| | | // .then(res => { |
| | | // this.tableData = res.data; |
| | | // }); |
| | | }, |
| | | // 动态控制展开与收起和切换对应图标 |
| | | isC() { |
| | |
| | | .catch(_ => {}); |
| | | }, |
| | | testItem() { |
| | | this.listgroup() |
| | | this.dialogVisible = true; |
| | | this.$axios.get(this.$api.url.addDeviceKeeper).then(res => { |
| | | this.keeperList = res.data; |
| | | }); |
| | | }, |
| | | selectinstall(val) { |
| | | this.equip = val |
| | | this.listgroup() |
| | | }, |
| | | listgroup() { |
| | | this.$axios.get(this.$api.url.listgroup).then(res =>{ |
| | | this.$axios.get(this.$api.url.listgroup,{ |
| | | params:{ |
| | | type:this.equip |
| | | } |
| | | }).then(res =>{ |
| | | this.equaip = res.data |
| | | console.log(this.equip); |
| | | }) |
| | |
| | | // } |
| | | // }); |
| | | this.towTree = res.data; |
| | | }); |
| | | this.$nextTick(() => { |
| | | this.$refs.tree.setCurrentKey(this.towTree[0].father) // 默认选中节点第一个 |
| | | }) |
| | | console.log(this.towTree); |
| | | let one=this.towTree[0] |
| | | console.log(one); |
| | | let name =one.father |
| | | console.log(name); |
| | | this.selectDeviceStart(name) |
| | | }); |
| | | }, |
| | | selectDeviceStart(name,) {//右边数据 |
| | | this.$axios.get(this.$api.url.selectDevice,{ |
| | | params:{ |
| | | father:name, |
| | | type:this.equip, |
| | | deviceStatus:this.staue_value, |
| | | message:this.codeNameModel, |
| | | } |
| | | }).then(res =>{ |
| | | console.log(res); |
| | | this.tableData = res.data |
| | | }, { |
| | | headers: { |
| | | "Content-Type": "application/json" |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | selectDevice() {//右边数据 |
| | | this.$axios.get(this.$api.url.selectDevice,{ |
| | | params:{ |
| | | father:this.checkTreeNode.father, |
| | | type:this.equip, |
| | | deviceStatus:this.staue_value, |
| | | message:this.codeNameModel, |
| | | } |
| | | }).then(res =>{ |
| | | console.log(res); |
| | | this.tableData = res.data |
| | | }, { |
| | | headers: { |
| | | "Content-Type": "application/json" |
| | | } |
| | | }) |
| | | }, |
| | | addApi() { |
| | | this.$axios.post(this.$api.url.addApi,{ |
| | |
| | | type:this.ruleForm.type, |
| | | }, {headers: {"Content-Type": "application/json"} |
| | | }).then(res =>{ |
| | | this.selectDevice() |
| | | this.$message.success('新增成功') |
| | | this.ruleForm = {} |
| | | this.selectDevice() |
| | | }) |
| | | }, |
| | | // tableDataApi() { |
| | |
| | | // }); |
| | | // }, |
| | | reset() { |
| | | this.tableDataApi(); |
| | | this.radio1 = "true"; |
| | | this.codeNameModel = ""; |
| | | this.staue_value = ""; |
| | | }, |
| | | handleNodeClick(data) { |
| | | console.log(data); |
| | | // this.treedata = data |
| | | this.selectDevice() |
| | | // this.tableDataApi(); |
| | | // this.radio1 = "true"; |
| | | // this.codeNameModel = ""; |
| | | // this.staue_value = ""; |
| | | this.staue_value = "" |
| | | this.codeNameModel = "" |
| | | this.selectDevice() |
| | | }, |
| | | handlerDeptList() { |
| | | this.towTree = []; |
| | |
| | | }); |
| | | }, |
| | | selectSearch() { |
| | | this.tableData = []; |
| | | if (this.radio1 === "false") { |
| | | this.$axios |
| | | .get(this.$api.url.tableDeviceList, { |
| | | params: { type: 1, codeNameModel: this.codeNameModel } |
| | | }) |
| | | .then(res => { |
| | | this.tableData = res.data; |
| | | }); |
| | | } else if (this.radio1 === "true") { |
| | | this.$axios |
| | | .get(this.$api.url.tableDeviceList, { |
| | | params: { type: 2, codeNameModel: this.codeNameModel } |
| | | }) |
| | | .then(res => { |
| | | this.tableData = res.data; |
| | | }); |
| | | } |
| | | this.selectDevice() |
| | | // this.tableData = []; |
| | | // if (this.radio1 === "false") { |
| | | // this.$axios |
| | | // .get(this.$api.url.tableDeviceList, { |
| | | // params: { type: 1, codeNameModel: this.codeNameModel } |
| | | // }) |
| | | // .then(res => { |
| | | // this.tableData = res.data; |
| | | // }); |
| | | // } else if (this.radio1 === "true") { |
| | | // this.$axios |
| | | // .get(this.$api.url.tableDeviceList, { |
| | | // params: { type: 2, codeNameModel: this.codeNameModel } |
| | | // }) |
| | | // .then(res => { |
| | | // this.tableData = res.data; |
| | | // }); |
| | | // } |
| | | }, |
| | | delDeviceById() { |
| | | this.$axios.post(this.$api.url.delDeviceById,{ |
| | |
| | | } |
| | | }); |
| | | }, |
| | | staueValueChange() { |
| | | this.tableData = []; |
| | | let val = 1; |
| | | if (this.radio1 === "false") { |
| | | val = 2; |
| | | } |
| | | this.$axios |
| | | .get(this.$api.url.tableDeviceList, { |
| | | params: { type: val, deviceStatue: this.staue_value } |
| | | }) |
| | | .then(res => { |
| | | this.tableData = res.data; |
| | | }); |
| | | } |
| | | |
| | | }, |
| | | |
| | | watch: { |
| | |
| | | process:{}, |
| | | // handleClose:[], |
| | | checkTreeNode:{ |
| | | id:2, |
| | | id:'', |
| | | }, |
| | | tableData:[], |
| | | tableapi:[{ |
| | |
| | | }) |
| | | }, |
| | | addMbom(data) { |
| | | this.$axios.post(this.$api.url.addMbom,data |
| | | // { |
| | | // name:this.tableapi.name, |
| | | // qualityTraceability:this.tableapi.qualityTraceability, |
| | | // specifications:this.tableapi.specifications, |
| | | // supplier:this.tableapi.supplier, |
| | | // techTemId:this.craftapi.id, |
| | | // unit:this.tableapi.unit, |
| | | // } |
| | | , { |
| | | this.$axios.post(this.$api.url.addMbom,data,{ |
| | | // params:{ |
| | | // techTemId:this.craftapi.id, |
| | | // mbomModelDto2List:[{ |
| | | // name:this.tableapi.name, |
| | | // qualityTraceability:this.tableapi.qualityTraceability, |
| | | // specifications:this.tableapi.specifications, |
| | | // supplier:this.tableapi.supplier, |
| | | // unit:this.tableapi.unit, |
| | | // }] |
| | | // } |
| | | }, { |
| | | headers: { |
| | | "Content-Type": "application/json" |
| | | } |
| | |
| | | this.$nextTick(() => { |
| | | this.$refs.tree.setCurrentKey(this.list[0].children[0].name) // 默认选中节点第一个 |
| | | }) |
| | | let one=this.list.filter(item=>{ |
| | | return item.children.length>0 |
| | | })[0] |
| | | console.log(one); |
| | | let name=one.children[0].id |
| | | console.log(name); |
| | | this.selectAllMbomStart(name) |
| | | this.selectDataList(); |
| | | }, { |
| | | headers: { |
| | | "Content-Type": "application/json" |
| | | } |
| | | }) |
| | | }, |
| | | selectAllMbomStart(name) { |
| | | this.$axios.get(this.$api.url.selectAllMbom,{ |
| | | params:{id:name} |
| | | }).then(res => { |
| | | this.tableData = res.data; |
| | | console.log(this.tableData); |
| | | }, { |
| | | headers: { |
| | | "Content-Type": "application/json" |
| | |
| | | }, |
| | | handleNodeClick(data){ |
| | | this.checkTreeNode = data |
| | | console.log(data); |
| | | console.log(this.checkTreeNode.id); |
| | | this.selectAllMbom() |
| | | }, |
| | |
| | | }) |
| | | .catch(_ => {}); |
| | | }, |
| | | //新增 |
| | | event(){ |
| | | this.dialogVisible = true |
| | | this.chooseTechFath() |
| | | }, |
| | | //添加行 |
| | | Addrow() { |
| | | if (this.tableapi == undefined) { |
| | | this.tableapi = new Array(); |
| | | } |
| | | let obj = []; |
| | | |
| | | this.tableapi.push(obj); |
| | | }, |
| | | skipshow(){ |
| | | console.log('666'); |
| | | let data = this.tableapi.at(-1) |
| | | // this.addMbom() |
| | | data.techTemId = this.search.craft |
| | | // console.log(this.search.craft); |
| | | // console.log(data); |
| | | |
| | | this.addMbom(data) |
| | | |
| | | this.dialogVisible = false |
| | | }, |
| | | //delAllMbom 批量删除 |
| | |
| | | console.log(this.tableData) |
| | | }, |
| | | mounted() { |
| | | |
| | | }, |
| | | methods: { |
| | | // 表格树全部选中配置 |
| | |
| | | import swal from 'sweetalert' |
| | | |
| | | Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80/"; //前端本地端口 |
| | | |
| | | Vue.prototype.HaveJson = (val) => { |
| | | return JSON.parse(JSON.stringify(val)) |
| | | } |
| | |
| | | const javaApi = 'http://192.168.0.23:8001' |
| | | // localhost 127.0.0.1 |
| | | |
| | | // const javaApi = 'http://127.0.0.1' |
| | | // const javaApi = 'http://127.0.0.1:8001/' |
| | | |
| | | |
| | | |