Sin Descripción

editUserPermissions.vue 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <el-dialog title="用户数据权限修改" :visible.sync="dialogTableVisible" width="860px" @close='closed'>
  3. <el-form class="form-main" :model="ruleForm2" ref="ruleForm2">
  4. <el-row :gutter="16">
  5. <el-col :xs="24" :sm="24" :lg="24">
  6. <div class="list-item">
  7. <el-row>
  8. <el-col :span="8">
  9. <el-form-item label="账号">{{ruleForm2.account}}</el-form-item>
  10. </el-col>
  11. <el-col :span="8">
  12. <el-form-item label="用户姓名">{{ruleForm2.name}}</el-form-item>
  13. </el-col>
  14. <el-col :span="8">
  15. <el-form-item label="用户类型">{{(ruleForm2.type) ? '管理员' : '普通用户'}}</el-form-item>
  16. </el-col>
  17. <el-col :span="8">
  18. <el-form-item label="职位">{{ruleForm2.job}}</el-form-item>
  19. </el-col>
  20. <el-col :span="16">
  21. <el-form-item label="所属机构">{{ruleForm2.comp}}</el-form-item>
  22. </el-col>
  23. </el-row>
  24. </div>
  25. </el-col>
  26. <!-- <el-col :xs="12" :sm="12" :lg="12">
  27. <div class="list-item">
  28. <el-row>
  29. <el-col :span="24">
  30. <el-form-item label="添加负责桥梁">
  31. <el-autocomplete
  32. v-model="state4"
  33. :fetch-suggestions="querySearchAsync"
  34. placeholder="请选择一个桥梁"
  35. @select="handleSelect">
  36. </el-autocomplete>
  37. </el-form-item>
  38. </el-col>
  39. <el-col :span="24" style="margin-top:30px">
  40. <el-table
  41. :show-header="shouHead"
  42. :data="tableData3"
  43. height="250"
  44. border
  45. style="width: 100%">
  46. <el-table-column
  47. prop="name"
  48. label=""
  49. min-width="180">
  50. </el-table-column>
  51. <el-table-column
  52. prop="address"
  53. label="">
  54. <template slot-scope="scope">
  55. <el-button size="mini" type="danger" @click="handleModifyStatus(scope.row,'deleted')">删除
  56. </el-button>
  57. </template>
  58. </el-table-column>
  59. </el-table>
  60. </el-col>
  61. </el-row>
  62. </div>
  63. </el-col> -->
  64. <el-col :xs="24" :sm="24" :lg="24">
  65. <el-transfer class="check-transfer"
  66. filterable
  67. v-model="valueBridge"
  68. :titles="['所有桥梁', '负责桥梁']"
  69. :button-texts="['删除', '添加']"
  70. :props="{
  71. key: 'id',
  72. label: 'value'
  73. }"
  74. :data="bridgeLists">
  75. </el-transfer>
  76. </el-col>
  77. <el-col :span="24" class="el-btn-col">
  78. <div class="el-btn-col-box">
  79. <el-button type="primary" @click="submit">确认</el-button>
  80. <el-button type="info" @click="closed">返回</el-button>
  81. </div>
  82. </el-col>
  83. </el-row>
  84. </el-form>
  85. </el-dialog>
  86. </template>
  87. <script>
  88. import { queryRegister, queryResponsibleBridge, DeviceOfservice, updatePermission } from '@/api/userManagemen'
  89. export default {
  90. props: ['dialog', 'id'],
  91. data() {
  92. return {
  93. bridgeLists: [],
  94. bridgeListsChecked: [],
  95. valueBridge: [],
  96. shouHead: false,
  97. state4: '',
  98. ruleForm2: {
  99. account: '',
  100. name: '',
  101. comp: '',
  102. job: '',
  103. type: 0
  104. },
  105. dialogTableVisible: false
  106. }
  107. },
  108. created() {
  109. this.getAllBridges()
  110. },
  111. watch: {
  112. dialog() {
  113. queryRegister({ id: this.id }).then(response => {
  114. if (response.success) {
  115. const $data = response.data
  116. this.ruleForm2 = {
  117. account: $data.account,
  118. name: $data.name,
  119. comp: $data.comp,
  120. job: $data.job,
  121. type: $data.type
  122. }
  123. }
  124. })
  125. queryResponsibleBridge({ uid: this.id, active: 1 }).then(response => {
  126. if (response.success) {
  127. const $info = response.data
  128. for (let j = 0; j < $info.length; j++) {
  129. this.valueBridge.push($info[j].id)
  130. }
  131. }
  132. })
  133. this.dialogTableVisible = true
  134. }
  135. },
  136. methods: {
  137. getAllBridges() {
  138. DeviceOfservice({ key: this.state4, active: 1 }).then(response => {
  139. if (response.success) {
  140. const $info = response.data
  141. if ($info.length) {
  142. this.bridgeListsChecked.push($info[0].id)
  143. const $data = $info.map(item => {
  144. return { 'value': item.shortName, 'id': item.id }
  145. })
  146. this.bridgeLists = $data
  147. }
  148. }
  149. })
  150. },
  151. pop($par) {
  152. this.$confirm($par, '提示', {
  153. confirmButtonText: '确定',
  154. cancelButtonText: '取消',
  155. type: 'success',
  156. showCancelButton: false,
  157. center: true
  158. }).then(() => {
  159. }).catch(() => {
  160. })
  161. },
  162. closed() {
  163. this.valueBridge = []
  164. this.dialogTableVisible = false
  165. },
  166. submit() {
  167. if (!this.valueBridge.length) {
  168. this.$message.error('请至少选择一个桥梁')
  169. return
  170. }
  171. updatePermission({ id: this.id, bridges: this.valueBridge }).then(response => {
  172. if (response.success) {
  173. this.valueBridge = []
  174. this.$emit('chilF')
  175. const that = this
  176. setTimeout(function() {
  177. that.pop('权限修改成功')
  178. }, 1000)
  179. this.dialogTableVisible = false
  180. }
  181. })
  182. }
  183. }
  184. }
  185. </script>
  186. <style rel="stylesheet/scss" lang="scss" scoped>
  187. .el-form-item{
  188. margin-bottom: 10px;
  189. }
  190. .textarea-div{
  191. line-height: 26px;
  192. margin-bottom: 10px;
  193. }
  194. .list-item{
  195. padding: 10px 15px;
  196. }
  197. .el-autocomplete {
  198. width: 100%
  199. }
  200. .check-transfer.el-transfer{
  201. padding-left: 15px;
  202. margin-bottom: 15px;
  203. display: -webkit-flex;
  204. display: -moz-flex;
  205. display: -ms-flexbox;
  206. display: flex;
  207. justify-content: center
  208. }
  209. .check-transfer .el-transfer-panel{
  210. width: 240px;
  211. }
  212. </style>