addPageOne.vue 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789
  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. let obj = {
  634. name:this.saveForm.name,
  635. type:this.saveForm.type,
  636. remark:this.saveForm.text,
  637. permitMenus:[]
  638. };
  639. for(let i=0;i<list.length;i++){
  640. let minObj = {
  641. menuId:list[i].menuId,
  642. }
  643. if(list[i].dataScope){
  644. minObj.dataScope = list[i].dataScope
  645. if(list[i].dataScope == 3){
  646. minObj.deptIds = list[i].deptIds;
  647. minObj.deptIdsList = list[i].deptIdsList;
  648. }
  649. }else{
  650. minObj.dataScope = 0
  651. }
  652. obj.permitMenus.push(minObj)
  653. }
  654. if(!obj.permitMenus[0]){
  655. this.msgError('请先勾选权限项');
  656. return
  657. }
  658. this.addSystemPermit(obj);
  659. }
  660. })
  661. },
  662. //保存权限
  663. addSystemPermit(obj){
  664. addSystemPermit(obj).then(response => {
  665. if(response.code == 200){
  666. this.saveOpenOff();
  667. this.msgSuccess(response.msg);
  668. }
  669. });
  670. },
  671. //根据选择人员获取权限
  672. takeUserData(ids){
  673. this.userPermit(ids[0]);
  674. this.$refs.userOpen.show();
  675. },
  676. //提交按钮
  677. upDataButton(){
  678. this.$refs["form"].validate(valid => {
  679. if (valid) {
  680. if(this.form.email){
  681. let re = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
  682. if(!re.test(this.form.email)){
  683. this.msgError('请输入正确的邮箱地址')
  684. return
  685. }
  686. }
  687. let list = this.toArray();
  688. let obj = JSON.parse(JSON.stringify(this.form));
  689. obj.permitMenus = [];
  690. if(obj.status == 0){
  691. for(let i=0;i<list.length;i++){
  692. let minObj = {
  693. menuId:list[i].menuId,
  694. }
  695. if(list[i].dataScope){
  696. minObj.dataScope = list[i].dataScope
  697. if(list[i].dataScope == 3){
  698. minObj.deptIds = list[i].deptIds;
  699. minObj.deptIdsList = list[i].deptIdsList;
  700. }
  701. }else{
  702. minObj.dataScope = 0
  703. }
  704. obj.permitMenus.push(minObj)
  705. }
  706. }
  707. if(this.propsData.userId){
  708. //修改
  709. obj.userId = this.propsData.userId;
  710. this.putUserTeacherNew(obj);
  711. }else{
  712. //发布
  713. this.addUserTeacher(obj);
  714. }
  715. }
  716. });
  717. },
  718. putUserTeacherNew(obj){
  719. putUserTeacherNew(obj).then(response => {
  720. if(response.code == 200){
  721. this.msgSuccess(response.msg);
  722. this.outPageButton();
  723. }
  724. });
  725. },
  726. addUserTeacher(obj){
  727. addUserTeacher(obj).then(response => {
  728. if(response.code == 200){
  729. this.msgSuccess(response.msg);
  730. this.outPageButton();
  731. }
  732. });
  733. },
  734. //根据用户查询权限
  735. userPermit(userId){
  736. let self = this;
  737. userPermit(userId).then(response => {
  738. if(response.code == 200){
  739. let newList = JSON.parse(JSON.stringify(this.originalMenuList));
  740. for(let i=0;i<response.data.length;i++){
  741. for(let o=0;o<newList.length;o++){
  742. if(response.data[i].menuId == newList[o].menuId){
  743. newList[o].checkType = true;
  744. if(response.data[i].dataScope == 3){
  745. newList[o].dataScope = response.data[i].dataScope;
  746. newList[o].deptIds =response.data[i].deptIds;
  747. newList[o].deptIdsList =response.data[i].deptIdsList;
  748. newList[o].scopeCheckType = true;
  749. }else if(response.data[i].dataScope != 0){
  750. newList[o].dataScope = response.data[i].dataScope;
  751. newList[o].scopeCheckType = true;
  752. }
  753. }
  754. if(response.data[i].menuType == 'F' && response.data[i].parentId == newList[o].menuId && !newList[o].permissionCheckType){
  755. newList[o].permissionCheckType = true;
  756. }
  757. }
  758. }
  759. let newMenu = JSON.parse(JSON.stringify(this.handleTree(newList, "menuId")))
  760. this.$set(this,'menuList',newMenu);
  761. }
  762. });
  763. },
  764. getAll(){
  765. //身份
  766. optionselect({postName:""}).then(response => {
  767. this.positionOptions = response.data;
  768. });
  769. //职称
  770. getVaguet({dictType:"professional",dictLabel:""}).then(response => {
  771. this.categoryOptions = response.data;
  772. });
  773. //文化程度
  774. getVaguet({dictType:"education",dictLabel:""}).then(response => {
  775. this.educationOptions = response.data;
  776. });
  777. },
  778. //获取快捷权限列表
  779. getPermitOptionList(){
  780. getPermitOptionList().then(response => {
  781. this.templateList = response.data
  782. });
  783. },
  784. //查询身份
  785. positionSelect(query){
  786. if (query !== '') {
  787. let obj = {
  788. postName:query,
  789. };
  790. optionselect(obj).then(response => {
  791. this.positionOptions = response.data;
  792. });
  793. } else {
  794. this.positionOptions = [];
  795. }
  796. },
  797. positionSelectClick(){
  798. },
  799. positionClearClick(){
  800. },
  801. //查询职称列表
  802. categorySelect(query){
  803. if (query !== '') {
  804. let obj = {
  805. dictType:"professional",
  806. dictLabel:query
  807. };
  808. getVaguet(obj).then(response => {
  809. this.categoryOptions = response.data;
  810. });
  811. } else {
  812. this.categoryOptions = [];
  813. }
  814. },
  815. categorySelectClick(){
  816. },
  817. categoryClearClick(){
  818. },
  819. //查询文化程度
  820. educationSelect(query){
  821. if (query !== '') {
  822. let obj = {
  823. dictType:"education",
  824. dictLabel:query
  825. };
  826. getVaguet(obj).then(response => {
  827. this.educationOptions = response.data;
  828. });
  829. } else {
  830. this.educationOptions = [];
  831. }
  832. },
  833. educationSelectClick(){
  834. },
  835. educationClearClick(){
  836. },
  837. /** 查询部门下拉树结构 */
  838. getTreeselect() {
  839. treeselect().then(response => {
  840. this.deptOptions = response.data;
  841. this.$set(this,'treeselectList',response.data[0].children);
  842. });
  843. },
  844. natureCaptcha(){
  845. this.form.nature = this.form.nature == 1?'0':'1';
  846. if(this.form.nature == 1){
  847. this.form.status = 1;
  848. }
  849. },
  850. isCheckCaptcha(){
  851. this.form.isCheck = this.form.isCheck == 1?0:1;
  852. },
  853. statusCaptcha(){
  854. this.form.status = this.form.status == 1?'0':'1';
  855. },
  856. //上传
  857. handleAvatarSuccess(res, file) {
  858. this.form.avatar = res.data.url;
  859. this.$forceUpdate()
  860. },
  861. beforeAvatarUpload(file) {
  862. let type = false;
  863. if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/gif') {
  864. type = true;
  865. }else{
  866. this.$message.error('只能上传png/jpeg/gif格式图片');
  867. type = false;
  868. }
  869. return type;
  870. },
  871. //导入用户权限
  872. importUser(){
  873. this.$refs.userOpen.show();
  874. },
  875. //返回事件
  876. outPageButton(){
  877. this.$parent.outPage(1);
  878. },
  879. //模板选中
  880. templateClick(id){
  881. let self = this;
  882. getPermitInfo(id).then(response => {
  883. for(let a=0;a<response.data.length;a++){
  884. if(response.data[a].isRequired == 1){
  885. response.data[a].checkType = true;
  886. }
  887. }
  888. let newList = JSON.parse(JSON.stringify(this.originalMenuList));
  889. for(let i=0;i<response.data.permitMenus.length;i++){
  890. for(let o=0;o<newList.length;o++){
  891. if(response.data.permitMenus[i].menuId == newList[o].menuId){
  892. newList[o].checkType = true;
  893. if(response.data.permitMenus[i].dataScope == 3){
  894. newList[o].dataScope = response.data.permitMenus[i].dataScope;
  895. newList[o].deptIds =response.data.permitMenus[i].deptIds;
  896. newList[o].deptIdsList =response.data.permitMenus[i].deptIdsList;
  897. newList[o].scopeCheckType = true;
  898. }else if(response.data.permitMenus[i].dataScope != 0){
  899. newList[o].dataScope = response.data.permitMenus[i].dataScope;
  900. newList[o].scopeCheckType = true;
  901. }
  902. }
  903. if(response.data.permitMenus[i].menuType == 'F' && response.data.permitMenus[i].parentId == newList[o].menuId && !newList[o].permissionCheckType){
  904. newList[o].permissionCheckType = true;
  905. }
  906. }
  907. }
  908. this.menuList = JSON.parse(JSON.stringify(this.handleTree(newList, "menuId")))
  909. });
  910. if(this.templateKey != id){
  911. this.templateKey = id;
  912. for(let i=0;i<self.templateList.length;i++){
  913. if(id == self.templateList[i].id){
  914. this.templateName = self.templateList[i].name;
  915. }
  916. }
  917. }else{
  918. this.templateKey = "";
  919. this.templateName = "";
  920. }
  921. this.$forceUpdate();
  922. },
  923. //清除模板选中
  924. templateDel(){
  925. this.templateKey = "";
  926. this.templateName = "";
  927. this.$set(this,'menuList',JSON.parse(JSON.stringify(this.menuListData)))
  928. },
  929. //权限详情按钮
  930. permissionDetails(obj,maxIndex,bigIndex,minIndex){
  931. let item = JSON.parse(JSON.stringify(obj));
  932. this.maxIndex = maxIndex;
  933. this.bigIndex = bigIndex;
  934. this.minIndex = minIndex;
  935. let num = 0;
  936. for(let i=0;i<item.children.length;i++){
  937. if(item.children[i].checkType){
  938. num++
  939. }
  940. }
  941. this.allCheckType = num != 0;
  942. this.$set(this,'permissionCheckData',item)
  943. this.permissionOpen = true;
  944. },
  945. surePermissionOpen(){
  946. if(this.maxIndex != undefined && this.bigIndex != undefined && this.minIndex != undefined){
  947. this.menuList[this.maxIndex].children[this.bigIndex].children[this.minIndex] = JSON.parse(JSON.stringify(this.permissionCheckData));
  948. this.menuList[this.maxIndex].children[this.bigIndex].children[this.minIndex].permissionCheckType = JSON.parse(JSON.stringify(this.allCheckType))
  949. }else if(this.maxIndex != undefined && this.bigIndex != undefined){
  950. this.menuList[this.maxIndex].children[this.bigIndex] = JSON.parse(JSON.stringify(this.permissionCheckData));
  951. this.menuList[this.maxIndex].children[this.bigIndex].permissionCheckType = JSON.parse(JSON.stringify(this.allCheckType))
  952. }else if(this.maxIndex != undefined){
  953. this.menuList[this.maxIndex] = JSON.parse(JSON.stringify(this.permissionCheckData));
  954. this.menuList[this.maxIndex].permissionCheckType = JSON.parse(JSON.stringify(this.allCheckType))
  955. }
  956. this.permissionOpen = false;
  957. },
  958. permissionOpenOff(){
  959. this.permissionOpen = false;
  960. },
  961. //展开时触发
  962. visibleChange(type,item,maxIndex,bigIndex,minIndex){
  963. if(type){
  964. if(minIndex!=undefined){
  965. this.deptOpenType = this.menuList[maxIndex].children[bigIndex].children[minIndex].dataScope
  966. }else{
  967. this.deptOpenType = this.menuList[maxIndex].children[bigIndex].dataScope
  968. }
  969. }
  970. },
  971. //数据范围选中指定部门
  972. optionChange(type,item,maxIndex,bigIndex,minIndex){
  973. if(type == 3){
  974. if(item.deptIdsList){
  975. this.deptForm.deptIds = JSON.parse(item.deptIdsList);
  976. }else{
  977. this.deptForm.deptIds = "";
  978. }
  979. this.deptForm.maxIndex = maxIndex;
  980. this.deptForm.bigIndex = bigIndex;
  981. this.deptForm.minIndex = minIndex;
  982. this.deptForm.dataScope = item.dataScope;
  983. this.deptOpen = true;
  984. }
  985. this.$forceUpdate()
  986. },
  987. //指定部门弹窗取消
  988. deptCancel(){
  989. if(this.deptForm.minIndex || this.deptForm.minIndex == 0){
  990. this.$set(this.menuList[this.deptForm.maxIndex].children[this.deptForm.bigIndex].children[this.deptForm.minIndex],'dataScope',this.deptOpenType)
  991. }else{
  992. this.$set(this.menuList[this.deptForm.maxIndex].children[this.deptForm.bigIndex],'dataScope',this.deptOpenType)
  993. }
  994. this.deptForm.deptIds = [];
  995. this.deptForm.maxIndex = "";
  996. this.deptForm.bigIndex = "";
  997. this.deptForm.minIndex = "";
  998. this.deptForm.dataScope = "";
  999. this.deptOpen = false;
  1000. this.$forceUpdate()
  1001. },
  1002. //指定部门弹窗确定
  1003. deptSure(){
  1004. let self = this;
  1005. this.$refs["deptForm"].validate(valid => {
  1006. if (valid) {
  1007. let list = [];
  1008. for(let i=0;i<self.deptForm.deptIds.length;i++){
  1009. for(let o=0;o<self.deptForm.deptIds[i].length;o++){
  1010. list.push(self.deptForm.deptIds[i][o])
  1011. }
  1012. }
  1013. let newList = [];
  1014. for (var i = 0,len=list.length; i < len; i++) {
  1015. if(newList.indexOf(list[i]) === -1){
  1016. newList.push(list[i]);
  1017. }
  1018. }
  1019. if(this.deptForm.minIndex || this.deptForm.minIndex == 0){
  1020. this.$set(this.menuList[this.deptForm.maxIndex].children[this.deptForm.bigIndex].children[this.deptForm.minIndex],'deptIds',newList)
  1021. this.$set(this.menuList[this.deptForm.maxIndex].children[this.deptForm.bigIndex].children[this.deptForm.minIndex],'deptIdsList',JSON.stringify(self.deptForm.deptIds))
  1022. }else{
  1023. this.$set(this.menuList[this.deptForm.maxIndex].children[this.deptForm.bigIndex],'deptIds',newList)
  1024. this.$set(this.menuList[this.deptForm.maxIndex].children[this.deptForm.bigIndex],'deptIdsList',JSON.stringify(self.deptForm.deptIds))
  1025. }
  1026. this.deptOpen = false;
  1027. this.deptForm.deptIds = [];
  1028. this.deptForm.maxIndex = "";
  1029. this.deptForm.bigIndex = "";
  1030. this.deptForm.minIndex = "";
  1031. this.deptForm.dataScope = "";
  1032. this.$forceUpdate()
  1033. }
  1034. });
  1035. },
  1036. //模块勾选逻辑
  1037. itemCheckClick(status,type,item,bigItem,maxItem){
  1038. if(status == 1 || status == 2 || status == 3){
  1039. //一级菜单勾选
  1040. if(item.children){
  1041. for(let i=0;i<item.children.length;i++){
  1042. item.children[i].checkType = !!type;
  1043. if(item.children[i].children){
  1044. for(let o=0;o<item.children[i].children.length;o++){
  1045. item.children[i].children[o].checkType = !!type;
  1046. if(item.children[i].children[o].children){
  1047. for(let x=0;x<item.children[i].children[o].children.length;x++){
  1048. item.children[i].children[o].children[x].checkType = !!type;
  1049. }
  1050. }
  1051. if(item.children[i].children[o].menuType == 'C'){
  1052. item.children[i].children[o].scopeCheckType = !!type;
  1053. item.children[i].children[o].dataScope = type?1:"";
  1054. item.children[i].children[o].permissionCheckType = !!type;
  1055. }
  1056. }
  1057. }
  1058. if(item.children[i].menuType == 'C'){
  1059. item.children[i].scopeCheckType = !!type;
  1060. item.children[i].dataScope = type?1:"";
  1061. item.children[i].permissionCheckType = !!type;
  1062. }
  1063. }
  1064. }
  1065. if(item.menuType == 'C'){
  1066. item.scopeCheckType = !!type;
  1067. item.dataScope = type?1:"";
  1068. item.permissionCheckType = !!type;
  1069. }
  1070. if(bigItem&&type){
  1071. bigItem.checkType = type;
  1072. }
  1073. if(maxItem&&type){
  1074. maxItem.checkType = type;
  1075. }
  1076. }else if(status == 4){
  1077. //数据范围勾选
  1078. item.scopeCheckType = !!type;
  1079. item.dataScope = type?1:"";
  1080. }else if(status == 5){
  1081. //管理权限勾选
  1082. item.permissionCheckType = !!type;
  1083. for(let i=0;i<item.children.length;i++){
  1084. item.children[i].checkType = !!type;
  1085. }
  1086. }
  1087. },
  1088. //权限勾选逻辑
  1089. permissionCheckClick(status,type){
  1090. let self = this;
  1091. if(status == 1){
  1092. for(let i=0;i<self.permissionCheckData.children.length;i++){
  1093. self.permissionCheckData.children[i].checkType = !!type;
  1094. self.permissionCheckData.permissionCheckType = !!type;
  1095. }
  1096. }else if(status == 2){
  1097. if(type&&!this.allCheckType){
  1098. this.allCheckType = true;
  1099. this.permissionCheckData.permissionCheckType = true;
  1100. }else{
  1101. let num = 0;
  1102. for(let i=0;i<self.permissionCheckData.children.length;i++){
  1103. if(!self.permissionCheckData.children[i].checkType){
  1104. num++
  1105. }
  1106. }
  1107. if(num == self.permissionCheckData.children.length){
  1108. this.allCheckType = false;
  1109. this.permissionCheckData.permissionCheckType = false;
  1110. }
  1111. }
  1112. }
  1113. this.$forceUpdate();
  1114. },
  1115. showText(){
  1116. this.textType = true;
  1117. },
  1118. hideText(){
  1119. this.textType = false;
  1120. },
  1121. /** 查询菜单列表 */
  1122. getMenuOne(){
  1123. let self = this;
  1124. this.loading = true;
  1125. listMenuAll(this.queryParams).then(response => {
  1126. for(let a=0;a<response.data.length;a++){
  1127. if(response.data[a].isRequired == 1){
  1128. response.data[a].checkType = true;
  1129. }
  1130. }
  1131. if(this.propsData.userId){
  1132. let newList = JSON.parse(JSON.stringify(response.data));
  1133. this.form.name = this.propsData.name;
  1134. this.form.type = this.propsData.type;
  1135. this.form.text = this.propsData.remark;
  1136. for(let i=0;i<self.propsData.permitMenus.length;i++){
  1137. for(let o=0;o<newList.length;o++){
  1138. if(self.propsData.permitMenus[i].menuId == newList[o].menuId){
  1139. newList[o].checkType = true;
  1140. if(self.propsData.permitMenus[i].dataScope == 3){
  1141. newList[o].dataScope = self.propsData.permitMenus[i].dataScope;
  1142. newList[o].deptIds =self.propsData.permitMenus[i].deptIds;
  1143. newList[o].scopeCheckType = true;
  1144. }else if(self.propsData.permitMenus[i].dataScope != 0){
  1145. newList[o].dataScope = self.propsData.permitMenus[i].dataScope;
  1146. newList[o].scopeCheckType = true;
  1147. }
  1148. }
  1149. if(self.propsData.permitMenus[i].menuType == 'F' && self.propsData.permitMenus[i].parentId == newList[o].menuId && !newList[o].permissionCheckType){
  1150. newList[o].permissionCheckType = true;
  1151. }
  1152. }
  1153. }
  1154. this.menuList = JSON.parse(JSON.stringify(this.handleTree(newList, "menuId")))
  1155. this.menuListData = JSON.parse(JSON.stringify(this.handleTree(response.data, "menuId")))
  1156. this.originalMenuList = JSON.parse(JSON.stringify(response.data));
  1157. }else{
  1158. this.menuList = JSON.parse(JSON.stringify(this.handleTree(response.data, "menuId")))
  1159. this.menuListData = JSON.parse(JSON.stringify(this.handleTree(response.data, "menuId")))
  1160. this.originalMenuList = JSON.parse(JSON.stringify(response.data));
  1161. }
  1162. this.loading = false;
  1163. this.userPermit(this.propsData.userId);
  1164. });
  1165. },
  1166. getMenu() {
  1167. let self = this;
  1168. this.loading = true;
  1169. listMenuAll(this.queryParams).then(response => {
  1170. for(let a=0;a<response.data.length;a++){
  1171. if(response.data[a].isRequired == 1){
  1172. response.data[a].checkType = true;
  1173. }
  1174. }
  1175. if(this.propsData.userId){
  1176. let newList = JSON.parse(JSON.stringify(response.data));
  1177. this.form.name = this.propsData.name;
  1178. this.form.type = this.propsData.type;
  1179. this.form.text = this.propsData.remark;
  1180. for(let i=0;i<self.propsData.permitMenus.length;i++){
  1181. for(let o=0;o<newList.length;o++){
  1182. if(self.propsData.permitMenus[i].menuId == newList[o].menuId){
  1183. newList[o].checkType = true;
  1184. if(self.propsData.permitMenus[i].dataScope == 3){
  1185. newList[o].dataScope = self.propsData.permitMenus[i].dataScope;
  1186. newList[o].deptIds =self.propsData.permitMenus[i].deptIds;
  1187. newList[o].scopeCheckType = true;
  1188. }else if(self.propsData.permitMenus[i].dataScope != 0){
  1189. newList[o].dataScope = self.propsData.permitMenus[i].dataScope;
  1190. newList[o].scopeCheckType = true;
  1191. }
  1192. }
  1193. if(self.propsData.permitMenus[i].menuType == 'F' && self.propsData.permitMenus[i].parentId == newList[o].menuId && !newList[o].permissionCheckType){
  1194. newList[o].permissionCheckType = true;
  1195. }
  1196. }
  1197. }
  1198. this.menuList = JSON.parse(JSON.stringify(this.handleTree(newList, "menuId")))
  1199. this.menuListData = JSON.parse(JSON.stringify(this.handleTree(response.data, "menuId")))
  1200. this.originalMenuList = JSON.parse(JSON.stringify(response.data));
  1201. }else{
  1202. this.menuList = JSON.parse(JSON.stringify(this.handleTree(response.data, "menuId")))
  1203. this.menuListData = JSON.parse(JSON.stringify(this.handleTree(response.data, "menuId")))
  1204. this.originalMenuList = JSON.parse(JSON.stringify(response.data));
  1205. }
  1206. this.loading = false;
  1207. });
  1208. },
  1209. //结构树转数组并筛选选中项
  1210. toArray(){
  1211. let list = [];
  1212. let newList = JSON.parse(JSON.stringify(this.menuList));
  1213. for(let i=0;i<newList.length;i++){
  1214. pushNode(newList[i]);
  1215. }
  1216. function pushNode(node){
  1217. if(node.children){
  1218. for (let nodeItem of node.children){
  1219. pushNode(nodeItem)
  1220. }
  1221. delete node.children;
  1222. if(node.checkType){
  1223. list.push(node)
  1224. }
  1225. }else{
  1226. if(node.children){
  1227. delete node.children
  1228. }
  1229. if(node.checkType){
  1230. list.push(node)
  1231. }
  1232. }
  1233. }
  1234. return list
  1235. }
  1236. }
  1237. }
  1238. </script>
  1239. <style scoped lang="scss">
  1240. .teacher-add-page{
  1241. flex:1;
  1242. display: flex;
  1243. flex-direction: column;
  1244. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  1245. padding:0 0 20px!important;
  1246. overflow: hidden;
  1247. *{
  1248. margin:0;
  1249. }
  1250. .public-form-box{
  1251. flex:1;
  1252. overflow-y: scroll;
  1253. overflow-x: hidden;
  1254. }
  1255. .top-title-box{
  1256. border-bottom:1px solid #E0E0E0;
  1257. display: flex;
  1258. p:nth-child(1){
  1259. color:#0045AF;
  1260. line-height:80px;
  1261. margin-left:24px;
  1262. font-size:18px;
  1263. flex:1;
  1264. }
  1265. p:nth-child(2){
  1266. border:1px solid #0045AF;
  1267. color:#0045AF;
  1268. width:80px;
  1269. height:30px;
  1270. text-align: center;
  1271. font-size:16px;
  1272. border-radius: 6px;
  1273. line-height:30px;
  1274. margin:25px 20px 0 0;
  1275. cursor: pointer;
  1276. }
  1277. }
  1278. .top-info-box{
  1279. display: flex;
  1280. padding:40px 20px 0;
  1281. .left-info-box{
  1282. margin-right:20px;
  1283. img{
  1284. width:100px;
  1285. height:120px;
  1286. }
  1287. p{
  1288. width: 80px;
  1289. height: 26px;
  1290. border: 1px solid #0183FA;
  1291. border-radius: 6px;
  1292. line-height:24px;
  1293. font-size:12px;
  1294. color:#0183FA;
  1295. text-align: center;
  1296. margin:24px 10px;
  1297. }
  1298. }
  1299. }
  1300. .top-title-one{
  1301. display: flex;
  1302. border-top:1px solid #E0E0E0;
  1303. position: relative;
  1304. .title-p{
  1305. font-size:18px;
  1306. color:#0045AF;
  1307. line-height:80px;
  1308. margin-left:24px;
  1309. }
  1310. .img-p{
  1311. font-size:18px;
  1312. margin:0 10px;
  1313. line-height:80px;
  1314. color:#FFC000;
  1315. }
  1316. .position-box{
  1317. width: 420px;
  1318. height: 194px;
  1319. padding:20px;
  1320. background: #F5F5F5;
  1321. position: absolute;
  1322. top:10px;
  1323. left:134px;
  1324. p{
  1325. font-size:12px;
  1326. line-height:18px;
  1327. color:#333;
  1328. }
  1329. }
  1330. }
  1331. .name-input-box{
  1332. height:100px;
  1333. }
  1334. .for-button-list{
  1335. background: #E5F2FE;
  1336. margin:0 20px;
  1337. display: flex;
  1338. .for-title-p{
  1339. width:175px;
  1340. height:80px;
  1341. line-height:80px;
  1342. font-size:16px;
  1343. color:#333;
  1344. text-align: center;
  1345. }
  1346. .for-button-max-box{
  1347. flex:1;
  1348. .for-button-min-box{
  1349. font-size:16px;
  1350. display: inline-block;
  1351. overflow: hidden;
  1352. height:30px;
  1353. line-height:30px;
  1354. border-radius:6px;
  1355. margin:25px 28px 0 0;
  1356. cursor: pointer;
  1357. i{
  1358. height:30px;
  1359. line-height:30px;
  1360. font-size:16px;
  1361. color:#fff;
  1362. margin-right:6px;
  1363. }
  1364. }
  1365. .colorAA{
  1366. color: #ffffff;
  1367. background: #0183FA;
  1368. padding:0 26px 0 16px;
  1369. }
  1370. .colorBB{
  1371. padding:0 26px;
  1372. color: #333;
  1373. background: #E0E0E0;
  1374. }
  1375. }
  1376. }
  1377. .template-name-box{
  1378. display: flex;
  1379. .template-name-p{
  1380. font-weight:500;
  1381. height:80px;
  1382. line-height:80px;
  1383. font-size:16px;
  1384. color:#333;
  1385. margin-left:20px;
  1386. flex: 1;
  1387. }
  1388. .template-name-button{
  1389. width:80px;
  1390. height:40px;
  1391. line-height:40px;
  1392. margin:20px 20px 0 0;
  1393. }
  1394. .template-name-button-one{
  1395. width:180px;
  1396. height:40px;
  1397. line-height:40px;
  1398. margin:20px 40px 0 0;
  1399. color:#fff;
  1400. background: #0183FA;
  1401. border: 1px solid #E0E0E0;
  1402. cursor: pointer;
  1403. font-size: 14px;
  1404. text-align: center;
  1405. border-radius: 6px;
  1406. }
  1407. }
  1408. .table-for-max-box{
  1409. border:1px solid #D7D7D7;
  1410. margin:0 20px;
  1411. *{
  1412. margin:0;
  1413. padding:0;
  1414. }
  1415. .table-title-box{
  1416. background: rgba(1,131,250,0.1);
  1417. display: flex;
  1418. p{
  1419. font-size:14px;
  1420. font-weight:700;
  1421. color:#333;
  1422. line-height:48px;
  1423. padding-left:20px;
  1424. }
  1425. p:nth-child(1){
  1426. width:615px;
  1427. border-right:1px solid #D7D7D7;
  1428. }
  1429. }
  1430. .table-for-big-box{
  1431. border-top:1px solid #D7D7D7;
  1432. display: flex;
  1433. font-size:14px;
  1434. .max-title-box-null{
  1435. width:615px!important;
  1436. }
  1437. .max-title-box{
  1438. width:230px;
  1439. border-right:1px solid #D7D7D7;
  1440. min-height:48px;
  1441. position: relative;
  1442. p{
  1443. position: absolute;
  1444. top:50%;
  1445. left:20px;
  1446. height:18px;
  1447. line-height:18px;
  1448. margin-top:-9px;
  1449. }
  1450. }
  1451. .max-right-box{
  1452. flex:5;
  1453. min-height:48px;
  1454. .big-box:nth-child(1){
  1455. border:none!important;
  1456. }
  1457. .big-box-null{
  1458. line-height:48px;
  1459. margin-left:20px;
  1460. color:#606266;
  1461. }
  1462. .big-box{
  1463. display: flex;
  1464. border-top:1px solid #D7D7D7;
  1465. .big-title-box-null{
  1466. width:385px!important;
  1467. }
  1468. .big-title-box{
  1469. width:180px;
  1470. border-right:1px solid #D7D7D7;
  1471. min-height:48px;
  1472. position: relative;
  1473. overflow: hidden;
  1474. p{
  1475. position: absolute;
  1476. top:50%;
  1477. left:20px;
  1478. height:48px;
  1479. line-height:48px;
  1480. margin-top:-24px;
  1481. }
  1482. }
  1483. .big-right-box-null{
  1484. display: flex;
  1485. .scope-box{
  1486. width:430px;
  1487. position: relative;
  1488. overflow: hidden;
  1489. border-right:1px solid #D7D7D7;
  1490. p{
  1491. position: absolute;
  1492. top:50%;
  1493. left:20px;
  1494. height:48px;
  1495. line-height:48px;
  1496. margin-top:-24px;
  1497. }
  1498. }
  1499. .permission-box{
  1500. flex:1;
  1501. position: relative;
  1502. overflow: hidden;
  1503. display: flex;
  1504. .check-left-p{
  1505. margin-left:20px;
  1506. height:48px;
  1507. line-height:48px;
  1508. }
  1509. .check-button-box{
  1510. width:130px;
  1511. height:36px;
  1512. margin:6px 0 0 36px;
  1513. line-height:36px;
  1514. display: flex;
  1515. color:#333;
  1516. cursor: pointer;
  1517. img{
  1518. width:16px;
  1519. height:16px;
  1520. margin:10px 14px 0 19px;
  1521. }
  1522. }
  1523. .check-button-box-colorA{
  1524. background: #CCE6FE;
  1525. color:#0183FA;
  1526. }
  1527. .check-button-box-colorB{
  1528. background: #E0E0E0;
  1529. color:#333;
  1530. }
  1531. }
  1532. }
  1533. .big-right-box{
  1534. flex:5;
  1535. min-height:48px;
  1536. .min-box:nth-child(1){
  1537. border:none!important;
  1538. }
  1539. .min-box{
  1540. display: flex;
  1541. border-top:1px solid #D7D7D7;
  1542. .min-title-box{
  1543. width:205px;
  1544. border-right:1px solid #D7D7D7;
  1545. min-height:48px;
  1546. position: relative;
  1547. overflow: hidden;
  1548. p{
  1549. position: absolute;
  1550. top:50%;
  1551. left:20px;
  1552. height:48px;
  1553. line-height:48px;
  1554. margin-top:-24px;
  1555. }
  1556. }
  1557. .min-right-box{
  1558. flex:5;
  1559. min-height:48px;
  1560. display: flex;
  1561. .scope-box{
  1562. width:430px;
  1563. position: relative;
  1564. overflow: hidden;
  1565. border-right:1px solid #D7D7D7;
  1566. p{
  1567. position: absolute;
  1568. top:50%;
  1569. left:20px;
  1570. height:48px;
  1571. line-height:48px;
  1572. margin-top:-24px;
  1573. }
  1574. }
  1575. .permission-box{
  1576. flex:1;
  1577. position: relative;
  1578. overflow: hidden;
  1579. display: flex;
  1580. .check-left-p{
  1581. margin-left:20px;
  1582. height:48px;
  1583. line-height:48px;
  1584. }
  1585. .check-button-box{
  1586. width:130px;
  1587. height:36px;
  1588. margin:6px 0 0 36px;
  1589. line-height:36px;
  1590. display: flex;
  1591. color:#333;
  1592. cursor: pointer;
  1593. img{
  1594. width:16px;
  1595. height:16px;
  1596. margin:10px 14px 0 19px;
  1597. }
  1598. }
  1599. .check-button-box-colorA{
  1600. background: #CCE6FE;
  1601. color:#0183FA;
  1602. }
  1603. .check-button-box-colorB{
  1604. background: #E0E0E0;
  1605. color:#333;
  1606. }
  1607. }
  1608. }
  1609. }
  1610. }
  1611. }
  1612. }
  1613. }
  1614. }
  1615. .bottom-button-box{
  1616. display: flex;
  1617. width:300px;
  1618. margin:30px auto 10px;
  1619. p:nth-child(1){
  1620. width:100px;
  1621. margin-right:20px;
  1622. }
  1623. p:nth-child(2){
  1624. width:180px;
  1625. }
  1626. }
  1627. }
  1628. </style>
  1629. <style lang="scss">
  1630. .teacher-add-page{
  1631. .top-info-box{
  1632. .el-form-item{
  1633. height:70px;
  1634. }
  1635. .el-input--small{
  1636. width:180px!important;
  1637. }
  1638. .el-select{
  1639. width:180px!important;
  1640. }
  1641. .el-input{
  1642. width:180px!important;
  1643. }
  1644. .el-input__inner{
  1645. width:180px!important;
  1646. }
  1647. .el-radio-group{
  1648. width:180px!important;
  1649. }
  1650. .is-disabled{
  1651. width:180px!important;
  1652. }
  1653. .switch .el-switch__label {
  1654. position: absolute;
  1655. display: none;
  1656. color: #fff !important;
  1657. }
  1658. .switch .el-switch__label--right {
  1659. z-index: 1;
  1660. }
  1661. .switch .el-switch__label--right span{
  1662. margin-left: 10px;
  1663. }
  1664. .switch .el-switch__label--left {
  1665. z-index: 1;
  1666. }
  1667. .switch .el-switch__label--left span{
  1668. margin-left: 24px;
  1669. }
  1670. .switch .el-switch__label.is-active {
  1671. display: block;
  1672. }
  1673. .switch.el-switch .el-switch__core,
  1674. .el-switch .el-switch__label {
  1675. width: 64px !important;
  1676. margin: 0;
  1677. }
  1678. }
  1679. }
  1680. .managePermissionTemplates-permission-dialog-box{
  1681. *{
  1682. margin:0;
  1683. }
  1684. .title-p{
  1685. font-size:15px;
  1686. font-weight:700;
  1687. margin-bottom:30px;
  1688. }
  1689. .managePermissionTemplates-permission-dialog-form-box{
  1690. .title-box{
  1691. display: flex;
  1692. height: 60px;
  1693. background: #F5F5F5;
  1694. .left-title-p{
  1695. width:198px;
  1696. border-right:1px solid #E0E0E0;
  1697. font-size:15px;
  1698. font-weight:700;
  1699. padding-left:26px;
  1700. line-height:60px;
  1701. color:#333;
  1702. }
  1703. .right-box{
  1704. flex:1;
  1705. .right-box-min{
  1706. height:20px;
  1707. margin:20px 0 0 50px;
  1708. .el-checkbox__label{
  1709. font-size:15px;
  1710. font-weight:700;
  1711. }
  1712. }
  1713. }
  1714. }
  1715. .check-box{
  1716. display: flex;
  1717. .left-title-box{
  1718. width:198px;
  1719. border:1px solid #E0E0E0;
  1720. position: relative;
  1721. .left-title-p{
  1722. position: absolute;
  1723. left:27px;
  1724. height:20px;
  1725. line-height:20px;
  1726. top:50%;
  1727. margin-top:-10px;
  1728. }
  1729. }
  1730. .right-box{
  1731. padding:0 50px 41px 0;
  1732. flex:1;
  1733. border:1px solid #E0E0E0;
  1734. border-left:none;
  1735. .for-check-box{
  1736. margin:41px 0 0 50px;
  1737. }
  1738. }
  1739. }
  1740. }
  1741. .managePermissionTemplates-permission-dialog-button-box{
  1742. display: flex;
  1743. width:160px;
  1744. margin:0 auto;
  1745. p{
  1746. margin:0;
  1747. width:70px;
  1748. height:30px;
  1749. line-height:30px;
  1750. font-size:14px;
  1751. }
  1752. p:nth-child(1){
  1753. margin-right:20px;
  1754. }
  1755. }
  1756. }
  1757. .managePermissionTemplates-dept-dialog-box{
  1758. *{
  1759. margin:0;
  1760. }
  1761. .managePermissionTemplates-dept-dialog-button-box{
  1762. display: flex;
  1763. width:190px;
  1764. margin:0 auto;
  1765. p{
  1766. margin:0;
  1767. width:70px;
  1768. height:30px;
  1769. line-height:30px;
  1770. font-size:14px;
  1771. }
  1772. p:nth-child(1){
  1773. margin-right:50px;
  1774. }
  1775. }
  1776. }
  1777. </style>