index.vue 11 KB

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