index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <!--黑名单-->
  2. <template>
  3. <div class="app-container blacklist">
  4. <div class="blacklist-page" v-if="pageType == 1">
  5. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  6. <el-form-item label="学院" prop="deptId" style="margin-left:-30px;">
  7. <el-select v-model="queryParams.deptId" placeholder="请选择学院" clearable size="small">
  8. <el-option
  9. v-for="dict in deptOptions"
  10. :key="dict.deptId"
  11. :label="dict.deptName"
  12. :value="dict.deptId"
  13. ></el-option>
  14. </el-select>
  15. </el-form-item>
  16. <el-form-item label="关键字" prop="searchValue">
  17. <el-input
  18. v-model="queryParams.searchValue"
  19. placeholder="请输入姓名/学号"
  20. clearable
  21. size="small"
  22. />
  23. </el-form-item>
  24. <el-form-item>
  25. <p class="inquire-button-one" @click="handleQuery">查询</p>
  26. <p class="reset-button-one" @click="resetQuery">重置</p>
  27. </el-form-item>
  28. </el-form>
  29. <el-table v-loading="loading" border :data="blacklistList" @sort-change="handleSelectionChange">
  30. <el-table-column label="姓名" align="left" prop="userName" />
  31. <el-table-column label="学号" align="left" prop="number" />
  32. <el-table-column label="学院" align="left" prop="deptName" />
  33. <el-table-column label="违规次数" align="left" sortable="custom" prop="total" />
  34. <el-table-column label="负面清单次数" align="left" sortable="custom" prop="negativeNum" />
  35. <el-table-column label="黑名单次数" align="left" sortable="custom" prop="blackNum" />
  36. <el-table-column label="信用分" align="left" prop="creditScore" />
  37. <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="230" v-if="tableButtonType">
  38. <template slot-scope="scope">
  39. <div class="button-box">
  40. <p class="table-min-button"
  41. style="margin-right:10px;"
  42. @click="goPage(2,scope.row)"
  43. v-hasPermi="['laboratory:blackdetail:list']"
  44. >历史记录</p>
  45. <p class="table-min-button"
  46. v-if="scope.row.blacklistStatus == 1"
  47. @click="handleDelete(scope.row)"
  48. v-hasPermi="['laboratory:blacklist:remove']"
  49. >移除黑名单</p>
  50. </div>
  51. </template>
  52. </el-table-column>
  53. </el-table>
  54. <pagination
  55. v-show="total>0"
  56. :total="total"
  57. layout="total, prev, pager, next, sizes, jumper"
  58. :page.sync="queryParams.pageNum"
  59. :limit.sync="queryParams.pageSize"
  60. @pagination="getList"
  61. />
  62. </div>
  63. <black-list-info v-if="pageType == 2" :propsData="propsData"></black-list-info>
  64. <!-- 移除黑名单 -->
  65. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  66. <el-form ref="form" :model="form" :rules="rules" label-width="90px">
  67. <el-form-item label="姓名:">
  68. <el-input v-model="form.userName" :disabled="true" placeholder="请输入姓名" />
  69. </el-form-item>
  70. <el-form-item label="学号:">
  71. <el-input v-model="form.number" :disabled="true" placeholder="请输入学号" />
  72. </el-form-item>
  73. <el-form-item label="学院:">
  74. <el-input v-model="form.deptName" :disabled="true" placeholder="请输入姓名" />
  75. </el-form-item>
  76. <el-form-item label="原因:" prop="reason">
  77. <el-input
  78. type="textarea"
  79. :autosize="{ minRows: 6, maxRows: 6}"
  80. placeholder="请输入原因"
  81. resize="none"
  82. v-model="form.reason">
  83. </el-input>
  84. </el-form-item>
  85. <el-form-item label="">
  86. <p style="font-size:14px;color:#999;margin:0;">提交后,该人员信用分自动恢复到合格分。</p>
  87. </el-form-item>
  88. </el-form>
  89. <div slot="footer" class="dialog-footer">
  90. <el-button @click="cancel">取 消</el-button>
  91. <el-button type="primary" @click="submitForm">确 定</el-button>
  92. </div>
  93. </el-dialog>
  94. </div>
  95. </template>
  96. <script>
  97. import { listBlacklist, getBlacklist, delBlacklist, addBlacklist, updateBlacklist, removeBlacklist } from "@/api/laboratory/blacklist";
  98. import { selectListUser } from "@/api/system/user";
  99. import { listDepartments,listbuildings } from "@/api/system/dept";
  100. import blackListInfo from "./blackListInfo.vue";
  101. export default {
  102. name: "Blacklist",
  103. components: {
  104. blackListInfo,
  105. },
  106. data() {
  107. return {
  108. tableButtonType:this.hasPermiDom(['laboratory:blackdetail:list','laboratory:blacklist:remove']),
  109. // 遮罩层
  110. loading: true,
  111. // 选中数组
  112. ids: [],
  113. // 非单个禁用
  114. single: true,
  115. // 非多个禁用
  116. multiple: true,
  117. // 显示搜索条件
  118. showSearch: true,
  119. // 总条数
  120. total: 0,
  121. // 黑名单表格数据
  122. blacklistList: [
  123. {
  124. id:"id",
  125. joinUserId:"joinUserId",
  126. blacklistStatus:"blacklistStatus",
  127. deptId:"deptId",
  128. },
  129. ],
  130. // 弹出层标题
  131. title: "",
  132. // 是否显示弹出层
  133. open: false,
  134. // 查询参数
  135. queryParams: {
  136. pageNum: 1,
  137. pageSize:20,
  138. searchValue: null,
  139. joinUserId: null,
  140. blacklistStatus: null,
  141. deptId: null,
  142. deptName: null,
  143. userId: null,
  144. },
  145. // 表单参数
  146. form: {},
  147. // 表单校验
  148. rules: {
  149. reason:[
  150. {required: true, message: '请输入原因', trigger: 'blur'},
  151. { required: true, message: "请输入原因", validator: this.spaceJudgment, trigger: "blur" }
  152. ],
  153. },
  154. //新增-编辑状态
  155. disabledType:true,
  156. //人员
  157. optionsUser: [],
  158. //处置方案
  159. optionsTwo: [],
  160. // 日期范围
  161. dateRange: [],
  162. deptOptions:[],
  163. //页面状态
  164. pageType:1,
  165. propsData:{},
  166. };
  167. },
  168. created() {
  169. this.getList();
  170. this.getDicts("penaltyType").then(response => {
  171. this.optionsTwo = response.data;
  172. });
  173. },
  174. mounted(){
  175. this.getDeptList();
  176. },
  177. methods: {
  178. goPage(type,row){
  179. if(this.pageType!=type){
  180. if(type == 1){
  181. this.pageType = type;
  182. this.getList();
  183. }else if(type == 2){
  184. this.propsData.userId = row.id
  185. this.pageType = type;
  186. }
  187. }
  188. },
  189. /** 查询黑名单列表 */
  190. getList() {
  191. this.loading = true;
  192. if(this.dateRange&&this.dateRange.length>0)
  193. {
  194. this.queryParams.startTime=this.dateRange[0]
  195. this.queryParams.endTime=this.dateRange[1]
  196. }
  197. else
  198. {
  199. this.queryParams.startTime=null;
  200. this.queryParams.endTime=null
  201. }
  202. listBlacklist(this.queryParams).then(response => {
  203. this.blacklistList = response.rows;
  204. this.total = response.total;
  205. this.loading = false;
  206. });
  207. },
  208. /** 查询学院列表 */
  209. getDeptList()
  210. {
  211. listDepartments().then(response => {
  212. // this.deptOptions = response.data;
  213. this.$set(this, 'deptOptions', response.data)
  214. });
  215. },
  216. // 处置类型字典翻译
  217. statusFormat(row, column) {
  218. return this.selectDictLabel(this.optionsTwo, row.penaltyType);
  219. },
  220. // 取消按钮
  221. cancel() {
  222. this.open = false;
  223. this.reset();
  224. },
  225. // 表单重置
  226. reset() {
  227. this.form = {
  228. id: null,
  229. joinUserId: null,
  230. blacklistStatus: 0,
  231. deptId: null,
  232. deptName: null,
  233. userId: null,
  234. remark: null,
  235. createBy: null,
  236. createTime: null,
  237. updateBy: null,
  238. updateTime: null
  239. };
  240. this.resetForm("form");
  241. },
  242. /** 搜索按钮操作 */
  243. handleQuery() {
  244. this.queryParams.pageNum = 1;
  245. this.getList();
  246. },
  247. /** 重置按钮操作 */
  248. resetQuery() {
  249. // this.resetForm("queryForm");
  250. this.$set(this,'queryParams',{
  251. pageNum: 1,
  252. pageSize:20,
  253. deptId:"",
  254. searchValue: '',
  255. });
  256. this.dateRange = null;
  257. this.handleQuery();
  258. },
  259. // 多选框选中数据
  260. handleSelectionChange(type) {
  261. if(type.order == 'ascending'){
  262. this.queryParams.order = type.prop;//降
  263. this.queryParams.orderType = 'asc';//升ascending
  264. }else if(type.order == 'descending'){
  265. this.queryParams.order = type.prop;//降
  266. this.queryParams.orderType = 'desc';//降
  267. }else{
  268. this.queryParams.order = null;//无
  269. this.queryParams.orderType = null;//无
  270. }
  271. this.getList();
  272. },
  273. /** 新增按钮操作 */
  274. handleAdd() {
  275. this.reset();
  276. this.disabledType = false;
  277. this.open = true;
  278. this.title = "添加黑名单";
  279. },
  280. /** 修改按钮操作 */
  281. // handleUpdate(row) {
  282. // this.reset();
  283. // const id = row.id || this.ids.join()
  284. // getBlacklist(id).then(response => {
  285. // this.form = response.data;
  286. // this.disabledType = true;
  287. // this.open = true;
  288. // this.title = "修改黑名单";
  289. // });
  290. // },
  291. /** 提交按钮 */
  292. submitForm() {
  293. this.$refs["form"].validate(valid => {
  294. if (valid) {
  295. removeBlacklist(this.form).then(response => {
  296. this.msgSuccess("操作成功");
  297. this.open = false;
  298. this.getList();
  299. });
  300. }
  301. });
  302. },
  303. /** 删除按钮操作 */
  304. handleDelete(row) {
  305. this.$set(this,'form',row);
  306. this.title = "移除黑名单";
  307. this.open = true;
  308. },
  309. /** 导出按钮操作 */
  310. handleExport() {
  311. this.download('laboratory/blacklist/export', {
  312. ...this.queryParams
  313. }, `laboratory_blacklist.xlsx`)
  314. },
  315. /** 下列人员-懒加载 */
  316. userSelectList(query) {
  317. if (query !== '' && query.length>1) {
  318. this.loading = true;
  319. this.userSelectList.nickName=query;
  320. selectListUser(this.userSelectList).then(response => {
  321. this.optionsUser = response.data;
  322. this.loading = false;
  323. });
  324. } else {
  325. this.optionsUser = [];
  326. }
  327. }
  328. }
  329. };
  330. </script>
  331. <style scoped lang="scss">
  332. .blacklist {
  333. display: flex!important;
  334. flex-direction: column;
  335. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  336. padding:20px!important;
  337. overflow: hidden;
  338. .blacklist-page{
  339. flex:1;
  340. display: flex!important;
  341. flex-direction: column;
  342. overflow: hidden;
  343. .button-box{
  344. display: flex;
  345. width:250px;
  346. margin:0 auto;
  347. }
  348. }
  349. }
  350. </style>