ShareView.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <template>
  2. <div class="containe">
  3. <div class="top">
  4. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  5. <el-form-item prop="isSecret" label="是否机密">
  6. <el-switch v-model="form.isSecret" active-value="1" inactive-value="0" @change="shareChange()"
  7. active-color="red"> </el-switch>
  8. <span>(如果选择机密,则共享用户打开时需要输入自己的用户密码才能查看)</span>
  9. </el-form-item>
  10. </el-form>
  11. </div>
  12. <div class="main">
  13. <div class="app-container">
  14. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
  15. label-width="68px">
  16. <el-form-item label="用户ID" prop="userId">
  17. <el-input v-model="queryParams.userId" placeholder="请输入用户ID" clearable @keyup.enter.native="handleQuery" />
  18. </el-form-item>
  19. <el-form-item label="用户姓名" prop="userName">
  20. <el-input v-model="queryParams.userName" placeholder="请输入用户姓名" clearable
  21. @keyup.enter.native="handleQuery" />
  22. </el-form-item>
  23. <el-form-item>
  24. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  25. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" class="resetq">重置</el-button>
  26. </el-form-item>
  27. </el-form>
  28. <el-row :gutter="10" class="mb8">
  29. <el-col :span="1.5">
  30. <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">添加人员</el-button>
  31. </el-col>
  32. <el-col :span="1.5">
  33. <el-button type="danger" plain icon="el-icon-circle-close" size="mini" :disabled="multiple"
  34. @click="cancelGroupUserAll">删除人员</el-button>
  35. </el-col>
  36. <el-col :span="1.5">
  37. <el-button type="warning" plain icon="el-icon-arrow-left" size="mini" @click="handleClose">返回</el-button>
  38. </el-col>
  39. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  40. </el-row>
  41. <el-table v-loading="loading" :data="groupUserList" @selection-change="handleSelectionChange">
  42. <el-table-column type="selection" width="55" align="center" />
  43. <el-table-column label="用户名称" prop="userName" :show-overflow-tooltip="true" />
  44. <el-table-column label="用户昵称" prop="nickName" :show-overflow-tooltip="true" />
  45. <el-table-column label="邮箱" prop="email" :show-overflow-tooltip="true" />
  46. <el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" />
  47. <el-table-column label="状态" align="center" prop="status">
  48. <template slot-scope="scope">
  49. <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status" />
  50. </template>
  51. </el-table-column>
  52. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  53. <template slot-scope="scope">
  54. <el-button size="mini" type="text" icon="el-icon-circle-close" @click="cancelGroupUser(scope.row)">删除人员</el-button>
  55. </template>
  56. </el-table-column>
  57. </el-table>
  58. <pagination v-show=" total>0" :total="total" :page.sync="queryParams.pageNum"
  59. :limit.sync="queryParams.pageSize"
  60. @pagination="getList" />
  61. <select-user ref="select" :docId="queryParams.docId" @ok="handleQuery" />
  62. </div>
  63. </div>
  64. </div>
  65. </template>
  66. <script>
  67. import "@/styles1/element-ui1.scss";
  68. import {
  69. listShareAccepter,
  70. getShareAccepter,
  71. delShareAccepter,
  72. addShareAccepter,
  73. updateShareAccepter,
  74. shareUserCancelAll
  75. } from "@/api/doc/shareAccepter";
  76. import {
  77. listShare,
  78. getShare,
  79. delShare,
  80. addShare,
  81. updateShare
  82. } from "@/api/doc/share";
  83. import selectUser from "./selectUser";
  84. export default {
  85. name: "GroupUser",
  86. dicts: ['sys_yes_no'],
  87. components: {
  88. selectUser
  89. },
  90. data() {
  91. return {
  92. // 遮罩层
  93. loading: true,
  94. // 选中数组
  95. ids: [],
  96. // 非单个禁用
  97. single: true,
  98. // 非多个禁用
  99. multiple: true,
  100. // 显示搜索条件
  101. showSearch: true,
  102. // 总条数
  103. total: 0,
  104. // 分组成员表格数据
  105. groupUserList: [],
  106. // 弹出层标题
  107. title: "",
  108. // 是否显示弹出层
  109. open: false,
  110. // 查询参数
  111. queryParams: {
  112. pageNum: 1,
  113. pageSize: 10,
  114. userId: null,
  115. userName: null
  116. },
  117. // 表单参数
  118. form: {},
  119. // 表单校验
  120. rules: {}
  121. };
  122. },
  123. created() {
  124. const docId = this.$route.params && this.$route.params.docId;
  125. if (docId) {
  126. this.queryParams.docId = docId;
  127. this.getList();
  128. }
  129. },
  130. methods: {
  131. shareChange() {
  132. this.form.docId = this.queryParams.docId;
  133. updateShare(this.form).then(response => {
  134. this.$modal.msgSuccess("修改成功");
  135. });
  136. },
  137. // 返回按钮
  138. handleClose() {
  139. const obj = {
  140. path: "/home/file/individual"
  141. };
  142. this.$tab.closeOpenPage(obj);
  143. },
  144. /** 查询分组成员列表 */
  145. getList() {
  146. this.loading = true;
  147. getShare(this.queryParams.docId).then(response => {
  148. this.form.isSecret = response.data.isSecret;
  149. this.form.onlyOneTime = response.data.onlyOneTime;
  150. });
  151. listShareAccepter(this.queryParams).then(response => {
  152. this.groupUserList = response.rows;
  153. this.total = response.total;
  154. this.loading = false;
  155. });
  156. },
  157. // 取消按钮
  158. cancel() {
  159. this.open = false;
  160. this.reset();
  161. },
  162. // 表单重置
  163. reset() {
  164. this.form = {
  165. docId: null,
  166. userId: null,
  167. userName: null
  168. };
  169. this.resetForm("form");
  170. },
  171. /** 搜索按钮操作 */
  172. handleQuery() {
  173. this.queryParams.pageNum = 1;
  174. this.getList();
  175. },
  176. /** 重置按钮操作 */
  177. resetQuery() {
  178. this.resetForm("queryForm");
  179. this.handleQuery();
  180. },
  181. // 多选框选中数据
  182. handleSelectionChange(selection) {
  183. this.ids = selection.map(item => item.userId)
  184. this.single = selection.length !== 1
  185. this.multiple = !selection.length
  186. },
  187. /** 新增按钮操作 */
  188. handleAdd() {
  189. this.$refs.select.show();
  190. },
  191. /** 提交按钮 */
  192. submitForm() {
  193. this.$refs["form"].validate(valid => {
  194. if (valid) {
  195. if (this.form.docId != null) {
  196. updateGroupUser(this.form).then(response => {
  197. this.$modal.msgSuccess("修改成功");
  198. this.open = false;
  199. this.getList();
  200. });
  201. } else {
  202. addGroupUser(this.form).then(response => {
  203. this.$modal.msgSuccess("新增成功");
  204. this.open = false;
  205. this.getList();
  206. });
  207. }
  208. }
  209. });
  210. },
  211. /** 删除按钮操作 */
  212. cancelGroupUserAll(row) {
  213. const docId = this.queryParams.docId;
  214. const userIds = this.ids.join(",");
  215. this.$modal.confirm('是否确认删除选中的分组成员?').then(function() {
  216. return shareUserCancelAll({
  217. docId: docId,
  218. userIds: userIds
  219. });
  220. }).then(() => {
  221. this.getList();
  222. this.$modal.msgSuccess("删除成功");
  223. }).catch(() => {});
  224. },
  225. /** 删除按钮操作 */
  226. cancelGroupUser(row) {
  227. const docId = this.queryParams.docId;
  228. const userIds = row.userId
  229. this.$modal.confirm('是否确认删除分组成员"' + row.userName + '"的数据项?').then(function() {
  230. return shareUserCancelAll({
  231. docId: docId,
  232. userIds: userIds
  233. });
  234. }).then(() => {
  235. this.getList();
  236. this.$modal.msgSuccess("删除成功");
  237. }).catch(() => {});
  238. },
  239. },
  240. };
  241. </script>
  242. <style scoped lang='scss'>
  243. .containe {
  244. color: #7ea4c8;
  245. font-size: 0.14rem;
  246. font-family: PingFang SC-Medium, PingFang SC;
  247. font-weight: 500;
  248. padding-left: calc(100vw * (20 / 1920));
  249. // .header {
  250. // height: calc(100vh * (22 / 1080));
  251. // margin-top: calc(100vh * (20 / 1080));
  252. // margin-bottom: calc(100vh * (20 / 1080));
  253. // display: flex;
  254. // align-items: center;
  255. // img {
  256. // width: calc(100vw * (16 / 1920));
  257. // height: calc(100vh * (16 / 1080));
  258. // border: 1px dashed grey;
  259. // margin-left: 3px;
  260. // margin-right: 3px;
  261. // }
  262. // .top1 {
  263. // color: #2e8aecff;
  264. // margin-top: calc(100vh * (35 / 1080));
  265. // }
  266. // }
  267. // .title {
  268. // height: calc(100vh * (22 / 1080));
  269. // margin-top: calc(100vh * (20 / 1080));
  270. // margin-bottom: calc(100vh * (20 / 1080));
  271. // color: #ffffffff;
  272. // font-size: 0.16rem;
  273. // font-weight: bold;
  274. // line-height: calc(100vh * (22 / 1080));
  275. // }
  276. .top{
  277. margin-top: calc(100vh * (20 / 1080));
  278. margin-bottom: calc(100vh * (20 / 1080));
  279. }
  280. .main {
  281. width: calc(100vw * (1876 / 1920));
  282. height: calc(100vh * (850 / 1080));
  283. .app-container {
  284. width: calc(100vw * (1876 / 1920));
  285. height: calc(100vh * (850 / 1080));
  286. background: url(../../../../assets/img/Group-615.png);
  287. background-size: calc(100vw * (1876 / 1920)) calc(100vh * (850 / 1080));
  288. }
  289. .mb8 {
  290. margin-top: 5px;
  291. }
  292. //表格底部
  293. .pagination-container {
  294. background: transparent;
  295. padding: 0 !important;
  296. margin: 0;
  297. }
  298. //重置搜索
  299. .resetq {
  300. color: #2E8AECFF;
  301. background: transparent;
  302. border: 1px solid #2E8AECFF;
  303. }
  304. }
  305. }
  306. //开关按钮前面的字体颜色
  307. ::v-deep .el-form-item__label {
  308. color: #2E8AECFF;
  309. }
  310. //开关按钮之间的间距
  311. ::v-deep .el-form-item {
  312. margin-bottom: 5px;
  313. }
  314. //搜索刷新按钮颜色
  315. ::v-deep .el-button.is-circle {
  316. background: #006c9aff;
  317. color: white;
  318. }
  319. //table样式
  320. ::v-deep .el-table {
  321. height: calc(100vh * (590 / 1080));
  322. background: transparent;
  323. color: #7ea4c8ff;
  324. }
  325. ::v-deep .el-table th {
  326. background: #016c9aa6;
  327. color: #2e8aec;
  328. }
  329. ::v-deep .el-table tr {
  330. background: transparent;
  331. }
  332. ::v-deep .el-table tbody tr:hover>td {
  333. background-color: #016c9a78 !important;
  334. }
  335. ::v-deep .el-table td.el-table__cell {
  336. border-bottom: 1px solid #006c9aff;
  337. }
  338. ::v-deep .el-table th.el-table__cell.is-leaf {
  339. border-bottom: 1px solid #006c9aff;
  340. }
  341. //表格底部线条隐藏
  342. ::v-deep .el-table::before {
  343. height: 0;
  344. }
  345. //按钮的样式
  346. ::v-deep .el-button--primary.is-plain,
  347. .el-button--success.is-plain.is-disabled,
  348. .el-button--danger.is-plain.is-disabled,
  349. .el-button--warning.is-plain {
  350. background-color: #002a5cff;
  351. border: none;
  352. color: #2e8aec;
  353. }
  354. //右边顶部搜索框样式
  355. ::v-deep .el-input__inner {
  356. background-color: transparent;
  357. border: 1px solid #01d1ffff;
  358. color: #ffffffcc;
  359. }
  360. </style>