addPage.vue 62 KB

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