Răsfoiți Sursa

已采购页面

lxf 1 an în urmă
părinte
comite
26b57627ee
1 a modificat fișierele cu 293 adăugiri și 0 ștergeri
  1. 293 0
      src/views/EHSD/procurement/purchasedEHSD/index.vue

+ 293 - 0
src/views/EHSD/procurement/purchasedEHSD/index.vue

@@ -0,0 +1,293 @@
+<template>
+  <div class="tenant">
+    <byTable
+      :source="sourceList.data"
+      :pagination="sourceList.pagination"
+      :config="config"
+      :loading="loading"
+      :selectConfig="selectConfig"
+      highlight-current-row
+      @get-list="getList">
+      <template #amount="{ item }">
+        <div>
+          <span style="padding-right: 4px">{{ item.currency }}</span>
+          <span>{{ moneyFormat(item.amount, 2) }}</span>
+        </div>
+      </template>
+    </byTable>
+  </div>
+</template>
+
+<script setup>
+import { computed, ref } from "vue";
+import byTable from "@/components/byTable/index";
+import { ElMessage, ElMessageBox } from "element-plus";
+
+const { proxy } = getCurrentInstance();
+const supplierList = ref([]);
+const status = ref([
+  {
+    label: "草稿",
+    value: 0,
+  },
+  {
+    label: "审批中",
+    value: 10,
+  },
+  {
+    label: "驳回",
+    value: 20,
+  },
+  {
+    label: "已采购",
+    value: 30,
+  },
+  {
+    label: "作废",
+    value: 88,
+  },
+  {
+    label: "终止",
+    value: 99,
+  },
+]);
+const payStatus = ref([
+  {
+    label: "未付款",
+    value: 0,
+  },
+  {
+    label: "部分付款",
+    value: 10,
+  },
+  {
+    label: "已付款",
+    value: 20,
+  },
+]);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+    keyword: "",
+    status: "",
+    payStatus: "",
+  },
+});
+const loading = ref(false);
+const selectConfig = computed(() => {
+  return [
+    {
+      label: "采购状态",
+      prop: "status",
+      data: status.value,
+    },
+    {
+      label: "付款状态",
+      prop: "payStatus",
+      data: payStatus.value,
+    },
+  ];
+});
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "采购单号",
+        prop: "code",
+        width: 180,
+      },
+    },
+    {
+      attrs: {
+        label: "供应商",
+        prop: "sellCorporationId",
+        "min-width": 220,
+      },
+      render(type) {
+        return proxy.dictValueLabel(type, supplierList.value);
+      },
+    },
+    {
+      attrs: {
+        label: "采购金额",
+        slot: "amount",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "版本号",
+        prop: "version",
+        width: 100,
+      },
+    },
+    {
+      attrs: {
+        label: "采购人",
+        prop: "userName",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "采购时间",
+        prop: "createTime",
+        width: 160,
+      },
+    },
+    {
+      attrs: {
+        label: "采购状态",
+        prop: "status",
+        width: 140,
+      },
+      render(type) {
+        return proxy.dictValueLabel(type, status.value);
+      },
+    },
+    {
+      attrs: {
+        label: "付款状态",
+        prop: "payStatus",
+        width: 140,
+      },
+      render(type) {
+        return proxy.dictValueLabel(type, payStatus.value);
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: 160,
+        align: "center",
+        fixed: "right",
+      },
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "打印",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              clickPrint(row);
+            },
+          },
+          row.status == 30
+            ? {
+                attrs: {
+                  label: "作废",
+                  type: "primary",
+                  text: true,
+                },
+                el: "button",
+                click() {
+                  ElMessageBox.confirm("此操作将作废该数据, 是否继续?", "提示", {
+                    confirmButtonText: "确定",
+                    cancelButtonText: "取消",
+                    type: "warning",
+                  }).then(() => {
+                    proxy
+                      .post("/ehsdPurchase/edit", {
+                        id: row.id,
+                        status: 88,
+                      })
+                      .then(() => {
+                        ElMessage({
+                          message: "作废成功",
+                          type: "success",
+                        });
+                        getList();
+                      });
+                  });
+                },
+              }
+            : {},
+          row.status == 30
+            ? {
+                attrs: {
+                  label: "终止",
+                  type: "primary",
+                  text: true,
+                },
+                el: "button",
+                click() {
+                  ElMessageBox.confirm("此操作将终止该数据, 是否继续?", "提示", {
+                    confirmButtonText: "确定",
+                    cancelButtonText: "取消",
+                    type: "warning",
+                  }).then(() => {
+                    proxy
+                      .post("/ehsdPurchase/edit", {
+                        id: row.id,
+                        status: 99,
+                      })
+                      .then(() => {
+                        ElMessage({
+                          message: "终止",
+                          type: "success",
+                        });
+                        getList();
+                      });
+                  });
+                },
+              }
+            : {},
+        ];
+      },
+    },
+  ];
+});
+const getDict = () => {
+  proxy.post("/supplierInfo/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    supplierList.value = res.rows.map((item) => {
+      return {
+        ...item,
+        label: item.name,
+        value: item.id,
+      };
+    });
+  });
+};
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy.post("/ehsdPurchase/page", sourceList.value.pagination).then((res) => {
+    console.log(res);
+    sourceList.value.data = res.rows;
+    sourceList.value.pagination.total = res.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
+getDict();
+getList();
+const clickPrint = (row) => {
+  console.log(row, "打印");
+};
+</script>
+
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+::v-deep(.el-input-number .el-input__inner) {
+  text-align: left;
+}
+.baseRow {
+  min-height: 24px;
+  border-top: 1px solid black;
+  border-left: 1px solid black;
+}
+.contentRow {
+  border-right: 1px solid black;
+  line-height: 24px;
+  padding-left: 4px;
+}
+</style>