隐藏新增

This commit is contained in:
mkm 2023-08-19 09:37:33 +08:00
parent 39f6609b22
commit 8c6e79490a

View File

@ -1,38 +1,31 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form
class="mb-[-16px] formtabel"
:model="queryParams"
inline
label-width="100px"
>
<el-form-item label="区域经理" prop="create_user_id">
<el-input
class="w-[280px]"
v-model="queryParams.create_user_id"
clearable
placeholder="请输入区域经理"
/>
</el-form-item>
<el-form-item label="公司" prop="company_id">
<el-input
class="w-[280px]"
v-model="queryParams.company_id"
clearable
placeholder="请输入公司"
/>
</el-form-item>
<el-form-item>
<el-button class="el-btn" type="primary" @click="resetPage"
>查询</el-button
>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<el-button
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px] formtabel" :model="queryParams" inline label-width="100px">
<el-form-item label="区域经理" prop="create_user_id">
<el-input
class="w-[280px]"
v-model="queryParams.create_user_id"
clearable
placeholder="请输入区域经理"
/>
</el-form-item>
<el-form-item label="公司" prop="company_id">
<el-input
class="w-[280px]"
v-model="queryParams.company_id"
clearable
placeholder="请输入公司"
/>
</el-form-item>
<el-form-item>
<el-button class="el-btn" type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<!-- <el-button
v-perms="['task_scheduling.task_scheduling/add']"
type="primary"
@click="handleAdd"
@ -41,8 +34,8 @@
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<!--
</el-button> -->
<!--
<el-button
v-perms="['task_scheduling.task_scheduling/delete']"
:disabled="!selectData.length"
@ -50,191 +43,176 @@
>
删除
</el-button> -->
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column
label="区域经理"
prop="admin_name"
show-overflow-tooltip
/>
<el-table-column
label="公司"
prop="company_name"
show-overflow-tooltip
/>
<el-table-column
label="每日最大金额"
prop="money"
show-overflow-tooltip
/>
<el-table-column
label="公司类型"
prop="company_type_name"
show-overflow-tooltip
/>
<el-table-column
label="状态"
min-width="100"
v-perms="['task_scheduling.task_scheduling/edit']"
>
<template #default="{ row }">
<el-switch
v-model="row.status"
:active-value="1"
:inactive-value="0"
@change="changeStatus(row)"
/>
</template>
</el-table-column>
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="区域经理" prop="admin_name" show-overflow-tooltip />
<el-table-column label="公司" prop="company_name" show-overflow-tooltip />
<el-table-column label="每日最大金额" prop="money" show-overflow-tooltip />
<el-table-column
label="公司类型"
prop="company_type_name"
show-overflow-tooltip
/>
<el-table-column
label="状态"
min-width="100"
v-perms="['task_scheduling.task_scheduling/edit']"
>
<template #default="{ row }">
<el-switch
v-model="row.status"
:active-value="1"
:inactive-value="0"
@change="changeStatus(row)"
/>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['task.task_calendar']"
@click="moneyAdd(row)"
type="primary"
link
>
金额
</el-button>
<el-button
v-perms="['task_template.task_template/lists']"
type="primary"
link
>
<router-link
:to="{
path: getRoutePath('task_template.task_template/lists'),
query: {
id: row.id,
company_id: row.company_id,
},
}"
>任务安排</router-link
>
</el-button>
<el-button v-perms="['task.task_calendar']" type="primary" link>
<router-link
:to="{
path: getRoutePath('task.task_calendar'),
query: {
id: row.id,
company_id: row.company_id,
},
}"
>任务日程</router-link
>
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
<edit-popup
v-if="showEdit"
ref="editRef"
:dict-data="dictData"
@success="getLists"
@close="showEdit = false"
/>
<money
ref="moneyRef"
v-if="moneyShow"
@success="getLists"
@close="moneyShow = false"
></money>
</div>
<el-table-column label="操作" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['task.task_calendar']"
@click="moneyAdd(row)"
type="primary"
link
>
金额
</el-button>
<el-button
v-perms="['task_template.task_template/lists']"
type="primary"
link
>
<router-link
:to="{
path: getRoutePath('task_template.task_template/lists'),
query: {
id: row.id,
company_id: row.company_id
}
}"
>任务安排</router-link
>
</el-button>
<el-button v-perms="['task.task_calendar']" type="primary" link>
<router-link
:to="{
path: getRoutePath('task.task_calendar'),
query: {
id: row.id,
company_id: row.company_id
}
}"
>任务日程</router-link
>
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
<edit-popup
v-if="showEdit"
ref="editRef"
:dict-data="dictData"
@success="getLists"
@close="showEdit = false"
/>
<money
ref="moneyRef"
v-if="moneyShow"
@success="getLists"
@close="moneyShow = false"
></money>
</div>
</template>
<script lang="ts" setup name="taskSchedulingLists">
import { usePaging } from "@/hooks/usePaging";
import { useDictData } from "@/hooks/useDictOptions";
import {
apiTaskSchedulingLists,
apiTaskSchedulingEdit,
} from "@/api/task_scheduling";
import { timeFormat } from "@/utils/util";
import feedback from "@/utils/feedback";
import EditPopup from "./edit.vue";
import { dictDataLists } from "@/api/setting/dict";
import { getRoutePath } from "@/router";
import money from "./money.vue";
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiTaskSchedulingLists, apiTaskSchedulingEdit } from '@/api/task_scheduling'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import { dictDataLists } from '@/api/setting/dict'
import { getRoutePath } from '@/router'
import money from './money.vue'
const datalist = ref([]);
const editRef = shallowRef<InstanceType<typeof EditPopup>>();
const moneyRef = shallowRef<InstanceType<typeof money>>();
const datalist = ref([])
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const moneyRef = shallowRef<InstanceType<typeof money>>()
//
const showEdit = ref(false);
const showEdit = ref(false)
//
const moneyShow = ref(false);
const moneyShow = ref(false)
//
const queryParams = reactive({
create_user_id: "",
template_id: "",
company_id: "",
type: "",
status: "",
});
create_user_id: '',
template_id: '',
company_id: '',
type: '',
status: ''
})
//
const selectData = ref<any[]>([]);
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id);
};
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData("");
const { dictData } = useDictData('')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiTaskSchedulingLists,
params: queryParams,
});
fetchFun: apiTaskSchedulingLists,
params: queryParams
})
//
const handleAdd = async () => {
showEdit.value = true;
await nextTick();
editRef.value?.open("add");
};
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
//
const moneyAdd = async (obj: any) => {
moneyShow.value = true;
await nextTick();
moneyRef.value?.open(obj.money ? "edit" : "add");
moneyRef.value?.setFormData(obj);
};
moneyShow.value = true
await nextTick()
moneyRef.value?.open(obj.money ? 'edit' : 'add')
moneyRef.value?.setFormData(obj)
}
const changeStatus = (data: any) => {
apiTaskSchedulingEdit({
id: data.id,
status: data.status,
}).finally(() => {
getLists();
});
};
apiTaskSchedulingEdit({
id: data.id,
status: data.status
}).finally(() => {
getLists()
})
}
dictDataLists({ type_id: 10 }).then((res) => {
datalist.value = res.lists;
});
datalist.value = res.lists
})
getLists();
getLists()
</script>
<style lang="scss" scoped>
.formtabel {
.el-form-item {
width: 20%;
.el-form-item {
width: 20%;
.el-btn {
margin-left: 100px;
.el-btn {
margin-left: 100px;
}
}
}
}
</style>