dashboard.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. <template>
  2. <popu>
  3. <div>
  4. <div class="menu-list">
  5. <div>
  6. <div class="main-title">
  7. <div class="title">常用菜单</div>
  8. <div class="el-icon-setting" @click="dialogVisible = !dialogVisible" />
  9. </div>
  10. <div class="child">
  11. <el-row :gutter="20">
  12. <el-col
  13. v-for="(it, idx) in normsMenuList"
  14. :key="idx"
  15. class="item"
  16. :span="4"
  17. style="margin-top: 16px; padding: 3px 20px"
  18. >
  19. <el-link class="link" :underline="false" @click="clickMenu(it.fullUrl)">{{ it.moduleName }}</el-link>
  20. </el-col>
  21. </el-row>
  22. </div>
  23. </div>
  24. <div v-for="(item, index) in menuList" :key="index" class="group">
  25. <div v-if="item.moduleName != '首页'">
  26. <div class="main-title">
  27. <div class="title">{{ item.moduleName }}</div>
  28. </div>
  29. <div v-if="item.children && item.children.length" class="child">
  30. <el-row :gutter="20">
  31. <el-col v-for="(it, idx) in item.children" :key="idx" class="item" :span="4">
  32. <el-link class="link" :underline="false" @click="clickMenu(it.fullUrl)">{{ it.moduleName }}</el-link>
  33. </el-col>
  34. </el-row>
  35. </div>
  36. <div v-else class="child">
  37. <div class="item">
  38. <el-link class="link" :underline="false" @click="clickMenu(item.fullUrl)">{{
  39. item.moduleName
  40. }}</el-link>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. <!-- 弹窗 -->
  47. <el-dialog title="菜单配置" append-to-body :visible.sync="dialogVisible" width="70%">
  48. <el-checkbox-group v-model="checkList" :max="10">
  49. <div v-for="(item, index) in menuList" :key="index" class="group">
  50. <div v-if="item.moduleName != '首页'">
  51. <div v-if="item.children && item.children.length" class="dia-child">
  52. <el-checkbox v-for="(it, idx) in item.children" :key="idx" :label="it.moduleId" class="dia-item">{{
  53. it.moduleName
  54. }}</el-checkbox>
  55. </div>
  56. <div v-else class="child">
  57. <el-checkbox class="dia-item" :label="item.moduleId">{{ item.moduleName }}</el-checkbox>
  58. </div>
  59. </div>
  60. </div>
  61. </el-checkbox-group>
  62. <div class="dia-tip">( {{ checkList.length }} / 10 )注:最多选10个导航菜单</div>
  63. <span slot="footer" class="dialog-footer">
  64. <el-button
  65. @click="
  66. dialogVisible = false
  67. checkList = []
  68. "
  69. >取 消</el-button
  70. >
  71. <el-button type="primary" @click="handleSaveMenu">确 定</el-button>
  72. </span>
  73. </el-dialog>
  74. </div>
  75. </popu>
  76. </template>
  77. <script>
  78. import {
  79. getNoticeList,
  80. getComListList,
  81. getComListDownload,
  82. getNoticeDetail,
  83. confirmCheck,
  84. getRebateOrderList,
  85. getRouter,
  86. getMenuList,
  87. setMenuList,
  88. getListInvoiceOrder
  89. } from '@/api/dashboard'
  90. import { getArrivalNotice } from '@/api/stock'
  91. import { getListOrderTrack } from '@/api/supply/pickup'
  92. import { getFileUrl } from '@/api/common'
  93. import { mapGetters } from 'vuex'
  94. import popu from '@/components/template/popu.vue'
  95. export default {
  96. name: 'Dashboard',
  97. components: {
  98. popu
  99. },
  100. created() {
  101. getRouter({
  102. flag: 'index',
  103. adminUserId: this.userid
  104. }).then(res => {
  105. this.menuList = res.data
  106. console.log(res.data)
  107. })
  108. this.getMenuList()
  109. },
  110. computed: {
  111. ...mapGetters(['showMessages', 'userid', 'isCustomer'])
  112. },
  113. data() {
  114. return {
  115. imageURL: this.$imageUrl,
  116. type: '1',
  117. currentPage: 1, // 当前页码
  118. pageSize: 10, // 每页数量
  119. listTotal: 0, // 列表总数
  120. dataList: [],
  121. listLoading: false, // 列表加载loading
  122. fileList: [],
  123. inDialog: false,
  124. detailData: [],
  125. rebateList: [],
  126. // isCustomer: JSON.parse(localStorage.getItem('supply_user')).isCustomer,
  127. menuList: [],
  128. dialogVisible: false,
  129. checkList: [],
  130. normsMenuList: [],
  131. invoiceOrderList: [],
  132. bol: true,
  133. visible: false,
  134. orderId: '',
  135. logisticsDetail: [],
  136. arrivalNoticeList: [],
  137. specification: ''
  138. }
  139. },
  140. methods: {
  141. // 获取常用菜单列表
  142. getMenuList() {
  143. getMenuList().then(res => {
  144. this.normsMenuList = res.data
  145. if (this.normsMenuList.length) {
  146. this.normsMenuList.forEach(k => {
  147. this.checkList.push(k.moduleId)
  148. })
  149. }
  150. })
  151. },
  152. // 保存常用菜单
  153. handleSaveMenu() {
  154. setMenuList({ adminModuleIds: this.checkList.join(',') }).then(res => {
  155. this.$successMsg('设置成功')
  156. this.checkList = []
  157. this.getMenuList()
  158. this.dialogVisible = false
  159. })
  160. },
  161. // 打开链接
  162. openLink(url) {
  163. getFileUrl({ key: url }).then(res => {
  164. window.open(res.data)
  165. })
  166. },
  167. // 复核
  168. secondFn(id) {
  169. this.$router.push({
  170. path: '/finance/rebate_list',
  171. query: {
  172. id
  173. }
  174. })
  175. this.$store.commit('user/showMessage', 'no')
  176. },
  177. // 确认查收
  178. confirmCheck(id) {
  179. confirmCheck({ noticeIds: id }).then(res => {
  180. this.$successMsg('查收成功')
  181. this.inDialog = false
  182. this.getDataList({
  183. pageSize: this.pageSize,
  184. pageNum: this.currentPage,
  185. readFlag: false
  186. })
  187. })
  188. },
  189. // 检查文件类型
  190. checkFileType(url) {
  191. if (!url) return ''
  192. const fileSuffix = url.substring(url.lastIndexOf('.') + 1)
  193. if (['jpg', 'jpeg', 'png'].includes(fileSuffix)) {
  194. return 'image'
  195. } else if (['doc', 'docx', 'dot', 'wps', 'wpt'].includes(fileSuffix)) {
  196. return 'word'
  197. } else if (['xls', 'xlsx', 'xlt', 'et', 'ett'].includes(fileSuffix)) {
  198. return 'excel'
  199. } else if (['ppt', 'pptx', 'dps', 'dpt', 'pot', 'pps'].includes(fileSuffix)) {
  200. return 'ppt'
  201. } else if (['pdf'].includes(fileSuffix)) {
  202. return 'pdf'
  203. } else {
  204. return ''
  205. }
  206. },
  207. // 查看
  208. async lookInDialog(id) {
  209. const res = await getNoticeDetail({ id })
  210. // console.log(res, 7898);
  211. this.detailData = res.data
  212. this.inDialog = true
  213. },
  214. // 下载
  215. async downloadFn(id) {
  216. const res = await getComListDownload({ id })
  217. if (res.data) {
  218. window.open(this.imageURL + res.data)
  219. }
  220. },
  221. // 获取文件列表数据
  222. async getFileList(data) {
  223. const res = await getComListList(data)
  224. this.fileList = res.data.records
  225. this.listTotal = res.data.total
  226. },
  227. // 更改每页数量
  228. handleSizeChange(val) {
  229. this.pageSize = val
  230. this.currentPage = 1
  231. if (this.type == 1) {
  232. this.getDataList({
  233. pageSize: this.pageSize,
  234. pageNum: this.currentPage,
  235. readFlag: false
  236. })
  237. }
  238. if (this.type == 2) {
  239. this.getFileList({
  240. needDown: true,
  241. pageSize: this.pageSize,
  242. pageNo: this.currentPage
  243. })
  244. }
  245. if (this.type == 3) {
  246. this.getRebateList({
  247. pageSize: this.pageSize,
  248. pageNum: this.currentPage,
  249. isSecondExamine: false
  250. })
  251. }
  252. if (this.type == 4) {
  253. this.getListInvoiceOrder({
  254. pageSize: this.pageSize,
  255. pageNum: this.currentPage
  256. })
  257. }
  258. if (this.type == 5) {
  259. this.getArrivalNotice({
  260. pageSize: this.pageSize,
  261. pageNum: this.currentPage
  262. })
  263. }
  264. },
  265. // 更改当前页
  266. handleCurrentChange(val) {
  267. this.currentPage = val
  268. if (this.type == 1) {
  269. this.getDataList({
  270. pageSize: this.pageSize,
  271. pageNum: this.currentPage,
  272. readFlag: false
  273. })
  274. }
  275. if (this.type == 2) {
  276. this.getFileList({
  277. needDown: true,
  278. pageSize: this.pageSize,
  279. pageNo: this.currentPage
  280. })
  281. }
  282. if (this.type == 3) {
  283. this.getRebateList({
  284. pageSize: this.pageSize,
  285. pageNum: this.currentPage,
  286. isSecondExamine: false
  287. })
  288. }
  289. if (this.type == 4) {
  290. this.getListInvoiceOrder({
  291. pageSize: this.pageSize,
  292. pageNum: this.currentPage
  293. })
  294. }
  295. if (this.type == 5) {
  296. this.getArrivalNotice({
  297. pageSize: this.pageSize,
  298. pageNum: this.currentPage
  299. })
  300. }
  301. },
  302. // 获取返利确认单数据
  303. async getRebateList(data) {
  304. const res = await getRebateOrderList(data)
  305. this.rebateList = res.data.records
  306. this.listTotal = res.data.total
  307. },
  308. // 获取列表数据
  309. async getDataList(data) {
  310. const res = await getNoticeList(data)
  311. console.log(res)
  312. this.dataList = res.data.records
  313. this.listTotal = res.data.total
  314. },
  315. // 获取物流列表
  316. async getListInvoiceOrder(data) {
  317. const res = await getListInvoiceOrder(data)
  318. this.invoiceOrderList = res.data.records
  319. this.listTotal = res.data.total
  320. },
  321. async getArrivalNotice(data) {
  322. data = {
  323. ...data,
  324. pageSize: this.pageSize,
  325. pageNum: this.currentPage,
  326. specification: this.specification
  327. }
  328. const res = await getArrivalNotice(data)
  329. this.arrivalNoticeList = res.data.records
  330. this.listTotal = res.data.total
  331. },
  332. // 选择
  333. checkFn(v) {
  334. this.$refs.table.doLayout()
  335. this.type = v
  336. if (v == 1) {
  337. this.getDataList({
  338. pageSize: this.pageSize,
  339. pageNum: this.currentPage,
  340. readFlag: false
  341. })
  342. }
  343. if (v == 2) {
  344. this.getFileList({
  345. needDown: true,
  346. pageSize: this.pageSize,
  347. pageNo: this.currentPage
  348. })
  349. }
  350. if (v == 3) {
  351. this.getRebateList({
  352. pageSize: this.pageSize,
  353. pageNum: this.currentPage,
  354. isSecondExamine: false
  355. })
  356. }
  357. if (v == 4) {
  358. this.getListInvoiceOrder({
  359. pageSize: this.pageSize,
  360. pageNum: this.currentPage
  361. })
  362. }
  363. if (this.type == 5) {
  364. this.getArrivalNotice({
  365. pageSize: this.pageSize,
  366. pageNum: this.currentPage
  367. })
  368. }
  369. },
  370. // 关闭
  371. closeFn() {
  372. this.$store.commit('user/showMessage', 'no')
  373. },
  374. // 点击菜单
  375. clickMenu(path) {
  376. const curlArr = ['/notice', '/issue']
  377. // if (curlArr.includes(path)) {
  378. // path += '/index'
  379. // }
  380. this.$router.push({
  381. path
  382. })
  383. },
  384. handLogistics(row) {
  385. getListOrderTrack({ orderId: row.id }).then(res => {
  386. this.logisticsDetail = res.data
  387. })
  388. this.orderId = row.id
  389. this.visible = true
  390. },
  391. onClose() {
  392. this.logisticsDetail = []
  393. this.orderId = ''
  394. this.visible = false
  395. },
  396. handleJump(id) {
  397. this.$router.push({ path: `/supply/pickup/sum_list?id=${id}` })
  398. this.$store.commit('user/showMessage', 'no')
  399. }
  400. }
  401. }
  402. </script>
  403. <style lang="scss" scoped>
  404. ::v-deep .el-input__inner {
  405. /* width: 80px; */
  406. font-size: 16px;
  407. color: #333333;
  408. /* border: 0 !important; */
  409. }
  410. .dashboard {
  411. &-container {
  412. background: #f5f5f5;
  413. padding: 30px;
  414. min-height: calc(100vh - 86px);
  415. .top-container {
  416. .today-content {
  417. font-size: 14px;
  418. }
  419. }
  420. }
  421. }
  422. .cql {
  423. ::v-deep.el-table__header-wrapper {
  424. background-color: #f5f7fa;
  425. }
  426. }
  427. .dia-menu-title {
  428. padding: 10px 0;
  429. color: #000;
  430. font-weight: bold;
  431. }
  432. .dia-tip {
  433. padding: 10px 0;
  434. color: #000;
  435. font-weight: bold;
  436. }
  437. .dia-child {
  438. display: flex;
  439. flex-wrap: wrap;
  440. }
  441. .dia-item {
  442. flex: 0 1 220px;
  443. padding: 3px 0;
  444. }
  445. .menu-list {
  446. .main-title {
  447. margin: 10px 0 0;
  448. .el-icon-setting {
  449. cursor: pointer;
  450. font-size: 22px;
  451. }
  452. }
  453. .group {
  454. margin-bottom: 20px;
  455. .child {
  456. display: flex;
  457. flex-wrap: wrap;
  458. padding-left: 10px;
  459. .el-row {
  460. width: 100%;
  461. }
  462. .item {
  463. margin-top: 16px;
  464. }
  465. }
  466. }
  467. ::v-deep .el-link--inner {
  468. white-space: nowrap;
  469. overflow: hidden;
  470. text-overflow: ellipsis;
  471. }
  472. }
  473. .logistics-title {
  474. padding-bottom: 10px;
  475. }
  476. .tip {
  477. height: 200px;
  478. text-align: center;
  479. line-height: 200px;
  480. }
  481. </style>