Compare commits

..

No commits in common. "ea61580c55dbc144392d135faeeb46e8f9bd1628" and "220d9d4fd8d3420df180154b8ab176fe7d4fda9d" have entirely different histories.

5 changed files with 36 additions and 269 deletions

View File

@ -13,60 +13,6 @@ const StockList = Mock.mock({
},
],
});
const ReceiptList = Mock.mock([
{
"list|20-30": [
{
"id|+1": 0,
billserial: "@integer(100000000,199999999)1",
proposer: "孙东宇",
billType: "@integer(0,4)",
receiptNum: "@integer(1,10)张",
receiptDate: "@date",
useInfo: "@csentence",
},
],
},
{
"list|20-30": [
{
"id|+1": 0,
billserial: "@integer(100000000,199999999)1",
proposer: "杨春宇",
billType: "@integer(0,4)",
receiptNum: "@integer(1,10)张",
receiptDate: "@date",
useInfo: "@csentence",
},
],
},
{
"list|20-30": [
{
"id|+1": 0,
billserial: "@integer(100000000,199999999)1",
proposer: "吕才卓",
billType: "@integer(0,4)",
receiptNum: "@integer(1,10)张",
receiptDate: "@date",
useInfo: "@csentence",
},
],
},
{
"list|20-30": [
{
"id|+1": 0,
billserial: "@integer(100000000,199999999)1",
proposer: "刘欣宇",
billType: "@integer(0,4)",
receiptNum: "@integer(1,10)张",
receiptDate: "@date",
useInfo: "@csentence",
},
],
},
]);
const personName = () => {
return [
@ -137,31 +83,4 @@ export default [
};
},
},
{
url: "/api/receiptList",
method: "post",
response: (req) => {
if (req.body.name === "孙东宇") {
return {
code: 200,
data: ReceiptList[0].list,
};
} else if (req.body.name === "杨春宇") {
return {
code: 200,
data: ReceiptList[1].list,
};
} else if (req.body.name === "吕才卓") {
return {
code: 200,
data: ReceiptList[2].list,
};
} else {
return {
code: 200,
data: ReceiptList[3].list,
};
}
},
},
];

View File

@ -2,8 +2,6 @@ import request from "@/utils/requestMock";
const API = {
PERSON_LIST: "/personName",
RECEIPT_LIST: "/receiptList",
};
export const reqPersonName = () => request.get(API.PERSON_LIST);
export const reqReceiptList = (data) => request.post(API.RECEIPT_LIST, data);

View File

@ -371,7 +371,7 @@ const headerQuery = () => {
if (
scarchData.value.billserial === "" &&
scarchData.value.billType === "" &&
scarchData.value.appleDate === ""
scarchData.value.stockDate === ""
) {
arrList = item;
}

View File

@ -35,28 +35,6 @@
maxlength="10"
></t-input>
</t-form-item>
<t-form-item label="领用时间:" name="receiptDate">
<t-date-picker v-model="scarchData.receiptDate" clearable />
</t-form-item>
<t-form-item
label="票据类型:"
name="billType"
style="margin-bottom: 0.3rem"
>
<t-select
v-model="scarchData.billType"
placeholder="请选择票据类型"
clearable
>
<t-option
v-for="item in billType"
:key="item.value"
:value="item.value"
:label="item.label"
></t-option>
</t-select>
</t-form-item>
</div>
<t-form-item style="margin-right: 1rem">
<t-button theme="primary" type="submit">查询</t-button>
@ -97,6 +75,32 @@
}}</span>
</div>
</template>
<template #approvalStatus="{ row }">
<div v-for="item in approvalStatus" :key="item">
<t-tag
v-if="row.approvalStatus === item.value"
:theme="tagColor(row.approvalStatus)"
variant="light"
>
{{ item.label }}
</t-tag>
</div>
</template>
<template #status="slotProps">
<t-button
theme="default"
variant="text"
size="small"
@click="Approve(slotProps)"
>
<span v-if="slotProps.row.approvalStatus === 0">{{
"审批"
}}</span>
<span v-if="slotProps.row.approvalStatus === 3">{{
"重新审批"
}}</span>
</t-button>
</template>
</t-base-table>
</t-content>
</t-layout>
@ -106,156 +110,35 @@
</template>
<script setup>
import { ref, onMounted, nextTick } from "vue";
import { ref, onMounted } from "vue";
import { MessagePlugin } from "tdesign-vue-next";
import { LoadIcon } from "tdesign-icons-vue-next";
import { useReceiptList } from "@/stores/billReceipt";
const receiptList = useReceiptList();
const personName = ref([]);
const tableData = ref([]);
const data = ref([]);
const columns = ref([
{
colKey: "serial-number",
title: "序号",
width: 50,
},
{
colKey: "billserial",
title: "票据编号",
align: "center",
width: 100,
},
{
colKey: "proposer",
title: "申请人",
align: "center",
width: 100,
},
{
colKey: "billType",
title: "票据类型",
align: "center",
width: 100,
},
{
colKey: "receiptNum",
title: "领用数量",
align: "center",
width: 100,
},
{
colKey: "receiptDate",
title: "领用时间",
align: "center",
width: 100,
},
{
colKey: "useInfo",
title: "用途",
ellipsis: true,
align: "center",
width: 200,
},
]);
//
const billType = ref([
{ label: "票据类型1", value: 0 },
{ label: "票据类型2", value: 1 },
{ label: "票据类型3", value: 2 },
{ label: "票据类型4", value: 3 },
{ label: "票据类型5", value: 4 },
]);
//
const scarchData = ref({
billserial: "",
});
//
const pagination = ref({
defaultCurrent: 1,
defaultPageSize: 10,
total: 50,
});
//
const personList = async () => {
personName.value = await receiptList.getPersonNameList();
console.log(personName.value);
};
//
const headerQuery = () => {
tableData.value = data.value;
console.log(
scarchData.value.billserial,
scarchData.value.billType,
scarchData.value.receiptDate
);
if (
scarchData.value.billserial === "" &&
(scarchData.value.billType === undefined ||
scarchData.value.billType === "") &&
(scarchData.value.receiptDate === undefined ||
scarchData.value.receiptDate === "")
) {
getNewTable();
} else {
const list = tableData.value.filter((item) => {
let arrList;
if (scarchData.value.billserial === item.billserial) {
arrList = item;
}
if (scarchData.value.billType === item.billType) {
arrList = item;
}
if (scarchData.value.receiptDate === item.receiptDate) {
arrList = item;
}
if (
scarchData.value.billserial === "" &&
scarchData.value.billType === "" &&
scarchData.value.receiptDate === ""
) {
arrList = item;
}
return arrList;
});
tableData.value = list;
pagination.value.total = list.length;
}
};
//
const resetting = () => {
scarchData.value = {
billserial: "",
billType: "",
receiptDate: "",
};
getNewTable();
};
const onClick = async (context) => {
const onClick = (context) => {
//
if (context.node.value === "t1") {
return;
}
//
tableData.value = await receiptList.getReceiptList({
name: context.node.label,
});
data.value = await receiptList.getReceiptList({
name: context.node.label,
});
pagination.value.total = tableData.value.length;
};
//
const refresh = () => {
getTableData();
console.info("onClick", context);
};
// menuManagement
const getPersonName = () => {
const getNewTable = () => {
let arr = JSON.parse(localStorage.getItem("ReceiptList"));
if (arr) {
personName.value = arr.personName;
@ -263,32 +146,9 @@ const getPersonName = () => {
personList();
}
};
// menuManagement
const getTableData = async () => {
let arr = JSON.parse(localStorage.getItem("ReceiptList"));
if (arr.receiptList.length > 0) {
tableData.value = arr.receiptList;
} else {
await nextTick();
//
const firstNodeWithChildren = personName.value.find(
(node) => Array.isArray(node.children) && node.children.length > 0
);
if (firstNodeWithChildren) {
const simulatedContext = {
node: {
label: "孙东宇",
},
};
onClick(simulatedContext);
}
}
};
onMounted(async () => {
getPersonName();
getTableData();
// personName
onMounted(() => {
getNewTable();
});
</script>

View File

@ -1,14 +1,10 @@
import { defineStore } from "pinia";
import {
reqPersonName,
reqReceiptList,
} from "@/api/finance-bill-manage/receiptList";
import { reqPersonName } from "@/api/finance-bill-manage/receiptList";
export const useReceiptList = defineStore("ReceiptList", {
state: () => {
return {
personName: [],
receiptList: [],
};
},
actions: {
@ -18,12 +14,6 @@ export const useReceiptList = defineStore("ReceiptList", {
console.log(this.personName);
return this.personName;
},
async getReceiptList(obj) {
const { data } = await reqReceiptList(obj);
this.receiptList = data;
return this.receiptList;
},
},
persist: true,
});