From 80367ddf4383493729420bb62aa8c8ebb9616dd9 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期日, 04 一月 2026 16:54:04 +0800
Subject: [PATCH] 代码调整9

---
 src/views/contractor/assets/index.vue |  864 +++++++++++++++++----------------------------------------
 1 files changed, 264 insertions(+), 600 deletions(-)

diff --git a/src/views/contractor/assets/index.vue b/src/views/contractor/assets/index.vue
index ad8a641..d4072a9 100644
--- a/src/views/contractor/assets/index.vue
+++ b/src/views/contractor/assets/index.vue
@@ -1,637 +1,301 @@
 <template>
   <div class="app-container">
-    <el-form
-      :model="queryParams"
-      ref="queryRef"
-      :inline="true"
-      v-show="showSearch"
-      label-width="90px"
-    >
-      <el-form-item label="璧勪骇鍚嶇О" prop="assetName">
+    <el-form :model="filters" :inline="true">
+      <el-form-item label="椤圭洰鍚嶇О">
         <el-input
-          v-model="queryParams.assetName"
-          placeholder="璇疯緭鍏ヨ祫浜у悕绉�"
-          clearable
-          style="width: 220px"
-          @keyup.enter="handleQuery"
+            v-model="filters.deviceName"
+            style="width: 240px"
+            placeholder="璇疯緭鍏ラ」鐩悕绉�"
+            clearable
+            :prefix-icon="Search"
+            @change="getTableData"
         />
       </el-form-item>
-      <el-form-item label="璧勪骇缂栧彿" prop="assetCode">
+      <el-form-item label="鍚堝悓缂栧彿">
         <el-input
-          v-model="queryParams.assetCode"
-          placeholder="璇疯緭鍏ヨ祫浜х紪鍙�"
-          clearable
-          style="width: 240px"
-          @keyup.enter="handleQuery"
+            v-model="filters.deviceModel"
+            style="width: 240px"
+            placeholder="璇疯緭鍏ュ悎鍚岀紪鍙�"
+            clearable
+            :prefix-icon="Search"
+            @change="getTableData"
         />
       </el-form-item>
-      <el-form-item label="鎵�灞炴壙鍖呭晢" prop="contractorId">
-        <el-select
-          v-model="queryParams.contractorId"
-          placeholder="璇烽�夋嫨鎵垮寘鍟�"
-          clearable
-          style="width: 240px"
-        >
-          <el-option
-            v-for="contractor in contractorOptions"
-            :key="contractor.contractorId"
-            :label="contractor.contractorName"
-            :value="contractor.contractorId"
-          />
-        </el-select>
-      </el-form-item>
-      <el-form-item label="璧勪骇鐘舵��" prop="status">
-        <el-select
-          v-model="queryParams.status"
-          placeholder="璧勪骇鐘舵��"
-          clearable
-          style="width: 240px"
-        >
-          <el-option
-            v-for="dict in asset_status"
-            :key="dict.value"
-            :label="dict.label"
-            :value="dict.value"
-          />
-        </el-select>
+      <el-form-item label="褰曞叆鏃ユ湡:">
+        <el-date-picker v-model="filters.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange"
+                        placeholder="璇烽�夋嫨" clearable @change="changeDaterange" />
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" icon="Search" @click="handleQuery"
-          >鎼滅储</el-button
-        >
-        <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button>
+        <el-button type="primary" @click="getTableData">鎼滅储</el-button>
+        <el-button @click="resetFilters">閲嶇疆</el-button>
       </el-form-item>
     </el-form>
-
-    <el-row :gutter="10" class="mb8">
-      <el-col :span="1.5">
-        <el-button
-          type="primary"
-          plain
-          icon="Plus"
-          @click="handleAdd"
-          >鏂板</el-button
-        >
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="success"
-          plain
-          icon="Edit"
-          :disabled="single"
-          @click="handleUpdate"
-          >淇敼</el-button
-        >
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="danger"
-          plain
-          icon="Delete"
-          :disabled="multiple"
-          @click="handleDelete"
-          >鍒犻櫎</el-button
-        >
-      </el-col>
-      <right-toolbar
-        v-model:showSearch="showSearch"
-        @queryTable="getList"
-        :columns="columns"
-      ></right-toolbar>
-    </el-row>
-
-    <el-table
-      v-loading="loading"
-      :data="assetList"
-      @selection-change="handleSelectionChange"
-      stripe
-    >
-      <el-table-column type="selection" width="50" align="center" />
-      <el-table-column
-        label="璧勪骇缂栧彿"
-        align="center"
-        key="assetId"
-        prop="assetId"
-        v-if="columns[0].visible"
-      />
-      <el-table-column
-        label="璧勪骇鍚嶇О"
-        align="center"
-        key="assetName"
-        prop="assetName"
-        v-if="columns[1].visible"
-        :show-overflow-tooltip="true"
-      />
-      <el-table-column
-        label="璧勪骇缂栧彿"
-        align="center"
-        key="assetCode"
-        prop="assetCode"
-        v-if="columns[2].visible"
-      />
-      <el-table-column
-        label="鎵�灞炴壙鍖呭晢"
-        align="center"
-        key="contractorName"
-        prop="contractorName"
-        v-if="columns[3].visible"
-        :show-overflow-tooltip="true"
-      />
-      <el-table-column
-        label="璧勪骇绫诲瀷"
-        align="center"
-        key="assetType"
-        prop="assetType"
-        v-if="columns[4].visible"
-      >
-        <template #default="scope">
-          {{ getAssetTypeLabel(scope.row.assetType) }}
-        </template>
-      </el-table-column>
-      <el-table-column
-        label="璧勪骇浠峰��"
-        align="center"
-        key="assetValue"
-        prop="assetValue"
-        v-if="columns[5].visible"
-      >
-        <template #default="scope">
-          {{ scope.row.assetValue.toFixed(2) }}
-        </template>
-      </el-table-column>
-      <el-table-column
-        label="鐘舵��"
-        align="center"
-        key="status"
-        v-if="columns[6].visible"
-      >
-        <template #default="scope">
-          <el-switch
-            v-model="scope.row.status"
-            active-value="0"
-            inactive-value="1"
-            @change="handleStatusChange(scope.row)"
-          ></el-switch>
-        </template>
-      </el-table-column>
-      <el-table-column
-        label="鍒涘缓鏃堕棿"
-        align="center"
-        prop="createTime"
-        v-if="columns[7].visible"
-        width="160"
-      >
-        <template #default="scope">
-          <span>{{ parseTime(scope.row.createTime) }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column
-        label="鎿嶄綔"
-        align="center"
-        width="150"
-        class-name="small-padding fixed-width"
-      >
-        <template #default="scope">
-          <el-tooltip
-            content="淇敼"
-            placement="top"
-          >
-            <el-button
-              link
-              type="primary"
-              icon="Edit"
-              @click="handleUpdate(scope.row)"
-            ></el-button>
-          </el-tooltip>
-          <el-tooltip
-            content="鍒犻櫎"
-            placement="top"
-          >
-            <el-button
-              link
-              type="primary"
+    <div class="table_list">
+      <div class="actions">
+        <div></div>
+        <div>
+          <el-button type="primary" @click="add" icon="Plus"> 鏂板 </el-button>
+          <el-button
+              type="danger"
               icon="Delete"
-              @click="handleDelete(scope.row)"
-            ></el-button>
-          </el-tooltip>
-        </template>
-      </el-table-column>
-    </el-table>
-    <pagination
-      v-show="total > 0"
-      :total="total"
-      v-model:page="queryParams.pageNum"
-      v-model:limit="queryParams.pageSize"
-      @pagination="getList"
-    />
-
-    <!-- 娣诲姞鎴栦慨鏀硅祫浜ч厤缃璇濇 -->
-    <el-dialog :title="title" v-model="open" width="600px" append-to-body>
-      <el-form :model="form" :rules="rules" ref="assetRef" label-width="80px">
-        <el-row>
-          <el-col :span="12">
-            <el-form-item label="璧勪骇鍚嶇О" prop="assetName">
-              <el-input
-                v-model="form.assetName"
-                placeholder="璇疯緭鍏ヨ祫浜у悕绉�"
-                maxlength="50"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="璧勪骇缂栧彿" prop="assetCode">
-              <el-input
-                v-model="form.assetCode"
-                placeholder="璇疯緭鍏ヨ祫浜х紪鍙�"
-                maxlength="20"
-              />
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="12">
-            <el-form-item label="鎵�灞炴壙鍖呭晢" prop="contractorId">
-              <el-select
-                v-model="form.contractorId"
-                placeholder="璇烽�夋嫨鎵垮寘鍟�"
-                clearable
-              >
-                <el-option
-                  v-for="contractor in contractorOptions"
-                  :key="contractor.contractorId"
-                  :label="contractor.contractorName"
-                  :value="contractor.contractorId"
-                />
-              </el-select>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="璧勪骇绫诲瀷" prop="assetType">
-              <el-select
-                v-model="form.assetType"
-                placeholder="璇烽�夋嫨璧勪骇绫诲瀷"
-                clearable
-              >
-                <el-option
-                  v-for="type in asset_types"
-                  :key="type.value"
-                  :label="type.label"
-                  :value="type.value"
-                />
-              </el-select>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="12">
-            <el-form-item label="璧勪骇浠峰��" prop="assetValue">
-              <el-input
-                v-model="form.assetValue"
-                placeholder="璇疯緭鍏ヨ祫浜т环鍊�"
-                type="number"
-                step="0.01"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="鐘舵��">
-              <el-radio-group v-model="form.status">
-                <el-radio
-                  v-for="dict in sys_normal_disable"
-                  :key="dict.value"
-                  :value="dict.value"
-                  >{{ dict.label }}</el-radio
-                >
-              </el-radio-group>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="24">
-            <el-form-item label="澶囨敞">
-              <el-input
-                v-model="form.remark"
-                type="textarea"
-                placeholder="璇疯緭鍏ュ唴瀹�"
-              ></el-input>
-            </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="cancel">鍙� 娑�</el-button>
+              :disabled="multipleList.length <= 0"
+              @click="deleteRow(multipleList.map((item) => item.id))"
+          >
+            鎵归噺鍒犻櫎
+          </el-button>
         </div>
-      </template>
+      </div>
+      <PIMTable
+          rowKey="id"
+          isSelection
+          :column="columns"
+          :tableData="dataList"
+          :page="{
+          current: pagination.currentPage,
+          size: pagination.pageSize,
+          total: pagination.total,
+        }"
+          :isShowSummary="true"
+          :summaryMethod="summaryMethod"
+          @selection-change="handleSelectionChange"
+          @pagination="changePage"
+      >
+      </PIMTable>
+    </div>
+    <Modal ref="modalRef" @success="getTableData"></Modal>
+    <el-dialog v-model="qrDialogVisible" title="浜岀淮鐮�" width="300px">
+      <div style="text-align:center;">
+        <img :src="qrCodeUrl" alt="浜岀淮鐮�" style="width:200px;height:200px;" />
+        <div style="margin:10px 0;">
+          <el-button type="primary" @click="downloadQRCode">涓嬭浇浜岀淮鐮佸浘鐗�</el-button>
+        </div>
+      </div>
     </el-dialog>
   </div>
 </template>
 
-<script setup name="ContractorAssets">
-import { ref, reactive, toRefs, watch, onMounted } from 'vue';
-import { ElMessage } from 'element-plus';
-import { parseTime } from '@/utils/ruoyi';
+<script setup>
+import { usePaginationApi } from "@/hooks/usePaginationApi";
+import { getLedgerPage, delLedger } from "@/api/equipmentManagement/ledger";
+import { onMounted, getCurrentInstance } from "vue";
+import Modal from "./Modal.vue";
+import { ElMessageBox, ElMessage } from "element-plus";
+import dayjs from "dayjs";
+import QRCode from "qrcode";
+import { ref } from "vue";
+import { summarizeTable } from "@/utils/summarizeTable";
+import {Search} from "@element-plus/icons-vue";
 
-const assetList = ref([]);
-const open = ref(false);
-const loading = ref(true);
-const showSearch = ref(true);
-const ids = ref([]);
-const single = ref(true);
-const multiple = ref(true);
-const total = ref(0);
-const title = ref("");
-
-// 鍒楁樉闅愪俊鎭�
-const columns = ref([
-  { key: 0, label: `璧勪骇缂栧彿`, visible: true },
-  { key: 1, label: `璧勪骇鍚嶇О`, visible: true },
-  { key: 2, label: `璧勪骇缂栧彿`, visible: true },
-  { key: 3, label: `鎵�灞炴壙鍖呭晢`, visible: true },
-  { key: 4, label: `璧勪骇绫诲瀷`, visible: true },
-  { key: 5, label: `璧勪骇浠峰�糮, visible: true },
-  { key: 6, label: `鐘舵�乣, visible: true },
-  { key: 7, label: `鍒涘缓鏃堕棿`, visible: true },
-]);
-
-const data = reactive({
-  form: {
-    assetId: undefined,
-    assetName: undefined,
-    assetCode: undefined,
-    contractorId: undefined,
-    contractorName: undefined,
-    assetType: undefined,
-    assetValue: 0,
-    status: "0",
-    remark: undefined,
-  },
-  queryParams: {
-    pageNum: 1,
-    pageSize: 10,
-    assetName: undefined,
-    assetCode: undefined,
-    contractorId: undefined,
-    status: undefined,
-  },
-  rules: {
-    assetName: [
-      { required: true, message: "璧勪骇鍚嶇О涓嶈兘涓虹┖", trigger: "blur" },
-    ],
-    assetCode: [
-      { required: true, message: "璧勪骇缂栧彿涓嶈兘涓虹┖", trigger: "blur" },
-    ],
-    contractorId: [
-      { required: true, message: "鎵�灞炴壙鍖呭晢涓嶈兘涓虹┖", trigger: "blur" },
-    ],
-    assetType: [
-      { required: true, message: "璧勪骇绫诲瀷涓嶈兘涓虹┖", trigger: "blur" },
-    ],
-    assetValue: [
-      { required: true, message: "璧勪骇浠峰�间笉鑳戒负绌�", trigger: "blur" },
-      { type: "number", message: "璇疯緭鍏ユ纭殑鏁板瓧", trigger: "blur" },
-    ],
-  },
+defineOptions({
+  name: "璁惧鍙拌处",
 });
 
-const { queryParams, form, rules } = toRefs(data);
+// 琛ㄦ牸澶氶�夋閫変腑椤�
+const multipleList = ref([]);
+const { proxy } = getCurrentInstance();
+const modalRef = ref();
+const qrDialogVisible = ref(false);
+const qrCodeUrl = ref("");
+const qrRowData = ref(null);
 
-// 妯℃嫙鎵垮寘鍟嗘暟鎹�
-const contractorOptions = ref([
-  { contractorId: 1, contractorName: "鍖椾含寤哄伐闆嗗洟" },
-  { contractorId: 2, contractorName: "涓婃捣鍩庡缓闆嗗洟" },
-  { contractorId: 3, contractorName: "骞垮窞寤虹瓚闆嗗洟" },
-  { contractorId: 4, contractorName: "娣卞湷寤哄伐闆嗗洟" },
-  { contractorId: 5, contractorName: "鏉窞寤哄伐闆嗗洟" },
-]);
+const {
+  filters,
+  columns,
+  dataList,
+  pagination,
+  getTableData,
+  resetFilters,
+  onCurrentChange,
+} = usePaginationApi(
+    getLedgerPage,
+    {
+      deviceName: undefined,
+      deviceModel: undefined,
+      supplierName: undefined,
+      unit: undefined,
+      entryDateStart: undefined,
+      entryDateEnd: undefined,
+    },
+    [
+      {
+        label: "椤圭洰鍚嶇О",
+        align: "center",
+        prop: "deviceName",
+      },
+      {
+        label: "鍚堝悓缂栧彿",
+        align: "center",
+        prop: "deviceModel",
+      },
+      {
+        label: "鎵垮寘鍟�",
+        align: "center",
+        prop: "supplierName",
+      },
+      {
+        label: "浠樻鏂瑰紡",
+        align: "center",
+        prop: "unit",
+      },
+      {
+        label: "鏁伴噺",
+        align: "center",
+        prop: "number",
+      },
+      {
+        label: "鍚◣鍗曚环",
+        align: "center",
+        prop: "taxIncludingPriceUnit",
+      },
+      {
+        label: "鍚◣鎬讳环",
+        align: "center",
+        prop: "taxIncludingPriceTotal",
+      },
+      {
+        label: "绋庣巼",
+        align: "center",
+        prop: "taxRate",
+      },
+      {
+        label: "涓嶅惈绋庢�讳环",
+        align: "center",
+        prop: "unTaxIncludingPriceTotal",
+      },
+      {
+        label: "褰曞叆浜�",
+        align: "center",
+        prop: "createUser",
+      },
+      {
+        label: "褰曞叆鏃ユ湡",
+        align: "center",
+        prop: "createTime",
+      },
+      {
+        dataType: "action",
+        label: "鎿嶄綔",
+        align: "center",
+        fixed: 'right',
+        width: 140,
+        operation: [
+          {
+            name: "缂栬緫",
+            type: "text",
+            clickFun: (row) => {
+              edit(row.id)
+            },
+          },
+        ],
+      },
+    ]
+);
 
-// 璧勪骇绫诲瀷瀛楀吀
-const asset_types = ref([
-  { value: "equipment", label: "璁惧" },
-  { value: "material", label: "鏉愭枡" },
-  { value: "vehicle", label: "杞﹁締" },
-  { value: "tool", label: "宸ュ叿" },
-  { value: "other", label: "鍏朵粬" },
-]);
+// 澶氶�夊悗鍋氫粈涔�
+const handleSelectionChange = (selectionList) => {
+  multipleList.value = selectionList;
+};
 
-// 璧勪骇鐘舵�佸瓧鍏�
-const asset_status = ref([
-  { value: "0", label: "姝e父" },
-  { value: "1", label: "绂佺敤" },
-  { value: "2", label: "缁翠慨涓�" },
-  { value: "3", label: "宸叉姤搴�" },
-]);
+const add = () => {
+  modalRef.value.openModal();
+};
+const edit = (id) => {
+  modalRef.value.loadForm(id);
+};
+const changePage = ({ page, limit }) => {
+  pagination.currentPage = page;
+  pagination.pageSize = limit;
+  onCurrentChange(page);
+};
 
-// 姝e父绂佺敤瀛楀吀
-const sys_normal_disable = ref([
-  { value: "0", label: "姝e父" },
-  { value: "1", label: "绂佺敤" },
-]);
+// 鍚堣鏂规硶
+const summaryMethod = (param) => {
+  return summarizeTable(
+      param,
+      ['number', 'taxIncludingPriceTotal', 'unTaxIncludingPriceTotal', 'taxIncludingPriceUnit'],
+      {
+        number: { noDecimal: true },
+        taxIncludingPriceTotal: { decimalPlaces: 2 },
+        unTaxIncludingPriceTotal: { decimalPlaces: 2 }
+      }
+  );
+};
 
-// 妯℃嫙璧勪骇鏁版嵁
-const mockAssets = ref([
-  {
-    assetId: 1,
-    assetName: "鎸栨帢鏈�",
-    assetCode: "ASSET001",
-    contractorId: 1,
-    contractorName: "鍖椾含寤哄伐闆嗗洟",
-    assetType: "equipment",
-    assetValue: 500000.00,
-    status: "0",
-    createTime: "2024-01-01 10:00:00",
-    remark: "澶у瀷鎸栨帢鏈�",
-  },
-  {
-    assetId: 2,
-    assetName: "娣峰嚌鍦熸悈鎷屾満",
-    assetCode: "ASSET002",
-    contractorId: 2,
-    contractorName: "涓婃捣鍩庡缓闆嗗洟",
-    assetType: "equipment",
-    assetValue: 150000.00,
-    status: "0",
-    createTime: "2024-01-02 10:00:00",
-    remark: "娣峰嚌鍦熸悈鎷岃澶�",
-  },
-  {
-    assetId: 3,
-    assetName: "瑁呰浇鏈�",
-    assetCode: "ASSET003",
-    contractorId: 3,
-    contractorName: "骞垮窞寤虹瓚闆嗗洟",
-    assetType: "equipment",
-    assetValue: 300000.00,
-    status: "1",
-    createTime: "2024-01-03 10:00:00",
-    remark: "瑁呰浇鏈鸿澶�",
-  },
-  {
-    assetId: 4,
-    assetName: "杩愯緭鍗¤溅",
-    assetCode: "ASSET004",
-    contractorId: 4,
-    contractorName: "娣卞湷寤哄伐闆嗗洟",
-    assetType: "vehicle",
-    assetValue: 400000.00,
-    status: "0",
-    createTime: "2024-01-04 10:00:00",
-    remark: "閲嶅瀷杩愯緭鍗¤溅",
-  },
-  {
-    assetId: 5,
-    assetName: "閽㈢瓔鍒囨柇鏈�",
-    assetCode: "ASSET005",
-    contractorId: 5,
-    contractorName: "鏉窞寤哄伐闆嗗洟",
-    assetType: "tool",
-    assetValue: 20000.00,
-    status: "0",
-    createTime: "2024-01-05 10:00:00",
-    remark: "閽㈢瓔鍔犲伐璁惧",
-  },
-]);
-
-/** 鑾峰彇璧勪骇绫诲瀷鏍囩 */
-function getAssetTypeLabel(value) {
-  const type = asset_types.value.find(item => item.value === value);
-  return type ? type.label : value;
-}
-
-/** 鏌ヨ璧勪骇鍒楄〃 */
-function getList() {
-  loading.value = true;
-  // 妯℃嫙API璇锋眰寤惰繜
-  setTimeout(() => {
-    let data = [...mockAssets];
-    // 妯℃嫙鎼滅储杩囨护
-    if (queryParams.value.assetName) {
-      data = data.filter(item => item.assetName.includes(queryParams.value.assetName));
+const deleteRow = (id) => {
+  ElMessageBox.confirm("姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?", "鎻愮ず", {
+    confirmButtonText: "纭畾",
+    cancelButtonText: "鍙栨秷",
+    type: "warning",
+  }).then(async () => {
+    const { code } = await delLedger(id);
+    if (code == 200) {
+      ElMessage({
+        type: "success",
+        message: "鍒犻櫎鎴愬姛",
+      });
+      getTableData();
     }
-    if (queryParams.value.assetCode) {
-      data = data.filter(item => item.assetCode.includes(queryParams.value.assetCode));
-    }
-    if (queryParams.value.contractorId) {
-      data = data.filter(item => item.contractorId === queryParams.value.contractorId);
-    }
-    if (queryParams.value.status) {
-      data = data.filter(item => item.status === queryParams.value.status);
-    }
-    // 妯℃嫙鍒嗛〉
-    const start = (queryParams.value.pageNum - 1) * queryParams.value.pageSize;
-    const end = start + queryParams.value.pageSize;
-    assetList.value = data.slice(start, end);
-    total.value = data.length;
-    loading.value = false;
-  }, 500);
-}
-
-/** 鎼滅储鎸夐挳鎿嶄綔 */
-function handleQuery() {
-  queryParams.value.pageNum = 1;
-  getList();
-}
-
-/** 閲嶇疆鎸夐挳鎿嶄綔 */
-function resetQuery() {
-  Object.assign(queryParams.value, {
-    assetName: undefined,
-    assetCode: undefined,
-    contractorId: undefined,
-    status: undefined,
   });
-  handleQuery();
-}
+};
 
-/** 鍒犻櫎鎸夐挳鎿嶄綔 */
-function handleDelete(row) {
-  const assetIds = row.assetId || ids.value;
-  ElMessage.confirm(`鏄惁纭鍒犻櫎璧勪骇缂栧彿涓�"${assetIds}"鐨勬暟鎹」锛焋).then(() => {
-    // 妯℃嫙鍒犻櫎鎿嶄綔
-    ElMessage.success("鍒犻櫎鎴愬姛");
-    getList();
-  }).catch(() => {});
-}
-
-/** 鐘舵�佷慨鏀� */
-function handleStatusChange(row) {
-  let text = row.status === "0" ? "鍚敤" : "鍋滅敤";
-  ElMessage.confirm(`纭瑕�"${text}""${row.assetName}"璧勪骇鍚�?`).then(() => {
-    // 妯℃嫙鐘舵�佷慨鏀�
-    ElMessage.success(text + "鎴愬姛");
-    getList();
-  }).catch(() => {
-    row.status = row.status === "0" ? "1" : "0";
-  });
-}
-
-/** 閫夋嫨鏉℃暟  */
-function handleSelectionChange(selection) {
-  ids.value = selection.map((item) => item.assetId);
-  single.value = selection.length != 1;
-  multiple.value = !selection.length;
-}
-
-/** 閲嶇疆鎿嶄綔琛ㄥ崟 */
-function reset() {
-  form.value = {
-    assetId: undefined,
-    assetName: undefined,
-    assetCode: undefined,
-    contractorId: undefined,
-    contractorName: undefined,
-    assetType: undefined,
-    assetValue: 0,
-    status: "0",
-    remark: undefined,
-  };
-}
-
-/** 鍙栨秷鎸夐挳 */
-function cancel() {
-  open.value = false;
-  reset();
-}
-
-/** 鏂板鎸夐挳鎿嶄綔 */
-function handleAdd() {
-  reset();
-  open.value = true;
-  title.value = "娣诲姞璧勪骇";
-}
-
-/** 淇敼鎸夐挳鎿嶄綔 */
-function handleUpdate(row) {
-  reset();
-  const assetId = row.assetId || ids.value;
-  // 妯℃嫙鑾峰彇璇︽儏
-  const asset = mockAssets.find(item => item.assetId === assetId);
-  if (asset) {
-    form.value = { ...asset };
-    open.value = true;
-    title.value = "淇敼璧勪骇";
+const changeDaterange = (value) => {
+  if (value) {
+    filters.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
+    filters.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD");
+  } else {
+    filters.entryDateStart = undefined;
+    filters.entryDateEnd = undefined;
   }
-}
+  getTableData();
+};
 
-/** 鎻愪氦鎸夐挳 */
-function submitForm() {
-  // 妯℃嫙琛ㄥ崟楠岃瘉
-  const requiredFields = ['assetName', 'assetCode', 'contractorId', 'assetType', 'assetValue'];
-  const isInvalid = requiredFields.some(field => !form.value[field]);
+const handleOut = () => {
+  ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+    confirmButtonText: "纭",
+    cancelButtonText: "鍙栨秷",
+    type: "warning",
+  })
+      .then(() => {
+        proxy.download(`/device/ledger/export`, {}, "璁惧鍙拌处妗f.xlsx");
+      })
+      .catch(() => {
+        proxy.$modal.msg("宸插彇娑�");
+      });
+};
 
-  if (isInvalid) {
-    ElMessage.error("璇峰~鍐欏繀濉瓧娈�");
-    return;
-  }
+const showQRCode = async (row) => {
+  // 浣犲彲浠ヨ嚜瀹氫箟浜岀淮鐮佸唴瀹癸紝姣斿 row.id 鎴� row.deviceName
+  const qrContent = JSON.stringify(row); // 鎴� `${row.id}`
+  qrCodeUrl.value = await QRCode.toDataURL(qrContent);
+  qrRowData.value = row;
+  qrDialogVisible.value = true;
+};
 
-  // 妯℃嫙鎻愪氦鎿嶄綔
-  ElMessage.success(title.value === "娣诲姞璧勪骇" ? "鏂板鎴愬姛" : "淇敼鎴愬姛");
-  open.value = false;
-  getList();
-}
+const downloadQRCode = () => {
+  const a = document.createElement("a");
+  a.href = qrCodeUrl.value;
+  a.download = `${qrRowData.value.deviceName || "浜岀淮鐮�"}.png`;
+  a.click();
+};
 
 onMounted(() => {
-  getList();
+  filters.entryDate = [
+    dayjs().format("YYYY-MM-DD"),
+    dayjs().add(1, "day").format("YYYY-MM-DD"),
+  ]
+  filters.entryDateStart = dayjs().format("YYYY-MM-DD")
+  filters.entryDateEnd = dayjs().add(1, "day").format("YYYY-MM-DD")
+  getTableData();
 });
 </script>
+
+<style lang="scss" scoped>
+.table_list {
+  margin-top: unset;
+}
+.actions {
+  display: flex;
+  justify-content: space-between;
+  margin-bottom: 10px;
+}
+</style>

--
Gitblit v1.9.3