123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <template>
- <div class="performance">
- <div class="title-box">
- <h3>员工绩效</h3>
- </div>
- <div class="padding-box">
- <div class="search-box"></div>
- </div>
- </div>
- </template>
- <script lang="ts">
- import usePagination from "@/hooks/usePagination";
- import { defineComponent, reactive, toRefs, ref } from "vue";
- import { onBeforeRouteUpdate } from "vue-router";
- // import { TableColumnOfYuewen } from "../_pageOptions/table_yuewen";
- //getPromotionList
- import {
- getPromotionList,
- addPromotionLInk,
- updateReportConfig,
- deletePromotion,
- } from "@/api";
- import { message } from "ant-design-vue";
- const PutDataIndex = defineComponent({
- components: {},
- setup() {
- let { tablePageOptions } = usePagination();
- const formRef = ref();
- const state = reactive({
- search: {
- name: "", // 推广员名称
- days: "", // 自定义天数 1~30天 无默认
- months: "", // 自定义月数 默认一个月
- dateType: "month", // 按月查询month/按天查询date
- month_range: "", // 按月查询 月范围
- date_range: "", // 按天查询 日期范围
- },
- addLink: {
- channel_id: "", // 推广链接id
- channel_name: "", // 渠道名
- book_name: "", // 作品名
- },
- list: ref<any[]>([]),
- visible: false, // 添加派单链接dialog
- rateVisible: false, // 添加派单链接dialog
- drawerVisible: false,
- confirmLoading: false, // 提交链接loading
- // columns: TableColumnOfYuewen,
- rate: 0, // 设置回传配置
- channelId: "",
- loading: false,
- rules: {
- channel_id: [
- { required: true, message: "请输入推广链接ID", trigger: "change" },
- ],
- channel_name: [
- { required: true, message: "请输入渠道名", trigger: "change" },
- ],
- book_name: [
- { required: true, message: "请输入作品名", trigger: "change" },
- ],
- },
- });
- return { ...toRefs(state), formRef, tablePageOptions };
- },
- mounted() {
- this.getList({ current: 1 });
- },
- methods: {
- // 重置搜索条件
- resetSearch() {
- // this.search.book_name = "";
- // this.search.channel_name = "";
- // this.search.channel_id = "";
- },
- // 获取推广链接数据
- async getList(page?: any) {
- // this.loading = true;
- // let { data } = await getPromotionList({
- // page: page ? page.current : 1,
- // ...this.search,
- // });
- // this.loading = false;
- // this.list = data.list;
- },
- // 点击添加链接
- onAddLink() {
- this.addLink.channel_id = "";
- this.addLink.channel_name = "";
- this.addLink.book_name = "";
- this.visible = true;
- },
- // 确认增加派单链接
- async onEmitLink() {
- this.formRef.validate().then(() => {});
- if (!this.addLink.channel_name) return message.warn("请输入渠道名称");
- if (!this.addLink.channel_id) return message.warn("请输入链接ID");
- if (!this.addLink.book_name) return message.warn("请输入推广作品");
- try {
- await addPromotionLInk(this.addLink);
- message.success("新增成功");
- this.getList({ current: 1 });
- this.visible = false;
- } catch (err) {
- console.log("ERROR:", err);
- }
- },
- // 删除
- async onDelete(val: any) {
- try {
- await deletePromotion({ channel_id: val.channel_id });
- this.getList({ current: 1 });
- message.success("删除成功");
- } catch (err) {
- console.log(err);
- }
- },
- // 点击回传配置
- onRateConfig(val: any) {
- this.channelId = val.channel_id;
- this.rateVisible = true;
- this.rate = val.rate;
- },
- // 提交回传配置
- async onEmitRate() {
- if (this.rate > 100 || this.rate < 0)
- return message.error("回传比例应在0~100之间");
- if (parseInt(this.rate) !== parseFloat(this.rate))
- return message.warn("请输入整数");
- try {
- await updateReportConfig({
- channel_id: this.channelId,
- rate: this.rate,
- });
- message.success("修改成功");
- this.getList({ current: 1 });
- this.rateVisible = false;
- } catch (err) {
- console.log(err);
- }
- },
- // 查看注册用户
- openUserDrawer(val: any) {
- this.channelId = val.channel_id;
- this.drawerVisible = true;
- },
- },
- });
- export default PutDataIndex;
- </script>
- <style lang="scss" scoped>
- @import "@/assets/common-style/frame.scss";
- // .performance {
- // }
- </style>
|