index.vue 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022
  1. <!--学生管理-->
  2. <template>
  3. <div class="app-container student">
  4. <div v-show="pageType == 1" class="student-one-box">
  5. <el-form :model="queryParams" class="form-box" ref="queryForm" :inline="true" v-show="showSearch">
  6. <!--v-hasPermi="['laboratory:plan:add']"-->
  7. <el-form-item label="关键字" prop="searchValue" label-width="54px">
  8. <el-input
  9. maxLength="20"
  10. v-model="queryParams.searchValue"
  11. placeholder="姓名/学号/导师/手机号码"
  12. clearable
  13. size="small"
  14. style="width: 240px"
  15. />
  16. </el-form-item>
  17. <el-form-item label="学院" prop="deptId" label-width="50px">
  18. <el-select v-model="queryParams.deptId" clearable placeholder="请选择学院">
  19. <el-option
  20. style="width:80px;"
  21. v-for="item in collegeOptions"
  22. :key="item.deptId"
  23. :label="item.deptName"
  24. :value="item.deptId">
  25. </el-option>
  26. </el-select>
  27. </el-form-item>
  28. <el-form-item label="状态" prop="status" label-width="50px">
  29. <el-select v-model="queryParams.status" clearable placeholder="请选择状态">
  30. <el-option :key="0" label="启用" :value="0"></el-option>
  31. <el-option :key="1" label="停用" :value="1"></el-option>
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item label="校园卡" prop="cardNumSimple" label-width="54px">
  35. <el-select v-model="queryParams.cardNumSimple" clearable placeholder="请选择">
  36. <el-option
  37. v-for="item in professionOptions"
  38. :key="item.postId"
  39. :label="item.postName"
  40. :value="item.postId">
  41. </el-option>
  42. </el-select>
  43. </el-form-item>
  44. <el-form-item>
  45. <el-dropdown @command="importButton" v-hasPermi="['system:user_student:import']">
  46. <div class="form-dropdown-box">
  47. <img src="@/assets/ZDimages/personnelManagement/icon_jzgxx_dr.png">
  48. <p>导入</p>
  49. <img src="@/assets/ZDimages/personnelManagement/icon_jzggl_xljt.png">
  50. </div>
  51. <el-dropdown-menu slot="dropdown">
  52. <el-dropdown-item style="border-bottom:1px solid #E0E0E0;margin:0 10px;color:#333;" :command="{command:1}" v-hasPermi="['system:user_student:exceltemplate']">下载模板</el-dropdown-item>
  53. <el-dropdown-item style="margin:0 10px;color:#666;" :command="{command:2}">导入数据</el-dropdown-item>
  54. </el-dropdown-menu>
  55. </el-dropdown>
  56. </el-form-item>
  57. <el-form-item>
  58. <el-dropdown @command="exportButton" v-hasPermi="['system:user_student:export']">
  59. <div class="form-dropdown-box">
  60. <img src="@/assets/ZDimages/personnelManagement/icon_jzgxx_sc.png">
  61. <p>导出</p>
  62. <img src="@/assets/ZDimages/personnelManagement/icon_jzggl_xljt.png">
  63. </div>
  64. <el-dropdown-menu slot="dropdown">
  65. <el-dropdown-item style="border-bottom:1px solid #E0E0E0;margin:0 10px;color:#333;" :command="{command:1}">导出全部数据</el-dropdown-item>
  66. <el-dropdown-item style="margin:0 10px;color:#666;" :command="{command:2}">导出选中数据</el-dropdown-item>
  67. </el-dropdown-menu>
  68. </el-dropdown>
  69. </el-form-item>
  70. <el-form-item style="float: right;">
  71. <el-col :span="1.5" v-hasPermi="['system:user_student:add']">
  72. <p class="add-button-one-90"
  73. @click="addButton"
  74. ><i class="el-icon-plus"></i>新增</p>
  75. </el-col>
  76. </el-form-item>
  77. <el-form-item style="float: right;">
  78. <el-col :span="1.5" v-hasPermi="['system:user_student:check']">
  79. <p class="add-button-one-90"
  80. @click="bindingCard"
  81. >批量绑卡</p>
  82. </el-col>
  83. </el-form-item>
  84. <el-form-item>
  85. <p class="inquire-button-one" @click="handleQuery">查询</p>
  86. <p class="reset-button-one" @click="resetQuery">重置</p>
  87. </el-form-item>
  88. </el-form>
  89. <el-table border :data="userList" @selection-change="handleSelectionChange" ref="multipleTable" :row-key="getRowKeys">
  90. <el-table-column type="selection" width="50" :reserve-selection="true" align="center"/>
  91. <el-table-column label="序号" width="50" align="center" type="index"/>
  92. <el-table-column label="姓名" align="left" prop="nickName"/>
  93. <el-table-column label="学号" align="left" prop="userName" width="180">
  94. <template slot-scope="scope">
  95. <div style="display: flex">
  96. <span style="flex:1;">{{scope.row.userName}}</span>
  97. <el-switch
  98. @click.native="changeIsNeedCaptcha(scope.row)"
  99. class="switch captcha-img"
  100. active-value="0"
  101. inactive-value="1"
  102. active-color="#0183FA"
  103. inactive-color="#999"
  104. v-model="scope.row.status"
  105. active-text="启用"
  106. inactive-text="停用"
  107. disabled
  108. ></el-switch>
  109. </div>
  110. </template>
  111. </el-table-column>
  112. <el-table-column label="手机号码" align="left" prop="phonenumber" show-overflow-tooltip width="162"/>
  113. <el-table-column label="学院" align="left" prop="deptName" show-overflow-tooltip width="200"/>
  114. <el-table-column label="专业" align="left" prop="major" show-overflow-tooltip width="180"/>
  115. <el-table-column label="学生类别" align="left" prop="education" show-overflow-tooltip width="149"/>
  116. <el-table-column label="班级" align="center" prop="gradeName" show-overflow-tooltip width="100"/>
  117. <el-table-column label="导师" align="center" prop="tutorUserName" show-overflow-tooltip width="150"/>
  118. <el-table-column label="操作" align="left" width="160" class-name="small-padding fixed-width" v-if="tableButtonType">
  119. <template slot-scope="scope">
  120. <div class="button-box">
  121. <p class="table-min-button"
  122. style="margin-left:20px;"
  123. v-hasPermi="['system:user_student:query']"
  124. @click="infoButton(scope.row)"
  125. >详情</p>
  126. <el-dropdown @command="moreClick" v-hasPermi="['system:user_student:query','system:user_student:edit','system:user_student:remove','system:user_student:resetpwd']">
  127. <p class="table-min-button">更多>></p>
  128. <el-dropdown-menu slot="dropdown">
  129. <el-dropdown-item style="border-bottom:1px solid #E0E0E0;margin:0 10px;" :command="{row:scope.row,command:1}"
  130. v-hasPermiAnd="['system:user_student:query','system:user_student:edit']">编辑</el-dropdown-item>
  131. <el-dropdown-item style="border-bottom:1px solid #E0E0E0;margin:0 10px;" :command="{row:scope.row,command:2}"
  132. v-hasPermi="['system:user_student:remove']">删除</el-dropdown-item>
  133. <el-dropdown-item style="margin:0 10px;" :command="{row:scope.row,command:3}"
  134. v-hasPermi="['system:user_student:resetpwd']">重置密码</el-dropdown-item>
  135. </el-dropdown-menu>
  136. </el-dropdown>
  137. </div>
  138. </template>
  139. </el-table-column>
  140. </el-table>
  141. <div style="display: flex;height:32px;margin-top:15px;">
  142. <!--<p style="flex:4;"></p>-->
  143. <p style="text-align: left;margin:0;line-height:32px;margin-right:20px;font-size:14px;color:#999;">
  144. <i class="el-icon-warning" style="color:#0183FA;"></i>
  145. 已选择 {{selectedNum}} 项
  146. </p>
  147. <div style="flex:5;">
  148. <pagination :page-sizes="[20, 30, 40, 50]"
  149. v-show="total>0"
  150. :total="total"
  151. style="margin:0;"
  152. :page.sync="queryParams.pageNum"
  153. :limit.sync="queryParams.pageSize"
  154. @pagination="getList"
  155. />
  156. </div>
  157. </div>
  158. </div>
  159. <add-page v-if="pageType == 2" :editType="editType" :propsData="propsData" :titleName="titleName"></add-page>
  160. <binding-card-page v-if="pageType == 3" :ids="ids"></binding-card-page>
  161. <!--重置密码-->
  162. <el-dialog title="重置密码" :visible.sync="reviseOpen" width="600px" append-to-body class="teacher-revise-dialog-box">
  163. <el-form :model="passwordForm" ref="passwordForm" :inline="true" :rules="rules" class="addCheckPage-min">
  164. <el-form-item label="新密码" prop="password" label-width="110px" >
  165. <el-input type="password" v-model="passwordForm.password" clearable maxlength="20" style="width:420px;" placeholder="请输入新密码"/>
  166. </el-form-item>
  167. <el-form-item label="确认新密码" prop="newPassword" label-width="110px">
  168. <el-input type="password" v-model="passwordForm.newPassword" clearable maxlength="20" style="width:420px;" placeholder="请确认新密码"/>
  169. </el-form-item>
  170. </el-form>
  171. <!--<p class="teacher-text-p">确定要重置该账号的密码吗?</p>-->
  172. <!--<p class="teacher-text-p">确定操作后,该账号密码将重置为系统初始密码。</p>-->
  173. <div slot="footer" class="teacher-revise-dialog-button-box">
  174. <p class="reset-button-one" @click="reviseOpenOff">取消</p>
  175. <p class="inquire-button-one" @click="putUserResetPwd">确定</p>
  176. </div>
  177. </el-dialog>
  178. <!--导入窗口-->
  179. <el-dialog title="导入数据" :visible.sync="importOpen" @close="importOpenOff" width="600px" append-to-body class="teacher-import-dialog-box">
  180. <el-upload
  181. class="teacher-import-dialog-upLoad-box"
  182. :drag="true"
  183. :data="upImportData"
  184. :action="uploadImgUrl"
  185. :show-file-list="false"
  186. :on-success="handleAvatarSuccess"
  187. :headers="headers"
  188. :before-upload="beforeAvatarUpload">
  189. <i class="el-icon-upload"></i>
  190. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  191. <div class="el-upload__tip" slot="tip">
  192. <el-checkbox v-model="upImportData.upDate">是否更新已经存在的用户数据</el-checkbox>
  193. </div>
  194. <div class="el-upload__tip" slot="tip">仅允许导入xls、xlsx、格式文件。<span style="color:#0183FA;cursor: pointer" v-hasPermi="['system:user_student:exceltemplate']" @click="importTemplate">下载模板</span></div>
  195. <div class="el-upload-text-box" slot="tip" v-if="getImportData.downFile">
  196. <div class="img-text-box">
  197. <img src="@/assets/ZDimages/personnelManagement/icon_dr_wj.png">
  198. <p>{{getImportData.textName}}</p>
  199. </div>
  200. <p class="text-p">数据导入成功 <span style="color:#0183FA;">{{getImportData.successNum}}</span> 条,失败 <span style="color:#FF6464 ;">{{getImportData.failureNum}}</span> 条</p>
  201. <div class="img-text-box">
  202. <img src="@/assets/ZDimages/personnelManagement/icon_dr_sj.png">
  203. <p style="color:#0183FA;cursor: pointer;" @click="failureExcel">点击下载失败数据报表</p>
  204. </div>
  205. </div>
  206. </el-upload>
  207. <div slot="footer" class="teacher-import-dialog-button-box">
  208. <p class="inquire-button-one" @click="importOpenOff">确定</p>
  209. </div>
  210. <div class="teacher-import-dialog-position-box" v-if="loading"></div>
  211. </el-dialog>
  212. </div>
  213. </template>
  214. <script>
  215. import { Message } from 'element-ui'
  216. import { listDepartments } from "@/api/system/dept";
  217. import { getAuthRole, updateAuthRole, resetUserPwd } from "@/api/system/user";
  218. import { listUser, getUser, delUser, addUser, updateUser, changeUserStatus,getListAll, putUserTeacher,putUserResetPwd,delUserInfo,getStudentInfo } from "@/api/system/user_student";
  219. import { optionUser } from "@/api/system/user_teacher";
  220. import { getToken } from "@/utils/auth";
  221. import { treeselect } from "@/api/system/dept";
  222. import {listMajorAll} from "@/api/system/major";
  223. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  224. import addPage from "./addPage.vue"
  225. import bindingCardPage from "./bindingCardPage.vue"
  226. export default {
  227. name: "User",
  228. components: {
  229. addPage,
  230. bindingCardPage
  231. },
  232. data() {
  233. const equalToPassword = (rule, value, callback) => {
  234. if (this.passwordForm.password !== value) {
  235. callback(new Error("两次输入的密码不一致"));
  236. } else {
  237. callback();
  238. }
  239. };
  240. return {
  241. tableButtonType:this.hasPermiDom(['system:user_student:query','system:user_student:query','system:user_student:edit','system:user_student:remove','system:user_student:resetpwd']),
  242. uploadImgUrl: window.location.href.split('://')[0]+'://' + this.judgmentNetworkReturnAddress() + "/system/user/student/importData", // 上传地址
  243. headers: {
  244. Authorization: "Bearer " + getToken(),
  245. },
  246. //专业列表
  247. majorList:[],
  248. // 遮罩层
  249. loading: false,
  250. // 选中数组
  251. ids: [],
  252. // 非单个禁用
  253. single: true,
  254. // 非多个禁用
  255. multiple: true,
  256. // 显示搜索条件
  257. showSearch: true,
  258. // 总条数
  259. total: 0,
  260. // 用户表格数据
  261. userList: [],
  262. // 弹出层标题
  263. title: "",
  264. // 部门树选项
  265. deptOptions: undefined,
  266. //专业列表
  267. professionOptions:[
  268. {
  269. postName:"未绑定",
  270. postId:"0",
  271. },
  272. {
  273. postName:"已绑定",
  274. postId:"1",
  275. },
  276. ],
  277. //学院列表
  278. collegeOptions:[],
  279. // 是否显示弹出层
  280. open: false,
  281. // 部门名称
  282. deptName: undefined,
  283. // 日期范围
  284. dateRange: [],
  285. // 岗位选项
  286. postOptions: [],
  287. // 角色选项
  288. roleOptions: [],
  289. // 表单参数
  290. form: {},
  291. defaultProps: {
  292. children: "children",
  293. label: "label"
  294. },
  295. // 用户导入参数
  296. upload: {
  297. // 是否显示弹出层(用户导入)
  298. open: false,
  299. // 弹出层标题(用户导入)
  300. title: "",
  301. // 是否禁用上传
  302. isUploading: false,
  303. // 是否更新已经存在的用户数据
  304. updateSupport: 0,
  305. // 设置上传的请求头部
  306. headers: { Authorization: "Bearer " + getToken() },
  307. // 上传的地址
  308. url: window.location.href.split('://')[0]+'://' + this.judgmentNetworkReturnAddress() + "/system/user/importData"
  309. },
  310. // 查询参数
  311. queryParams: {
  312. pageNum: 1,
  313. pageSize: 20,
  314. searchValue: "",
  315. majorId: "",
  316. deptId: "",
  317. status: "",
  318. },
  319. // 列信息
  320. columns: [
  321. { key: 0, label: `用户编号`, visible: true },
  322. { key: 1, label: `用户名称`, visible: true },
  323. { key: 2, label: `用户昵称`, visible: true },
  324. { key: 3, label: `部门`, visible: true },
  325. { key: 4, label: `手机号码`, visible: true },
  326. { key: 5, label: `状态`, visible: true },
  327. { key: 6, label: `创建时间`, visible: true }
  328. ],
  329. // 表单校验
  330. rules: {
  331. password: [
  332. { required: true, message: "新密码不能为空", trigger: "blur" },
  333. { min: 5, max: 20, message: '新密码长度必须介于 5 和 20 之间', trigger: 'blur' }
  334. ],
  335. newPassword: [
  336. { required: true, message: "确认新密码不能为空", trigger: "blur" },
  337. { min: 5, max: 20, message: '确认新密码长度必须介于 5 和 20 之间', trigger: 'blur' },
  338. { required: true, validator: equalToPassword, trigger: "blur" }
  339. ],
  340. },
  341. //表格扩展选择器---需要在@selection-change绑定的方法内监控selection数组长度
  342. selectedNum:0,
  343. //页面选项
  344. pageType:1,
  345. editType:false,
  346. //组件传参数据
  347. propsData:{},
  348. //弹窗状态
  349. shadeType:1,
  350. // 教师列表
  351. teacherList: [],
  352. //学院列表
  353. deptList:[],
  354. // 新增学生开关
  355. addStudentType:false,
  356. addTitle:"",
  357. addForm:{
  358. tutorUserName:"",
  359. tmpTutorUserId:"",
  360. },
  361. subForm:{
  362. tutorUserName:""
  363. },
  364. // 重置密码弹层开关
  365. reviseOpen: false,
  366. //导入弹层开关
  367. importOpen:false,
  368. //导入数据
  369. upImportData:{
  370. sysUserEnable:true,
  371. upDate:false,
  372. },
  373. getImportData:{
  374. downFile:false,
  375. successNum:0,
  376. failureNum:0,
  377. textName:"",
  378. },
  379. //重置密码id
  380. resetPwdId:"",
  381. passwordForm:{
  382. password:"",
  383. newPassword:"",
  384. },
  385. currentDate:'',
  386. };
  387. },
  388. watch: {
  389. // 根据名称筛选部门树
  390. deptName(val) {
  391. this.$refs.tree.filter(val);
  392. }
  393. },
  394. created() {
  395. this.getList();
  396. // this.getListAll();
  397. this.listDepartments();
  398. this.getDicts("sys_user_sex").then(response => {});
  399. this.getConfigKey("sys.user.initPassword").then(response => {});
  400. },
  401. methods: {
  402. //批量绑卡页面跳转与数量检测
  403. bindingCard(){
  404. let self = this;
  405. if(self.ids.length<1){
  406. self.msgError('请先勾选人员')
  407. return
  408. }
  409. if(self.ids.length>50){
  410. self.msgError('批量绑卡最多只可选中50条数据,当前选中了'+self.ids.length+'条.')
  411. return
  412. }
  413. this.pageType = 3;
  414. },
  415. //关闭重置密码页面
  416. reviseOpenOff(){
  417. this.reviseOpen = false;
  418. this.resetPwdId = "";
  419. },
  420. //重置密码
  421. putUserResetPwd(){
  422. this.$refs["passwordForm"].validate(valid => {
  423. if (valid) {
  424. let obj = {
  425. userId : this.resetPwdId,
  426. password:this.passwordForm.password
  427. };
  428. putUserResetPwd(obj).then(response => {
  429. this.reviseOpen = false;
  430. this.msgSuccess(response.msg)
  431. });
  432. }
  433. });
  434. },
  435. //启用/停用
  436. changeIsNeedCaptcha(row){
  437. let obj = {
  438. userId:row.userId,//用户id
  439. userName:row.userName,//用户账户
  440. status:row.status == 1?'0':'1',//账户启用停用,0是启用,1是停用
  441. }
  442. putUserTeacher(obj).then(response => {
  443. row.status = row.status == 1?'0':'1';
  444. this.msgSuccess(response.msg)
  445. });
  446. },
  447. //获取学院列表
  448. listDepartments(){
  449. listDepartments().then(response => {
  450. this.collegeOptions = response.data;
  451. });
  452. },
  453. // 查询专业列表
  454. getListAll(){
  455. getListAll().then(response => {
  456. this.professionOptions = response.data;
  457. });
  458. },
  459. outPage(){
  460. this.pageType = 1;
  461. this.getList();
  462. },
  463. //新增按钮
  464. addButton(){
  465. this.pageType = 2;
  466. this.propsData = {};
  467. this.titleName = '新增学生';
  468. this.editType = false;
  469. },
  470. //详情按钮
  471. infoButton(row){
  472. getStudentInfo(row.userId).then(response => {
  473. this.propsData = response.data;
  474. this.titleName = '学生详情';
  475. this.editType = true;
  476. this.pageType = 2;
  477. });
  478. },
  479. //更多选项
  480. moreClick(item){
  481. let self = this;
  482. if(item.command == 1){
  483. getStudentInfo(item.row.userId).then(response => {
  484. this.titleName = '学生编辑';
  485. this.propsData = response.data;
  486. this.editType = false;
  487. this.pageType = 2;
  488. });
  489. }else if(item.command == 2){
  490. this.$confirm('确认要删除吗?', "警告", {
  491. confirmButtonText: "确定",
  492. cancelButtonText: "取消",
  493. type: "warning"
  494. }).then(() => {
  495. // 确定
  496. delUserInfo(item.row.userId).then(response => {
  497. self.msgSuccess(response.msg);
  498. self.getList();
  499. });
  500. }).catch(function() {});
  501. }else if(item.command == 3){
  502. this.reset();
  503. this.title = "重置密码";
  504. this.resetPwdId = item.row.userId;
  505. this.reviseOpen = true;
  506. }
  507. },
  508. //=========表格扩展选择器方法---开始=========
  509. /*===记录勾选数据===
  510. 需要再el-table 添加 :row-key="getRowKeys"
  511. 需要在selection 添加 :reserve-selection="true"
  512. */
  513. getRowKeys(row) {
  514. return row.userId
  515. },
  516. //=========表格扩展选择器方法---结束=========
  517. /** 查询用户列表 */
  518. getList() {
  519. this.loading = true;
  520. listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  521. this.$set(this,'userList',response.rows);
  522. this.total = response.total;
  523. this.loading = false;
  524. }
  525. );
  526. },
  527. // 取消按钮
  528. cancel() {
  529. this.open = false;
  530. this.reset();
  531. },
  532. // 表单重置
  533. reset() {
  534. this.form = {
  535. userId: undefined,
  536. deptId: undefined,
  537. userName: undefined,
  538. nickName: undefined,
  539. password: undefined,
  540. newPassword: undefined,
  541. phonenumber: undefined,
  542. email: undefined,
  543. sex: undefined,
  544. status: "0",
  545. remark: undefined,
  546. postIds: [],
  547. roleIds: []
  548. };
  549. this.resetForm("form");
  550. },
  551. /** 搜索按钮操作 */
  552. handleQuery() {
  553. this.pageType = 1;
  554. this.queryParams.pageNum = 1;
  555. this.$set(this,"selectedNum",0);
  556. this.$refs.multipleTable.clearSelection()
  557. this.getList();
  558. },
  559. /** 重置按钮操作 */
  560. resetQuery() {
  561. this.dateRange = [];
  562. // this.resetForm("queryForm");
  563. this.$set(this,'queryParams',{
  564. pageNum: 1,
  565. pageSize:20,
  566. searchValue: "",
  567. cardNumSimple: "",
  568. deptId: "",
  569. status: "",
  570. });
  571. this.handleQuery();
  572. },
  573. // 多选框选中数据
  574. handleSelectionChange(selection) {
  575. this.selectedNum = selection.length;
  576. this.ids = selection.map(item => item.userId);
  577. this.single = selection.length != 1;
  578. this.multiple = !selection.length;
  579. },
  580. /** 修改按钮操作 */
  581. handleUpdate(row) {
  582. this.reset();
  583. const userId = row.userId || this.ids;
  584. getUser(userId).then(response => {
  585. this.form = response.data;
  586. this.postOptions = response.posts;
  587. this.roleOptions = response.roles;
  588. this.form.postIds = response.postIds;
  589. this.form.roleIds = response.roleIds;
  590. this.open = true;
  591. this.title = "修改用户";
  592. this.form.password = "";
  593. });
  594. },
  595. /** 提交按钮 */
  596. submitForm: function() {
  597. debugger
  598. this.$refs["addForm"].validate(valid => {
  599. if (valid) {
  600. if (this.addForm.userId != undefined) {
  601. console.log("this.addForm",this.addForm)
  602. this.subForm=this.addForm;
  603. if(!(!isNaN(this.addForm.tutorUserId) && typeof this.addForm.tutorUserId === 'number')){
  604. this.subForm.tutorUserId=this.addForm.tmpTutorUserId;
  605. }
  606. updateUser(this.subForm).then(response => {
  607. this.msgSuccess("修改成功");
  608. this.addStudentType = false;
  609. this.getList();
  610. });
  611. } else {
  612. this.addForm.password = '123456';
  613. addUser(this.addForm).then(response => {
  614. this.msgSuccess("新增成功");
  615. this.addStudentType = false;
  616. this.getList();
  617. });
  618. }
  619. }
  620. });
  621. },
  622. //导入页面关闭
  623. importOpenOff(){
  624. this.importOpen = false;
  625. this.getImportData.downFile = false;
  626. this.getImportData.successNum = 0;
  627. this.getImportData.failureNum = 0;
  628. this.getImportData.textName = "";
  629. },
  630. /** 导入按钮操作 */
  631. importButton(item){
  632. if(item.command == 1){
  633. // 下载模板
  634. this.download('/system/user/student/importTemplate', {}, `导入模板.xlsx`)
  635. }else if(item.command == 2){
  636. // 导入数据
  637. console.log('导入数据');
  638. this.importOpen = true;
  639. }
  640. },
  641. /** 当前时间 */
  642. getCurrentTime () {
  643. const yy = new Date().getFullYear()
  644. const mm = new Date().getMonth() + 1
  645. const dd = new Date().getDate()
  646. const hh = new Date().getHours()
  647. const mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes()
  648. const ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds()
  649. return yy + '-' + mm + '-' + dd
  650. },
  651. /** 导出按钮操作 */
  652. exportButton(item) {
  653. let self = this;
  654. this.currentDate=this.getCurrentTime()
  655. if(item.command == 1){
  656. self.$confirm(`确认导出全部数据?`, "提示", {
  657. confirmButtonText: "确定",
  658. cancelButtonText: "取消",
  659. type: "warning"
  660. }).then(async () => {
  661. self.download('/system/user/student/export/', {...self.queryParams}, '学生信息-'+this.currentDate+'.xlsx')
  662. }).catch(() => {})
  663. }else if(item.command == 2){
  664. if(self.ids.length>0) {
  665. self.$confirm(`确认导出选中数据?`, "提示", {
  666. confirmButtonText: "确定",
  667. cancelButtonText: "取消",
  668. type: "warning"
  669. }).then(async () => {
  670. let ids = self.ids.join(',');
  671. let obj = {
  672. ids :ids
  673. }
  674. self.download(`/system/user/student/export/`,obj, '学生信息-'+this.currentDate+'.xlsx')
  675. }).catch(() => {})
  676. }else {
  677. Message({
  678. message: "请选择要导出的数据",
  679. type: 'error'
  680. });
  681. }
  682. }
  683. },
  684. /** 下载模板操作 */
  685. importTemplate() {
  686. this.download('/system/user/student/importTemplate', {}, `导入模板.xlsx`)
  687. },
  688. /*下载失败列表*/
  689. failureExcel(){
  690. this.download('/system/user/student/importErrorData', {}, `失败报表.xlsx`)
  691. },
  692. //****************************************导入功能**************************************
  693. handleAvatarSuccess(res, file) {
  694. if(res.code == 200){
  695. this.getImportData.downFile = res.data.downFile
  696. this.getImportData.successNum = res.data.successNum
  697. this.getImportData.failureNum = res.data.failureNum
  698. // this.importOpen = false;
  699. // this.getList();
  700. }else{
  701. this.msgError(res.msg);
  702. }
  703. this.loading = false;
  704. },
  705. beforeAvatarUpload(file) {
  706. let type = false;
  707. console.log('file',file);
  708. if (file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' || file.type == 'application/vnd.ms-excel') {
  709. this.getImportData.textName = file.name;
  710. type = true;
  711. this.loading = true;
  712. }else{
  713. this.$message.error('只能上传xls/xlsx格式文件');
  714. type = false;
  715. }
  716. return type;
  717. },
  718. }
  719. };
  720. </script>
  721. <style scoped lang="scss">
  722. .student {
  723. display: flex!important;
  724. flex-direction: column;
  725. overflow: hidden!important;
  726. .sheet-expand-box{
  727. height:40px;
  728. display:flex;
  729. background:rgba(1,131,250,0.1);
  730. border-radius: 5px;
  731. margin-bottom:18px;
  732. font-size:14px;
  733. i{
  734. margin:10px 16px 0 14px;
  735. height:20px;
  736. width:20px;
  737. font-size:20px;
  738. display: block;
  739. }
  740. p{
  741. margin:0;
  742. }
  743. p:nth-child(2){
  744. width:132px;
  745. font-size:14px;
  746. height:40px;
  747. line-height:40px;
  748. }
  749. p:nth-child(3){
  750. width:60px;
  751. font-size:14px;
  752. height:40px;
  753. line-height:40px;
  754. margin-right:20px;
  755. }
  756. p:nth-child(4){
  757. width:60px;
  758. font-size:14px;
  759. height:40px;
  760. line-height:40px;
  761. margin-right:20px;
  762. }
  763. p:nth-child(5){
  764. font-size:14px;
  765. line-height:30px;
  766. width: 100px;
  767. height: 30px;
  768. border-radius: 6px;
  769. text-align: center;
  770. margin-top:5px;
  771. margin-right:20px;
  772. }
  773. p:nth-child(6){
  774. font-size:14px;
  775. line-height:30px;
  776. width: 100px;
  777. height: 30px;
  778. border-radius: 6px;
  779. text-align: center;
  780. margin-top:5px;
  781. }
  782. }
  783. .button-box{
  784. width:300px;
  785. display: flex;
  786. }
  787. .data-max-box{
  788. position:relative;
  789. margin-top:-20px;
  790. p{
  791. margin:0;
  792. }
  793. .info-title-p{
  794. line-height:80px;
  795. font-size:18px;
  796. padding-left:20px;
  797. border-bottom:1px solid #E0E0E0;
  798. }
  799. .info-data-box{
  800. height:100px;
  801. display:flex;
  802. padding-left:20px;
  803. p{
  804. width:270px;
  805. line-height:60px;
  806. font-size:16px;
  807. }
  808. }
  809. .reset-button-p{
  810. position: absolute;
  811. right:0;
  812. top:20px;
  813. cursor: pointer;
  814. text-align: center;
  815. width: 70px;
  816. height: 40px;
  817. line-height: 40px;
  818. border-radius: 6px;
  819. font-size:14px;
  820. border: 1px solid #DCDFE6;
  821. color: #606266;
  822. background: #ffffff;
  823. }
  824. }
  825. .student-one-box{
  826. flex:1;
  827. display: flex;
  828. flex-direction: column;
  829. overflow: hidden!important;
  830. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  831. padding:20px!important;
  832. .top-max-box{
  833. flex:1;
  834. display: flex;
  835. overflow: hidden!important;
  836. .left-max-box{
  837. width:250px;
  838. }
  839. .center-max-box{
  840. border-right:2px dashed #E0E0E0;
  841. margin-right:50px;
  842. margin-top:20px;
  843. }
  844. .right-max-box{
  845. flex:1;
  846. display: flex;
  847. flex-direction: column;
  848. overflow: hidden!important;
  849. .min-list-box{
  850. flex: 1;
  851. overflow: hidden!important;
  852. display: flex;
  853. margin-bottom:15px;
  854. }
  855. }
  856. }
  857. .bottom-max-box{
  858. height:35px;
  859. }
  860. .form-box{
  861. .form-dropdown-box{
  862. display: flex;
  863. margin:0;
  864. padding:0 10px;
  865. cursor: pointer;
  866. height:40px;
  867. img:nth-child(1){
  868. width:16px;
  869. height:16px;
  870. margin-top:12px;
  871. }
  872. p{
  873. width:47px;
  874. text-align: center;
  875. font-size:14px;
  876. margin:0;
  877. line-height:40px;
  878. }
  879. img:nth-child(3){
  880. width:10px;
  881. height:6px;
  882. margin-top:17px;
  883. }
  884. }
  885. }
  886. }
  887. }
  888. </style>
  889. <style lang="scss">
  890. .teacher-revise-dialog-box{
  891. .teacher-text-p{
  892. margin-left:110px;
  893. font-size:16px;
  894. }
  895. .teacher-revise-dialog-button-box{
  896. display: flex;
  897. width:190px;
  898. margin:0 auto;
  899. p{
  900. margin:0;
  901. width:70px;
  902. height:30px;
  903. line-height:30px;
  904. font-size:14px;
  905. }
  906. p:nth-child(1){
  907. margin-right:50px;
  908. }
  909. }
  910. }
  911. .teacher-import-dialog-box{
  912. .teacher-import-dialog-upLoad-box{
  913. .el-upload{
  914. width:450px;
  915. margin:0 55px;
  916. .el-upload-dragger{
  917. width:450px;
  918. .el-icon-upload{
  919. font-size:100px;
  920. color:#CBE6FE;
  921. }
  922. .el-upload__text{
  923. margin-top:20px;
  924. }
  925. }
  926. }
  927. .el-upload__tip{
  928. margin-left:60px;
  929. font-size:14px;
  930. margin-top:10px;
  931. }
  932. .el-upload-text-box{
  933. background: #F5F5F5;
  934. border-radius: 10px;
  935. margin:15px 30px 0;
  936. padding:0 20px 15px;
  937. overflow: hidden;
  938. *{
  939. margin:0;
  940. }
  941. .img-text-box{
  942. display: flex;
  943. margin-top:15px;
  944. img{
  945. width:16px;
  946. height:16px;
  947. margin-right:13px;
  948. }
  949. p{
  950. height:16px;
  951. line-height:16px;
  952. font-size:12px;
  953. }
  954. }
  955. .text-p{
  956. margin-top:15px;
  957. margin-left:29px;
  958. height:16px;
  959. line-height:16px;
  960. font-size:12px;
  961. }
  962. }
  963. }
  964. .teacher-import-dialog-button-box{
  965. display: flex;
  966. width:190px;
  967. margin:0 auto;
  968. p{
  969. width:70px;
  970. height:30px;
  971. line-height:30px;
  972. font-size:14px;
  973. margin:0 auto;
  974. }
  975. }
  976. .teacher-import-dialog-position-box{
  977. width:100%;
  978. height:100%;
  979. position: absolute;
  980. top:0;
  981. left:0;
  982. z-index: 999;
  983. background: rgba(255,255,255,0.4);
  984. border-radius:20px;
  985. }
  986. }
  987. </style>
  988. <style lang="scss">
  989. .student{
  990. .student-one-box{
  991. .switch .el-switch__label {
  992. position: absolute;
  993. display: none;
  994. color: #fff !important;
  995. }
  996. .switch .el-switch__label--right {
  997. z-index: 1;
  998. }
  999. .switch .el-switch__label--right span{
  1000. margin-left: 10px;
  1001. }
  1002. .switch .el-switch__label--left {
  1003. z-index: 1;
  1004. }
  1005. .switch .el-switch__label--left span{
  1006. margin-left: 24px;
  1007. }
  1008. .switch .el-switch__label.is-active {
  1009. display: block;
  1010. }
  1011. .switch.el-switch .el-switch__core,
  1012. .el-switch .el-switch__label {
  1013. width: 64px !important;
  1014. margin: 0;
  1015. }
  1016. }
  1017. }
  1018. </style>