From 6cd44812a96026d6c6d0fff397eb2662c75fedd3 Mon Sep 17 00:00:00 2001
From: Goldennfish <1981343953@qq.com>
Date: 星期五, 28 七月 2023 17:00:04 +0800
Subject: [PATCH] 实验室管理设备台账完善
---
src/views/laboratory/ledger/index.vue | 142 +++++++++++++++++++++++++++++++++++++++++++----
src/api/laboratory/ledger.js | 8 ++
2 files changed, 138 insertions(+), 12 deletions(-)
diff --git a/src/api/laboratory/ledger.js b/src/api/laboratory/ledger.js
index c0d74db..8bd6df7 100644
--- a/src/api/laboratory/ledger.js
+++ b/src/api/laboratory/ledger.js
@@ -80,6 +80,14 @@
})
}
+export function deleteInstrument(params) {
+ return request({
+ url: '/instrument/delete',
+ method: 'delete',
+ params
+ })
+}
+
// 鏍规嵁璁惧id鏌ユ壘瀵瑰簲鐮佺偣
export function getEquipmentPointList(params) {
return request({
diff --git a/src/views/laboratory/ledger/index.vue b/src/views/laboratory/ledger/index.vue
index d8e1d65..f092459 100644
--- a/src/views/laboratory/ledger/index.vue
+++ b/src/views/laboratory/ledger/index.vue
@@ -12,8 +12,8 @@
</el-input>
</el-form-item>
<el-form-item>
- <el-button type="primary">鏌ヨ</el-button>
- <el-button type="primary" plain>閲嶇疆</el-button>
+ <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-form-item>
</el-form>
@@ -28,6 +28,7 @@
<el-row>
<el-col :span="19">
<el-input
+ v-model="filterText"
placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�"
/>
</el-col>
@@ -40,7 +41,7 @@
ref="classTree"
:data="classTree"
:props="defaultProps"
- default-expand-all
+ :default-expand-all="true"
:filter-node-method="filterNode"
@node-click="nodeClickHandler"
/>
@@ -48,13 +49,13 @@
<div class="library-table">
<div class="table-header">
<div class="search-bar">
- <el-radio-group v-model="radioValue">
- <el-radio-button label="0">鍏ㄩ儴</el-radio-button>
+ <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>
</el-radio-group>
- <el-checkbox v-model="isOut" :style="{'marginLeft':'12px'}">宸茶繃鏈�</el-checkbox>
+ <el-checkbox v-model="isOut" @change="getExpireTable" :style="{'marginLeft':'12px'}">宸茶繃鏈�</el-checkbox>
</div>
<div class="serve-btn">
<!-- <el-button type="primary" icon="el-icon-plus">鏂板浜哄憳</el-button> -->
@@ -124,7 +125,7 @@
>
<template slot-scope="scope">
<el-button type="text" size="small" @click="openDetail(scope.row)">缂栬緫</el-button>
- <el-button type="text" size="small">鍒犻櫎</el-button>
+ <el-button type="text" size="small" @click="clickDelete(scope.row)">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
@@ -650,6 +651,18 @@
<el-button @click="measureFormVisible = false">鍙� 娑�</el-button>
</span>
</el-dialog>
+ <!-- 鍒犻櫎浠櫒寮瑰嚭妗� -->
+ <el-dialog
+ title="鎻愮ず"
+ :visible.sync="deletedialogVisible"
+ width="30%"
+ :before-close="handleClose">
+ <span>纭畾鍒犻櫎璇ヤ华鍣ㄥ悧锛�</span>
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="deletedialogVisible = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="deleteInstrument">纭� 瀹�</el-button>
+ </span>
+ </el-dialog>
</div>
</template>
@@ -657,7 +670,7 @@
import { getClassifyList, getInstrumentList,
addInstrumentUser, addInstrument, getInstrumentDetail,
getEquipmentPointList, addEquipmentPoint,
- getMetricalInformationList, changeInstrument, addMetricalInformation } from '@/api/laboratory/ledger'
+ getMetricalInformationList, changeInstrument, addMetricalInformation, deleteInstrument } from '@/api/laboratory/ledger'
import { parseTime } from '@/utils/index'
export default {
filters: {
@@ -689,6 +702,10 @@
userOpetions: [],
// 浠櫒鐘舵�侀厤缃」
conditionsOptions: [
+ {
+ label: '鍏ㄩ儴',
+ value: 0
+ },
{
label: '杩愯',
value: 1
@@ -748,6 +765,8 @@
addClassVisible: false,
// 鎺у埗鏂板璁¢噺妯℃�佹鏄剧ず
measureFormVisible: false,
+ // 鎺у埗鍒犻櫎浠櫒妯℃�佹鏄剧ず
+ deletedialogVisible: false,
// 鎺у埗娣诲姞淇敼浠櫒鎶藉眽鐨勬樉绀�
addDrawerVisible: false,
// 娣诲姞淇敼浠櫒鍙傛暟瀵硅薄
@@ -796,7 +815,17 @@
// 鐮佺偣琛ㄦ牸鐨勭姸鎬侊細鏁版嵁灞曠ずfalse/鏂板杈撳叆true
codePointesTableStatus: false,
// 璁惧璇︽儏瀵硅薄
- equipmentDetail: {}
+ equipmentDetail: {},
+ // 杩囨护鍏抽敭瀛�
+ filterText: '',
+ // 杩囨护鍚庣殑浠櫒璁惧琛�
+ filterdequipmentTable: '',
+ oldtableData: '',
+ // 杩囨护涓嶅悓鐘舵�佽澶�
+ conditionTable: '',
+ nodeclicked: '',
+ expireData: '',
+ instrumentId: ''
}
},
watch: {
@@ -844,19 +873,21 @@
},
// 鑺傜偣鐐瑰嚮澶勭悊
nodeClickHandler(data, node, element) {
- console.log(data)
+ this.nodeclicked = data
+ // console.log(data)
// 鍙湁鏁版嵁涓惡甯d鎵嶈兘鍙戦�佹煡璇㈣姹�
if (data.id) {
- this.getEquipmentTable({ classifyId: data.id, pageSize: this.pageSize, pageNo: this.currentPage })
+ 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)
- // console.log(data)
+ console.log(data)
this.equipmentTable = data.row
this.total = data.total
+ this.oldtableData = this.equipmentTable
},
// 杩囨护鑺傜偣
filterNode(value, data) {
@@ -997,6 +1028,93 @@
handleUpload(file, fileList) {
// console.log(file, fileList)
this.measureForm.file = file
+ },
+ // 鏍规嵁杈撳叆鐨勮澶囩紪鍙凤紝璁惧鍚嶇О鎴栬�呭瀷鍙疯鏍煎叧閿瓧杩涜杩囨护鍒楄〃
+ filterTableData() {
+ this.oldtableData = this.equipmentTable
+ const filterdequipmentTable = this.equipmentTable.filter(item => {
+ return item.equipment_code.includes(this.searchData.keyword) || item.equipment_name.includes(this.searchData.keyword) || item.specifications_models.includes(this.searchData.keyword)
+ })
+ this.equipmentTable = filterdequipmentTable
+ },
+ resetBtn() {
+ this.searchData.keyword = ''
+ this.equipmentTable = this.oldtableData
+ },
+ getConditionTable() {
+ // console.log(this.radioValue)
+ let filteredTable = this.oldtableData.filter(item => {
+ return item.conditions === this.radioValue
+ })
+ // 鍏堝垽鏂璱sOut
+ if (this.isOut) {
+ // 濡傛灉鐜板湪鍕鹃�変簡宸茶繃鏈熸寜閽紝閭e氨浠庡綋鍓嶈繃婊ゅソ鐨勫垪琛ㄤ腑绛涢�夊嚭杩囨湡鍒楄〃
+ if (this.expireData.length === 0) {
+ this.equipmentTable = null
+ } else {
+ let expireItem
+ for (expireItem of this.expireData) {
+ filteredTable = filteredTable.filter(item => {
+ return item.equipment_code === expireItem.equipment_code
+ })
+ }
+ this.equipmentTable = filteredTable
+ }
+ if (!this.radioValue) {
+ this.equipmentTable = this.expireData
+ }
+ } else {
+ this.equipmentTable = filteredTable
+ if (!this.radioValue) {
+ this.equipmentTable = this.oldtableData
+ }
+ }
+ },
+ async getExpireTable() {
+ // const filteredTable = this.oldtableData.filter(item => {
+ // return item.conditions === this.radioValue
+ // })
+ if (this.isOut) {
+ // 鎹曡幏鐐瑰嚮浜嗗凡杩囨湡锛岃姹傝繃鏈熸暟鎹苟淇濆瓨
+ const { data } = await getInstrumentList({ classifyId: this.nodeclicked.id, pageSize: this.pageSize, pageNo: this.currentPage, whetherWhether: this.isOut })
+ this.expireData = data.row
+ if (this.expireData.length === 0) {
+ this.equipmentTable = null
+ } else {
+ if (this.radioValue !== 0) {
+ 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
+ }
+ }
+ } else {
+ // 鎹曡幏鍙栨秷浜嗗凡杩囨湡锛屽皢杩囨湡鏁版嵁娓呯┖锛岄噸鏂版洿鏂癳quipmentTable
+ this.expireData = ''
+ this.equipmentTable = this.oldtableData.filter(item => {
+ return item.conditions === this.radioValue
+ })
+ if (this.radioValue === 0) {
+ this.equipmentTable = this.oldtableData
+ }
+ }
+ },
+ clickDelete(row) {
+ this.instrumentId = row.id
+ this.deletedialogVisible = true
+ },
+ async deleteInstrument() {
+ // console.log(row.id)
+ await deleteInstrument({ instrumentId: this.instrumentId })
+ this.deletedialogVisible = false
}
}
}
--
Gitblit v1.9.3