| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043 |
- <template>
- <div class="app-container">
- <el-row :gutter="10">
- <!--机构数据-->
- <!-- <el-col :span="4" :xs="24">
- <org-tree
- v-model="queryParams.belongOrgId"
- @defaultKey="getDefaultKey"
- @checkChange="checkChange"
- @click="clickTreeNode"
- hangsheTree
- :defaultCheckSub="false"
- ></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.belongOrgId"
- @defaultKey="getDefaultKey"
- @checkChange="checkChange"
- @click="clickTreeNode"
- hangsheTree
- :defaultCheckSub="false"
- ></org-tree>
- </el-form-item>
- <el-form-item label="任务名称" prop="planName">
- <el-input
- v-model="queryParams.planName"
- placeholder="请输入关键字"
- clearable
- maxlength="50"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="机构类型" prop="execOrgType">
- <el-select
- v-model="queryParams.execOrgType"
- placeholder="请选择机构类型"
- clearable
- >
- <el-option
- v-for="dict in dict.type.sys_org_type"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="任务状态" prop="planStatus">
- <el-select
- v-model="queryParams.planStatus"
- placeholder="请选择任务状态"
- clearable
- >
- <el-option
- v-for="dict in dict.type.edu_plan_status"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
- <!-- <el-form-item label="培训角色" prop="planRoleId">
- <el-select v-model="queryParams.planRoleId" placeholder="请选择培训角色" clearable>
- <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="planCycle">
- <el-select
- v-model="queryParams.planCycle"
- placeholder="请选择任务周期"
- clearable
- >
- <el-option
- v-for="dict in dict.type.edu_plan_cycle"
- :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="handleAdd"
- v-hasPermi="['core:plan:add']">新增任务
- </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"
- @click="handleAdd"
- v-hasPermi="['core:plan:add']"
- >新增任务
- </el-button>
- </el-col>
- <!-- <el-col :span="1.5">
- <el-button type="success" plain icon="el-icon-edit-outline" 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"
- :data="planList"
- @selection-change="handleSelectionChange"
- row-key="id"
- >
- <!-- :tree-props="{ children: 'children' }" -->
- <el-table-column label="序号" align="center" prop="no" width="60" />
- <el-table-column
- label="任务名称"
- align="left"
- header-align="center"
- prop="planName"
- />
- <el-table-column
- label="创建机构"
- align="left"
- header-align="center"
- prop="createOrgName"
- />
- <el-table-column
- label="行社名称"
- align="left"
- header-align="center"
- prop="belongOrgName"
- />
- <!-- <el-table-column label="所属机构" align="left" width="180" prop="belongOrgName"/> -->
- <el-table-column
- label="机构类型"
- align="center"
- width="150"
- prop="execOrgType"
- >
- <template slot-scope="scope">
- <dict-tag
- :options="dict.type.sys_org_type"
- :value="scope.row.execOrgType"
- />
- </template>
- </el-table-column>
- <!-- <el-table-column prop="planRoleNameList" width="180" label="培训角色">
- <template slot-scope="scope">
- <template v-if="scope.row.planRoleNameList">
- <el-tag size="mini" type="success"
- v-for="(item, index) in (scope.row.planRoleNameList || '').split(',')"
- :key="index">
- {{ item }}
- </el-tag>
- </template>
- <template v-else>
- <el-tag size="mini">{{ scope.row.checkOrgTypeText }}</el-tag>
- </template>
- </template>
- </el-table-column>-->
- <el-table-column
- label="任务周期"
- align="center"
- width="150"
- prop="planCycle"
- >
- <template slot-scope="scope">
- <dict-tag
- :options="dict.type.edu_plan_cycle"
- :value="scope.row.planCycle"
- />
- </template>
- </el-table-column>
- <el-table-column
- label="任务次数"
- align="center"
- width="100"
- prop="execTimes"
- />
- <el-table-column
- label="任务状态"
- align="center"
- width="100"
- prop="planStatus"
- >
- <template slot-scope="scope">
- <dict-tag
- :options="dict.type.edu_plan_status"
- :value="parseInt(scope.row.planStatus)"
- />
- </template>
- </el-table-column>
- <!-- <el-table-column label="备注" align="center" prop="remark"/>-->
- <el-table-column
- label="操作"
- width="200"
- align="left"
- header-align="center"
- fixed="right"
- class-name="small-padding fixed-width"
- >
- <template slot-scope="scope">
- <el-button
- v-if="checkCanPublish(scope.row)"
- size="mini"
- type="text"
- icon="el-icon-arrow-down"
- @click="handlePublish(scope.row)"
- v-hasPermi="['core:plan:edit']"
- >下发
- </el-button>
- <el-button
- v-if="checkCanRevocation(scope.row)"
- size="mini"
- type="text"
- icon="el-icon-top-left"
- @click="handleRevocation(scope.row)"
- v-hasPermi="['core:plan:edit']"
- >撤回
- </el-button>
- <el-button
- v-if="checkCanEdit(scope.row)"
- size="mini"
- type="text"
- icon="el-icon-edit-outline"
- @click="handleUpdate(scope.row)"
- 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="['core:plan:remove']"
- >删除
- </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>
- <!-- 添加或修改教育培训计划对话框 -->
- <DialogCom
- :title="title"
- :visible.sync="open"
- :before-close="closeDialog"
- @close="cancel"
- width="850px"
- height="800px"
- append-to-body
- >
- <el-form ref="form" :model="form" :rules="rules" label-width="120px">
- <el-row>
- <el-col :span="24">
- <el-form-item label="任务名称" prop="planName" class="endItem">
- <el-input
- v-model="form.planName"
- maxlength="50"
- placeholder="请输入任务名称"
- />
- </el-form-item>
- </el-col>
- <!-- <el-col :span="12">
- <el-form-item label="培训类型" prop="type">
- <el-select
- style="width: 100%"
- v-model="form.type"
- placeholder="请选择培训类型"
- @change="eduTypeSelected()"
- >
- <el-option
- v-for="dict in dict.type.edu_training_type"
- :key="dict.value"
- :label="dict.label"
- :value="parseInt(dict.value)"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>-->
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="任务周期" prop="planCycle">
- <el-select
- style="width: 100%"
- v-model="form.planCycle"
- placeholder="请选择任务周期"
- >
- <el-option
- v-for="dict in dict.type.edu_plan_cycle"
- :key="dict.value"
- :label="dict.label"
- :value="parseInt(dict.value)"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="任务次数" prop="execTimes">
- <template>
- <el-input-number
- style="width: 100%"
- v-model="form.execTimes"
- :min="1"
- :max="10"
- ></el-input-number>
- </template>
- </el-form-item>
- </el-col>
- <!-- <el-col :span="12">
- <el-form-item label="培训角色" prop="planRoleId">
- <el-select style="width: 100%" 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-row>
- <el-row>
- <el-col :span="12" v-show="form.planCycle == 0">
- <el-form-item prop="startDate" label="开始日期">
- <el-date-picker
- style="width: 100%"
- 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
- style="width: 100%"
- 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" v-show="showBuildTaskNow()">
- <el-form-item label="立即生效" prop="buildTaskNow">
- <el-checkbox v-model="form.buildTaskNow">
- 默认从下个周期生成任务,
- <br />
- 勾选后从当前周期立即生成任务
- <!-- <el-popover placement="top-start" title="" width="200" trigger="hover"
- content="默认从下个周期生成任务,勾选后从当前周期立即生成任务">
- <i class="el-icon-warning-outline change-icon" slot="reference"></i>
- </el-popover>-->
- </el-checkbox>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="受训机构类型" prop="execOrgType">
- <el-select
- style="width: 100%"
- v-model="form.execOrgType"
- placeholder="请选择机构类型"
- @change="execOrgTypeChanged()"
- >
- <el-option
- v-for="dict in getUserOrgType"
- :key="dict.value"
- :label="dict.label"
- :value="parseInt(dict.value)"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <!-- <el-col :span="12">
- <el-form-item v-if="this.form.id" label="计划状态" prop="planStatus">
- <el-select style="width: 100%" v-model="form.planStatus" placeholder="请选择计划状态">
- <el-option v-for="dict in dict.type.edu_plan_status" :key="dict.value" :label="dict.label"
- :value="parseInt(dict.value)"></el-option>
- </el-select>
- </el-form-item>
- </el-col>-->
- <el-col :span="24">
- <el-form-item
- v-show="form.execOrgType"
- label="受训机构"
- prop="planExecOrgIdList"
- >
- <org-tree-select
- v-model="form.planExecOrgIdList"
- :queryData="form.execOrgType"
- ref="orgTreeSelect"
- :enabledCheckOrgTypes="form.execOrgType"
- :disable="true"
- >
- </org-tree-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="24">
- <el-form-item label="备注" prop="remark">
- <k-textarea
- v-model="form.remark"
- :length="200"
- :autosize="{ minRows: 2, maxRows: 4 }"
- type="textarea"
- show-word-limit
- placeholder="请输入备注"
- />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="上传文件" prop="fileList">
- <K-file-upload
- ref="upload"
- :defaultValue="formFileListDefualtValue"
- v-model="form.fileList"
- />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="">
- <el-button type="primary" @click="showSelectFile"
- >选取知识库文件</el-button
- >
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </DialogCom>
- <DialogSelectFile
- ref="DialogSelectFile"
- :defaultSelect="defaultSelect"
- @select="fileSelected"
- :orgId="orgId"
- ></DialogSelectFile>
- </div>
- </template>
- <script>
- import {
- addPlan,
- delPlan,
- getPlan,
- listPlan,
- listPlanRole,
- publishPlan,
- roleList,
- updatePlan,
- revocationPlan,
- } from "@/api/core/edu/plan";
- import OrgTreeSelect from "@/components/orgTreeSelect";
- import tableList from "@/mixins/tableList";
- import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
- import { deptTreeSelect } from "@/api/system/public";
- import KFileUpload from "@/components/K-FileUpload/index.vue";
- import DialogSelectFile from "./dialog.select.file.vue";
- import dayjs from "dayjs";
- import KTextarea from "@/components/common/textarea.vue";
- export default {
- name: "Plan",
- dicts: [
- "sys_org_type",
- "edu_plan_cycle",
- "edu_plan_status",
- "edu_training_type",
- ],
- components: {
- OrgTreeSelect,
- OrgTree,
- KFileUpload,
- DialogSelectFile,
- KTextarea,
- },
- mixins: [tableList],
- data() {
- return {
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 非单个停用
- single: true,
- // 非多个停用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 教育培训计划表格数据
- planList: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- isUnfold: false,
- defaultSelect: [],
- filterOrtTypeOptions: [],
- orgId: null,
- type: null,
- // 查询参数
- queryParams: {
- execOrgType: null,
- planCycle: null,
- planStatus: null,
- planRoleId: null,
- planName: null,
- pageNum: 1,
- pageSize: 10,
- belongOrgId: null,
- checkSub: false,
- },
- formFileListDefualtValue: [],
- // 表单参数
- form: {},
- // 表单校验
- rules: {
- planName: [
- { required: true, message: "培训名称不能为空", trigger: "blur" },
- ],
- type: [
- { required: true, message: "培训类型不能为空", trigger: "blur" },
- ],
- planCycle: [
- { required: true, message: "计划周期不能为空", trigger: "blur" },
- ],
- execTimes: [
- { required: true, message: "培训次数不能为空", trigger: "blur" },
- ],
- planStatus: [
- { required: true, message: "计划状态不能为空", trigger: "blur" },
- ],
- execOrgType: [
- { required: true, message: "培训机构类型不能为空", trigger: "blur" },
- ],
- planRoleId: [
- { required: true, message: "培训角色不能为空", trigger: "blur" },
- ],
- },
- planRoleList: [],
- roleList: [],
- //修改新增中的机构树
- deptOptions: [],
- startDatepickerOptions: {
- disabledDate(time) {
- const date = new Date();
- date.setTime(date.getTime() - 3600 * 1000 * 24);
- return time.getTime() < date;
- },
- },
- endDatepickerOptions: {
- disabledDate: this.disabledDate,
- },
- };
- },
- computed: {
- getUserOrgType() {
- let tempArry = [];
- this.dict.type.sys_org_type.forEach((x) => {
- if (Number(x.value) >= this.$store.getters.orgType) {
- tempArry.push(x);
- }
- });
- // console.log("computed getUserOrgType",tempArry);
- return tempArry;
- },
- },
- created() {
- //this.getList();
- // this.initPlanRoleList();
- this.orgId = this.$store.getters.orgId;
- },
- methods: {
- // clear() {
- // this.$refs['orgTreeSelect'].clear();
- // },
- queryNode(nodes) {
- this.form.planExecOrgIdList = JSON.parse(nodes).map((v) => {
- return v.id;
- });
- },
- showBuildTaskNow() {
- //如果是新增的情况下
- if (!this.form.id) {
- return this.form.planCycle != 0;
- } else {
- //如果是编辑的情况下,判断是否是标准计划
- /*if (this.form.standard==1){
- return this.form.planCycle != 0&&this.form.issue == 0
- }*/
- return this.form.planStatus == 0 && this.form.planCycle != 0;
- }
- },
- /** 查询教育培训计划列表 */
- getList() {
- this.loading = true;
- listPlan(this.queryParams).then((response) => {
- this.planList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- //初始化与计划相关的角色信息
- initPlanRoleList() {
- listPlanRole({}).then((response) => {
- this.planRoleList = response.data;
- });
- },
- //初始化所有角色数据
- initRoleList(query) {
- this.form.planRoleId = [];
- roleList(query).then((response) => {
- 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();
- },
- checkCanPublish(row) {
- //是标准计划且未下发,状态为草稿或停用,且所属机构为当前用户登录机构时才显示 “下发”按钮
- if (
- row.issue == 0 &&
- row.standard == 1 &&
- (row.planStatus == 0 || row.planStatus == 2) &&
- this.checkCanEdit(row)
- ) {
- return true;
- }
- return false;
- },
- //撤回按钮
- checkCanRevocation(row) {
- return row.planStatus == 1 && row.standard == 1 && this.checkCanEdit(row);
- },
- //所属机构为当前用户登录机构或等于创建机构时才显示 “编辑、删除”按钮
- checkCanEdit(row) {
- return (
- row.belongOrgId == this.$store.getters.orgId ||
- row.createOrgId == this.$store.getters.orgId
- );
- },
- checkCanDel(row) {
- // 计划仅能够通过删除标准计划来删除
- /* return (row.belongOrgId == this.$store.getters.orgId)
- /!* && (row.issue != 1 || (row.issue == 1 && row.done != 1))*!/
- && !row.parentId && row.createByTopOrg!=1*/
- return (
- (row.standard == 1 || row.standard == 2) &&
- row.done != 1 &&
- this.checkCanEdit(row)
- );
- },
- //省联社下发的计划不显示“删除”按钮
- checkCreateByTopOrg(row) {
- return row.createByTopOrg !== 1 && this.checkCanEdit(row);
- },
- eduTypeSelected() {
- if (this.form.type == 0) {
- this.form.planCycle = 3;
- this.form.execTimes = 1;
- this.form.execOrgType = 3;
- }
- if (this.form.type == 1) {
- this.form.planCycle = 6;
- this.form.execTimes = 2;
- this.form.execOrgType = 3;
- }
- if (this.form.type == 2) {
- this.form.planCycle = 4;
- this.form.execTimes = 1;
- this.form.execOrgType = 4;
- }
- if (this.form.type == 3) {
- this.form.planCycle = 6;
- this.form.execTimes = 2;
- this.form.execOrgType = 4;
- }
- },
- execOrgTypeChanged(row) {
- this.$refs["orgTreeSelect"].clear();
- //this.initRoleList(this.form.execOrgType);
- // this.form.planExecOrgIdList = [];
- },
- /** 查询机构树数据 */
- getDeptTree() {
- deptTreeSelect().then((response) => {
- this.deptOptions = response.data;
- });
- },
- // 取消按钮
- cancel() {
- //console.log("xxx")
- this.open = false;
- this.reset();
- this.$refs["orgTreeSelect"].clear();
- this.$refs["upload"].clearFiles();
- },
- closeDialog() {
- this.cancel();
- },
- // 表单重置
- reset() {
- this.form = {
- id: null,
- type: null,
- planName: null,
- planCycle: null,
- execTimes: null,
- planStatus: null,
- execOrgType: null,
- planExecOrgIdList: [],
- startDate: null,
- endDate: null,
- buildTaskNow: null,
- remark: null,
- planRoleId: null,
- fileList: null,
- standard: null,
- };
- this.resetForm("form");
- },
- getDefaultKey(key) {
- this.queryParams.belongOrgId = key;
- this.getList();
- },
- //单选框状态改变
- checkChange(state) {
- this.queryParams.checkSub = state;
- this.handleQuery();
- },
- // 节点单击事件
- clickTreeNode(data) {
- // this.initPlanRoleList();
- this.queryParams.belongOrgId = data.id;
- this.handleQuery();
- },
- /** treeSelect组件自定义数据*/
- tenantIdnormalizer(node, instanceId) {
- if (node.children && !node.children.length) {
- delete node.children;
- }
- return {
- id: node.id,
- label: node.name,
- children: node.children,
- };
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm("queryForm");
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map((item) => item.id);
- this.single = selection.length !== 1;
- this.multiple = !selection.length;
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.initRoleList();
- this.reset();
- this.open = true;
- this.title = "新增培训任务";
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.initRoleList();
- this.reset();
- const id = row.id || this.ids;
- getPlan(id).then((response) => {
- this.form = response.data;
- //将 this.form.planExecOrgIdList中的元素转为字符串
- if (this.form.planExecOrgIdList == null) {
- this.form.planExecOrgIdList = [];
- }
- this.form.planExecOrgIdList = this.form.planExecOrgIdList.map(
- (element) => element.toString()
- );
- this.formFileListDefualtValue = this.form.fileList;
- this.open = true;
- this.title = "编辑培训任务";
- });
- },
- /** 提交按钮 */
- submitForm() {
- if (dayjs(this.form.startDate).isAfter(dayjs(this.form.endDate))) {
- this.$message.error("开始时间不能大于结束时间!");
- return;
- }
- this.$refs["form"].validate((valid) => {
- if (valid) {
- let request = { ...this.form };
- if (this.form.planExecOrgIdList) {
- const list = Array.isArray(this.form.planExecOrgIdList)
- ? this.form.planExecOrgIdList
- : [this.form.planExecOrgIdList];
- request.planExecOrgIdList = list;
- } else {
- request.planExecOrgIdList = [];
- }
- if (request.id != null) {
- console.log("updatePlan", request);
- this.$modal
- .confirm(this.getMsgStr(request, "修改"))
- .then(function () {
- return updatePlan(request);
- })
- .then(() => {
- this.$modal.msgSuccess("修改成功");
- this.open = false;
- this.getList();
- this.$refs["upload"].clearFiles();
- })
- .catch(() => {});
- } else {
- addPlan(request).then((response) => {
- this.$modal.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- this.$refs["upload"].clearFiles();
- });
- }
- }
- });
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const ids = row.id || this.ids;
- this.$modal
- .confirm(this.getMsgStr(row, "删除"))
- .then(function () {
- return delPlan(ids);
- })
- .then(() => {
- this.getList();
- this.$modal.msgSuccess("删除成功");
- })
- .catch(() => {});
- },
- /** 下发计划 */
- handlePublish(row) {
- if (row.id != null) {
- this.$modal
- .confirm(this.getMsgStr(row, "下发"))
- .then(function () {
- return publishPlan(row.id);
- })
- .then(() => {
- this.$modal.msgSuccess("计划下发成功");
- this.getList();
- })
- .catch(() => {});
- }
- },
- getMsgStr(row, type) {
- let str = "是否确认" + type + "该计划?";
- if (row.standard == 1) {
- str = "此操作将会影响所有行社计划," + str;
- }
- return str;
- },
- //撤回计划
- handleRevocation(row) {
- if (row.id != null) {
- this.$modal
- .confirm("撤回计划会清除本周期所有任务,是否继续?")
- .then(function () {
- return revocationPlan(row.id);
- })
- .then(() => {
- this.$modal.msgSuccess("计划撤回成功");
- this.getList();
- })
- .catch(() => {});
- }
- },
- /** 导出按钮操作 */
- handleExport() {
- this.download(
- "system/plan/export",
- {
- ...this.queryParams,
- },
- `plan_${new Date().getTime()}.xlsx`
- );
- },
- showSelectFile() {
- this.$refs["DialogSelectFile"].show();
- },
- fileSelected(list) {
- if (!list) return;
- let tempArry = [];
- let fileNameList = [];
- let addFileNameList = [];
- if(this.form.fileList==null) {
- this.form.fileList=[];
- }
- this.form.fileList.forEach((x) => {
- let fileObj = JSON.parse(x);
- fileNameList.push(fileObj.name);
- });
- list.forEach((x) => {
- tempArry.forEach((s) => {
- addFileNameList.push(JSON.parse(s).name);
- });
- x.fileList.forEach((y) => {
- let fileObj = JSON.parse(y);
- if (
- fileNameList.indexOf(fileObj.name) == -1 &&
- addFileNameList.indexOf(fileObj.name) == -1
- ) {
- tempArry.push(y);
- }
- });
- });
- if (this.form.fileList) {
- this.formFileListDefualtValue = this.form.fileList.concat(tempArry);
- } else {
- this.formFileListDefualtValue = tempArry;
- }
- },
- },
- mounted() {
- // console.log("mounted",this.$options.dicts);
- // let a= this.getSysOrgType;
- // console.log(" handleAdd getSysOrgType",a);
- },
- // updated(){
- // console.log("update",this.$options.dicts);
- // },
- };
- </script>
- <style lang="scss" scoped>
- .endItem ::v-deep .el-textarea__inner {
- padding-bottom: 36px;
- }
- </style>
|