| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596 |
- <template>
- <div class="app-container">
- <el-row :gutter="10">
- <!-- <el-col :span="4" :xs="24">
- <org-tree v-model="queryParams.orgId" @defaultOrg="getDefaultOrg" @checkChange="checkChange"
- @click="clickTreeNode"></org-tree>
- </el-col> -->
- <el-col :span="24" :xs="24">
- <div class="main-right-box">
- <div class="main-search-box">
- <el-form
- :model="queryParams"
- ref="queryForm"
- size="small"
- :inline="true"
- v-show="showSearch"
- >
- <el-form-item label="受训机构">
- <org-tree
- v-model="queryParams.orgId"
- @defaultOrg="getDefaultOrg"
- @checkChange="checkChange"
- @click="clickTreeNode"
- :defaultCheckSub="true"
- ref="orgTree"
- ></org-tree>
- </el-form-item>
- <el-form-item label="任务名称" prop="title">
- <el-input
- v-model="queryParams.title"
- placeholder="请输入关键字"
- clearable
- maxlength="50"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="任务进度" prop="status">
- <el-select
- v-model="queryParams.status"
- placeholder="请选择任务进度"
- clearable
- >
- <el-option
- v-for="dict in dict.type.edu_training_do_status"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
- <!-- <el-form-item label="任务时间" prop="rangen">
- <el-date-picker
- v-model="queryParams.range"
- type="daterange"
- value-format="yyyy-MM-dd"
- placeholder="请选择任务时间段">
- </el-date-picker>
- </el-form-item> -->
- <el-form-item class="searchTitle" label="任务时间">
- <DataRangePicker
- v-model="queryParams.range"
- key="daterange"
- type="daterange"
- :clearable="timeClearable"
- />
- </el-form-item>
- <!-- <el-form-item label="培训类型" prop="type">
- <el-select v-model="queryParams.type" placeholder="请选择培训类型" clearable>
- <el-option
- v-for="dict in dict.type.edu_type"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </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>
- <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddTask">临时登记</el-button>
- <el-button type="primary" icon="el-icon-download" size="mini" @click="handleExport">导出数据</el-button>
- </el-form-item> -->
- </el-form>
- <el-row :gutter="10">
- <el-col :span="1.5">
- <el-button
- type="primary"
- icon="el-icon-search"
- size="mini"
- @click="handleQuery"
- >搜索</el-button
- >
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="primary"
- icon="el-icon-refresh"
- size="mini"
- @click="resetQuery"
- >重置</el-button
- >
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="primary"
- icon="el-icon-plus"
- size="mini"
- v-hasPermi="['core:eduTask:edit']"
- @click="handleAddTask"
- >临时登记</el-button
- >
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="primary"
- icon="el-icon-download"
- size="mini"
- @click="handleExport"
- >导出数据</el-button
- >
- </el-col>
- <!-- <el-col :span="1.5">
- <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
- v-hasPermi="['core:plan:edit']">修改
- </el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
- v-hasPermi="['core:plan:remove']">删除
- </el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="warning"
- plain
- icon="el-icon-download"
- size="mini"
- @click="handleExport"
- v-hasPermi="['core:plan:export']"
- >导出
- </el-button>
- </el-col>-->
- <right-toolbar
- :showSearch.sync="showSearch"
- @queryTable="getList"
- ></right-toolbar>
- </el-row>
- </div>
- <el-table
- border
- height="646"
- size="small"
- v-loading="loading"
- :data="eduTaskList"
- @selection-change="handleSelectionChange"
- >
- <el-table-column type="index" label="序号" align="center" width="60" prop="no">
- <template slot-scope="scope">
- {{
- (queryParams.pageNum - 1) * queryParams.pageSize +
- scope.$index +
- 1
- }}
- </template>
- </el-table-column>
- <el-table-column
- label="任务名称"
- align="center"
- width="315"
- prop="title"
- />
- <el-table-column
- label="地区"
- width="115"
- align="center"
- prop="affiliatedArea"
- />
- <el-table-column
- label="行社名称"
- width="315"
- align="center"
- prop="affiliatedBank"
- />
- <el-table-column
- label="受训机构"
- width="315"
- align="center"
- prop="orgName"
- />
- <el-table-column
- label="任务进度"
- align="center"
- prop="status"
- width="150"
- >
- <template slot-scope="scope">
- <dict-tag
- :options="dict.type.edu_training_do_status"
- :value="scope.row.status"
- />
- </template>
- </el-table-column>
- <!-- <el-table-column label="开始时间" align="center" prop="startDate" width="180">
- </el-table-column>
- <el-table-column label="截止时间" align="center" prop="endDate" width="180"></el-table-column> -->
- <el-table-column label="任务时间" align="center" width="300">
- <template slot-scope="scope">
- {{
- scope.row.startDate
- ? dayjs(scope.row.startDate).format("YYYY年MM月DD日") +
- " ~ " +
- dayjs(scope.row.endDate).format("YYYY年MM月DD日")
- : ""
- }}
- </template>
- </el-table-column>
- <!-- <el-table-column label="培训时间" align="center" prop="trainingStartDateTime" width="300">
- <template slot-scope="scope">
- {{
- scope.row.trainingStartDateTime
- ? (scope.row.trainingStartDateTime + " ~ " + scope.row.trainingEndDateTime) : ''
- }}
- </template>
- </el-table-column>-->
- <!-- <el-table-column label="培训角色" width="180" align="center" >
- <template slot-scope="scope">
- <template v-if="scope.row.taskRoleNameList ">
- <el-tag size="mini" type="success" v-for="(item, index) in (scope.row.taskRoleNameList || '').split(',')"
- :key="index">
- {{ item }}
- </el-tag>
- </template>
- </template>
- </el-table-column> -->
- <!-- <el-table-column label="培训类型" width="180" align="center" >
- <template slot-scope="scope">
- <dict-tag :options="dict.type.edu_type" :value="scope.row.type"/>
- </template>
- </el-table-column>
- <el-table-column label="主持人" width="140" align="center" prop="hostName" />-->
- <el-table-column
- label="操作"
- align="center"
- class-name="small-padding fixed-width"
- width="350"
- >
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-view"
- @click="handleDetail(scope.row,scope.row.id,false)"
- v-hasPermi="['core:eduTask:list']"
- >详情
- </el-button>
- <!-- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
- v-if="isSignature(scope.row)"
- @click="handleDetail(scope.row,scope.row.id,true)"
- >签名
- </el-button>-->
- <el-button
- size="mini"
- type="text"
- icon="el-icon-document-add"
- v-if="canPerform(scope.row)"
- @click="handleRecorded(scope.row.id)"
- v-hasPermi="['core:eduTask:edit']"
- >任务登记
- </el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-delete"
- v-if="canDelete(scope.row)"
- @click="handleDelete(scope.row.id)"
- v-hasPermi="['core:eduTask:remove']"
- >删除
- </el-button>
- <el-button
- icon="el-icon-document"
- type="text"
- size="mini"
- v-if="scope.row.pdfUrl"
- @click="onDown(scope.row.pdfUrl)"
- >培训登记簿
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total > 0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- </div>
- </el-col>
- </el-row>
- <dialog-info ref="infoDialog" @success="handleQuery(true)"></dialog-info>
- <dialog-perform
- ref="performDialog"
- @success="handleQuery(true)"
- ></dialog-perform>
- <dialog-new-task
- ref="newTaskDialog"
- @success="handleQuery(true)"
- ></dialog-new-task>
- </div>
- </template>
- <script>
- import {
- listEduTask,
- addEduTask,
- recordEduTask,
- delEduTask,
- } from "@/api/core/edu/eduTask";
- import DataRangePicker from "@/components/dateTime/daterange.picker.vue";
- import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
- import DialogInfo from "./dialog.info";
- import DialogPerform from "./dialog.perform";
- import DialogNewTask from "./dialog.newTask";
- import dayjs from "dayjs";
- import tableList from "@/mixins/tableList";
- import { mapGetters } from "vuex";
- export default {
- name: "EduTask",
- dicts: ["edu_type", "edu_training_do_status"],
- components: {
- DialogInfo,
- DialogPerform,
- OrgTree,
- DialogNewTask,
- DataRangePicker,
- },
- mixins: [tableList],
- data() {
- return {
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 非单个停用
- single: true,
- // 非多个停用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 教育任务表格数据
- eduTaskList: [],
- timeClearable: true,
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- checkSub: true,
- title: null,
- orgId: this.$store.getters.orgId,
- type: null,
- status: null,
- range: [],
- },
- // 表单参数
- form: {},
- // 表单校验
- rules: {
- orgId: [{ required: true, message: "机构不能为空", trigger: "blur" }],
- },
- selectedOrgName: null,
- };
- },
- beforeRouteEnter(to,from,next){
- console.log(from,'to')
- if(from.path === '/home'){
- next(vm=>{
- vm.queryParams.status = to.query.status;
- })
- }else {
- next()
- }
- },
- mounted() {
- this.getList();
- },
- computed: {
- ...mapGetters(["orgId", "orgName", "userId"]),
- },
- methods: {
- dayjs,
- /** 查询教育任务列表 */
- getList() {
- this.loading = true;
- listEduTask(this.queryParams).then((response) => {
- this.eduTaskList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- range: [],
- title: null,
- type: null,
- status: null,
- };
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- /** 重置按钮操作 */
- resetQuery() {
- this.clearQueryForm();
- this.handleQuery();
- },
- clearQueryForm() {
- this.queryParams.title = null;
- this.queryParams.status = null;
- this.queryParams.range = [new Date(),new Date()];
- this.queryParams.orgId = this.orgId;
- this.selectedOrgName = this.orgName;
- this.queryParams.checkSub = true;
- this.$refs["orgTree"].setCheckSub(this.queryParams.checkSub)
- },
- //单选框状态改变
- checkChange(state) {
- this.queryParams.checkSub = state;
- this.handleQuery();
- },
- getDefaultOrg(org) {
- this.queryParams.orgId = org.id;
- this.selectedOrgName = org.shortName;
- this.getList();
- },
- // 节点单击事件
- clickTreeNode(data) {
- this.queryParams.orgId = data.id;
- this.selectedOrgName = data.shortName;
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map((item) => item.id);
- this.single = selection.length !== 1;
- this.multiple = !selection.length;
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset();
- this.open = true;
- this.title = "添加教育任务";
- },
- /** 删除按钮操作 */
- handleDelete(id) {
- this.$modal
- .confirm("删除后不可恢复,是否确认删除该任务?")
- .then(function () {
- return delEduTask(id);
- })
- .then(() => {
- this.$modal.msgSuccess("删除成功");
- this.getList();
- })
- .catch(() => {});
- },
- /** 修改按钮操作 */
- handleDetail(row,id,isSignType) {
- console.log("this.$refs", this.$refs["infoDialog"]);
- this.$refs["infoDialog"].show(id, false, isSignType,{});
- // this.reset();
- // const id = row.id || this.ids
- // getEduTask(id).then(response => {
- // this.form = response.data;
- // this.open = true;
- // this.title = "修改教育任务";
- // });
- },
- /** 培训登记按钮操作 */
- handleRecorded(id) {
- this.$refs["performDialog"].show(id, {});
- },
- handleAddTask(id) {
- this.$refs["newTaskDialog"].show(id, {});
- },
- /** 导出按钮操作 */
- handleExport() {
- if (this.total==null || this.total===0){
- this.$modal.alert("暂无可用数据导出");
- return;
- }
- if (this.total>50000){
- this.$modal.alert("导出数据超过5万条,请缩小查询范围后重试");
- return;
- }
- this.download(
- "core/eduTask/export",
- {
- ...this.queryParams,
- },
- `${
- this.selectedOrgName
- }-${this.$tab.getCurrentTabName()}-${dayjs().format("YYYYMMDD")}.xlsx`
- );
- },
- canPerform(row) {
- console.log("row.status", row.status);
- if (row.status != 0 && row.status != 4) return false;
- let isCur = row.orgId == this.$store.getters.orgId;
- let isOver = this.isNotOverOrUnStart(row);
- return isCur && isOver;
- /*let flag = 0;
- if(!row.taskRoleList) return false;
- row.taskRoleList.forEach((taskRole) => {
- this.$store.getters.roleList.forEach((role) => {
- if (taskRole.roleId == role.roleId) {
- flag = 1;
- }
- });
- });
- return (flag == 1) && isOver;*/
- },
- canDelete(row) {
- //本机构用户可以删除
- return row.orgId == this.$store.getters.orgId && !row.planId;
- },
- isNotOverOrUnStart(row) {
- const currentTime = dayjs().startOf("day"); // 获取当前时间,并将时分秒部分设置为00时00分00秒
- const startDate = dayjs(row.startDate).startOf("day"); // 转换开始时间为 Moment.js 对象,并将时分秒部分设置为00时00分00秒
- const endDate = dayjs(row.endDate).startOf("day"); // 转换结束时间为 Moment.js 对象,并将时分秒部分设置为00时00分00秒
- return !(currentTime < startDate || currentTime > endDate);
- },
- async onDown(pdfUrl) {
- window.open(pdfUrl);
- },
- //判断是否展示签名按钮
- // isSignature(list) {
- // let falg = false
- // let timefalg = false
- // //value1 当前登陆用户ID
- // //当前时间再时间范围内且签名是待签名状态且签名列表存在当前登录人未签名的情况才可以进行签名
- // if (list.startDate && list.endDate && list.status == 1) {
- // let date = new Date().getTime()
- // let startDate = Date.parse(new Date(list.startDate));// Date.parse(new Date(list.startDate))
- // let endDate = Date.parse(new Date(list.endDate));// Date.parse(new Date(list.endDate))
- //
- // if (date >= startDate && date <= endDate) {
- // console.log(list.id, 'ssss')
- // timefalg = true
- // }
- // if (!list.planId) {
- // timefalg = true
- // }
- // }
- // if (list.userList && list.userList.length > 0) {
- // list.userList.forEach(item => {
- // if (this.userId == item.userId && item.sign === 0 && item.type == 1) {
- // falg = true
- // }
- // })
- // }
- //
- // if (falg && timefalg) {
- // return true
- // }
- // },
- },
- };
- </script>
|