addPage.vue 62 KB

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