index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <div class="app-container handheldEquipmentUsers">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px">
  4. <el-form-item label="关键字" prop="userName">
  5. <el-input
  6. v-model="queryParams.searchValue"
  7. placeholder="姓名/工号/联系方式"
  8. clearable
  9. maxLength="30"
  10. size="small"
  11. />
  12. </el-form-item>
  13. <el-form-item>
  14. <p class="inquire-button-one" @click="handleQuery">查询</p>
  15. <p class="reset-button-one" @click="resetQuery">重置</p>
  16. </el-form-item>
  17. <el-form-item style="float: right;">
  18. <p class="inquire-button-one" v-hasPermi="['system:pda:add']" style="width:80px;margin-right:0!important;" @click="addButton">新增</p>
  19. </el-form-item>
  20. </el-form>
  21. <el-table v-loading="loading" border :data="dataList" >
  22. <el-table-column label="姓名" align="left" prop="nickName"/>
  23. <el-table-column label="工号" align="left" prop="userName"/>
  24. <el-table-column label="联系方式" align="left" prop="phonenumber"/>
  25. <el-table-column label="部门" align="left" prop="deptName"/>
  26. <el-table-column label="操作" align="center" width="160">
  27. <template slot-scope="scope">
  28. <div class="table-button-box">
  29. <p class="table-button-null"></p>
  30. <p class="table-button-p"
  31. v-hasPermi="['system:pda:remove']"
  32. @click="delButton(scope.row)"
  33. >移除</p>
  34. <p class="table-button-null"></p>
  35. </div>
  36. </template>
  37. </el-table-column>
  38. </el-table>
  39. <pagination :page-sizes="[20, 30, 40, 50]"
  40. v-show="total>0"
  41. :total="total"
  42. :page.sync="queryParams.pageNum"
  43. :limit.sync="queryParams.pageSize"
  44. @pagination="getList"
  45. />
  46. <el-dialog class="handheldEquipmentUsersAddDialog" title='新增' @close="dialogOffButton"
  47. :show-close="false" :close-on-click-modal="false" :close-on-press-escape="false"
  48. :visible.sync="dialogType" v-if="dialogType" width="600px">
  49. <el-form ref="addForm" :model="addForm" :rules="rules" label-width="80px">
  50. <el-form-item label="用户" prop="safeUserId" class="form-item" label-width="100px">
  51. <el-select
  52. style="width:400px;"
  53. v-model="addForm.userIds"
  54. :multiple-limit="10"
  55. multiple
  56. filterable
  57. remote
  58. clearable
  59. reserve-keyword
  60. placeholder="请输入至少2个字符搜索相关人员"
  61. :remote-method="getUserList"
  62. :loading="loading">
  63. <el-option
  64. v-for="item in userOption"
  65. :key="item.userId"
  66. :label="item.nickName"
  67. :value="item.userId">
  68. </el-option>
  69. </el-select>
  70. </el-form-item>
  71. </el-form>
  72. <div slot="footer" class="dialog-footer">
  73. <p class="dialog-footer-null"></p>
  74. <el-button @click="dialogOffButton">取 消</el-button>
  75. <el-button type="primary" @click="dialogSubmitButton">确 定</el-button>
  76. <p class="dialog-footer-null"></p>
  77. </div>
  78. </el-dialog>
  79. </div>
  80. </template>
  81. <script>
  82. import { selectUser,pdaUserList,pdaUser,pdaUserDel } from '@/api/trainingCourse/index'
  83. export default {
  84. name: 'handheldEquipmentUsers',
  85. data(){
  86. return{
  87. queryParams:{
  88. pageNum: 1,
  89. pageSize:20,
  90. searchValue: null,
  91. },
  92. // 遮罩层
  93. loading: false,
  94. // 显示搜索条件
  95. showSearch: true,
  96. dataList:[],
  97. // 总条数
  98. total: 0,
  99. dialogType:false,
  100. addForm:{
  101. userIds:[]
  102. },
  103. userOption:[],
  104. rules:{
  105. userIds: [
  106. { required: true, message: "请选择用户", trigger: "change" },
  107. ],
  108. }
  109. }
  110. },
  111. created(){
  112. },
  113. mounted(){
  114. this.getList();
  115. },
  116. methods:{
  117. //获取人员列表
  118. getUserList(query){
  119. if(query.length > 1){
  120. this.loading = true;
  121. selectUser({userType:11,nickName:query}).then(response => {
  122. this.$set(this,'userOption',response.data)
  123. this.loading = false;
  124. });
  125. }
  126. },
  127. //弹窗开启
  128. addButton(){
  129. this.$set(this.addForm,'userIds','');
  130. this.$set(this,'dialogType',true);
  131. },
  132. //弹窗关闭
  133. dialogOffButton(){
  134. this.$set(this,'dialogType',false);
  135. },
  136. //弹窗提交
  137. dialogSubmitButton(){
  138. this.$refs["addForm"].validate(valid => {
  139. if (valid) {
  140. pdaUser(this.addForm).then(response => {
  141. this.msgSuccess(response.msg);
  142. this.$set(this,'dialogType',false);
  143. this.getList();
  144. });
  145. }
  146. })
  147. },
  148. //查询
  149. handleQuery(){
  150. this.$set(this.queryParams,'pageNum',1)
  151. this.getList();
  152. },
  153. //重置
  154. resetQuery(){
  155. this.$set(this,'queryParams',{
  156. pageNum: 1,
  157. pageSize:20,
  158. searchValue: null,
  159. })
  160. this.getList();
  161. },
  162. //数据列表
  163. getList(){
  164. this.loading = true;
  165. pdaUserList(this.queryParams).then(response => {
  166. this.$set(this,'dataList',response.rows)
  167. this.loading = false;
  168. });
  169. },
  170. //移除
  171. delButton(item){
  172. let self = this;
  173. this.$confirm('确定移除当用户?', "警告", {
  174. confirmButtonText: "确定",
  175. cancelButtonText: "取消",
  176. type: "warning"
  177. }).then(function() {
  178. pdaUserDel(item.id).then(response => {
  179. self.msgSuccess(response.msg);
  180. self.getList();
  181. });
  182. }).then(() => {}).catch(() => {});
  183. },
  184. },
  185. }
  186. </script>
  187. <style scoped lang="scss">
  188. .handheldEquipmentUsers{
  189. padding:20px!important;
  190. flex:1;
  191. display: flex !important;
  192. flex-direction: column;
  193. overflow: hidden;
  194. .handheldEquipmentUsersAddDialog{
  195. .dialog-footer{
  196. display: flex;
  197. .dialog-footer-null{
  198. flex:1;
  199. }
  200. }
  201. }
  202. }
  203. </style>