PlanUserStatus.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  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="80%"
  9. style="border-radius: 40px"
  10. >
  11. <div slot="title">
  12. <div label-width="150px" class="demo-ruleForm">
  13. <p v-if="isView" class="dig_title">人员配置</p>
  14. <p v-if="!isView" class="dig_title">编辑计划</p>
  15. <div slot=""></div>
  16. <div slot="footer"></div>
  17. <div class="table-content">
  18. <el-table
  19. :data="tableData"
  20. :row-style="{ height: '0px' }"
  21. :cell-style="{ padding: '5px' }"
  22. :header-cell-style="{ background: '#F8F8F8', color: '#606266' }"
  23. >
  24. <el-table-column
  25. show-overflow-tooltip
  26. prop="userName"
  27. label="姓名"
  28. align="center"
  29. width=""
  30. >
  31. </el-table-column>
  32. <el-table-column prop="userNo" label="学号" align="center" width="">
  33. </el-table-column>
  34. <el-table-column
  35. prop="isComplete"
  36. label="是否已完成"
  37. :formatter="formaCom"
  38. align="center"
  39. width=""
  40. >
  41. <template slot-scope="scope">
  42. <div v-if="scope.row.isComplete == '0'" style="color: #ff7800">
  43. 未开始
  44. </div>
  45. <div v-if="scope.row.isComplete == '1'" style="color: #333333">
  46. 已完成
  47. </div>
  48. </template>
  49. </el-table-column>
  50. <el-table-column
  51. prop="orgName"
  52. label="所属组织架构"
  53. align="center"
  54. width=""
  55. >
  56. </el-table-column>
  57. <!-- <el-table-column label="操作" width="510px" align="center">
  58. <template slot-scope="scope">
  59. <div class="detail_button_out">
  60. <div class="detail_button" @click="deleteUser(scope.row)">
  61. <img style="width: 20px" src="../assets/img/table/delete.png" />
  62. <span> 移除 </span>
  63. </div>
  64. </div>
  65. </template>
  66. </el-table-column> -->
  67. </el-table>
  68. </div>
  69. <el-pagination
  70. class="pag_class"
  71. background
  72. @size-change="handleSizeChange"
  73. @current-change="handleCurrentChange"
  74. :current-page.sync="pageNum"
  75. layout="total, sizes, prev, pager, next"
  76. :page-size="pageSize"
  77. :page-sizes="[10, 20, 50, 100]"
  78. :total="total"
  79. >
  80. </el-pagination>
  81. <div class="dig_button"></div>
  82. </div>
  83. </div>
  84. </el-dialog>
  85. </div>
  86. </div>
  87. </template>
  88. <script>
  89. // import { oSessionStorage } from "../../utils/utils";
  90. import { oSessionStorage } from "../utils/utils";
  91. import md5 from "md5";
  92. export default {
  93. data() {
  94. return {
  95. userVisible: false,
  96. //编辑返回的值
  97. userDetailData: {},
  98. //组织架构名字
  99. groupName: "",
  100. disableFlag: false,
  101. phoneFlag: false,
  102. flag: 3,
  103. dialogVisible: false,
  104. //渠道列表
  105. isView: true,
  106. //当前计划ID
  107. planId: "",
  108. userInfo: {},
  109. proDataLin: [],
  110. total: 0,
  111. pageSize: 10,
  112. pageNum: 1,
  113. tableData: [],
  114. userTotal: 0,
  115. userpageSize: 10,
  116. userPageNum: 1,
  117. userTableData: [],
  118. multipleSelection: [],
  119. };
  120. },
  121. mounted() {
  122. this.userInfo = JSON.parse(oSessionStorage.getItem("userInfo"));
  123. //获取渠道信息
  124. // this.ruleForm.type = "3";
  125. },
  126. methods: {
  127. formaCom(val) {
  128. if (val.isComplete == "0") {
  129. return "未完成";
  130. } else {
  131. return "已完成";
  132. }
  133. },
  134. deleteUser(val) {
  135. let data = [val.id];
  136. //调用接口开始添加
  137. let url = `/planUser/deletePlanUsers`;
  138. this.$http.post(url, data, (res) => {
  139. if (res && res.code == 200) {
  140. this.searchTarget();
  141. this.tableData = res.data.content;
  142. this.total = res.data.totalElements;
  143. } else {
  144. // this.$toast.fail(res.msg);
  145. this.$message.error(res.msg);
  146. }
  147. });
  148. },
  149. addUser() {
  150. this.userVisible = true;
  151. //调用待添加的用户
  152. this.userSearchTarget();
  153. },
  154. isComUser(val, row) {
  155. //添加已选用户
  156. let data = [];
  157. if (val == 1) {
  158. for (let i = 0; i < this.multipleSelection.length; i++) {
  159. //
  160. let obj = {
  161. orgName: this.multipleSelection[i].orgName,
  162. orgNo: this.multipleSelection[i].orgNo,
  163. planId: this.proDataLin.id,
  164. userName: this.multipleSelection[i].userName,
  165. userNo: this.multipleSelection[i].userNo,
  166. };
  167. data.push(obj);
  168. }
  169. } else {
  170. let obj = {
  171. orgName: row.orgName,
  172. orgNo: row.orgNo,
  173. planId: this.proDataLin.id,
  174. userName: row.userName,
  175. userNo: row.userNo,
  176. };
  177. data.push(obj);
  178. }
  179. //调用接口开始添加
  180. let url = `/planUser/savePlanUsers`;
  181. this.$http.post(url, data, (res) => {
  182. if (res && res.code == 200) {
  183. this.searchTarget();
  184. this.userSearchTarget();
  185. this.tableData = res.data.content;
  186. this.total = res.data.totalElements;
  187. } else {
  188. // this.$toast.fail(res.msg);
  189. this.$message.error(res.msg);
  190. }
  191. });
  192. },
  193. searchTarget() {
  194. this.pageNum = 1;
  195. this.searchList();
  196. },
  197. userSearchTarget() {
  198. this.userPageNum = 1;
  199. this.userSearchList();
  200. },
  201. //进来调用已选列表接口
  202. searchList() {
  203. let url = `/planUser/findUserProgressByPage?pageSize=${this.pageSize}&pageNum=${this.pageNum}&planId=${this.proDataLin.id}`;
  204. this.$http.get(url, {}, (res) => {
  205. if (res && res.code == 200) {
  206. this.tableData = res.data.content;
  207. this.total = res.data.totalElements;
  208. } else {
  209. // this.$toast.fail(res.msg);
  210. this.$message.error(res.msg);
  211. }
  212. });
  213. },
  214. userSearchList() {
  215. let url = `/plan/planAddUser?pageSize=${this.userpageSize}&pageNum=${this.userPageNum}&planId=${this.proDataLin.id}&orgNo=${this.proDataLin.planOrgNo}`;
  216. this.$http.get(url, {}, (res) => {
  217. if (res && res.code == 200) {
  218. this.userTableData = res.data.content;
  219. this.userTotalotal = res.data.totalElements;
  220. } else {
  221. // this.$toast.fail(res.msg);
  222. this.$message.error(res.msg);
  223. }
  224. });
  225. },
  226. //每页多少条
  227. handleSizeChange(val) {
  228. //将首页重置为1时---且总条数变化
  229. //设置为当前总条数
  230. this.pageSize=val;
  231. this.searchList();
  232. },
  233. handleCurrentChange(val) {
  234. this.pageNum = val;
  235. this.searchList();
  236. },
  237. //已选选项
  238. handleSelectionChange(val) {
  239. this.multipleSelection = val;
  240. },
  241. resetForm(val) {
  242. this.cancle();
  243. },
  244. formatterTime(val) {
  245. let date = new Date(val);
  246. let year = date.getFullYear();
  247. let month = date.getMonth() + 1;
  248. month = this.formatterMon(month);
  249. let day = date.getDate();
  250. day = this.formatterMon(day);
  251. return year + "-" + month + "-" + day;
  252. },
  253. formatterMon(val) {
  254. if (val < 10) {
  255. return "0" + val;
  256. } else {
  257. return val;
  258. }
  259. },
  260. open(val) {
  261. // this.searchTarget();
  262. this.proDataLin = val;
  263. this.dialogVisible = true;
  264. this.searchTarget();
  265. },
  266. edit(val) {
  267. this.dialogVisible = true;
  268. this.isView = false;
  269. this.userDetailData = val;
  270. //调用查询详情的接口
  271. },
  272. //调用查询详情的接口
  273. disableFlagStatus() {
  274. setTimeout(() => {
  275. this.disableFlag = false;
  276. }, 1500);
  277. },
  278. register() {
  279. let that = this;
  280. this.$http.post(`/plan/addOrUpdate`, {}, (res) => {
  281. this.disableFlagStatus();
  282. // this.disableFlag = false;
  283. if (res && res.code == 200) {
  284. this.dialogVisible = false;
  285. // this.$toast.success({ message: "成功" });
  286. //调用父组件的查询方法
  287. that.$emit("search");
  288. } else {
  289. // this.$toast.fail({ message: res.msg });
  290. this.$message.error(res.msg);
  291. }
  292. //清空缓存
  293. this.cancle();
  294. });
  295. },
  296. },
  297. };
  298. </script>
  299. <style lang="less" scoped>
  300. .dig_update /deep/.el-cascader {
  301. position: relative;
  302. font-size: 14px;
  303. line-height: 40px;
  304. width: 100%;
  305. }
  306. .dig_update /deep/.el-dialog {
  307. box-shadow: none !important;
  308. background: transparent !important;
  309. }
  310. .demo-ruleForm /deep/ .el-form-item {
  311. margin-right: 10px;
  312. vertical-align: top;
  313. display: flex !important;
  314. flex-direction: column;
  315. }
  316. .demo-ruleForm /deep/.el-form-item__label {
  317. text-align: left;
  318. vertical-align: middle;
  319. float: left;
  320. font-size: 14px;
  321. color: #606266;
  322. line-height: 40px;
  323. padding: 0 12px 0 0;
  324. -webkit-box-sizing: border-box;
  325. box-sizing: border-box;
  326. }
  327. .demo-ruleForm /deep/.el-input {
  328. width: 100% !important;
  329. }
  330. .demo-ruleForm /deep/.el-input__inner {
  331. width: 100% !important;
  332. background-color: #f7f7f7;
  333. border: 0px;
  334. }
  335. .dig_button {
  336. display: flex;
  337. width: 100%;
  338. justify-content: space-around;
  339. }
  340. .demo-ruleForm {
  341. background-color: #ffffff;
  342. // border-radius: 20px;
  343. margin-right: -10px;
  344. margin-top: -10px;
  345. padding-right: 100px;
  346. padding-left: 100px;
  347. border-radius: 20px;
  348. padding-top: 20px;
  349. padding-bottom: 40px;
  350. .dig_title {
  351. margin-bottom: 30px;
  352. text-align: center;
  353. font-weight: 700;
  354. }
  355. }
  356. </style>