123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158 |
- <template>
- <div>
- <!---lxh-修改密码-->
- <div class="dig_update">
- <el-dialog
- :visible.sync="dialogVisible"
- :close-on-click-modal="false"
- width="40%"
- top="5vh"
- style="overflow: hidden"
- >
- <div slot="title">
- <el-form
- :model="ruleForm"
- :rules="rules"
- :inline="true"
- ref="ruleForm"
- label-width="150px"
- class="demo-ruleForm"
- >
- <p v-if="isView" class="dig_title">新增计划</p>
- <p v-if="!isView" class="dig_title">编辑计划</p>
- <div slot=""></div>
- <div slot="footer"></div>
- <div
- style="
- height: 60vh;
- overflow-y: auto;
- padding-left: 20px;
- padding-right: 20px;
- "
- class="form_main"
- >
- <el-form-item label="计划名称" prop="planName">
- <el-input v-model="ruleForm.planName"></el-input>
- </el-form-item>
- <!-- <el-button v-show="true">asasas</el-button> -->
- <div v-if="userInfo.roleType != '3'">
- <el-form-item label="测评对象" prop="planType">
- <el-radio-group v-model="ruleForm.planType" @change="teacherChange">
- <el-radio label="1">教师</el-radio>
- <el-radio label="0">学生</el-radio>
- </el-radio-group>
- </el-form-item>
- </div>
- <el-form-item label="结束时间" prop="endTime">
- <el-date-picker
- v-model="ruleForm.endTime"
- type="date"
- placeholder="选择日期"
- @change="timeChange"
- :picker-options="expireTimeOption"
- >
- </el-date-picker>
- </el-form-item>
- <div v-show="ruleForm.planType == '0'">
- <el-form-item label="快捷选项">
- <el-row>
- <el-col :span="12">
- <!-- @change="gradeChange"
- @remove-tag="gradeRemoveChange"
- -->
- <el-select
- :collapse-tags="true"
- multiple
- placeholder="请选择年级"
- v-model="grade"
- clearable
- filterable
- >
- <el-option
- v-for="item in gradeOption"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-col>
- <el-col :span="12" style="text-align: right">
- <el-select
- v-show="userInfo.roleType != '3'"
- :collapse-tags="true"
- multiple
- placeholder="请选择辅导员"
- v-model="instructor"
- clearable
- filterable
- >
- <el-option
- v-for="item in instructorOption"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-col>
- </el-row>
- </el-form-item>
- </div>
- <el-button
- type="info"
- style="line-height: 10px; margin-top: 10px; font-size: 12px"
- round
- size="mini"
- @click="selectAllDataOrg()"
- >全选组织架构</el-button
- >
- <el-button
- type="info"
- style="line-height: 10px; margin-top: 10px; font-size: 12px"
- round
- size="mini"
- @click="clearDataOrg()"
- >清空组织架构</el-button
- >
- <div style="display: flex">
- <el-form-item label="组织架构" prop="checkedList">
- <el-tree
- :data="treeData"
- show-checkbox
- node-key="id"
- default-expand-all
- :default-checked-keys="ruleForm.checkedList"
- :props="defaultProps"
- ref="tree"
- >
- </el-tree>
- </el-form-item>
- </div>
- <!-- <el-button @click="getCheckedNodes"> 获取已选 </el-button> -->
- <el-form-item label="量表选择" class="taskSelect">
- <el-checkbox-group v-model="ruleForm.checkboxGroup2" size="mini">
- <el-checkbox
- v-for="item in scaleList"
- :key="item.id"
- :label="item.flag"
- border
- :disabled="item.isRequired == '1'"
- >{{ item.name }}</el-checkbox
- >
- <!-- <el-checkbox
- v-for="item in taskList"
- :key="item.id"
- :label="item.flag"
- border
- :disabled="item.isRequired == '1'"
- >{{ item.name }}</el-checkbox
- > -->
- </el-checkbox-group>
- </el-form-item>
- <el-form-item label="任务选择" class="taskSelect" prop="taskRadio">
- <el-select v-model="ruleForm.taskRadio" placeholder="请选择">
- <el-option
- v-for="item in taskList"
- :key="item.flag"
- :label="item.name"
- :value="item.flag"
- >
- </el-option>
- </el-select>
- <!-- <el-radio-group v-model="ruleForm.taskRadio">
- <el-radio v-for="item in taskList" :key="item" :label="item.flag">
- {{item.name}}
- </el-radio>
-
- </el-radio-group> -->
- <!-- <el-checkbox-group v-model="ruleForm.checkboxGroup2" size="mini">
-
- <el-checkbox
- v-for="item in taskList"
- :key="item.id"
- :label="item.flag"
- border
- :disabled="item.isRequired == '1'"
- >{{ item.name }}</el-checkbox
- >
- </el-checkbox-group> -->
- </el-form-item>
- </div>
- </el-form>
- <div class="dig_button">
- <el-button type="info" round @click="resetData()">取消</el-button>
- <el-button :disabled="disableFlag" type="success" round @click="submitCom()"
- >提交</el-button
- >
- </div>
- </div>
- <!-- <div slot="footer">
- <div class="dig_button">
- <el-button type="info" round @click="resetData()">重置</el-button>
- <el-button type="success" round @click="submitCom()">下一步</el-button>
- </div>
- </div> -->
- </el-dialog>
- </div>
- </div>
- </template>
- <script>
- // import { oSessionStorage } from "../../utils/utils";
- import { oSessionStorage } from "../utils/utils";
- import md5 from "md5";
- export default {
- data() {
- return {
- expireTimeOption: {
- disabledDate(date) {
- // 当天可选:date.getTime() < Date.now() - 24 * 60 * 60 * 1000
- return date.getTime() < Date.now();
- },
- },
- //编辑返回的值
- userDetailData: {},
- //组织架构名字
- groupName: "",
- disableFlag: false,
- phoneFlag: false,
- flag: 3,
- dialogVisible: false,
- //渠道列表
- ruleForm: {
- //所属组织架构
- planName: "",
- planType: "0",
- endTime: "",
- checkboxGroup2: [],
- checkedList: [],
- taskRadio: "",
- },
- isView: true,
- rules: {
- planName: [{ required: true, message: "请输入计划名称", trigger: "blur" }],
- endTime: [{ required: true, message: "请输入结束时间", trigger: "blur" }],
- checkedList: [{ required: true, message: "请选择组织架构", trigger: "blur" }],
- taskRadio: [{ required: true, message: "请选择任务", trigger: "blur" }],
- },
- userInfo: {},
- scaleAndCon: [],
- //查看是不是两次都调用完了
- countList: [],
- //显示用的认知任务名称
- cognitionName: "",
- id: "",
- //学生届数
- gradeOption: [],
- //辅导员列表
- instructorOption: [],
- //辅导员的原始列表
- teacherList: [],
- //树形选择班级的框
- treeData: [
- {
- id: 1,
- label: "一级 1",
- },
- ],
- defaultProps: {
- children: "children",
- label: "label",
- },
- //所选届数
- grade: [],
- instructor: [],
- ppData: [],
- //任务可选量表数据
- scaleAndTaskList: [],
- scaleList: [],
- taskList: [],
- //辅导员的组织架构
- teacherOrgList: [],
- };
- },
- //需要监听变量
- //如果这样变量增加的是谁,减少的是谁都知道
- watch: {
- grade(newCount, oldCount) {
- //首先是判断是新增还是减少
- //如果是新增
- if (newCount.length > oldCount.length) {
- let poor = newCount.filter((a) => !oldCount.includes(a));
- //此时新增的话需要调用方法
- //此时要判断增加的是谁
- if (poor.length == 1) {
- this.gradeAdd(poor[0], "isGrade");
- }
- } else if (newCount.length < oldCount.length) {
- let poor = oldCount.filter((a) => !newCount.includes(a));
- if (poor.length == 1) {
- this.gradeDecrease(poor[0], "isGrade");
- }
- }
- //如果是减少
- },
- //判断是减少还是增多
- instructor(newCount, oldCount) {
- if (newCount.length > oldCount.length) {
- let poor = newCount.filter((a) => !oldCount.includes(a));
- //此时新增的话需要调用方法
- //此时要判断增加的是谁
- if (poor.length == 1) {
- this.gradeAdd(poor[0], "noGrade");
- }
- } else if (newCount.length < oldCount.length) {
- let poor = oldCount.filter((a) => !newCount.includes(a));
- if (poor.length == 1) {
- this.gradeDecrease(poor[0], "noGrade");
- }
- }
- },
- },
- mounted() {
- this.userInfo = JSON.parse(oSessionStorage.getItem("userInfo"));
- // this.ruleForm.type = "3";
- },
- methods: {
- teacherChange(val) {
- this.getChannel();
- //当val == 1 时 调用查询组织架构的方法
- //重新绘制
- },
- // pickerOptions1() {},
- //查询学生模版
- queryStudentTemp() {
- this.$http.get(`/content/findAllByTemplate?template=studentContent`, {}, (res) => {
- // this.$toast.success({message:'成功'});
- if (res && res.code == 200) {
- //将值赋值给list
- if (res.data.length > 0) {
- this.scaleAndTaskList = res.data;
- this.scaleList = res.data.filter((item) => {
- //并且 是必须展示的
- return item.type == "0" && item.isDisplayed == "1";
- });
- this.taskList = res.data.filter((item) => {
- return item.type == "1" && item.isDisplayed == "1";
- });
- let listRequest = res.data.filter((item) => {
- return item.isRequired == "1";
- });
- this.ruleForm.checkboxGroup2 = [];
- for (let i = 0; i < listRequest.length; i++) {
- this.ruleForm.checkboxGroup2.push(listRequest[i].flag);
- }
- } else {
- // this.groupData = [];
- }
- // this.channelList = res.data;
- } else {
- this.$message.error(res.msg);
- }
- });
- },
- //获取辅导员
- getTeacher() {
- this.instructorOption = [];
- this.$http.get(`/user/findAllCounsellor`, {}, (res) => {
- // this.$toast.success({message:'成功'});
- if (res && res.code == 200) {
- //将值赋值给list
- if (res.data.length > 0) {
- //
- this.teacherList = res.data;
- for (let i = 0; i < res.data.length; i++) {
- //
- let obj = {
- value: res.data[i].userNo,
- label: res.data[i].userName,
- };
- this.instructorOption.push(obj);
- }
- } else {
- // this.groupData = [];
- }
- // this.channelList = res.data;
- } else {
- this.$message.error(res.msg);
- }
- });
- },
- //当选择的届减少时
- gradeDecrease(val, flag) {
- //减少的时候去查询
- let original = JSON.parse(JSON.stringify(this.ruleForm.checkedList));
- let gradeIds = [];
- if (flag == "isGrade") {
- for (let i = 0; i < this.ppData.length; i++) {
- if (this.ppData[i].extend == val) {
- //将此选项的ID保存下来
- gradeIds.push(this.ppData[i].id);
- }
- }
- } else {
- //
- for (let i = 0; i < this.teacherList.length; i++) {
- if (this.teacherList[i].userNo == val) {
- if (this.teacherList[i].gradeEntities.length > 0) {
- for (let j = 0; j < this.teacherList[i].gradeEntities.length; j++) {
- gradeIds.push(this.teacherList[i].gradeEntities[j].orgNo);
- }
- }
- }
- }
- }
- //求差值
- this.ruleForm.checkedList = original.filter((item) => !gradeIds.includes(item));
- //这些ID都需要从已选中去掉
- this.$refs.tree.setCheckedKeys(this.ruleForm.checkedList);
- //应该是要判断减少的是什么
- },
- //当选择的届发生改变时
- gradeAdd(val, flag) {
- //获取当前已选列表
- //届数改变以后
- //获取数行已选项,将已选ID组合
- //---------------已选 开始----------
- this.ruleForm.checkedList = [];
- // this.$refs.tree.setCheckedKeys([]);
- let list = this.$refs.tree.getCheckedNodes();
- let listIds = [];
- if (list.length > 0) {
- for (let i = 0; i < list.length; i++) {
- if (list[i].id.length == 12) {
- listIds.push(list[i].id);
- }
- }
- }
- //---------------已选 结束----------
- //---------------筛选届 开始----------
- let gradeIds = [];
- if (flag == "isGrade") {
- for (let i = 0; i < this.ppData.length; i++) {
- if (this.ppData[i].extend == val) {
- //将此选项的ID保存下来
- gradeIds.push(this.ppData[i].id);
- }
- }
- } else {
- //去遍历数组
- for (let i = 0; i < this.teacherList.length; i++) {
- if (this.teacherList[i].userNo == val) {
- if (this.teacherList[i].gradeEntities.length > 0) {
- for (let j = 0; j < this.teacherList[i].gradeEntities.length; j++) {
- gradeIds.push(this.teacherList[i].gradeEntities[j].orgNo);
- }
- }
- }
- }
- }
- //合并两个数组
- let listAll = gradeIds.concat(listIds);
- //然后去重
- let listDeWeight = listAll.filter((item, index, arr) => {
- return arr.indexOf(item) == index;
- });
- this.ruleForm.checkedList = listDeWeight;
- //然后将两个数组进行合并去重
- //---------------筛选届 结束----------
- //再将届数的id合并仅已选组合
- },
- // gradeAdd(val) {
- // //获取当前已选列表
- // console.log(this.grade);
- // //届数改变以后
- // //获取数行已选项,将已选ID组合
- // //---------------已选 开始----------
- // this.checkedList = [];
- // let list = this.$refs.tree.getCheckedNodes();
- // let listIds = [];
- // if (list.length > 0) {
- // for (let i = 0; i < list.length; i++) {
- // listIds.push(list[i].id);
- // }
- // }
- // //---------------已选 结束----------
- // //---------------筛选届 开始----------
- // let gradeIds = [];
- // if (this.grade.length > 0) {
- // for (let i = 0; i < this.ppData.length; i++) {
- // for (let j = 0; j < this.grade.length; j++) {
- // if (this.ppData[i].extend == this.grade[j]) {
- // //将此选项的ID保存下来
- // gradeIds.push(this.ppData[i].id);
- // }
- // }
- // }
- // }
- // //合并两个数组
- // let listAll = gradeIds.concat(listIds);
- // //然后去重
- // let listDeWeight = listAll.filter((item) => {
- // return listAll.indexOf(item);
- // });
- // console.log("去重listDeWeight");
- // console.log(listDeWeight);
- // this.checkedList = listDeWeight;
- // //然后将两个数组进行合并去重
- // //---------------筛选届 结束----------
- // //再将届数的id合并仅已选组合
- // },
- //通过node获取方法已选选项
- getCheckedNodes() {
- // console.log(this.$refs.tree.getCheckedNodes());
- let list = [];
- list = this.$refs.tree.getCheckedKeys();
- this.ruleForm.checkedList = list.filter((item) => {
- return item.length == 12;
- });
- // this.ruleForm.checkedList=this.$refs.tree.getCheckedNodes()
- //循环得到ID 将ID放入数组
- },
- //获取组织架构方法--------------------开始-----------------------
- getChannel() {
- this.$http.get(
- // `/org/findAllOrgByPOrgNo?orgNo=${this.userInfo.orgNo}`,
- `/org/findAllOrgByCurrent`,
- {},
- (res) => {
- // this.$toast.success({message:'成功'});
- if (res && res.code == 200) {
- //将值赋值给list
- if (res.data.length > 0) {
- //当用户角色为3时 需要将数据处理为辅导员的数据
- //选择出来需要的级
- //--------------------------------开始
- //
- //需要保存数据
- let list = [];
- for (let i = 0; i < res.data.length; i++) {
- if (res.data[i].extend !== null && res.data[i].extend !== "") {
- let obj = {
- value: res.data[i].extend,
- label:
- res.data[i].extend == -1 ? "教师组" : `${res.data[i].extend}级`,
- };
- list.push(obj);
- }
- }
- //存储最新的
- let listTT = [];
- //储存最后过滤数据
- let listTMP = [];
- //过滤重复数据
- listTMP = list.filter((item, index, arr) => {
- if (listTT.indexOf(item.label) == -1) {
- listTT.push(item.label);
- return true;
- }
- });
- console.log(listTMP);
- this.gradeOption = listTMP.reverse();
- //--------------------------------结束
- let resAdd = this.addPro(res.data);
- this.ppData = JSON.parse(JSON.stringify(resAdd));
- let forRes = this.arrToTree(resAdd);
- let resultRes = this.deleteChildren(forRes);
- let levelList = this.markersFun(resultRes, 1);
- //修改测试计划
- let listOrg = levelList[0].children;
- this.treeData = listOrg;
- //判断选择时教师还是学生
- if (this.ruleForm.planType == "1") {
- let listOrg = levelList[0].children;
- this.treeData = listOrg.filter((item) => {
- return item.extend == -1;
- });
- } else {
- let listOrg = levelList[0].children;
- this.treeData = listOrg.filter((item) => {
- return item.extend != -1;
- });
- }
- //
- } else {
- this.groupData = [];
- }
- // this.channelList = res.data;
- } else {
- this.$message.error(res.msg);
- }
- }
- );
- },
- //z增加
- addPro(val) {
- let data = JSON.parse(JSON.stringify(val));
- for (let i = 0; i < val.length; i++) {
- data[i].id = val[i].orgNo;
- data[i].label = val[i].orgName;
- }
- return data;
- },
- //非递归方式:将平铺数据转换为树形结构数据
- arrToTree(arr) {
- let data = arr.filter((item) => {
- item.children = arr.filter((e) => {
- return item.orgNo === e.parentOrgNo;
- });
- return item.orgNo == this.userInfo.orgNo;
- });
- return data;
- },
- //去除转换树形结构数据后存在的空children
- deleteChildren(arr) {
- let childs = arr;
- for (let i = childs.length; i--; i > 0) {
- if (childs[i].children) {
- if (childs[i].children.length) {
- this.deleteChildren(childs[i].children);
- } else {
- delete childs[i].children;
- }
- }
- }
- return arr;
- },
- //标记层级
- markersFun(arr, level) {
- if (!arr || !arr.length) {
- return;
- }
- arr.forEach((item) => {
- item.level = level;
- //设置都可以编辑
- item.isEdit = true;
- //设置都可以增加
- item.isAdd = true;
- //设置都可以删除
- item.isDelete = true;
- // item.extend = true;
- item.isExtend = true;
- //当角色是超级管理员时
- if (this.userInfo.roleType == "5") {
- //则level 是三级时
- if (level == "3") {
- item.isAdd = false;
- }
- }
- // //当角色是院管理员时
- if (this.userInfo.roleType == "4") {
- //则level 是三级时
- if (level == "2") {
- item.isAdd = false;
- }
- }
- if (item.children && item.children.length) {
- //
- this.markersFun(item.children, level + 1);
- }
- });
- return arr;
- },
- //获取当前届数
- getGradeFun() {
- this.gradeOption = [];
- //获取当前届数
- //获取当前年份
- let date = new Date();
- let currentYear = date.getFullYear();
- let preYear = currentYear - 12;
- let list = [];
- for (let i = preYear; i < currentYear + 1; i++) {
- //
- let obj = {
- value: i + "",
- label: i + "级",
- };
- list.push(obj);
- }
- this.gradeOption = list.reverse();
- },
- resetForm(val) {
- this.cancle();
- },
- timeChange(val) {
- if (val !== null) {
- //根据时间得到格式化的数据
- this.ruleForm.endTime = this.formatterTime(val);
- }
- },
- formatterTime(val) {
- let date = new Date(val);
- let year = date.getFullYear();
- let month = date.getMonth() + 1;
- month = this.formatterMon(month);
- let day = date.getDate();
- day = this.formatterMon(day);
- return year + "-" + month + "-" + day;
- },
- formatterMon(val) {
- if (val < 10) {
- return "0" + val;
- } else {
- return val;
- }
- },
- open(val) {
- this.cancle();
- //打开后返回的数组
- this.dialogVisible = true;
- this.isView = val;
- //获取渠道信息
-
- // this.getGradeFun();
- this.getChannel();
- this.getTeacher();
- this.queryStudentTemp();
- //查询以下的教师
- //查询学生模版
- //添加计划
- //查询需要选择的量表
- this.$nextTick(() => {
- this.$refs.ruleForm.clearValidate();
- });
- },
- edit(val) {
- this.id = val.id;
- this.dialogVisible = true;
- this.isView = false;
- this.ruleForm.planType = val.planType;
- this.ruleForm.planName = val.planName;
- this.ruleForm.endTime = val.planEndTime;
- //将配置计划置空
- this.ruleForm.checkedList = [];
- this.$refs.tree.setCheckedKeys([]);
- //将快捷选项 届数 置空
- this.grade = [];
- //将快捷选项辅导员置空
- this.instructor = [];
- //将任务选择置空
- this.ruleForm.checkboxGroup2 = [];
- this.$refs["ruleForm"].clearValidate();
- this.userDetailData = val;
- // this.getGradeFun();
- this.getChannel();
- this.getTeacher();
- this.queryStudentTemp();
- //根据ID查询详情
- this.queryDetail();
- //调用查询详情的接口
- },
- //查询量表
- queryDetail() {
- //val 是查询的类型
- this.$http.get(`/plan/findPlanById?id=${this.id}`, {}, (res) => {
- if (res.code == 200) {
- //查询到已选任务的列表
- let list = [];
- list = res.data.contentEntities.filter((item) => {
- return item.isDisplayed == "1";
- });
- //已选任务的列表
- let listTask = [];
- for (let i = 0; i < list.length; i++) {
- //
-
- if(list[i].contentType=='1'){
- //
- this.ruleForm.taskRadio=list[i].flag;
- }else{
- listTask.push(list[i].flag);
- }
- }
- this.ruleForm.checkboxGroup2 = listTask;
- //查询到已选任务
- //查询到已选组织架构的列表
- let listOrg = [];
- //res.data.orgEntityList
- for (let i = 0; i < res.data.orgEntityList.length; i++) {
- //
- listOrg.push(res.data.orgEntityList[i].orgNo);
- }
- this.ruleForm.checkedList = listOrg;
- this.$refs.tree.setCheckedKeys(this.ruleForm.checkedList);
- }
- });
- },
- //全选组织架构
- selectAllDataOrg() {
- let list = [];
- for (let i = 0; i < this.treeData.length; i++) {
- list.push(this.treeData[i].orgNo);
- }
- this.ruleForm.checkedList = list;
- this.$refs.tree.setCheckedKeys(this.ruleForm.checkedList);
- },
- //清空组织架构
- clearDataOrg() {
- this.grade = [];
- this.instructor = [];
- this.$refs.tree.setCheckedKeys([]);
- },
- //调用查询详情的接口
- resetData() {
- //修改编辑计划--关闭该弹出框
- this.dialogVisible = false;
- // this.$refs["ruleForm"].clearValidate();
- // //清空表单
- // this.grade = [];
- // this.instructor = [];
- // this.ruleForm.planName = "";
- // this.ruleForm.endTime = "";
- // this.ruleForm.checkboxGroup2 = [];
- // this.$refs.tree.setCheckedKeys([]);
- // this.ruleForm.checkedList = [];
- },
- cancle() {
- this.$refs["ruleForm"].clearValidate();
- //清空表单
- this.instructor = [];
- this.grade = [];
- this.ruleForm.planName = "";
- this.ruleForm.endTime = "";
- this.ruleForm.taskRadio='';
- this.ruleForm.checkedList = [];
-
- this.$refs.tree.setCheckedKeys([]);
- this.ruleForm.checkboxGroup2 = [];
- this.dialogVisible = false;
- },
- disableFlagStatus() {
- this.disableFlag = false;
- // setTimeout(() => {
- // this.disableFlag = false;
- // }, 1500);
- },
- submitCom() {
- if (this.disableFlag) {
- return;
- }
- this.disableFlag = true;
- let validSp = [];
- if (this.isView) {
- validSp = ["planName", "endTime", "checkedList", "taskRadio"];
- } else {
- validSp = ["planName", "endTime", "checkedList", "taskRadio"];
- }
- let aa = [];
- //获取已选项
- //将值赋值给this.ruleForm.checkedList
- this.getCheckedNodes();
- this.$refs["ruleForm"].validateField(validSp, (valid) => {
- if (!valid) {
- aa.push(valid);
- //判断是编辑还是新增
- if (this.isView) {
- if (aa.length == 4) {
- this.disableFlag = true;
- this.register();
- } else {
- this.disableFlagStatus();
- }
- } else {
- if (aa.length == 4) {
- this.disableFlag = true;
- this.editUserFun();
- } else {
- this.disableFlagStatus();
- }
- }
- //都校验通过后可以触发注册接口了
- //调用方法进行入参
- } else {
- this.disableFlagStatus();
- }
- });
- },
- register() {
- let that = this;
- //获取已选任务的列表
- let list = [];
- let listTmp = [];
- let listTmpNo = [];
- listTmp = this.scaleAndTaskList.filter((item) => {
- return this.ruleForm.checkboxGroup2.includes(item.flag)||this.ruleForm.taskRadio==item.flag;
- });
- for (let i = 0; i < listTmp.length; i++) {
- let obj = {
- contentType: listTmp[i].type,
- flag: listTmp[i].flag,
- isDisplayed: listTmp[i].isDisplayed,
- isAvailable: listTmp[i].isAvailable,
- name: listTmp[i].name,
- expectTime: listTmp[i].expectTime,
- };
- list.push(obj);
- }
- //不展示要传输到后台的字段
- listTmpNo = this.scaleAndTaskList.filter((item) => {
- return item.isDisplayed == "0";
- });
- for (let i = 0; i < listTmpNo.length; i++) {
- let obj = {
- contentType: listTmpNo[i].type,
- flag: listTmpNo[i].flag,
- isDisplayed: listTmpNo[i].isDisplayed,
- isAvailable: listTmpNo[i].isAvailable,
- name: listTmpNo[i].name,
- expectTime: listTmpNo[i].expectTime,
- };
- list.push(obj);
- }
- //得到不展示的数组
- //获取已选组织架构的列表
- let listOrg = [];
- let listOrgTmp = [];
- listOrgTmp = this.ppData.filter((item) => {
- return this.ruleForm.checkedList.includes(item.orgNo);
- });
- for (let i = 0; i < listOrgTmp.length; i++) {
- let obj = {
- orgNo: listOrgTmp[i].orgNo,
- orgName: listOrgTmp[i].orgName,
- };
- listOrg.push(obj);
- }
- // this.ruleForm.password = md5(this.ruleForm.password);
- this.$http.post(
- `/plan/addOrUpdate`,
- {
- // planType:this.ruleForm.planType,
- contentEntities: list,
- orgEntityList: listOrg,
- planName: this.ruleForm.planName,
- planEndTime: this.ruleForm.endTime,
- createUserId: this.userInfo.id,
- createUserName: this.userInfo.userName,
- planOrgNo: this.userInfo.orgNo,
- planOrgName: this.userInfo.orgName,
- planType: this.ruleForm.planType,
- },
- (res) => {
- this.disableFlagStatus();
- // this.disableFlag = false;
- if (res && res.code == 200) {
- this.dialogVisible = false;
- // this.$toast.success({ message: "成功" });
- //调用父组件的查询方法
- that.$emit("search");
- // that.$emit("configuration", res.data);
- //也调用打开人员配置的方法
- } else {
- // this.$toast.fail({ message: res.msg });
- this.$message.error(res.msg);
- }
- //清空缓存
- this.cancle();
- }
- );
- },
- editUserFun() {
- let that = this;
- //获取已选任务的列表
- let list = [];
- let listTmp = [];
- let listTmpNo = [];
- listTmp = this.scaleAndTaskList.filter((item) => {
- return this.ruleForm.checkboxGroup2.includes(item.flag)||this.ruleForm.taskRadio==item.flag;
- });
- for (let i = 0; i < listTmp.length; i++) {
- let obj = {
- contentType: listTmp[i].type,
- flag: listTmp[i].flag,
- isDisplayed: listTmp[i].isDisplayed,
- isAvailable: listTmp[i].isAvailable,
- name: listTmp[i].name,
- expectTime: listTmp[i].expectTime,
- };
- list.push(obj);
- }
- //不展示要传输到后台的字段
- listTmpNo = this.scaleAndTaskList.filter((item) => {
- return item.isDisplayed == "0";
- });
- for (let i = 0; i < listTmpNo.length; i++) {
- let obj = {
- contentType: listTmpNo[i].type,
- flag: listTmpNo[i].flag,
- isDisplayed: listTmpNo[i].isDisplayed,
- isAvailable: listTmpNo[i].isAvailable,
- name: listTmpNo[i].name,
- expectTime: listTmpNo[i].expectTime,
- };
- list.push(obj);
- }
- //获取已选组织架构的列表
- let listOrg = [];
- let listOrgTmp = [];
- listOrgTmp = this.ppData.filter((item) => {
- return this.ruleForm.checkedList.includes(item.orgNo);
- });
- for (let i = 0; i < listOrgTmp.length; i++) {
- let obj = {
- orgNo: listOrgTmp[i].orgNo,
- orgName: listOrgTmp[i].orgName,
- };
- listOrg.push(obj);
- }
- this.userDetailData.planEndTime = this.ruleForm.endTime;
- this.userDetailData.planName = this.ruleForm.planName;
- this.userDetailData.contentEntities = list;
- this.userDetailData.orgEntityList = listOrg;
- this.userDetailData.planType = this.ruleForm.planType;
- this.$http.post(
- `/plan/addOrUpdate`,
- {
- ...this.userDetailData,
- },
- (res) => {
- this.disableFlagStatus();
- if (res && res.code == 200) {
- this.dialogVisible = false;
- // this.$toast.success({ message: "成功" });
- //调用父组件的查询方法
- that.$emit("search");
- this.$message.success("修改成功");
- } else {
- // this.$toast.fail({ message: res.msg });
- this.$message.error(res.msg);
- }
- }
- );
- },
- },
- };
- </script>
- <style lang="less" scoped>
- input[aria-hidden="true"] {
- display: none !important;
- }
- .el-radio:focus:not(.is-focus):not(:active):not(.is-disabled) .el-radio__inner {
- box-shadow: none;
- }
- .taskSelect /deep/ .el-checkbox.is-bordered + .el-checkbox.is-bordered {
- margin-left: 0px !important;
- }
- .dig_update /deep/ .el-dialog {
- border-radius: 20px !important;
- }
- .form_main::-webkit-scrollbar {
- width: 6px;
- }
- .form_main::-webkit-scrollbar-track {
- background: rgb(239, 239, 239);
- border-radius: 2px;
- }
- .form_main::-webkit-scrollbar-thumb {
- background: #00000049;
- border-radius: 10px;
- }
- .form_main::-webkit-scrollbar-thumb:hover {
- background: #444444;
- }
- .dig_update /deep/.el-cascader {
- position: relative;
- font-size: 14px;
- line-height: 40px;
- width: 100%;
- }
- // .dig_update /deep/.el-dialog {
- // box-shadow: none !important;
- // background: transparent !important;
- // }
- .demo-ruleForm /deep/ .el-form-item {
- margin-right: 10px;
- vertical-align: top;
- display: flex !important;
- flex-direction: column;
- }
- .demo-ruleForm /deep/.el-form-item__label {
- text-align: left;
- vertical-align: middle;
- float: left;
- font-size: 14px;
- color: #606266;
- line-height: 40px;
- padding: 0 12px 0 0;
- -webkit-box-sizing: border-box;
- box-sizing: border-box;
- }
- .demo-ruleForm /deep/.el-input {
- width: 100% !important;
- }
- .demo-ruleForm /deep/.el-input__inner {
- width: 100% !important;
- background-color: #f7f7f7;
- border: 0px;
- }
- .dig_button {
- display: flex;
- width: 100%;
- justify-content: space-around;
- }
- .demo-ruleForm {
- background-color: #ffffff;
- // border-radius: 20px;
- margin-right: -10px;
- margin-top: -10px;
- // padding-right: 100px;
- // padding-left: 100px;
- border-radius: 20px;
- padding-top: 20px;
- padding-bottom: 40px;
- .dig_title {
- margin-bottom: 30px;
- text-align: center;
- font-weight: 700;
- }
- }
- </style>
|