index.vue 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409
  1. <template>
  2. <div class="pb_content" style="background: unset">
  3. <backPage style="padding: 40px 0 0;width: 94%;margin: auto;" v-if="gotype " tit="教研室管理"></backPage>
  4. <div v-if="ctype == 1" class="pb_content_body" style="
  5. background: #fff;
  6. padding: 0px 25px;
  7. box-sizing: border-box;
  8. border-radius: 5px;
  9. ">
  10. <div class="pb_head top">
  11. <div style="display: flex;align-items: center;">
  12. <span class="sub_head">教研室管理</span>
  13. <span class="subClick" @click="
  14. goTo(
  15. '/teacherType?userid=' +
  16. userid +
  17. '&oid=' +
  18. oid +
  19. '&org=' +
  20. org
  21. )
  22. ">教研室类型管理</span>
  23. </div>
  24. <div class="student_button" style="border-radius: 4px;">
  25. <el-button type="primary" class="bgColor" @click="openAddTeacher">添加教研室</el-button>
  26. </div>
  27. </div>
  28. <div class="student_head">
  29. <div class="student_search">
  30. <span>
  31. <el-input placeholder="请输入教研室名称" v-model="sClassName" clearable>
  32. </el-input>
  33. </span>
  34. <el-button type="primary" @click="searchClass">查询</el-button>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="pb_content_body" v-if="ctype == 1">
  39. <div class="student_table">
  40. <el-table v-if="ctype == 1" ref="table" :key="1" :data="tableData" border :height="tableHeight" :fit="true"
  41. v-loading="isLoading" style="width: 100%; height: 60%" :header-cell-style="{ background: '#f1f1f1' }"
  42. :row-class-name="tableRowClassName">
  43. <el-table-column prop="name" label="教研室名称" align="center">
  44. </el-table-column>
  45. <el-table-column prop="typeName" label="教研室类型" align="center">
  46. <template slot-scope="scope">
  47. <span v-if="scope.row.parentid == 6">教研室</span>
  48. <span v-else>{{ scope.row.typeName }}</span>
  49. </template>
  50. </el-table-column>
  51. <!-- <el-table-column prop="pnum" label="人数" align="center">
  52. </el-table-column> -->
  53. <el-table-column label="操作" width="400px">
  54. <template slot-scope="scope">
  55. <el-button type="primary" size="small" @click="getStudent(scope.row.id)">查看老师</el-button>
  56. <!-- <el-button type="primary" size="small" @Sclick="updateG(scope.row.pid, scope.row.id)">修改年级</el-button> -->
  57. <el-button type="primary" size="small" @click="openUpdate(scope.row.id, scope.row.name, scope.row.parentid)">修改</el-button>
  58. <el-button type="primary" size="small" @click="deleteClass(scope.row.id)">删除</el-button>
  59. </template>
  60. </el-table-column>
  61. </el-table>
  62. </div>
  63. <div class="student_page">
  64. <el-pagination background layout="prev, pager, next" :page-size="10" :total="total" v-if="page"
  65. @current-change="handleCurrentChange">
  66. </el-pagination>
  67. </div>
  68. </div>
  69. <div v-if="ctype == 2" class="pb_content_body" style="
  70. background: #fff;
  71. padding: 0px 25px;
  72. box-sizing: border-box;
  73. border-radius: 5px;
  74. ">
  75. <div class="pb_head top">
  76. <span>查看老师-{{ getGrade(cid) }}</span>
  77. <div class="student_button" style="border-radius: 4px;">
  78. <el-button type="primary" class="bgColor" @click="ctype = 1, getClass()">返回</el-button>
  79. </div>
  80. </div>
  81. <div class="student_head">
  82. <div class="head_left">
  83. <el-input v-model="sPhoneUser" class="student_input" placeholder="请输入用户名" style="margin:0 10px"></el-input>
  84. <!-- <el-select disabled v-model="cid" placeholder="请选择教研室" class="student_input" @change="searchStudent"
  85. style="margin:0 10px">
  86. <el-option label="所有人" value=""></el-option>
  87. <el-option v-for="(item, index) in classJuri" :key="index" :label="item.name" :value="item.id"></el-option>
  88. </el-select> -->
  89. <el-button class="student_button" @click="searchStudent">查询</el-button>
  90. </div>
  91. <div class="head_right">
  92. <el-button @click="addStudent">添加老师</el-button>
  93. </div>
  94. </div>
  95. </div>
  96. <div class="pb_content_body" v-if="ctype == 2">
  97. <div class="student_table">
  98. <el-table v-if="ctype == 2" :key="2" ref="table2" :data="tableData2" border :height="tableHeight" :fit="true"
  99. v-loading="isLoading" style="width: 100%" :header-cell-style="{ background: '#f1f1f1', fontSize: '17px' }"
  100. :row-class-name="tableRowClassName">
  101. <el-table-column label="姓名" min-width="10" align="center">
  102. <template slot-scope="scope">
  103. <div class="userImg">
  104. <div class="tx">
  105. <img :src="scope.row.headportrait != null
  106. ? scope.row.headportrait
  107. : tx
  108. " alt />
  109. </div>
  110. <div style="
  111. width: 150px;
  112. text-align: left;
  113. white-space: nowrap;
  114. overflow: hidden;
  115. text-overflow: ellipsis;
  116. ">
  117. {{ scope.row.name }}
  118. </div>
  119. </div>
  120. </template>
  121. </el-table-column>
  122. <el-table-column label="老师账号" min-width="15" align="center">
  123. <template slot-scope="scope">
  124. <div>{{ scope.row.un ? scope.row.un : "" }}</div>
  125. </template>
  126. </el-table-column>
  127. <el-table-column prop="classname2" label="教研室" min-width="15" align="center">
  128. </el-table-column>
  129. <el-table-column label="操作" width="250px">
  130. <template slot-scope="scope">
  131. <div class="btnBox">
  132. <el-button class="de_button" type="primary" size="small" @click="iniPassword(scope.row.userid)"
  133. v-show="false">初始化密码</el-button>
  134. <!-- <el-button class="de_button" type="primary" size="small" @click="updateStudentA(scope.row)">修改</el-button> -->
  135. <el-button class="de_button" type="primary" size="small"
  136. @click="deleteClassStudent(scope.row.userid)">移除</el-button>
  137. <!-- <div class="delete">
  138. <img src="../../../assets/remove.png" alt @click="deleteStudent(scope.row.userid, scope.row.state)" />
  139. </div> -->
  140. </div>
  141. </template>
  142. </el-table-column>
  143. </el-table>
  144. </div>
  145. <div class="student_page">
  146. <el-pagination background layout="prev, pager, next" :page-size="10" :total="total2" v-if="page2"
  147. @current-change="handleCurrentChange2"></el-pagination>
  148. </div>
  149. </div>
  150. <el-dialog :visible.sync="dialogVisibleAddStudent" :append-to-body="true" width="700px" :before-close="handleClose"
  151. class="add_student">
  152. <div slot="title" class="header-title">
  153. <div class="logoImg">
  154. <img src="../../../assets/logo.png" alt />
  155. </div>
  156. <div class="title_add_student">添加老师</div>
  157. </div>
  158. <el-form>
  159. <el-form-item label="老师姓名" :label-width="formLabelWidth">
  160. <span>
  161. <el-input placeholder="请输入老师姓名" clearable v-model="sName" class="add_input"></el-input>
  162. </span>
  163. </el-form-item>
  164. <el-form-item label="老师学号" :label-width="formLabelWidth">
  165. <span>
  166. <el-input placeholder="请输入老师学号" clearable v-model="sId" class="add_input"></el-input>
  167. </span>
  168. </el-form-item>
  169. <el-form-item label="老师手机号" :label-width="formLabelWidth">
  170. <span>
  171. <el-input placeholder="请输入老师手机号" clearable v-model="sPhone" class="add_input"></el-input>
  172. </span>
  173. </el-form-item>
  174. <el-form-item label="老师账号" :label-width="formLabelWidth">
  175. <span>
  176. <el-input placeholder="请输入老师账号" clearable v-model="sMail" class="add_input"></el-input>
  177. </span>
  178. </el-form-item>
  179. <el-form-item label="所属学校" :label-width="formLabelWidth">
  180. <el-input disabled style="width: 300px" v-model="schoolName"></el-input>
  181. </el-form-item>
  182. <el-form-item label="教研室" :label-width="formLabelWidth">
  183. <el-select v-model="cid" placeholder="请选择教研室" disabled>
  184. <el-option v-for="(item, index) in classJuri" :key="index" :label="item.name" :value="item.id"></el-option>
  185. </el-select>
  186. </el-form-item>
  187. <div style="text-align: center; color: #adb3b7">
  188. </div>
  189. </el-form>
  190. <span slot="footer" class="dialog-footer flex">
  191. <el-button class="right" @click="insertStudent">确认</el-button>
  192. </span>
  193. </el-dialog>
  194. <el-dialog :visible.sync="dialogVisibleUpdate" :append-to-body="true" width="700px" :before-close="handleClose"
  195. class="add_student">
  196. <div slot="title" class="header-title">
  197. <div class="logoImg">
  198. <img src="../../../assets/logo.png" alt />
  199. </div>
  200. <div class="title_add_student">修改老师</div>
  201. </div>
  202. <el-form>
  203. <el-form-item label="老师名称" :label-width="formLabelWidth">
  204. <span>
  205. <el-input placeholder="请输入老师姓名" clearable v-model="userinfo.name" class="add_input"></el-input>
  206. </span>
  207. </el-form-item>
  208. <el-form-item label="老师学号" :label-width="formLabelWidth">
  209. <span>
  210. <el-input placeholder="请输入老师学号" clearable v-model="userinfo.studentid" class="add_input"></el-input>
  211. </span>
  212. </el-form-item>
  213. <el-form-item label="老师手机号" :label-width="formLabelWidth">
  214. <span>
  215. <el-input placeholder="请输入老师手机号" clearable v-model="userinfo.phonenumber" class="add_input"></el-input>
  216. </span>
  217. </el-form-item>
  218. <el-form-item label="老师账号" :label-width="formLabelWidth">
  219. <span>
  220. <el-input placeholder="请输入老师账号" clearable v-model="userinfo.un" class="add_input"></el-input>
  221. </span>
  222. </el-form-item>
  223. <el-form-item label="所属学校" :label-width="formLabelWidth">
  224. <el-input disabled style="width: 300px" v-model="schoolName"></el-input>
  225. </el-form-item>
  226. <el-form-item label="教研室" :label-width="formLabelWidth">
  227. <el-select multiple collapse-tags v-model="userinfo.classid" placeholder="请选择教研室">
  228. <el-option v-for="(item, index) in classJuri" :key="index" :label="item.name" :value="item.id"></el-option>
  229. </el-select>
  230. </el-form-item>
  231. <div style="text-align: center; color: #adb3b7">
  232. </div>
  233. </el-form>
  234. <span slot="footer" class="dialog-footer flex">
  235. <el-button class="right" @click="updateStudent">修改</el-button>
  236. </span>
  237. </el-dialog>
  238. <el-dialog title="添加教研室" :visible.sync="dialogVisible" :append-to-body="true" width="25%"
  239. :before-close="handleClose" class="dialog_diy">
  240. <el-form>
  241. <el-form-item label="教研室名称" :label-width="formLabelWidth">
  242. <el-input v-model="className" auto-complete="off" placeholder="请输入教研室..."></el-input>
  243. </el-form-item>
  244. <el-form-item label="教研室类型" :label-width="formLabelWidth">
  245. <el-select v-model="typeId" placeholder="类型">
  246. <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"></el-option>
  247. </el-select>
  248. </el-form-item>
  249. </el-form>
  250. <span slot="footer" class="dialog-footer">
  251. <el-button @click="handleCancel">取 消</el-button>
  252. <el-button type="primary" @click="insertClass">确 定</el-button>
  253. </span>
  254. </el-dialog>
  255. <el-dialog title="修改年级" :visible.sync="dialogVisibleGrade" :append-to-body="true" width="25%"
  256. :before-close="handleClose" class="dialog_diy">
  257. <el-form>
  258. <el-form-item label="选择年级" :label-width="formLabelWidth">
  259. <el-select v-model="gid" placeholder="请选择教研室" class="student_input" style="margin:0 10px" clearable>
  260. <el-option v-for="(item, index) in grade" :key="index" :label="item.name" :value="item.id"></el-option>
  261. </el-select>
  262. </el-form-item>
  263. </el-form>
  264. <span slot="footer" class="dialog-footer">
  265. <el-button @click="dialogVisibleGrade = false">取 消</el-button>
  266. <el-button type="primary" @click="updateGrade">确 定</el-button>
  267. </span>
  268. </el-dialog>
  269. <el-dialog title="修改教研室" :visible.sync="dialogVisible1" :append-to-body="true" width="25%"
  270. :before-close="handleClose" class="dialog_diy">
  271. <el-form>
  272. <el-form-item label="教研室名称" :label-width="formLabelWidth">
  273. <el-input v-model="className1" auto-complete="off" placeholder="请输入教研室..."></el-input>
  274. </el-form-item>
  275. <el-form-item label="教研室类型" :label-width="formLabelWidth">
  276. <el-select v-model="typeId2" placeholder="类型">
  277. <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"></el-option>
  278. </el-select>
  279. </el-form-item>
  280. </el-form>
  281. <span slot="footer" class="dialog-footer">
  282. <el-button @click="dialogVisible1 = false">取 消</el-button>
  283. <el-button type="primary" @click="updateClass">确 定</el-button>
  284. </span>
  285. </el-dialog>
  286. <el-dialog title="添加老师" :visible.sync="dialogVisibleMember" :append-to-body="true" width="500px" height="80%"
  287. :before-close="handleClose" class="addNewPP">
  288. <div class="people">
  289. <div class="people_top">
  290. <div class="people_top_right">
  291. <div class="people_search">
  292. <el-input placeholder="搜索老师姓名" v-model="searchTN" @keyup.enter.native="getClassStudent"></el-input>
  293. <div class="search_img" @click="getClassStudent">
  294. <img src="../../../assets/icon/search.png" alt />
  295. </div>
  296. </div>
  297. </div>
  298. <div class="people_nav">选择成员</div>
  299. </div>
  300. <div class="t_j_box" style="
  301. padding: 20px 0 0 25px;
  302. width: calc(100% - 55px);
  303. margin-left: 25px;
  304. ">
  305. <span>姓名</span>
  306. <span>账号</span>
  307. </div>
  308. <el-checkbox-group v-model="checkboxList3" class="people_name" v-if="teacherJuri.length" v-loading="isLoading2">
  309. <el-checkbox v-for="item in teacherJuri" :key="item.userid" :label="item.userid">
  310. <div class="t_j_box">
  311. <el-tooltip placement="top" :content="item.name ? item.name : '暂无姓名'">
  312. <span>{{ item.name ? item.name : "暂无姓名" }}</span>
  313. </el-tooltip>
  314. <el-tooltip placement="top" :content="item.username.split('@')[0]">
  315. <span>{{ item.username.split('@')[0] }}</span>
  316. </el-tooltip>
  317. </div>
  318. </el-checkbox>
  319. </el-checkbox-group>
  320. <div style="text-align: center; margin-top: 10px" v-else>暂无数据</div>
  321. </div>
  322. <div style="margin-top: 10px;">
  323. <el-pagination background layout="prev, pager, next" :page-size="pageSize3" :total="total3"
  324. v-if="page3 && teacherJuri.length" style="padding-bottom: 20px"
  325. @current-change="handleCurrentChange3"></el-pagination>
  326. </div>
  327. <span slot="footer" class="dialog-footer">
  328. <el-button @click="dialogVisibleMember = false">取 消</el-button>
  329. <el-button type="primary" @click="addClassStudent">确定</el-button>
  330. </span>
  331. </el-dialog>
  332. </div>
  333. </template>
  334. <script>
  335. import TaskListHeader from 'gantt-elastic/src/components/TaskList/TaskListHeader.vue';
  336. import backPage from "../liyuan/components/backPage.vue";
  337. export default {
  338. components: {backPage },
  339. data() {
  340. return {
  341. gotype:(window.topU && window.topU.gotype) ? window.topU.gotype : '',
  342. tableHeight: "500px",
  343. isLoading: false,
  344. formLabelWidth: "100px",
  345. sClassName: "",
  346. className: "",
  347. className1: "",
  348. classid: "",
  349. dialogVisible: false,
  350. dialogVisible1: false,
  351. dialogVisibleUpdate: false,
  352. dialogVisibleAddStudent: false,
  353. tableData: [],
  354. page: 1,
  355. total: 0,
  356. tableData2: [],
  357. page2: 1,
  358. total2: 0,
  359. userid: this.$route.query.userid,
  360. oid: this.$route.query.oid,
  361. cid: "",
  362. ctype: 1,
  363. sName: "",
  364. sPhone: "",
  365. sId: "",
  366. schoolName: "",
  367. sByClass: "",
  368. sMail: "",
  369. classJuri: [],
  370. userinfo: {},
  371. userinfoA: {},
  372. sPhoneUser: "",
  373. tx: require("../../../assets/avatar.png"),
  374. dialogVisibleMember: false,
  375. checkboxList3: [],
  376. teacherJuri: [],
  377. pageSize3: 10,
  378. total3: 0,
  379. page3: 1,
  380. isLoading2: false,
  381. searchTN: "",
  382. grade: [],
  383. gid: "",
  384. dialogVisibleGrade: false,
  385. options: [
  386. // {
  387. // typeId: 6,
  388. // label: '教研室'
  389. // }
  390. ],
  391. typeId: "",
  392. typeId2: ""
  393. };
  394. },
  395. created() {
  396. this.page = 1;
  397. this.getClass();
  398. this.getClass2();
  399. this.selectGrage()
  400. this.getSchoolName();
  401. this.getTeacherType();
  402. },
  403. computed: {
  404. getGrade() {
  405. return function (gid) {
  406. let name = ''
  407. this.grade.forEach(element => {
  408. if (element.id == gid) {
  409. name = element.name
  410. }
  411. });
  412. return name ? name : '暂无'
  413. }
  414. }
  415. },
  416. mounted() {
  417. this.$nextTick(function () {
  418. this.tableHeight =
  419. window.innerHeight - this.$refs.table.$el.offsetTop - 200;
  420. if (this.tableHeight <= 530) {
  421. this.tableHeight = 530;
  422. }
  423. // 监听窗口大小变化
  424. let self = this;
  425. window.onresize = function () {
  426. self.tableHeight =
  427. window.innerHeight - self.$refs.table.$el.offsetTop - 200;
  428. if (self.tableHeight <= 530) {
  429. self.tableHeight = 530;
  430. }
  431. };
  432. });
  433. },
  434. methods: {
  435. goTo(path) {
  436. this.$router.push(path);
  437. },
  438. //获取教研室列表
  439. selectGrage() {
  440. let params = {
  441. oid: this.oid,
  442. };
  443. this.ajax
  444. .get(this.$store.state.api + "selectTeacherOfficeBySchool", params)
  445. .then((res) => {
  446. this.grade = res.data[0];
  447. })
  448. .catch((err) => {
  449. console.error(err);
  450. });
  451. },
  452. //获取教研室分类列表
  453. getTeacherType() {
  454. let params = {
  455. cu: '',
  456. oid: this.oid,
  457. cn: '',
  458. pid: '10'
  459. };
  460. this.ajax
  461. .get(this.$store.state.api + "selectTeacherOfficeType", params)
  462. .then((res) => {
  463. this.options = res.data[0];
  464. this.options.push(
  465. {
  466. id: '6',
  467. name:'教研室'
  468. }
  469. )
  470. })
  471. .catch((err) => {
  472. console.error(err);
  473. });
  474. },
  475. tableRowClassName({ row, rowIndex }) {
  476. if ((rowIndex + 1) % 2 === 0) {
  477. return "even_row";
  478. } else {
  479. return "";
  480. }
  481. },
  482. handleCurrentChange(val) {
  483. this.page = val;
  484. this.getClass();
  485. },
  486. handleClose(done) {
  487. this.typeId = ''
  488. done();
  489. },
  490. handleCancel() {
  491. this.dialogVisible = false;
  492. this.typeId = ''; // 清空下拉菜单的值
  493. },
  494. time() {
  495. if (!this.now) {
  496. this.now = new Date().getTime();
  497. return true;
  498. } else {
  499. let time = new Date().getTime();
  500. if (time - this.now > 3000) {
  501. this.now = time;
  502. return true;
  503. } else {
  504. return false;
  505. }
  506. }
  507. },
  508. searchClass() {
  509. this.page = 1;
  510. this.getClass();
  511. },
  512. updateG(gid, id) {
  513. this.gid = gid;
  514. this.classid = id;
  515. this.dialogVisibleGrade = true;
  516. },
  517. updateGrade() {
  518. this.$confirm("确定修改吗?", "提示", {
  519. confirmButtonText: "确定",
  520. cancelButtonText: "取消",
  521. type: "warning",
  522. })
  523. .then(() => {
  524. let params = [{
  525. cid: this.gid,
  526. student: JSON.stringify([this.classid])
  527. }];
  528. this.ajax
  529. .post(this.$store.state.api + "addGradeClass", params)
  530. .then((res) => {
  531. this.gid = '';
  532. this.classid = '';
  533. this.dialogVisibleGrade = false
  534. this.getClass();
  535. })
  536. .catch((err) => {
  537. console.error(err);
  538. });
  539. })
  540. .catch(() => { });
  541. },
  542. openUpdate(id, n, t) {
  543. this.classid = id;
  544. this.className1 = n;
  545. this.typeId2 = t;
  546. this.getTeacherType();
  547. this.dialogVisible1 = true;
  548. },
  549. //新增教研室
  550. insertClass() {
  551. // 检查是否选择了教研室类型
  552. if (this.typeId == "") {
  553. this.$message({
  554. message: "请选择教研室类型",
  555. type: "warning",
  556. });
  557. return; // 停止继续执行
  558. }
  559. let params = [{
  560. name: this.className,
  561. oid: this.oid,
  562. uid: this.userid,
  563. pid: this.typeId,
  564. }];
  565. this.ajax
  566. .post(this.$store.state.api + "insertTeacherOfficeCopy", params)
  567. .then((res) => {
  568. if (res.data[0] && res.data[0][0].classname == 1) {
  569. this.$message({
  570. message: "不能与其他教研室名称相同!",
  571. type: "error",
  572. });
  573. } else {
  574. this.$message({
  575. message: "新增成功",
  576. type: "success",
  577. });
  578. this.dialogVisible = false;
  579. this.sClassName = "";
  580. this.getClass();
  581. this.className = "";
  582. }
  583. })
  584. .catch((err) => {
  585. this.$message({
  586. message: "新增失败",
  587. type: "error",
  588. });
  589. console.error(err);
  590. });
  591. },
  592. openAddTeacher(){
  593. this.typeId = '6'
  594. this.getTeacherType();
  595. this.dialogVisible = true
  596. },
  597. //修改教研室
  598. updateClass() {
  599. let params = {
  600. id: this.classid,
  601. n: this.className1,
  602. oid: this.oid,
  603. pid: this.typeId2,
  604. };
  605. this.ajax
  606. .get(this.$store.state.api + "updateTeacherOffice2", params)
  607. .then((res) => {
  608. if (res.data[0] && res.data[0][0].classname == 1) {
  609. this.$message({
  610. message: "不能与其他教研室名称相同!",
  611. type: "error",
  612. });
  613. } else {
  614. this.$message({
  615. message: "修改成功",
  616. type: "success",
  617. });
  618. this.dialogVisible1 = false;
  619. this.getClass();
  620. this.classid = "";
  621. this.className1 = "";
  622. }
  623. })
  624. .catch((err) => {
  625. this.$message({
  626. message: "修改失败",
  627. type: "error",
  628. });
  629. console.error(err);
  630. });
  631. },
  632. //获取教研室列表
  633. getClass() {
  634. this.isLoading = true;
  635. let params = {
  636. // username: this.$store.state.userInfo.userid,
  637. cu: "",
  638. oid: this.oid,
  639. cn: this.sClassName,
  640. pid: "6",
  641. page: this.page,
  642. };
  643. this.ajax
  644. .get(this.$store.state.api + "selectTeacherOffice2", params)
  645. .then((res) => {
  646. this.isLoading = false;
  647. this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
  648. this.tableData = res.data[0];
  649. console.log(this.tableData, "tableData");
  650. this.selectGrage()
  651. })
  652. .catch((err) => {
  653. this.isLoading = false;
  654. console.error(err);
  655. });
  656. },
  657. //删除教研室
  658. deleteClass(id) {
  659. let params = {
  660. id: id,
  661. };
  662. if (this.time()) {
  663. this.$confirm("确定删除此教研室吗?", "提示", {
  664. confirmButtonText: "确定",
  665. cancelButtonText: "取消",
  666. type: "warning",
  667. })
  668. .then(() => {
  669. this.ajax
  670. .get(this.$store.state.api + "deleteClass", params)
  671. .then((res) => {
  672. this.$message({
  673. message: "删除成功",
  674. type: "success",
  675. });
  676. if (this.page != 1 && this.tableData.length == 1) {
  677. this.page - 1;
  678. }
  679. this.getClass();
  680. })
  681. .catch((err) => {
  682. this.$message.error("删除失败");
  683. console.error(err);
  684. });
  685. })
  686. .catch(() => { });
  687. }
  688. },
  689. addStudent() {
  690. // this.dialogVisibleAddStudent = true;
  691. // (this.sName = ""), (this.sPhone = ""), (this.sByClass = ""), this.sMail;
  692. // this.getClass2();
  693. this.dialogVisibleMember = true
  694. this.searchTN = ""
  695. this.getClassStudent();
  696. },
  697. //新增老师
  698. insertStudent() {
  699. if (this.sName === "") {
  700. this.$message.error("老师姓名不能为空");
  701. return;
  702. } else if (
  703. this.sPhone != "" &&
  704. !/^[1][3,4,5,7,8][0-9]{9}$/.test(this.sPhone)
  705. ) {
  706. this.$message.error("手机号格式不正确");
  707. return;
  708. } else if (
  709. !/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(this.sMail)
  710. ) {
  711. this.$message.error("邮箱格式不正确");
  712. return;
  713. }
  714. if (this.time()) {
  715. let params = { un: this.sMail };
  716. this.ajax
  717. .get(this.$store.state.api + "findMail", params)
  718. .then((res) => {
  719. if (res.data[0].length > 0) {
  720. this.$message.error("此老师账号已被注册");
  721. } else {
  722. this.add_Student();
  723. }
  724. })
  725. .catch((err) => {
  726. console.error(err);
  727. });
  728. }
  729. },
  730. add_Student() {
  731. let params = [
  732. {
  733. username: this.sMail,
  734. password: '',
  735. alias: this.sName,
  736. oid: this.oid,
  737. ph: this.sPhone,
  738. sid: this.sId,
  739. cid: this.cid,
  740. },
  741. ];
  742. this.ajax
  743. .post(this.$store.state.api + "batchRegistration", params)
  744. .then((res) => {
  745. let params = [
  746. {
  747. userid: res.data.uid,
  748. username: this.sName,
  749. sid: this.sId,
  750. type: 2,
  751. oid: res.data.oid,
  752. phone: res.data.ph,
  753. cid: res.data.cid,
  754. intro: "",
  755. sex: "0",
  756. },
  757. ];
  758. this.ajax
  759. .post(this.$store.state.api + "updateUserByEdu", params)
  760. .then((res) => {
  761. console.log(res);
  762. })
  763. .catch((err) => {
  764. console.error(err);
  765. });
  766. this.$message({
  767. message: "新增成功",
  768. type: "success",
  769. });
  770. this.dialogVisibleAddStudent = false;
  771. this.sPhone = "";
  772. this.sName = "";
  773. this.sByClass = [];
  774. this.sMail = "";
  775. this.getStudent(this.cid);
  776. })
  777. .catch((err) => {
  778. this.isLoading = false;
  779. this.$message({
  780. message: "新增失败",
  781. type: "error",
  782. });
  783. console.error(err);
  784. });
  785. },
  786. updateStudentA(res) {
  787. this.userinfo = JSON.parse(JSON.stringify(res));
  788. this.userinfoA = JSON.parse(JSON.stringify(res));
  789. this.userinfo.classid = this.userinfo.classid.split(",")
  790. this.dialogVisibleUpdate = true;
  791. },
  792. updateStudent() {
  793. if (this.userinfo.name === "") {
  794. this.$message.error("老师姓名不能为空");
  795. return;
  796. } else if (!this.userinfo.classid) {
  797. this.$message.error("请为老师选择教研室");
  798. return;
  799. } else if (
  800. this.userinfo.phonenumber &&
  801. !/^[1][3,4,5,7,8][0-9]{9}$/.test(this.userinfo.phonenumber)
  802. ) {
  803. this.$message.error("手机号格式不正确");
  804. return;
  805. } else if (
  806. !/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(
  807. this.userinfo.un
  808. )
  809. ) {
  810. this.$message.error("邮箱格式不正确");
  811. return;
  812. }
  813. if (this.time()) {
  814. if (this.userinfoA.un != this.userinfo.un) {
  815. let params = { un: this.userinfo.un };
  816. this.ajax
  817. .get(this.$store.state.api + "findMail", params)
  818. .then((res) => {
  819. if (res.data[0].length > 0) {
  820. this.$message.error("此老师账号已被注册");
  821. } else {
  822. this.update_Student();
  823. }
  824. })
  825. .catch((err) => {
  826. console.error(err);
  827. });
  828. } else {
  829. this.update_Student();
  830. }
  831. }
  832. },
  833. update_Student() {
  834. let params = [
  835. {
  836. userid: this.userinfo.userid,
  837. username: this.userinfo.un,
  838. alias: this.userinfo.name,
  839. ph: this.userinfo.phonenumber,
  840. sid: this.userinfo.studentid,
  841. cid: this.userinfo.classid.join(","),
  842. },
  843. ];
  844. this.ajax
  845. .post(this.$store.state.api + "updateStudentInfo", params)
  846. .then((res) => {
  847. this.$message({
  848. message: "修改成功",
  849. type: "success",
  850. });
  851. this.dialogVisibleUpdate = false;
  852. this.getStudent(this.cid);
  853. })
  854. .catch((err) => {
  855. this.isLoading = false;
  856. this.$message({
  857. message: "修改失败",
  858. type: "error",
  859. });
  860. console.error(err);
  861. });
  862. },
  863. deleteClassStudent(id) {
  864. let params = [{ uid: id, cid: this.cid }];
  865. this.$confirm("确定在本教研室移除此老师吗?", "提示", {
  866. confirmButtonText: "确定",
  867. cancelButtonText: "取消",
  868. type: "warning",
  869. })
  870. .then(() => {
  871. this.ajax
  872. .post(this.$store.state.api + "deleteClassTeacher", params)
  873. .then((res) => {
  874. this.$message({
  875. message: "操作成功",
  876. type: "success",
  877. });
  878. this.getStudent(this.cid);
  879. })
  880. .catch((err) => {
  881. this.$message.error("操作失败");
  882. console.error(err);
  883. });
  884. })
  885. .catch(() => { });
  886. },
  887. //获取教研室列表
  888. getClass2() {
  889. let params = {
  890. oid: this.oid,
  891. };
  892. this.ajax
  893. .get(this.$store.state.api + "selectTeacherOfficeBySchool", params)
  894. .then((res) => {
  895. this.classJuri = res.data[0];
  896. })
  897. .catch((err) => {
  898. console.error(err);
  899. });
  900. },
  901. getSchoolName() {
  902. let params = {
  903. oid: this.oid,
  904. };
  905. this.ajax
  906. .get(this.$store.state.api + "selectSchoolName2", params)
  907. .then((res) => {
  908. this.schoolName = res.data[0][0].name;
  909. })
  910. .catch((err) => {
  911. console.error(err);
  912. });
  913. },
  914. searchStudent() {
  915. this.page2 = 1;
  916. this.getStudent(this.cid);
  917. },
  918. handleCurrentChange2(val) {
  919. this.page2 = val;
  920. this.getStudent(this.cid);
  921. },
  922. handleCurrentChange3(val) {
  923. this.page3 = val;
  924. this.getClassStudent();
  925. },
  926. getStudent(cid) {
  927. this.cid = cid
  928. this.ctype = 2
  929. this.isLoading = true;
  930. let params = {
  931. oid: this.oid,
  932. cid: this.cid,
  933. cu: "",
  934. cn: this.sPhoneUser,
  935. page: this.page2,
  936. };
  937. this.ajax
  938. .get(this.$store.state.api + "selectTeacher2", params)
  939. .then((res) => {
  940. this.isLoading = false;
  941. this.total2 = res.data[0].length > 0 ? res.data[0][0].num : 0;
  942. this.tableData2 = res.data[0];
  943. this.getClass2();
  944. })
  945. .catch((err) => {
  946. this.isLoading = false;
  947. console.error(err);
  948. });
  949. },
  950. getClassStudent() {
  951. this.isLoading2 = true;
  952. let params = {
  953. oid: this.oid,
  954. cid: this.cid,
  955. cn: this.searchTN,
  956. page: this.page3,
  957. num: this.pageSize3,
  958. };
  959. this.ajax
  960. .get(this.$store.state.api + "getClassTeacher", params)
  961. .then((res) => {
  962. this.isLoading2 = false;
  963. this.total3 = res.data[0].length > 0 ? res.data[0][0].num : 0;
  964. this.teacherJuri = res.data[0];
  965. })
  966. .catch((err) => {
  967. this.isLoading2 = false;
  968. console.error(err);
  969. });
  970. },
  971. addClassStudent() {
  972. if (!this.checkboxList3.length) {
  973. this.$message.error('请选择要添加教研室的老师');
  974. return;
  975. }
  976. let params = [{
  977. cid: this.cid,
  978. student: JSON.stringify(this.checkboxList3)
  979. }];
  980. this.ajax
  981. .post(this.$store.state.api + "addClassTeacher", params)
  982. .then((res) => {
  983. this.$message.success("添加成功")
  984. this.checkboxList3 = []
  985. this.dialogVisibleMember = false
  986. this.getStudent(this.cid)
  987. })
  988. .catch((err) => {
  989. console.error(err);
  990. });
  991. },
  992. iniPassword(id) {
  993. this.$confirm("确定" + "初始化" + "此老师的密码吗?", "提示", {
  994. confirmButtonText: "确定",
  995. cancelButtonText: "取消",
  996. type: "warning",
  997. })
  998. .then(() => {
  999. let params = [
  1000. {
  1001. uid: id,
  1002. pa: '',
  1003. },
  1004. ];
  1005. this.ajax
  1006. .post(this.$store.state.api + "iniPassword", params)
  1007. .then((res) => {
  1008. this.$message({
  1009. message: "初始化密码成功!",
  1010. type: "success",
  1011. });
  1012. })
  1013. .catch((err) => {
  1014. console.error(err);
  1015. });
  1016. })
  1017. .catch(() => { });
  1018. },
  1019. },
  1020. };
  1021. </script>
  1022. <style scoped>
  1023. .dialog_diy>>>.el-dialog__header {
  1024. background: #3d67bc !important;
  1025. padding: 15px 20px;
  1026. }
  1027. .dialog_diy>>>.el-dialog__title {
  1028. color: #fff;
  1029. }
  1030. .student_table>>>.el-table--border td {
  1031. border-right: 0px !important;
  1032. }
  1033. .dialog_diy>>>.el-dialog__headerbtn {
  1034. top: 19px;
  1035. }
  1036. .dialog_diy>>>.el-dialog__headerbtn .el-dialog__close {
  1037. color: #fff;
  1038. }
  1039. .dialog_diy>>>.el-dialog__headerbtn .el-dialog__close:hover {
  1040. color: #fff;
  1041. }
  1042. .student_head>>>.el-button--primary {
  1043. background-color: #2268bc;
  1044. }
  1045. .xls_button {
  1046. font-size: 14px;
  1047. cursor: pointer;
  1048. text-decoration: underline;
  1049. color: rgb(34, 104, 188);
  1050. }
  1051. .pb_head {
  1052. margin: 0 !important;
  1053. width: 100% !important;
  1054. }
  1055. .student_page {
  1056. margin-top: 10px;
  1057. }
  1058. .student_head {
  1059. margin-top: 10px;
  1060. padding-bottom: 15px;
  1061. display: flex;
  1062. justify-content: space-between;
  1063. }
  1064. .student_search {
  1065. display: flex;
  1066. width: 300px;
  1067. }
  1068. .student_search span {
  1069. margin: 0 10px 0 0;
  1070. }
  1071. .student_button {
  1072. display: flex;
  1073. height: 40px;
  1074. }
  1075. .student_button .el-button--primary {
  1076. /* margin-right: 10px; */
  1077. }
  1078. .upload-demo {
  1079. display: flex;
  1080. flex-direction: column;
  1081. align-items: end;
  1082. /* position: relative; */
  1083. width: 100px;
  1084. overflow: hidden;
  1085. }
  1086. .student_table {
  1087. margin: 20px 0;
  1088. }
  1089. .el-table>>>.even_row {
  1090. background-color: #f1f1f1;
  1091. }
  1092. .top {
  1093. display: flex;
  1094. justify-content: space-between;
  1095. }
  1096. .bgColor {
  1097. background: #2167bc;
  1098. }
  1099. .student_table>>>.el-table,
  1100. .student_table>>>.el-table__body-wrapper {
  1101. height: auto !important;
  1102. }
  1103. .student_head {
  1104. margin-top: 10px;
  1105. padding-bottom: 10px;
  1106. display: flex;
  1107. justify-content: space-between;
  1108. }
  1109. .head_left {
  1110. display: flex;
  1111. align-items: center;
  1112. }
  1113. .head_right {
  1114. display: flex;
  1115. flex-direction: row;
  1116. flex-wrap: nowrap;
  1117. align-items: baseline;
  1118. }
  1119. .student_input>>>.el-input__inner {
  1120. width: 190px;
  1121. font-size: 13px;
  1122. padding: 0 10px;
  1123. }
  1124. .student_button {
  1125. color: #fff;
  1126. background: #2268bc;
  1127. }
  1128. .head_right>button:nth-child(1) {
  1129. color: #fff;
  1130. background: #2268bc;
  1131. }
  1132. .head_right>div {
  1133. line-height: 40px;
  1134. margin-left: 10px;
  1135. color: #2a6dbe;
  1136. text-decoration: underline;
  1137. cursor: pointer;
  1138. }
  1139. .userImg {
  1140. display: flex;
  1141. flex-direction: row;
  1142. justify-content: center;
  1143. align-items: center;
  1144. }
  1145. .tx {
  1146. width: 40px;
  1147. margin-right: 10px;
  1148. }
  1149. .delete {
  1150. width: 25px;
  1151. height: 25px;
  1152. cursor: pointer;
  1153. margin-left: 10px;
  1154. }
  1155. .tx>img,
  1156. .delete>img {
  1157. width: 100%;
  1158. height: 100%;
  1159. }
  1160. .btnBox {
  1161. display: flex;
  1162. align-items: center;
  1163. }
  1164. .add_student>>>.el-dialog__header {
  1165. padding: 20px 20px 10px;
  1166. text-align: center;
  1167. background: #32455b;
  1168. }
  1169. .add_student>>>.el-dialog__title {
  1170. font-size: 14px !important;
  1171. color: #fff !important;
  1172. }
  1173. .add_student>>>.el-dialog__headerbtn {
  1174. font-size: 20px !important;
  1175. }
  1176. .add_student>>>.el-form-item__label {
  1177. margin-left: 65px;
  1178. }
  1179. .add_student>>>.el-form-item {
  1180. display: flex;
  1181. }
  1182. .add_student>>>.el-form-item__content {
  1183. margin: 0 !important;
  1184. }
  1185. .add_input {
  1186. width: 365px;
  1187. }
  1188. .add_student>>>.el-dialog__footer {
  1189. text-align: center !important;
  1190. }
  1191. .right {
  1192. width: 250px;
  1193. color: #fff;
  1194. background: #0e72e6;
  1195. margin-bottom: 20px;
  1196. }
  1197. .header-title {
  1198. display: flex;
  1199. }
  1200. .logoImg {
  1201. width: 30px;
  1202. }
  1203. .logoImg>img {
  1204. width: 100%;
  1205. height: 100%;
  1206. }
  1207. .title_add_student {
  1208. margin: 0 auto;
  1209. color: #fff;
  1210. }
  1211. .upload-demo {
  1212. line-height: 0px !important;
  1213. }
  1214. .upload-demo>>>.el-button {
  1215. color: #fff;
  1216. background: #2268bc;
  1217. width: 70px;
  1218. height: 30px;
  1219. padding: 0 !important;
  1220. font-size: 12px;
  1221. line-height: 0 !important;
  1222. }
  1223. .people {
  1224. border: 1px solid rgb(229 229 229);
  1225. height: 495px;
  1226. border-radius: 5px;
  1227. width: 100%;
  1228. overflow: auto;
  1229. }
  1230. .people_top {
  1231. display: flex;
  1232. width: 100%;
  1233. /* justify-content: space-between; */
  1234. /* align-items: center; */
  1235. flex-direction: column;
  1236. padding: 10px 25px 0;
  1237. box-sizing: border-box;
  1238. }
  1239. .people_nav,
  1240. .people_top_right {
  1241. /* padding: 20px 0 0 20px; */
  1242. }
  1243. .people_top_right {
  1244. height: 40px;
  1245. margin-bottom: 10px;
  1246. }
  1247. .people_search {
  1248. display: flex;
  1249. position: relative;
  1250. }
  1251. .people_search>>>.el-input__inner {
  1252. /* height: 25px; */
  1253. width: 95%;
  1254. }
  1255. .search_img {
  1256. width: 20px;
  1257. height: 20px;
  1258. position: absolute;
  1259. right: 30px;
  1260. top: 50%;
  1261. transform: translateY(-50%);
  1262. }
  1263. .search_img>img {
  1264. width: 100%;
  1265. height: 100%;
  1266. }
  1267. .people_name {
  1268. display: flex;
  1269. justify-content: flex-start;
  1270. padding: 10px 0 0 25px;
  1271. flex-direction: column;
  1272. flex-wrap: nowrap;
  1273. height: calc(100% - 140px);
  1274. overflow-y: auto;
  1275. overflow-x: hidden;
  1276. flex-direction: column;
  1277. }
  1278. .people_name>>>.el-checkbox {
  1279. width: 100%;
  1280. display: flex;
  1281. align-items: center;
  1282. margin-bottom: 10px;
  1283. }
  1284. .people_name>>>.el-checkbox__label {
  1285. text-overflow: ellipsis;
  1286. overflow: hidden;
  1287. width: 100%;
  1288. }
  1289. .addNewPP>>>.el-dialog__body {
  1290. padding: 5px 20px;
  1291. }
  1292. .t_j_box {
  1293. display: flex;
  1294. }
  1295. .t_j_box span:nth-child(1) {
  1296. width: 50%;
  1297. overflow: hidden;
  1298. margin-right: 10px;
  1299. text-overflow: ellipsis;
  1300. white-space: nowrap;
  1301. }
  1302. .t_j_box span:nth-child(2) {
  1303. width: 50%;
  1304. overflow: hidden;
  1305. margin-right: 10px;
  1306. text-overflow: ellipsis;
  1307. white-space: nowrap;
  1308. }
  1309. .sub_head {
  1310. position: relative;
  1311. }
  1312. .sub_head::after {
  1313. content: "";
  1314. width: 100%;
  1315. background: #5a9cea;
  1316. height: 2px;
  1317. position: absolute;
  1318. left: 0;
  1319. bottom: -10px;
  1320. }
  1321. .subClick {
  1322. /* font-size: 16px; */
  1323. font-size: 26px;
  1324. cursor: pointer;
  1325. margin-left: 17.5px;
  1326. /* color: #ab582f; */
  1327. /* color: #409eff; */
  1328. color: #999;
  1329. }
  1330. .subClick:hover {
  1331. color: #000;
  1332. }
  1333. </style>