This commit is contained in:
weipengfei 2023-08-19 17:13:22 +08:00
commit cec528418a

View File

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