瀏覽代碼

1、新增单据解锁界面功能

MY 2 周之前
父節點
當前提交
e378776a34
共有 1 個文件被更改,包括 34 次插入3 次删除
  1. 34 3
      JLHWEB/src/views/baseinfo/unlockbill/index.vue

+ 34 - 3
JLHWEB/src/views/baseinfo/unlockbill/index.vue

@@ -2,7 +2,7 @@
   <div class="table-box">
     <LjVxeTable
       ref="VxeTableRef"
-      row-key="springid"
+      row-key="billcode"
       :columns="columns"
       :request-api="getData"
       :data-callback="dataCallback"
@@ -16,7 +16,7 @@
       <!-- 表格 header 按钮 -->
       <template #tableHeader>
         <el-button-group>
-          <el-button>解锁</el-button>
+          <el-button @click="handleUnLock">解锁</el-button>
         </el-button-group>
       </template>
     </LjVxeTable>
@@ -29,6 +29,9 @@ import { getLockBillList } from "@/api/modules/basicinfo";
 import { ColumnProps } from "@/components/LjVxeTable/interface";
 import { useI18n } from "vue-i18n";
 import { useAuthButtons } from "@/hooks/useAuthButtons";
+import { UnLockBill } from "@/api/modules/common";
+import { ElMessage, ElMessageBox } from "element-plus";
+import { getCurrentRecords } from "@/utils/index";
 
 const dwname = "web_lock_table";
 const tableProps = {
@@ -36,10 +39,11 @@ const tableProps = {
   editConfig: { trigger: "click", mode: "cell" }
 };
 
+const VxeTableRef = ref();
 const { t } = useI18n();
 const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
 const columns = ref<ColumnProps<any>[]>([
-  { type: "checkbox", width: 40, fixed: "left" },
+  // { type: "checkbox", width: 40, fixed: "left" },
   {
     field: "pid",
     title: "序",
@@ -119,6 +123,33 @@ const dataCallback = (data: any) => {
   };
 };
 
+const handleUnLock = () => {
+  const { curRecords } = getCurrentRecords(VxeTableRef.value);
+  if (!curRecords.length) {
+    ElMessage.warning(t("business.tips.mattress.records"));
+    return;
+  }
+  ElMessageBox.confirm("是否确定要解锁吗?", "询问", {
+    confirmButtonText: "是",
+    cancelButtonText: "否",
+    type: "warning"
+  })
+    .then(() => {
+      curRecords.forEach(element => {
+        UnLockBill(element).then(() => {
+          ElMessage.success("解锁成功!");
+          VxeTableRef?.value.refresh();
+        });
+      });
+    })
+    .catch(() => {
+      ElMessage({
+        type: "info",
+        message: "操作取消"
+      });
+    });
+};
+
 // 返回绑定的事件
 const tableEvents = {
   // "cell-dblclick": handleDBlClickTable