|
|
@@ -5,6 +5,20 @@
|
|
|
<el-form-item label="创建时间" prop="createTime">
|
|
|
<el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="changeTime"></el-date-picker>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="部门" prop="deptId">
|
|
|
+ <treeselect
|
|
|
+ v-model="queryParams.deptId"
|
|
|
+ :options="deptOptions"
|
|
|
+ :normalizer="normalizer"
|
|
|
+ :show-count="true"
|
|
|
+ clearable
|
|
|
+ placeholder="全公司(不选则统计全公司含子部门)"
|
|
|
+ style="width: 260px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="redPackageMoney != null && redPackageMoney !== ''">
|
|
|
+ <span class="readpkg-balance-tip">企业红包总余额:<b>¥{{ redPackageMoneyFormatted }}</b>(与部门筛选无关)</span>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
@@ -82,10 +96,10 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import SelectTree from "@/components/TreeSelect/index.vue";
|
|
|
-import TreeSelect from '@riophae/vue-treeselect'
|
|
|
+import Treeselect from '@riophae/vue-treeselect'
|
|
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
|
|
import {allList} from "@/api/company/company";
|
|
|
+import { treeselect } from '@/api/company/companyDept'
|
|
|
import { getReadPackageTotal, exportReadPackageTotal, recharge } from '@/api/course/courseRedPacketLog'
|
|
|
|
|
|
|
|
|
@@ -93,7 +107,7 @@ import { getReadPackageTotal, exportReadPackageTotal, recharge } from '@/api/cou
|
|
|
|
|
|
export default {
|
|
|
name: "FastgptEventLogTotal",
|
|
|
- components: {SelectTree,TreeSelect},
|
|
|
+ components: { Treeselect },
|
|
|
data() {
|
|
|
return {
|
|
|
createTime:this.getDefaultTimeRange(),
|
|
|
@@ -104,6 +118,10 @@ export default {
|
|
|
selectedCompanyList: [],
|
|
|
companyList:[],
|
|
|
deptList: [],
|
|
|
+ /** 企业部门树(与员工管理页同源 companyDept/treeselect) */
|
|
|
+ deptOptions: [],
|
|
|
+ /** 企业红包总余额,来自列表接口 response.ext.redPackageMoney,不受部门筛选影响 */
|
|
|
+ redPackageMoney: null,
|
|
|
companyUserList: [],
|
|
|
selectedAppKey: null,
|
|
|
selectedAppKeyLabel: '',
|
|
|
@@ -141,6 +159,8 @@ export default {
|
|
|
beginTime:null,
|
|
|
endTime:null,
|
|
|
appKey:null,
|
|
|
+ /** 可选;选中则统计该部门及子部门员工消耗,不传则全公司 */
|
|
|
+ deptId: null,
|
|
|
},
|
|
|
// 表单参数
|
|
|
form: {},
|
|
|
@@ -179,6 +199,7 @@ export default {
|
|
|
created() {
|
|
|
// 先获取公司列表
|
|
|
this.getAllCompany();
|
|
|
+ this.getTreeselect();
|
|
|
|
|
|
// 等待DOM更新后设置默认时间并获取数据
|
|
|
this.$nextTick(() => {
|
|
|
@@ -187,7 +208,30 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
|
|
|
+ computed: {
|
|
|
+ redPackageMoneyFormatted() {
|
|
|
+ const n = this.redPackageMoney
|
|
|
+ if (n === null || n === undefined || n === '') return '--'
|
|
|
+ return Number(n).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
methods: {
|
|
|
+ /** 查询部门下拉树(复用员工列表接口) */
|
|
|
+ getTreeselect() {
|
|
|
+ treeselect().then((response) => {
|
|
|
+ this.deptOptions = response.data || []
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 组装 GET 参数:无部门时不传 deptId */
|
|
|
+ buildReadPackageQuery() {
|
|
|
+ const params = { ...this.queryParams }
|
|
|
+ if (params.deptId == null || params.deptId === '') {
|
|
|
+ delete params.deptId
|
|
|
+ }
|
|
|
+ return params
|
|
|
+ },
|
|
|
// 获取默认时间范围(今天 00:00:00 - 23:59:59)
|
|
|
getDefaultTimeRange() {
|
|
|
const today = new Date();
|
|
|
@@ -250,10 +294,15 @@ export default {
|
|
|
getList() {
|
|
|
this.loading = true;
|
|
|
|
|
|
- getReadPackageTotal(this.queryParams).then(response => {
|
|
|
+ getReadPackageTotal(this.buildReadPackageQuery()).then(response => {
|
|
|
console.log(response)
|
|
|
this.fastGptPushTokenTotalList = response.rows;
|
|
|
this.total = response.total;
|
|
|
+ if (response.ext && response.ext.redPackageMoney != null) {
|
|
|
+ this.redPackageMoney = response.ext.redPackageMoney
|
|
|
+ }
|
|
|
+ this.loading = false;
|
|
|
+ }).catch(() => {
|
|
|
this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
@@ -312,6 +361,7 @@ export default {
|
|
|
this.selectedAppKeyLabel = '';
|
|
|
this.selectedCompanyList = [];
|
|
|
this.queryParams.appKey = null;
|
|
|
+ this.queryParams.deptId = null;
|
|
|
this.resetForm("queryForm");
|
|
|
this.handleQuery();
|
|
|
},
|
|
|
@@ -338,6 +388,9 @@ export default {
|
|
|
beginTime: this.queryParams.beginTime,
|
|
|
endTime: this.queryParams.endTime
|
|
|
};
|
|
|
+ if (this.queryParams.deptId != null && this.queryParams.deptId !== '') {
|
|
|
+ exportData.deptId = this.queryParams.deptId
|
|
|
+ }
|
|
|
exportReadPackageTotal(exportData)
|
|
|
.then(response => {
|
|
|
if (response && response.msg) this.download(response.msg);
|
|
|
@@ -400,3 +453,13 @@ export default {
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.readpkg-balance-tip {
|
|
|
+ font-size: 13px;
|
|
|
+ color: #606266;
|
|
|
+}
|
|
|
+.readpkg-balance-tip b {
|
|
|
+ color: #303133;
|
|
|
+}
|
|
|
+</style>
|