From 93b79b3a68e19cc36a8feb3bfea4e08ae76ec233 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期二, 06 一月 2026 21:14:34 +0800
Subject: [PATCH] 代码调整9

---
 src/views/environmentAccess/intelligentInspectionManagement/index.vue |  465 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 461 insertions(+), 4 deletions(-)

diff --git a/src/views/environmentAccess/intelligentInspectionManagement/index.vue b/src/views/environmentAccess/intelligentInspectionManagement/index.vue
index 40dc0c9..0ff4ab5 100644
--- a/src/views/environmentAccess/intelligentInspectionManagement/index.vue
+++ b/src/views/environmentAccess/intelligentInspectionManagement/index.vue
@@ -1,9 +1,466 @@
 <template>
-  <div></div>
+  <div class="app-container">
+    <div class="search_form">
+      <div>
+        <span class="search_title">宸℃鍚嶇О锛�</span>
+        <el-input
+            v-model="searchForm.supplierName"
+            style="width: 240px"
+            placeholder="杈撳叆宸℃鍚嶇О鎼滅储"
+            @change="handleQuery"
+            clearable
+            :prefix-icon="Search"
+        />
+        <el-button type="primary" @click="handleQuery" style="margin-left: 10px"
+        >鎼滅储</el-button
+        >
+      </div>
+      <div>
+        <el-button type="primary" @click="openForm('add')"
+        >鏂板</el-button>
+        <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
+      </div>
+    </div>
+    <div class="table_list">
+      <PIMTable
+          rowKey="id"
+          :column="tableColumn"
+          :tableData="tableData"
+          :page="page"
+          :isSelection="true"
+          @selection-change="handleSelectionChange"
+          :tableLoading="tableLoading"
+          @pagination="pagination"
+      ></PIMTable>
+    </div>
+    <el-dialog
+        v-model="dialogFormVisible"
+        :title="operationType === 'add' ? '鏂板宸℃淇℃伅' : '缂栬緫宸℃淇℃伅'"
+        width="70%"
+        @close="closeDia"
+    >
+      <el-form
+          :model="form"
+          label-width="140px"
+          label-position="top"
+          :rules="rules"
+          ref="formRef"
+      >
+        <el-row :gutter="30">
+          <el-col :span="12">
+            <el-form-item label="宸℃鍚嶇О锛�" prop="supplierName">
+              <el-input
+                  v-model="form.supplierName"
+                  placeholder="璇疯緭鍏�"
+                  clearable
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item
+                label="宸℃绫诲瀷锛�"
+                prop="taxpayerIdentificationNum"
+            >
+              <el-select style="width:100%" v-model="form.taxpayerIdentificationNum" clearable>
+                <el-option v-for="(item,index) in typeList" :key="index" :label="item.label" :value="item.value"/>
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="30">
+          <el-col :span="12">
+            <el-form-item label="宸℃鍖哄煙锛�" prop="companyAddress">
+              <el-input
+                  v-model="form.companyAddress"
+                  placeholder="璇疯緭鍏�"
+                  clearable
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="璁″垝寮�濮嬫椂闂达細" prop="companyPhone">
+              <el-date-picker style="width:100%" clearable value-format="YYYY-MM-DD" type="date" placeholder="閫夋嫨鏃ユ湡鏃堕棿" v-model="form.companyPhone"></el-date-picker>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="30">
+          <el-col :span="12">
+            <el-form-item label="璁″垝缁撴潫鏃堕棿锛�" prop="bankAccountName">
+              <el-date-picker style="width:100%" clearable value-format="YYYY-MM-DD" type="date" placeholder="閫夋嫨鏃ユ湡鏃堕棿" v-model="form.bankAccountName"></el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="瀹為檯寮�濮嬫椂闂达細" prop="bankAccountNum">
+              <el-date-picker style="width:100%" clearable value-format="YYYY-MM-DD" type="date" placeholder="閫夋嫨鏃ユ湡鏃堕棿" v-model="form.bankAccountNum"></el-date-picker>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="30">
+          <el-col :span="12">
+            <el-form-item label="瀹為檯缁撴潫鏃堕棿锛�" prop="contactUserName">
+              <el-date-picker style="width:100%" clearable value-format="YYYY-MM-DD" type="date" placeholder="閫夋嫨鏃ユ湡鏃堕棿" v-model="form.contactUserName"></el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="宸℃浜哄憳锛�" prop="contactUserPhone">
+              <el-input
+                  v-model="form.contactUserPhone"
+                  placeholder="璇疯緭鍏�"
+                  clearable
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button type="primary" @click="submitForm">纭</el-button>
+          <el-button @click="closeDia">鍙栨秷</el-button>
+        </div>
+      </template>
+    </el-dialog>
+
+    <!-- 渚涘簲鍟嗗鍏ュ璇濇 -->
+    <el-dialog
+        :title="upload.title"
+        v-model="upload.open"
+        width="400px"
+        append-to-body
+    >
+      <el-upload
+          ref="uploadRef"
+          :limit="1"
+          accept=".xlsx, .xls"
+          :headers="upload.headers"
+          :action="upload.url + '?updateSupport=' + upload.updateSupport"
+          :disabled="upload.isUploading"
+          :on-progress="handleFileUploadProgress"
+          :on-success="handleFileSuccess"
+          :auto-upload="false"
+          drag
+      >
+        <el-icon class="el-icon--upload"><upload-filled /></el-icon>
+        <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div>
+        <template #tip>
+          <div class="el-upload__tip text-center">
+            <span>浠呭厑璁稿鍏ls銆亁lsx鏍煎紡鏂囦欢銆�</span>
+            <!-- <el-link
+              type="primary"
+              :underline="false"
+              style="font-size: 12px; vertical-align: baseline"
+              @click="importTemplate"
+              >涓嬭浇妯℃澘</el-link
+            > -->
+          </div>
+        </template>
+      </el-upload>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button type="primary" @click="submitFileForm">纭� 瀹�</el-button>
+          <el-button @click="upload.open = false">鍙� 娑�</el-button>
+        </div>
+      </template>
+    </el-dialog>
+  </div>
 </template>
-<script>
 
+<script setup>
+import { onMounted, ref } from "vue";
+import { Search } from "@element-plus/icons-vue";
+import { delSupplier } from "@/api/basicData/supplierManageFile.js";
+import { ElMessageBox } from "element-plus";
+import { userListNoPage } from "@/api/system/user.js";
+import {
+  addSupplier,
+  getSupplier,
+  listSupplier,
+  updateSupplier,
+} from "@/api/basicData/supplierManageFile.js";
+import useUserStore from "@/store/modules/user";
+import { getToken } from "@/utils/auth.js";
+const { proxy } = getCurrentInstance();
+const userStore = useUserStore();
+
+const tableColumn = ref([
+  {
+    label: "宸℃鍚嶇О",
+    prop: "supplierName",
+    width: 250,
+  },
+  {
+    label: "宸℃绫诲瀷",
+    prop: "taxpayerIdentificationNum",
+    width: 230,
+  },
+  {
+    label: "璁″垝寮�濮嬫椂闂�",
+    prop: "companyPhone",
+    width:150
+  },
+  {
+    label: "璁″垝缁撴潫鏃堕棿",
+    prop: "bankAccountName",
+    width: 220,
+  },
+  {
+    label: "瀹為檯寮�濮嬫椂闂�",
+    prop: "bankAccountNum",
+    width: 220,
+  },
+  {
+    label: "瀹為檯缁撴潫鏃堕棿",
+    prop: "contactUserName",
+  },
+  {
+    label: "宸℃浜哄憳",
+    prop: "contactUserPhone",
+    width: 150,
+  },
+  {
+    label: "宸℃鍖哄煙",
+    prop: "companyAddress",
+  },
+  {
+    dataType: "action",
+    label: "鎿嶄綔",
+    align: "center",
+    fixed: 'right',
+    operation: [
+      {
+        name: "缂栬緫",
+        type: "text",
+        clickFun: (row) => {
+          openForm("edit", row);
+        },
+        disabled: (row) => {
+          return row.maintainUserName !== userStore.nickName
+        }
+      },
+    ],
+  },
+]);
+const tableData = ref([]);
+const selectedRows = ref([]);
+const userList = ref([]);
+const tableLoading = ref(false);
+const page = reactive({
+  current: 1,
+  size: 100,
+  total: 0,
+});
+const typeList = ref([
+  { label: "鏃ュ父宸℃", value: "鏃ュ父宸℃" },
+  { label: "涓撻」宸℃", value: "涓撻」宸℃" },
+  { label: "涓存椂宸℃", value: "涓存椂宸℃" },
+]);
+
+// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
+const operationType = ref("");
+const dialogFormVisible = ref(false);
+const data = reactive({
+  searchForm: {
+    supplierName: "",
+  },
+  form: {
+    supplierName: "",
+    taxpayerIdentificationNum: "",
+    companyAddress: "",
+    companyPhone: "",
+    bankAccountName: "",
+    bankAccountNum: "",
+    contactUserName: "",
+    contactUserPhone: "",
+    maintainUserId: "",
+    maintainTime: "",
+  },
+  rules: {
+    supplierName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+    taxpayerIdentificationNum: [
+      { required: true, message: "璇疯緭鍏�", trigger: "blur" },
+    ],
+    companyAddress: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+    companyPhone: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+    bankAccountName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+    bankAccountNum: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+    contactUserName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+    contactUserPhone: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+    maintainUserId: [{ required: false, message: "璇烽�夋嫨", trigger: "change" }],
+    maintainTime: [{ required: false, message: "璇烽�夋嫨", trigger: "change" }],
+  },
+});
+const { searchForm, form, rules } = toRefs(data);
+
+// 鏌ヨ鍒楄〃
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+  page.current = 1;
+  getList();
+};
+const pagination = (obj) => {
+  page.current = obj.page;
+  page.size = obj.limit;
+  getList();
+};
+/** 鎻愪氦涓婁紶鏂囦欢 */
+function submitFileForm() {
+  console.log(upload.url + '?updateSupport=' + upload.updateSupport)
+  proxy.$refs["uploadRef"].submit();
+}
+const getList = () => {
+  tableLoading.value = true;
+  listSupplier({ ...searchForm.value, ...page }).then((res) => {
+    tableLoading.value = false;
+    tableData.value = res.data.records;
+    page.total = res.data.total;
+  });
+};
+const upload = reactive({
+  // 鏄惁鏄剧ず寮瑰嚭灞傦紙渚涘簲鍟嗗鍏ワ級
+  open: false,
+  // 寮瑰嚭灞傛爣棰橈紙渚涘簲鍟嗗鍏ワ級
+  title: "",
+  // 鏄惁绂佺敤涓婁紶
+  isUploading: false,
+  // 鏄惁鏇存柊宸茬粡瀛樺湪鐨勭敤鎴锋暟鎹�
+  updateSupport: 1,
+  // 璁剧疆涓婁紶鐨勮姹傚ご閮�
+  headers: { Authorization: "Bearer " + getToken() },
+  // 涓婁紶鐨勫湴鍧�
+  url: import.meta.env.VITE_APP_BASE_API + "/system/supplier/import",
+});
+/** 瀵煎叆鎸夐挳鎿嶄綔 */
+function handleImport() {
+  upload.title = "渚涘簲鍟嗗鍏�";
+  upload.open = true;
+}
+
+/**鏂囦欢涓婁紶涓鐞� */
+const handleFileUploadProgress = (event, file, fileList) => {
+  upload.isUploading = true;
+};
+
+/** 鏂囦欢涓婁紶鎴愬姛澶勭悊 */
+const handleFileSuccess = (response, file, fileList) => {
+  upload.open = false;
+  upload.isUploading = false;
+  proxy.$refs["uploadRef"].handleRemove(file);
+  getList();
+};
+// 琛ㄦ牸閫夋嫨鏁版嵁
+const handleSelectionChange = (selection) => {
+  selectedRows.value = selection;
+};
+// 鎵撳紑寮规
+const openForm = (type, row) => {
+  operationType.value = type;
+  form.value = {};
+  form.value.maintainUserId = userStore.id;
+  form.value.maintainTime = getCurrentDate();
+  userListNoPage().then((res) => {
+    userList.value = res.data;
+  });
+  if (type === "edit") {
+    getSupplier(row.id).then((res) => {
+      form.value = { ...res.data };
+    });
+  }
+  dialogFormVisible.value = true;
+};
+// 鎻愪氦琛ㄥ崟
+const submitForm = () => {
+  proxy.$refs["formRef"].validate((valid) => {
+    if (valid) {
+      if (operationType.value === "edit") {
+        submitEdit();
+      } else {
+        submitAdd();
+      }
+    }
+  });
+};
+// 鎻愪氦鏂板
+const submitAdd = () => {
+  addSupplier(form.value).then((res) => {
+    proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+    closeDia();
+    getList();
+  });
+};
+// 鎻愪氦淇敼
+const submitEdit = () => {
+  updateSupplier(form.value).then((res) => {
+    proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+    closeDia();
+    getList();
+  });
+};
+// 鍏抽棴寮规
+const closeDia = () => {
+  proxy.resetForm("formRef");
+  dialogFormVisible.value = false;
+};
+// 瀵煎嚭
+const handleOut = () => {
+  ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+    confirmButtonText: "纭",
+    cancelButtonText: "鍙栨秷",
+    type: "warning",
+  })
+      .then(() => {
+        proxy.download("/system/supplier/export", {}, "渚涘簲鍟嗘。妗�.xlsx");
+      })
+      .catch(() => {
+        proxy.$modal.msg("宸插彇娑�");
+      });
+};
+// 鍒犻櫎
+const handleDelete = () => {
+  let ids = [];
+  if (selectedRows.value.length > 0) {
+    // 妫�鏌ユ槸鍚︽湁浠栦汉缁存姢鐨勬暟鎹�
+    const unauthorizedData = selectedRows.value.filter(item => item.maintainUserName !== userStore.nickName);
+    if (unauthorizedData.length > 0) {
+      proxy.$modal.msgWarning("涓嶅彲鍒犻櫎浠栦汉缁存姢鐨勬暟鎹�");
+      return;
+    }
+    ids = selectedRows.value.map((item) => item.id);
+  } else {
+    proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+    return;
+  }
+  ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
+    confirmButtonText: "纭",
+    cancelButtonText: "鍙栨秷",
+    type: "warning",
+  })
+      .then(() => {
+        tableLoading.value = true;
+        delSupplier(ids)
+            .then((res) => {
+              proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+              getList();
+            })
+            .finally(() => {
+              tableLoading.value = false;
+            });
+      })
+      .catch(() => {
+        proxy.$modal.msg("宸插彇娑�");
+      });
+};
+
+// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
+function getCurrentDate() {
+  const today = new Date();
+  const year = today.getFullYear();
+  const month = String(today.getMonth() + 1).padStart(2, "0"); // 鏈堜唤浠�0寮�濮�
+  const day = String(today.getDate()).padStart(2, "0");
+  return `${year}-${month}-${day}`;
+}
+
+onMounted(() => {
+  getList();
+});
 </script>
-<style>
 
-</style>
+<style scoped lang="scss"></style>

--
Gitblit v1.9.3