| | |
| | | <div class="ledger-main"> |
| | | <div class="page-header-search"> |
| | | <div class="serve-btn"> |
| | | <el-button type="primary" icon="el-icon-plus" |
| | | <el-button size="small" type="primary" icon="el-icon-plus" |
| | | @click="showAddDrawer()">新增仪器</el-button> |
| | | </div> |
| | | </div> |
| | |
| | | <div class="bom-item-search"> |
| | | <el-row> |
| | | <el-col :span="19"> |
| | | <el-input v-model="filterText" clearable placeholder="输入关键字进行过滤" /> |
| | | <el-input size="small" v-model="filterText" clearable placeholder="输入关键字进行过滤" /> |
| | | </el-col> |
| | | <el-col :span="5"> |
| | | <el-button type="primary" size="small" @click="addClassVisible = true"><i |
| | |
| | | <div class="table-header"> |
| | | <div class="search-bar"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="15"> |
| | | <el-col :span="8"> |
| | | <el-form ref="form" :inline="true" :model="searchData"> |
| | | <el-form-item> |
| | | <el-input v-model="searchData.keyword" placeholder="请输入编号/设备名称/型号规格"> |
| | | <el-form-item width="200"> |
| | | <el-input size="small" v-model="searchData.keyword" placeholder="请输入编号/设备名称/型号规格"> |
| | | <i slot="prefix" class="el-input__icon el-icon-search" /> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="filterTableData">查询</el-button> |
| | | <el-button type="primary" plain @click="resetBtn">重置</el-button> |
| | | <!-- <el-button type="text">高级搜索<i class="el-icon-arrow-down el-icon--right" /></el-button> --> |
| | | <el-button size="small" type="primary" @click="filterTableData">查询</el-button> |
| | | <el-button size="small" type="primary" plain @click="resetBtn">重置</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-col> |
| | | <el-col :span="9"> |
| | | <el-col :span="16"> |
| | | <el-radio-group v-model="radioValue" @change="getConditionTable"> |
| | | <!-- <el-radio-button label="0">全部</el-radio-button> --> |
| | | <el-radio-button v-for="item in conditionsOptions" :key="item.value" :label="item.value"> |
| | | {{ item.label }} |
| | | </el-radio-button> |
| | |
| | | </div> |
| | | <el-tabs v-model="activeTabsName"> |
| | | <el-tab-pane label="设备码点" name="codePoints"> |
| | | <el-button v-show="!codePointesTableStatus" :style="{ marginBottom: '18px' }" |
| | | @click="addCodePoints">新增设备码点</el-button> |
| | | <div v-show="codePointesTableStatus" :style="{ marginBottom: '18px' }" class="btns"> |
| | | <div :style="{ marginBottom: '18px' }" class="btns"> |
| | | <el-button @click="addNewCodePoints">添加</el-button> |
| | | <el-button @click="saveCodePoins">保存</el-button> |
| | | <el-button v-show="codePointesTableStatus" @click="saveCodePoins">保存</el-button> |
| | | <el-button @click="closeCodePoins">取消</el-button> |
| | | </div> |
| | | |
| | |
| | | <el-table-column type="index" label="序号" min-width="90" /> |
| | | <el-table-column prop="equipmentPoint" label="码点编码" min-width="150"> |
| | | <template slot-scope="scope"> |
| | | <span v-show="!codePointesTableStatus">{{ scope.row.equipmentPoint }}</span> |
| | | <el-input v-show="codePointesTableStatus" v-model="scope.row.equipmentPoint" /> |
| | | <el-input v-if="codePointesTableStatus && scope.row.isInput" v-model="scope.row.equipmentPoint" /> |
| | | <span v-else>{{ scope.row.equipmentPoint }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column prop="equipmentPointName" label="码点名称" min-width="150"> |
| | | <template slot-scope="scope"> |
| | | <span v-show="!codePointesTableStatus">{{ scope.row.equipmentPointName }}</span> |
| | | <el-input v-show="codePointesTableStatus" v-model="scope.row.equipmentPointName" /> |
| | | <el-input v-if="codePointesTableStatus && scope.row.isInput" v-model="scope.row.equipmentPointName" /> |
| | | <span v-else>{{ scope.row.equipmentPointName }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="unit" label="单位" min-width="150"> |
| | | <template slot-scope="scope"> |
| | | <span v-show="!codePointesTableStatus">{{ scope.row.unit }}</span> |
| | | <el-input v-show="codePointesTableStatus" v-model="scope.row.unit" /> |
| | | <el-input v-if="codePointesTableStatus && scope.row.isInput" v-model="scope.row.unit" /> |
| | | <span v-else>{{ scope.row.unit }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column prop="name" label="更新人" min-width="100" /> |
| | | <el-table-column prop="updateTime" label="更新日期" min-width="120" /> --> |
| | | <el-table-column prop="descriptiveness" label="描述" min-width="200"> |
| | | <template slot-scope="scope"> |
| | | <span v-show="!codePointesTableStatus">{{ scope.row.descriptiveness }}</span> |
| | | <el-input v-show="codePointesTableStatus" v-model="scope.row.descriptiveness" /> |
| | | <el-input v-if="codePointesTableStatus && scope.row.isInput" v-model="scope.row.descriptiveness" /> |
| | | <span v-else>{{ scope.row.descriptiveness }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | |
| | | <el-col :span="11"> |
| | | <el-form-item label="状态:" prop="conditions" |
| | | :rules="[{ required: true, message: '请选择仪器设备状态', trigger: 'blur' }]" label-width="80"> |
| | | <el-select v-model="equipmentform.conditions" clearable filterable :allow-create="true" |
| | | <el-select v-model="equipmentform.conditions" clearable :allow-create="true" |
| | | placeholder="请选择仪器设备状态" style="width:100%"> |
| | | <el-option v-for="item in conditionsOptions" :key="item.value" :label="item.label" |
| | | :value="item.value" /> |
| | |
| | | </el-col> |
| | | <el-col :span="11"> |
| | | <el-form-item label="保管人:" label-width="80"> |
| | | <el-select v-model="equipmentform.userId" clearable filterable :allow-create="true" placeholder="请选择保管人" |
| | | <el-select v-model="equipmentform.userId" clearable :allow-create="true" placeholder="请选择保管人" |
| | | style="width:100%"> |
| | | <el-option v-for="item in userOpetions" :key="item.id" :label="item.label" :value="item.value" /> |
| | | </el-select> |
| | |
| | | // 码点表格 |
| | | codePointsTable: [ |
| | | { |
| | | 'isInput':false, |
| | | 'unit': '', |
| | | 'descriptiveness': '', |
| | | 'equipmentPoint': '', |
| | |
| | | }, |
| | | measureFormVisible(newVal){ |
| | | if(newVal === false){ |
| | | this.resetForm("addmeasureForm"); |
| | | this.cancelAddMeasure(); |
| | | } |
| | | } |
| | | }, |
| | |
| | | // 获取分类数据 |
| | | async getThreeData() { |
| | | const { data } = await getClassifyList() |
| | | // console.log(data) |
| | | this.classTree = data.map(item => { |
| | | if (item.children) { |
| | | item.children = item.children.map(childrenItem => { |
| | |
| | | }, |
| | | // 显示仪器详情 |
| | | async openDetail(row) { |
| | | // console.log(row) |
| | | this.detailDrawer = true |
| | | const { data } = await getInstrumentDetail({ InstrumentId: row.id }) |
| | | this.equipmentDetail = data |
| | | this.equipmentform = data |
| | | console.log(this.equipmentform) |
| | | const { data: pointList } = await getEquipmentPointList({ InstrumentId: this.equipmentDetail.id }) |
| | | this.codePointsTable = pointList |
| | | const { data: informationList } = await getMetricalInformationList({ InstrumentId: this.equipmentDetail.id }) |
| | | this.measureTable = informationList |
| | | console.log(informationList) |
| | | }, |
| | | // 节点点击处理 |
| | | nodeClickHandler(data, node, element) { |
| | | this.nodeclicked = data |
| | | console.log(data) |
| | | // 只有数据中携带id才能发送查询请求 |
| | | if (data.id) { |
| | | this.getEquipmentTable({ classifyId: data.id, pageSize: this.pageSize, pageNo: this.currentPage, whetherWhether: this.isOut }) |
| | |
| | | }, |
| | | // 获取仪器列表数据 |
| | | async getEquipmentTable(ages) { |
| | | // console.log('条件对象', ages) |
| | | const { data } = await getInstrumentList(ages) |
| | | this.equipmentTable = data.row |
| | | this.total = data.total |
| | |
| | | handleCurrentChange() { |
| | | // 当前页更改 |
| | | }, |
| | | // 显示设备码点 |
| | | addCodePoints() { |
| | | // 添加新码点,清空原数组 |
| | | this.codePointesTableStatus = true |
| | | this.codePointsTable = undefined |
| | | }, |
| | | // 新增设备码点 |
| | | addNewCodePoints() { |
| | | // |
| | | if (!this.codePointsTable) { |
| | | this.codePointsTable = [] |
| | | } |
| | | this.codePointesTableStatus = true; |
| | | const newObj = {} |
| | | newObj.isInput = true, |
| | | newObj.name = '' // 当前用户的名称 |
| | | newObj.updateTime = '' // 获取当前时间 |
| | | newObj.equipmentPoint = '' |
| | |
| | | newObj.descriptiveness = '' |
| | | newObj.unit = '' |
| | | newObj.instrumentId = this.equipmentDetail.id |
| | | this.codePointsTable.push(newObj) |
| | | this.codePointsTable.unshift(newObj) |
| | | }, |
| | | // 保存提交新增设备码点 |
| | | async saveCodePoins() { |
| | | console.log(this.codePointsTable) |
| | | if (!this.codePointsTable) { |
| | | this.codePointsTable = [] |
| | | if (this.codePointsTable.length === 0) { |
| | | return this.$message.error('请点击添加按钮添加数据') |
| | | } |
| | | if (this.codePointsTable.length === 0) return this.$message.error('请点击添加按钮添加数据') |
| | | try { |
| | | for (const item of this.codePointsTable) { |
| | | const { code, data, message } = await addEquipmentPoint(item) |
| | | console.log(data) |
| | | if (code !== 200) throw new Error(message) |
| | | this.$message.success('添加成功') |
| | | } |
| | | } catch (error) { |
| | | let data = this.codePointsTable.filter(item => { |
| | | return item.instrumentId != null; |
| | | }) |
| | | await addEquipmentPoint(data).then(()=>{ |
| | | this.$message.success('添加成功') |
| | | }).catch(error=>{ |
| | | this.$message.error(error.message) |
| | | } |
| | | }) |
| | | await this.closeCodePoins() |
| | | }, |
| | | // 取消新增设备码点 |
| | |
| | | }, |
| | | // 点击新增仪器设备或当存在仪器详情时是修改仪器设备信息 |
| | | async addNewEquipment() { |
| | | let v = this.submitForm('addNewEquipment') |
| | | if (!v) { |
| | | return |
| | | } |
| | | if (Array.isArray(this.equipmentform.classifyId)) { |
| | | this.equipmentform.classifyId = this.equipmentform.classifyId.pop() |
| | | } |
| | | if (!this.equipmentDetail.id) { |
| | | // 格式化日期 |
| | | this.equipmentform.arrivalDate = parseTime(this.equipmentform.arrivalDate, '{y}-{m}-{d}') |
| | | this.equipmentform.acceptanceDate = parseTime(this.equipmentform.acceptanceDate, '{y}-{m}-{d}') |
| | | // this.equipmentform.termValidity = parseTime(this.equipmentform?.termValidity, '{y}-{m}-{d}') |
| | | try { |
| | | const res = await addInstrument(this.equipmentform) |
| | | console.log(res) |
| | | } catch (error) { |
| | | this.$message.error('添加失败') |
| | | this.$refs["addNewEquipment"].validate(async(valid)=>{ |
| | | if(valid){ |
| | | if (Array.isArray(this.equipmentform.classifyId)) { |
| | | this.equipmentform.classifyId = this.equipmentform.classifyId.pop() |
| | | } |
| | | if (!this.equipmentDetail.id) { |
| | | // 格式化日期 |
| | | this.equipmentform.arrivalDate = parseTime(this.equipmentform.arrivalDate, '{y}-{m}-{d}') |
| | | this.equipmentform.acceptanceDate = parseTime(this.equipmentform.acceptanceDate, '{y}-{m}-{d}') |
| | | // this.equipmentform.termValidity = parseTime(this.equipmentform?.termValidity, '{y}-{m}-{d}') |
| | | await addInstrument(this.equipmentform).then(()=>{ |
| | | this.$message.success('添加成功') |
| | | }).catch(error=>{ |
| | | this.$message.error(error.message); |
| | | }) |
| | | let d = this.nodeclicked; |
| | | this.nodeClickHandler(d); |
| | | this.addDrawerVisible = false |
| | | this.equipmentform = {} |
| | | return |
| | | } |
| | | console.log('修改仪器参数', this.equipmentform) |
| | | await changeInstrument(this.equipmentform).then(()=>{ |
| | | this.$message.success('修改成功') |
| | | let d = this.nodeclicked; |
| | | this.nodeClickHandler(d); |
| | | this.addDrawerVisible = false |
| | | this.detailDrawer = false |
| | | }).catch(error=>{ |
| | | this.$message.error(error.message); |
| | | }) |
| | | } |
| | | this.$message.success('添加成功') |
| | | let d = this.nodeclicked; |
| | | this.nodeClickHandler(d); |
| | | this.addDrawerVisible = false |
| | | this.equipmentform = {} |
| | | return |
| | | } |
| | | console.log('修改仪器参数', this.equipmentform) |
| | | try { |
| | | const res = await changeInstrument(this.equipmentform) |
| | | this.$message.success('修改成功') |
| | | let d = this.nodeclicked; |
| | | this.nodeClickHandler(d); |
| | | this.addDrawerVisible = false |
| | | this.detailDrawer = false |
| | | } catch (error) { |
| | | this.$message.error('添加失败') |
| | | } |
| | | }); |
| | | }, |
| | | cancelAddEq() { |
| | | this.resetForm('addDrawer') |
| | |
| | | this.$refs[formName].resetFields(); |
| | | }, |
| | | cancelAddMeasure() { |
| | | this.$refs['upload'].clearFiles(); |
| | | this.measureForm.file = null; |
| | | this.measureFormVisible = false |
| | | this.resetForm('addmeasureForm'); |
| | | this.$refs['upload'].clearFiles(); |
| | | }, |
| | | // 添加计量信息 |
| | | async addMeasure() { |
| | |
| | | this.measureForm.beginDate = parseTime(this.measureForm.date[0], '{y}-{m}-{d}') |
| | | this.measureForm.endDate = parseTime(this.measureForm.date[1], '{y}-{m}-{d}') |
| | | } |
| | | console.log(this.measureForm) |
| | | const formData = new FormData() |
| | | if(this.measureForm.file == null || this.measureForm.file == ""){ |
| | | this.$message.warning("请选择要上传的文件!"); |
| | |
| | | }else{ |
| | | formData.append('file', this.measureForm.file?.raw, this.measureForm.file?.name) |
| | | } |
| | | console.log(this.measureForm) |
| | | for (const key in this.measureForm) { |
| | | console.log(key) |
| | | // if (key === 'file') return |
| | | formData.append(key, this.measureForm[key]) |
| | | } |
| | | console.log(formData) |
| | | try { |
| | | const { data } = await addMetricalInformation(formData) |
| | | console.log(data) |
| | | await addMetricalInformation(formData) |
| | | this.$message.success('添加成功') |
| | | const { data: informationList } = await getMetricalInformationList({ InstrumentId: this.equipmentDetail.id }) |
| | | this.measureTable = informationList |
| | |
| | | } |
| | | this.measureForm.file = null; |
| | | this.$refs['upload'].clearFiles(); |
| | | }else{ |
| | | console.log(32); |
| | | } |
| | | }); |
| | | }, |
| | |
| | | this.codePointsTable = [] |
| | | this.measureTable = [] |
| | | this.measureForm.file = null; |
| | | this.$refs['upload'].clearFiles(); |
| | | }, |
| | | // 关闭添加修改设备抽屉 |
| | | closeAddOrChangeDrawer() { |
| | |
| | | }, |
| | | // 文件上传 |
| | | handleUpload(file, fileList) { |
| | | console.log(file, fileList) |
| | | this.measureForm.file = file |
| | | }, |
| | | // 根据输入的设备编号,设备名称或者型号规格关键字进行过滤列表 |
| | |
| | | }, |
| | | resetBtn() { |
| | | this.searchData.keyword = '' |
| | | this.radioValue = 0; |
| | | this.isOut = false; |
| | | this.equipmentTable = this.oldtableData |
| | | }, |
| | | getConditionTable() { |
| | | // console.log(this.radioValue) |
| | | let filteredTable = this.oldtableData.filter(item => { |
| | | return item.conditions === this.radioValue |
| | | }) |
| | |
| | | let expireItem |
| | | for (expireItem of this.expireData) { |
| | | this.equipmentTable = this.oldtableData.filter(item => { |
| | | console.log(this.radioValue) |
| | | console.log('item', item) |
| | | console.log('expireItem', expireItem) |
| | | return item.conditions === this.radioValue && item.equipment_code === expireItem.equipment_code |
| | | }) |
| | | console.log(this.equipmentTable) |
| | | } |
| | | } else { |
| | | this.equipmentTable = this.expireData |
| | |
| | | display: flex; |
| | | justify-content: space-between; |
| | | padding: 15px 24px 12px 24px; |
| | | |
| | | .serve-btn{ |
| | | position: relative; |
| | | left: 92%; |
| | | } |
| | | .search-bar { |
| | | .el-radio-button.is-active { |
| | | color: #409EFF !important; |