role.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092
  1. <template>
  2. <div class="content-box">
  3. <div class="left">
  4. <!-- <el-icon :size="23" class="camera"><VideoCameraFilled /></el-icon> -->
  5. <span class="cameratxt">角色管理</span>
  6. </div>
  7. <div class="middle">
  8. <div class="filter">
  9. <div class="condition">
  10. <span>角色名称 </span>
  11. <el-input
  12. clearable
  13. v-model="searchInput.roleName"
  14. @clear="searchBtn"
  15. class="w-50 m-2"
  16. placeholder="请输入角色名称"
  17. style="width: 250px"
  18. />
  19. </div>
  20. <div class="condition">
  21. <span>创建时间 </span>
  22. <el-date-picker
  23. v-model="searchInput.createTime"
  24. type="daterange"
  25. unlink-panels
  26. range-separator="-"
  27. start-placeholder="起始时间"
  28. end-placeholder="截止时间"
  29. format="YYYY-MM-DD"
  30. value-format="YYYY-MM-DD"
  31. :prefix-icon="Calendar"
  32. placeholder="请选择日期"
  33. style="width: 280px"
  34. @change="searchBtn"
  35. />
  36. </div>
  37. <el-button
  38. style="margin-left: 20px"
  39. type="primary"
  40. class="search"
  41. @click="searchBtn"
  42. >查询</el-button
  43. >
  44. <!-- <el-button
  45. style="margin-left: 20px"
  46. class="reset"
  47. @click="resetSearchBtn"
  48. >重置</el-button
  49. > -->
  50. </div>
  51. <!-- 按钮列表 -->
  52. <div class="gongneng">
  53. <el-button v-if="btnFlag('role-chuangjianjuese')" @click="addProjectbtn(1)" class="add"
  54. ><el-icon> <CirclePlus /> </el-icon><span>创建角色</span></el-button
  55. >
  56. <!-- <el-button @click="projectImportBtn" class="imp"
  57. ><el-icon><Upload /></el-icon><span>批量导入</span></el-button
  58. > -->
  59. <!-- <el-button @click="projectExportBtn" class="add"
  60. ><el-icon><Download /></el-icon><span>项目导出</span></el-button
  61. > -->
  62. </div>
  63. </div>
  64. <div class="scroll">
  65. <div class="footer" v-loading="loading">
  66. <el-table
  67. :row-class-name="tableRowClassName"
  68. :data="tableData.list"
  69. @selection-change="handleSelectionChange"
  70. style="width: 100%"
  71. :header-cell-style="{
  72. background: 'rgba(240, 243, 247, 1)',
  73. height: '50px',
  74. border: 0,
  75. }"
  76. >
  77. <!-- <el-table-column type="selection" width="55" /> -->
  78. <el-table-column
  79. align="center"
  80. type="index"
  81. label="序号"
  82. width="80"
  83. />
  84. <!-- <el-table-column align="center" prop="roleLevel" label="角色级别" /> -->
  85. <!-- <el-table-column align="center" prop="pname" label="父级角色" /> -->
  86. <el-table-column align="center" prop="roleName" label="角色名称" />
  87. <el-table-column align="center" prop="createTime" label="创建时间" />
  88. <el-table-column align="center" label="操作" width="220">
  89. <template #default="scope">
  90. <div class="options">
  91. <!-- <div class="reset" @click="addProjectbtn(2, scope.row)">
  92. 添加
  93. </div> -->
  94. <div class="look" v-if="btnFlag('role-xiugaijuese')" @click="edit(scope.row)">编辑</div>
  95. <el-popconfirm
  96. v-if="btnFlag('role-shanchujuese')"
  97. width="220"
  98. confirm-button-text="确认"
  99. cancel-button-text="取消"
  100. :icon="InfoFilled"
  101. icon-color="#f89626"
  102. title="是否删除此角色?"
  103. @confirm="delRoles(scope.row)"
  104. @cancel="cancelEvent"
  105. >
  106. <template #reference>
  107. <div class="del">删除</div>
  108. </template>
  109. </el-popconfirm>
  110. </div>
  111. </template>
  112. </el-table-column>
  113. </el-table>
  114. </div>
  115. <!-- 分页组件 -->
  116. <el-pagination
  117. background
  118. v-model:current-page="currentPage"
  119. v-model:page-size="pageSize"
  120. :page-sizes="[10, 20, 30, 40]"
  121. layout="total,sizes, prev, pager, next, jumper, slot"
  122. :total="total"
  123. @size-change="handleSizeChange"
  124. @current-change="handleCurrentChange"
  125. />
  126. </div>
  127. <!-- 添加角色 -->
  128. <el-dialog
  129. class="addRoles"
  130. v-model="addRolesVisible"
  131. :close-on-click-modal="false"
  132. :close-on-press-escape="false"
  133. :title="addRolesTitle"
  134. align-center
  135. width="900"
  136. :before-close="cancelAddRoles"
  137. >
  138. <el-form
  139. v-loading="addRolesLoading"
  140. ref="addRoleRef"
  141. :model="addRoleRuleForm"
  142. :rules="addRoleRules"
  143. class="demo-ruleForm"
  144. label-width="110px"
  145. :size="formSize"
  146. label-position="right"
  147. status-icon
  148. >
  149. <!-- <el-form-item v-if="addRoleFlag == 2" label="父级角色名称" prop="pname">
  150. <el-input
  151. :clearable="true"
  152. v-model.trim="addRoleRuleForm.pname"
  153. class="w-50 m-2"
  154. style="width: 450px"
  155. :disabled="addRoleFlag == 2"
  156. placeholder="请输入父级角色名称"
  157. />
  158. </el-form-item> -->
  159. <el-form-item label="角色名称" prop="roleName">
  160. <el-input
  161. :clearable="true"
  162. v-model.trim="addRoleRuleForm.roleName"
  163. class="w-50 m-2"
  164. style="width: 450px"
  165. placeholder="请输入角色名称"
  166. />
  167. </el-form-item>
  168. <!-- <el-form-item label="角色级别" prop="roleLevel">
  169. <el-input
  170. :clearable="true"
  171. v-model.trim="addRoleRuleForm.roleLevel"
  172. class="w-50 m-2"
  173. style="width: 450px"
  174. placeholder="请输入角色级别"
  175. />
  176. </el-form-item> -->
  177. <el-form-item label="权限" prop="treeSel">
  178. <el-tree
  179. ref="treeRef"
  180. style="max-width: 600px"
  181. :data="addtableData.list"
  182. show-checkbox
  183. default-expand-all
  184. node-key="id"
  185. highlight-current
  186. :props="defaultProps"
  187. @check-change="handleCheckChange"
  188. check-strictly
  189. />
  190. </el-form-item>
  191. <el-form-item>
  192. <div class="options">
  193. <div class="btn">
  194. <el-button
  195. color="rgba(41, 109, 227, 1)"
  196. class="queding"
  197. type="primary"
  198. @click="confirmRoles(addRoleRef)"
  199. >
  200. 确定
  201. </el-button>
  202. <el-button @click="cancelAddRoles">取消</el-button>
  203. </div>
  204. </div>
  205. </el-form-item>
  206. </el-form>
  207. <!-- <div class="rolesName">
  208. <div>
  209. <el-tree
  210. ref="treeRef"
  211. style="max-width: 600px"
  212. :data="addtableData.list"
  213. show-checkbox
  214. default-expand-all
  215. node-key="id"
  216. highlight-current
  217. :props="defaultProps"
  218. @check-change="handleCheckChange"
  219. check-strictly
  220. />
  221. </div>
  222. </div> -->
  223. </el-dialog>
  224. <!-- 项目导入 -->
  225. <el-dialog
  226. class="projectImport"
  227. v-model="projectImportVisible"
  228. :close-on-click-modal="false"
  229. :close-on-press-escape="false"
  230. title="项目导入"
  231. align-center
  232. width="600"
  233. :before-close="cancelProjectImport"
  234. >
  235. <p class="title">当前只支持项目类型为“非装配式建筑项目”的项目导入</p>
  236. <p class="down">
  237. <span>非装配式建筑项目导入模板</span
  238. ><span @click="templateDown">模板下载</span>
  239. </p>
  240. <el-upload
  241. class="avatar-uploader"
  242. action="#"
  243. :auto-upload="false"
  244. :on-remove="projectImportRemove"
  245. :on-change="projectImportChange"
  246. :before-upload="beforeAvatarProImport"
  247. ref="projectRef"
  248. :limit="1"
  249. :on-exceed="projectImportExceed"
  250. >
  251. <template #trigger>
  252. <el-button class="queding" type="primary">
  253. &nbsp;&nbsp;导入项目&nbsp;&nbsp;
  254. </el-button>
  255. </template>
  256. </el-upload>
  257. <div class="options">
  258. <el-button
  259. color="rgba(9, 101, 98, 1)"
  260. class="queding"
  261. type="primary"
  262. @click="projectImportConfirm(projectRef)"
  263. >
  264. &nbsp;&nbsp;确认导入&nbsp;&nbsp;
  265. </el-button>
  266. <el-button @click="cancelProjectImport"
  267. >&nbsp;&nbsp;取消导入&nbsp;&nbsp;</el-button
  268. >
  269. </div>
  270. </el-dialog>
  271. </div>
  272. </template>
  273. <script setup>
  274. import {
  275. ref,
  276. reactive,
  277. nextTick,
  278. onMounted,
  279. watch,
  280. onBeforeMount,
  281. onUnmounted,
  282. inject
  283. } from "vue";
  284. import COS from "cos-js-sdk-v5";
  285. import { useRouter } from "vue-router";
  286. import { genFileId, ElMessage, ElMessageBox } from "element-plus";
  287. import { Calendar } from "@element-plus/icons-vue";
  288. import { dayjs } from "element-plus";
  289. import lodash, { reduce } from "lodash";
  290. import axios from "axios";
  291. import { useStore } from "vuex";
  292. const store = useStore();
  293. const router = useRouter();
  294. const btnFlag = inject('$btnFlag')
  295. const loading = ref();
  296. const tableData = reactive({
  297. list: [{}],
  298. });
  299. const searchInput = reactive({
  300. roleName: "", // 项目名称
  301. createTime: "", // 创建时间
  302. }); // 搜索按钮数据
  303. const currentPage = ref(1); // 当前页
  304. const pageSize = ref(10);
  305. const total = ref(40); // 当前总数
  306. const selectData = reactive({
  307. list: [],
  308. }); // 多选框选择的数据
  309. const api = ref("");
  310. // 新增角色 (--------------------------------------------------------)
  311. const addRolesVisible = ref(false);
  312. const addRolesTitle = ref();
  313. const addRolesLoading = ref(false);
  314. const treeRef = ref();
  315. const addtableData = reactive({
  316. list: [],
  317. });
  318. const treeSelData = ref();
  319. const defaultProps = {
  320. children: "menuLists",
  321. label: "menuName",
  322. };
  323. const addRoleRef = ref();
  324. const addRoleFlag = ref();
  325. const addRoleRuleForm = reactive({
  326. pid: "", // 父级角色ID,最高级为0
  327. pname: "", // 父级角色名称
  328. roleName: "", // 角色名称
  329. roleLevel: "", // 角色级别
  330. treeSel: [],
  331. id: "",
  332. });
  333. // 更新进度验证
  334. const addRoleRules = reactive({
  335. pname: [{ required: true, message: "父级角色名称不能为空", trigger: "blur" }],
  336. roleName: [{ required: true, message: "角色名称不能为空", trigger: "blur" }],
  337. roleLevel: [{ required: true, message: "角色级别不能为空", trigger: "blur" }],
  338. treeSel: [{ required: true, message: "权限不能为空", trigger: "blur" }],
  339. });
  340. // 项目导入
  341. const projectImportVisible = ref(false);
  342. const projectRef = ref();
  343. const projectFile = ref();
  344. // 获取账户列表
  345. const getList = async () => {
  346. loading.value = true;
  347. let params = {
  348. page: currentPage.value, // 当前页
  349. rows: pageSize.value, // 一页数据条数
  350. };
  351. let data = {
  352. roleName: searchInput.roleName,
  353. };
  354. if (searchInput.createTime) {
  355. data.createBy = searchInput.createTime[0];
  356. data.updateBy = searchInput.createTime[1];
  357. }
  358. let res = await axios({
  359. method: "post",
  360. url: api.value + "/api/sysRole/queryPageSysRole",
  361. headers: {
  362. tokenP: sessionStorage.getItem("tokenP"),
  363. user_head: sessionStorage.getItem("userhead"),
  364. },
  365. params: params,
  366. data:data
  367. });
  368. console.log(res, "查询角色分页数据");
  369. if (res.data.code == 200) {
  370. tableData.list = res.data.data.rows;
  371. total.value = res.data.data.total;
  372. loading.value = false;
  373. } else {
  374. loading.value = false;
  375. if(res.data.message.indexOf('Handler dispatch failed')!=-1){
  376. window.location.href =
  377. "https://chtech.ncjti.edu.cn/kpi/template/api/sysUser/authorize";
  378. }
  379. ElMessage({
  380. type: "error",
  381. showClose: true,
  382. message: res.data.message,
  383. center: true,
  384. });
  385. }
  386. };
  387. // 搜索功能
  388. const searchBtn = lodash.debounce(async () => {
  389. getList();
  390. }, 300);
  391. const menuList = async () => {
  392. let res = await axios({
  393. method: "post",
  394. url: api.value + "/api/sysMenu/QueryMenuTreeRecords",
  395. headers: {
  396. tokenP: sessionStorage.getItem("tokenP"),
  397. user_head: sessionStorage.getItem("userhead"),
  398. },
  399. });
  400. console.log(res, "查看菜单");
  401. if (res.data.code == 200) {
  402. addtableData.list = res.data.data;
  403. } else {
  404. ElMessage({
  405. type: "error",
  406. showClose: true,
  407. message: res.data.message,
  408. center: true,
  409. });
  410. }
  411. };
  412. // 角色新增
  413. const addProjectbtn = async (flag, row) => {
  414. addRolesVisible.value = true;
  415. addRolesTitle.value = "角色新增";
  416. treeSelData.value = [];
  417. addRoleFlag.value = flag; // 判断是 父级添加 还是 子级添加
  418. console.log(flag, row);
  419. if (flag == 1) {
  420. addRoleRuleForm.pid = 0; // 父级角色ID
  421. addRoleRuleForm.pname = "/"; // 父级角色名称
  422. addRoleRuleForm.roleName = ""; // 角色名称
  423. addRoleRuleForm.roleLevel = "T0"; // 角色级别
  424. } else if (flag == 2) {
  425. addRoleRuleForm.pid = row.id;
  426. addRoleRuleForm.pname = row.roleName;
  427. addRoleRuleForm.roleName = "";
  428. addRoleRuleForm.roleLevel = "";
  429. }
  430. menuList();
  431. };
  432. // 勾选权限
  433. const handleCheckChange = (data, checked, indeterminate) => {
  434. // console.log(treeRef.value.getCheckedNodes());
  435. addtableData.list.forEach((i) => {
  436. i.state = 0;
  437. if (i.menuLists) {
  438. i.menuLists.forEach((item) => {
  439. item.state = 0;
  440. });
  441. }
  442. });
  443. if (treeRef.value.getCheckedNodes().length) {
  444. treeSelData.value = [];
  445. treeRef.value.getCheckedNodes().forEach((i) => {
  446. // 菜单权限
  447. if (i.pid == 0) {
  448. addtableData.list.forEach((item) => {
  449. if (i.id == item.id) {
  450. item.state = 1;
  451. }
  452. });
  453. }
  454. // 按钮权限
  455. else {
  456. // 将勾选的数据的state状态变为1
  457. addtableData.list.forEach((item) => {
  458. if (item.menuLists) {
  459. item.menuLists.forEach((row) => {
  460. if (row.id == i.id) {
  461. row.state = 1;
  462. }
  463. });
  464. }
  465. });
  466. }
  467. });
  468. addRoleRuleForm.treeSel = [];
  469. addtableData.list.forEach((i) => {
  470. addRoleRuleForm.treeSel.push({
  471. id: i.id,
  472. state: i.state,
  473. });
  474. if (i.menuLists) {
  475. i.menuLists.forEach((item) => {
  476. addRoleRuleForm.treeSel.push({
  477. id: item.id,
  478. state: item.state,
  479. });
  480. });
  481. }
  482. });
  483. // console.log(addtableData.list, "菜单数据");
  484. // console.log(addRoleRuleForm.treeSel, "勾选的菜单");
  485. }
  486. };
  487. // 确定编辑角色权限
  488. const confirmRoles = (formEl) => {
  489. if (!formEl) return;
  490. formEl.validate(async (valid, fields) => {
  491. if (valid) {
  492. addRolesLoading.value = true;
  493. let res = "";
  494. let data = {
  495. sysRole: {
  496. // pid: addRoleRuleForm.pid, // 父级角色ID,最高级为0
  497. // pname: addRoleRuleForm.pname, // 父级角色名称
  498. roleName: addRoleRuleForm.roleName, // 父级角色名称
  499. // roleLevel: addRoleRuleForm.roleLevel, // 角色级别
  500. },
  501. list: addRoleRuleForm.treeSel,
  502. };
  503. // 判断是否有id存在,有则是修改账号
  504. if (addRoleRuleForm.id) {
  505. data.sysRole.id = addRoleRuleForm.id;
  506. res = await axios({
  507. method: "post",
  508. url: api.value + "/api/sysRole/update",
  509. headers: {
  510. tokenP: sessionStorage.getItem("tokenP"),
  511. user_head: sessionStorage.getItem("userhead"),
  512. },
  513. data: data,
  514. });
  515. } else {
  516. // 最大级添加
  517. // if (addRoleFlag.value == 1) {
  518. // } else if (addRoleFlag.value == 2) {
  519. // }
  520. res = await axios({
  521. method: "post",
  522. url: api.value + "/api/sysRole/add",
  523. headers: {
  524. tokenP: sessionStorage.getItem("tokenP"),
  525. user_head: sessionStorage.getItem("userhead"),
  526. },
  527. data: data,
  528. });
  529. }
  530. console.log(data, "添加参数");
  531. console.log(res, "新增账号数据");
  532. if (res.data.code == 200) {
  533. addRolesVisible.value = false;
  534. addRolesLoading.value = false;
  535. getList();
  536. ElMessage({
  537. type: "success",
  538. showClose: true,
  539. message: res.data.message,
  540. center: true,
  541. });
  542. } else {
  543. addRolesLoading.value = false;
  544. ElMessage({
  545. type: "error",
  546. showClose: true,
  547. message: res.data.message,
  548. center: true,
  549. });
  550. }
  551. }
  552. });
  553. };
  554. // 取消角色新增
  555. const cancelAddRoles = () => {
  556. addRolesVisible.value = false;
  557. addRoleRuleForm.pid = "";
  558. addRoleRuleForm.pname = "";
  559. addRoleRuleForm.roleName = "";
  560. addRoleRuleForm.roleLevel = "";
  561. addRoleRef.value.resetFields();
  562. };
  563. //编辑项目
  564. const edit = (row) => {
  565. addRolesVisible.value = true;
  566. addRolesTitle.value = "角色编辑";
  567. addRoleRuleForm.id = row.id;
  568. // addRoleRuleForm.pid = row.pid;
  569. // addRoleRuleForm.pname = row.pname;
  570. addRoleRuleForm.roleName = row.roleName;
  571. addRoleRuleForm.roleLevel = row.roleLevel;
  572. menuList();
  573. nextTick(async () => {
  574. // console.log(row);
  575. let data = new FormData();
  576. data.append("roleId", row.id);
  577. let role = await axios({
  578. method: "post",
  579. url: api.value + "/api/sysRole/queryMenuByRole",
  580. headers: {
  581. tokenP: sessionStorage.getItem("tokenP"),
  582. user_head: sessionStorage.getItem("userhead"),
  583. },
  584. data: data,
  585. });
  586. console.log(role, "查询角色菜单权限");
  587. if (role.data.code == 200) {
  588. // addtableData.list=role.data.data
  589. treeSelData.value = [];
  590. addRoleRuleForm.treeSel = [];
  591. role.data.data.forEach((i) => {
  592. addRoleRuleForm.treeSel.push({
  593. id: i.id,
  594. state: i.state,
  595. });
  596. if (i.menuLists) {
  597. i.menuLists.forEach((item) => {
  598. addRoleRuleForm.treeSel.push({
  599. id: item.id,
  600. state: item.state,
  601. });
  602. });
  603. }
  604. });
  605. // console.log(addtableData.list, "菜单数据");
  606. // console.log(addRoleRuleForm.treeSel, "勾选的菜单");
  607. let arr = [];
  608. addRoleRuleForm.treeSel.forEach((i) => {
  609. if (i.state == 1) {
  610. arr.push(i.id);
  611. }
  612. });
  613. treeRef.value.setCheckedKeys(arr);
  614. } else {
  615. ElMessage({
  616. type: "error",
  617. showClose: true,
  618. message: role.data.message,
  619. center: true,
  620. });
  621. }
  622. });
  623. };
  624. const delRoles = async (row) => {
  625. console.log(row);
  626. let data = new FormData();
  627. data.append("id", row.id);
  628. let res = await axios({
  629. method: "post",
  630. url: api.value + "/api/sysRole/del",
  631. headers: {
  632. tokenP: sessionStorage.getItem("tokenP"),
  633. user_head: sessionStorage.getItem("userhead"),
  634. },
  635. data: data,
  636. });
  637. if (res.data.code == 200) {
  638. getList();
  639. ElMessage({
  640. type: "success",
  641. showClose: true,
  642. message: res.data.message,
  643. center: true,
  644. });
  645. } else {
  646. ElMessage({
  647. type: "error",
  648. showClose: true,
  649. message: res.data.message,
  650. center: true,
  651. });
  652. }
  653. };
  654. // 导入项目
  655. const projectImportConfirm = async () => {
  656. let data = new FormData();
  657. data.set("file", projectFile.value);
  658. data.set("pageType", 1);
  659. let res = await axios({
  660. method: "POST",
  661. url: api.value + "/jgcloudProject/importExcelProject",
  662. headers: {
  663. tokenP: sessionStorage.getItem("tokenP"),
  664. user_head: sessionStorage.getItem("userhead"),
  665. },
  666. data: data,
  667. });
  668. console.log(res, "导入项目");
  669. if (res.data.code == 200) {
  670. projectImportVisible.value = false;
  671. getList();
  672. if (projectRef.value) {
  673. projectRef.value.clearFiles();
  674. }
  675. ElMessage({
  676. type: "success",
  677. showClose: true,
  678. message: res.data.message,
  679. center: true,
  680. });
  681. } else {
  682. ElMessage({
  683. type: "error",
  684. showClose: true,
  685. message: res.data.message,
  686. center: true,
  687. });
  688. }
  689. };
  690. const cancelProjectImport = () => {
  691. projectRef.value.clearFiles();
  692. projectImportVisible.value = false;
  693. };
  694. // 多选框功能
  695. const handleSelectionChange = (val) => {
  696. console.log(val);
  697. selectData.list = val;
  698. };
  699. // 表格斑马纹颜色修改
  700. const tableRowClassName = ({ row, rowIndex }) => {
  701. if (rowIndex % 2 === 0) {
  702. return "even";
  703. } else if (rowIndex % 2 !== 0) {
  704. return "odd";
  705. }
  706. return "";
  707. };
  708. // 每页显示条数
  709. const handleSizeChange = (value) => {
  710. console.log(value, "每页显示条数");
  711. pageSize.value = value;
  712. getList();
  713. };
  714. // 分页
  715. const handleCurrentChange = (value) => {
  716. currentPage.value = value;
  717. getList();
  718. };
  719. onBeforeMount(() => {
  720. api.value = store.state.user.api;
  721. getList();
  722. });
  723. onUnmounted(() => {
  724. // document.removeEventListener("keyup", Enters);
  725. });
  726. </script>
  727. <style scoped lang="scss">
  728. .content-box {
  729. min-width: 1000px;
  730. width: calc(100vw - 260px);
  731. height: calc(100vh - 105px);
  732. margin: 20px auto;
  733. background-color: #fff;
  734. color: #fff;
  735. display: flex;
  736. flex-direction: column;
  737. box-shadow: 0px 3px 10px rgba(0, 97, 255, 0.2);
  738. .left {
  739. // width: calc(100wh - 40px);
  740. display: flex;
  741. align-items: center;
  742. height: 60px;
  743. margin: 0 30px;
  744. border-bottom: 1px solid #ccc;
  745. color: #000;
  746. font-size: 18px;
  747. font-weight: 600;
  748. .cameratxt {
  749. display: block;
  750. height: 60px;
  751. line-height: 60px;
  752. }
  753. }
  754. .middle {
  755. width: calc(100% - 60px);
  756. margin: 0 auto;
  757. color: #000;
  758. // border-bottom: 1px solid rgb(231, 231, 231);
  759. .filter {
  760. display: flex;
  761. flex-wrap: wrap;
  762. align-items: center;
  763. margin: 10px 0 0 0;
  764. .search {
  765. margin-left: 0 !important;
  766. color: #fff;
  767. background: linear-gradient(
  768. 90deg,
  769. rgba(33, 107, 255, 1) 0%,
  770. rgba(102, 182, 255, 1) 100%
  771. );
  772. border: none;
  773. }
  774. .reset {
  775. border: 1px solid rgba(38, 151, 255, 1);
  776. color: rgba(38, 151, 255, 1);
  777. }
  778. .condition {
  779. display: flex;
  780. align-items: center;
  781. margin: 10px 30px 10px 0;
  782. :deep(.el-input .el-input__inner) {
  783. font-size: 14px;
  784. }
  785. span {
  786. margin: 0 10px 0 0;
  787. }
  788. }
  789. }
  790. .gongneng {
  791. margin: 8px 0;
  792. // .el-button {
  793. // color: #fff;
  794. // border: none;
  795. // }
  796. .add {
  797. color: #fff;
  798. border: none;
  799. background: linear-gradient(
  800. 90deg,
  801. rgba(33, 107, 255, 1) 0%,
  802. rgba(102, 182, 255, 1) 100%
  803. );
  804. }
  805. .imp {
  806. border: 1px solid rgba(33, 107, 255, 1);
  807. color: rgba(33, 107, 255, 1);
  808. }
  809. }
  810. }
  811. .scroll {
  812. flex: 1;
  813. overflow: auto;
  814. }
  815. .footer {
  816. width: 96%;
  817. height: calc(100% - 82px);
  818. margin: 10px auto 10px;
  819. .el-table--fit {
  820. height: 100%;
  821. :deep(.el-table__header-wrapper) {
  822. background-color: #000;
  823. font-size: 14px;
  824. color: #000;
  825. .cell {
  826. color: #000;
  827. }
  828. }
  829. :deep(.el-table__row) {
  830. height: 50px;
  831. font-size: 14px;
  832. color: #000;
  833. }
  834. :deep(.el-table__row td) {
  835. padding: 0;
  836. border: 0;
  837. }
  838. .el-button--primary {
  839. margin-left: 5px;
  840. }
  841. :deep(.el-table__body .even) {
  842. background-color: #fff;
  843. }
  844. :deep(.el-table__body .odd) {
  845. background-color: rgba(240, 243, 247, 1);
  846. }
  847. :deep(.options) {
  848. display: flex;
  849. justify-content: center;
  850. align-items: center;
  851. .reset {
  852. margin-right: 15px;
  853. color: rgba(30, 125, 251, 1);
  854. cursor: pointer;
  855. }
  856. .look {
  857. margin-right: 15px;
  858. color: rgba(30, 125, 251, 1);
  859. cursor: pointer;
  860. }
  861. .del {
  862. color: rgba(212, 48, 48, 1);
  863. cursor: pointer;
  864. }
  865. }
  866. }
  867. }
  868. .el-pagination {
  869. width: calc(100vw - 300px);
  870. margin: 20px auto;
  871. justify-content: flex-end;
  872. :deep(.el-pagination__total) {
  873. color: #000;
  874. }
  875. :deep(.el-pagination__goto) {
  876. color: #000;
  877. }
  878. :deep(.el-pagination__classifier) {
  879. color: #000;
  880. }
  881. :deep(.el-input__wrapper) {
  882. // border: 1px solid rgba(0, 0, 0, 1);
  883. // border-radius: 5px;
  884. // box-shadow: none;
  885. width: 100px;
  886. }
  887. :deep(.el-pager li) {
  888. margin: 0 5px;
  889. border: 1px solid rgba(0, 0, 0, 1);
  890. border-radius: 5px;
  891. background-color: transparent;
  892. }
  893. :deep(.el-pager li.is-active) {
  894. // background-color: rgba(111, 182, 184, 1);
  895. color: rgba(0, 149, 255, 1);
  896. border: 1px solid rgba(0, 149, 255, 1);
  897. }
  898. :deep(.btn-prev) {
  899. margin-right: 5px;
  900. border: 1px solid rgba(0, 0, 0, 1);
  901. border-radius: 5px;
  902. background-color: transparent;
  903. }
  904. :deep(.btn-next) {
  905. margin-left: 5px;
  906. border: 1px solid rgba(0, 0, 0, 1);
  907. border-radius: 5px;
  908. background-color: transparent;
  909. }
  910. }
  911. // 添加角色
  912. :deep(.addRoles) {
  913. // height: 420px;
  914. border-radius: 11px;
  915. .el-dialog__header {
  916. border-radius: 11px 11px 0 0;
  917. background: rgba(237, 241, 245, 1);
  918. font-weight: 600;
  919. margin: 0;
  920. .el-dialog__headerbtn {
  921. outline: none;
  922. }
  923. }
  924. .el-dialog__body {
  925. padding: 20px 30px 10px 30px;
  926. .rolesName {
  927. margin: 15px 0;
  928. color: #000;
  929. height: 600px;
  930. overflow: auto;
  931. .rolePermission {
  932. margin: 10px 0;
  933. }
  934. }
  935. .el-table--fit {
  936. height: 100%;
  937. :deep(.el-table__header-wrapper) {
  938. background-color: #000;
  939. font-size: 14px;
  940. color: #000;
  941. .cell {
  942. color: #000;
  943. }
  944. }
  945. .el-table__row {
  946. height: 45px;
  947. font-size: 14px;
  948. color: #000;
  949. }
  950. .el-table__row td {
  951. // padding: 0;
  952. // border: 0;
  953. }
  954. .el-button--primary {
  955. margin-left: 5px;
  956. }
  957. :deep(.el-table__body .even) {
  958. background-color: #fff;
  959. }
  960. :deep(.el-table__body .odd) {
  961. background-color: rgba(240, 243, 247, 1);
  962. }
  963. }
  964. // table {
  965. // width: 840px;
  966. // // height: 600px;
  967. // tr {
  968. // td {
  969. // border-top: 1px solid #7c7c7c;
  970. // border-left: 1px solid #7c7c7c;
  971. // }
  972. // td:nth-child(1) {
  973. // width: 120px;
  974. // }
  975. // td:last-child {
  976. // border-right: 1px solid #7c7c7c;
  977. // padding: 10px 0;
  978. // .el-tree {
  979. // .el-tree-node__children {
  980. // display: flex;
  981. // flex-wrap: wrap;
  982. // .el-tree-node {
  983. // width: 140px;
  984. // .el-tree-node__content {
  985. // padding-left: 0 !important;
  986. // }
  987. // }
  988. // // border: 1px solid red;
  989. // }
  990. // }
  991. // }
  992. // }
  993. // tr:nth-child(1) {
  994. // td {
  995. // height: 40px;
  996. // }
  997. // }
  998. // tr:last-child {
  999. // td {
  1000. // border-bottom: 1px solid #7c7c7c;
  1001. // }
  1002. // }
  1003. // }
  1004. .options {
  1005. margin: 10px 20px 10px 0;
  1006. width: 100%;
  1007. .btn {
  1008. display: flex;
  1009. flex-direction: row-reverse;
  1010. }
  1011. .queding {
  1012. color: #fff;
  1013. margin-left: 15px;
  1014. }
  1015. }
  1016. }
  1017. }
  1018. }
  1019. .el-input {
  1020. width: 192px;
  1021. }
  1022. </style>
  1023. <style lang="scss">
  1024. .usePrefabricate {
  1025. height: 488px;
  1026. .el-select-dropdown__wrap {
  1027. max-height: 100%;
  1028. }
  1029. }
  1030. </style>