|
@@ -7,7 +7,7 @@
|
|
|
type="month"
|
|
|
placeholder="选择开始月份"
|
|
|
v-model="sourceList.pagination.beginTime"
|
|
|
- value-format="YYYY-MM"
|
|
|
+ value-format="YYYY-MM-01"
|
|
|
style="width: 100%"
|
|
|
@change="getList"></el-date-picker>
|
|
|
</el-col>
|
|
@@ -17,7 +17,7 @@
|
|
|
type="month"
|
|
|
placeholder="选择结束月份"
|
|
|
v-model="sourceList.pagination.endTime"
|
|
|
- value-format="YYYY-MM"
|
|
|
+ value-format="YYYY-MM-31"
|
|
|
style="width: 100%"
|
|
|
@change="getList"></el-date-picker>
|
|
|
</el-col>
|
|
@@ -37,9 +37,24 @@
|
|
|
</el-form>
|
|
|
|
|
|
<el-table :data="sourceList.data" style="width: 100%">
|
|
|
- <el-table-column prop="date" label="部门" width="180" />
|
|
|
- <el-table-column prop="name" label="Name" width="180" />
|
|
|
- <el-table-column prop="address" label="Address" />
|
|
|
+ <el-table-column prop="deptName" label="部门" width="180" />
|
|
|
+ <el-table-column v-for="(item, index) in monthList" :key="index" align="center" :label="item">
|
|
|
+ <el-table-column align="center" label="收入" width="120">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <span>{{ getMoney(row.accountRunningWaterVoList, item, "incomeAmount") }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="支出" width="120">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <span>{{ getMoney(row.accountRunningWaterVoList, item, "expenditureAmount") }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="结余" width="120">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <span>{{ getMoney(row.accountRunningWaterVoList, item, "balanceAmount") }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -48,18 +63,19 @@
|
|
|
import { ref } from "vue";
|
|
|
import useUserStore from "@/store/modules/user";
|
|
|
import moment from "moment";
|
|
|
-import * as date from "@/utils/date.js";
|
|
|
+import { ElMessage } from "element-plus";
|
|
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
const deptList = ref([]);
|
|
|
+const monthList = ref([]);
|
|
|
const sourceList = ref({
|
|
|
data: [],
|
|
|
pagination: {
|
|
|
total: 0,
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
- beginTime: moment().format("yyyy") + '-01',
|
|
|
- endTime: moment().format("yyyy") + '-12',
|
|
|
+ beginTime: moment().format("yyyy") + "-01-01",
|
|
|
+ endTime: moment().format("yyyy") + "-12-31",
|
|
|
deptId: "",
|
|
|
},
|
|
|
});
|
|
@@ -68,6 +84,27 @@ const defaultProps = {
|
|
|
label: "deptName",
|
|
|
};
|
|
|
const loading = ref(false);
|
|
|
+const getMonthBetween = (start, end) => {
|
|
|
+ var result = [];
|
|
|
+ var s = start.split("-");
|
|
|
+ var e = end.split("-");
|
|
|
+ var min = new Date();
|
|
|
+ var max = new Date();
|
|
|
+ min.setFullYear(s[0], s[1]);
|
|
|
+ max.setFullYear(e[0], e[1]);
|
|
|
+ var curr = min;
|
|
|
+ while (curr <= max) {
|
|
|
+ var month = curr.getMonth();
|
|
|
+ var str = (month == 0 ? curr.getFullYear() - 1 : curr.getFullYear()) + "-" + (month == 0 ? 12 : month < 10 ? "0" + month : month);
|
|
|
+ var s = curr.getFullYear() + "-12";
|
|
|
+ if (str == s) {
|
|
|
+ str = curr.getFullYear() + "-12";
|
|
|
+ }
|
|
|
+ result.push(str);
|
|
|
+ curr.setMonth(month + 1);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+};
|
|
|
const getDict = () => {
|
|
|
proxy
|
|
|
.get("/tenantDept/list", {
|
|
@@ -80,10 +117,16 @@ const getDict = () => {
|
|
|
});
|
|
|
};
|
|
|
const getList = async () => {
|
|
|
+ if (!sourceList.value.pagination.beginTime) {
|
|
|
+ return ElMessage("请选择开始月份");
|
|
|
+ }
|
|
|
+ if (!sourceList.value.pagination.endTime) {
|
|
|
+ return ElMessage("请选择结束月份");
|
|
|
+ }
|
|
|
+ monthList.value = getMonthBetween(sourceList.value.pagination.beginTime.substring(0, 7), sourceList.value.pagination.endTime.substring(0, 7));
|
|
|
loading.value = true;
|
|
|
proxy.post("/accountDeptRunningWater/DeptRunningWaterReport", sourceList.value.pagination).then((res) => {
|
|
|
- sourceList.value.data = res.rows;
|
|
|
- sourceList.value.pagination.total = res.total;
|
|
|
+ sourceList.value.data = res;
|
|
|
setTimeout(() => {
|
|
|
loading.value = false;
|
|
|
}, 200);
|
|
@@ -91,6 +134,14 @@ const getList = async () => {
|
|
|
};
|
|
|
getDict();
|
|
|
getList();
|
|
|
+const getMoney = (list, time, key) => {
|
|
|
+ let text = 0;
|
|
|
+ let data = list.filter((item) => item.time === time);
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ text = data[0][key];
|
|
|
+ }
|
|
|
+ return text;
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|