| | |
| | | <template> |
| | | <div> |
| | | <div class="laboratoryMangement"> |
| | | <el-row> |
| | | <el-col :span="12" class="top_left_name">实验室管理</el-col> |
| | | <el-col :span="12" style="text-align: right;"> |
| | | <el-col :span="12" class="top_left_name">设备维护</el-col> |
| | | <el-col :span="12" style="text-align: right;" class="title"> |
| | | <el-button |
| | | @click="testItem()" |
| | | type="primary" |
| | |
| | | <el-form-item label="设备用途" prop="type"> |
| | | <el-select |
| | | v-model="ruleForm.type" |
| | | @change="selectinstall" |
| | | placeholder="请选择设备用途" |
| | | > |
| | | <el-option label="生产设备" value="1"></el-option> |
| | |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="父级分类"> |
| | | <el-form-item label="设备组" prop="name"> |
| | | <el-select |
| | | v-model="value" |
| | | @blur="productSelect" |
| | | filterable |
| | | v-model="ruleForm.equr" |
| | | allow-create |
| | | placeholder="请选择父级分类" |
| | | filterable |
| | | @create="" |
| | | placeholder="请选择设备组" |
| | | > |
| | | <el-option |
| | | v-for="list in parentClassificationList" |
| | | :key="list.index" |
| | | :label="list.father" |
| | | :value="list.father" |
| | | v-for="list in equaip" |
| | | :key="list" |
| | | :label="list" |
| | | :value="list" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | <!-- <el-autocomplete |
| | | class="inline-input" |
| | | v-model="ruleForm.equr" |
| | | :fetch-suggestions="querySearch" |
| | | placeholder="请输入内容" |
| | | ></el-autocomplete> --> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检测项目" prop="rawInsProductId" required> |
| | | <el-select |
| | | v-model="ruleForm.rawInsProductId" |
| | | placeholder="请选择检测项目" |
| | | > |
| | | <el-option |
| | | v-for="item in inspectionList" |
| | | :key="item.index" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检测样品" required> |
| | | <el-form-item> |
| | | <el-input |
| | | placeholder="检测样品" |
| | | :disabled="true" |
| | | style="width: 206px" |
| | | v-model="showCodeNameModel.name" |
| | | > |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <!-- <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="规格型号"> |
| | | <el-input |
| | |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检测人"> |
| | | <el-input |
| | | placeholder="检测人" |
| | | :disabled="true" |
| | | style="width: 206px" |
| | | v-model="showCodeNameModel.user_name" |
| | | > |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | </el-row> --> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogVisible = false">取 消</el-button> |
| | |
| | | <el-radio-group |
| | | class="ai-tab-change" |
| | | style="width: 270px; margin-top: 5px" |
| | | v-model="radio1" |
| | | v-model="equipment" |
| | | @input="RadioChange" |
| | | > |
| | | <el-radio-button size="small" label="true"> |
| | | <div>生产设备</div> |
| | | </el-radio-button> |
| | | <el-radio-button size="small" label="false"> |
| | | <div>检测设备</div> |
| | | </el-radio-button> |
| | | <el-radio-button label="1">生产设备</el-radio-button> |
| | | <el-radio-button label="2">检验设备</el-radio-button> |
| | | </el-radio-group> |
| | | <el-input |
| | | <!-- <el-input |
| | | class="frame_input" |
| | | v-model="search_class" |
| | | placeholder="请输入分类名称" |
| | |
| | | style="font-size: 23px; padding: 5px 0;cursor:pointer;" |
| | | @click="handlerDeptList" |
| | | ></i> |
| | | </el-input> |
| | | </el-input> --> |
| | | <el-tree |
| | | :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 }"> |
| | |
| | | }` |
| | | " |
| | | ></i> |
| | | {{ data.name }}</span |
| | | {{ data.father }}</span |
| | | > |
| | | <el-button type="text" size="mini" @click.stop="remove(node, data)"> |
| | | <!-- <el-button type="text" size="mini" @click.stop="remove(node, data)"> |
| | | <i class="el-icon-delete"></i> |
| | | </el-button> |
| | | </el-button> --> |
| | | </div> |
| | | </el-tree> |
| | | </div> |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="仪器设备名称" width="125"> |
| | | </el-table-column> |
| | | <el-table-column prop="keeper" label="保管人"> </el-table-column> |
| | | <el-table-column prop="userName" label="保管人"> </el-table-column> |
| | | <el-table-column |
| | | prop="end_measure" |
| | | prop="DATE_FORMAT(end_measure, '%Y-%m-%d')" |
| | | label="计量截至有效期" |
| | | width="147" |
| | | > |
| | |
| | | :show-overflow-tooltip="true" |
| | | > |
| | | </el-table-column> |
| | | <el-table-column prop="inspectProject" label="检测项目"> |
| | | <!-- <el-table-column prop="inspectProject" label="检测项目"> |
| | | </el-table-column> |
| | | <el-table-column prop="testSample" label="检验样品"> |
| | | </el-table-column> |
| | | <el-table-column prop="user_name" label="检测人"> </el-table-column> |
| | | <el-table-column prop="user_name" label="检测人"> </el-table-column> --> |
| | | <el-table-column prop="name" label="操作"> |
| | | <template v-slot="scope"> |
| | | <el-button |
| | | @click="handleClick(scope.$index, tableData, scope.row)" |
| | | @click="handleClick(scope.row)" |
| | | type="text" |
| | | size="small" |
| | | >删除</el-button |
| | |
| | | name: "LaboratoryManagement", |
| | | data() { |
| | | return { |
| | | |
| | | value: "", |
| | | dialogVisible: false, |
| | | checkTreeNode:{}, |
| | | isCollapse: true, //默认为展开 |
| | | radio1: "true", // 分类切换 |
| | | tableData: [], // 主页表格数据 |
| | |
| | | staue_value: "", // 主页表格上方的状态选择 |
| | | // BOM树数据结构 |
| | | towTree: [], |
| | | equipment: '1', |
| | | equaip:[], |
| | | ruleForm: { |
| | | // 新增仪器表单 |
| | | code: "", |
| | |
| | | keeper: "", |
| | | name: "", |
| | | rawInsProductId: "", |
| | | type: "" |
| | | type: "", |
| | | // treedata:{ |
| | | // father:'设备组1', |
| | | // }, |
| | | equr:'', |
| | | |
| | | }, |
| | | delete:{}, |
| | | equip:1, |
| | | rules: { |
| | | name: [ |
| | | { required: true, message: "请输入仪器设备编号", trigger: "blur" }, |
| | |
| | | } |
| | | }; |
| | | }, |
| | | mounted() { |
| | | // 初始化调用二级树 |
| | | this.twoTreeApi(); |
| | | // 初始化调用表格数据 |
| | | // this.tableDataApi(); |
| | | // this.selectDevice() |
| | | }, |
| | | methods: { |
| | | handleNodeClick(val) { |
| | | this.checkTreeNode = val |
| | | console.log(this.checkTreeNode); |
| | | this.selectDevice() |
| | | }, |
| | | selectInput(){ |
| | | |
| | | }, |
| | | // querySearch(queryString, cb) { |
| | | // console.log(this.equaip); |
| | | // var restaurants = this.equaip; |
| | | // var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants; |
| | | // // 调用 callback 返回建议列表的数据 |
| | | // cb(results); |
| | | // }, |
| | | // createFilter(queryString) { |
| | | // return (restaurant) => { |
| | | // return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0); |
| | | // }; |
| | | // }, |
| | | 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() { |
| | | this.isCollapse = !this.isCollapse; |
| | |
| | | } |
| | | }, |
| | | submitForm() { |
| | | this.$refs.ruleForm.validate(valid => { |
| | | if (valid) { |
| | | this.ruleForm.father = this.value; |
| | | this.$axios |
| | | .post(this.$api.url.addDeviceInstrument, this.ruleForm, { |
| | | headers: { |
| | | "Content-Type": "application/json" |
| | | } |
| | | }) |
| | | .then(res => { |
| | | this.keeperList = res.data; |
| | | // 成功关闭新增弹出框 |
| | | this.dialogVisible = false; |
| | | }); |
| | | } else { |
| | | console.log("error submit!!"); |
| | | return false; |
| | | } |
| | | }); |
| | | // this.$refs.ruleForm.validate(valid => { |
| | | // if (valid) { |
| | | // this.ruleForm.father = this.value; |
| | | // this.$axios |
| | | // .post(this.$api.url.addDeviceInstrument, this.ruleForm, { |
| | | // headers: { |
| | | // "Content-Type": "application/json" |
| | | // } |
| | | // }) |
| | | // .then(res => { |
| | | // this.keeperList = res.data; |
| | | // // 成功关闭新增弹出框 |
| | | // this.dialogVisible = false; |
| | | // }); |
| | | // } else { |
| | | // console.log("error submit!!"); |
| | | // return false; |
| | | // } |
| | | // }); |
| | | this.addApi() |
| | | this.dialogVisible = false; |
| | | }, |
| | | handleClose(done) { |
| | | this.$confirm("确认关闭?") |
| | |
| | | this.$axios.get(this.$api.url.addDeviceKeeper).then(res => { |
| | | this.keeperList = res.data; |
| | | }); |
| | | this.$axios.get(this.$api.url.addDeviceInspectDownBox).then(res => { |
| | | this.inspectionList = res.data; |
| | | }); |
| | | this.$axios.get(this.$api.url.addDeviceParentClassification).then(res => { |
| | | this.parentClassificationList = res.data; |
| | | }); |
| | | }, |
| | | selectinstall(val) { |
| | | this.equip = val |
| | | this.listgroup() |
| | | }, |
| | | listgroup() { |
| | | this.$axios.get(this.$api.url.listgroup,{ |
| | | params:{ |
| | | type:this.equip |
| | | } |
| | | }) |
| | | .then(res =>{ |
| | | this.equaip = res.data |
| | | // res.data.forEach(item=>{ |
| | | // let obj={ |
| | | // id: item, |
| | | // value: item |
| | | // } |
| | | // this.equaip.push(obj) |
| | | console.log(this.equaip); |
| | | // }) |
| | | }) |
| | | }, |
| | | RadioChange(val){ |
| | | console.log(val); |
| | | this.equip = val |
| | | this.twoTreeApi() |
| | | }, |
| | | twoTreeApi() { |
| | | this.$axios.get(this.$api.url.towTree).then(res => { |
| | | let list = res.data; |
| | | list.forEach(i => { |
| | | if (i.name === undefined) { |
| | | i.name = i.children[0].name; |
| | | i.id = i.children[0].id; |
| | | i.children = undefined; |
| | | } |
| | | }); |
| | | this.$axios.get(this.$api.url.towTree,{ |
| | | params:{ |
| | | type:this.equip, |
| | | } |
| | | }).then(res => { |
| | | // let list = res.data; |
| | | // list.forEach(i => { |
| | | // if (i.name === undefined) { |
| | | // i.name = i.children[0].name; |
| | | // i.id = i.children[0].id; |
| | | // i.children = undefined; |
| | | // } |
| | | // }); |
| | | 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 |
| | | this.checkTreeNode.father = name |
| | | console.log(name); |
| | | this.selectDeviceStart(name) |
| | | }); |
| | | }, |
| | | tableDataApi() { |
| | | this.$axios.get(this.$api.url.tableDeviceList).then(res => { |
| | | this.tableData = res.data; |
| | | }); |
| | | 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,{ |
| | | code:this.ruleForm.code, |
| | | deviceStatus:this.ruleForm.deviceStatus, |
| | | endMeasure:this.ruleForm.endMeasure, |
| | | factory:this.ruleForm.factory, |
| | | father:this.ruleForm.equr, |
| | | keeper:this.ruleForm.keeper, |
| | | name:this.ruleForm.name, |
| | | type:this.ruleForm.type, |
| | | }, {headers: {"Content-Type": "application/json"} |
| | | }).then(res =>{ |
| | | this.selectDevice() |
| | | this.$message.success('新增成功') |
| | | this.ruleForm = {} |
| | | }) |
| | | }, |
| | | // tableDataApi() { |
| | | // this.$axios.get(this.$api.url.tableDeviceList).then(res => { |
| | | // this.tableData = res.data; |
| | | // }); |
| | | // }, |
| | | reset() { |
| | | this.tableDataApi(); |
| | | this.radio1 = "true"; |
| | | this.codeNameModel = ""; |
| | | this.staue_value = ""; |
| | | }, |
| | | handleNodeClick(data) { |
| | | if (data.id === undefined) { |
| | | this.$axios |
| | | .get(this.$api.url.tableDeviceList, { |
| | | params: { fatherName: data.name } |
| | | }) |
| | | .then(res => { |
| | | this.tableData = res.data; |
| | | }); |
| | | } else if (data.id !== undefined) { |
| | | this.$axios |
| | | .get(this.$api.url.tableDeviceList, { params: { deviceId: data.id } }) |
| | | .then(res => { |
| | | this.tableData = res.data; |
| | | }); |
| | | } |
| | | // 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; |
| | | // }); |
| | | // } |
| | | }, |
| | | handleClick(index, datas, row) { |
| | | this.$confirm("此操作将永久删除该设备, 是否继续?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }).then(() => { |
| | | this.$axios |
| | | .delete(this.$api.url.deleteDevice, { params: { deviceId: row.id } }) |
| | | .then(res => { |
| | | this.$message({ |
| | | message: res.message, |
| | | type: "success" |
| | | }); |
| | | datas.splice(index, 1); |
| | | }) |
| | | .catch(err => { |
| | | this.$message({ |
| | | message: err.message, |
| | | type: "warning" |
| | | }); |
| | | }); |
| | | delDeviceById() { |
| | | this.$axios.post(this.$api.url.delDeviceById,{ |
| | | id:this.delete.id |
| | | }).then(res=>{ |
| | | this.$parent.removeAllTab() |
| | | }); |
| | | }, |
| | | handleClick(row) { |
| | | console.log(row); |
| | | this.delete = row |
| | | this.delDeviceById() |
| | | this.selectDevice() |
| | | // this.$confirm("此操作将永久删除该设备, 是否继续?", "提示", { |
| | | // confirmButtonText: "确定", |
| | | // cancelButtonText: "取消", |
| | | // type: "warning" |
| | | // }).then(() => { |
| | | // this.$axios |
| | | // .delete(this.$api.url.deleteDevice, { params: { deviceId: row.id } }) |
| | | // .then(res => { |
| | | // this.$message({ |
| | | // message: res.message, |
| | | // type: "success" |
| | | // }); |
| | | // datas.splice(index, 1); |
| | | // }) |
| | | // .catch(err => { |
| | | // this.$message({ |
| | | // message: err.message, |
| | | // type: "warning" |
| | | // }); |
| | | // }); |
| | | // }); |
| | | }, |
| | | remove(node, data) { |
| | | this.$confirm("此操作将永久删除该设备, 是否继续?", "提示", { |
| | |
| | | } |
| | | }); |
| | | }, |
| | | 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; |
| | | }); |
| | | } |
| | | |
| | | }, |
| | | mounted() { |
| | | // 初始化调用二级树 |
| | | this.twoTreeApi(); |
| | | // 初始化调用表格数据 |
| | | this.tableDataApi(); |
| | | }, |
| | | |
| | | watch: { |
| | | "ruleForm.rawInsProductId": { |
| | | //监听ruleForm.rawInsProductId |
| | |
| | | } |
| | | } |
| | | }, |
| | | dialogVisible: { |
| | | handler: function(newVal, oldVal) { |
| | | if (newVal) { |
| | | // 成功清空输入内容 |
| | | this.ruleForm = {}; |
| | | this.value = ""; |
| | | this.showCodeNameModel = {}; |
| | | this.$refs.ruleForm.resetFields(); |
| | | } |
| | | } |
| | | }, |
| | | // dialogVisible: { |
| | | // handler: function(newVal, oldVal) { |
| | | // if (newVal) { |
| | | // // 成功清空输入内容 |
| | | // this.ruleForm = {}; |
| | | // this.value = ""; |
| | | // this.showCodeNameModel = {}; |
| | | // this.$refs.ruleForm.resetFields(); |
| | | // } |
| | | // } |
| | | // }, |
| | | radio1: { |
| | | handler: function(newVal, oldVal) { |
| | | this.towTree = []; |
| | |
| | | line-height: 14px; |
| | | } |
| | | </style> |
| | | <style> |
| | | .laboratoryMangement .title *{ |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .laboratoryMangement .table_top_div *{ |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .laboratoryMangement .title .el-button { |
| | | height: 32px; |
| | | border: 1px solid rgba(190, 190, 190, 0.44); |
| | | box-shadow: 0px 2px 4px rgba(220, 220, 220, 0.41); |
| | | padding: 0 12px; |
| | | } |
| | | .laboratoryMangement .table_top_div .el-button { |
| | | height: 32px; |
| | | border: 1px solid rgba(190, 190, 190, 0.44); |
| | | box-shadow: 0px 2px 4px rgba(220, 220, 220, 0.41); |
| | | padding: 0 12px; |
| | | } |
| | | </style> |