index.vue 20 KB

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