|
@@ -3,7 +3,7 @@
|
|
<el-card class="mt8" shadow="never" :body-style="{ paddingBottom: '0' }">
|
|
<el-card class="mt8" shadow="never" :body-style="{ paddingBottom: '0' }">
|
|
<el-form :inline="true" @submit.stop.prevent>
|
|
<el-form :inline="true" @submit.stop.prevent>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-select lable="选择项目" v-model="state.uploadFilter.ProjectId" value-key="id" clearable>
|
|
|
|
|
|
+ <el-select placeholder="选择项目" v-model="state.uploadFilter.ProjectId" value-key="id" clearable>
|
|
<el-option v-for="item in state.uploadProjectList" :key="item.id" :label="item.name"
|
|
<el-option v-for="item in state.uploadProjectList" :key="item.id" :label="item.name"
|
|
:value="item.id"></el-option>
|
|
:value="item.id"></el-option>
|
|
</el-select>
|
|
</el-select>
|
|
@@ -13,7 +13,7 @@
|
|
:data="{ ProjectId: state.uploadFilter.ProjectId }"
|
|
:data="{ ProjectId: state.uploadFilter.ProjectId }"
|
|
:show-file-list="false" :before-upload="OnUploadStatBefore" :on-success="onUploadStatSuccess"
|
|
:show-file-list="false" :before-upload="OnUploadStatBefore" :on-success="onUploadStatSuccess"
|
|
:on-error="onUploadStatError" accept=".xlsx">
|
|
:on-error="onUploadStatError" accept=".xlsx">
|
|
- <el-button type="primary" icon="ele-Upload"> 导入每日统计 </el-button>
|
|
|
|
|
|
+ <el-button :loading="state.LinkLoading" type="primary" icon="ele-Upload"> 导入每日统计 </el-button>
|
|
</el-upload>
|
|
</el-upload>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
@@ -22,27 +22,27 @@
|
|
<el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" @click="onSettle"> 结算 </el-button>
|
|
<el-button type="primary" @click="onSettle"> 结算 </el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <!-- <el-form-item>
|
|
|
|
- <el-button type="primary" icon="ele-Download" @click="onDownExcel"> 导出项目统计模板 </el-button>
|
|
|
|
- </el-form-item> -->
|
|
|
|
|
|
+ <el-form-item>
|
|
|
|
+ <el-button type="primary" icon="ele-Download" @click="onDownExcel"> 导出项目统计模板 </el-button>
|
|
|
|
+ </el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
</el-card>
|
|
</el-card>
|
|
<el-card class="mt8" shadow="never" :body-style="{ paddingBottom: '0' }">
|
|
<el-card class="mt8" shadow="never" :body-style="{ paddingBottom: '0' }">
|
|
<el-form :inline="true" @submit.stop.prevent>
|
|
<el-form :inline="true" @submit.stop.prevent>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-select lable="选择项目" v-model="state.filter.projectId" value-key="id" clearable>
|
|
|
|
|
|
+ <el-select placeholder="选择搜索项目" v-model="state.filter.projectId" value-key="id" clearable>
|
|
<el-option v-for="item in state.uploadProjectList" :key="item.id" :label="item.name"
|
|
<el-option v-for="item in state.uploadProjectList" :key="item.id" :label="item.name"
|
|
:value="item.id"></el-option>
|
|
:value="item.id"></el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-select lable="选择平台" v-model="state.filter.tenantId" value-key="id" clearable>
|
|
|
|
- <el-option v-for="item in state.uploadProjectList" :key="item.id" :label="item.name"
|
|
|
|
|
|
+ <el-select placeholder="选择平台" v-model="state.filter.tenantId" value-key="id" clearable>
|
|
|
|
+ <el-option v-for="item in state.queryTenantList" :key="item.id" :label="item.name"
|
|
:value="item.id"></el-option>
|
|
:value="item.id"></el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-select lable="选择结算状态" v-model="state.filter.isSettele" clearable>
|
|
|
|
|
|
+ <el-select placeholder="选择结算状态" v-model="state.filter.isSettele" clearable>
|
|
<el-option label="已结算" value="1"></el-option>
|
|
<el-option label="已结算" value="1"></el-option>
|
|
<el-option label="未结算" value="0"></el-option>
|
|
<el-option label="未结算" value="0"></el-option>
|
|
</el-select>
|
|
</el-select>
|
|
@@ -86,9 +86,11 @@
|
|
</template>
|
|
</template>
|
|
<script lang="ts" setup name="admin/projectlink">
|
|
<script lang="ts" setup name="admin/projectlink">
|
|
import { onMounted, computed, reactive, onBeforeMount, getCurrentInstance } from 'vue'
|
|
import { onMounted, computed, reactive, onBeforeMount, getCurrentInstance } from 'vue'
|
|
-import { PageInputProjectStatManagePageInput, ProjectStatManagePageOutput, ProjectSelectOutput } from '/@/api/admin/data-contracts'
|
|
|
|
|
|
+import { PageInputProjectStatManagePageInput, ProjectStatManagePageOutput, ProjectSelectOutput, TenantSelectListOutput } from '/@/api/admin/data-contracts'
|
|
|
|
+import { formatPast } from '/@/utils/formatTime'
|
|
import { ProjectStatApi } from '/@/api/admin/ProjectStat'
|
|
import { ProjectStatApi } from '/@/api/admin/ProjectStat'
|
|
import { ProjectApi } from '/@/api/admin/project'
|
|
import { ProjectApi } from '/@/api/admin/project'
|
|
|
|
+import { TenantApi } from '/@/api/admin/Tenant'
|
|
import pinia from '/@/stores/index'
|
|
import pinia from '/@/stores/index'
|
|
import { useUserInfo } from '/@/stores/userInfo'
|
|
import { useUserInfo } from '/@/stores/userInfo'
|
|
import eventBus from '/@/utils/mitt'
|
|
import eventBus from '/@/utils/mitt'
|
|
@@ -105,13 +107,13 @@ const state = reactive({
|
|
tenantFormTitle: '',
|
|
tenantFormTitle: '',
|
|
linkFormTitle: '',
|
|
linkFormTitle: '',
|
|
uploadFilter: {
|
|
uploadFilter: {
|
|
- ProjectId: 0,
|
|
|
|
|
|
+ ProjectId: '',
|
|
EffecDate: ''
|
|
EffecDate: ''
|
|
},
|
|
},
|
|
filter: {
|
|
filter: {
|
|
- projectId: 0,
|
|
|
|
- tenantId: 0,
|
|
|
|
- isSettele: -1,
|
|
|
|
|
|
+ projectId: '',
|
|
|
|
+ tenantId: '',
|
|
|
|
+ isSettele: '',
|
|
effectDate: ''
|
|
effectDate: ''
|
|
},
|
|
},
|
|
pageInput: {
|
|
pageInput: {
|
|
@@ -122,11 +124,13 @@ const state = reactive({
|
|
listData: [] as Array<ProjectStatManagePageOutput>,
|
|
listData: [] as Array<ProjectStatManagePageOutput>,
|
|
uploadProjectList: [] as Array<ProjectSelectOutput>,
|
|
uploadProjectList: [] as Array<ProjectSelectOutput>,
|
|
queryProjectList: [] as Array<ProjectSelectOutput>,
|
|
queryProjectList: [] as Array<ProjectSelectOutput>,
|
|
|
|
+ queryTenantList: [] as Array<TenantSelectListOutput>,
|
|
LinkLoading: false,
|
|
LinkLoading: false,
|
|
token: storesUserInfo.getToken()
|
|
token: storesUserInfo.getToken()
|
|
})
|
|
})
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
onProjects();
|
|
onProjects();
|
|
|
|
+ onTenants();
|
|
onQuery()
|
|
onQuery()
|
|
eventBus.off('refreshProjectStat')
|
|
eventBus.off('refreshProjectStat')
|
|
eventBus.on('refreshProjectStat', async () => {
|
|
eventBus.on('refreshProjectStat', async () => {
|
|
@@ -140,7 +144,12 @@ onBeforeMount(() => {
|
|
//查询
|
|
//查询
|
|
const onQuery = async () => {
|
|
const onQuery = async () => {
|
|
state.loading = true
|
|
state.loading = true
|
|
- state.pageInput.filter = state.filter
|
|
|
|
|
|
+ state.pageInput.filter = state.filter;
|
|
|
|
+ if (state.filter.effectDate != '') {
|
|
|
|
+ state.pageInput.filter.effectDate = formatPast(new Date(state.filter.effectDate), 'YYYY-mm-dd');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
const res = await new ProjectStatApi().getPageManage(state.pageInput).catch(() => {
|
|
const res = await new ProjectStatApi().getPageManage(state.pageInput).catch(() => {
|
|
state.loading = false
|
|
state.loading = false
|
|
})
|
|
})
|
|
@@ -157,6 +166,14 @@ const onProjects = async () => {
|
|
state.uploadProjectList = res?.data ?? []
|
|
state.uploadProjectList = res?.data ?? []
|
|
state.queryProjectList = res?.data ?? []
|
|
state.queryProjectList = res?.data ?? []
|
|
}
|
|
}
|
|
|
|
+//平台列表
|
|
|
|
+const onTenants = async () => {
|
|
|
|
+ let input: any = {}
|
|
|
|
+ const res = await new TenantApi().getAll(input).catch(() => {
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ state.queryTenantList = res?.data ?? []
|
|
|
|
+}
|
|
//导入项目统计
|
|
//导入项目统计
|
|
// 上传项目统计请求url
|
|
// 上传项目统计请求url
|
|
const StatAction = computed(() => {
|
|
const StatAction = computed(() => {
|
|
@@ -169,13 +186,12 @@ const StatHeaders = computed(() => {
|
|
// 上传项目统计成功
|
|
// 上传项目统计成功
|
|
const onUploadStatSuccess = (res: AxiosResponse) => {
|
|
const onUploadStatSuccess = (res: AxiosResponse) => {
|
|
state.LinkLoading = false
|
|
state.LinkLoading = false
|
|
- if (!res?.success) {
|
|
|
|
|
|
+ if (!res?.success) {
|
|
if (res.msg) {
|
|
if (res.msg) {
|
|
proxy.$modal.msgError(res.msg)
|
|
proxy.$modal.msgError(res.msg)
|
|
- }
|
|
|
|
- return
|
|
|
|
- } else {
|
|
|
|
- eventBus.off('refreshProjectStat')
|
|
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ eventBus.emit('refreshProjectStat')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 上传项目统计失败
|
|
// 上传项目统计失败
|
|
@@ -193,7 +209,7 @@ const onUploadStatError = (error: any) => {
|
|
}
|
|
}
|
|
//上传项目统计前
|
|
//上传项目统计前
|
|
const OnUploadStatBefore = () => {
|
|
const OnUploadStatBefore = () => {
|
|
- if (state.uploadFilter.ProjectId <= 0) {
|
|
|
|
|
|
+ if (state.uploadFilter.ProjectId === '') {
|
|
proxy.$modal.msgError("请选择项目");
|
|
proxy.$modal.msgError("请选择项目");
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
@@ -202,10 +218,22 @@ const OnUploadStatBefore = () => {
|
|
}
|
|
}
|
|
//结算
|
|
//结算
|
|
const onSettle = async () => {
|
|
const onSettle = async () => {
|
|
|
|
+ if (state.uploadFilter.ProjectId == '') {
|
|
|
|
+ proxy.$modal.msgError("请选择项目");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (state.uploadFilter.EffecDate == '') {
|
|
|
|
+ proxy.$modal.msgError("请选择结算日期");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
proxy.$modal
|
|
proxy.$modal
|
|
.confirm(`请确认是否结算`)
|
|
.confirm(`请确认是否结算`)
|
|
- .then(async () => {
|
|
|
|
- const res = await new ProjectStatApi().Settle(state.uploadFilter, { loading: true }).catch(() => {
|
|
|
|
|
|
+ .then(async () => {
|
|
|
|
+ let EffecDate = formatPast(new Date(state.uploadFilter.EffecDate), 'YYYYmmdd');
|
|
|
|
+ const res = await new ProjectStatApi().Settle({
|
|
|
|
+ ProjectId: state.uploadFilter.ProjectId,
|
|
|
|
+ EffecDate:EffecDate
|
|
|
|
+ }, { loading: true }).catch(() => {
|
|
proxy.$modal.closeLoading()
|
|
proxy.$modal.closeLoading()
|
|
})
|
|
})
|
|
if (res?.success) {
|
|
if (res?.success) {
|
|
@@ -215,5 +243,10 @@ const onSettle = async () => {
|
|
})
|
|
})
|
|
.catch(() => { })
|
|
.catch(() => { })
|
|
}
|
|
}
|
|
|
|
+// 导出项目统计模板
|
|
|
|
+const onDownExcel = () => {
|
|
|
|
+ let url = import.meta.env.VITE_API_URL + '/stat/项目统计模板.xlsx'
|
|
|
|
+ window.open(url, '_self');
|
|
|
|
+}
|
|
|
|
|
|
</script>
|
|
</script>
|