GroupsView.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. <template>
  2. <div class="containe">
  3. <div class="header">
  4. <span>分组管理</span>
  5. <img src="../../../assets/img/chevron-down.png" alt="" />
  6. <img src="../../../assets/img/slash.png" alt="" />
  7. <span class="top1">分组</span>
  8. <img src="../../../assets/img/chevron-up.png" alt="" class="top2" />
  9. <img src="../../../assets/img/slash.png" alt="" />
  10. </div>
  11. <div class="title">分组</div>
  12. <div class="main">
  13. <h3>分组</h3>
  14. <div class="main-main">
  15. <el-form
  16. :model="queryParams"
  17. ref="queryForm"
  18. size="small"
  19. :inline="true"
  20. v-show="showSearch"
  21. label-width="110px"
  22. >
  23. <el-form-item label="分组名称" prop="groupName">
  24. <el-input
  25. v-model="queryParams.groupName"
  26. placeholder="请输入分组名称"
  27. clearable
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="分组管理员" prop="groupManagerName">
  32. <el-input
  33. v-model="queryParams.groupManagerName"
  34. placeholder="请输入分组管理员"
  35. clearable
  36. @keyup.enter.native="handleQuery"
  37. />
  38. </el-form-item>
  39. <el-form-item>
  40. <el-button
  41. type="primary"
  42. icon="el-icon-search"
  43. size="mini"
  44. @click="handleQuery"
  45. >搜索</el-button
  46. >
  47. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" class="reset1"
  48. >重置</el-button
  49. >
  50. </el-form-item>
  51. </el-form>
  52. <el-row :gutter="10" class="mb8">
  53. <el-col :span="1.5">
  54. <el-button
  55. type="primary"
  56. plain
  57. icon="el-icon-plus"
  58. size="mini"
  59. @click="handleAdd"
  60. v-hasPermi="['doc:group:add']"
  61. >新增</el-button
  62. >
  63. </el-col>
  64. <el-col :span="1.5">
  65. <el-button
  66. type="success"
  67. plain
  68. icon="el-icon-edit"
  69. size="mini"
  70. :disabled="single"
  71. @click="handleUpdate"
  72. v-hasPermi="['doc:group:edit']"
  73. >修改</el-button
  74. >
  75. </el-col>
  76. <el-col :span="1.5">
  77. <el-button
  78. type="danger"
  79. plain
  80. icon="el-icon-delete"
  81. size="mini"
  82. :disabled="multiple"
  83. @click="handleDelete"
  84. v-hasPermi="['doc:group:remove']"
  85. >删除</el-button
  86. >
  87. </el-col>
  88. <el-col :span="1.5">
  89. <el-button
  90. type="warning"
  91. plain
  92. icon="el-icon-download"
  93. size="mini"
  94. @click="handleExport"
  95. v-hasPermi="['doc:group:export']"
  96. >导出</el-button
  97. >
  98. </el-col>
  99. <right-toolbar
  100. :showSearch.sync="showSearch"
  101. @queryTable="getList"
  102. ></right-toolbar>
  103. </el-row>
  104. <el-table
  105. v-loading="loading"
  106. :data="groupList"
  107. @selection-change="handleSelectionChange"
  108. >
  109. <el-table-column type="selection" width="55" align="center" />
  110. <el-table-column label="分组名称" align="center" prop="groupName" />
  111. <el-table-column
  112. label="分组管理员"
  113. align="center"
  114. prop="groupManagerName"
  115. />
  116. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  117. <template slot-scope="scope">
  118. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
  119. v-hasPermi="['doc:group:edit']">修改</el-button>
  120. <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
  121. v-hasPermi="['doc:group:remove']">删除</el-button>
  122. <el-button size="mini" type="text" icon="el-icon-user" @click="handleGroupUser(scope.row)"
  123. v-hasPermi="['doc:group:user']">分配成员</el-button>
  124. </template>
  125. </el-table-column>
  126. </el-table>
  127. <pagination
  128. v-show="total > 0"
  129. :total="total"
  130. :page.sync="queryParams.pageNum"
  131. :limit.sync="queryParams.pageSize"
  132. @pagination="getList"
  133. />
  134. <!-- 添加或修改分组对话框 -->
  135. <el-dialog
  136. :title="title"
  137. :visible.sync="open"
  138. width="500px"
  139. custom-class="el-dialog1"
  140. >
  141. <el-form ref="form" :model="form" :rules="rules" label-width="130px">
  142. <el-form-item label="分组名称" prop="groupName">
  143. <el-input v-model="form.groupName" placeholder="请输入分组名称" />
  144. </el-form-item>
  145. <el-form-item label="分组管理员" prop="groupManagerName">
  146. <el-input
  147. v-model="form.groupManagerName"
  148. placeholder="请输入分组管理员"
  149. @click.native="select()"
  150. />
  151. </el-form-item>
  152. <el-form-item label="备注" prop="remark">
  153. <el-input v-model="form.remark" placeholder="请输入备注" />
  154. </el-form-item>
  155. </el-form>
  156. <div slot="footer" class="dialog-footer">
  157. <el-button type="primary" @click="submitForm">确 定</el-button>
  158. <el-button @click="cancel">取 消</el-button>
  159. </div>
  160. </el-dialog>
  161. <select-user ref="select" :groupId="queryParams.groupId" @okk="handleTest"/>
  162. </div>
  163. </div>
  164. </div>
  165. </template>
  166. <script>
  167. import selectUser from "./selectUser";
  168. import "@/styles1/element-ui1.scss";
  169. import {
  170. listGroup,
  171. getGroup,
  172. delGroup,
  173. addGroup,
  174. updateGroup,
  175. } from "@/api/doc/group";
  176. export default {
  177. name: "Group",
  178. components: {
  179. selectUser
  180. },
  181. data() {
  182. return {
  183. // 遮罩层
  184. loading: true,
  185. // 选中数组
  186. ids: [],
  187. // 非单个禁用
  188. single: true,
  189. // 非多个禁用
  190. multiple: true,
  191. // 显示搜索条件
  192. showSearch: true,
  193. // 总条数
  194. total: 0,
  195. // 分组表格数据
  196. groupList: [],
  197. // 弹出层标题
  198. title: "",
  199. // 是否显示弹出层
  200. open: false,
  201. // 查询参数
  202. queryParams: {
  203. pageNum: 1,
  204. pageSize: 10,
  205. groupName: null,
  206. groupManager: null,
  207. groupManagerName: null,
  208. },
  209. // 表单参数
  210. form: {},
  211. // 表单校验
  212. rules: {},
  213. };
  214. },
  215. created() {
  216. this.getList();
  217. },
  218. methods: {
  219. // 分组管理员
  220. select(){
  221. this.$refs.select.show();
  222. },
  223. /** 查询分组列表 */
  224. getList() {
  225. this.loading = true;
  226. listGroup(this.queryParams).then((response) => {
  227. this.groupList = response.rows;
  228. this.total = response.total;
  229. this.loading = false;
  230. });
  231. },
  232. // 取消按钮
  233. cancel() {
  234. this.open = false;
  235. this.reset();
  236. },
  237. // 返回数据
  238. handleTest(a) {
  239. this.form.groupManagerName=a.name;
  240. this.form.groupManager=a.id;
  241. },
  242. // 表单重置
  243. reset() {
  244. this.form = {
  245. groupId: null,
  246. groupName: null,
  247. groupManager: null,
  248. groupManagerName: null,
  249. creater: null,
  250. createBy: null,
  251. createTime: null,
  252. updateBy: null,
  253. updateTime: null,
  254. remark: null,
  255. isDel: null,
  256. };
  257. this.resetForm("form");
  258. },
  259. /** 搜索按钮操作 */
  260. handleQuery() {
  261. this.queryParams.pageNum = 1;
  262. this.getList();
  263. },
  264. /** 重置按钮操作 */
  265. resetQuery() {
  266. this.resetForm("queryForm");
  267. this.handleQuery();
  268. },
  269. // 多选框选中数据
  270. handleSelectionChange(selection) {
  271. this.ids = selection.map(item => item.groupId);
  272. this.single = selection.length !== 1;
  273. this.multiple = !selection.length;
  274. },
  275. /** 新增按钮操作 */
  276. handleAdd() {
  277. this.reset();
  278. this.open = true;
  279. this.title = "添加分组";
  280. },
  281. /** 分组成员按钮操作 */
  282. handleGroupUser(row) {
  283. const groupId = row.groupId;
  284. this.$router.push("/home/group/subgroup/" + groupId);
  285. },
  286. /** 修改按钮操作 */
  287. handleUpdate(row) {
  288. this.reset();
  289. const groupId = row.groupId || this.ids;
  290. getGroup(groupId).then(response => {
  291. this.form = response.data;
  292. this.open = true;
  293. this.title = "修改分组";
  294. });
  295. },
  296. /** 提交按钮 */
  297. submitForm() {
  298. this.$refs["form"].validate((valid) => {
  299. if (valid) {
  300. if (this.form.groupId != null) {
  301. updateGroup(this.form).then((response) => {
  302. this.$modal.msgSuccess("修改成功");
  303. this.open = false;
  304. this.getList();
  305. });
  306. } else {
  307. addGroup(this.form).then((response) => {
  308. this.$modal.msgSuccess("新增成功");
  309. this.open = false;
  310. this.getList();
  311. });
  312. }
  313. }
  314. });
  315. },
  316. /** 删除按钮操作 */
  317. handleDelete(row) {
  318. const groupIds = row.groupId || this.ids;
  319. this.$modal
  320. .confirm('是否确认删除分组编号为"' + groupIds + '"的数据项?')
  321. .then(function () {
  322. return delGroup(groupIds);
  323. })
  324. .then(() => {
  325. this.getList();
  326. this.$modal.msgSuccess("删除成功");
  327. })
  328. .catch(() => {});
  329. },
  330. /** 导出按钮操作 */
  331. handleExport() {
  332. this.download(
  333. "doc/group/export",
  334. {
  335. ...this.queryParams,
  336. },
  337. `group_${new Date().getTime()}.xlsx`
  338. );
  339. },
  340. },
  341. };
  342. </script>
  343. <style scoped lang='scss'>
  344. .containe {
  345. color: #7ea4c8;
  346. font-size: 0.14rem;
  347. font-family: PingFang SC-Medium, PingFang SC;
  348. font-weight: 500;
  349. padding-left: calc(100vw * (20 / 1920));
  350. //顶部信息
  351. .header {
  352. width: calc(100vw * (300 / 1920));
  353. height: calc(100vh * (22 / 1080));
  354. margin-top: calc(100vh * (20 / 1080));
  355. margin-bottom: calc(100vh * (20 / 1080));
  356. display: flex;
  357. align-items: center;
  358. img {
  359. width: calc(100vw * (16 / 1920));
  360. height: calc(100vh * (16 / 1080));
  361. border: 1px dashed grey;
  362. margin-left: 3px;
  363. margin-right: 3px;
  364. }
  365. .top1 {
  366. color: #2e8aecff;
  367. }
  368. }
  369. //中间目录列表
  370. .title {
  371. height: calc(100vh * (22 / 1080));
  372. margin-top: calc(100vh * (20 / 1080));
  373. margin-bottom: calc(100vh * (20 / 1080));
  374. color: #ffffffff;
  375. font-size: 0.16rem;
  376. font-weight: bold;
  377. line-height: calc(100vh * (22 / 1080));
  378. }
  379. .main {
  380. width: calc(100vw * (1876 / 1920));
  381. height: calc(100vh * (880 / 1080));
  382. background: url(../../../assets/img/Group-610.png);
  383. background-size: calc(100vw * (1876 / 1920)) calc(100vh * (880 / 1080));
  384. h3 {
  385. font-size: 0.2rem;
  386. color: #ffffffff;
  387. padding-top: calc(100vh * (25 / 1080));
  388. padding-bottom: calc(100vh * (10 / 1080));
  389. padding-left: calc(100vw * (30 / 1920));
  390. }
  391. .main-main {
  392. width: calc(100vw * (1822 / 1920));
  393. height: calc(100vh * (800 / 1080));
  394. margin-left: calc(100vw * (25 / 1920));
  395. margin-top: calc(100vh * (20 / 1080));
  396. // background: seagreen;
  397. .el-table {
  398. width: calc(100vw * (1822 / 1920));
  399. height: calc(100vh * (600 / 1080));
  400. background: transparent;
  401. overflow: auto;
  402. }
  403. .reset1 {
  404. color: #2e8aecff;
  405. background: transparent;
  406. border: 1px solid #2E8AECFF;
  407. }
  408. }
  409. }
  410. }
  411. //底部跳转
  412. ::v-deep .pagination-container {
  413. height: calc(100vh * (50 / 1080));
  414. background: transparent;
  415. }
  416. ::v-deep .pagination-container .el-pagination {
  417. bottom: 10px;
  418. }
  419. //table样式
  420. ::v-deep .el-table th {
  421. background: #016c9aa6;
  422. color: #2e8aec;
  423. }
  424. ::v-deep .el-table tr {
  425. background: transparent;
  426. }
  427. ::v-deep .el-table tbody tr:hover > td {
  428. background-color: #016c9a78 !important;
  429. }
  430. ::v-deep .el-table td.el-table__cell {
  431. border-bottom: 1px solid #006c9aff;
  432. }
  433. ::v-deep .el-table th.el-table__cell.is-leaf {
  434. border-bottom: 1px solid #006c9aff;
  435. }
  436. ::v-deep .el-form-item__label {
  437. color: #2e8aecff;
  438. }
  439. ::v-deep .el-input__inner {
  440. background: transparent;
  441. border: 1px solid #01d1ffff;
  442. color: #006c9aff;
  443. }
  444. //table底下白线消失处理
  445. ::v-deep .el-table {
  446. color: #ffffffff;
  447. }
  448. ::v-deep .el-table::before {
  449. width: 0;
  450. }
  451. //按钮的样式
  452. ::v-deep .el-button--primary.is-plain {
  453. background-color: #002a5cff;
  454. border: none;
  455. }
  456. ::v-deep .el-button--success.is-plain.is-disabled,
  457. .el-button--danger.is-plain.is-disabled,
  458. .el-button{
  459. background-color: #002a5cff;
  460. color: #1890ff;
  461. border: none;
  462. }
  463. //顶部样式
  464. ::v-deep .el-form-item__label {
  465. text-align: center;
  466. }
  467. //搜索刷新按钮颜色
  468. ::v-deep .el-button.is-circle{
  469. background: #006C9AFF;
  470. color: white;
  471. }
  472. //新增/修改弹窗样式
  473. ::v-deep .el-dialog__title {
  474. color: white;
  475. }
  476. ::v-deep .el-dialog1{
  477. width: calc(100vw * (750 / 1920)) !important;
  478. height: calc(100vh * (650 / 1080)) !important;
  479. background: url(../../../assets/img/Group-585.png);
  480. background-size: calc(100vw * (750 / 1920)) calc(100vh * (650 / 1080));
  481. padding-top: calc(100vh * (50 / 1080));
  482. }
  483. </style>