|
@@ -48,83 +48,6 @@
|
|
:key="item.label" sortable v-bind="item" />
|
|
:key="item.label" sortable v-bind="item" />
|
|
</template>
|
|
</template>
|
|
</el-table>
|
|
</el-table>
|
|
- <div class="flex-b">
|
|
|
|
- <div v-if="contentConfig.moneyTotal">
|
|
|
|
- <div class="flex" v-if="contentConfig.moneyTotalType === false">
|
|
|
|
- <div class="footSlotStyle mr10">小计:</div>
|
|
|
|
- <div class="footSlotStyle mr20" v-if="!contentConfig.customSubtotal">
|
|
|
|
- 数量 {{ subNumber || 0 }}
|
|
|
|
- 张
|
|
|
|
- </div>
|
|
|
|
- <div class="footSlotStyle mr20" v-else>数量 {{ subtotalNum || 0 }}</div>
|
|
|
|
- <slot name="subtotalSlot"></slot>
|
|
|
|
- </div>
|
|
|
|
- <div v-else class="flex">
|
|
|
|
- <div class="footSlotStyle mr10">小计:</div>
|
|
|
|
- <div class="footSlotStyle mr20" v-if="!contentConfig.customSubtotal">
|
|
|
|
- 费用金额 {{ subtotal || 0 }}元
|
|
|
|
- </div>
|
|
|
|
- <div class="footSlotStyle mr20" v-else>费用金额 {{ subtotalNum || 0 }}元</div>
|
|
|
|
- <slot name="subtotalSlot"></slot>
|
|
|
|
- </div>
|
|
|
|
- <div v-if="contentConfig.moneyTotalType === false" class="flex">
|
|
|
|
- <div class="footSlotStyle mr10">总计:</div>
|
|
|
|
- <div class="footSlotStyle mr20">数量 {{ resDate.moneyTotal || 0 }} 张</div>
|
|
|
|
- <slot name="totalSlot"></slot>
|
|
|
|
- </div>
|
|
|
|
- <div v-else class="flex">
|
|
|
|
- <div class="footSlotStyle mr10">总计:</div>
|
|
|
|
- <div class="footSlotStyle mr20">费用金额 {{ resDate.moneyTotal || 0 }} 元</div>
|
|
|
|
- <slot name="totalSlot"></slot>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- <div v-else-if="contentConfig.energyMonery">
|
|
|
|
- <div class="flex">
|
|
|
|
- <div class="footSlotStyle mr10">小计:</div>
|
|
|
|
- <div class="footSlotStyle mr20 energyClass">
|
|
|
|
- <div class="itemName">电:{{ electricity || 0 }}</div>
|
|
|
|
- <div class="itemName">水:{{ water || 0 }}</div>
|
|
|
|
- <div class="itemName">气:{{ gas || 0 }}</div>
|
|
|
|
- </div>
|
|
|
|
- <slot name="subtotalSlot"></slot>
|
|
|
|
- </div>
|
|
|
|
- <div class="flex">
|
|
|
|
- <div class="footSlotStyle mr10">总计:</div>
|
|
|
|
- <div class="footSlotStyle mr20 energyClass">
|
|
|
|
- <div class="itemName">电:{{ electricityTotalPrice || 0 }}</div>
|
|
|
|
- <div class="itemName">水:{{ waterTotalPrice || 0 }}</div>
|
|
|
|
- <div class="itemName">气:{{ gasTotalPrice || 0 }}</div>
|
|
|
|
- </div>
|
|
|
|
- <slot name="totalSlot"></slot>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- <!-- 其他/能耗费用计算 -->
|
|
|
|
- <div style="width: 60%;" v-else-if="contentConfig.energyConsumption">
|
|
|
|
- <div class="flex" v-if="contentConfig.energyConsumptionType === false">
|
|
|
|
- <div class="footSlotStyle mr10">能耗总量:</div>
|
|
|
|
- <div class="footSlotStyle mr20 energyClass">
|
|
|
|
- <div class="itemName" v-for="(item, index) in rowDate.value" :key="index">{{ item.energyName
|
|
|
|
- }}:{{
|
|
|
|
- item.dosage || 0 }}
|
|
|
|
- </div>
|
|
|
|
-
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- <div class="flex" v-else>
|
|
|
|
- <div class="footSlotStyle mr10">能耗总量:</div>
|
|
|
|
- <div class="footSlotStyle mr20 energyClass">
|
|
|
|
- <div class="itemName">电:{{ electricityDosage || 0 }}</div>
|
|
|
|
- <div class="itemName">水:{{ waterDosage || 0 }}</div>
|
|
|
|
- <div class="itemName">气:{{ gasDosage || 0 }}</div>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- <div class="flex" v-else></div>
|
|
|
|
- <el-pagination class="mt10" v-model:current-page="systemStore.pageInfo.pageNum"
|
|
|
|
- v-model:page-size="systemStore.pageInfo.pageSize" :page-sizes="sizes" :small="false" :disabled="false"
|
|
|
|
- :background="true" layout="total, sizes, prev, pager, next, jumper" :total="pageTotalCount"
|
|
|
|
- @size-change="onPageSizeChange" @current-change="onPageChange" />
|
|
|
|
- </div>
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -134,9 +57,6 @@ import { parseTime } from '@/utils/ruoyi';
|
|
import useUserStore from '@/store/modules/user';
|
|
import useUserStore from '@/store/modules/user';
|
|
const userStore = useUserStore().userInfo.userName === 'admin' ? '' : useUserStore().userInfo.userId;
|
|
const userStore = useUserStore().userInfo.userName === 'admin' ? '' : useUserStore().userInfo.userId;
|
|
import { ref, watch } from 'vue';
|
|
import { ref, watch } from 'vue';
|
|
-// import { ElTable } from 'element-plus';
|
|
|
|
-import { useSharedValueStore } from './sharedValueStore';
|
|
|
|
-
|
|
|
|
const props = withDefaults(
|
|
const props = withDefaults(
|
|
defineProps<{
|
|
defineProps<{
|
|
contentConfig: {
|
|
contentConfig: {
|
|
@@ -172,18 +92,10 @@ const loading = ref(true);
|
|
|
|
|
|
// 请求数据
|
|
// 请求数据
|
|
const systemStore = useSystemStore();
|
|
const systemStore = useSystemStore();
|
|
-// const pageNum = ref(1);
|
|
|
|
-// const pageSize = ref(10);
|
|
|
|
-
|
|
|
|
-const sharedValueStore = useSharedValueStore();
|
|
|
|
-const sharedValue = computed(() => sharedValueStore.sharedValue);
|
|
|
|
|
|
|
|
// 获取列表
|
|
// 获取列表
|
|
async function fetchPageListData(queryInfo: any = {}) {
|
|
async function fetchPageListData(queryInfo: any = {}) {
|
|
loading.value = true;
|
|
loading.value = true;
|
|
- // const pageNumber = pageNum.value;
|
|
|
|
- // const pageSizeValue = pageSize.value;
|
|
|
|
- // 2.发生网络请求
|
|
|
|
await systemStore
|
|
await systemStore
|
|
.getPageListDataAction(props.contentConfig.pageName, {
|
|
.getPageListDataAction(props.contentConfig.pageName, {
|
|
pageNum: systemStore.pageInfo.pageNum,
|
|
pageNum: systemStore.pageInfo.pageNum,
|
|
@@ -203,16 +115,12 @@ async function fetchPageListData(queryInfo: any = {}) {
|
|
fetchPageListData();
|
|
fetchPageListData();
|
|
systemStore.$onAction(arg => {
|
|
systemStore.$onAction(arg => {
|
|
if (arg.name === 'newPageDataAction' || arg.name === 'deletePageDataAction') {
|
|
if (arg.name === 'newPageDataAction' || arg.name === 'deletePageDataAction') {
|
|
- // pageNum.value = 1;
|
|
|
|
- // pageSize.value = 10;
|
|
|
|
systemStore.pageInfo.pageNum = 1;
|
|
systemStore.pageInfo.pageNum = 1;
|
|
systemStore.pageInfo.pageSize = 50;
|
|
systemStore.pageInfo.pageSize = 50;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
-// 2.展示数据
|
|
|
|
const { pageList, pageTotalCount, resDate } = storeToRefs(systemStore);
|
|
const { pageList, pageTotalCount, resDate } = storeToRefs(systemStore);
|
|
-// 监听列表数据变化清空选择器
|
|
|
|
const multipleTableRef = ref();
|
|
const multipleTableRef = ref();
|
|
let subtotal = ref(0 as any);
|
|
let subtotal = ref(0 as any);
|
|
let subNumber = ref(0 as any);
|
|
let subNumber = ref(0 as any);
|
|
@@ -252,12 +160,7 @@ watch(
|
|
subtotal.value = 0;
|
|
subtotal.value = 0;
|
|
subNumber.value = 0;
|
|
subNumber.value = 0;
|
|
}
|
|
}
|
|
- // 控制是否清空所选项
|
|
|
|
clearFlag.value = true;
|
|
clearFlag.value = true;
|
|
- // pageList.value.forEach((item: any) => {
|
|
|
|
- // subtotal.value += item.moneyTotal;
|
|
|
|
- // });
|
|
|
|
- // subtotal.value = Number(subtotal.value.toFixed(2)).toFixed(2);
|
|
|
|
},
|
|
},
|
|
{ deep: true }
|
|
{ deep: true }
|
|
);
|
|
);
|
|
@@ -268,100 +171,17 @@ const getRowKeys = row => {
|
|
return row.checkId;
|
|
return row.checkId;
|
|
};
|
|
};
|
|
|
|
|
|
-const echoWay = async () => {
|
|
|
|
- await pageList.value.forEach((row: any) => {
|
|
|
|
- if (selectedItems.value!.indexOf(row.checkId) >= 0) {
|
|
|
|
- multipleTableRef.value!.toggleRowSelection(row, true);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- // console.log(selectedItems.value);
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
// 清空多选
|
|
// 清空多选
|
|
function clearSelection() {
|
|
function clearSelection() {
|
|
if (pageList) {
|
|
if (pageList) {
|
|
multipleTableRef.value!.clearSelection();
|
|
multipleTableRef.value!.clearSelection();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-const water = ref();
|
|
|
|
-const electricity = ref();
|
|
|
|
-const gas = ref();
|
|
|
|
// 多选框切换
|
|
// 多选框切换
|
|
function handleSelectionChange(e: any) {
|
|
function handleSelectionChange(e: any) {
|
|
emit('handleSelect', e);
|
|
emit('handleSelect', e);
|
|
- if (props.contentConfig.energyMonery) {
|
|
|
|
- water.value = 0;
|
|
|
|
- electricity.value = 0;
|
|
|
|
- gas.value = 0;
|
|
|
|
- e.forEach(item => {
|
|
|
|
- if (item.energyType == '水') {
|
|
|
|
- let waters = item.moneyTotal * 100; // 将金额转换为分;
|
|
|
|
- water.value += waters;
|
|
|
|
- } else if (item.energyType == '电') {
|
|
|
|
- let electricitys = item.moneyTotal * 100; // 将金额转换为分;
|
|
|
|
- electricity.value += electricitys;
|
|
|
|
- } else if (item.energyType == '气') {
|
|
|
|
- let gase = item.moneyTotal * 100; // 将金额转换为分;
|
|
|
|
- gas.value += gase;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- water.value = (water.value / 100).toFixed(2);
|
|
|
|
- electricity.value = (electricity.value / 100).toFixed(2);
|
|
|
|
- gas.value = (gas.value / 100).toFixed(2);
|
|
|
|
- console.log('zheshi', water.value, electricity.value, gas.value);
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- subtotal.value = 0;
|
|
|
|
- subNumber.value = 0;
|
|
|
|
- selectedItems.value = [];
|
|
|
|
- e.forEach(item => {
|
|
|
|
- subNumber.value += item.moneyTotal;
|
|
|
|
- let moneyTotalInCents = item.moneyTotal * 100; // 将金额转换为分
|
|
|
|
- subtotal.value += moneyTotalInCents;
|
|
|
|
- selectedItems.value.push(item.checkId);
|
|
|
|
- });
|
|
|
|
- subtotal.value = (subtotal.value / 100).toFixed(2);
|
|
|
|
- // selectedItems.value = e.map(item => {
|
|
|
|
- // console.log(item.moneyTotal);
|
|
|
|
- // subtotal.value += item.moneyTotal;
|
|
|
|
- // return item.checkId;
|
|
|
|
- // });
|
|
|
|
- // console.log(subtotal.value);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-// 页码变化
|
|
|
|
-async function onPageSizeChange(size: number) {
|
|
|
|
- // 每页条数改变函数
|
|
|
|
- // pageSize.value = size;
|
|
|
|
- // pageNum.value = 1;
|
|
|
|
- systemStore.pageInfo.pageSize = size;
|
|
|
|
- systemStore.pageInfo.pageNum = 1;
|
|
|
|
- // 控制是否清空所选项
|
|
|
|
- clearFlag.value = false;
|
|
|
|
- await fetchPageListData();
|
|
|
|
- // 恢复选中状态
|
|
|
|
- // await echoWay();
|
|
|
|
-}
|
|
|
|
-async function onPageChange(current: number) {
|
|
|
|
- // 页码改变函数
|
|
|
|
- systemStore.pageInfo.pageNum = current;
|
|
|
|
- systemStore.pageInfo.pageNum = current;
|
|
|
|
- // 控制是否清空所选项
|
|
|
|
- clearFlag.value = false;
|
|
|
|
- await fetchPageListData();
|
|
|
|
- // 恢复选中状态
|
|
|
|
- // await echoWay();
|
|
|
|
-}
|
|
|
|
-watch(
|
|
|
|
- () => sharedValueStore.pageNum,
|
|
|
|
- (newVal, oldVal) => {
|
|
|
|
- // pageNum.value = 1;
|
|
|
|
- systemStore.pageInfo.pageNum = 1;
|
|
|
|
- },
|
|
|
|
- { deep: true }
|
|
|
|
-);
|
|
|
|
// 暴露函数
|
|
// 暴露函数
|
|
defineExpose({
|
|
defineExpose({
|
|
clearSelection,
|
|
clearSelection,
|