index.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023
  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. v-for="item in collegeOptions"
  21. :key="item.deptId"
  22. :label="item.deptName"
  23. :value="item.deptId">
  24. </el-option>
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item label="状态" prop="status" label-width="50px">
  28. <el-select v-model="queryParams.status" clearable placeholder="请选择状态">
  29. <el-option :key="0" label="启用" :value="0"></el-option>
  30. <el-option :key="1" label="停用" :value="1"></el-option>
  31. </el-select>
  32. </el-form-item>
  33. <el-form-item label="校园卡" prop="cardNumSimple" label-width="54px">
  34. <el-select v-model="queryParams.cardNumSimple" clearable placeholder="请选择">
  35. <el-option
  36. v-for="item in professionOptions"
  37. :key="item.postId"
  38. :label="item.postName"
  39. :value="item.postId">
  40. </el-option>
  41. </el-select>
  42. </el-form-item>
  43. <el-form-item>
  44. <el-dropdown @command="importButton" v-hasPermi="['system:user_student:import']">
  45. <div class="form-dropdown-box">
  46. <img src="@/assets/ZDimages/personnelManagement/icon_jzgxx_dr.png">
  47. <p>导入</p>
  48. <img src="@/assets/ZDimages/personnelManagement/icon_jzggl_xljt.png">
  49. </div>
  50. <el-dropdown-menu slot="dropdown">
  51. <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>
  52. <el-dropdown-item style="margin:0 10px;color:#666;" :command="{command:2}">导入数据</el-dropdown-item>
  53. </el-dropdown-menu>
  54. </el-dropdown>
  55. </el-form-item>
  56. <el-form-item>
  57. <el-dropdown @command="exportButton" v-hasPermi="['system:user_student:export']">
  58. <div class="form-dropdown-box">
  59. <img src="@/assets/ZDimages/personnelManagement/icon_jzgxx_sc.png">
  60. <p>导出</p>
  61. <img src="@/assets/ZDimages/personnelManagement/icon_jzggl_xljt.png">
  62. </div>
  63. <el-dropdown-menu slot="dropdown">
  64. <el-dropdown-item style="border-bottom:1px solid #E0E0E0;margin:0 10px;color:#333;" :command="{command:1}">导出全部数据</el-dropdown-item>
  65. <el-dropdown-item style="margin:0 10px;color:#666;" :command="{command:2}">导出选中数据</el-dropdown-item>
  66. </el-dropdown-menu>
  67. </el-dropdown>
  68. </el-form-item>
  69. <el-form-item style="float: right;">
  70. <el-col :span="1.5" v-hasPermi="['system:user_student:add']">
  71. <p class="add-button-one-90"
  72. @click="addButton"
  73. ><i class="el-icon-plus"></i>新增</p>
  74. </el-col>
  75. </el-form-item>
  76. <el-form-item style="float: right;">
  77. <el-col :span="1.5" v-hasPermi="['system:user_student:check']">
  78. <p class="add-button-one-90"
  79. @click="bindingCard"
  80. >批量绑卡</p>
  81. </el-col>
  82. </el-form-item>
  83. <el-form-item>
  84. <p class="inquire-button-one" @click="handleQuery">查询</p>
  85. <p class="reset-button-one" @click="resetQuery">重置</p>
  86. </el-form-item>
  87. </el-form>
  88. <el-table border :data="userList" @selection-change="handleSelectionChange" ref="multipleTable" :row-key="getRowKeys">
  89. <el-table-column type="selection" width="50" :reserve-selection="true" align="center"/>
  90. <el-table-column label="序号" width="50" align="center" type="index"/>
  91. <el-table-column label="姓名" align="left" prop="nickName"/>
  92. <el-table-column label="学号" align="left" prop="userName" width="180">
  93. <template slot-scope="scope">
  94. <div style="display: flex">
  95. <span style="flex:1;">{{scope.row.userName}}</span>
  96. <el-switch
  97. @click.native="changeIsNeedCaptcha(scope.row)"
  98. class="switch captcha-img"
  99. active-value="0"
  100. inactive-value="1"
  101. active-color="#0183FA"
  102. inactive-color="#999"
  103. v-model="scope.row.status"
  104. active-text="启用"
  105. inactive-text="停用"
  106. disabled
  107. ></el-switch>
  108. </div>
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="手机号码" align="left" prop="phonenumber" show-overflow-tooltip width="162"/>
  112. <el-table-column label="学院" align="left" prop="deptName" show-overflow-tooltip width="200"/>
  113. <el-table-column label="专业" align="left" prop="major" show-overflow-tooltip width="180"/>
  114. <el-table-column label="学生类别" align="left" prop="education" show-overflow-tooltip width="149"/>
  115. <el-table-column label="班级" align="center" prop="gradeName" show-overflow-tooltip width="100"/>
  116. <el-table-column label="导师" align="center" prop="tutorUserName" show-overflow-tooltip width="150"/>
  117. <el-table-column label="操作" align="left" width="160" class-name="small-padding fixed-width" v-if="tableButtonType">
  118. <template slot-scope="scope">
  119. <div class="table-button-box">
  120. <p class="table-button-null"></p>
  121. <p class="table-button-p"
  122. v-hasPermi="['system:user_student:query']"
  123. @click="infoButton(scope.row)"
  124. >详情</p>
  125. <el-dropdown @command="moreClick" v-hasPermi="['system:user_student:query','system:user_student:edit','system:user_student:remove','system:user_student:resetpwd']">
  126. <p class="table-button-p">更多>></p>
  127. <el-dropdown-menu slot="dropdown">
  128. <el-dropdown-item style="border-bottom:1px solid #E0E0E0;margin:0 10px;" :command="{row:scope.row,command:1}"
  129. v-hasPermiAnd="['system:user_student:query','system:user_student:edit']">编辑</el-dropdown-item>
  130. <el-dropdown-item style="border-bottom:1px solid #E0E0E0;margin:0 10px;" :command="{row:scope.row,command:2}"
  131. v-hasPermi="['system:user_student:remove']">删除</el-dropdown-item>
  132. <el-dropdown-item style="margin:0 10px;" :command="{row:scope.row,command:3}"
  133. v-hasPermi="['system:user_student:resetpwd']">重置密码</el-dropdown-item>
  134. </el-dropdown-menu>
  135. </el-dropdown>
  136. <p class="table-button-null"></p>
  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.propsData.roleIds = response.roleIds;
  487. this.editType = false;
  488. this.pageType = 2;
  489. });
  490. }else if(item.command == 2){
  491. this.$confirm('确认要删除吗?', "警告", {
  492. confirmButtonText: "确定",
  493. cancelButtonText: "取消",
  494. type: "warning"
  495. }).then(() => {
  496. // 确定
  497. delUserInfo(item.row.userId).then(response => {
  498. self.msgSuccess(response.msg);
  499. self.getList();
  500. });
  501. }).catch(function() {});
  502. }else if(item.command == 3){
  503. this.reset();
  504. this.title = "重置密码";
  505. this.resetPwdId = item.row.userId;
  506. this.reviseOpen = true;
  507. }
  508. },
  509. //=========表格扩展选择器方法---开始=========
  510. /*===记录勾选数据===
  511. 需要再el-table 添加 :row-key="getRowKeys"
  512. 需要在selection 添加 :reserve-selection="true"
  513. */
  514. getRowKeys(row) {
  515. return row.userId
  516. },
  517. //=========表格扩展选择器方法---结束=========
  518. /** 查询用户列表 */
  519. getList() {
  520. this.loading = true;
  521. listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  522. this.$set(this,'userList',response.rows);
  523. this.total = response.total;
  524. this.loading = false;
  525. }
  526. );
  527. },
  528. // 取消按钮
  529. cancel() {
  530. this.open = false;
  531. this.reset();
  532. },
  533. // 表单重置
  534. reset() {
  535. this.form = {
  536. userId: undefined,
  537. deptId: undefined,
  538. userName: undefined,
  539. nickName: undefined,
  540. password: undefined,
  541. newPassword: undefined,
  542. phonenumber: undefined,
  543. email: undefined,
  544. sex: undefined,
  545. status: "0",
  546. remark: undefined,
  547. postIds: [],
  548. roleIds: []
  549. };
  550. this.resetForm("form");
  551. },
  552. /** 搜索按钮操作 */
  553. handleQuery() {
  554. this.pageType = 1;
  555. this.queryParams.pageNum = 1;
  556. this.$set(this,"selectedNum",0);
  557. this.$refs.multipleTable.clearSelection()
  558. this.getList();
  559. },
  560. /** 重置按钮操作 */
  561. resetQuery() {
  562. this.dateRange = [];
  563. // this.resetForm("queryForm");
  564. this.$set(this,'queryParams',{
  565. pageNum: 1,
  566. pageSize:20,
  567. searchValue: "",
  568. cardNumSimple: "",
  569. deptId: "",
  570. status: "",
  571. });
  572. this.handleQuery();
  573. },
  574. // 多选框选中数据
  575. handleSelectionChange(selection) {
  576. this.selectedNum = selection.length;
  577. this.ids = selection.map(item => item.userId);
  578. this.single = selection.length != 1;
  579. this.multiple = !selection.length;
  580. },
  581. /** 修改按钮操作 */
  582. handleUpdate(row) {
  583. this.reset();
  584. const userId = row.userId || this.ids;
  585. getUser(userId).then(response => {
  586. this.form = response.data;
  587. this.postOptions = response.posts;
  588. this.roleOptions = response.roles;
  589. this.form.postIds = response.postIds;
  590. this.form.roleIds = response.roleIds;
  591. this.open = true;
  592. this.title = "修改用户";
  593. this.form.password = "";
  594. });
  595. },
  596. /** 提交按钮 */
  597. submitForm: function() {
  598. debugger
  599. this.$refs["addForm"].validate(valid => {
  600. if (valid) {
  601. if (this.addForm.userId != undefined) {
  602. console.log("this.addForm",this.addForm)
  603. this.subForm=this.addForm;
  604. if(!(!isNaN(this.addForm.tutorUserId) && typeof this.addForm.tutorUserId === 'number')){
  605. this.subForm.tutorUserId=this.addForm.tmpTutorUserId;
  606. }
  607. updateUser(this.subForm).then(response => {
  608. this.msgSuccess("修改成功");
  609. this.addStudentType = false;
  610. this.getList();
  611. });
  612. } else {
  613. this.addForm.password = '123456';
  614. addUser(this.addForm).then(response => {
  615. this.msgSuccess("新增成功");
  616. this.addStudentType = false;
  617. this.getList();
  618. });
  619. }
  620. }
  621. });
  622. },
  623. //导入页面关闭
  624. importOpenOff(){
  625. this.importOpen = false;
  626. this.getImportData.downFile = false;
  627. this.getImportData.successNum = 0;
  628. this.getImportData.failureNum = 0;
  629. this.getImportData.textName = "";
  630. },
  631. /** 导入按钮操作 */
  632. importButton(item){
  633. if(item.command == 1){
  634. // 下载模板
  635. this.download('/system/user/student/importTemplate', {}, `导入模板.xlsx`)
  636. }else if(item.command == 2){
  637. // 导入数据
  638. console.log('导入数据');
  639. this.importOpen = true;
  640. }
  641. },
  642. /** 当前时间 */
  643. getCurrentTime () {
  644. const yy = new Date().getFullYear()
  645. const mm = new Date().getMonth() + 1
  646. const dd = new Date().getDate()
  647. const hh = new Date().getHours()
  648. const mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes()
  649. const ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds()
  650. return yy + '-' + mm + '-' + dd
  651. },
  652. /** 导出按钮操作 */
  653. exportButton(item) {
  654. let self = this;
  655. this.currentDate=this.getCurrentTime()
  656. if(item.command == 1){
  657. self.$confirm(`确认导出全部数据?`, "提示", {
  658. confirmButtonText: "确定",
  659. cancelButtonText: "取消",
  660. type: "warning"
  661. }).then(async () => {
  662. self.download('/system/user/student/export/', {...self.queryParams}, '学生信息-'+this.currentDate+'.xlsx')
  663. }).catch(() => {})
  664. }else if(item.command == 2){
  665. if(self.ids.length>0) {
  666. self.$confirm(`确认导出选中数据?`, "提示", {
  667. confirmButtonText: "确定",
  668. cancelButtonText: "取消",
  669. type: "warning"
  670. }).then(async () => {
  671. let ids = self.ids.join(',');
  672. let obj = {
  673. ids :ids
  674. }
  675. self.download(`/system/user/student/export/`,obj, '学生信息-'+this.currentDate+'.xlsx')
  676. }).catch(() => {})
  677. }else {
  678. Message({
  679. message: "请选择要导出的数据",
  680. type: 'error'
  681. });
  682. }
  683. }
  684. },
  685. /** 下载模板操作 */
  686. importTemplate() {
  687. this.download('/system/user/student/importTemplate', {}, `导入模板.xlsx`)
  688. },
  689. /*下载失败列表*/
  690. failureExcel(){
  691. this.download('/system/user/student/importErrorData', {}, `失败报表.xlsx`)
  692. },
  693. //****************************************导入功能**************************************
  694. handleAvatarSuccess(res, file) {
  695. if(res.code == 200){
  696. this.getImportData.downFile = res.data.downFile
  697. this.getImportData.successNum = res.data.successNum
  698. this.getImportData.failureNum = res.data.failureNum
  699. // this.importOpen = false;
  700. // this.getList();
  701. }else{
  702. this.msgError(res.msg);
  703. }
  704. this.loading = false;
  705. },
  706. beforeAvatarUpload(file) {
  707. let type = false;
  708. console.log('file',file);
  709. if (file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' || file.type == 'application/vnd.ms-excel') {
  710. this.getImportData.textName = file.name;
  711. type = true;
  712. this.loading = true;
  713. }else{
  714. this.$message.error('只能上传xls/xlsx格式文件');
  715. type = false;
  716. }
  717. return type;
  718. },
  719. }
  720. };
  721. </script>
  722. <style scoped lang="scss">
  723. .student {
  724. display: flex!important;
  725. flex-direction: column;
  726. overflow: hidden!important;
  727. .sheet-expand-box{
  728. height:40px;
  729. display:flex;
  730. background:rgba(1,131,250,0.1);
  731. border-radius: 5px;
  732. margin-bottom:18px;
  733. font-size:14px;
  734. i{
  735. margin:10px 16px 0 14px;
  736. height:20px;
  737. width:20px;
  738. font-size:20px;
  739. display: block;
  740. }
  741. p{
  742. margin:0;
  743. }
  744. p:nth-child(2){
  745. width:132px;
  746. font-size:14px;
  747. height:40px;
  748. line-height:40px;
  749. }
  750. p:nth-child(3){
  751. width:60px;
  752. font-size:14px;
  753. height:40px;
  754. line-height:40px;
  755. margin-right:20px;
  756. }
  757. p:nth-child(4){
  758. width:60px;
  759. font-size:14px;
  760. height:40px;
  761. line-height:40px;
  762. margin-right:20px;
  763. }
  764. p:nth-child(5){
  765. font-size:14px;
  766. line-height:30px;
  767. width: 100px;
  768. height: 30px;
  769. border-radius: 6px;
  770. text-align: center;
  771. margin-top:5px;
  772. margin-right:20px;
  773. }
  774. p:nth-child(6){
  775. font-size:14px;
  776. line-height:30px;
  777. width: 100px;
  778. height: 30px;
  779. border-radius: 6px;
  780. text-align: center;
  781. margin-top:5px;
  782. }
  783. }
  784. .button-box{
  785. width:300px;
  786. display: flex;
  787. }
  788. .data-max-box{
  789. position:relative;
  790. margin-top:-20px;
  791. p{
  792. margin:0;
  793. }
  794. .info-title-p{
  795. line-height:80px;
  796. font-size:18px;
  797. padding-left:20px;
  798. border-bottom:1px solid #E0E0E0;
  799. }
  800. .info-data-box{
  801. height:100px;
  802. display:flex;
  803. padding-left:20px;
  804. p{
  805. width:270px;
  806. line-height:60px;
  807. font-size:16px;
  808. }
  809. }
  810. .reset-button-p{
  811. position: absolute;
  812. right:0;
  813. top:20px;
  814. cursor: pointer;
  815. text-align: center;
  816. width: 70px;
  817. height: 40px;
  818. line-height: 40px;
  819. border-radius: 6px;
  820. font-size:14px;
  821. border: 1px solid #DCDFE6;
  822. color: #606266;
  823. background: #ffffff;
  824. }
  825. }
  826. .student-one-box{
  827. flex:1;
  828. display: flex;
  829. flex-direction: column;
  830. overflow: hidden!important;
  831. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  832. padding:20px!important;
  833. .top-max-box{
  834. flex:1;
  835. display: flex;
  836. overflow: hidden!important;
  837. .left-max-box{
  838. width:250px;
  839. }
  840. .center-max-box{
  841. border-right:2px dashed #E0E0E0;
  842. margin-right:50px;
  843. margin-top:20px;
  844. }
  845. .right-max-box{
  846. flex:1;
  847. display: flex;
  848. flex-direction: column;
  849. overflow: hidden!important;
  850. .min-list-box{
  851. flex: 1;
  852. overflow: hidden!important;
  853. display: flex;
  854. margin-bottom:15px;
  855. }
  856. }
  857. }
  858. .bottom-max-box{
  859. height:35px;
  860. }
  861. .form-box{
  862. .form-dropdown-box{
  863. display: flex;
  864. margin:0;
  865. padding:0 10px;
  866. cursor: pointer;
  867. height:40px;
  868. img:nth-child(1){
  869. width:16px;
  870. height:16px;
  871. margin-top:12px;
  872. }
  873. p{
  874. width:47px;
  875. text-align: center;
  876. font-size:14px;
  877. margin:0;
  878. line-height:40px;
  879. }
  880. img:nth-child(3){
  881. width:10px;
  882. height:6px;
  883. margin-top:17px;
  884. }
  885. }
  886. }
  887. }
  888. }
  889. </style>
  890. <style lang="scss">
  891. .teacher-revise-dialog-box{
  892. .teacher-text-p{
  893. margin-left:110px;
  894. font-size:16px;
  895. }
  896. .teacher-revise-dialog-button-box{
  897. display: flex;
  898. width:190px;
  899. margin:0 auto;
  900. p{
  901. margin:0;
  902. width:70px;
  903. height:30px;
  904. line-height:30px;
  905. font-size:14px;
  906. }
  907. p:nth-child(1){
  908. margin-right:50px;
  909. }
  910. }
  911. }
  912. .teacher-import-dialog-box{
  913. .teacher-import-dialog-upLoad-box{
  914. .el-upload{
  915. width:450px;
  916. margin:0 55px;
  917. .el-upload-dragger{
  918. width:450px;
  919. .el-icon-upload{
  920. font-size:100px;
  921. color:#CBE6FE;
  922. }
  923. .el-upload__text{
  924. margin-top:20px;
  925. }
  926. }
  927. }
  928. .el-upload__tip{
  929. margin-left:60px;
  930. font-size:14px;
  931. margin-top:10px;
  932. }
  933. .el-upload-text-box{
  934. background: #F5F5F5;
  935. border-radius: 10px;
  936. margin:15px 30px 0;
  937. padding:0 20px 15px;
  938. overflow: hidden;
  939. *{
  940. margin:0;
  941. }
  942. .img-text-box{
  943. display: flex;
  944. margin-top:15px;
  945. img{
  946. width:16px;
  947. height:16px;
  948. margin-right:13px;
  949. }
  950. p{
  951. height:16px;
  952. line-height:16px;
  953. font-size:12px;
  954. }
  955. }
  956. .text-p{
  957. margin-top:15px;
  958. margin-left:29px;
  959. height:16px;
  960. line-height:16px;
  961. font-size:12px;
  962. }
  963. }
  964. }
  965. .teacher-import-dialog-button-box{
  966. display: flex;
  967. width:190px;
  968. margin:0 auto;
  969. p{
  970. width:70px;
  971. height:30px;
  972. line-height:30px;
  973. font-size:14px;
  974. margin:0 auto;
  975. }
  976. }
  977. .teacher-import-dialog-position-box{
  978. width:100%;
  979. height:100%;
  980. position: absolute;
  981. top:0;
  982. left:0;
  983. z-index: 999;
  984. background: rgba(255,255,255,0.4);
  985. border-radius:20px;
  986. }
  987. }
  988. </style>
  989. <style lang="scss">
  990. .student{
  991. .student-one-box{
  992. .switch .el-switch__label {
  993. position: absolute;
  994. display: none;
  995. color: #fff !important;
  996. }
  997. .switch .el-switch__label--right {
  998. z-index: 1;
  999. }
  1000. .switch .el-switch__label--right span{
  1001. margin-left: 10px;
  1002. }
  1003. .switch .el-switch__label--left {
  1004. z-index: 1;
  1005. }
  1006. .switch .el-switch__label--left span{
  1007. margin-left: 24px;
  1008. }
  1009. .switch .el-switch__label.is-active {
  1010. display: block;
  1011. }
  1012. .switch.el-switch .el-switch__core,
  1013. .el-switch .el-switch__label {
  1014. width: 64px !important;
  1015. margin: 0;
  1016. }
  1017. }
  1018. }
  1019. </style>