|
|
@@ -41,7 +41,7 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="培训角色" prop="planRoleId">
|
|
|
<el-select v-model="form.planRoleId" placeholder="请选择">
|
|
|
- <el-option v-for="item in planRoleList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
+ <el-option v-for="item in planRoleList" :key="item.roleId" :label="item.roleName" :value="item.roleId"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="计划名称" prop="planName">
|
|
|
@@ -67,7 +67,7 @@
|
|
|
icon="el-icon-plus"
|
|
|
size="mini"
|
|
|
@click="handleAdd"
|
|
|
- v-hasPermi="['system:plan:add']"
|
|
|
+ v-hasPermi="['core:plan:add']"
|
|
|
>新增
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
@@ -79,7 +79,7 @@
|
|
|
size="mini"
|
|
|
:disabled="single"
|
|
|
@click="handleUpdate"
|
|
|
- v-hasPermi="['system:plan:edit']"
|
|
|
+ v-hasPermi="['core:plan:edit']"
|
|
|
>修改
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
@@ -91,7 +91,7 @@
|
|
|
size="mini"
|
|
|
:disabled="multiple"
|
|
|
@click="handleDelete"
|
|
|
- v-hasPermi="['system:plan:remove']"
|
|
|
+ v-hasPermi="['core:plan:remove']"
|
|
|
>删除
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
@@ -102,7 +102,7 @@
|
|
|
icon="el-icon-download"
|
|
|
size="mini"
|
|
|
@click="handleExport"
|
|
|
- v-hasPermi="['system:plan:export']"
|
|
|
+ v-hasPermi="['core:plan:export']"
|
|
|
>导出
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
@@ -136,19 +136,30 @@
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
+ v-if="checkCanEdit(scope.row)"
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="handlePublish(scope.row)"
|
|
|
+ v-hasPermi="['core:plan:publish']"
|
|
|
+ >下发
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="checkCanEdit(scope.row)"
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-edit"
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
- v-hasPermi="['system:plan:edit']"
|
|
|
+ v-hasPermi="['core:plan:edit']"
|
|
|
>修改
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
+ v-if="checkCanDel(scope.row)"
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-delete"
|
|
|
@click="handleDelete(scope.row)"
|
|
|
- v-hasPermi="['system:plan:remove']"
|
|
|
+ v-hasPermi="['core:plan:remove']"
|
|
|
>删除
|
|
|
</el-button>
|
|
|
</template>
|
|
|
@@ -167,12 +178,12 @@
|
|
|
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
<el-row>
|
|
|
- <el-col :span="10">
|
|
|
+ <el-col :span="12">
|
|
|
<el-form-item label="计划名称" prop="planName">
|
|
|
<el-input v-model="form.planName" placeholder="请输入计划名称"/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="14">
|
|
|
+ <el-col :span="12">
|
|
|
<el-form-item label="计划周期" prop="planCycle">
|
|
|
<el-select v-model="form.planCycle" placeholder="请选择计划周期">
|
|
|
<el-option
|
|
|
@@ -186,14 +197,32 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
- <el-col :span="10">
|
|
|
+ <el-col :span="12" v-show="form.planCycle == 0">
|
|
|
+ <el-form-item prop="startDate" label="开始日期">
|
|
|
+ <el-date-picker v-model="form.startDate" @change="startDateChanged"
|
|
|
+ :picker-options="startDatepickerOptions" align="right" type="date"
|
|
|
+ placeholder="选择开始日期">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12" v-show="form.planCycle == 0">
|
|
|
+ <el-form-item prop="endDate" label="结束日期">
|
|
|
+ <el-date-picker v-model="form.endDate" :picker-options="endDatepickerOptions" align="right"
|
|
|
+ type="date" placeholder="选择结束日期">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
<el-form-item label="培训次数" prop="execTimes">
|
|
|
<template>
|
|
|
<el-input-number v-model="form.execTimes" :min="1" :max="10"></el-input-number>
|
|
|
</template>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="14">
|
|
|
+ <el-col :span="12">
|
|
|
<el-form-item label="计划状态" prop="planStatus">
|
|
|
<el-select v-model="form.planStatus" placeholder="请选择计划状态">
|
|
|
<el-option
|
|
|
@@ -207,14 +236,14 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
- <el-col :span="10">
|
|
|
+ <el-col :span="12" v-show="form.planCycle != 0">
|
|
|
<el-form-item label="立即生效" prop="buildTaskNow">
|
|
|
<el-checkbox v-model="form.buildTaskNow">
|
|
|
勾选后在当前周期开始生效
|
|
|
</el-checkbox>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="14">
|
|
|
+ <el-col :span="12">
|
|
|
<el-form-item label="培训机构类型" prop="execOrgType">
|
|
|
<el-select v-model="form.execOrgType" placeholder="请选择执行机构类型">
|
|
|
<el-option
|
|
|
@@ -228,14 +257,14 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
- <el-col :span="10">
|
|
|
+ <el-col :span="12">
|
|
|
<el-form-item label="培训角色" prop="planRoleId">
|
|
|
<el-select v-model="form.planRoleId" placeholder="请选择" multiple>
|
|
|
<el-option v-for="item in roleList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="14">
|
|
|
+ <el-col :span="12">
|
|
|
<el-form-item label="培训机构" prop="belongOrgId">
|
|
|
<tree-select
|
|
|
v-model="form.belongOrgId"
|
|
|
@@ -268,9 +297,10 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {listPlan, getPlan, delPlan, addPlan, updatePlan, listPlanRole, roleList} from "@/api/core/plan";
|
|
|
+import {listPlan, getPlan, delPlan, addPlan, updatePlan, listPlanRole, roleList, publishPlan} from "@/api/core/plan";
|
|
|
import OrgTree from "@/components/orgTree/index.vue";
|
|
|
import {deptTreeSelect} from "@/api/system/public";
|
|
|
+import {formatTime} from "@/utils/ruoyi";
|
|
|
|
|
|
export default {
|
|
|
name: "Plan",
|
|
|
@@ -316,6 +346,16 @@ export default {
|
|
|
roleList: [],
|
|
|
//修改新增中的机构树
|
|
|
deptOptions: [],
|
|
|
+ startDatepickerOptions: {
|
|
|
+ disabledDate(time) {
|
|
|
+ const date = new Date();
|
|
|
+ date.setTime(date.getTime() - 3600 * 1000 * 24);
|
|
|
+ return time.getTime() < date;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ endDatepickerOptions: {
|
|
|
+ disabledDate: this.disabledDate,
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
@@ -344,6 +384,32 @@ export default {
|
|
|
this.roleList = response.data;
|
|
|
});
|
|
|
},
|
|
|
+ startDateChanged(time) {
|
|
|
+ if (this.form.startDate > this.form.endDate) {
|
|
|
+ this.form.endDate = this.form.startDate;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ disabledDate(time) {
|
|
|
+ //小于开始日期禁止选择
|
|
|
+ let startDate = new Date();
|
|
|
+ startDate.setTime(startDate.getTime() - 3600 * 1000 * 24);
|
|
|
+ if (this.form.startDate) {
|
|
|
+ startDate = new Date(this.formatTime(this.form.startDate, 'YYYY-MM-DD'));
|
|
|
+ startDate.setTime(startDate.getTime() - 3600 * 1000 * 24);
|
|
|
+ }
|
|
|
+ return time.getTime() < new Date(startDate).getTime()
|
|
|
+ },
|
|
|
+ //所属机构为当前用户登录机构时才显示 “编辑、删除”按钮
|
|
|
+ checkCanEdit(row) {
|
|
|
+ return row.belongOrgId === this.$store.getters.orgId
|
|
|
+ },
|
|
|
+ checkCanDel(row) {
|
|
|
+ return row.belongOrgId === this.$store.getters.orgId || row.createByTopOrg === 0
|
|
|
+ },
|
|
|
+ //省联社下发的计划不显示“删除”按钮
|
|
|
+ checkCreateByTopOrg(row) {
|
|
|
+ return row.createByTopOrg !== 1
|
|
|
+ },
|
|
|
/** 查询机构树数据 */
|
|
|
getDeptTree() {
|
|
|
deptTreeSelect().then(response => {
|
|
|
@@ -386,6 +452,7 @@ export default {
|
|
|
},
|
|
|
// 节点单击事件
|
|
|
clickTreeNode(data) {
|
|
|
+ this.initPlanRoleList();
|
|
|
this.queryParams.belongOrgId = data.id;
|
|
|
this.handleQuery();
|
|
|
},
|
|
|
@@ -417,6 +484,16 @@ export default {
|
|
|
this.multiple = !selection.length
|
|
|
},
|
|
|
/** 新增按钮操作 */
|
|
|
+ handlePublish(row) {
|
|
|
+ if (row.id != null) {
|
|
|
+ publishPlan(row.id).then(response => {
|
|
|
+ this.$modal.msgSuccess("下发成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /** 新增按钮操作 */
|
|
|
handleAdd() {
|
|
|
this.initRoleList();
|
|
|
this.getDeptTree()
|