crewList.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <div class="app-container">
  3. <el-row>
  4. <el-col :span="24">
  5. <el-button @click="openDialog" :loading="loading">分值统计日设置</el-button>
  6. <el-button :loading="loading">导出通讯录N/A</el-button>
  7. </el-col>
  8. </el-row>
  9. <!-- 列表区域 -->
  10. <el-table :data="crews" style="width: 100%" v-loading="loading">
  11. <el-table-column type="index" width="40"></el-table-column>
  12. <el-table-column label="头像" width="110">
  13. <template slot-scope="scope">
  14. <el-image
  15. style="width: 100px; height: 100px"
  16. :src="'http://localhost:9102/img' + scope.row.headUrl"
  17. ></el-image>
  18. </template>
  19. </el-table-column>
  20. <el-table-column prop="name" label="姓名" width="70"></el-table-column>
  21. <el-table-column prop="phone" label="手机号" width="110"></el-table-column>
  22. <el-table-column prop="deptId" label="部门" width="80"></el-table-column>
  23. <el-table-column prop="roleName" label="角色" width="80"></el-table-column>
  24. <el-table-column label="对应资产">
  25. <template slot-scope="scope">
  26. <span
  27. v-for="asset in assets[scope.$index]"
  28. :key="asset"
  29. style="margin-right: 10px"
  30. >{{asset}}</span>
  31. </template>
  32. </el-table-column>
  33. <el-table-column label="操作" width="80">
  34. <template slot-scope="scope">
  35. <el-button type="primary" @click="toDetail(scope.row.id)">详情</el-button>
  36. </template>
  37. </el-table-column>
  38. </el-table>
  39. <div>
  40. <!-- 打分提示 -->
  41. <span class="tips" v-if="currentDate!=null">请于本月{{currentDate}}日前完成上月的打分</span>
  42. <span class="tips" v-else>请设置打分截止日期</span>
  43. <!-- 页码区域 -->
  44. <el-pagination
  45. v-if="total > 0"
  46. @size-change="handleSizeChange"
  47. @current-change="handleCurrentChange"
  48. :current-page="pageIndex"
  49. :page-sizes="[20, 50, 100]"
  50. :page-size="20"
  51. layout="total, sizes, prev, pager, next, jumper"
  52. :total="total"
  53. background
  54. style="float: right"
  55. ></el-pagination>
  56. </div>
  57. <!-- 设置打分截止日期的dialog -->
  58. <el-dialog title="设置打分截止日期" :visible.sync="dialogVisible" width="330px">
  59. <el-form ref="form" :model="settingForm" :rules="rules" label-width="120px">
  60. <el-form-item label="打分截止日期" prop="date">
  61. <!-- 这里要限制数字类型 并且要小于等于28 -->
  62. <el-input v-model="settingForm.date" placeholder="请输入截止日期" clearable></el-input>
  63. </el-form-item>
  64. </el-form>
  65. <span slot="footer" class="dialog-footer">
  66. <el-button @click="dialogVisible=false">取消</el-button>
  67. <el-button type="primary" @click="editDeadline">提交</el-button>
  68. </span>
  69. </el-dialog>
  70. </div>
  71. </template>
  72. <script>
  73. import request from "@/utils/request";
  74. export default {
  75. data() {
  76. return {
  77. crews: [],
  78. assets: [],
  79. settingForm: {
  80. date: ""
  81. },
  82. currentDate: 0,
  83. loading: false,
  84. dialogVisible: false,
  85. //分页相关
  86. pageIndex: 1,
  87. pageSize: 20,
  88. total: 0,
  89. rules: {
  90. date: [{ required: true, message: "请输入截止时间", trigger: "blur" }]
  91. }
  92. };
  93. },
  94. methods: {
  95. getCrews() {
  96. this.loading = true;
  97. request({
  98. url: "/user/getUserByPage",
  99. method: "post",
  100. params: {
  101. pageIndex: this.pageIndex,
  102. pageSize: this.pageSize
  103. }
  104. })
  105. .then(response => {
  106. this.crews = response.data.user.records;
  107. this.total = response.data.user.total;
  108. this.assets = response.data.asset;
  109. this.loading = false;
  110. })
  111. .catch(error => {
  112. this.loading = false;
  113. });
  114. },
  115. //获取截止日期
  116. getDeadline() {
  117. request({
  118. url: "/user/getScoringDeadline",
  119. method: "post"
  120. })
  121. .then(response => {
  122. this.currentDate = response.data;
  123. this.loading = false;
  124. })
  125. .catch(error => {
  126. this.loading = false;
  127. });
  128. },
  129. //修改截止日期
  130. editDeadline() {
  131. this.$refs.form.validate(valid => {
  132. if (valid) {
  133. this.loading = true;
  134. request({
  135. url: "/user/setScoringDeadline",
  136. method: "post",
  137. params: {
  138. date: this.settingForm.date
  139. }
  140. })
  141. .then(response => {
  142. this.getDeadline();
  143. this.loading = false;
  144. this.dialogVisible = false;
  145. })
  146. .catch(error => {
  147. this.loading = false;
  148. });
  149. }
  150. });
  151. },
  152. //打开设置截止日期的dialog
  153. openDialog() {
  154. this.settingForm.date = this.currentDate;
  155. this.dialogVisible = true;
  156. },
  157. //到详情页面
  158. toDetail(id) {
  159. if (id != null) {
  160. this.$router.push("/crew/" + id);
  161. } else {
  162. this.$message({
  163. message: "发生错误",
  164. type: "error"
  165. });
  166. }
  167. },
  168. //页码规格变更
  169. handleSizeChange(val) {
  170. this.pageSize = val;
  171. this.getCrews();
  172. },
  173. //页码页数变更
  174. handleCurrentChange(val) {
  175. this.pageIndex = val;
  176. this.getCrews();
  177. }
  178. },
  179. mounted() {
  180. this.getCrews();
  181. this.getDeadline();
  182. }
  183. };
  184. </script>
  185. <style scoped>
  186. .tips {
  187. line-height: 32px;
  188. }
  189. </style>