PlanRegister.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911
  1. <template>
  2. <div>
  3. <!---lxh-修改密码-->
  4. <div class="dig_update">
  5. <el-dialog
  6. :visible.sync="dialogVisible"
  7. :close-on-click-modal="false"
  8. width="40%"
  9. top="5vh"
  10. style="overflow: hidden"
  11. >
  12. <div slot="title">
  13. <el-form
  14. :model="ruleForm"
  15. :rules="rules"
  16. :inline="true"
  17. ref="ruleForm"
  18. label-width="150px"
  19. class="demo-ruleForm"
  20. >
  21. <p v-if="isView" class="dig_title">新增计划</p>
  22. <p v-if="!isView" class="dig_title">编辑计划</p>
  23. <div slot=""></div>
  24. <div slot="footer"></div>
  25. <div
  26. style="
  27. height: 60vh;
  28. overflow-y: auto;
  29. padding-left: 20px;
  30. padding-right: 20px;
  31. "
  32. class="form_main"
  33. >
  34. <el-form-item label="计划名称" prop="planName">
  35. <el-input v-model="ruleForm.planName"></el-input>
  36. </el-form-item>
  37. <el-form-item label="结束时间" prop="endTime">
  38. <el-date-picker
  39. v-model="ruleForm.endTime"
  40. type="date"
  41. placeholder="选择日期"
  42. @change="timeChange"
  43. >
  44. </el-date-picker>
  45. </el-form-item>
  46. <el-form-item label="快捷选项">
  47. <el-row>
  48. <el-col :span="12">
  49. <!-- @change="gradeChange"
  50. @remove-tag="gradeRemoveChange"
  51. -->
  52. <el-select
  53. :collapse-tags="true"
  54. multiple
  55. placeholder="请选择届"
  56. v-model="grade"
  57. clearable
  58. filterable
  59. >
  60. <el-option
  61. v-for="item in gradeOption"
  62. :key="item.value"
  63. :label="item.label"
  64. :value="item.value"
  65. >
  66. </el-option>
  67. </el-select>
  68. </el-col>
  69. <el-col :span="12" style="text-align: right">
  70. <el-select
  71. :collapse-tags="true"
  72. multiple
  73. placeholder="请选择辅导员"
  74. v-model="instructor"
  75. clearable
  76. filterable
  77. >
  78. <el-option
  79. v-for="item in instructorOption"
  80. :key="item.value"
  81. :label="item.label"
  82. :value="item.value"
  83. >
  84. </el-option>
  85. </el-select>
  86. </el-col>
  87. </el-row>
  88. </el-form-item>
  89. <el-form-item label="配置计划">
  90. <el-tree
  91. :data="treeData"
  92. show-checkbox
  93. node-key="id"
  94. default-expand-all
  95. :default-checked-keys="checkedList"
  96. :props="defaultProps"
  97. ref="tree"
  98. >
  99. </el-tree>
  100. </el-form-item>
  101. <el-button @click="getCheckedNodes"> 获取已选 </el-button>
  102. <el-form-item label="任务选择" class="taskSelect">
  103. <el-checkbox-group v-model="checkboxGroup2" size="mini">
  104. <el-checkbox
  105. v-for="item in scaleList"
  106. :key="item.id"
  107. :label="item.flag"
  108. border
  109. :disabled="item.isRequired == '1'"
  110. >{{ item.name }}</el-checkbox
  111. >
  112. <el-checkbox
  113. v-for="item in taskList"
  114. :key="item.id"
  115. :label="item.flag"
  116. border
  117. :disabled="item.isRequired == '1'"
  118. >{{ item.name }}</el-checkbox
  119. >
  120. <!-- <el-checkbox label="2" border>{{ cognitionName }}</el-checkbox> -->
  121. </el-checkbox-group>
  122. </el-form-item>
  123. </div>
  124. </el-form>
  125. <div class="dig_button">
  126. <el-button type="info" round @click="resetData()">重置</el-button>
  127. <el-button type="success" round @click="submitCom()">提交</el-button>
  128. </div>
  129. </div>
  130. <!-- <div slot="footer">
  131. <div class="dig_button">
  132. <el-button type="info" round @click="resetData()">重置</el-button>
  133. <el-button type="success" round @click="submitCom()">下一步</el-button>
  134. </div>
  135. </div> -->
  136. </el-dialog>
  137. </div>
  138. </div>
  139. </template>
  140. <script>
  141. // import { oSessionStorage } from "../../utils/utils";
  142. import { oSessionStorage } from "../utils/utils";
  143. import md5 from "md5";
  144. export default {
  145. data() {
  146. return {
  147. //编辑返回的值
  148. userDetailData: {},
  149. //组织架构名字
  150. groupName: "",
  151. disableFlag: false,
  152. phoneFlag: false,
  153. flag: 3,
  154. dialogVisible: false,
  155. //渠道列表
  156. ruleForm: {
  157. //所属组织架构
  158. planName: "",
  159. endTime: "",
  160. },
  161. isView: true,
  162. rules: {
  163. planName: [{ required: true, message: "请输入计划名称", trigger: "blur" }],
  164. endTime: [{ required: true, message: "请输结束时间", trigger: "blur" }],
  165. },
  166. userInfo: {},
  167. scaleAndCon: [],
  168. checkboxGroup2: ["1"],
  169. //查看是不是两次都调用完了
  170. countList: [],
  171. //显示用的认知任务名称
  172. cognitionName: "",
  173. id: "",
  174. //学生届数
  175. gradeOption: [],
  176. //辅导员列表
  177. instructorOption: [],
  178. //辅导员的原始列表
  179. teacherList: [],
  180. //树形选择班级的框
  181. treeData: [
  182. {
  183. id: 1,
  184. label: "一级 1",
  185. },
  186. ],
  187. defaultProps: {
  188. children: "children",
  189. label: "label",
  190. },
  191. //所选届数
  192. grade: [],
  193. instructor: [],
  194. ppData: [],
  195. checkedList: [],
  196. //任务可选量表数据
  197. scaleAndTaskList: [],
  198. scaleList: [],
  199. taskList: [],
  200. };
  201. },
  202. //需要监听变量
  203. //如果这样变量增加的是谁,减少的是谁都知道
  204. watch: {
  205. grade(newCount, oldCount) {
  206. //首先是判断是新增还是减少
  207. //如果是新增
  208. if (newCount.length > oldCount.length) {
  209. let poor = newCount.filter((a) => !oldCount.includes(a));
  210. //此时新增的话需要调用方法
  211. //此时要判断增加的是谁
  212. if (poor.length == 1) {
  213. this.gradeAdd(poor[0], "isGrade");
  214. }
  215. } else if (newCount.length < oldCount.length) {
  216. let poor = oldCount.filter((a) => !newCount.includes(a));
  217. if (poor.length == 1) {
  218. this.gradeDecrease(poor[0], "isGrade");
  219. }
  220. }
  221. //如果是减少
  222. },
  223. //判断是减少还是增多
  224. instructor(newCount, oldCount) {
  225. if (newCount.length > oldCount.length) {
  226. let poor = newCount.filter((a) => !oldCount.includes(a));
  227. //此时新增的话需要调用方法
  228. //此时要判断增加的是谁
  229. if (poor.length == 1) {
  230. this.gradeAdd(poor[0], "noGrade");
  231. }
  232. } else if (newCount.length < oldCount.length) {
  233. let poor = oldCount.filter((a) => !newCount.includes(a));
  234. if (poor.length == 1) {
  235. this.gradeDecrease(poor[0], "noGrade");
  236. }
  237. }
  238. },
  239. },
  240. mounted() {
  241. this.userInfo = JSON.parse(oSessionStorage.getItem("userInfo"));
  242. // this.ruleForm.type = "3";
  243. },
  244. methods: {
  245. //查询学生模版
  246. queryStudentTemp() {
  247. this.$http.get(`/content/findAllByTemplate?template=studentContent`, {}, (res) => {
  248. // this.$toast.success({message:'成功'});
  249. if (res && res.code == 200) {
  250. //将值赋值给list
  251. if (res.data.length > 0) {
  252. this.scaleAndTaskList = res.data;
  253. this.scaleList = res.data.filter((item) => {
  254. //并且 是必须展示的
  255. return item.type == "0" && item.isDisplayed == "1";
  256. });
  257. this.taskList = res.data.filter((item) => {
  258. return item.type == "1" && item.isDisplayed == "1";
  259. });
  260. // checkboxGroup2
  261. let listRequest = res.data.filter((item) => {
  262. return item.isRequired == "1";
  263. });
  264. this.checkboxGroup2 = [];
  265. for (let i = 0; i < listRequest.length; i++) {
  266. this.checkboxGroup2.push(listRequest[i].flag);
  267. }
  268. // instructorOption
  269. } else {
  270. // this.groupData = [];
  271. }
  272. // this.channelList = res.data;
  273. } else {
  274. this.$message.error(res.msg);
  275. }
  276. });
  277. },
  278. //获取辅导员
  279. getTeacher() {
  280. this.instructorOption = [];
  281. this.$http.get(`/user/findAllCounsellor`, {}, (res) => {
  282. // this.$toast.success({message:'成功'});
  283. if (res && res.code == 200) {
  284. //将值赋值给list
  285. if (res.data.length > 0) {
  286. //
  287. this.teacherList = res.data;
  288. for (let i = 0; i < res.data.length; i++) {
  289. //
  290. let obj = {
  291. value: res.data[i].userNo,
  292. label: res.data[i].userName,
  293. };
  294. this.instructorOption.push(obj);
  295. }
  296. // instructorOption
  297. } else {
  298. // this.groupData = [];
  299. }
  300. // this.channelList = res.data;
  301. } else {
  302. this.$message.error(res.msg);
  303. }
  304. });
  305. },
  306. //当选择的届减少时
  307. gradeDecrease(val, flag) {
  308. //减少的时候去查询
  309. // this.checkedList = [];
  310. let original = JSON.parse(JSON.stringify(this.checkedList));
  311. let gradeIds = [];
  312. if (flag == "isGrade") {
  313. for (let i = 0; i < this.ppData.length; i++) {
  314. if (this.ppData[i].extend == val) {
  315. //将此选项的ID保存下来
  316. gradeIds.push(this.ppData[i].id);
  317. }
  318. }
  319. } else {
  320. //
  321. for (let i = 0; i < this.teacherList.length; i++) {
  322. if (this.teacherList[i].userNo == val) {
  323. if (this.teacherList[i].gradeEntities.length > 0) {
  324. for (let j = 0; j < this.teacherList[i].gradeEntities.length; j++) {
  325. gradeIds.push(this.teacherList[i].gradeEntities[j].orgNo);
  326. }
  327. }
  328. }
  329. }
  330. }
  331. //求差值
  332. this.checkedList = original.filter((item) => !gradeIds.includes(item));
  333. //这些ID都需要从已选中去掉
  334. // this.checkedList=['000000100015']
  335. this.$refs.tree.setCheckedKeys(this.checkedList);
  336. //应该是要判断减少的是什么
  337. },
  338. //当选择的届发生改变时
  339. gradeAdd(val, flag) {
  340. //获取当前已选列表
  341. //届数改变以后
  342. //获取数行已选项,将已选ID组合
  343. //---------------已选 开始----------
  344. this.checkedList = [];
  345. let list = this.$refs.tree.getCheckedNodes();
  346. let listIds = [];
  347. if (list.length > 0) {
  348. for (let i = 0; i < list.length; i++) {
  349. listIds.push(list[i].id);
  350. }
  351. }
  352. //---------------已选 结束----------
  353. //---------------筛选届 开始----------
  354. let gradeIds = [];
  355. if (flag == "isGrade") {
  356. for (let i = 0; i < this.ppData.length; i++) {
  357. if (this.ppData[i].extend == val) {
  358. //将此选项的ID保存下来
  359. gradeIds.push(this.ppData[i].id);
  360. }
  361. }
  362. } else {
  363. //去遍历数组
  364. for (let i = 0; i < this.teacherList.length; i++) {
  365. if (this.teacherList[i].userNo == val) {
  366. if (this.teacherList[i].gradeEntities.length > 0) {
  367. for (let j = 0; j < this.teacherList[i].gradeEntities.length; j++) {
  368. gradeIds.push(this.teacherList[i].gradeEntities[j].orgNo);
  369. }
  370. }
  371. }
  372. }
  373. }
  374. //合并两个数组
  375. let listAll = gradeIds.concat(listIds);
  376. //然后去重
  377. let listDeWeight = listAll.filter((item, index, arr) => {
  378. return arr.indexOf(item) == index;
  379. });
  380. this.checkedList = listDeWeight;
  381. //this.checkedList
  382. //然后将两个数组进行合并去重
  383. //---------------筛选届 结束----------
  384. //再将届数的id合并仅已选组合
  385. },
  386. // gradeAdd(val) {
  387. // //获取当前已选列表
  388. // console.log(this.grade);
  389. // //届数改变以后
  390. // //获取数行已选项,将已选ID组合
  391. // //---------------已选 开始----------
  392. // this.checkedList = [];
  393. // let list = this.$refs.tree.getCheckedNodes();
  394. // let listIds = [];
  395. // if (list.length > 0) {
  396. // for (let i = 0; i < list.length; i++) {
  397. // listIds.push(list[i].id);
  398. // }
  399. // }
  400. // //---------------已选 结束----------
  401. // //---------------筛选届 开始----------
  402. // let gradeIds = [];
  403. // if (this.grade.length > 0) {
  404. // for (let i = 0; i < this.ppData.length; i++) {
  405. // for (let j = 0; j < this.grade.length; j++) {
  406. // if (this.ppData[i].extend == this.grade[j]) {
  407. // //将此选项的ID保存下来
  408. // gradeIds.push(this.ppData[i].id);
  409. // }
  410. // }
  411. // }
  412. // }
  413. // //合并两个数组
  414. // let listAll = gradeIds.concat(listIds);
  415. // //然后去重
  416. // let listDeWeight = listAll.filter((item) => {
  417. // return listAll.indexOf(item);
  418. // });
  419. // console.log("去重listDeWeight");
  420. // console.log(listDeWeight);
  421. // this.checkedList = listDeWeight;
  422. // //this.checkedList
  423. // //然后将两个数组进行合并去重
  424. // //---------------筛选届 结束----------
  425. // //再将届数的id合并仅已选组合
  426. // },
  427. //通过node获取方法已选选项
  428. getCheckedNodes() {
  429. console.log(this.$refs.tree.getCheckedNodes());
  430. //循环得到ID 将ID放入数组
  431. },
  432. //获取组织架构方法--------------------开始-----------------------
  433. getChannel() {
  434. this.$http.get(
  435. `/org/findAllOrgByPOrgNo?orgNo=${this.userInfo.orgNo}`,
  436. {},
  437. (res) => {
  438. // this.$toast.success({message:'成功'});
  439. if (res && res.code == 200) {
  440. //将值赋值给list
  441. if (res.data.length > 0) {
  442. let resAdd = this.addPro(res.data);
  443. this.ppData = JSON.parse(JSON.stringify(resAdd));
  444. let forRes = this.arrToTree(resAdd);
  445. let resultRes = this.deleteChildren(forRes);
  446. let levelList = this.markersFun(resultRes, 1);
  447. this.treeData = levelList;
  448. } else {
  449. this.groupData = [];
  450. }
  451. // this.channelList = res.data;
  452. } else {
  453. this.$message.error(res.msg);
  454. }
  455. }
  456. );
  457. },
  458. //z增加
  459. addPro(val) {
  460. let data = JSON.parse(JSON.stringify(val));
  461. for (let i = 0; i < val.length; i++) {
  462. data[i].id = val[i].orgNo;
  463. data[i].label = val[i].orgName;
  464. }
  465. return data;
  466. },
  467. //非递归方式:将平铺数据转换为树形结构数据
  468. arrToTree(arr) {
  469. let data = arr.filter((item) => {
  470. item.children = arr.filter((e) => {
  471. return item.orgNo === e.parentOrgNo;
  472. });
  473. return item.orgNo == this.userInfo.orgNo;
  474. });
  475. return data;
  476. },
  477. //去除转换树形结构数据后存在的空children
  478. deleteChildren(arr) {
  479. let childs = arr;
  480. for (let i = childs.length; i--; i > 0) {
  481. if (childs[i].children) {
  482. if (childs[i].children.length) {
  483. this.deleteChildren(childs[i].children);
  484. } else {
  485. delete childs[i].children;
  486. }
  487. }
  488. }
  489. return arr;
  490. },
  491. //标记层级
  492. markersFun(arr, level) {
  493. if (!arr || !arr.length) {
  494. return;
  495. }
  496. arr.forEach((item) => {
  497. item.level = level;
  498. //设置都可以编辑
  499. item.isEdit = true;
  500. //设置都可以增加
  501. item.isAdd = true;
  502. //设置都可以删除
  503. item.isDelete = true;
  504. // item.extend = true;
  505. item.isExtend = true;
  506. //当角色是超级管理员时
  507. if (this.userInfo.roleType == "5") {
  508. //则level 是三级时
  509. if (level == "3") {
  510. item.isAdd = false;
  511. }
  512. }
  513. // //当角色是院管理员时
  514. if (this.userInfo.roleType == "4") {
  515. //则level 是三级时
  516. if (level == "2") {
  517. item.isAdd = false;
  518. }
  519. }
  520. if (item.children && item.children.length) {
  521. //
  522. this.markersFun(item.children, level + 1);
  523. }
  524. });
  525. return arr;
  526. },
  527. //获取当前届数
  528. getGradeFun() {
  529. this.gradeOption = [];
  530. //获取当前届数
  531. //获取当前年份
  532. let date = new Date();
  533. let currentYear = date.getFullYear();
  534. let preYear = currentYear - 12;
  535. let list = [];
  536. for (let i = preYear; i < currentYear + 1; i++) {
  537. //
  538. let obj = {
  539. value: i + "",
  540. label: i + "届",
  541. };
  542. list.push(obj);
  543. }
  544. this.gradeOption = list.reverse();
  545. },
  546. resetForm(val) {
  547. this.cancle();
  548. },
  549. timeChange(val) {
  550. if (val !== null) {
  551. //根据时间得到格式化的数据
  552. this.ruleForm.endTime = this.formatterTime(val);
  553. }
  554. },
  555. formatterTime(val) {
  556. let date = new Date(val);
  557. let year = date.getFullYear();
  558. let month = date.getMonth() + 1;
  559. month = this.formatterMon(month);
  560. let day = date.getDate();
  561. day = this.formatterMon(day);
  562. return year + "-" + month + "-" + day;
  563. },
  564. formatterMon(val) {
  565. if (val < 10) {
  566. return "0" + val;
  567. } else {
  568. return val;
  569. }
  570. },
  571. open(val) {
  572. this.cancle();
  573. //打开后返回的数组
  574. this.dialogVisible = true;
  575. this.isView = val;
  576. //获取渠道信息
  577. this.getGradeFun();
  578. this.getChannel();
  579. this.getTeacher();
  580. this.queryStudentTemp();
  581. //查询以下的教师
  582. //查询学生模版
  583. //添加计划
  584. //查询需要选择的量表
  585. this.$nextTick(() => {
  586. this.$refs.ruleForm.clearValidate();
  587. });
  588. },
  589. edit(val) {
  590. this.id = val.id;
  591. this.dialogVisible = true;
  592. this.isView = false;
  593. this.ruleForm.planName = val.planName;
  594. this.ruleForm.endTime = val.planEndTime;
  595. this.userDetailData = val;
  596. //调用查询详情的接口
  597. },
  598. //查询量表
  599. queryDetail() {
  600. //val 是查询的类型
  601. this.$http.get(`/plan/findPlanById?id=${this.id}`, {}, (res) => {
  602. if (res.code == 200) {
  603. let list = res.data.contentEntities;
  604. let listTmp = list.filter((item) => {
  605. return item.contentType == "1";
  606. });
  607. if (listTmp.length > 0) {
  608. // this.checkboxGroup2 = ["1", "2"];
  609. }
  610. }
  611. });
  612. },
  613. //调用查询详情的接口
  614. resetData() {
  615. this.$refs["ruleForm"].clearValidate();
  616. //清空表单
  617. this.ruleForm.planName = "";
  618. this.ruleForm.endTime = "";
  619. },
  620. cancle() {
  621. this.$refs["ruleForm"].clearValidate();
  622. //清空表单
  623. this.ruleForm.planName = "";
  624. this.ruleForm.endTime = "";
  625. this.dialogVisible = false;
  626. },
  627. disableFlagStatus() {
  628. setTimeout(() => {
  629. this.disableFlag = false;
  630. }, 1500);
  631. },
  632. submitCom() {
  633. if (this.disableFlag) {
  634. return;
  635. }
  636. this.disableFlag = true;
  637. let validSp = [];
  638. if (this.isView) {
  639. validSp = ["planName", "endTime"];
  640. } else {
  641. validSp = ["planName", "endTime"];
  642. }
  643. let aa = [];
  644. this.$refs["ruleForm"].validateField(validSp, (valid) => {
  645. if (!valid) {
  646. aa.push(valid);
  647. //判断是编辑还是新增
  648. if (this.isView) {
  649. if (aa.length == 2) {
  650. this.register();
  651. } else {
  652. this.disableFlagStatus();
  653. }
  654. } else {
  655. if (aa.length == 2) {
  656. this.editUserFun();
  657. } else {
  658. this.disableFlagStatus();
  659. }
  660. }
  661. //都校验通过后可以触发注册接口了
  662. //调用方法进行入参
  663. } else {
  664. this.disableFlagStatus();
  665. }
  666. });
  667. },
  668. register() {
  669. let that = this;
  670. //获取已选任务的列表
  671. let list = [];
  672. let listTmp = [];
  673. listTmp = this.scaleAndTaskList.filter((item) => {
  674. return this.checkboxGroup2.includes(item.flag);
  675. });
  676. for (let i = 0; i < listTmp.length; i++) {
  677. let obj = {
  678. contentType: listTmp[i].type,
  679. flag: listTmp[i].flag,
  680. isDisplayed: listTmp[i].isDisplayed,
  681. isAvailable: listTmp[i].isAvailable,
  682. name:listTmp[i].name
  683. };
  684. list.push(obj);
  685. }
  686. //获取已选组织架构的列表
  687. let listOrg = [];
  688. let listOrgTmp = [];
  689. listOrgTmp = this.ppData.filter((item) => {
  690. return this.checkedList.includes(item.orgNo);
  691. });
  692. for (let i = 0; i < listOrgTmp.length; i++) {
  693. let obj = {
  694. orgNo: listOrgTmp[i].orgNo,
  695. orgName: listOrgTmp[i].orgName,
  696. };
  697. listOrg.push(obj);
  698. }
  699. // this.ruleForm.password = md5(this.ruleForm.password);
  700. this.$http.post(
  701. `/plan/addOrUpdate`,
  702. {
  703. contentEntities: list,
  704. orgEntityList: listOrg,
  705. planName: this.ruleForm.planName,
  706. planEndTime: this.ruleForm.endTime,
  707. createUserId: this.userInfo.id,
  708. createUserName: this.userInfo.userName,
  709. planOrgNo: this.userInfo.orgNo,
  710. planOrgName: this.userInfo.orgName,
  711. planType:'0'
  712. },
  713. (res) => {
  714. this.disableFlagStatus();
  715. // this.disableFlag = false;
  716. if (res && res.code == 200) {
  717. this.dialogVisible = false;
  718. // this.$toast.success({ message: "成功" });
  719. //调用父组件的查询方法
  720. that.$emit("search");
  721. // that.$emit("configuration", res.data);
  722. //也调用打开人员配置的方法
  723. } else {
  724. // this.$toast.fail({ message: res.msg });
  725. this.$message.error(res.msg);
  726. }
  727. //清空缓存
  728. this.cancle();
  729. }
  730. );
  731. },
  732. editUserFun() {
  733. let that = this;
  734. let list = [];
  735. if (this.checkboxGroup2.length == 2) {
  736. //开始组装数据
  737. for (let i = 0; i < this.scaleAndCon.length; i++) {
  738. //
  739. if (this.scaleAndCon[i].paramType == "cognition") {
  740. let obj = {
  741. contentType: "1",
  742. description: this.scaleAndCon[i].paramDesc,
  743. flag: this.scaleAndCon[i].paramValue,
  744. name: this.scaleAndCon[i].paramName,
  745. };
  746. list.push(obj);
  747. }
  748. if (this.scaleAndCon[i].paramType == "scale") {
  749. let obj = {
  750. contentType: "0",
  751. description: this.scaleAndCon[i].paramDesc,
  752. flag: this.scaleAndCon[i].paramValue,
  753. name: this.scaleAndCon[i].paramName,
  754. };
  755. list.push(obj);
  756. }
  757. }
  758. } else {
  759. for (let i = 0; i < this.scaleAndCon.length; i++) {
  760. if (this.scaleAndCon[i].paramType == "scale") {
  761. let obj = {
  762. contentType: "0",
  763. description: this.scaleAndCon[i].paramDesc,
  764. flag: this.scaleAndCon[i].paramValue,
  765. name: this.scaleAndCon[i].paramName,
  766. };
  767. list.push(obj);
  768. }
  769. }
  770. }
  771. this.userDetailData.planEndTime = this.ruleForm.endTime;
  772. this.userDetailData.planName = this.ruleForm.planName;
  773. this.userDetailData.contentEntities = list;
  774. this.$http.post(
  775. `/plan/addOrUpdate`,
  776. {
  777. ...this.userDetailData,
  778. },
  779. (res) => {
  780. this.disableFlagStatus();
  781. if (res && res.code == 200) {
  782. this.dialogVisible = false;
  783. // this.$toast.success({ message: "成功" });
  784. //调用父组件的查询方法
  785. that.$emit("search");
  786. this.$message.success("修改成功");
  787. } else {
  788. // this.$toast.fail({ message: res.msg });
  789. this.$message.error(res.msg);
  790. }
  791. //清空缓存
  792. //清空缓存
  793. }
  794. );
  795. },
  796. },
  797. };
  798. </script>
  799. <style lang="less" scoped>
  800. .taskSelect /deep/ .el-checkbox.is-bordered + .el-checkbox.is-bordered {
  801. margin-left: 0px !important;
  802. }
  803. .dig_update /deep/ .el-dialog {
  804. border-radius: 20px !important;
  805. }
  806. .form_main::-webkit-scrollbar {
  807. width: 6px;
  808. }
  809. .form_main::-webkit-scrollbar-track {
  810. background: rgb(239, 239, 239);
  811. border-radius: 2px;
  812. }
  813. .form_main::-webkit-scrollbar-thumb {
  814. background: #00000049;
  815. border-radius: 10px;
  816. }
  817. .form_main::-webkit-scrollbar-thumb:hover {
  818. background: #444444;
  819. }
  820. .dig_update /deep/.el-cascader {
  821. position: relative;
  822. font-size: 14px;
  823. line-height: 40px;
  824. width: 100%;
  825. }
  826. // .dig_update /deep/.el-dialog {
  827. // box-shadow: none !important;
  828. // background: transparent !important;
  829. // }
  830. .demo-ruleForm /deep/ .el-form-item {
  831. margin-right: 10px;
  832. vertical-align: top;
  833. display: flex !important;
  834. flex-direction: column;
  835. }
  836. .demo-ruleForm /deep/.el-form-item__label {
  837. text-align: left;
  838. vertical-align: middle;
  839. float: left;
  840. font-size: 14px;
  841. color: #606266;
  842. line-height: 40px;
  843. padding: 0 12px 0 0;
  844. -webkit-box-sizing: border-box;
  845. box-sizing: border-box;
  846. }
  847. .demo-ruleForm /deep/.el-input {
  848. width: 100% !important;
  849. }
  850. .demo-ruleForm /deep/.el-input__inner {
  851. width: 100% !important;
  852. background-color: #f7f7f7;
  853. border: 0px;
  854. }
  855. .dig_button {
  856. display: flex;
  857. width: 100%;
  858. justify-content: space-around;
  859. }
  860. .demo-ruleForm {
  861. background-color: #ffffff;
  862. // border-radius: 20px;
  863. margin-right: -10px;
  864. margin-top: -10px;
  865. // padding-right: 100px;
  866. // padding-left: 100px;
  867. border-radius: 20px;
  868. padding-top: 20px;
  869. padding-bottom: 40px;
  870. .dig_title {
  871. margin-bottom: 30px;
  872. text-align: center;
  873. font-weight: 700;
  874. }
  875. }
  876. </style>