userCenterUnitPersonnelInformation.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <div style="width: 100%;background: #fff;min-height: 700px;color: #666;" class="userCenterMyProject">
  3. <div style="height: 50px;line-height: 50px;">
  4. <el-button type="primary" style="float: right;margin-right: 90px;margin-top: 10px;" @click="toView('addPersonnel','')">{{$t('common.addPersonnel')}}</el-button>
  5. </div>
  6. <div style="width: 880px;padding:20px 0 0 0;background: #f2f2f2;margin-left: 30px;height: 125px;margin-top: 5px;">
  7. <el-form :inline="true" :model="params" class="demo-form-inline" style="padding:0 40px">
  8. <el-row>
  9. <el-col :span="10">
  10. <el-form-item :label="$t('common.name')">
  11. <el-input v-model="params.name" :placeholder="$t('common.namePlaceholder')"></el-input>
  12. </el-form-item>
  13. </el-col>
  14. <el-col :span="10">
  15. <el-form-item :label="$t('common.MobilePhone')">
  16. <el-input v-model="params.preferredMobile" :placeholder="$t('common.EnterMobile')"></el-input>
  17. </el-form-item>
  18. </el-col>
  19. <el-col :span="10">
  20. <el-form-item :label="$t('common.emailInfo')">
  21. <el-input v-model="params.email" :placeholder="$t('common.EnterEmail')"></el-input>
  22. </el-form-item>
  23. </el-col>
  24. </el-row>
  25. <el-row>
  26. <el-col :span="2">
  27. <el-button @click="toInitData" type="primary" style="width:70px">{{$t('common.query')}}</el-button>
  28. </el-col>
  29. <el-col :span="2">
  30. <el-button type="info" style="width:70px">{{$t('common.reset')}}</el-button>
  31. </el-col>
  32. </el-row>
  33. </el-form>
  34. </div>
  35. <div style="margin-left: 30px;">
  36. <el-table
  37. :data="tableData"
  38. stripe
  39. style="width: 100%" >
  40. <el-table-column fixed prop="name" :label="$t('common.name')" width="150" > </el-table-column>
  41. <el-table-column prop="unitName" :label="$t('common.NameOfEnterprise')" width="150"> </el-table-column>
  42. <el-table-column prop="preferredMobile" :label="$t('common.phoneInfo')" width="150"> </el-table-column>
  43. <el-table-column prop="email" :label="$t('common.emailInfo')" width="150"></el-table-column>
  44. <el-table-column prop="status" :label="$t('common.State')" width="150"> </el-table-column>
  45. <el-table-column prop="createDate" :label="$t('common.Time')" width="150"> </el-table-column>
  46. <el-table-column fixed="right" prop="address5" :label="$t('common.Option')" width="210">
  47. <template slot-scope="scope">
  48. <el-button
  49. @click.native.prevent="change(scope.$index, tableData)"
  50. type="text"
  51. size="small">
  52. {{$t('common.editor')}}
  53. </el-button>
  54. <!-- <el-button
  55. @click.native.prevent="detail(scope.$index, tableData)"
  56. type="text"
  57. size="small">
  58. {{$t('查看')}}
  59. </el-button>-->
  60. <el-button
  61. @click.native.prevent="deleteRow(scope.$index, tableData)"
  62. type="text"
  63. size="small">
  64. {{$t('common.delete')}}
  65. </el-button>
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. </div>
  70. <div style="width: 100%;text-align: center;">
  71. <el-pagination
  72. style="margin-top: 50px;height: 80px;"
  73. background
  74. layout="prev, pager, next"
  75. :total= num @size-change="handleSizeChange"
  76. @current-change="handleCurrentChange">
  77. </el-pagination>
  78. </div>
  79. </div>
  80. </template>
  81. <script>
  82. import Base from "@/views/base/Base";
  83. import { formatDate } from "@/utils/formatUtils";
  84. import { getUnitPersonnelInformation ,del} from "@/api/userCenter/unitPersonnel";
  85. export default {
  86. name: 'userCenterUnitPersonnelInformation',
  87. extends: Base,
  88. data () {
  89. return {
  90. num: 0,
  91. params: {
  92. name: "",
  93. preferredMobile:"",
  94. email:"",
  95. baseEntityId:"",
  96. pageNo: 1,
  97. pageSize: 10
  98. },
  99. tableData: [],
  100. status:[],
  101. }
  102. },
  103. mounted() {
  104. this.toInitData();
  105. },
  106. methods:{
  107. toInitData: function() {
  108. var users=localStorage.getItem('user');
  109. var user = JSON.parse(users);
  110. this.params.baseEntityId = user.umsUser.unitEntityId;
  111. getUnitPersonnelInformation(this.params).then((result) => {
  112. var data = result.data;
  113. if (data.unitPersonnelInformations) {
  114. this.num = parseInt(data.totalCount);
  115. this.tableData = data.unitPersonnelInformations;
  116. this.tableData.forEach((i) => {
  117. i.createDate = i.createDate
  118. ? formatDate(i.createDate, "YYYY-MM-DD")
  119. : "";
  120. })
  121. }else {
  122. this.tableData = [];
  123. this.num = ""
  124. }
  125. }) .catch(error => {
  126. // 此处你的业务代码
  127. this.$message({
  128. message: error.msg,
  129. type: 'error'
  130. });
  131. this.resetToken();
  132. });
  133. },
  134. toView(router,json){
  135. this.$router.push({name:router,params:{key:json}})
  136. },
  137. // 查看
  138. detail(index, rows) {
  139. },
  140. // 编辑
  141. change(index, rows) {
  142. console.log(index, rows[index].id)
  143. this.toView('addPersonnel',rows[index].id)
  144. },
  145. // 移除
  146. deleteRow(index, rows) {
  147. this.$confirm(this.$t('common.Thisoperationwillpermanently'), this.$t('common.Tips'), {
  148. confirmButtonText: this.$t('common.OK'),
  149. cancelButtonText: this.$t('common.cancel'),
  150. type: 'warning'
  151. }).then(() => {
  152. del(rows[index].id).then(res=>{
  153. this.$message({
  154. message: res.msg,
  155. type: 'success'
  156. });
  157. this.toInitData();
  158. }).catch((error) => {
  159. this.$message.error(res.msg);
  160. })
  161. }).catch(() => {
  162. this.$message({
  163. type: 'info',
  164. message: this.$i18n.locale === 'zh' ? '已取消删除' : 'Deletion canceled',
  165. });
  166. });
  167. },
  168. handleSizeChange(val) {
  169. console.log(`每页 ${val} 条`);
  170. },
  171. handleCurrentChange(val) {
  172. this.param.pageNo=val;
  173. this.getReply()
  174. }
  175. }
  176. }
  177. </script>
  178. <style scoped>
  179. .el-input {
  180. width: 200px ;
  181. }
  182. .el-form-item__content,.el-select {
  183. width: 200px !important;
  184. }
  185. .el-table thead {
  186. background: #eee;
  187. }
  188. .userCenterMyProject >>> .el-pagination .el-pager li,
  189. .userCenterMyProject >>> .el-pagination .btn-next,
  190. .userCenterMyProject >>> .el-pagination .btn-prev{
  191. width: 35px;
  192. height: 35px;
  193. line-height: 35px;
  194. }
  195. .userCenterMyProject >>> .el-pagination.is-background .el-pager li:not(.disabled).active {
  196. background: #0050d8;
  197. }
  198. </style>