|
@@ -15,42 +15,43 @@
|
|
|
/>
|
|
|
</template>
|
|
|
</tool-bar>
|
|
|
+ <template v-if="showTable">
|
|
|
+ <a-table
|
|
|
+ :columns="columns"
|
|
|
+ :data-source="list"
|
|
|
+ :pagination="tablePageOptions"
|
|
|
+ bordered
|
|
|
+ :loading="tableLoading"
|
|
|
+ :scroll="{ y: scrollY, x: 1000 }"
|
|
|
+ @change="handleTableChange"
|
|
|
+ rowKey="id"
|
|
|
+ >
|
|
|
+ <template #info="{ text, record }">
|
|
|
+ <p @click="goAdlgroup(record.advertiser_id)">
|
|
|
+ <a href="javascript:;">广告主名:{{ record.advertiser_name }}</a>
|
|
|
+ </p>
|
|
|
+ <p @click="goAdlgroup(record.advertiser_id)">
|
|
|
+ <a href="javascript:;">广告主ID:{{ record.advertiser_id }}</a>
|
|
|
+ </p>
|
|
|
+ </template>
|
|
|
|
|
|
- <a-table
|
|
|
- :columns="columns"
|
|
|
- :data-source="list"
|
|
|
- :pagination="tablePageOptions"
|
|
|
- bordered
|
|
|
- :scroll="{ y: 700, x: 1000 }"
|
|
|
- @change="handleTableChange"
|
|
|
- rowKey="id"
|
|
|
- >
|
|
|
- <template #info="{ text, record }">
|
|
|
- <p @click="goAdlgroup(record.advertiser_id)">
|
|
|
- <a href="javascript:;">广告主名:{{ record.advertiser_name }}</a>
|
|
|
- </p>
|
|
|
- <p @click="goAdlgroup(record.advertiser_id)">
|
|
|
- <a href="javascript:;">广告主ID:{{ record.advertiser_id }}</a>
|
|
|
- </p>
|
|
|
- </template>
|
|
|
-
|
|
|
- <template #budget="{ text, record }">
|
|
|
- <editable-cell
|
|
|
- :text="
|
|
|
- record.budget_mode == 'BUDGET_MODE_INFINITE'
|
|
|
- ? '不限'
|
|
|
- : record.budget
|
|
|
- "
|
|
|
- title="预算"
|
|
|
- :minValue="1000"
|
|
|
- :muliteType="true"
|
|
|
- customTitle="不限"
|
|
|
- customValue="不限"
|
|
|
- @change="(val) => onCellChange(record, 'budget', val)"
|
|
|
- />
|
|
|
- </template>
|
|
|
- </a-table>
|
|
|
-
|
|
|
+ <template #budget="{ text, record }">
|
|
|
+ <editable-cell
|
|
|
+ :text="
|
|
|
+ record.budget_mode == 'BUDGET_MODE_INFINITE'
|
|
|
+ ? '不限'
|
|
|
+ : record.budget
|
|
|
+ "
|
|
|
+ title="预算"
|
|
|
+ :minValue="1000"
|
|
|
+ :muliteType="true"
|
|
|
+ customTitle="不限"
|
|
|
+ customValue="不限"
|
|
|
+ @change="(val) => onCellChange(record, 'budget', val)"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </a-table>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
@@ -60,7 +61,12 @@ import ToolBar from "@/components/tool-bar/index.vue";
|
|
|
import moment from "moment";
|
|
|
import useApp from "@/hooks/useApp";
|
|
|
import { AdCoundCloumn } from "../_pageOptions/table-put";
|
|
|
-import { getAdgroupData, setGroupStatus, setGroupDay } from "@/api";
|
|
|
+import {
|
|
|
+ getAdgroupData,
|
|
|
+ setGroupStatus,
|
|
|
+ setGroupDay,
|
|
|
+ ALLAcountGroupData,
|
|
|
+} from "@/api";
|
|
|
import usePagination from "@/hooks/usePagination";
|
|
|
import EditableCell from "@/components/edit-cell/index.vue";
|
|
|
import { AdgroupList, PageOptions } from "@/types/api";
|
|
@@ -80,9 +86,13 @@ const Adgroup = defineComponent({
|
|
|
list: ref<AdgroupList[]>([]),
|
|
|
rangePick: picker,
|
|
|
pickered: [moment().subtract(30, "d"), moment()],
|
|
|
- columns: AdCoundCloumn,
|
|
|
+ columns: ref<any[]>([]),
|
|
|
fields: {},
|
|
|
+ tableLoading:false,
|
|
|
cost_order: 0,
|
|
|
+ balance_order: 0,
|
|
|
+ showTable: false,
|
|
|
+ scrollY: 600,
|
|
|
});
|
|
|
|
|
|
const onSearch = (fields: Record<string, string>) => {
|
|
@@ -97,6 +107,7 @@ const Adgroup = defineComponent({
|
|
|
account_id?: string;
|
|
|
}) => {
|
|
|
try {
|
|
|
+ state.tableLoading = true;
|
|
|
loading.value = true;
|
|
|
let [begin_dates, end_dates] = state.pickered;
|
|
|
let begin_date, end_date;
|
|
@@ -104,28 +115,47 @@ const Adgroup = defineComponent({
|
|
|
begin_date = moment(begin_dates).format("YYYY-MM-DD");
|
|
|
end_date = moment(end_dates).format("YYYY-MM-DD");
|
|
|
}
|
|
|
-
|
|
|
- const { data } = await getAdgroupData(
|
|
|
- Object.assign(
|
|
|
- {
|
|
|
- begin_date,
|
|
|
- end_date,
|
|
|
- advertiser_id: query?.advertiser_id,
|
|
|
- account_id: query?.account_id,
|
|
|
- page: query?.current ?? 1,
|
|
|
- },
|
|
|
- state.cost_order ? { cost_order: state.cost_order } : {}
|
|
|
- )
|
|
|
+ let datas = Object.assign(
|
|
|
+ {
|
|
|
+ begin_date,
|
|
|
+ end_date,
|
|
|
+ advertiser_id: query?.advertiser_id,
|
|
|
+ account_id: query?.account_id,
|
|
|
+ page: query?.current ?? 1,
|
|
|
+ },
|
|
|
+ state.cost_order ? { cost_order: state.cost_order } : {},
|
|
|
+ state.balance_order ? { balance_order: state.balance_order } : {}
|
|
|
);
|
|
|
+ const { data } = await getAdgroupData(datas);
|
|
|
+ const { data: totals } = await ALLAcountGroupData(datas);
|
|
|
+
|
|
|
+ let mainCloumn = AdCoundCloumn.map((r) => {
|
|
|
+ if (r.dataIndex != "firle" && r.dataIndex !== "campaign_name") {
|
|
|
+ r.children = [
|
|
|
+ {
|
|
|
+ title: totals[r.dataIndex],
|
|
|
+ dataIndex: r.dataIndex,
|
|
|
+ width: r.width,
|
|
|
+ ellipsis: true,
|
|
|
+ sorter:
|
|
|
+ r.dataIndex === "cost" || r.dataIndex === "balance"
|
|
|
+ ? true
|
|
|
+ : false,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ return r;
|
|
|
+ });
|
|
|
+ state.columns = mainCloumn;
|
|
|
state.list = data.list;
|
|
|
meta.value = data.meta;
|
|
|
} catch (error) {
|
|
|
console.log("on get books list error");
|
|
|
} finally {
|
|
|
state.inSearching = false;
|
|
|
+ state.tableLoading = false;
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
const setSateSwitch = (val: string, name: string) => {
|
|
|
switch (val) {
|
|
|
case "ascend":
|
|
@@ -138,26 +168,26 @@ const Adgroup = defineComponent({
|
|
|
(state as any)[name] = 0;
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
const handleTableChange = (
|
|
|
pagination: PageOptions,
|
|
|
filters: any,
|
|
|
sorter: any
|
|
|
) => {
|
|
|
+ console.log(sorter.columnKey);
|
|
|
if (sorter.columnKey == "cost") {
|
|
|
setSateSwitch(sorter.order, "cost_order");
|
|
|
}
|
|
|
+ if (sorter.columnKey == "balance") {
|
|
|
+ setSateSwitch(sorter.order, "balance_order");
|
|
|
+ }
|
|
|
const { current, pageSize, total } = pagination;
|
|
|
let data = Object.assign({ current, ...state.fields });
|
|
|
getData(data);
|
|
|
};
|
|
|
-
|
|
|
const goAdlgroup = (id: string) => {
|
|
|
router.push({ path: "/put/datas/group", query: { advertiser_id: id } });
|
|
|
};
|
|
|
-
|
|
|
onMounted(getData);
|
|
|
-
|
|
|
return {
|
|
|
...toRefs(state),
|
|
|
loading,
|
|
@@ -167,6 +197,12 @@ const Adgroup = defineComponent({
|
|
|
goAdlgroup,
|
|
|
};
|
|
|
},
|
|
|
+ mounted() {
|
|
|
+ let winHeight =
|
|
|
+ document.documentElement.clientHeight || document.body.clientHeight;
|
|
|
+ this.scrollY = winHeight - 237;
|
|
|
+ this.showTable = true;
|
|
|
+ },
|
|
|
methods: {
|
|
|
moment,
|
|
|
onCellChange(record: any, dataIndex: string, value: string) {
|