From f03cf23f3acbd5582a16c263aa6bf83b260ec906 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期一, 28 九月 2026 09:53:19 +0800
Subject: [PATCH] feat(inspection): 接口

---
 src/views/structural/sealManage/index.vue |  314 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 314 insertions(+), 0 deletions(-)

diff --git a/src/views/structural/sealManage/index.vue b/src/views/structural/sealManage/index.vue
new file mode 100644
index 0000000..e9e3e2b
--- /dev/null
+++ b/src/views/structural/sealManage/index.vue
@@ -0,0 +1,314 @@
+<template>
+  <div class="app-container seal-manage">
+    <div class="search-bar">
+      <el-form ref="queryForm" :inline="true" :model="queryParams" size="small">
+        <el-form-item label="鍗扮珷鍚嶇О" prop="name">
+          <el-input v-model="queryParams.name" clearable placeholder="璇疯緭鍏�" @keyup.enter.native="refreshTable" />
+        </el-form-item>
+        <el-form-item label="鐘舵��" prop="status">
+          <el-select v-model="queryParams.status" clearable placeholder="鍏ㄩ儴">
+            <el-option label="鍚敤" :value="1" />
+            <el-option label="鍋滅敤" :value="0" />
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" size="mini" @click="refreshTable">鏌ヨ</el-button>
+          <el-button size="mini" @click="resetQuery">閲嶇疆</el-button>
+        </el-form-item>
+      </el-form>
+      <div class="toolbar">
+        <el-button type="primary" size="small" icon="el-icon-plus" @click="openForm()">鏂板</el-button>
+        <el-button type="primary" size="small" icon="el-icon-download" :loading="exportLoading" @click="handleExport">
+          瀵煎嚭
+        </el-button>
+      </div>
+    </div>
+
+    <lims-table
+      :table-data="tableData"
+      :column="columns"
+      :page="page"
+      :table-loading="tableLoading"
+      height="calc(100vh - 245px)"
+      @pagination="pagination"
+    />
+
+    <el-dialog
+      :title="formTitle"
+      :visible.sync="formVisible"
+      width="620px"
+      :close-on-click-modal="false"
+      @closed="resetSealForm"
+    >
+      <el-form ref="sealForm" :model="form" :rules="rules" label-width="100px">
+        <el-row :gutter="20">
+          <el-col :span="24">
+            <el-form-item label="鍗扮珷鍚嶇О" prop="name">
+              <el-input v-model="form.name" maxlength="64" placeholder="璇疯緭鍏ュ嵃绔犲悕绉�" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-form-item label="鍗扮珷鍥剧墖" prop="address">
+          <el-upload
+            ref="sealUpload"
+            class="seal-uploader"
+            :action="uploadAction"
+            :headers="uploadHeader"
+            accept="image/jpeg,image/png"
+            :show-file-list="false"
+            :before-upload="beforeUpload"
+            :on-success="handleUploadSuccess"
+            :on-error="handleUploadError"
+          >
+            <img v-if="form.address" :src="sealImageUrl(form.address)" class="seal-preview" alt="鍗扮珷鍥剧墖">
+            <div v-else class="seal-upload-placeholder">
+              <i class="el-icon-upload" />
+              <span>鐐瑰嚮涓婁紶鍗扮珷鍥剧墖</span>
+            </div>
+          </el-upload>
+          <div class="upload-tip">浠呮敮鎸� jpg / png锛屽ぇ灏忎笉瓒呰繃 2MB</div>
+        </el-form-item>
+        <el-form-item label="浣跨敤鑼冨洿" prop="useScope">
+          <el-input v-model="form.useScope" maxlength="255" placeholder="璇疯緭鍏ヤ娇鐢ㄨ寖鍥�" />
+        </el-form-item>
+        <el-form-item label="鐘舵��" prop="status">
+          <el-radio-group v-model="form.status">
+            <el-radio :label="1">鍚敤</el-radio>
+            <el-radio :label="0">鍋滅敤</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="澶囨敞" prop="remark">
+          <el-input v-model="form.remark" type="textarea" :rows="3" maxlength="255" show-word-limit />
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="formVisible = false">鍙� 娑�</el-button>
+        <el-button type="primary" :loading="submitLoading" @click="submitForm">纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import limsTable from '@/components/Table/lims-table.vue'
+import { addSeal, delSeal, exportSeal, pageSeal, updateSeal } from '@/api/structural/sealConfig'
+
+function emptyForm() {
+  return {
+    id: null,
+    name: '',
+    address: '',
+    useScope: '',
+    status: 1,
+    remark: ''
+  }
+}
+
+export default {
+  name: 'SealManage',
+  components: { limsTable },
+  data() {
+    return {
+      queryParams: {
+        name: '',
+        status: null
+      },
+      page: {
+        total: 0,
+        size: 20,
+        current: 1
+      },
+      tableData: [],
+      tableLoading: false,
+      exportLoading: false,
+      formVisible: false,
+      submitLoading: false,
+      form: emptyForm(),
+      rules: {
+        name: [{ required: true, message: '璇疯緭鍏ュ嵃绔犲悕绉�', trigger: 'blur' }],
+        address: [{ required: true, message: '璇蜂笂浼犲嵃绔犲浘鐗�', trigger: 'change' }]
+      },
+      columns: [
+        { label: '鍗扮珷缂栧彿', prop: 'code', width: '110px' },
+        { label: '鍗扮珷鍚嶇О', prop: 'name', width: '130px' },
+        { label: '鍗扮珷鍥剧墖', prop: 'address', dataType: 'image', width: '100px' },
+        { label: '浣跨敤鑼冨洿', prop: 'useScope' },
+        {
+          label: '鐘舵��',
+          prop: 'status',
+          width: '90px',
+          dataType: 'tag',
+          formatData: value => Number(value) === 1 ? '鍚敤' : '鍋滅敤',
+          formatType: value => Number(value) === 1 ? 'success' : 'info'
+        },
+        { label: '澶囨敞', prop: 'remark' },
+        { label: '鍒涘缓鏃堕棿', prop: 'createTime', width: '165px' },
+        {
+          label: '鎿嶄綔',
+          dataType: 'action',
+          fixed: 'right',
+          width: '140px',
+          operation: [
+            { name: '缂栬緫', type: 'text', clickFun: row => this.openForm(row) },
+            { name: '鍒犻櫎', type: 'text', clickFun: row => this.handleDelete(row) }
+          ]
+        }
+      ]
+    }
+  },
+  computed: {
+    formTitle() {
+      return this.form.id ? '缂栬緫鍗扮珷' : '鏂板鍗扮珷'
+    },
+    uploadAction() {
+      return this.javaApi + '/sealConfig/upload'
+    }
+  },
+  mounted() {
+    this.getList()
+  },
+  methods: {
+    getList() {
+      this.tableLoading = true
+      const params = { ...this.queryParams, current: this.page.current, size: this.page.size }
+      pageSeal(params).then(res => {
+        this.tableData = res.data.records || []
+        this.page.total = res.data.total || 0
+      }).finally(() => {
+        this.tableLoading = false
+      })
+    },
+    refreshTable() {
+      this.page.current = 1
+      this.getList()
+    },
+    resetQuery() {
+      this.resetForm('queryForm')
+      this.page.current = 1
+      this.getList()
+    },
+    pagination({ page, limit }) {
+      this.page.current = page
+      this.page.size = limit
+      this.getList()
+    },
+    openForm(row) {
+      this.form = row ? { ...row } : emptyForm()
+      this.formVisible = true
+      this.$nextTick(() => this.$refs.sealForm && this.$refs.sealForm.clearValidate())
+    },
+    resetSealForm() {
+      this.form = emptyForm()
+      if (this.$refs.sealUpload) this.$refs.sealUpload.clearFiles()
+      if (this.$refs.sealForm) this.$refs.sealForm.clearValidate()
+    },
+    submitForm() {
+      this.$refs.sealForm.validate(valid => {
+        if (!valid) return
+        this.submitLoading = true
+        const request = this.form.id ? updateSeal : addSeal
+        request(this.form).then(() => {
+          this.$message.success(this.form.id ? '淇敼鎴愬姛' : '鏂板鎴愬姛')
+          this.formVisible = false
+          this.getList()
+        }).finally(() => {
+          this.submitLoading = false
+        })
+      })
+    },
+    handleDelete(row) {
+      this.$confirm(`纭鍒犻櫎鍗扮珷鈥�${row.name}鈥濆悧锛焋, '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => delSeal(row.id)).then(() => {
+        this.$message.success('鍒犻櫎鎴愬姛')
+        if (this.tableData.length === 1 && this.page.current > 1) this.page.current -= 1
+        this.getList()
+      }).catch(() => {})
+    },
+    handleExport() {
+      this.exportLoading = true
+      exportSeal(this.queryParams).then(data => {
+        this.$download.saveAs(new Blob([data]), '鍗扮珷绠$悊.xlsx')
+      }).finally(() => {
+        this.exportLoading = false
+      })
+    },
+    beforeUpload(file) {
+      const validType = ['image/jpeg', 'image/png'].includes(file.type)
+      const validSize = file.size / 1024 / 1024 <= 2
+      if (!validType) this.$message.error('浠呮敮鎸� jpg / png 鍥剧墖')
+      if (validType && !validSize) this.$message.error('鍥剧墖澶у皬涓嶈兘瓒呰繃 2MB')
+      return validType && validSize
+    },
+    handleUploadSuccess(response) {
+      if (response.code !== 200) {
+        this.$message.error(response.msg || '涓婁紶澶辫触')
+        return
+      }
+      this.form.address = typeof response.data === 'string' ? response.data : response.data.url
+      this.$nextTick(() => this.$refs.sealForm.validateField('address'))
+    },
+    handleUploadError() {
+      this.$message.error('鍗扮珷鍥剧墖涓婁紶澶辫触')
+    },
+    sealImageUrl(address) {
+      return this.javaApi + '/img/' + address
+    }
+  }
+}
+</script>
+
+<style scoped>
+.search-bar {
+  display: flex;
+  align-items: flex-start;
+  justify-content: space-between;
+}
+
+.toolbar {
+  flex: none;
+  margin-left: 16px;
+}
+
+.seal-uploader ::v-deep .el-upload {
+  overflow: hidden;
+  width: 150px;
+  height: 150px;
+  border: 1px dashed #d9d9d9;
+  border-radius: 6px;
+}
+
+.seal-uploader ::v-deep .el-upload:hover {
+  border-color: #409eff;
+}
+
+.seal-preview {
+  display: block;
+  width: 150px;
+  height: 150px;
+  object-fit: contain;
+}
+
+.seal-upload-placeholder {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  width: 100%;
+  height: 100%;
+  color: #909399;
+}
+
+.seal-upload-placeholder i {
+  margin-bottom: 8px;
+  font-size: 30px;
+}
+
+.upload-tip {
+  color: #909399;
+  font-size: 12px;
+  line-height: 20px;
+}
+</style>

--
Gitblit v1.9.3