From d2e867966539004b6b5a73ae3566a659ac6f8b6d Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 30 十月 2025 11:55:34 +0800
Subject: [PATCH] 检验任务数据分类查询问题修复
---
src/views/CNAS/resourceDemand/device/component/borrow.vue | 354 ++++++++++++++++++++++++++---------------------------------
1 files changed, 156 insertions(+), 198 deletions(-)
diff --git a/src/views/CNAS/resourceDemand/device/component/borrow.vue b/src/views/CNAS/resourceDemand/device/component/borrow.vue
index fba75bc..4898f5f 100644
--- a/src/views/CNAS/resourceDemand/device/component/borrow.vue
+++ b/src/views/CNAS/resourceDemand/device/component/borrow.vue
@@ -2,23 +2,24 @@
<template>
<div>
<div class="search">
- <div class="search_thing">
- <div class="search_label">娴佺▼缂栧彿锛�</div>
- <div><el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="componentData.entity.processNumber"
- @keyup.enter.native="refreshTable()"></el-input></div>
- </div>
- <div class="search_thing" style="padding-left: 30px;">
- <el-button size="small" @click="refresh()">閲� 缃�</el-button>
- <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button>
- </div>
- <div class="btns">
+ <el-form :model="queryParams" ref="queryParams" size="small" :inline="true">
+ <el-form-item label="娴佺▼缂栧彿">
+ <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="queryParams.processNumber"
+ @keyup.enter.native="refreshTable()"></el-input>
+ </el-form-item>
+ <el-form-item>
+ <el-button size="mini" type="primary" @click="refreshTable()">鏌ヨ</el-button>
+ <el-button size="mini" @click="refresh()">閲嶇疆</el-button>
+ </el-form-item>
+ </el-form>
+ <div>
<el-button size="small" type="primary" @click="add">鏂板</el-button>
<!-- <el-button size="small" type="primary" @click="handleDown" :loading="outLoading">瀵煎嚭</el-button>-->
</div>
</div>
- <div class="tables" style="margin-top: 10px;">
- <ValueTable ref="ValueTable" :url="$api.deviceBorrow.deviceBorrowPage"
- :delUrl="$api.deviceBorrow.deleteDeviceBorrow" :componentData="componentData" :key="upIndex" />
+ <div class="tables">
+ <lims-table :tableData="tableData" :column="column" :tableLoading="tableLoading" :height="'calc(100vh - 290px)'"
+ :page="page" @pagination="pagination"></lims-table>
</div>
<el-dialog title="浠櫒璁惧棰�(鍊�)鐢ㄧ櫥璁�" top="5vh" :visible.sync="dialogVisible" width="60%">
<el-steps :active="currentStep" finish-status="success" align-center>
@@ -116,7 +117,6 @@
<el-col :span="12">
<el-form-item label="褰掕繕浜猴細" prop="rebackUser"
:rules="[{ required: currentStep === 1, message: '璇疯緭鍏ュ綊杩樹汉', trigger: 'change' }]">
- <!-- <el-input v-model="form.rebackUser" size="small" :disabled="currentStep !== 1"></el-input> -->
<el-select v-model="form.rebackUser" filterable placeholder="璇烽�夋嫨" clearable size="small"
style="width: 50%;" :disabled="currentStep !== 1">
<el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.name">
@@ -145,7 +145,6 @@
<el-col :span="12">
<el-form-item label="璁惧璐熻矗浜猴細" prop="deviceUser"
:rules="[{ required: currentStep === 1, message: '璇烽�夋嫨璁惧璐熻矗浜�', trigger: 'change' }]">
- <!-- <el-input v-model="form.deviceUser" size="small" :disabled="currentStep !== 1"></el-input> -->
<el-select v-model="form.deviceUser" filterable placeholder="璇烽�夋嫨" clearable size="small"
style="width: 50%;" :disabled="currentStep !== 1">
<el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.name">
@@ -158,7 +157,6 @@
<el-input type="textarea" v-model="form.note" :disabled="currentStep !== 1" size="small"></el-input>
</el-form-item>
</el-col>
-
</el-row>
</el-card>
<el-row style="margin-top: 1em;">
@@ -180,7 +178,7 @@
</span>
</el-dialog>
<el-dialog title="娴佺▼璺熻釜" top="5vh" :visible.sync="dialogVisible0" width="60%">
- <el-table :data="deviceLogs" style="width: 100%">
+ <el-table :data="deviceLogs" style="width: 100%" :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border>
<el-table-column type="index" width="50">
</el-table-column>
<el-table-column prop="operator" label="鎿嶄綔浜�" width="180">
@@ -197,13 +195,18 @@
</template>
<script>
-import ValueTable from '@/components/Table/value-table.vue'
+import limsTable from "@/components/Table/lims-table.vue";
import { dateFormat } from '@/utils/date'
import {
saveDeviceBorrow,
deleteCNASFile,
+ getDeviceBorrow,
+ deviceBorrowExport,
+ deleteDeviceBorrow,
+ deviceBorrowPage,
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/business/inspectionTask";
+import { mapGetters } from "vuex";
export default {
props: {
clickNodeVal: {
@@ -214,72 +217,12 @@
}
},
components: {
- ValueTable
+ limsTable
},
data() {
return {
dialogVisible: false,
dialogVisible0: false,
- //琛ㄥご鏄剧ず
- componentData: {
- entity: {
- processNumber: null,
- deviceId: null,
- orderBy: {
- field: 'id',
- order: 'asc'
- }
- },
- isIndex: true,
- showSelect: false,
- select: false,
- do: [
- {
- id: 'show',
- font: '鏌ョ湅',
- type: 'text',
- method: 'lookDetail'
- },
- {
- id: 'delete',
- font: '鍒犻櫎',
- type: 'text',
- method: 'doDiy'
- },
- {
- id: '111',
- font: '娴佺▼璺熻釜',
- type: 'text',
- method: 'handleLookList'
- }],
- init: false,
- tagField: {
- recipientState: {
- select: [{
- value: 0,
- type: 'success',
- label: '鍚堟牸'
- }, {
- value: 1,
- type: 'warning',
- label: '缁翠慨'
- }, {
- value: 2,
- type: 'info',
- label: '鍋滅敤'
- }, {
- value: 3,
- type: 'danger',
- label: '鎶ュ簾'
- }]
- }
- },
- selectField: {},
- requiredAdd: [],
- requiredUp: [],
- },
- upIndex: 0,
- entityCopy: null,
currentStep: 0, // 姝ラ鏉℃樉绀虹鍑犳
currentStepClick: 0, // 鐐瑰嚮姝ラ鏉″彉鍖�
steps: ['鍊熷嚭', '鍊熺敤'],
@@ -307,15 +250,94 @@
nextUser: [{ required: true, message: '璇烽�夋嫨涓嬬幆鑺傝礋璐d汉', trigger: 'change' }],
},
deviceLogs: [],
- outLoading: false
+ outLoading: false,
+ recipientStateList: [{
+ value: 0,
+ type: 'success',
+ label: '鍚堟牸'
+ }, {
+ value: 1,
+ type: 'warning',
+ label: '缁翠慨'
+ }, {
+ value: 2,
+ type: 'info',
+ label: '鍋滅敤'
+ }, {
+ value: 3,
+ type: 'danger',
+ label: '鎶ュ簾'
+ }],
+ queryParams: {},
+ tableData: [],
+ column: [
+ { label: "娴佺▼缂栧彿", prop: "processNumber" },
+ { label: "璁惧鍚嶇О", prop: "deviceName" },
+ {
+ label: "绠$悊缂栧彿",
+ prop: "unifyNumber"
+ },
+ { label: "鍊熺敤浜�", prop: "recipientUser" },
+ { label: "鍊熺敤浜鸿仈绯绘柟寮�", prop: "borrowerContactInformation", width: '140px' },
+ { label: "鍊熺敤鏃ユ湡", prop: "recipientTime" },
+ {
+ label: "鍊熺敤鏃剁姸鎬�", prop: "recipientState", dataType: "tag",
+ formatData: (params) => {
+ return this.recipientStateList.find((m) => m.value == params).label;
+ },
+ formatType: (params) => {
+ return this.recipientStateList.find((m) => m.value == params).type;
+ },
+ },
+ { label: "鍊熷嚭浜�", prop: "submitUser" },
+ { label: "鍊熷嚭鏃ユ湡", prop: "createTime" },
+ {
+ label: "褰撳墠鐘舵��", prop: "nowState"
+ },
+ { label: "褰撳墠璐d换浜�", prop: "nowUser" },
+ { label: "闄勪欢", prop: "fileName" },
+ {
+ dataType: "action",
+ fixed: "right",
+ label: "鎿嶄綔",
+ operation: [
+ {
+ name: "鏌ョ湅",
+ type: "text",
+ clickFun: (row) => {
+ this.lookDetail(row);
+ },
+ },
+ {
+ name: "鍒犻櫎",
+ type: "text",
+ clickFun: (row) => {
+ this.handleDelete(row);
+ },
+ },
+ {
+ name: "娴佺▼璺熻釜",
+ type: "text",
+ clickFun: (row) => {
+ this.handleLookList(row);
+ },
+ },
+ ],
+ },
+ ],
+ page: {
+ total: 0,
+ size: 10,
+ current: 0,
+ },
+ tableLoading: false,
}
},
watch: {
// 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊
clickNodeVal(newVal) {
if (newVal.value) {
- this.componentData.entity.deviceId = this.clickNodeVal.value
- this.entityCopy = this.HaveJson(this.componentData.entity)
+ thisqueryParams.deviceId = this.clickNodeVal.value
this.refreshTable()
}
},
@@ -329,25 +351,46 @@
}
},
computed: {
+ ...mapGetters(["nickName"]),
action() {
return this.javaApi + '/personBasicInfo/saveCNASFile'
}
},
mounted() {
- this.componentData.entity.deviceId = this.clickNodeVal.value
- this.entityCopy = this.HaveJson(this.componentData.entity)
- // console.log(333,this.clickNodeVal)
+ this.queryParams.deviceId = this.clickNodeVal.value
this.getUserList()
this.refreshTable()
},
methods: {
- refreshTable(e) {
- this.$refs['ValueTable'].selectList(e)
+ getList() {
+ this.tableLoading = true;
+ let param = { ...this.queryParams, ...this.page };
+ delete param.total;
+ deviceBorrowPage({ ...param })
+ .then((res) => {
+ this.tableLoading = false;
+ if (res.code === 200) {
+ this.tableData = res.data.records;
+ this.page.total = res.data.total;
+ }
+ })
+ .catch((err) => {
+ this.tableLoading = false;
+ });
+ },
+ pagination({ page, limit }) {
+ this.page.current = page;
+ this.page.size = limit;
+ this.getList();
},
refresh() {
- this.componentData.entity = this.HaveJson(this.entityCopy)
- this.refreshTable()
- // this.upIndex++
+ this.queryParams = {};
+ this.page.current = 1;
+ this.getList();
+ },
+ refreshTable() {
+ this.page.current = 1;
+ this.getList();
},
choiceStep(index) {
this.currentStepClick = index
@@ -362,11 +405,11 @@
// 鑾峰彇褰撳墠鐜妭鎿嶄綔浜轰笌鏃ユ湡
switch (this.currentStep) {
case 0:
- this.form.submitOperationUser = user.name
+ this.form.submitOperationUser = this.nickName
this.form.submitOperationTime = dateTime
break
case 1:
- this.form.receiveOperationUser = user.name
+ this.form.receiveOperationUser = this.nickName
this.form.receiveOperationTime = dateTime
break
default:
@@ -452,7 +495,7 @@
},
// 鏌ョ湅璇︽儏
lookDetail(row) {
- this.$axios.get(this.$api.deviceBorrow.getDeviceBorrow + '?id=' + row.id).then(res => {
+ getDeviceBorrow({ id: row.id }).then(res => {
if (res.code == 200) {
this.form = res.data
this.form.deviceName = this.clickNodeVal.label
@@ -493,131 +536,46 @@
//瀵煎嚭
handleDown() {
this.outLoading = true
- this.$axios.post(this.$api.deviceBorrow.deviceBorrowExport, { deviceId: this.clickNodeVal.value }, { responseType: 'blob' }).then(res => {
+ deviceBorrowExport({ deviceId: this.clickNodeVal.value }).then(res => {
this.outLoading = false
const blob = new Blob([res], {
type: 'application/force-download'
})
const filename = decodeURI(this.clickNodeVal.label + '璁惧鍊熷嚭缁熻' + '.xlsx')
- //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆
- let reader = new FileReader();
- reader.readAsText(blob, 'utf-8');
- reader.onload = () => {
- try {
- let result = JSON.parse(reader.result);
- if (result.message) {
- this.$message.error(result.message);
- } else {
- // 鍒涘缓涓�涓秴閾炬帴锛屽皢鏂囦欢娴佽祴杩涘幓锛岀劧鍚庡疄鐜拌繖涓秴閾炬帴鐨勫崟鍑讳簨浠�
- const elink = document.createElement('a')
- elink.download = filename
- elink.style.display = 'none'
- elink.href = URL.createObjectURL(blob)
- document.body.appendChild(elink)
- elink.click();
- URL.revokeObjectURL(elink.href) // 閲婃斁URL 瀵硅薄
- document.body.removeChild(elink)
- this.$message.success('瀵煎嚭鎴愬姛')
- }
- } catch (err) {
- console.log(err);
- // 鍒涘缓涓�涓秴閾炬帴锛屽皢鏂囦欢娴佽祴杩涘幓锛岀劧鍚庡疄鐜拌繖涓秴閾炬帴鐨勫崟鍑讳簨浠�
- const elink = document.createElement('a')
- elink.download = filename
- elink.style.display = 'none'
- elink.href = URL.createObjectURL(blob)
- document.body.appendChild(elink)
- elink.click();
- URL.revokeObjectURL(elink.href) // 閲婃斁URL 瀵硅薄
- document.body.removeChild(elink)
- this.$message.success('瀵煎嚭鎴愬姛')
- }
- }
+ this.$download.saveAs(blob, filename)
})
},
handleLookList(row) {
- this.$axios.get(this.$api.deviceBorrow.getDeviceBorrow + '?id=' + row.id).then(res => {
+ getDeviceBorrow({ id: row.id }).then(res => {
if (res.code == 200) {
this.deviceLogs = res.data.deviceLogs
this.dialogVisible0 = true
}
})
- }
+ },
+ handleDelete(row) {
+ this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ deleteDeviceBorrow({ id: row.id }).then((res) => {
+ this.$message.success("鍒犻櫎鎴愬姛");
+ this.refresh();
+ });
+ })
+ .catch(() => { });
+ },
},
}
</script>
<style scoped>
-h4 {
- font-weight: 400;
- font-size: 16px;
+.search {
+ height: 46px;
display: flex;
justify-content: space-between;
- margin: 10px 0;
-}
-
-h4 .line {
- display: inline-block;
- width: 3px;
- height: 16px;
- background: #3A7BFA;
- margin-right: 4px;
-}
-
-.tables {
- width: 100%;
- height: calc(100vh - 15em);
-}
-
-.search {
- background-color: #fff;
- display: flex;
- align-items: center;
- position: relative;
margin-top: 10px;
-}
-
-.search_thing {
- display: flex;
- align-items: center;
- height: 40px;
-}
-
-.search_label {
- width: 70px;
- font-size: 14px;
- text-align: right;
-}
-
-.search_input {
- width: calc(100% - 120px);
-}
-
-.btns {
- position: absolute;
- right: 0px;
- top: 50%;
- transform: translate(0, -50%);
-}
-
-.btns_thing {
- position: absolute;
- right: 230px;
- top: 50%;
- transform: translate(0, -50%);
-}
-
-.form .search_label {
- width: 120px;
-}
-
-.el-radio {
- margin-right: 10px;
-}
-
-.el-radio-group {
- width: 100%;
- display: flex;
- margin-top: 12px;
}
</style>
--
Gitblit v1.9.3