From f076107b1adc84c80522b4320a41e7cf0a1c9c5f Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 06 三月 2025 10:05:28 +0800
Subject: [PATCH] 场所或设施+实验室资质搬迁
---
src/api/structural/laboratory.js | 26 +
src/assets/styles/variables.scss | 32
src/views/structural/premises/index.vue | 421 ++++++++++++++++++++++++
src/api/structural/laboratoryScope.js | 65 +++
src/views/structural/capabilityAndLaboratory/laboratory/index.vue | 455 ++++++++++++++++++++++++++
5 files changed, 983 insertions(+), 16 deletions(-)
diff --git a/src/api/structural/laboratory.js b/src/api/structural/laboratory.js
new file mode 100644
index 0000000..1474f69
--- /dev/null
+++ b/src/api/structural/laboratory.js
@@ -0,0 +1,26 @@
+import request from "@/utils/request";
+
+// 鏌ヨ璧勮川鏄庣粏鍒楄〃
+export function getCertificationDetail(query) {
+ return request({
+ url: "/certification/getCertificationDetail",
+ method: "get",
+ params: query,
+ });
+}
+// 娣诲姞璧勮川鏄庣粏鍒楄〃
+export function addCertificationDetail(query) {
+ return request({
+ url: "/certification/addCertificationDetail",
+ method: "post",
+ data: query,
+ });
+}
+// 鍒犻櫎璧勮川鏄庣粏鍒楄〃
+export function delCertificationDetail(query) {
+ return request({
+ url: "/certification/delCertificationDetail",
+ method: "delete",
+ params: query,
+ });
+}
diff --git a/src/api/structural/laboratoryScope.js b/src/api/structural/laboratoryScope.js
new file mode 100644
index 0000000..2177f82
--- /dev/null
+++ b/src/api/structural/laboratoryScope.js
@@ -0,0 +1,65 @@
+import request from "@/utils/request";
+
+// 鑾峰彇瀹為獙瀹ゅ悕绉�
+export function obtainItemParameterList() {
+ return request({
+ url: "/laboratoryScope/obtainItemParameterList",
+ method: "get",
+ });
+}
+// 鏌ヨ瀹為獙瀹ょ鐞嗗垪琛�
+export function selectItemParameter(query) {
+ return request({
+ url: "/laboratoryScope/selectItemParameter",
+ method: "get",
+ params: query,
+ });
+}
+// 娣诲姞瀹為獙瀹ゅ弬鏁�
+export function addParameter(query) {
+ return request({
+ url: "/laboratoryScope/addParameter",
+ method: "post",
+ data: query,
+ });
+}
+// 淇敼瀹為獙瀹ゅ弬鏁�
+export function upParameter(query) {
+ return request({
+ url: "/laboratoryScope/upParameter",
+ method: "post",
+ data: query,
+ });
+}
+// 鍒犻櫎瀹為獙瀹ゅ弬鏁�
+export function delParameter(query) {
+ return request({
+ url: "/laboratoryScope/delParameter",
+ method: "delete",
+ params: query,
+ });
+}
+// 鏌ヨ鍗扮珷鍒楄〃
+export function selectSeal(query) {
+ return request({
+ url: "/sealScope/selectSeal",
+ method: "get",
+ params: query,
+ });
+}
+// 鏌ヨ鍗扮珷鍒楄〃
+export function addSeal(query) {
+ return request({
+ url: "/sealScope/addSeal",
+ method: "post",
+ data: query,
+ });
+}
+// 鏌ヨ璧勮川鏄庣粏鍒楄〃
+export function getCertificationDetail(query) {
+ return request({
+ url: "/certification/getCertificationDetail",
+ method: "get",
+ params: query,
+ });
+}
diff --git a/src/assets/styles/variables.scss b/src/assets/styles/variables.scss
index d30e122..3850fd6 100644
--- a/src/assets/styles/variables.scss
+++ b/src/assets/styles/variables.scss
@@ -1,25 +1,25 @@
// base color
-$blue:#324157;
-$light-blue:#3A71A8;
-$red:#C03639;
-$pink: #E65D6E;
-$green: #30B08F;
-$tiffany: #4AB7BD;
-$yellow:#FEC171;
-$panGreen: #30B08F;
+$blue: #324157;
+$light-blue: #3a71a8;
+$red: #c03639;
+$pink: #e65d6e;
+$green: #30b08f;
+$tiffany: #4ab7bd;
+$yellow: #fec171;
+$panGreen: #30b08f;
// 榛樿鑿滃崟涓婚椋庢牸
-$base-menu-color:#bfcbd9;
-$base-menu-color-active:#ffffff;
-$base-menu-background:#1890FF;
+$base-menu-color: #bfcbd9;
+$base-menu-color-active: #ffffff;
+$base-menu-background: #3a7bfa;
$base-logo-title-color: #ffffff;
-$base-menu-light-color:#ffffff;
-$base-menu-light-background:#1890FF;
+$base-menu-light-color: #ffffff;
+$base-menu-light-background: #3a7bfa;
$base-logo-light-title-color: #606266;
-$base-sub-menu-background:#ffffff;
-$base-sub-menu-hover:#001528;
+$base-sub-menu-background: #ffffff;
+$base-sub-menu-hover: #001528;
// 鑷畾涔夋殫鑹茶彍鍗曢鏍�
/**
@@ -50,5 +50,5 @@
subMenuHover: $base-sub-menu-hover;
sideBarWidth: $base-sidebar-width;
logoTitleColor: $base-logo-title-color;
- logoLightTitleColor: $base-logo-light-title-color
+ logoLightTitleColor: $base-logo-light-title-color;
}
diff --git a/src/views/structural/capabilityAndLaboratory/laboratory/index.vue b/src/views/structural/capabilityAndLaboratory/laboratory/index.vue
new file mode 100644
index 0000000..18cd6fd
--- /dev/null
+++ b/src/views/structural/capabilityAndLaboratory/laboratory/index.vue
@@ -0,0 +1,455 @@
+<template>
+ <div class="capacity-scope">
+ <div>
+ <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
+ <el-form-item label="璧勮川鍚嶇О" prop="name">
+ <el-select v-model="queryParams.name" placeholder="閫夋嫨璧勮川鍚嶇О" size="small" @change="refreshTable(), list = []">
+ <el-option v-for="dict in dict.type.cnas_method_qualification" :key="dict.value" :label="dict.label"
+ :value="dict.value">
+ {{ dict.label }}
+ </el-option>
+ </el-select>
+ </el-form-item>
+ <el-form-item>
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="refreshTable">鏌� 璇�</el-button>
+ <el-button icon="el-icon-refresh" size="mini" @click="refresh">閲� 缃�</el-button>
+ </el-form-item>
+ </el-form>
+ </div>
+ <div>
+ <el-row class="title">
+ <el-col :span="12" style="text-align: left">
+ <el-radio-group v-model="radio" @input="selectorSwitch" size="medium" fill="#409EFF">
+ <el-radio-button :label="0">璧勮川鏄庣粏</el-radio-button>
+ <el-radio-button :label="1">璧勮川鎬昏</el-radio-button>
+ </el-radio-group>
+ </el-col>
+ <el-col :span="12" style="text-align: right" v-if="radio === 0">
+ <el-button size="small" type="primary" @click="openAdd">璧勮川鏇存柊</el-button>
+ <el-button size="small" icon="el-icon-delete" @click="handleDel">鍒犻櫎</el-button>
+ </el-col>
+ </el-row>
+ </div>
+ <div v-if="radio === 0">
+ <lims-table :tableData="tableData" :column="column" :isSelection="true"
+ :handleSelectionChange="handleSelectionChange" @pagination="pagination" :height="'calc(100vh - 300px)'"
+ :page="page" :tableLoading="tableLoading"></lims-table>
+ </div>
+ <div class="table" v-if="radio === 1" v-loading="pageLoading" @scroll="scrollFn">
+ <el-row :gutter="16">
+ <el-col :span="8" v-for="(m, i) in list" :key="i" :xs="24" :sm="12" :md="8" :lg="8" :xl="6"
+ style="margin-bottom: 16px">
+ <div class="table-item">
+ <el-image style="
+ width: 102px;
+ height: 102px;
+ margin-right: 20px;
+ border-radius: 16px;
+ " :src="javaApi + '/img/' + m.imageUrl">
+ <div slot="error" class="image-error" style="
+ width: 100px;
+ height: 100px;
+ border-radius: 16px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border: 1px solid #eeeeee;
+ ">
+ <i class="el-icon-picture-outline" style="font-size: 30px; color: #666666"></i>
+ </div>
+ </el-image>
+ <div class="table-item-right" style="flex: 1; font-size: 12px; color: #666666">
+ <p style="line-height: 26px">
+ 璧勮川鍚嶇О锛�<span style="color: #3a7bfa">{{ m.name }}</span>
+ </p>
+ <p style="line-height: 26px">棰佸彂鏃堕棿锛歿{ m.recentlyTime }}</p>
+ <p style="line-height: 26px">鍒版湡鏃堕棿锛歿{ m.expireTime }}</p>
+ <p>
+ <span>鐘舵�侊細</span>
+ <el-tag :type="m.state === 0 ? 'danger' : 'success'" size="small">{{ m.state === 0 ? "澶辨晥" : "鏈夋晥"
+ }}</el-tag>
+ </p>
+ </div>
+ </div>
+ </el-col>
+ </el-row>
+ <div v-if="list.length < 1 && !pageLoading && !isLoding" style="
+ color: #909399;
+ font-size: 14px;
+ text-align: center;
+ margin-top: 200px;
+ ">
+ 鏆傛棤鏁版嵁
+ </div>
+ <div v-if="list.length > 0">
+ <el-button v-if="isLoding" type="text" style="display: flex; margin: 0 auto; color: #909399">
+ <i class="el-icon-loading" style="font-size: 20px"></i>
+ </el-button>
+ <el-button type="text" v-if="finishLoding"
+ style="display: flex; margin: 0 auto; color: #909399">宸茬粡娌℃湁鏇村鍟</el-button>
+ </div>
+ </div>
+ <el-dialog title="璧勮川鏇存柊" :visible.sync="qualificationsConnectVisible" width="400px">
+ <el-form ref="formDataRef" :model="formData" label-position="right" :rules="formDataRules" label-width="78px">
+ <el-form-item label="璧勮川鍚嶇О" prop="name">
+ <el-select v-model="formData.name" placeholder="璇烽�夋嫨" style="width: 100%" size="small" clearable>
+ <el-option v-for="dict in dict.type.cnas_method_qualification" :key="dict.value" :label="dict.label"
+ :value="dict.value">
+ {{ dict.label }}
+ </el-option>
+ </el-select>
+ </el-form-item>
+ <el-form-item label="璧勮川缂栫爜" prop="code">
+ <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="formData.code"></el-input>
+ </el-form-item>
+ <el-form-item label="棰佸彂鏈烘瀯" prop="organization">
+ <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="formData.organization"></el-input>
+ </el-form-item>
+ <el-form-item label="璧勮川璇存槑" prop="explanation">
+ <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="formData.explanation"></el-input>
+ </el-form-item>
+ <el-form-item label="棰佸彂鏃堕棿" prop="dateOfIssuance">
+ <el-date-picker style="width: 100%" v-model="formData.dateOfIssuance" type="datetime" size="small"
+ format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" clearable placeholder="閫夋嫨鏃ユ湡">
+ </el-date-picker>
+ </el-form-item>
+ <el-form-item label="鍒版湡鏃堕棿" prop="expireTime">
+ <el-date-picker style="width: 100%" v-model="formData.expireTime" type="datetime" size="small"
+ format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" clearable placeholder="閫夋嫨鏃ユ湡">
+ </el-date-picker>
+ </el-form-item>
+ <el-form-item label="璧勮川鍥剧墖">
+ <el-upload ref="upload" :action="uploadAction" :on-success="(m) => handleSuccessUpImg(m, 'imageUrl')"
+ accept="image/jpg,image/jpeg,image/png" :multiple="false" :limit="1" :headers="headers"
+ :on-change="beforeUpload" :on-error="onError">
+ <el-button slot="trigger" size="small" type="primary">閫夊彇鍥剧墖</el-button>
+ </el-upload>
+ </el-form-item>
+ <el-form-item label="璧勮川闄勪欢">
+ <el-upload ref="upload1" :action="uploadAction" :on-success="(m) => handleSuccessUpImg(m, 'fileUrl')"
+ accept="image/jpg,image/jpeg,image/png,application/pdf,.doc,.docx" :headers="headers" :multiple="false"
+ :limit="1" :on-change="beforeUpload1" :on-error="onError1">
+ <el-button slot="trigger" size="small" type="primary">閫夊彇鏂囦欢</el-button>
+ </el-upload>
+ </el-form-item>
+ </el-form>
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="qualificationsConnectVisible = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="confirmQualifications" :loading="loading">纭� 瀹�</el-button>
+ </span>
+ </el-dialog>
+ </div>
+</template>
+
+<script>
+import limsTable from "@/components/Table/lims-table.vue";
+import {
+ addCertificationDetail,
+ delCertificationDetail,
+ getCertificationDetail,
+} from "@/api/structural/laboratory";
+import { getToken } from "@/utils/auth";
+
+export default {
+ components: {
+ limsTable,
+ },
+ dicts: ["cnas_method_qualification"],
+ data() {
+ return {
+ radio: 0,
+ queryParams: {
+ name: "",
+ },
+ tableData: [],
+ selection: [],
+ column: [
+ { label: "璧勮川鍚嶇О", prop: "name" },
+ { label: "璧勮川缂栫爜", prop: "code" },
+ { label: "棰佸彂鏈烘瀯", prop: "organization" },
+ { label: "璧勮川璇存槑", prop: "explanation" },
+ { label: "棣栨棰佸彂鏃堕棿", prop: "firstIssuanceDate" },
+ { label: "鏈�杩戦鍙戞椂闂�", prop: "latestIssuanceDate" },
+ { label: "鍒版湡棰佸彂鏃堕棿", prop: "expireTime" },
+ {
+ dataType: "action",
+ fixed: "right",
+ label: "鎿嶄綔",
+ operation: [
+ {
+ name: "闄勪欢涓嬭浇",
+ type: "text",
+ clickFun: (row) => {
+ this.handleDownLoad(row);
+ },
+ },
+ ],
+ },
+ ],
+ page: {
+ total: 0,
+ size: 10,
+ current: 1,
+ },
+ tableLoading: false,
+ qualificationsList: [],
+ qualificationsConnectVisible: false,
+ formData: {},
+ formDataRules: {
+ name: [
+ { required: true, message: "璇峰~鍐欒祫璐ㄥ悕绉�", trigger: "change" },
+ ],
+ code: [{ required: true, message: "璇峰~鍐欒祫璐ㄧ紪鐮�", trigger: "blur" }],
+ organization: [
+ { required: true, message: "璇峰~鍐欓鍙戞満鏋�", trigger: "blur" },
+ ],
+ dateOfIssuance: [
+ { required: true, message: "璇烽�夋嫨棰佸彂鏃堕棿", trigger: "change" },
+ ],
+ expireTime: [
+ { required: true, message: "璇峰~鍐欏埌鏈熸椂闂�", trigger: "change" },
+ ],
+ },
+ loading: false,
+ pageLoading: false,
+ isLoding: false, // 鍔犺浇涓紝loading鍥炬爣,榛樿涓簍rue
+ finishLoding: false, // 鍔犺浇瀹屾垚锛屾樉绀哄凡缁忔病鏈夋洿澶氫簡
+ currentPage: 1, // 褰撳墠椤�
+ pageSize: 16, // 涓�椤�16鏉�
+ total: "",
+ list: [],
+ uploadAction: process.env.VUE_APP_BASE_API + "/deviceScope/uploadFile",
+ headers: { Authorization: "Bearer " + getToken() },
+ };
+ },
+ mounted() {
+ this.refreshTable();
+ },
+ methods: {
+ selectorSwitch(radio) {
+ if (radio === 1) {
+ this.list = [];
+ this.refreshTable();
+ }
+ },
+ refreshTable() {
+ if (this.radio === 0) {
+ this.tableLoading = true;
+ getCertificationDetail({ ...this.page, ...this.queryParams })
+ .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;
+ });
+ } else {
+ if (this.currentPage > 1) {
+ this.isLoding = true;
+ } else {
+ this.pageLoading = true;
+ }
+ if (this.list.length === 0) {
+ window.addEventListener(
+ "scroll",
+ this.throttle(this.scrollFn, 20000)
+ );
+ }
+ getCertificationDetail({
+ current: this.currentPage,
+ size: this.pageSize,
+ ...this.queryParams,
+ })
+ .then((res) => {
+ if (res.code === 200) {
+ this.total = res.data.total;
+ let list = res.data.records;
+ if (list.length === 0) {
+ this.finishLoding = true;
+ } else {
+ if (list.length < this.pageSize) {
+ this.finishLoding = true;
+ }
+ this.list = this.list.concat(list);
+ if (this.total === this.list.length) {
+ this.finishLoding = true;
+ }
+ }
+ }
+ this.pageLoading = false;
+ this.isLoding = false;
+ })
+ .catch((err) => {
+ this.pageLoading = false;
+ this.isLoding = false;
+ });
+ }
+ },
+ // 閲嶇疆
+ refresh() {
+ if (this.radio === 0) {
+ this.queryParams.name = "";
+ this.page.size = 10;
+ this.page.current = 1;
+ this.refreshTable();
+ } else {
+ this.finishLoding = false;
+ this.currentPage = 1;
+ this.list = [];
+ this.refreshTable();
+ }
+ },
+ // 琛ㄦ牸澶氶��
+ handleSelectionChange(selection) {
+ this.selection = selection;
+ },
+ pagination(page) {
+ this.page.size = page.limit;
+ this.refreshTable();
+ },
+ // 璧勮川鏄庣粏鎵归噺鍒犻櫎
+ handleDel() {
+ if (this.selection.length === 0) {
+ this.$message.warning("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ return;
+ }
+ const delIds = [];
+ this.selection.forEach((item) => {
+ delIds.push(item.id);
+ });
+ delCertificationDetail({ ids: delIds.join(',') }).then((res) => {
+ if (res.code !== 200) return;
+ this.refreshTable();
+ this.$message.success("鍒犻櫎鎴愬姛");
+ });
+ },
+ // 璧勮川鏄庣粏闄勪欢涓嬭浇
+ handleDownLoad(row) {
+ const url = process.env.VUE_APP_BASE_API + "/img/" + row.fileUrl;
+ this.$download.saveAs(url, row.fileUrl);
+ },
+ openAdd() {
+ this.qualificationsConnectVisible = true;
+ this.$nextTick(() => {
+ this.$refs.upload.clearFiles();
+ this.$refs.upload1.clearFiles();
+ });
+ this.formData = {};
+ },
+ handleSuccessUpImg(response, name) {
+ if (response.code === 200) {
+ this.formData[name] = response.data.url;
+ }
+ },
+ beforeUpload(file) {
+ if (file.size > 1024 * 1024 * 10) {
+ this.$message.error("涓婁紶鏂囦欢涓嶈秴杩�10M");
+ this.$refs.upload.clearFiles();
+ return false;
+ } else {
+ return true;
+ }
+ },
+ onError(err, file, fileList) {
+ this.$message.error("涓婁紶澶辫触");
+ this.$refs.upload.clearFiles();
+ },
+ beforeUpload1(file) {
+ if (file.size > 1024 * 1024 * 10) {
+ this.$message.error("涓婁紶鏂囦欢涓嶈秴杩�10M");
+ this.$refs.upload1.clearFiles();
+ return false;
+ } else {
+ return true;
+ }
+ },
+ onError1(err, file, fileList) {
+ this.$message.error("涓婁紶澶辫触");
+ this.$refs.upload1.clearFiles();
+ },
+ confirmQualifications() {
+ this.$refs["formDataRef"].validate((valid) => {
+ if (valid) {
+ this.loading = true;
+ addCertificationDetail({ ...this.formData })
+ .then((res) => {
+ this.loading = false;
+ if (res.code === 201) return;
+ this.$message.success("宸叉彁浜�");
+ this.refreshTable();
+ this.resetForm("formDataRef");
+ this.qualificationsConnectVisible = false;
+ })
+ .catch((err) => {
+ this.loading = false;
+ });
+ }
+ });
+ },
+ // 婊氬姩瑙﹀簳鍔犺浇
+ scrollFn() {
+ let clientHeight = document.documentElement.clientHeight - 18; //鍙鍖哄煙
+ let scrollHeight = document.body.scrollHeight; // 婊氬姩鏂囨。楂樺害
+ let scrollTop = parseInt(document.documentElement.scrollTop); // 宸叉粴鍔ㄧ殑楂樺害
+ let height = 300;
+ if (
+ scrollTop + clientHeight >= scrollHeight - height &&
+ scrollHeight !== 0
+ ) {
+ if (
+ !this.finishLoding &&
+ this.currentPage * this.pageSize < this.total
+ ) {
+ this.currentPage = this.currentPage + 1;
+ this.refreshTable();
+ }
+ } else {
+ return false;
+ }
+ },
+ throttle(fn, wait) {
+ // 灏佽鍑芥暟杩涜鑺傛祦
+ var timer = null;
+ return function () {
+ var context = this;
+ var args = arguments;
+ if (!timer) {
+ timer = setTimeout(function () {
+ fn.apply(context, args);
+ timer = null;
+ }, wait);
+ }
+ };
+ },
+ },
+ destroyed() {
+ window.removeEventListener("scroll", this.throttle(), false);
+ },
+};
+</script>
+
+<style scoped>
+.capacity-scope {
+ padding: 20px;
+}
+
+.title {
+ height: 40px;
+ line-height: 40px;
+ margin-bottom: 10px;
+}
+
+.table-item {
+ border-radius: 8px 8px 8px 8px;
+ box-shadow: 4px 4px 8px 0px rgba(51, 51, 51, 0.04);
+ border: 1px solid #eeeeee;
+ box-sizing: border-box;
+ padding: 14px 12px;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+}
+</style>
diff --git a/src/views/structural/premises/index.vue b/src/views/structural/premises/index.vue
new file mode 100644
index 0000000..1deeb8e
--- /dev/null
+++ b/src/views/structural/premises/index.vue
@@ -0,0 +1,421 @@
+<template>
+ <div class="capacity-scope">
+ <div class="search">
+ <div>
+ <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
+ <el-form-item label="瀹為獙瀹ゅ悕绉�" prop="laboratoryName">
+ <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="queryParams.laboratoryName"
+ @keyup.enter.native="refreshTable"></el-input>
+ </el-form-item>
+ <el-form-item label="瀹為獙瀹ょ紪鐮�" prop="laboratoryNumber">
+ <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="queryParams.laboratoryNumber"
+ @keyup.enter.native="refreshTable"></el-input>
+ </el-form-item>
+ <el-form-item>
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="refreshTable">鏌� 璇�</el-button>
+ <el-button icon="el-icon-refresh" size="mini" @click="refresh">閲� 缃�</el-button>
+ </el-form-item>
+ </el-form>
+ </div>
+ <div>
+ <el-button size="small" type="primary" @click="openAdd('add')" icon="el-icon-plus">鏂板</el-button>
+ </div>
+ </div>
+ <div class="table">
+ <lims-table :tableData="tableData" :column="column" :height="'calc(100vh - 250px)'" @pagination="pagination"
+ :page="page" :tableLoading="tableLoading"></lims-table>
+ </div>
+ <!-- 鏂板瀹為獙瀹�-->
+ <el-dialog :title="formTitle" :visible.sync="addDia" width="450px">
+ <el-form ref="laboratoryForm" :model="laboratoryForm" :rules="userRules" label-position="right"
+ label-width="100px">
+ <el-form-item label="瀹為獙瀹ゅ悕绉�" prop="laboratoryName">
+ <el-input v-model="laboratoryForm.laboratoryName" size="small" clearable></el-input>
+ </el-form-item>
+ <el-form-item label="鍦烘墍缂栫爜" prop="laboratoryNumber">
+ <el-input v-model="laboratoryForm.laboratoryNumber" size="small" clearable></el-input>
+ </el-form-item>
+ <el-form-item label="瀹為獙瀹や唬鍙�" prop="laboratoryCode">
+ <el-input v-model="laboratoryForm.laboratoryCode" size="small" clearable></el-input>
+ </el-form-item>
+ <el-form-item label="璐熻矗浜�" prop="head">
+ <el-input v-model="laboratoryForm.head" size="small" clearable></el-input>
+ </el-form-item>
+ <el-form-item label="璐熻矗浜虹數璇�" prop="phoneNumber">
+ <el-input v-model="laboratoryForm.phoneNumber" size="small" clearable></el-input>
+ </el-form-item>
+ <el-form-item label="鍦板潃" prop="address">
+ <el-input v-model="laboratoryForm.address" size="small" clearable></el-input>
+ </el-form-item>
+ </el-form>
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="reset">鍙� 娑�</el-button>
+ <el-button type="primary" @click="customAdd" :loading="loading">纭� 瀹�</el-button>
+ </span>
+ </el-dialog>
+ <el-dialog title="鍗扮珷绠$悊" :visible.sync="fileVisible" width="60vw">
+ <div class="btns">
+ <el-button size="medium" type="primary" @click="openUpload">鏇存柊鍗扮珷</el-button>
+ </div>
+ <lims-table :tableData="fileComponentData" :column="fileComponentDataColumn" @pagination="fileComponentPagination"
+ height="500px" :page="fileComponentPage" :tableLoading="fileComponentTableLoading"></lims-table>
+ </el-dialog>
+ <el-dialog title="鏇存柊鍗扮珷" :visible.sync="upFileVisible" width="400px">
+ <el-form ref="dataForm" :model="dataForm" :rules="dataFormRules" label-position="right" label-width="80px">
+ <el-form-item label="鍗扮珷绫诲瀷" prop="type">
+ <el-cascader v-model="dataForm.type" :options="options" :show-all-levels="false" :props="props"
+ placeholder="璇烽�夋嫨" size="small" style="width:100%" collapse-tags clearable></el-cascader>
+ </el-form-item>
+ <el-form-item label="鍗扮珷鍥剧墖" prop="address">
+ <el-upload class="avatar-uploader" :action="action" :headers="uploadHeader"
+ accept='image/jpg,image/jpeg,image/png' :show-file-list="false" :on-success="handleSuccess"
+ :on-change="beforeUpload" ref="upload" :on-error="onError">
+ <img v-if="dataForm.address" :src="javaApi + '/img/' + dataForm.address" class="avatar">
+ <i v-else class="el-icon-plus avatar-uploader-icon"></i>
+ </el-upload>
+ </el-form-item>
+ </el-form>
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="upFileVisible = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="confirmConnect" :loading="loading">纭� 瀹�</el-button>
+ </span>
+ </el-dialog>
+ </div>
+</template>
+
+<script>
+import limsTable from "@/components/Table/lims-table.vue";
+import {
+ addParameter,
+ addSeal,
+ delParameter,
+ selectItemParameter,
+ selectSeal,
+ upParameter
+} from "@/api/structural/laboratoryScope";
+import { getCertificationDetail } from "@/api/structural/laboratory";
+export default {
+ components: {
+ limsTable
+
+ },
+ computed: {
+ action() {
+ return this.javaApi + '/deviceScope/uploadFile'
+ }
+ },
+ data() {
+ return {
+ queryParams: {
+ laboratoryName: '',
+ laboratoryNumber: '',
+ },
+ tableData: [],
+ tableLoading: false,
+ column: [
+ { label: '瀹為獙瀹ゅ悕绉�', prop: 'laboratoryName' },
+ { label: '鍦烘墍缂栫爜', prop: 'laboratoryNumber' },
+ { label: '瀹為獙瀹や唬鍙�', prop: 'laboratoryCode' },
+ { label: '璐熻矗浜�', prop: 'head' },
+ { label: '璐熻矗浜虹數璇�', prop: 'phoneNumber' },
+ { label: '鍦板潃', prop: 'address' },
+ { label: '鍒涘缓浜�', prop: 'createUserName' },
+ { label: '鍒涘缓鏃堕棿', prop: 'createTime' },
+ {
+ dataType: 'action',
+ fixed: 'right',
+ label: '鎿嶄綔',
+ width: '180px',
+ operation: [
+ {
+ name: '缂栬緫',
+ type: 'text',
+ clickFun: (row) => {
+ this.openAdd('edit', row);
+ },
+ },
+ {
+ name: '鍒犻櫎',
+ type: 'text',
+ clickFun: (row) => {
+ this.delete(row);
+ },
+ },
+ {
+ name: '鍗扮珷绠$悊',
+ type: 'text',
+ clickFun: (row) => {
+ this.fileManagement(row);
+ },
+ },
+ ]
+ }
+ ],
+ page: {
+ total: 0,
+ size: 10,
+ current: 1
+ },
+ addDia: false,
+ formTitle: '',
+ laboratoryForm: {
+
+ },
+ operationType: '',
+ userRules: {
+ laboratoryName: [{ required: true, message: '璇疯緭鍏ュ疄楠屽鍚嶇О', trigger: 'blur' }],
+ laboratoryNumber: [{ required: true, message: '璇疯緭鍏ュ満鎵�缂栫爜', trigger: 'blur' }],
+ head: [{ required: true, message: '璇疯緭鍏ヨ礋璐d汉', trigger: 'blur' }],
+ phoneNumber: [{ required: true, message: '璇疯緭鍏ヨ礋璐d汉鐢佃瘽', trigger: 'blur' }],
+ },
+ currentRow: {},
+ fileComponentTableLoading: false,
+ fileComponentData: [],
+ fileComponentDataColumn: [
+ { label: '瀹為獙瀹ゅ悕绉�', prop: 'laboratoryName' },
+ { label: '鍗扮珷鍥剧墖', prop: 'address', dataType: 'image' },
+ { label: '鍗扮珷绫诲瀷', prop: 'type' },
+ ],
+ fileComponentPage: {
+ total: 0,
+ size: 10,
+ current: 1,
+ layout: 'total, prev, pager, next'
+ },
+ fileVisible: false,
+ upFileVisible: false,
+ loading: false,
+ dataForm: {
+ type: '',
+ address: '',
+ },
+ dataFormRules: {
+ type: [{ required: true, message: '璇烽�夋嫨鍗扮珷绫诲瀷', trigger: 'change' }],
+ address: [{ required: false, message: '璇蜂笂浼犲浘鐗�', trigger: 'change' }],
+ },
+ props: { multiple: false, emitPath: false, },
+ options: [
+ {
+ value: '瀹為獙瀹よ祫璐�',
+ label: '瀹為獙瀹よ祫璐�',
+ children: []
+ },
+ {
+ value: '濮旀墭鎶ュ憡',
+ label: '濮旀墭鎶ュ憡',
+ children: null
+ },
+ {
+ value: '杩涘巶鎶ュ憡',
+ label: '杩涘巶鎶ュ憡',
+ children: null
+ },
+ ],
+ }
+ },
+ mounted() {
+ this.refreshTable()
+ },
+ methods: {
+ refreshTable() {
+ this.tableLoading = true
+ selectItemParameter({ ...this.page, ...this.queryParams }).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
+ })
+ },
+ // 閲嶇疆
+ refresh() {
+ this.resetForm('queryForm')
+ this.refreshTable()
+ },
+ // 鍒嗛〉鍒囨崲
+ pagination(page) {
+ this.page.size = page.limit
+ this.refreshTable()
+ },
+ openAdd(type, row) {
+ this.formTitle = type === 'add' ? '鏂板瀹為獙瀹�' : '缂栬緫瀹為獙瀹�'
+ this.operationType = type
+ if (type === 'edit') {
+ this.laboratoryForm = this.HaveJson(row)
+ }
+ this.addDia = true
+ },
+ // 鎻愪氦鏂板銆佺紪杈戝疄楠屽琛ㄥ崟
+ customAdd() {
+ this.$refs['laboratoryForm'].validate((valid) => {
+ if (valid) {
+ this.loading = true
+ if (this.operationType === 'add') {
+ addParameter(this.laboratoryForm).then(res => {
+ this.loading = false
+ if (res.code !== 200) return
+ this.$message.success('鏂板鎴愬姛')
+ this.refreshTable()
+ this.reset()
+ }).catch(err => {
+ this.loading = false
+ })
+ } else {
+ upParameter(this.laboratoryForm).then(res => {
+ this.loading = false
+ if (res.code !== 200) return
+ this.$message.success('淇敼鎴愬姛')
+ this.refreshTable()
+ this.reset()
+ }).catch(err => {
+ this.loading = false
+ })
+ }
+ }
+ })
+ },
+ reset() {
+ this.resetForm('laboratoryForm')
+ this.addDia = false
+ },
+ // 鍒犻櫎瀹為獙瀹�
+ delete(row) {
+ this.$confirm('鏄惁鍒犻櫎褰撳墠鏁版嵁?', "璀﹀憡", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ }).then(() => {
+ delParameter({ id: row.id }).then(res => {
+ this.$message.success('鍒犻櫎鎴愬姛')
+ this.refreshTable()
+ }).catch(e => {
+ this.$message.error('鍒犻櫎澶辫触')
+ })
+ }).catch(() => { })
+ },
+ // 鎵撳紑鍗扮珷绠$悊寮规
+ fileManagement(row) {
+ this.fileVisible = true;
+ this.fileComponentTableLoading = true
+ this.currentRow = row
+ this.getFileComponentList()
+ },
+ getFileComponentList() {
+ selectSeal({ id: this.currentRow.id, ...this.fileComponentPage }).then(res => {
+ this.fileComponentTableLoading = false
+ if (res.code === 200) {
+ this.fileComponentData = res.data.records
+ this.fileComponentPage.total = res.data.total
+ }
+ }).catch(err => {
+ this.fileComponentTableLoading = false
+ })
+ },
+ fileComponentPagination(page) {
+ this.fileComponentPage.size = page.limit
+ this.getFileComponentList()
+ },
+ // 鎵撳紑鏇存柊鍗扮珷寮规
+ openUpload() {
+ this.dataForm.type = '';
+ this.dataForm.address = '';
+ this.upFileVisible = true;
+ this.getCertificationOperation()
+ },
+ // 鏌ヨ鍗扮珷绫诲瀷
+ getCertificationOperation() {
+ const params = {
+ current: -1,
+ size: -1,
+ }
+ getCertificationDetail(params).then(res => {
+ this.options[0].children = res.data.records.map(m => {
+ m.value = m.name;
+ m.label = m.name;
+ return m
+ });
+ })
+ },
+ // 鎻愪氦鏇存柊鍗扮珷
+ confirmConnect() {
+ this.$refs['dataForm'].validate((valid) => {
+ if (valid) {
+ this.loading = true;
+ addSeal({ labId: this.currentRow.id, ...this.dataForm }).then(res => {
+ this.loading = false;
+ this.getFileComponentList()
+ this.upFileVisible = false;
+ })
+ }
+ })
+ },
+ handleSuccess(response,) {
+ if (response.code === 200) {
+ this.dataForm.address = response.data.url
+ }
+ },
+ beforeUpload(file, type) {
+ if (file.size > 1024 * 1024 * 10) {
+ this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M');
+ this.$refs.upload.clearFiles()
+ return false;
+ } else {
+ return true;
+ }
+ },
+ onError(err, file, fileList, type) {
+ this.$message.error('涓婁紶澶辫触')
+ this.$refs.upload.clearFiles()
+ },
+ }
+}
+</script>
+<style scoped>
+.capacity-scope {
+ padding: 20px;
+}
+
+.search {
+ height: 46px;
+ display: flex;
+ justify-content: space-between;
+}
+
+.btns {
+ text-align: right;
+ margin-bottom: 10px;
+}
+
+::v-deep .el-dialog__body {
+ padding-top: 8px !important;
+}
+
+.avatar-uploader ::v-deep .el-upload {
+ border: 1px dashed #666666;
+ border-radius: 6px;
+ cursor: pointer;
+ position: relative;
+ overflow: hidden;
+}
+
+.avatar-uploader ::v-deep .el-upload:hover {
+ border-color: #409EFF;
+}
+
+.avatar-uploader-icon {
+ font-size: 20px;
+ color: #8c939d;
+ width: 90px;
+ height: 90px;
+ line-height: 90px;
+ text-align: center;
+}
+
+.avatar {
+ width: 90px;
+ height: 90px;
+ display: block;
+}
+</style>
--
Gitblit v1.9.3