dashboard.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. <template>
  2. <popu>
  3. <div class="app-container">
  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.curUrl)">{{ 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.curUrl)">{{ 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.curUrl)">{{ item.moduleName }}</el-link>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. <!-- 弹窗 -->
  45. <el-dialog title="菜单配置" :visible.sync="dialogVisible" width="70%">
  46. <el-checkbox-group v-model="checkList" :max="10">
  47. <div v-for="(item, index) in menuList" :key="index" class="group">
  48. <div v-if="item.moduleName != '首页'">
  49. <div v-if="item.children && item.children.length" class="dia-child">
  50. <el-checkbox v-for="(it, idx) in item.children" :key="idx" :label="it.moduleId" class="dia-item">{{
  51. it.moduleName
  52. }}</el-checkbox>
  53. </div>
  54. <div v-else class="child">
  55. <el-checkbox class="dia-item" :label="item.moduleId">{{ item.moduleName }}</el-checkbox>
  56. </div>
  57. </div>
  58. </div>
  59. </el-checkbox-group>
  60. <div class="dia-tip">( {{ checkList.length }} / 10 )注:最多选10个导航菜单</div>
  61. <span slot="footer" class="dialog-footer">
  62. <el-button
  63. @click="
  64. dialogVisible = false
  65. checkList = []
  66. "
  67. >取 消</el-button
  68. >
  69. <el-button type="primary" @click="handleSaveMenu">确 定</el-button>
  70. </span>
  71. </el-dialog>
  72. <el-dialog title="消息" :visible.sync="showMessages" width="50%" :show-close="false" :close-on-click-modal="false">
  73. <el-radio-group v-model="type" size="mini" @change="checkFn">
  74. <el-radio-button label="1">系统通知</el-radio-button>
  75. <el-radio-button label="2">文件下发</el-radio-button>
  76. <el-radio-button label="3">返利确认单</el-radio-button>
  77. <el-radio-button label="4">物流通知</el-radio-button>
  78. </el-radio-group>
  79. <br />
  80. <br />
  81. <!-- 系统通知 -->
  82. <div v-show="type == '1'" class="table">
  83. <el-table
  84. ref="table"
  85. v-loading="listLoading"
  86. class="cql"
  87. :data="dataList"
  88. element-loading-text="Loading"
  89. border
  90. fit
  91. highlight-current-row
  92. stripe
  93. >
  94. <el-table-column align="center" type="index" min-width="160" show-overflow-tooltip />
  95. <el-table-column align="center" label="标题" prop="title" min-width="160" show-overflow-tooltip />
  96. <el-table-column align="center" label="来源" prop="source" min-width="160" show-overflow-tooltip />
  97. <el-table-column align="center" label="时间" prop="issueTime" min-width="160" show-overflow-tooltip />
  98. <el-table-column align="center" label="" min-width="160" show-overflow-tooltip>
  99. <template slot-scope="scope">
  100. <el-button type="text" class="textColor" @click="lookInDialog(scope.row.id)">查看</el-button>
  101. </template>
  102. </el-table-column>
  103. </el-table>
  104. </div>
  105. <!-- 文件下发 -->
  106. <div v-show="type == '2'" class="table">
  107. <el-table
  108. ref="table"
  109. v-loading="listLoading"
  110. :data="fileList"
  111. element-loading-text="Loading"
  112. border
  113. fit
  114. highlight-current-row
  115. stripe
  116. >
  117. <el-table-column align="center" type="index" min-width="160" show-overflow-tooltip />
  118. <el-table-column align="center" label="标题" prop="title" min-width="160" show-overflow-tooltip />
  119. <el-table-column align="center" label="来源" prop="operatorNickName" min-width="160" show-overflow-tooltip />
  120. <el-table-column align="center" label="时间" prop="createTime" min-width="160" show-overflow-tooltip />
  121. <el-table-column align="center" label="操作" min-width="160" show-overflow-tooltip>
  122. <template slot-scope="scope">
  123. <el-button type="text" class="textColor" @click="downloadFn(scope.row.id)">下载</el-button>
  124. </template>
  125. </el-table-column>
  126. </el-table>
  127. </div>
  128. <!-- 返利确认单 -->
  129. <div v-show="type == '3'" class="table">
  130. <el-table
  131. ref="table"
  132. v-loading="listLoading"
  133. :data="rebateList"
  134. element-loading-text="Loading"
  135. border
  136. fit
  137. highlight-current-row
  138. stripe
  139. >
  140. <el-table-column align="center" type="index" min-width="160" show-overflow-tooltip />
  141. <el-table-column
  142. align="center"
  143. label="经销商名称"
  144. prop="customerName"
  145. min-width="160"
  146. show-overflow-tooltip
  147. />
  148. <el-table-column align="center" label="确认人" prop="examineBy" min-width="160" show-overflow-tooltip />
  149. <el-table-column align="center" label="确认时间" prop="examineTime" min-width="160" show-overflow-tooltip />
  150. <el-table-column align="center" label="" min-width="160" show-overflow-tooltip>
  151. <template slot-scope="scope">
  152. <el-button type="text" class="textColor" @click="secondFn(scope.row.rebateOrderId)">{{
  153. isCustomer ? '确认' : '复核'
  154. }}</el-button>
  155. </template>
  156. </el-table-column>
  157. </el-table>
  158. </div>
  159. <!-- 物流通知 -->
  160. <div v-show="type == '4'" class="table">
  161. <el-table
  162. ref="table"
  163. v-loading="listLoading"
  164. :data="invoiceOrderList"
  165. element-loading-text="Loading"
  166. border
  167. fit
  168. highlight-current-row
  169. stripe
  170. >
  171. <el-table-column align="center" type="index" min-width="160" show-overflow-tooltip />
  172. <el-table-column align="center" label="发货单" prop="id" min-width="160" show-overflow-tooltip>
  173. <template slot-scope="scope">
  174. <el-link v-if="!isCustomer" type="primary" :underline="false" @click="handleJump(scope.row.id)">{{
  175. scope.row.id
  176. }}</el-link>
  177. <template v-else>{{ scope.row.id }}</template>
  178. </template>
  179. </el-table-column>
  180. <el-table-column align="center" label="内容" prop="orderTrackStatus" min-width="160" show-overflow-tooltip />
  181. <el-table-column align="center" label="时间" prop="orderTrackTime" min-width="160" show-overflow-tooltip />
  182. <el-table-column align="center" label="收货地址" prop="address" min-width="160" show-overflow-tooltip>
  183. <template slot-scope="scope">
  184. {{ scope.row.address ? scope.row.address : '——' }}
  185. </template>
  186. </el-table-column>
  187. <el-table-column align="center" label="收货客户" prop="receivingName" min-width="160" show-overflow-tooltip>
  188. <template slot-scope="scope">{{ scope.row.receivingName ? scope.row.receivingName : '——' }}</template>
  189. </el-table-column>
  190. <el-table-column align="center" label="" min-width="80" show-overflow-tooltip fixed="right">
  191. <template slot-scope="scope">
  192. <el-button type="text" class="textColor" @click="handLogistics(scope.row)">查看</el-button>
  193. </template>
  194. </el-table-column>
  195. </el-table>
  196. </div>
  197. <br />
  198. <br />
  199. <!-- 分页 -->
  200. <div class="fr">
  201. <el-pagination
  202. :current-page="currentPage"
  203. :page-sizes="[10, 20, 30, 50]"
  204. :page-size="10"
  205. layout="total, sizes, prev, pager, next, jumper"
  206. :total="listTotal"
  207. @size-change="handleSizeChange"
  208. @current-change="handleCurrentChange"
  209. />
  210. </div>
  211. <br /><br />
  212. <!-- 内层弹窗 -->
  213. <el-dialog width="40%" title="消息标题" :visible.sync="inDialog" append-to-body>
  214. <div class="detail-container">
  215. <div class="title">{{ detailData.title }}</div>
  216. <div class="text">
  217. 发布人:{{ detailData.issueNickName }}<el-divider direction="vertical" />发布时间:{{
  218. detailData.issueTime
  219. }}
  220. </div>
  221. <el-divider />
  222. <div class="content">{{ detailData.content }}</div>
  223. <el-divider v-if="detailData.files && detailData.files.length > 0" />
  224. <div v-if="detailData.files && detailData.files.length > 0" class="file">
  225. <div>附件:</div>
  226. <div class="file-list">
  227. <div v-for="(item, index) in detailData.files" :key="index" class="item">
  228. <el-image
  229. v-if="checkFileType(item.url) == 'image'"
  230. class="img"
  231. :src="imageURL + item.url"
  232. :preview-src-list="[imageURL + item.url]"
  233. />
  234. <div v-else class="box2" @click="openLink(item.url)">
  235. <img v-if="checkFileType(item.url) == 'word'" src="@/assets/common/word.png" />
  236. <img v-if="checkFileType(item.url) == 'excel'" src="@/assets/common/excel.png" />
  237. <img v-if="checkFileType(item.url) == 'ppt'" src="@/assets/common/ppt.png" />
  238. <img v-if="checkFileType(item.url) == 'pdf'" src="@/assets/common/pdf.png" />
  239. <div class="name ellipsis-3">{{ item.name }}</div>
  240. </div>
  241. </div>
  242. </div>
  243. </div>
  244. </div>
  245. <div slot="footer" class="dialog-footer">
  246. <el-button size="mini" type="primary" @click="confirmCheck(detailData.noticeId)">确认接收</el-button>
  247. <el-button size="mini" @click="inDialog = false">关 闭</el-button>
  248. </div>
  249. </el-dialog>
  250. <div slot="footer" class="dialog-footer">
  251. <el-button type="primary" size="mini" @click="closeFn">关闭</el-button>
  252. </div>
  253. </el-dialog>
  254. <el-dialog title="物流信息" :visible.sync="visible" width="60%" @close="onClose" :close-on-click-modal="false">
  255. <el-timeline class="logistics" :reverse="false" v-if="logisticsDetail.length">
  256. <el-timeline-item
  257. placement="top"
  258. type="success"
  259. v-for="(item, index) in logisticsDetail"
  260. :key="index"
  261. :timestamp="item.time"
  262. >
  263. <el-row :gutter="20">
  264. <el-col class="logistics-title"> {{ item.status }} </el-col>
  265. <el-col>
  266. <div class="flex">
  267. <div>{{ item.context }}</div>
  268. <!-- <div>{{ item.createTime }}</div> -->
  269. </div>
  270. </el-col>
  271. </el-row>
  272. </el-timeline-item>
  273. </el-timeline>
  274. <div v-else class="tip">暂无物流信息</div>
  275. </el-dialog>
  276. </div>
  277. </popu>
  278. </template>
  279. <script>
  280. import {
  281. getNoticeList,
  282. getComListList,
  283. getComListDownload,
  284. getNoticeDetail,
  285. confirmCheck,
  286. getRebateOrderList,
  287. getRouter,
  288. getMenuList,
  289. setMenuList,
  290. getListInvoiceOrder
  291. } from '@/api/dashboard'
  292. import { getListOrderTrack } from '@/api/supply/pickup'
  293. import { getFileUrl } from '@/api/common'
  294. import { mapGetters } from 'vuex'
  295. import popu from '@/components/template/popu.vue';
  296. export default {
  297. name: 'Dashboard',
  298. components: {
  299. popu,
  300. },
  301. created() {
  302. this.getDataList({
  303. pageSize: this.pageSize,
  304. pageNum: this.currentPage,
  305. readFlag: false
  306. })
  307. getRouter({
  308. flag: 'index',
  309. adminUserId: this.userid
  310. }).then(res => {
  311. this.menuList = res.data
  312. console.log(res.data)
  313. })
  314. this.getMenuList()
  315. },
  316. computed: {
  317. ...mapGetters(['showMessages', 'userid', 'isCustomer'])
  318. },
  319. data() {
  320. return {
  321. imageURL: this.$imageUrl,
  322. type: '1',
  323. currentPage: 1, // 当前页码
  324. pageSize: 10, // 每页数量
  325. listTotal: 0, // 列表总数
  326. dataList: [],
  327. listLoading: false, // 列表加载loading
  328. fileList: [],
  329. inDialog: false,
  330. detailData: [],
  331. rebateList: [],
  332. // isCustomer: JSON.parse(localStorage.getItem('supply_user')).isCustomer,
  333. menuList: [],
  334. dialogVisible: false,
  335. checkList: [],
  336. normsMenuList: [],
  337. invoiceOrderList: [],
  338. bol: true,
  339. visible: false,
  340. orderId: '',
  341. logisticsDetail: []
  342. }
  343. },
  344. methods: {
  345. // 获取常用菜单列表
  346. getMenuList() {
  347. getMenuList().then(res => {
  348. this.normsMenuList = res.data
  349. if (this.normsMenuList.length) {
  350. this.normsMenuList.forEach(k => {
  351. this.checkList.push(k.moduleId)
  352. })
  353. }
  354. })
  355. },
  356. // 保存常用菜单
  357. handleSaveMenu() {
  358. setMenuList({ adminModuleIds: this.checkList.join(',') }).then(res => {
  359. this.$successMsg('设置成功')
  360. this.checkList = []
  361. this.getMenuList()
  362. this.dialogVisible = false
  363. })
  364. },
  365. // 打开链接
  366. openLink(url) {
  367. getFileUrl({ key: url }).then(res => {
  368. window.open(res.data)
  369. })
  370. },
  371. // 复核
  372. secondFn(id) {
  373. this.$router.push({
  374. path: '/finance/rebate/rebate_list',
  375. query: {
  376. id
  377. }
  378. })
  379. this.$store.commit('user/showMessage', 'no')
  380. },
  381. // 确认查收
  382. confirmCheck(id) {
  383. confirmCheck({ noticeIds: id }).then(res => {
  384. this.$successMsg('查收成功')
  385. this.inDialog = false
  386. this.getDataList({
  387. pageSize: this.pageSize,
  388. pageNum: this.currentPage,
  389. readFlag: false
  390. })
  391. })
  392. },
  393. // 检查文件类型
  394. checkFileType(url) {
  395. if (!url) return ''
  396. const fileSuffix = url.substring(url.lastIndexOf('.') + 1)
  397. if (['jpg', 'jpeg', 'png'].includes(fileSuffix)) {
  398. return 'image'
  399. } else if (['doc', 'docx', 'dot', 'wps', 'wpt'].includes(fileSuffix)) {
  400. return 'word'
  401. } else if (['xls', 'xlsx', 'xlt', 'et', 'ett'].includes(fileSuffix)) {
  402. return 'excel'
  403. } else if (['ppt', 'pptx', 'dps', 'dpt', 'pot', 'pps'].includes(fileSuffix)) {
  404. return 'ppt'
  405. } else if (['pdf'].includes(fileSuffix)) {
  406. return 'pdf'
  407. } else {
  408. return ''
  409. }
  410. },
  411. // 查看
  412. async lookInDialog(id) {
  413. const res = await getNoticeDetail({ id })
  414. // console.log(res, 7898);
  415. this.detailData = res.data
  416. this.inDialog = true
  417. },
  418. // 下载
  419. async downloadFn(id) {
  420. const res = await getComListDownload({ id })
  421. if (res.data) {
  422. window.open(this.imageURL + res.data)
  423. }
  424. },
  425. // 获取文件列表数据
  426. async getFileList(data) {
  427. const res = await getComListList(data)
  428. this.fileList = res.data.records
  429. this.listTotal = res.data.total
  430. },
  431. // 更改每页数量
  432. handleSizeChange(val) {
  433. this.pageSize = val
  434. this.currentPage = 1
  435. if (this.type == 1) {
  436. this.getDataList({
  437. pageSize: this.pageSize,
  438. pageNum: this.currentPage,
  439. readFlag: false
  440. })
  441. }
  442. if (this.type == 2) {
  443. this.getFileList({
  444. needDown: true,
  445. pageSize: this.pageSize,
  446. pageNo: this.currentPage
  447. })
  448. }
  449. if (this.type == 3) {
  450. this.getRebateList({
  451. pageSize: this.pageSize,
  452. pageNum: this.currentPage,
  453. isSecondExamine: false
  454. })
  455. }
  456. if (this.type == 4) {
  457. this.getListInvoiceOrder({
  458. pageSize: this.pageSize,
  459. pageNum: this.currentPage
  460. })
  461. }
  462. },
  463. // 更改当前页
  464. handleCurrentChange(val) {
  465. this.currentPage = val
  466. if (this.type == 1) {
  467. this.getDataList({
  468. pageSize: this.pageSize,
  469. pageNum: this.currentPage,
  470. readFlag: false
  471. })
  472. }
  473. if (this.type == 2) {
  474. this.getFileList({
  475. needDown: true,
  476. pageSize: this.pageSize,
  477. pageNo: this.currentPage
  478. })
  479. }
  480. if (this.type == 3) {
  481. this.getRebateList({
  482. pageSize: this.pageSize,
  483. pageNum: this.currentPage,
  484. isSecondExamine: false
  485. })
  486. }
  487. if (this.type == 4) {
  488. this.getListInvoiceOrder({
  489. pageSize: this.pageSize,
  490. pageNum: this.currentPage
  491. })
  492. }
  493. },
  494. // 获取返利确认单数据
  495. async getRebateList(data) {
  496. const res = await getRebateOrderList(data)
  497. this.rebateList = res.data.records
  498. this.listTotal = res.data.total
  499. },
  500. // 获取列表数据
  501. async getDataList(data) {
  502. const res = await getNoticeList(data)
  503. console.log(res)
  504. this.dataList = res.data.records
  505. this.listTotal = res.data.total
  506. },
  507. // 获取物流列表
  508. async getListInvoiceOrder(data) {
  509. const res = await getListInvoiceOrder(data)
  510. this.invoiceOrderList = res.data.records
  511. this.listTotal = res.data.total
  512. },
  513. // 选择
  514. checkFn(v) {
  515. this.$refs.table.doLayout()
  516. this.type = v
  517. if (v == 1) {
  518. this.getDataList({
  519. pageSize: this.pageSize,
  520. pageNum: this.currentPage,
  521. readFlag: false
  522. })
  523. }
  524. if (v == 2) {
  525. this.getFileList({
  526. needDown: true,
  527. pageSize: this.pageSize,
  528. pageNo: this.currentPage
  529. })
  530. }
  531. if (v == 3) {
  532. this.getRebateList({
  533. pageSize: this.pageSize,
  534. pageNum: this.currentPage,
  535. isSecondExamine: false
  536. })
  537. }
  538. if (v == 4) {
  539. this.getListInvoiceOrder({
  540. pageSize: this.pageSize,
  541. pageNum: this.currentPage
  542. })
  543. }
  544. },
  545. // 关闭
  546. closeFn() {
  547. this.$store.commit('user/showMessage', 'no')
  548. },
  549. // 点击菜单
  550. clickMenu(path) {
  551. const curlArr = ['/notice', '/issue']
  552. if (curlArr.includes(path)) {
  553. path += '/index'
  554. }
  555. this.$router.push({
  556. path
  557. })
  558. },
  559. handLogistics(row) {
  560. getListOrderTrack({ orderId: row.id }).then(res => {
  561. this.logisticsDetail = res.data
  562. })
  563. this.orderId = row.id
  564. this.visible = true
  565. },
  566. onClose() {
  567. this.logisticsDetail = []
  568. this.orderId = ''
  569. this.visible = false
  570. },
  571. handleJump(id) {
  572. this.$router.push({ path: `/exwarehouse/sum_list?id=${id}` })
  573. this.$store.commit('user/SET_MESSAGE', false)
  574. this.inDialog = false
  575. }
  576. }
  577. }
  578. </script>
  579. <style lang="scss" scoped>
  580. .dashboard {
  581. &-container {
  582. background: #f5f5f5;
  583. padding: 30px;
  584. min-height: calc(100vh - 86px);
  585. .top-container {
  586. .today-content {
  587. font-size: 14px;
  588. }
  589. }
  590. }
  591. }
  592. .cql {
  593. ::v-deep.el-table__header-wrapper {
  594. background-color: #f5f7fa;
  595. }
  596. }
  597. .dia-menu-title {
  598. padding: 10px 0;
  599. color: #000;
  600. font-weight: bold;
  601. }
  602. .dia-tip {
  603. padding: 10px 0;
  604. color: #000;
  605. font-weight: bold;
  606. }
  607. .dia-child {
  608. display: flex;
  609. flex-wrap: wrap;
  610. }
  611. .dia-item {
  612. flex: 0 1 220px;
  613. padding: 3px 0;
  614. }
  615. .menu-list {
  616. .main-title {
  617. margin: 10px 0 0;
  618. .el-icon-setting {
  619. cursor: pointer;
  620. font-size: 22px;
  621. }
  622. }
  623. .group {
  624. margin-bottom: 20px;
  625. .child {
  626. display: flex;
  627. flex-wrap: wrap;
  628. padding-left: 10px;
  629. .el-row {
  630. width: 100%;
  631. }
  632. .item {
  633. margin-top: 16px;
  634. }
  635. }
  636. }
  637. ::v-deep .el-link--inner {
  638. white-space: nowrap;
  639. overflow: hidden;
  640. text-overflow: ellipsis;
  641. }
  642. }
  643. .logistics-title {
  644. padding-bottom: 10px;
  645. }
  646. .tip {
  647. height: 200px;
  648. text-align: center;
  649. line-height: 200px;
  650. }
  651. </style>