addPageOne.vue 64 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796
  1. <!--教职工管理新增/编辑(针对空军四医大项目 去除了检查者相关字段)-->
  2. <template>
  3. <div class="teacher-add-page">
  4. <div class="public-form-box scrollbar-box">
  5. <div class="top-title-box">
  6. <p>{{titleName}}</p>
  7. <p @click="outPageButton">返回</p>
  8. </div>
  9. <el-form :model="form" class="top-info-box" ref="form" :inline="true" :rules="rules" label-width="120px">
  10. <div class="left-info-box">
  11. <img :src="form.avatar" v-if="form.avatar">
  12. <img src="@/assets/ZDimages/tx_cion.png" v-if="!form.avatar">
  13. <el-upload
  14. v-if="!editType"
  15. class="certificate-avatar-uploader"
  16. :action="uploadImgUrl"
  17. :show-file-list="false"
  18. accept="image/jpeg,image/gif,image/png"
  19. :on-success="handleAvatarSuccess"
  20. :headers="headers"
  21. :before-upload="beforeAvatarUpload">
  22. <p>上传证件照</p>
  23. </el-upload>
  24. </div>
  25. <div class="right-info-box">
  26. <el-form-item label="姓名:" prop="nickName">
  27. <el-input
  28. :disabled="editType"
  29. style="width:218px;"
  30. maxlength="10"
  31. v-model="form.nickName"
  32. placeholder="请输入名称"
  33. clearable
  34. size="small"
  35. />
  36. </el-form-item>
  37. <el-form-item label="性别:" prop="sex">
  38. <el-radio-group v-model="form.sex" v-if="!editType">
  39. <el-radio :label="0" style="margin-left:20px;width:70px;">男</el-radio>
  40. <el-radio :label="1">女</el-radio>
  41. </el-radio-group>
  42. <p v-if="editType" style="line-height:40px;color:#999;width:180px;padding-left:40px;">{{form.sex==0?'男':'女'}}</p>
  43. </el-form-item>
  44. <el-form-item label="工号:" prop="userName">
  45. <el-input
  46. style="width:218px;"
  47. :disabled="editType"
  48. maxlength="50"
  49. v-model="form.userName"
  50. placeholder="请输入工号"
  51. clearable
  52. size="small"
  53. />
  54. </el-form-item>
  55. <el-form-item label="所在部门:" prop="deptId">
  56. <el-cascader
  57. :disabled="editType"
  58. :show-all-levels="false"
  59. v-model="form.deptId"
  60. :options="deptOptions"
  61. :props="{ checkStrictly: true, value: 'id', label: 'label',emitPath:false }"></el-cascader>
  62. </el-form-item>
  63. <el-form-item label="身份:" prop="position">
  64. <el-select
  65. :disabled="editType"
  66. v-model="form.position"
  67. filterable
  68. remote
  69. clearable
  70. reserve-keyword
  71. @change="positionSelectClick"
  72. @clear="positionClearClick"
  73. placeholder="请选择身份"
  74. :remote-method="positionSelect">
  75. <el-option
  76. v-for="item in positionOptions"
  77. :key="item.postId"
  78. :label="item.postName"
  79. :value="item.postId">
  80. </el-option>
  81. </el-select>
  82. </el-form-item>
  83. <el-form-item label="手机号码:" prop="phonenumber">
  84. <el-input
  85. :disabled="editType"
  86. style="width:218px;"
  87. maxlength="25"
  88. onkeyup="this.value=this.value.replace(/[^\d.]/g,'')"
  89. v-model="form.phonenumber"
  90. placeholder="请输入手机号码"
  91. clearable
  92. size="small"
  93. />
  94. </el-form-item>
  95. <el-form-item label="职称:" prop="category">
  96. <el-select
  97. :disabled="editType"
  98. v-model="form.category"
  99. filterable
  100. remote
  101. clearable
  102. reserve-keyword
  103. @change="categorySelectClick"
  104. @clear="categoryClearClick"
  105. placeholder="请选择身份"
  106. :remote-method="categorySelect">
  107. <el-option
  108. v-for="item in categoryOptions"
  109. :key="item.dictValue"
  110. :label="item.dictLabel"
  111. :value="item.dictValue">
  112. </el-option>
  113. </el-select>
  114. </el-form-item>
  115. <el-form-item label="邮箱:" prop="email">
  116. <el-input
  117. :disabled="editType"
  118. style="width:218px;"
  119. maxlength="40"
  120. v-model="form.email"
  121. placeholder="请输入邮箱"
  122. clearable
  123. size="small"
  124. />
  125. </el-form-item>
  126. <el-form-item label="校园卡号:" prop="cardNum">
  127. <el-input
  128. :disabled="editType"
  129. style="width:218px;"
  130. onkeyup="this.value=this.value.replace(/[^\d.]/g,'')"
  131. maxlength="50"
  132. v-model="form.cardNum"
  133. placeholder="请输入校园卡号"
  134. clearable
  135. size="small"
  136. />
  137. </el-form-item>
  138. <el-form-item label="文化程度:" prop="education">
  139. <el-select
  140. :disabled="editType"
  141. v-model="form.education"
  142. filterable
  143. remote
  144. clearable
  145. reserve-keyword
  146. @change="educationSelectClick"
  147. @clear="educationClearClick"
  148. placeholder="请选择身份"
  149. :remote-method="educationSelect">
  150. <el-option
  151. v-for="item in educationOptions"
  152. :key="item.dictValue"
  153. :label="item.dictLabel"
  154. :value="item.dictValue">
  155. </el-option>
  156. </el-select>
  157. </el-form-item>
  158. <el-form-item label="出生日期:" prop="dateBirth">
  159. <el-date-picker
  160. :disabled="editType"
  161. v-model="form.dateBirth"
  162. type="date"
  163. placeholder="请选择出生日期">
  164. </el-date-picker>
  165. </el-form-item>
  166. <el-form-item label="在职状态:" prop="nature">
  167. <el-switch
  168. v-if="!editType"
  169. @click.native="natureCaptcha"
  170. class="switch captcha-img"
  171. active-value="0"
  172. inactive-value="1"
  173. active-color="#29B24D"
  174. inactive-color="#999"
  175. v-model="form.nature"
  176. active-text="在职"
  177. inactive-text="离职"
  178. disabled
  179. ></el-switch>
  180. <p v-if="editType" style="line-height:40px;color:#999;width:180px;padding-left:40px;">{{form.nature==0?'在职':'离职'}}</p>
  181. </el-form-item>
  182. <!--<el-form-item label="安全检查人员:" prop="isCheck">-->
  183. <!--<el-switch-->
  184. <!--v-if="!editType"-->
  185. <!--@click.native="isCheckCaptcha"-->
  186. <!--class="switch captcha-img"-->
  187. <!--:active-value="1"-->
  188. <!--:inactive-value="0"-->
  189. <!--active-color="#0183FA"-->
  190. <!--inactive-color="#999"-->
  191. <!--v-model="form.isCheck"-->
  192. <!--active-text="是"-->
  193. <!--inactive-text="否"-->
  194. <!--disabled-->
  195. <!--&gt;</el-switch>-->
  196. <!--<p v-if="editType" style="line-height:40px;color:#999;width:180px;padding-left:40px;">{{form.isCheck==0?'否':'是'}}</p>-->
  197. <!--</el-form-item>-->
  198. <el-form-item label="账号状态:" prop="status" v-if="form.nature == 0">
  199. <el-switch
  200. v-if="!editType"
  201. @click.native="statusCaptcha"
  202. class="switch captcha-img"
  203. active-value="0"
  204. inactive-value="1"
  205. active-color="#0183FA"
  206. inactive-color="#999"
  207. v-model="form.status"
  208. active-text="启用"
  209. inactive-text="停用"
  210. disabled
  211. ></el-switch>
  212. <p v-if="editType" style="line-height:40px;color:#999;width:180px;padding-left:40px;">{{form.status==0?'启用':'停用'}}</p>
  213. </el-form-item>
  214. </div>
  215. </el-form>
  216. <div class="top-title-one" v-if="!editType && form.status == 0">
  217. <p class="title-p">权限配置</p>
  218. <p class="el-icon-question img-p" @mouseenter="showText" @mouseout="hideText"></p>
  219. <div class="position-box" v-if="textType">
  220. <p>1、权限快捷模板:列出所有已创建的快捷模板,可选择快捷导入模板;导入后可修改或清空。</p>
  221. <p>2、模块菜单:选中父级,联动子级全部选中,可对子级单独勾选;子级选中,父级联动选中。</p>
  222. <p>3、数据范围:数据查看范围选择,默认展示所有数据。</p>
  223. <p>4、管理权限:功能操作权限,包含增删改查、启用、停用,以及导出等操作功能。</p>
  224. <p>5、详细配置:对底层菜单的功能操作进行细分权限勾选,功能操作按所属菜单页面现有的功能操作进行展示,可单选、全选。</p>
  225. </div>
  226. </div>
  227. <div class="for-button-list" v-if="!editType && form.status == 0">
  228. <p class="for-title-p">权限快捷模板:</p>
  229. <div class="for-button-max-box">
  230. <div class="for-button-min-box" v-for="(item,index) in templateList" :key="index"
  231. :class="templateKey == item.id?'colorAA':'colorBB'" @click="templateClick(item.id)">
  232. <i class="el-icon-success" v-if="templateKey == item.id"></i>
  233. <span>{{item.name}}</span>
  234. </div>
  235. </div>
  236. </div>
  237. <div class="template-name-box" v-if="!editType && form.status == 0">
  238. <p class="template-name-p">当前导入模板:{{templateName?templateName:'无'}}</p>
  239. <p class="reset-button-one template-name-button" @click="templateDel">清除</p>
  240. <p class="template-name-button-one" @click="importUser">导入其他账号权限</p>
  241. </div>
  242. <div class="table-for-max-box" v-if="!editType && form.status == 0">
  243. <div class="table-title-box">
  244. <p>模块菜单</p>
  245. <p>权限</p>
  246. </div>
  247. <div class="table-for-big-box" v-for="(maxItem,maxIndex) in menuList" :key="maxIndex">
  248. <div class="max-title-box" :class="!maxItem.children?'max-title-box-null':''">
  249. <p><el-checkbox :disabled="maxItem.isRequired == 1" v-model="maxItem.checkType" @change="(type)=>itemCheckClick(1,type,maxItem)">{{maxItem.menuName}}</el-checkbox></p>
  250. </div>
  251. <div class="max-right-box">
  252. <div class="big-box" v-for="(bigItem,bigIndex) in maxItem.children" :key="bigIndex">
  253. <div class="big-title-box" :class="bigItem.menuType == 'C'?'big-title-box-null':''">
  254. <p><el-checkbox :disabled="bigItem.isRequired == 1" v-model="bigItem.checkType" @change="(type)=>itemCheckClick(2,type,bigItem,maxItem)">{{bigItem.menuName}}</el-checkbox></p>
  255. </div>
  256. <div class="big-right-box" v-if="bigItem.menuType !='C'">
  257. <div class="min-box" v-for="(minItem,minIndex) in bigItem.children" :key="minIndex">
  258. <div class="min-title-box">
  259. <p><el-checkbox :disabled="minItem.isRequired == 1" v-model="minItem.checkType" @change="(type)=>itemCheckClick(3,type,minItem,bigItem,maxItem)">{{minItem.menuName}}</el-checkbox></p>
  260. </div>
  261. <div class="min-right-box" v-if="minItem.checkType">
  262. <div class="scope-box">
  263. <p>
  264. <el-checkbox v-model="minItem.scopeCheckType" @change="(type)=>itemCheckClick(4,type,minItem)" style="margin-right:40px;">数据范围</el-checkbox>
  265. <el-select v-model="minItem.dataScope" :disabled="!minItem.scopeCheckType" v-if="minItem.isRequired == 1"
  266. placeholder="请选择1" @visible-change="(type)=>visibleChange(type,minItem,maxIndex,bigIndex,minIndex)">
  267. <el-option v-for="dist in optionsDataListOne" :key="dist.type" :label="dist.value" :value="dist.type" @click.native="(type)=>optionChange(dist.type,minItem,maxIndex,bigIndex,minIndex)"></el-option>
  268. </el-select>
  269. <el-select v-model="minItem.dataScope" :disabled="!minItem.scopeCheckType" v-if="minItem.isRequired != 1"
  270. placeholder="请选择" @visible-change="(type)=>visibleChange(type,minItem,maxIndex,bigIndex,minIndex)">
  271. <el-option v-for="dist in optionsDataList" :key="dist.type" :label="dist.value" :value="dist.type" @click.native="(type)=>optionChange(dist.type,minItem,maxIndex,bigIndex,minIndex)"></el-option>
  272. </el-select>
  273. </p>
  274. </div>
  275. <div class="permission-box" v-if="minItem.children">
  276. <p class="check-left-p"><el-checkbox v-model="minItem.permissionCheckType" @change="(type)=>itemCheckClick(5,type,minItem)">管理权限</el-checkbox></p>
  277. <div class="check-button-box" @click="permissionDetails(minItem,maxIndex,bigIndex,minIndex)"
  278. :class="minItem.permissionCheckType?'check-button-box-colorA':'check-button-box-colorB'">
  279. <img v-if="!minItem.permissionCheckType" src="@/assets/ZDimages/personnelManagement/icon_xzqx_zc.png">
  280. <img v-if="minItem.permissionCheckType" src="@/assets/ZDimages/personnelManagement/icon_xzqx_xz.png">
  281. <p>详细配置</p>
  282. </div>
  283. </div>
  284. </div>
  285. </div>
  286. </div>
  287. <div class="big-right-box-null" v-if="bigItem.menuType == 'C'&&bigItem.checkType">
  288. <div class="scope-box">
  289. <p>
  290. <el-checkbox v-model="bigItem.scopeCheckType" style="margin-right:40px;" @change="(type)=>itemCheckClick(4,type,bigItem)">数据范围</el-checkbox>
  291. <el-select v-model="bigItem.dataScope" :disabled="!bigItem.scopeCheckType" v-if="bigItem.isRequired == 1"
  292. placeholder="请选择" @visible-change="(type)=>visibleChange(type,bigItem,maxIndex,bigIndex)">
  293. <el-option v-for="dist in optionsDataListOne" :key="dist.type" :label="dist.value" :value="dist.type" @click.native="(type)=>optionChange(dist.type,bigItem,maxIndex,bigIndex)"></el-option>
  294. </el-select>
  295. <el-select v-model="bigItem.dataScope" :disabled="!bigItem.scopeCheckType" v-if="bigItem.isRequired != 1"
  296. placeholder="请选择" @visible-change="(type)=>visibleChange(type,bigItem,maxIndex,bigIndex)">
  297. <el-option v-for="dist in optionsDataList" :key="dist.type" :label="dist.value" :value="dist.type" @click.native="(type)=>optionChange(dist.type,bigItem,maxIndex,bigIndex)"></el-option>
  298. </el-select>
  299. </p>
  300. </div>
  301. <div class="permission-box" v-if="bigItem.children">
  302. <p class="check-left-p"><el-checkbox v-model="bigItem.permissionCheckType" @change="(type)=>itemCheckClick(5,type,bigItem)">管理权限</el-checkbox></p>
  303. <div class="check-button-box" @click="permissionDetails(bigItem,maxIndex,bigIndex)"
  304. :class="bigItem.permissionCheckType?'check-button-box-colorA':'check-button-box-colorB'">
  305. <img v-if="!bigItem.permissionCheckType" src="@/assets/ZDimages/personnelManagement/icon_xzqx_zc.png">
  306. <img v-if="bigItem.permissionCheckType" src="@/assets/ZDimages/personnelManagement/icon_xzqx_xz.png">
  307. <p>详细配置</p>
  308. </div>
  309. </div>
  310. </div>
  311. </div>
  312. <p class="big-box-null" v-if="!maxItem.children&&maxItem.menuName == '数据可视化'">数据可视化大屏查看权限</p>
  313. </div>
  314. </div>
  315. </div>
  316. <user-list-one ref="userOpen"></user-list-one>
  317. <el-dialog :title="permissionCheckData.menuName+'模块'" :visible.sync="permissionOpen" width="900px" append-to-body class="managePermissionTemplates-permission-dialog-box">
  318. <p class="title-p">{{permissionCheckData.menuName}}权限详细配置</p>
  319. <div class="managePermissionTemplates-permission-dialog-form-box">
  320. <div class="title-box">
  321. <p class="left-title-p">功能菜单</p>
  322. <div class="right-box">
  323. <el-checkbox v-model="allCheckType" class="right-box-min" @change="(type)=>permissionCheckClick('1',type)">功能操作</el-checkbox>
  324. </div>
  325. </div>
  326. <div class="check-box">
  327. <div class="left-title-box">
  328. <p class="left-title-p">{{permissionCheckData.menuName}}</p>
  329. </div>
  330. <div class="right-box">
  331. <el-checkbox class="for-check-box" @change="(type)=>permissionCheckClick('2',type)"
  332. v-for="(item,index) in permissionCheckData.children" :key="index" v-model="item.checkType">
  333. {{item.menuName}}
  334. </el-checkbox>
  335. </div>
  336. </div>
  337. </div>
  338. <div slot="footer" class="managePermissionTemplates-permission-dialog-button-box">
  339. <p class="reset-button-one" @click="permissionOpenOff">取消</p>
  340. <p class="inquire-button-one" @click="surePermissionOpen">确定</p>
  341. </div>
  342. </el-dialog>
  343. <el-dialog title="选择指定部门(可多选)" @close="deptCancel" :visible.sync="deptOpen" v-if="deptOpen" width="500px" append-to-body class="managePermissionTemplates-dept-dialog-box">
  344. <el-form :model="deptForm" ref="deptForm" :inline="true" :rules="rules" class="addCheckPage-min">
  345. <el-form-item label="指定部门" prop="deptIds" label-width="90px" class="el-form-item-bottom">
  346. <el-cascader
  347. style="width:300px;"
  348. :options="treeselectList"
  349. :props="{multiple: true,value: 'id', label: 'label'}"
  350. v-model="deptForm.deptIds"
  351. clearable>
  352. </el-cascader>
  353. </el-form-item>
  354. </el-form>
  355. <div slot="footer" class="managePermissionTemplates-dept-dialog-button-box">
  356. <p class="reset-button-one" @click="deptCancel">取消</p>
  357. <p class="inquire-button-one" @click="deptSure">确定</p>
  358. </div>
  359. </el-dialog>
  360. <!--另存-->
  361. <el-dialog title="另存为权限模板" :visible.sync="saveOpen" width="600px" append-to-body class="teacher-revise-dialog-box">
  362. <el-form :model="saveForm" ref="saveForm" :inline="true" :rules="rules" class="addCheckPage-min">
  363. <el-form-item label="模板名称" prop="name" label-width="110px" >
  364. <el-input v-model="saveForm.name" clearable maxlength="12" style="width:420px;" placeholder="请输入模板名称"/>
  365. </el-form-item>
  366. <el-form-item label="是否为学生模板" prop="type" style="width:420px;">
  367. <el-radio-group v-model="saveForm.type">
  368. <el-radio :label="1" style="width:80px;margin-left:20px;">是</el-radio>
  369. <el-radio :label="0">否</el-radio>
  370. </el-radio-group>
  371. </el-form-item>
  372. <el-form-item label="权限模板说明" prop="newPassword" label-width="110px">
  373. <el-input
  374. type="textarea"
  375. style="width:420px;"
  376. maxlength="100"
  377. resize="none"
  378. show-word-limit
  379. :autosize="{ minRows: 6, maxRows: 6}"
  380. placeholder="请输入权限模板说明"
  381. v-model="saveForm.text">
  382. </el-input>
  383. </el-form-item>
  384. </el-form>
  385. <!--<p class="teacher-text-p">确定要重置该账号的密码吗?</p>-->
  386. <!--<p class="teacher-text-p">确定操作后,该账号密码将重置为系统初始密码。</p>-->
  387. <div slot="footer" class="teacher-revise-dialog-button-box">
  388. <p class="reset-button-one" @click="saveOpenOff">取消</p>
  389. <p class="inquire-button-one" @click="saveUpData">确定</p>
  390. </div>
  391. </el-dialog>
  392. </div>
  393. <div class="bottom-button-box" v-if="!editType">
  394. <p class="inquire-button-one" @click="upDataButton">提交</p>
  395. <p class="add-button-one-150" v-if="form.status == 0 && form.nature == 0" @click="saveDataButton">另存为权限模板</p>
  396. </div>
  397. </div>
  398. </template>
  399. <script>
  400. import userListOne from "./userListOne.vue"
  401. import { listMenuAll} from "@/api/system/menu";
  402. import { getToken } from "@/utils/auth";
  403. import { treeselect } from "@/api/system/dept";
  404. import { optionselect, getVaguet, userPermit, addUserTeacher, putUserTeacherNew } from "@/api/system/user_teacher";
  405. import { getPermitOptionList, getPermitInfo } from "@/api/laboratory/managePermissionTemplates";
  406. import { addSystemPermit } from "@/api/laboratory/managePermissionTemplates";
  407. import Treeselect from "@riophae/vue-treeselect";
  408. export default {
  409. name: "addPage",
  410. props:{
  411. editType:{},
  412. propsData:{},
  413. titleName:{},
  414. },
  415. components: {
  416. userListOne,
  417. Treeselect
  418. },
  419. data() {
  420. return {
  421. uploadImgUrl: this.uploadUrl(), // 上传的图片服务器地址
  422. headers: {
  423. Authorization: "Bearer " + getToken(),
  424. },
  425. menuList:[],
  426. menuListData:[],
  427. originalMenuList:[],
  428. form:{
  429. avatar:"", //头像
  430. nickName:"", //姓名
  431. sex:0, //性别
  432. userName:"", //工号
  433. deptId:"", //所在部门
  434. position:"", //身份
  435. category:"", //职称
  436. phonenumber:"", //联系方式
  437. cardNum:"", //校园卡号
  438. education:"", //文化程度
  439. dateBirth:"", //出生日期
  440. email:"", //邮箱
  441. nature:0, //在职离职
  442. isCheck:0, //是否检查者 0否 1是
  443. faceImg:"", //人脸照片
  444. signature:"", //电子签名
  445. status:0, //账户状态,启用停用
  446. },
  447. rules:{
  448. nickName: [{ required: true, message: "请输入姓名", trigger: "blur" },
  449. { required: true, message: "请输入姓名", validator: this.spaceJudgment, trigger: "blur" }],
  450. userName: [{ required: true, message: "请输入工号", trigger: "blur" },
  451. { required: true, message: "请输入工号", validator: this.spaceJudgment, trigger: "blur" }],
  452. deptId: [{ required: true, message: "请选择部门", trigger: "blur" }],
  453. position: [{ required: true, message: "请选择身份", trigger: "blur" }],
  454. name: [{ required: true, message: "请输入模板名称", trigger: "blur" },
  455. { required: true, message: "请输入模板名称", validator: this.spaceJudgment, trigger: "blur" }],
  456. deptIds: [{ required: true, message: "请选择指定部门", trigger: "blur" }],
  457. phonenumber: [
  458. { required: true, message: "请输入手机号码", trigger: "blur" },
  459. { required: true, message: "请输入手机号码", validator: this.spaceJudgment, trigger: "blur" }
  460. ],
  461. },
  462. textType:false,
  463. //数据范围列表
  464. optionsDataListOne:[
  465. {type: 1, value: "所有数据",},
  466. {type: 2, value: "本部门及下级部门数据",},
  467. {type: 3, value: "本部门及指定部门数据",},
  468. ],
  469. optionsDataList:[
  470. {type: 1, value: "所有数据",},
  471. {type: 2, value: "本部门及下级部门数据",},
  472. {type: 3, value: "本部门及指定部门数据",},
  473. {type: 4, value: "当前账号数据",},
  474. ],
  475. //数据范围部门弹窗
  476. deptOpen:false,
  477. deptOpenType:'',
  478. //部门数据结构树
  479. treeselectList:[],
  480. //指定部门数据
  481. deptForm:{
  482. deptIds:[],
  483. maxIndex:"",
  484. bigIndex:"",
  485. minIndex:"",
  486. dataScope:"",
  487. },
  488. //快捷权限列表
  489. templateList:[],
  490. templateKey:"",
  491. templateName:"",
  492. //权限勾选数据
  493. permissionOpen:false,
  494. permissionCheckData:{},
  495. allCheckType:false,
  496. maxIndex:'',
  497. bigIndex:'',
  498. minIndex:'',
  499. //身份列表
  500. positionOptions:[],
  501. //部门列表
  502. deptOptions:[],
  503. //职称列表
  504. categoryOptions:[],
  505. //文化列表
  506. educationOptions:[],
  507. //另存
  508. saveOpen:false,
  509. saveForm:{
  510. name:"",
  511. type:0,
  512. text:"",
  513. },
  514. }
  515. },
  516. created(){
  517. if(this.propsData.userId){
  518. if(this.propsData.avatar){
  519. this.form.avatar = this.propsData.avatar;
  520. }else{
  521. this.form.avatar = '';
  522. }
  523. if(this.propsData.nickName){
  524. this.form.nickName = this.propsData.nickName;
  525. }else{
  526. this.form.nickName = '';
  527. }
  528. if(this.propsData.sex){
  529. this.form.sex = parseInt(this.propsData.sex);
  530. }else{
  531. this.form.sex = 0;
  532. }
  533. if(this.propsData.userName){
  534. this.form.userName = this.propsData.userName;
  535. }else{
  536. this.form.userName = ''
  537. }
  538. if(this.propsData.deptId){
  539. this.form.deptId = this.propsData.deptId;
  540. }else{
  541. this.form.deptId = '';
  542. }
  543. if(this.propsData.position){
  544. this.form.position = parseInt(this.propsData.position);
  545. }else{
  546. this.form.position = '';
  547. }
  548. if(this.propsData.category){
  549. this.form.category = this.propsData.category;
  550. }else{
  551. this.form.category = '';
  552. }
  553. if(this.propsData.phonenumber){
  554. this.form.phonenumber = this.propsData.phonenumber;
  555. }else{
  556. this.form.phonenumber = '';
  557. }
  558. if(this.propsData.cardNum){
  559. this.form.cardNum = this.propsData.cardNum;
  560. }else{
  561. this.form.cardNum = '';
  562. }
  563. if(this.propsData.education){
  564. this.form.education = this.propsData.education;
  565. }else{
  566. this.form.education = '';
  567. }
  568. if(this.propsData.dateBirth){
  569. this.form.dateBirth = this.propsData.dateBirth;
  570. }else{
  571. this.form.dateBirth = '';
  572. }
  573. if(this.propsData.email){
  574. this.form.email = this.propsData.email;
  575. }else{
  576. this.form.email = '';
  577. }
  578. if(this.propsData.nature){
  579. this.form.nature = this.propsData.nature;
  580. }else{
  581. this.form.nature = '';
  582. }
  583. if(this.propsData.isCheck){
  584. this.form.isCheck = this.propsData.isCheck;
  585. }else{
  586. this.form.isCheck = '';
  587. }
  588. if(this.propsData.faceImg){
  589. this.form.faceImg = this.propsData.faceImg;
  590. }else{
  591. this.form.faceImg = '';
  592. }
  593. if(this.propsData.signature){
  594. this.form.signature = this.propsData.signature;
  595. }else{
  596. this.form.signature = '';
  597. }
  598. if(this.propsData.status){
  599. this.form.status = this.propsData.status;
  600. }else{
  601. this.form.status = '';
  602. }
  603. if(!this.editType){
  604. this.getPermitOptionList();
  605. this.getMenuOne();
  606. }
  607. }else{
  608. this.getPermitOptionList();
  609. this.getMenu();
  610. }
  611. this.getTreeselect();
  612. this.getAll();
  613. },
  614. mounted(){
  615. },
  616. methods:{
  617. //另存权限
  618. saveDataButton(){
  619. this.saveForm = {
  620. name:"",
  621. type:0,
  622. text:"",
  623. }
  624. this.saveOpen = true;
  625. },
  626. saveOpenOff(){
  627. this.saveOpen = false;
  628. },
  629. saveUpData(){
  630. this.$refs["saveForm"].validate(valid => {
  631. if (valid) {
  632. let list = this.toArray();
  633. console.log("list",list)
  634. let obj = {
  635. name:this.saveForm.name,
  636. type:this.saveForm.type,
  637. remark:this.saveForm.text,
  638. permitMenus:[]
  639. };
  640. for(let i=0;i<list.length;i++){
  641. let minObj = {
  642. menuId:list[i].menuId,
  643. }
  644. if(list[i].dataScope){
  645. minObj.dataScope = list[i].dataScope
  646. if(list[i].dataScope == 3){
  647. minObj.deptIds = list[i].deptIds;
  648. minObj.deptIdsList = list[i].deptIdsList;
  649. }
  650. }else{
  651. minObj.dataScope = 0
  652. }
  653. obj.permitMenus.push(minObj)
  654. }
  655. if(!obj.permitMenus[0]){
  656. this.msgError('请先勾选权限项');
  657. return
  658. }
  659. this.addSystemPermit(obj);
  660. }
  661. })
  662. },
  663. //保存权限
  664. addSystemPermit(obj){
  665. addSystemPermit(obj).then(response => {
  666. if(response.code == 200){
  667. this.saveOpenOff();
  668. this.msgSuccess(response.msg);
  669. }
  670. });
  671. },
  672. //根据选择人员获取权限
  673. takeUserData(ids){
  674. this.userPermit(ids[0]);
  675. this.$refs.userOpen.show();
  676. },
  677. //提交按钮
  678. upDataButton(){
  679. this.$refs["form"].validate(valid => {
  680. if (valid) {
  681. if(this.form.email){
  682. let re = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
  683. if(!re.test(this.form.email)){
  684. this.msgError('请输入正确的邮箱地址')
  685. return
  686. }
  687. }
  688. let list = this.toArray();
  689. let obj = JSON.parse(JSON.stringify(this.form));
  690. obj.permitMenus = [];
  691. if(obj.status == 0){
  692. for(let i=0;i<list.length;i++){
  693. let minObj = {
  694. menuId:list[i].menuId,
  695. }
  696. if(list[i].dataScope){
  697. minObj.dataScope = list[i].dataScope
  698. if(list[i].dataScope == 3){
  699. minObj.deptIds = list[i].deptIds;
  700. minObj.deptIdsList = list[i].deptIdsList;
  701. }
  702. }else{
  703. minObj.dataScope = 0
  704. }
  705. obj.permitMenus.push(minObj)
  706. }
  707. }
  708. if(this.propsData.userId){
  709. //修改
  710. obj.userId = this.propsData.userId;
  711. this.putUserTeacherNew(obj);
  712. }else{
  713. //发布
  714. this.addUserTeacher(obj);
  715. }
  716. }
  717. });
  718. },
  719. putUserTeacherNew(obj){
  720. putUserTeacherNew(obj).then(response => {
  721. if(response.code == 200){
  722. this.msgSuccess(response.msg);
  723. this.outPageButton();
  724. }
  725. });
  726. },
  727. addUserTeacher(obj){
  728. addUserTeacher(obj).then(response => {
  729. if(response.code == 200){
  730. this.msgSuccess(response.msg);
  731. this.outPageButton();
  732. }
  733. });
  734. },
  735. //根据用户查询权限
  736. userPermit(userId){
  737. let self = this;
  738. userPermit(userId).then(response => {
  739. if(response.code == 200){
  740. let newList = JSON.parse(JSON.stringify(this.originalMenuList));
  741. for(let i=0;i<response.data.length;i++){
  742. for(let o=0;o<newList.length;o++){
  743. if(response.data[i].menuId == newList[o].menuId){
  744. newList[o].checkType = true;
  745. if(response.data[i].dataScope == 3){
  746. newList[o].dataScope = response.data[i].dataScope;
  747. newList[o].deptIds =response.data[i].deptIds;
  748. newList[o].deptIdsList =response.data[i].deptIdsList;
  749. newList[o].scopeCheckType = true;
  750. }else if(response.data[i].dataScope != 0){
  751. newList[o].dataScope = response.data[i].dataScope;
  752. newList[o].scopeCheckType = true;
  753. }
  754. }
  755. if(response.data[i].menuType == 'F' && response.data[i].parentId == newList[o].menuId && !newList[o].permissionCheckType){
  756. newList[o].permissionCheckType = true;
  757. }
  758. }
  759. }
  760. let newMenu = JSON.parse(JSON.stringify(this.handleTree(newList, "menuId")))
  761. this.$set(this,'menuList',newMenu);
  762. }
  763. });
  764. },
  765. getAll(){
  766. //身份
  767. optionselect({postName:""}).then(response => {
  768. this.positionOptions = response.data;
  769. });
  770. //职称
  771. getVaguet({dictType:"professional",dictLabel:""}).then(response => {
  772. this.categoryOptions = response.data;
  773. });
  774. //文化程度
  775. getVaguet({dictType:"education",dictLabel:""}).then(response => {
  776. this.educationOptions = response.data;
  777. });
  778. },
  779. //获取快捷权限列表
  780. getPermitOptionList(){
  781. getPermitOptionList().then(response => {
  782. this.templateList = response.data
  783. });
  784. },
  785. //查询身份
  786. positionSelect(query){
  787. if (query !== '') {
  788. let obj = {
  789. postName:query,
  790. };
  791. optionselect(obj).then(response => {
  792. this.positionOptions = response.data;
  793. });
  794. } else {
  795. this.positionOptions = [];
  796. }
  797. },
  798. positionSelectClick(){
  799. },
  800. positionClearClick(){
  801. },
  802. //查询职称列表
  803. categorySelect(query){
  804. if (query !== '') {
  805. let obj = {
  806. dictType:"professional",
  807. dictLabel:query
  808. };
  809. getVaguet(obj).then(response => {
  810. this.categoryOptions = response.data;
  811. });
  812. } else {
  813. this.categoryOptions = [];
  814. }
  815. },
  816. categorySelectClick(){
  817. },
  818. categoryClearClick(){
  819. },
  820. //查询文化程度
  821. educationSelect(query){
  822. if (query !== '') {
  823. let obj = {
  824. dictType:"education",
  825. dictLabel:query
  826. };
  827. getVaguet(obj).then(response => {
  828. this.educationOptions = response.data;
  829. });
  830. } else {
  831. this.educationOptions = [];
  832. }
  833. },
  834. educationSelectClick(){
  835. },
  836. educationClearClick(){
  837. },
  838. /** 查询部门下拉树结构 */
  839. getTreeselect() {
  840. treeselect().then(response => {
  841. this.deptOptions = response.data;
  842. this.$set(this,'treeselectList',response.data[0].children);
  843. });
  844. },
  845. natureCaptcha(){
  846. this.form.nature = this.form.nature == 1?'0':'1';
  847. if(this.form.nature == 1){
  848. this.form.status = 1;
  849. }
  850. },
  851. isCheckCaptcha(){
  852. this.form.isCheck = this.form.isCheck == 1?0:1;
  853. },
  854. statusCaptcha(){
  855. this.form.status = this.form.status == 1?'0':'1';
  856. },
  857. //上传
  858. handleAvatarSuccess(res, file) {
  859. console.log(res.data.url);
  860. this.form.avatar = res.data.url;
  861. this.$forceUpdate()
  862. },
  863. beforeAvatarUpload(file) {
  864. let type = false;
  865. console.log('file',file);
  866. if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/gif') {
  867. type = true;
  868. }else{
  869. this.$message.error('只能上传png/jpeg/gif格式图片');
  870. type = false;
  871. }
  872. return type;
  873. },
  874. //导入用户权限
  875. importUser(){
  876. this.$refs.userOpen.show();
  877. },
  878. //返回事件
  879. outPageButton(){
  880. this.$parent.outPage(1);
  881. },
  882. //模板选中
  883. templateClick(id){
  884. let self = this;
  885. getPermitInfo(id).then(response => {
  886. for(let a=0;a<response.data.length;a++){
  887. if(response.data[a].isRequired == 1){
  888. response.data[a].checkType = true;
  889. }
  890. }
  891. let newList = JSON.parse(JSON.stringify(this.originalMenuList));
  892. for(let i=0;i<response.data.permitMenus.length;i++){
  893. for(let o=0;o<newList.length;o++){
  894. if(response.data.permitMenus[i].menuId == newList[o].menuId){
  895. newList[o].checkType = true;
  896. if(response.data.permitMenus[i].dataScope == 3){
  897. newList[o].dataScope = response.data.permitMenus[i].dataScope;
  898. newList[o].deptIds =response.data.permitMenus[i].deptIds;
  899. newList[o].deptIdsList =response.data.permitMenus[i].deptIdsList;
  900. newList[o].scopeCheckType = true;
  901. }else if(response.data.permitMenus[i].dataScope != 0){
  902. newList[o].dataScope = response.data.permitMenus[i].dataScope;
  903. newList[o].scopeCheckType = true;
  904. }
  905. }
  906. if(response.data.permitMenus[i].menuType == 'F' && response.data.permitMenus[i].parentId == newList[o].menuId && !newList[o].permissionCheckType){
  907. newList[o].permissionCheckType = true;
  908. }
  909. }
  910. }
  911. this.menuList = JSON.parse(JSON.stringify(this.handleTree(newList, "menuId")))
  912. });
  913. if(this.templateKey != id){
  914. this.templateKey = id;
  915. for(let i=0;i<self.templateList.length;i++){
  916. if(id == self.templateList[i].id){
  917. this.templateName = self.templateList[i].name;
  918. }
  919. }
  920. }else{
  921. this.templateKey = "";
  922. this.templateName = "";
  923. }
  924. this.$forceUpdate();
  925. },
  926. //清除模板选中
  927. templateDel(){
  928. this.templateKey = "";
  929. this.templateName = "";
  930. this.$set(this,'menuList',JSON.parse(JSON.stringify(this.menuListData)))
  931. },
  932. //权限详情按钮
  933. permissionDetails(obj,maxIndex,bigIndex,minIndex){
  934. let item = JSON.parse(JSON.stringify(obj));
  935. this.maxIndex = maxIndex;
  936. this.bigIndex = bigIndex;
  937. this.minIndex = minIndex;
  938. let num = 0;
  939. for(let i=0;i<item.children.length;i++){
  940. if(item.children[i].checkType){
  941. num++
  942. }
  943. }
  944. this.allCheckType = num != 0;
  945. this.$set(this,'permissionCheckData',item)
  946. this.permissionOpen = true;
  947. },
  948. surePermissionOpen(){
  949. if(this.maxIndex != undefined && this.bigIndex != undefined && this.minIndex != undefined){
  950. this.menuList[this.maxIndex].children[this.bigIndex].children[this.minIndex] = JSON.parse(JSON.stringify(this.permissionCheckData));
  951. this.menuList[this.maxIndex].children[this.bigIndex].children[this.minIndex].permissionCheckType = JSON.parse(JSON.stringify(this.allCheckType))
  952. }else if(this.maxIndex != undefined && this.bigIndex != undefined){
  953. this.menuList[this.maxIndex].children[this.bigIndex] = JSON.parse(JSON.stringify(this.permissionCheckData));
  954. this.menuList[this.maxIndex].children[this.bigIndex].permissionCheckType = JSON.parse(JSON.stringify(this.allCheckType))
  955. }else if(this.maxIndex != undefined){
  956. this.menuList[this.maxIndex] = JSON.parse(JSON.stringify(this.permissionCheckData));
  957. this.menuList[this.maxIndex].permissionCheckType = JSON.parse(JSON.stringify(this.allCheckType))
  958. }
  959. this.permissionOpen = false;
  960. },
  961. permissionOpenOff(){
  962. this.permissionOpen = false;
  963. },
  964. //展开时触发
  965. visibleChange(type,item,maxIndex,bigIndex,minIndex){
  966. if(type){
  967. if(minIndex!=undefined){
  968. this.deptOpenType = this.menuList[maxIndex].children[bigIndex].children[minIndex].dataScope
  969. }else{
  970. this.deptOpenType = this.menuList[maxIndex].children[bigIndex].dataScope
  971. }
  972. }
  973. },
  974. //数据范围选中指定部门
  975. optionChange(type,item,maxIndex,bigIndex,minIndex){
  976. if(type == 3){
  977. console.log('deptIdsList',item.deptIdsList);
  978. if(item.deptIdsList){
  979. this.deptForm.deptIds = JSON.parse(item.deptIdsList);
  980. }else{
  981. this.deptForm.deptIds = "";
  982. }
  983. this.deptForm.maxIndex = maxIndex;
  984. this.deptForm.bigIndex = bigIndex;
  985. this.deptForm.minIndex = minIndex;
  986. this.deptForm.dataScope = item.dataScope;
  987. this.deptOpen = true;
  988. }
  989. console.log(type);
  990. this.$forceUpdate()
  991. },
  992. //指定部门弹窗取消
  993. deptCancel(){
  994. if(this.deptForm.minIndex || this.deptForm.minIndex == 0){
  995. this.$set(this.menuList[this.deptForm.maxIndex].children[this.deptForm.bigIndex].children[this.deptForm.minIndex],'dataScope',this.deptOpenType)
  996. }else{
  997. this.$set(this.menuList[this.deptForm.maxIndex].children[this.deptForm.bigIndex],'dataScope',this.deptOpenType)
  998. }
  999. this.deptForm.deptIds = [];
  1000. this.deptForm.maxIndex = "";
  1001. this.deptForm.bigIndex = "";
  1002. this.deptForm.minIndex = "";
  1003. this.deptForm.dataScope = "";
  1004. this.deptOpen = false;
  1005. this.$forceUpdate()
  1006. },
  1007. //指定部门弹窗确定
  1008. deptSure(){
  1009. let self = this;
  1010. this.$refs["deptForm"].validate(valid => {
  1011. if (valid) {
  1012. let list = [];
  1013. for(let i=0;i<self.deptForm.deptIds.length;i++){
  1014. for(let o=0;o<self.deptForm.deptIds[i].length;o++){
  1015. list.push(self.deptForm.deptIds[i][o])
  1016. }
  1017. }
  1018. let newList = [];
  1019. for (var i = 0,len=list.length; i < len; i++) {
  1020. if(newList.indexOf(list[i]) === -1){
  1021. newList.push(list[i]);
  1022. }
  1023. }
  1024. if(this.deptForm.minIndex || this.deptForm.minIndex == 0){
  1025. this.$set(this.menuList[this.deptForm.maxIndex].children[this.deptForm.bigIndex].children[this.deptForm.minIndex],'deptIds',newList)
  1026. this.$set(this.menuList[this.deptForm.maxIndex].children[this.deptForm.bigIndex].children[this.deptForm.minIndex],'deptIdsList',JSON.stringify(self.deptForm.deptIds))
  1027. }else{
  1028. this.$set(this.menuList[this.deptForm.maxIndex].children[this.deptForm.bigIndex],'deptIds',newList)
  1029. this.$set(this.menuList[this.deptForm.maxIndex].children[this.deptForm.bigIndex],'deptIdsList',JSON.stringify(self.deptForm.deptIds))
  1030. }
  1031. this.deptOpen = false;
  1032. this.deptForm.deptIds = [];
  1033. this.deptForm.maxIndex = "";
  1034. this.deptForm.bigIndex = "";
  1035. this.deptForm.minIndex = "";
  1036. this.deptForm.dataScope = "";
  1037. this.$forceUpdate()
  1038. }
  1039. });
  1040. },
  1041. //模块勾选逻辑
  1042. itemCheckClick(status,type,item,bigItem,maxItem){
  1043. if(status == 1 || status == 2 || status == 3){
  1044. //一级菜单勾选
  1045. if(item.children){
  1046. for(let i=0;i<item.children.length;i++){
  1047. item.children[i].checkType = !!type;
  1048. if(item.children[i].children){
  1049. for(let o=0;o<item.children[i].children.length;o++){
  1050. item.children[i].children[o].checkType = !!type;
  1051. if(item.children[i].children[o].children){
  1052. for(let x=0;x<item.children[i].children[o].children.length;x++){
  1053. item.children[i].children[o].children[x].checkType = !!type;
  1054. }
  1055. }
  1056. if(item.children[i].children[o].menuType == 'C'){
  1057. item.children[i].children[o].scopeCheckType = !!type;
  1058. item.children[i].children[o].dataScope = type?1:"";
  1059. item.children[i].children[o].permissionCheckType = !!type;
  1060. }
  1061. }
  1062. }
  1063. if(item.children[i].menuType == 'C'){
  1064. item.children[i].scopeCheckType = !!type;
  1065. item.children[i].dataScope = type?1:"";
  1066. item.children[i].permissionCheckType = !!type;
  1067. }
  1068. }
  1069. }
  1070. if(item.menuType == 'C'){
  1071. item.scopeCheckType = !!type;
  1072. item.dataScope = type?1:"";
  1073. item.permissionCheckType = !!type;
  1074. }
  1075. if(bigItem&&type){
  1076. bigItem.checkType = type;
  1077. }
  1078. if(maxItem&&type){
  1079. maxItem.checkType = type;
  1080. }
  1081. }else if(status == 4){
  1082. //数据范围勾选
  1083. item.scopeCheckType = !!type;
  1084. item.dataScope = type?1:"";
  1085. }else if(status == 5){
  1086. //管理权限勾选
  1087. item.permissionCheckType = !!type;
  1088. for(let i=0;i<item.children.length;i++){
  1089. item.children[i].checkType = !!type;
  1090. }
  1091. }
  1092. },
  1093. //权限勾选逻辑
  1094. permissionCheckClick(status,type){
  1095. let self = this;
  1096. if(status == 1){
  1097. for(let i=0;i<self.permissionCheckData.children.length;i++){
  1098. self.permissionCheckData.children[i].checkType = !!type;
  1099. self.permissionCheckData.permissionCheckType = !!type;
  1100. }
  1101. }else if(status == 2){
  1102. if(type&&!this.allCheckType){
  1103. this.allCheckType = true;
  1104. this.permissionCheckData.permissionCheckType = true;
  1105. }else{
  1106. let num = 0;
  1107. for(let i=0;i<self.permissionCheckData.children.length;i++){
  1108. if(!self.permissionCheckData.children[i].checkType){
  1109. num++
  1110. }
  1111. }
  1112. if(num == self.permissionCheckData.children.length){
  1113. this.allCheckType = false;
  1114. this.permissionCheckData.permissionCheckType = false;
  1115. }
  1116. }
  1117. }
  1118. this.$forceUpdate();
  1119. },
  1120. showText(){
  1121. console.log("1")
  1122. this.textType = true;
  1123. },
  1124. hideText(){
  1125. console.log("2")
  1126. this.textType = false;
  1127. },
  1128. /** 查询菜单列表 */
  1129. getMenuOne(){
  1130. let self = this;
  1131. this.loading = true;
  1132. listMenuAll(this.queryParams).then(response => {
  1133. for(let a=0;a<response.data.length;a++){
  1134. if(response.data[a].isRequired == 1){
  1135. response.data[a].checkType = true;
  1136. }
  1137. }
  1138. if(this.propsData.userId){
  1139. let newList = JSON.parse(JSON.stringify(response.data));
  1140. this.form.name = this.propsData.name;
  1141. this.form.type = this.propsData.type;
  1142. this.form.text = this.propsData.remark;
  1143. for(let i=0;i<self.propsData.permitMenus.length;i++){
  1144. for(let o=0;o<newList.length;o++){
  1145. if(self.propsData.permitMenus[i].menuId == newList[o].menuId){
  1146. newList[o].checkType = true;
  1147. if(self.propsData.permitMenus[i].dataScope == 3){
  1148. newList[o].dataScope = self.propsData.permitMenus[i].dataScope;
  1149. newList[o].deptIds =self.propsData.permitMenus[i].deptIds;
  1150. newList[o].scopeCheckType = true;
  1151. }else if(self.propsData.permitMenus[i].dataScope != 0){
  1152. newList[o].dataScope = self.propsData.permitMenus[i].dataScope;
  1153. newList[o].scopeCheckType = true;
  1154. }
  1155. }
  1156. if(self.propsData.permitMenus[i].menuType == 'F' && self.propsData.permitMenus[i].parentId == newList[o].menuId && !newList[o].permissionCheckType){
  1157. newList[o].permissionCheckType = true;
  1158. }
  1159. }
  1160. }
  1161. this.menuList = JSON.parse(JSON.stringify(this.handleTree(newList, "menuId")))
  1162. this.menuListData = JSON.parse(JSON.stringify(this.handleTree(response.data, "menuId")))
  1163. this.originalMenuList = JSON.parse(JSON.stringify(response.data));
  1164. }else{
  1165. this.menuList = JSON.parse(JSON.stringify(this.handleTree(response.data, "menuId")))
  1166. this.menuListData = JSON.parse(JSON.stringify(this.handleTree(response.data, "menuId")))
  1167. this.originalMenuList = JSON.parse(JSON.stringify(response.data));
  1168. }
  1169. this.loading = false;
  1170. this.userPermit(this.propsData.userId);
  1171. });
  1172. },
  1173. getMenu() {
  1174. let self = this;
  1175. this.loading = true;
  1176. listMenuAll(this.queryParams).then(response => {
  1177. for(let a=0;a<response.data.length;a++){
  1178. if(response.data[a].isRequired == 1){
  1179. response.data[a].checkType = true;
  1180. }
  1181. }
  1182. if(this.propsData.userId){
  1183. let newList = JSON.parse(JSON.stringify(response.data));
  1184. this.form.name = this.propsData.name;
  1185. this.form.type = this.propsData.type;
  1186. this.form.text = this.propsData.remark;
  1187. for(let i=0;i<self.propsData.permitMenus.length;i++){
  1188. for(let o=0;o<newList.length;o++){
  1189. if(self.propsData.permitMenus[i].menuId == newList[o].menuId){
  1190. newList[o].checkType = true;
  1191. if(self.propsData.permitMenus[i].dataScope == 3){
  1192. newList[o].dataScope = self.propsData.permitMenus[i].dataScope;
  1193. newList[o].deptIds =self.propsData.permitMenus[i].deptIds;
  1194. newList[o].scopeCheckType = true;
  1195. }else if(self.propsData.permitMenus[i].dataScope != 0){
  1196. newList[o].dataScope = self.propsData.permitMenus[i].dataScope;
  1197. newList[o].scopeCheckType = true;
  1198. }
  1199. }
  1200. if(self.propsData.permitMenus[i].menuType == 'F' && self.propsData.permitMenus[i].parentId == newList[o].menuId && !newList[o].permissionCheckType){
  1201. newList[o].permissionCheckType = true;
  1202. }
  1203. }
  1204. }
  1205. this.menuList = JSON.parse(JSON.stringify(this.handleTree(newList, "menuId")))
  1206. this.menuListData = JSON.parse(JSON.stringify(this.handleTree(response.data, "menuId")))
  1207. this.originalMenuList = JSON.parse(JSON.stringify(response.data));
  1208. }else{
  1209. this.menuList = JSON.parse(JSON.stringify(this.handleTree(response.data, "menuId")))
  1210. this.menuListData = JSON.parse(JSON.stringify(this.handleTree(response.data, "menuId")))
  1211. this.originalMenuList = JSON.parse(JSON.stringify(response.data));
  1212. }
  1213. this.loading = false;
  1214. });
  1215. },
  1216. //结构树转数组并筛选选中项
  1217. toArray(){
  1218. let list = [];
  1219. let newList = JSON.parse(JSON.stringify(this.menuList));
  1220. for(let i=0;i<newList.length;i++){
  1221. pushNode(newList[i]);
  1222. }
  1223. function pushNode(node){
  1224. if(node.children){
  1225. for (let nodeItem of node.children){
  1226. pushNode(nodeItem)
  1227. }
  1228. delete node.children;
  1229. if(node.checkType){
  1230. list.push(node)
  1231. }
  1232. }else{
  1233. if(node.children){
  1234. delete node.children
  1235. }
  1236. if(node.checkType){
  1237. list.push(node)
  1238. }
  1239. }
  1240. }
  1241. return list
  1242. }
  1243. }
  1244. }
  1245. </script>
  1246. <style scoped lang="scss">
  1247. .teacher-add-page{
  1248. flex:1;
  1249. display: flex;
  1250. flex-direction: column;
  1251. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  1252. padding:0 0 20px!important;
  1253. overflow: hidden;
  1254. *{
  1255. margin:0;
  1256. }
  1257. .public-form-box{
  1258. flex:1;
  1259. overflow-y: scroll;
  1260. overflow-x: hidden;
  1261. }
  1262. .top-title-box{
  1263. border-bottom:1px solid #E0E0E0;
  1264. display: flex;
  1265. p:nth-child(1){
  1266. color:#0045AF;
  1267. line-height:80px;
  1268. margin-left:24px;
  1269. font-size:18px;
  1270. flex:1;
  1271. }
  1272. p:nth-child(2){
  1273. border:1px solid #0045AF;
  1274. color:#0045AF;
  1275. width:80px;
  1276. height:30px;
  1277. text-align: center;
  1278. font-size:16px;
  1279. border-radius: 6px;
  1280. line-height:30px;
  1281. margin:25px 20px 0 0;
  1282. cursor: pointer;
  1283. }
  1284. }
  1285. .top-info-box{
  1286. display: flex;
  1287. padding:40px 20px 0;
  1288. .left-info-box{
  1289. margin-right:20px;
  1290. img{
  1291. width:100px;
  1292. height:120px;
  1293. }
  1294. p{
  1295. width: 80px;
  1296. height: 26px;
  1297. border: 1px solid #0183FA;
  1298. border-radius: 6px;
  1299. line-height:24px;
  1300. font-size:12px;
  1301. color:#0183FA;
  1302. text-align: center;
  1303. margin:24px 10px;
  1304. }
  1305. }
  1306. }
  1307. .top-title-one{
  1308. display: flex;
  1309. border-top:1px solid #E0E0E0;
  1310. position: relative;
  1311. .title-p{
  1312. font-size:18px;
  1313. color:#0045AF;
  1314. line-height:80px;
  1315. margin-left:24px;
  1316. }
  1317. .img-p{
  1318. font-size:18px;
  1319. margin:0 10px;
  1320. line-height:80px;
  1321. color:#FFC000;
  1322. }
  1323. .position-box{
  1324. width: 420px;
  1325. height: 194px;
  1326. padding:20px;
  1327. background: #F5F5F5;
  1328. position: absolute;
  1329. top:10px;
  1330. left:134px;
  1331. p{
  1332. font-size:12px;
  1333. line-height:18px;
  1334. color:#333;
  1335. }
  1336. }
  1337. }
  1338. .name-input-box{
  1339. height:100px;
  1340. }
  1341. .for-button-list{
  1342. background: #E5F2FE;
  1343. margin:0 20px;
  1344. display: flex;
  1345. .for-title-p{
  1346. width:175px;
  1347. height:80px;
  1348. line-height:80px;
  1349. font-size:16px;
  1350. color:#333;
  1351. text-align: center;
  1352. }
  1353. .for-button-max-box{
  1354. flex:1;
  1355. .for-button-min-box{
  1356. font-size:16px;
  1357. display: inline-block;
  1358. overflow: hidden;
  1359. height:30px;
  1360. line-height:30px;
  1361. border-radius:6px;
  1362. margin:25px 28px 0 0;
  1363. cursor: pointer;
  1364. i{
  1365. height:30px;
  1366. line-height:30px;
  1367. font-size:16px;
  1368. color:#fff;
  1369. margin-right:6px;
  1370. }
  1371. }
  1372. .colorAA{
  1373. color: #ffffff;
  1374. background: #0183FA;
  1375. padding:0 26px 0 16px;
  1376. }
  1377. .colorBB{
  1378. padding:0 26px;
  1379. color: #333;
  1380. background: #E0E0E0;
  1381. }
  1382. }
  1383. }
  1384. .template-name-box{
  1385. display: flex;
  1386. .template-name-p{
  1387. font-weight:500;
  1388. height:80px;
  1389. line-height:80px;
  1390. font-size:16px;
  1391. color:#333;
  1392. margin-left:20px;
  1393. flex: 1;
  1394. }
  1395. .template-name-button{
  1396. width:80px;
  1397. height:40px;
  1398. line-height:40px;
  1399. margin:20px 20px 0 0;
  1400. }
  1401. .template-name-button-one{
  1402. width:180px;
  1403. height:40px;
  1404. line-height:40px;
  1405. margin:20px 40px 0 0;
  1406. color:#fff;
  1407. background: #0183FA;
  1408. border: 1px solid #E0E0E0;
  1409. cursor: pointer;
  1410. font-size: 14px;
  1411. text-align: center;
  1412. border-radius: 6px;
  1413. }
  1414. }
  1415. .table-for-max-box{
  1416. border:1px solid #D7D7D7;
  1417. margin:0 20px;
  1418. *{
  1419. margin:0;
  1420. padding:0;
  1421. }
  1422. .table-title-box{
  1423. background: rgba(1,131,250,0.1);
  1424. display: flex;
  1425. p{
  1426. font-size:14px;
  1427. font-weight:700;
  1428. color:#333;
  1429. line-height:48px;
  1430. padding-left:20px;
  1431. }
  1432. p:nth-child(1){
  1433. width:615px;
  1434. border-right:1px solid #D7D7D7;
  1435. }
  1436. }
  1437. .table-for-big-box{
  1438. border-top:1px solid #D7D7D7;
  1439. display: flex;
  1440. font-size:14px;
  1441. .max-title-box-null{
  1442. width:615px!important;
  1443. }
  1444. .max-title-box{
  1445. width:230px;
  1446. border-right:1px solid #D7D7D7;
  1447. min-height:48px;
  1448. position: relative;
  1449. p{
  1450. position: absolute;
  1451. top:50%;
  1452. left:20px;
  1453. height:18px;
  1454. line-height:18px;
  1455. margin-top:-9px;
  1456. }
  1457. }
  1458. .max-right-box{
  1459. flex:5;
  1460. min-height:48px;
  1461. .big-box:nth-child(1){
  1462. border:none!important;
  1463. }
  1464. .big-box-null{
  1465. line-height:48px;
  1466. margin-left:20px;
  1467. color:#606266;
  1468. }
  1469. .big-box{
  1470. display: flex;
  1471. border-top:1px solid #D7D7D7;
  1472. .big-title-box-null{
  1473. width:385px!important;
  1474. }
  1475. .big-title-box{
  1476. width:180px;
  1477. border-right:1px solid #D7D7D7;
  1478. min-height:48px;
  1479. position: relative;
  1480. overflow: hidden;
  1481. p{
  1482. position: absolute;
  1483. top:50%;
  1484. left:20px;
  1485. height:48px;
  1486. line-height:48px;
  1487. margin-top:-24px;
  1488. }
  1489. }
  1490. .big-right-box-null{
  1491. display: flex;
  1492. .scope-box{
  1493. width:430px;
  1494. position: relative;
  1495. overflow: hidden;
  1496. border-right:1px solid #D7D7D7;
  1497. p{
  1498. position: absolute;
  1499. top:50%;
  1500. left:20px;
  1501. height:48px;
  1502. line-height:48px;
  1503. margin-top:-24px;
  1504. }
  1505. }
  1506. .permission-box{
  1507. flex:1;
  1508. position: relative;
  1509. overflow: hidden;
  1510. display: flex;
  1511. .check-left-p{
  1512. margin-left:20px;
  1513. height:48px;
  1514. line-height:48px;
  1515. }
  1516. .check-button-box{
  1517. width:130px;
  1518. height:36px;
  1519. margin:6px 0 0 36px;
  1520. line-height:36px;
  1521. display: flex;
  1522. color:#333;
  1523. cursor: pointer;
  1524. img{
  1525. width:16px;
  1526. height:16px;
  1527. margin:10px 14px 0 19px;
  1528. }
  1529. }
  1530. .check-button-box-colorA{
  1531. background: #CCE6FE;
  1532. color:#0183FA;
  1533. }
  1534. .check-button-box-colorB{
  1535. background: #E0E0E0;
  1536. color:#333;
  1537. }
  1538. }
  1539. }
  1540. .big-right-box{
  1541. flex:5;
  1542. min-height:48px;
  1543. .min-box:nth-child(1){
  1544. border:none!important;
  1545. }
  1546. .min-box{
  1547. display: flex;
  1548. border-top:1px solid #D7D7D7;
  1549. .min-title-box{
  1550. width:205px;
  1551. border-right:1px solid #D7D7D7;
  1552. min-height:48px;
  1553. position: relative;
  1554. overflow: hidden;
  1555. p{
  1556. position: absolute;
  1557. top:50%;
  1558. left:20px;
  1559. height:48px;
  1560. line-height:48px;
  1561. margin-top:-24px;
  1562. }
  1563. }
  1564. .min-right-box{
  1565. flex:5;
  1566. min-height:48px;
  1567. display: flex;
  1568. .scope-box{
  1569. width:430px;
  1570. position: relative;
  1571. overflow: hidden;
  1572. border-right:1px solid #D7D7D7;
  1573. p{
  1574. position: absolute;
  1575. top:50%;
  1576. left:20px;
  1577. height:48px;
  1578. line-height:48px;
  1579. margin-top:-24px;
  1580. }
  1581. }
  1582. .permission-box{
  1583. flex:1;
  1584. position: relative;
  1585. overflow: hidden;
  1586. display: flex;
  1587. .check-left-p{
  1588. margin-left:20px;
  1589. height:48px;
  1590. line-height:48px;
  1591. }
  1592. .check-button-box{
  1593. width:130px;
  1594. height:36px;
  1595. margin:6px 0 0 36px;
  1596. line-height:36px;
  1597. display: flex;
  1598. color:#333;
  1599. cursor: pointer;
  1600. img{
  1601. width:16px;
  1602. height:16px;
  1603. margin:10px 14px 0 19px;
  1604. }
  1605. }
  1606. .check-button-box-colorA{
  1607. background: #CCE6FE;
  1608. color:#0183FA;
  1609. }
  1610. .check-button-box-colorB{
  1611. background: #E0E0E0;
  1612. color:#333;
  1613. }
  1614. }
  1615. }
  1616. }
  1617. }
  1618. }
  1619. }
  1620. }
  1621. }
  1622. .bottom-button-box{
  1623. display: flex;
  1624. width:300px;
  1625. margin:30px auto 10px;
  1626. p:nth-child(1){
  1627. width:100px;
  1628. margin-right:20px;
  1629. }
  1630. p:nth-child(2){
  1631. width:180px;
  1632. }
  1633. }
  1634. }
  1635. </style>
  1636. <style lang="scss">
  1637. .teacher-add-page{
  1638. .top-info-box{
  1639. .el-form-item{
  1640. height:70px;
  1641. }
  1642. .el-input--small{
  1643. width:180px!important;
  1644. }
  1645. .el-select{
  1646. width:180px!important;
  1647. }
  1648. .el-input{
  1649. width:180px!important;
  1650. }
  1651. .el-input__inner{
  1652. width:180px!important;
  1653. }
  1654. .el-radio-group{
  1655. width:180px!important;
  1656. }
  1657. .is-disabled{
  1658. width:180px!important;
  1659. }
  1660. .switch .el-switch__label {
  1661. position: absolute;
  1662. display: none;
  1663. color: #fff !important;
  1664. }
  1665. .switch .el-switch__label--right {
  1666. z-index: 1;
  1667. }
  1668. .switch .el-switch__label--right span{
  1669. margin-left: 10px;
  1670. }
  1671. .switch .el-switch__label--left {
  1672. z-index: 1;
  1673. }
  1674. .switch .el-switch__label--left span{
  1675. margin-left: 24px;
  1676. }
  1677. .switch .el-switch__label.is-active {
  1678. display: block;
  1679. }
  1680. .switch.el-switch .el-switch__core,
  1681. .el-switch .el-switch__label {
  1682. width: 64px !important;
  1683. margin: 0;
  1684. }
  1685. }
  1686. }
  1687. .managePermissionTemplates-permission-dialog-box{
  1688. *{
  1689. margin:0;
  1690. }
  1691. .title-p{
  1692. font-size:15px;
  1693. font-weight:700;
  1694. margin-bottom:30px;
  1695. }
  1696. .managePermissionTemplates-permission-dialog-form-box{
  1697. .title-box{
  1698. display: flex;
  1699. height: 60px;
  1700. background: #F5F5F5;
  1701. .left-title-p{
  1702. width:198px;
  1703. border-right:1px solid #E0E0E0;
  1704. font-size:15px;
  1705. font-weight:700;
  1706. padding-left:26px;
  1707. line-height:60px;
  1708. color:#333;
  1709. }
  1710. .right-box{
  1711. flex:1;
  1712. .right-box-min{
  1713. height:20px;
  1714. margin:20px 0 0 50px;
  1715. .el-checkbox__label{
  1716. font-size:15px;
  1717. font-weight:700;
  1718. }
  1719. }
  1720. }
  1721. }
  1722. .check-box{
  1723. display: flex;
  1724. .left-title-box{
  1725. width:198px;
  1726. border:1px solid #E0E0E0;
  1727. position: relative;
  1728. .left-title-p{
  1729. position: absolute;
  1730. left:27px;
  1731. height:20px;
  1732. line-height:20px;
  1733. top:50%;
  1734. margin-top:-10px;
  1735. }
  1736. }
  1737. .right-box{
  1738. padding:0 50px 41px 0;
  1739. flex:1;
  1740. border:1px solid #E0E0E0;
  1741. border-left:none;
  1742. .for-check-box{
  1743. margin:41px 0 0 50px;
  1744. }
  1745. }
  1746. }
  1747. }
  1748. .managePermissionTemplates-permission-dialog-button-box{
  1749. display: flex;
  1750. width:160px;
  1751. margin:0 auto;
  1752. p{
  1753. margin:0;
  1754. width:70px;
  1755. height:30px;
  1756. line-height:30px;
  1757. font-size:14px;
  1758. }
  1759. p:nth-child(1){
  1760. margin-right:20px;
  1761. }
  1762. }
  1763. }
  1764. .managePermissionTemplates-dept-dialog-box{
  1765. *{
  1766. margin:0;
  1767. }
  1768. .managePermissionTemplates-dept-dialog-button-box{
  1769. display: flex;
  1770. width:190px;
  1771. margin:0 auto;
  1772. p{
  1773. margin:0;
  1774. width:70px;
  1775. height:30px;
  1776. line-height:30px;
  1777. font-size:14px;
  1778. }
  1779. p:nth-child(1){
  1780. margin-right:50px;
  1781. }
  1782. }
  1783. }
  1784. </style>