index.vue 32 KB

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