zouyu
2 天以前 db42d47f5692ef64e5436c5a6d29dcb537b44596
src/views/equipmentManagement/calibration/index.vue
@@ -13,6 +13,17 @@
               style="width: 160px"
               @change="handleQuery"
            />
            <span class="search_title ml10">录入日期:</span>
            <el-date-picker
               v-model="searchForm.entryDate"
               value-format="YYYY-MM-DD"
               format="YYYY-MM-DD"
               type="date"
               placeholder="请选择"
               clearable
               style="width: 160px"
               @change="handleQuery"
            />
            <span class="search_title ml10">计量器具编号:</span>
            <el-input v-model="searchForm.code" placeholder="请输入编号" clearable style="width: 240px" @change="handleQuery"/>
<!--            <span class="search_title ml10">状态:</span>-->
@@ -23,6 +34,7 @@
            <el-button type="primary" @click="handleQuery" style="margin-left: 10px"
            >搜索</el-button
            >
            <el-button @click="handleReset" style="margin-left: 10px">重置</el-button>
         </div>
         <div>
            <el-button @click="handleOut">导出</el-button>
@@ -45,11 +57,11 @@
</template>
<script setup>
import {onMounted, ref} from "vue";
import {ElMessageBox} from "element-plus";
import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick} from "vue";
import {ElMessageBox, ElMessage} from "element-plus";
import useUserStore from "@/store/modules/user.js";
import CalibrationDia from "@/views/equipmentManagement/measurementEquipment/components/calibrationDia.vue";
import {ledgerRecordListPage} from "@/api/equipmentManagement/calibration.js";
import {ledgerRecordListPage, ledgerRecordDelete} from "@/api/equipmentManagement/calibration.js";
const { proxy } = getCurrentInstance();
const userStore = useUserStore()
@@ -57,7 +69,7 @@
   searchForm: {
      recordDate: "",
      code: "",
      status: "",
      entryDate: "",
   },
});
const { searchForm } = toRefs(data);
@@ -123,6 +135,7 @@
   {
      dataType: "action",
      label: "操作",
      width: 140,
      align: "center",
      fixed: 'right',
      operation: [
@@ -132,9 +145,16 @@
            clickFun: (row) => {
               openCalibrationDia("edit", row);
            },
            disabled: (row) => {
               return row.userId !== userStore.id
            }
         },
         {
            name: "删除",
            type: "text",
            style: {
               color: "#F56C6C"
            },
            clickFun: (row) => {
               handleDelete(row);
            },
         },
      ],
   },
@@ -160,6 +180,15 @@
   page.current = 1;
   getList();
};
// 重置搜索条件
const handleReset = () => {
   searchForm.value.recordDate = "";
   searchForm.value.entryDate = "";
   searchForm.value.code = "";
   page.current = 1;
   getList();
};
const pagination = (obj) => {
   page.current = obj.page;
   page.size = obj.limit;
@@ -183,6 +212,26 @@
   })
}
// 删除记录
const handleDelete = (row) => {
   ElMessageBox.confirm(`确认删除计量器具编号为"${row.code}"的检定记录吗?`, "删除确认", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
   })
      .then(() => {
         ledgerRecordDelete([row.id]).then(() => {
            ElMessage.success("删除成功");
            getList();
         }).catch(() => {
            ElMessage.error("删除失败");
         });
      })
      .catch(() => {
         proxy.$modal.msg("已取消删除");
      });
};
// 导出
const handleOut = () => {
   ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {