Navbar.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949
  1. <template>
  2. <div class="navbar">
  3. <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
  4. <breadcrumb v-if="showBreadcrumb" class="breadcrumb-container" />
  5. <!-- <NavMenu class="navmenu" /> -->
  6. <div class="right-menu">
  7. <!-- <div class="right-menu-item hover-effect">
  8. <el-tooltip effect="dark" content="家用工程机登录" placement="bottom">
  9. <i
  10. class="el-icon-s-platform"
  11. style="font-size: 24px; line-height: 50px"
  12. @click="toEngine"
  13. ></i>
  14. </el-tooltip>
  15. </div> -->
  16. <div class="right-menu-item" style="display: flex" v-if="isHongGe">
  17. <el-select v-model="changeNum" filterable :disabled="!isHongGe" @change="handleChangeArea">
  18. <el-option v-for="item in areaOpti" :key="item.value" :label="item.label" :value="item.value"> </el-option>
  19. </el-select>
  20. </div>
  21. <!-- <div class="right-menu-item hover-effect" style="display: flex" @click="handleShow">
  22. <el-badge>
  23. <i class="el-icon-message-solid" style="font-size: 24px; line-height: 50px" />
  24. </el-badge>
  25. <span style="font-size: 16px; margin-left: 15px">物流通知</span>
  26. </div> -->
  27. <div class="right-menu-item hover-effect" style="display: flex" @click="handleNotice('click')">
  28. <el-badge value="示">
  29. <i class="el-icon-message-solid" style="font-size: 24px; line-height: 50px" />
  30. </el-badge>
  31. <span style="font-size: 16px; margin-left: 15px">物流到货通知</span>
  32. </div>
  33. <div class="right-menu-item hover-effect" @click="toEngine">
  34. <i class="el-icon-s-platform" style="font-size: 18px" />
  35. <span style="font-size: 16px; margin-left: 6px">家用工程机登录</span>
  36. </div>
  37. <el-badge :value="noticeCount" :max="10" :hidden="!noticeVisible" class="right-menu-item hover-effect">
  38. <el-tooltip effect="dark" content="系统消息" placement="bottom">
  39. <i class="el-icon-message-solid" style="font-size: 24px; line-height: 50px" @click="goNotice" />
  40. </el-tooltip>
  41. <!-- <el-button icon="el-icon-message-solid" type="text" class="notice-icon" @click="goNotice"></el-button> -->
  42. </el-badge>
  43. <template v-if="device !== 'mobile'">
  44. <screenfull id="screenfull" class="right-menu-item hover-effect" />
  45. </template>
  46. <el-dropdown class="user-container" trigger="click">
  47. <div class="user right-menu-item hover-effect">
  48. <i class="el-icon-user-solid" />
  49. <span>{{ name }}</span>
  50. </div>
  51. <el-dropdown-menu slot="dropdown" class="user-dropdown">
  52. <router-link to="/setting/personal">
  53. <el-dropdown-item>个人信息</el-dropdown-item>
  54. </router-link>
  55. <el-dropdown-item divided @click.native="logout">
  56. <span style="display: block">退出登录</span>
  57. </el-dropdown-item>
  58. </el-dropdown-menu>
  59. </el-dropdown>
  60. </div>
  61. <el-dialog title="绑定工程机系统" :visible.sync="dialogFormVisible" :modal="false" width="30%">
  62. <el-form ref="engineForm" :model="engineForm" :rules="engineFormRules">
  63. <el-form-item label="账号" :label-width="formLabelWidth" prop="account">
  64. <el-input v-model="engineForm.account" placeholder="请输入账号" autocomplete="off" />
  65. </el-form-item>
  66. <el-form-item label="密码" :label-width="formLabelWidth" prop="password">
  67. <el-input v-model="engineForm.password" placeholder="请输入密码" autocomplete="off" show-password />
  68. </el-form-item>
  69. </el-form>
  70. <div slot="footer" class="dialog-footer">
  71. <el-button @click="dialogFormVisible = false">取 消</el-button>
  72. <el-button type="primary" @click="submitForm">确 定</el-button>
  73. </div>
  74. </el-dialog>
  75. <el-dialog
  76. title="到货通知"
  77. :modal="false"
  78. width="70%"
  79. :visible.sync="hasNotice"
  80. :append-to-body="true"
  81. @close="handleNotice(false)"
  82. >
  83. <div style="margin-top: 20px">
  84. <el-radio-group v-model="noticeType" size="mini" @change="handleChangeNotice">
  85. <el-radio-button :label="1">物流通知</el-radio-button>
  86. <el-radio-button :label="2">到货通知</el-radio-button>
  87. </el-radio-group>
  88. </div>
  89. <div v-show="noticeType === 2" class="mymain-container">
  90. <el-form ref="form" :model="form" label-width="80px" label-position="left" size="mini">
  91. <el-row>
  92. <el-col>
  93. <el-form-item prop="specification" label="规格型号">
  94. <div style="display: flex">
  95. <el-input v-model="form.specification" clearable style="margin-right: 10px" />
  96. <el-button
  97. @click="
  98. form.specification = ''
  99. getNoticeList()
  100. "
  101. >重置</el-button
  102. >
  103. <el-button type="primary" @click="getNoticeLists">查询</el-button>
  104. </div>
  105. </el-form-item>
  106. </el-col>
  107. </el-row>
  108. </el-form>
  109. <div class="table">
  110. <el-table v-loading="listLoading" :data="noticeList" border>
  111. <el-table-column
  112. property="materialOldNumber"
  113. align="left"
  114. min-width="120"
  115. label="产品编号"
  116. show-overflow-tooltip
  117. />
  118. <el-table-column
  119. property="materialNumber"
  120. align="left"
  121. min-width="100"
  122. label="物料编码"
  123. show-overflow-tooltip
  124. />
  125. <el-table-column
  126. property="materialName"
  127. align="left"
  128. min-width="250"
  129. label="产品名称"
  130. show-overflow-tooltip
  131. />
  132. <el-table-column
  133. property="specification"
  134. align="left"
  135. min-width="350"
  136. label="规格型号"
  137. show-overflow-tooltip
  138. />
  139. <el-table-column property="stockName" align="left" min-width="100" label="到货仓库" show-overflow-tooltip />
  140. <el-table-column
  141. property="updateTime"
  142. align="left"
  143. min-width="200"
  144. label="到货通知时间"
  145. show-overflow-tooltip
  146. />
  147. </el-table>
  148. <div class="flex">
  149. <div />
  150. <div class="fr">
  151. <el-pagination
  152. :current-page="currentPage2"
  153. :page-sizes="[10, 20, 30, 50]"
  154. :page-size="10"
  155. layout="total, prev, pager, next"
  156. :total="listTotal2"
  157. @size-change="handleSizeChange2"
  158. @current-change="handleCurrentChange2"
  159. />
  160. </div>
  161. </div>
  162. </div>
  163. </div>
  164. <div v-show="noticeType === 1" class="mymain-container">
  165. <div class="table">
  166. <el-table
  167. ref="table"
  168. v-loading="listLoading"
  169. :data="invoiceOrderList"
  170. element-loading-text="Loading"
  171. border
  172. fit
  173. highlight-current-row
  174. stripe
  175. >
  176. <el-table-column align="center" type="index" min-width="160" show-overflow-tooltip />
  177. <el-table-column align="center" label="发货单" prop="id" min-width="160" show-overflow-tooltip>
  178. <template slot-scope="scope">
  179. <el-link v-if="!isCustomer" type="primary" :underline="false" @click="handleJump(scope.row.id)">{{
  180. scope.row.id
  181. }}</el-link>
  182. <template v-else>{{ scope.row.id }}</template>
  183. </template>
  184. </el-table-column>
  185. <el-table-column
  186. align="center"
  187. label="内容"
  188. prop="orderTrackStatus"
  189. min-width="160"
  190. show-overflow-tooltip
  191. />
  192. <el-table-column align="center" label="时间" prop="orderTrackTime" min-width="160" show-overflow-tooltip />
  193. <el-table-column align="center" label="收货地址" prop="address" min-width="160" show-overflow-tooltip>
  194. <template slot-scope="scope">
  195. {{ scope.row.address ? scope.row.address : '——' }}
  196. </template>
  197. </el-table-column>
  198. <el-table-column align="center" label="收货客户" prop="receivingName" min-width="160" show-overflow-tooltip>
  199. <template slot-scope="scope">{{ scope.row.receivingName ? scope.row.receivingName : '——' }}</template>
  200. </el-table-column>
  201. <el-table-column align="center" label="" min-width="80" show-overflow-tooltip fixed="right">
  202. <template slot-scope="scope">
  203. <el-button type="text" class="textColor" @click="handLogistics(scope.row)">查看</el-button>
  204. </template>
  205. </el-table-column>
  206. </el-table>
  207. <!-- 分页 -->
  208. <div class="flex">
  209. <div></div>
  210. <div class="fr">
  211. <el-pagination
  212. :current-page="currentPage"
  213. :page-sizes="[10, 20, 30, 50]"
  214. :page-size="10"
  215. layout="total, sizes, prev, pager, next, jumper"
  216. :total="listTotal"
  217. @size-change="handleSizeChange"
  218. @current-change="handleCurrentChange"
  219. />
  220. </div>
  221. </div>
  222. </div>
  223. </div>
  224. </el-dialog>
  225. <el-dialog title="物流通知" :visible.sync="isLogistics" width="60%" :modal="true" @close="isLogistics = false">
  226. <div class="table">
  227. <el-table
  228. ref="table"
  229. v-loading="listLoading"
  230. :data="invoiceOrderList"
  231. element-loading-text="Loading"
  232. border
  233. fit
  234. highlight-current-row
  235. stripe
  236. >
  237. <el-table-column align="center" type="index" min-width="160" show-overflow-tooltip />
  238. <el-table-column align="center" label="发货单" prop="id" min-width="160" show-overflow-tooltip>
  239. <template slot-scope="scope">
  240. <el-link v-if="!isCustomer" type="primary" :underline="false" @click="handleJump(scope.row.id)">{{
  241. scope.row.id
  242. }}</el-link>
  243. <template v-else>{{ scope.row.id }}</template>
  244. </template>
  245. </el-table-column>
  246. <el-table-column align="center" label="内容" prop="orderTrackStatus" min-width="160" show-overflow-tooltip />
  247. <el-table-column align="center" label="时间" prop="orderTrackTime" min-width="160" show-overflow-tooltip />
  248. <el-table-column align="center" label="收货地址" prop="address" min-width="160" show-overflow-tooltip>
  249. <template slot-scope="scope">
  250. {{ scope.row.address ? scope.row.address : '——' }}
  251. </template>
  252. </el-table-column>
  253. <el-table-column align="center" label="收货客户" prop="receivingName" min-width="160" show-overflow-tooltip>
  254. <template slot-scope="scope">{{ scope.row.receivingName ? scope.row.receivingName : '——' }}</template>
  255. </el-table-column>
  256. <el-table-column align="center" label="" min-width="80" show-overflow-tooltip fixed="right">
  257. <template slot-scope="scope">
  258. <el-button type="text" class="textColor" @click="handLogistics(scope.row)">查看</el-button>
  259. </template>
  260. </el-table-column>
  261. </el-table>
  262. </div>
  263. <!-- 分页 -->
  264. <div class="fr">
  265. <el-pagination
  266. :current-page="currentPage"
  267. :page-sizes="[10, 20, 30, 50]"
  268. :page-size="10"
  269. layout="total, sizes, prev, pager, next, jumper"
  270. :total="listTotal"
  271. @size-change="handleSizeChange"
  272. @current-change="handleCurrentChange"
  273. />
  274. </div>
  275. <br />
  276. <br />
  277. </el-dialog>
  278. <el-dialog
  279. title="物流信息"
  280. :visible.sync="visible"
  281. width="60%"
  282. @close="onClose"
  283. :modal="false"
  284. :close-on-click-modal="false"
  285. >
  286. <el-timeline class="logistics" :reverse="false" v-if="logisticsDetail.length">
  287. <el-timeline-item
  288. placement="top"
  289. type="success"
  290. v-for="(item, index) in logisticsDetail"
  291. :key="index"
  292. :timestamp="item.time"
  293. >
  294. <el-row :gutter="20">
  295. <el-col class="logistics-title"> {{ item.status }} </el-col>
  296. <el-col>
  297. <div class="flex">
  298. <div>{{ item.context }}</div>
  299. <!-- <div>{{ item.createTime }}</div> -->
  300. </div>
  301. </el-col>
  302. </el-row>
  303. </el-timeline-item>
  304. </el-timeline>
  305. <div v-else class="tip">暂无物流信息</div>
  306. </el-dialog>
  307. <!-- 工程机多帐号-->
  308. <!-- <el-dialog-->
  309. <!-- title="绑定工程机系统"-->
  310. <!-- :visible.sync="dialogFormVisible"-->
  311. <!-- :modal="false"-->
  312. <!-- width="60%"-->
  313. <!-- >-->
  314. <!-- <el-form ref="engineForm" :model="engineForm">-->
  315. <!-- <el-row v-for="(row, index) in engineForm.engineList" :key="row.id" :gutter="20">-->
  316. <!-- <el-col :span="8">-->
  317. <!-- <el-form-item-->
  318. <!-- :label="'账号' + (index+1)"-->
  319. <!-- :label-width="formLabelWidth"-->
  320. <!-- :prop="'engineList.' + index + '.enginUserName'"-->
  321. <!-- :rules="{required: true, message: '请输入工程机账号', trigger: 'blur'}"-->
  322. <!-- >-->
  323. <!-- <el-input v-model="row.enginUserName" placeholder="请输入账号" autocomplete="off"></el-input>-->
  324. <!-- </el-form-item>-->
  325. <!-- </el-col>-->
  326. <!-- <el-col :span="8">-->
  327. <!-- <el-form-item-->
  328. <!-- :label="'密码' + (index+1)"-->
  329. <!-- :label-width="formLabelWidth"-->
  330. <!-- :prop="'engineList.' + index + '.enginPassword'"-->
  331. <!-- :rules="{required: true, message: '请输入工程机密码', trigger: 'blur'}"-->
  332. <!-- >-->
  333. <!-- <el-input v-model="row.enginPassword" placeholder="请输入密码" autocomplete="off" show-password></el-input>-->
  334. <!-- </el-form-item>-->
  335. <!-- </el-col>-->
  336. <!-- <el-col :span="8">-->
  337. <!-- <template v-if="row.adminUserId">-->
  338. <!-- <el-button @click="submitForm(index)">重验</el-button>-->
  339. <!-- </template>-->
  340. <!-- <template v-else>-->
  341. <!-- <el-button @click="submitForm(index)">验证</el-button>-->
  342. <!-- </template>-->
  343. <!-- <el-button v-if="row.adminUserId" @click="toEngine(index)">打开</el-button>-->
  344. <!-- <el-button @click="delAccountForm(index)">删除</el-button>-->
  345. <!-- </el-col>-->
  346. <!-- </el-row>-->
  347. <!-- </el-form>-->
  348. <!-- <div slot="footer" class="dialog-footer">-->
  349. <!-- <el-button @click="addRowEngine">新增账号</el-button>-->
  350. <!-- <el-button @click="dialogFormVisible = false">取 消</el-button>-->
  351. <!-- </div>-->
  352. <!-- </el-dialog>-->
  353. </div>
  354. </template>
  355. <script>
  356. import { mapGetters } from 'vuex'
  357. import Breadcrumb from '@/components/Breadcrumb'
  358. import Hamburger from '@/components/Hamburger'
  359. import Screenfull from '@/components/Screenfull'
  360. import NavMenu from '@/components/NavMenu'
  361. import { getNoticeListCount } from '@/api/notice'
  362. import { getNoticeList } from '@/api/stock'
  363. import { getListOrderTrack } from '@/api/supply/pickup'
  364. import { getListInvoiceOrder } from '@/api/dashboard'
  365. import { bindEngineAccount, checkEngineAccount, setUserChanging } from '@/api/setting'
  366. import mixin from '@/mixin'
  367. export default {
  368. components: {
  369. Breadcrumb,
  370. Hamburger,
  371. Screenfull,
  372. NavMenu
  373. },
  374. mixins: [mixin],
  375. data() {
  376. return {
  377. noticeType: 1,
  378. intivalId: '',
  379. timer: '',
  380. noticeCount: 0,
  381. userInfo: '',
  382. engineForm: {
  383. account: '',
  384. password: ''
  385. // engineList: []
  386. },
  387. engineFormRules: {
  388. account: [{ required: true, message: '请输入工程机账号', trigger: 'blur' }],
  389. password: [{ required: true, message: '请输入工程机密码', trigger: 'blur' }]
  390. },
  391. formLabelWidth: '100px',
  392. dialogFormVisible: false,
  393. // websocket错误连接次数
  394. wsConnectErrorTime: 1,
  395. websock: null,
  396. lockReconnect: false,
  397. noticeList: [],
  398. form: {
  399. specification: ''
  400. },
  401. isLogistics: false,
  402. visible: false,
  403. orderId: '',
  404. logisticsDetail: [],
  405. invoiceOrderList: [],
  406. currentPage: 1, // 当前页码
  407. pageSize: 10, // 每页数量
  408. listTotal: 0, // 列表总数
  409. currentPage2: 1, // 当前页码
  410. pageSize2: 10, // 每页数量
  411. listTotal2: 0, // 列表总数
  412. myType: '',
  413. changeNum: localStorage.getItem('user_change_num') || '1',
  414. areaOpti: [
  415. { label: '弘格', value: '1' },
  416. { label: '广州', value: '2' },
  417. { label: '佛山', value: '3' }
  418. ]
  419. }
  420. },
  421. mounted() {
  422. const that = this
  423. // 开定时器轮询未读消息接口(写在全局vuex里比较好)
  424. // that.initNotice();
  425. // that.tcMessage();
  426. // this.intivalId = setInterval(function () {
  427. // that.tcMessage();
  428. // }, 5000);
  429. // this.timer = setInterval(function () {
  430. // that.initNotice();
  431. // }, 3000);
  432. // 长链接
  433. // this.initWebSocket();
  434. },
  435. created() {
  436. this.userInfo = JSON.parse(localStorage.getItem('supply_user'))
  437. },
  438. beforeDestroy() {
  439. window.clearInterval(this.intivalId)
  440. window.clearInterval(this.timer)
  441. this.websocketOnclose()
  442. },
  443. computed: {
  444. showBreadcrumb() {
  445. return this.$store.state.settings.breadcrumb
  446. },
  447. noticeVisible() {
  448. return this.noticeCount > 0
  449. },
  450. hasNotice: {
  451. get() {
  452. // 数据为空是不展示消息通知弹框
  453. if (!this.noticeList.length && !this.myType) {
  454. return false
  455. } else {
  456. // if (this.noticeList.length) {
  457. // return true
  458. // }
  459. return this.isNotice
  460. }
  461. },
  462. set(e) {
  463. return e
  464. }
  465. },
  466. ...mapGetters(['sidebar', 'avatar', 'device', 'name', 'isNotice', 'isCustomer', 'isHongGe'])
  467. },
  468. methods: {
  469. getList() {
  470. // this.getNoticeList()
  471. },
  472. handleChangeNotice(e) {
  473. if (e === 2) {
  474. this.currentPage2 = 1
  475. this.pageSize2 = 10
  476. this.getNoticeList()
  477. } else {
  478. this.pageSize = 1
  479. this.currentPage = 10
  480. this.getListInvoiceOrder()
  481. }
  482. },
  483. getNoticeList() {
  484. // this.listLoading = true
  485. getNoticeList({
  486. pageNum: this.currentPage2,
  487. pageSize: this.pageSize2,
  488. specification: this.form.specification
  489. }).then(res => {
  490. this.noticeList = res.data.records
  491. this.listTotal2 = res.data.total
  492. // this.listLoading = false
  493. })
  494. },
  495. getNoticeLists() {
  496. // this.listLoading = true
  497. getNoticeList({
  498. pageNum: 1,
  499. pageSize: this.pageSize2,
  500. specification: this.form.specification
  501. }).then(res => {
  502. this.noticeList = res.data.records
  503. this.listTotal2 = res.data.total
  504. // this.listLoading = false
  505. })
  506. },
  507. // 获取物流列表
  508. getListInvoiceOrder(data) {
  509. // this.listLoading = true
  510. getListInvoiceOrder({
  511. pageSize: this.pageSize,
  512. pageNum: this.currentPage
  513. }).then(res => {
  514. this.invoiceOrderList = res.data.records
  515. this.listTotal = res.data.total
  516. // this.listLoading = false
  517. })
  518. },
  519. handleNotice(flag = true) {
  520. if (flag || flag == 'click') {
  521. if (flag == 'click') {
  522. this.myType = flag
  523. }
  524. this.getListInvoiceOrder()
  525. this.$store.commit('user/SET_STATUS', true)
  526. } else {
  527. if (!flag) {
  528. this.myType = ''
  529. }
  530. this.noticeType = 1
  531. this.$store.commit('user/SET_STATUS', false)
  532. }
  533. },
  534. toggleSideBar() {
  535. this.$store.dispatch('app/toggleSideBar')
  536. },
  537. async logout() {
  538. await this.$store.dispatch('user/logout')
  539. // this.$router.push(`/login?redirect=${this.$route.fullPath}`)
  540. this.$store.commit('tagsView/SET_RESET_VIES')
  541. this.$router.push(`/login`)
  542. },
  543. initNotice() {
  544. getNoticeListCount().then(res => {
  545. if (res.data > 0 && this.noticeCount !== res.data) {
  546. this.noticeCount = res.data
  547. } else if (res.data === 0 && this.noticeCount !== res.data) {
  548. this.noticeCount = 0
  549. }
  550. })
  551. },
  552. // async tcMessage() {
  553. // // 长链接
  554. // // let data = {
  555. // // type: 'RebateOrderMsg',
  556. // // params: {
  557. // // }
  558. // // }
  559. // // this.websocketSend(JSON.stringify(data))
  560. // let res = await getRebateOrderMsg();
  561. // if (res.data.hasMessage) {
  562. // this.$notify.info({
  563. // title: "消息",
  564. // message: res.data.messages,
  565. // position: "bottom-right",
  566. // duration: 4000,
  567. // showClose: false,
  568. // });
  569. // }
  570. // },
  571. goNotice() {
  572. this.$router.push('/notice/index')
  573. },
  574. openEngineAccount() {
  575. this.engineForm.engineList = this.userInfo.bindEnginList
  576. this.dialogFormVisible = true
  577. },
  578. toEngine() {
  579. const userInfoCopy = this.userInfo
  580. if (userInfoCopy && userInfoCopy.bindEngin) {
  581. checkEngineAccount().then(res => {
  582. if (res.code === 200) {
  583. // this.$refs.engineSubmit.click()
  584. const { href } = this.$router.resolve({
  585. name: 'open_engin'
  586. })
  587. window.open(href, '_blank')
  588. } else {
  589. this.$errorMsg('账号密码错误,请重新绑定')
  590. this.dialogFormVisible = true
  591. }
  592. })
  593. } else {
  594. this.dialogFormVisible = true
  595. }
  596. },
  597. // toEngine(index) {
  598. // 工程机多帐号
  599. // const { href } = this.$router.resolve({
  600. // name: "open_engin",
  601. // query: {
  602. // index: index
  603. // }
  604. // });
  605. // window.open(href, "_blank");
  606. // },
  607. // addRowEngine() {
  608. // this.engineForm.engineList.push({
  609. // adminUserId: '',
  610. // enginPassword: '',
  611. // enginUserName: '',
  612. // status: '',
  613. // })
  614. // },
  615. submitForm() {
  616. this.$refs.engineForm.validate(valid => {
  617. if (valid) {
  618. const params = {
  619. enginUserName: this.engineForm.account,
  620. enginPassword: this.engineForm.password
  621. }
  622. bindEngineAccount(params).then(res => {
  623. if (res.code === 200) {
  624. this.$successMsg('绑定成功,正在打开工程机系统')
  625. this.dialogFormVisible = false
  626. this.$store.dispatch('user/getInfo').then(() => {
  627. this.userInfo = JSON.parse(localStorage.getItem('supply_user'))
  628. const { href } = this.$router.resolve({
  629. name: 'open_engin'
  630. })
  631. window.open(href, '_blank')
  632. })
  633. } else {
  634. this.$errorMsg(res.message)
  635. }
  636. })
  637. }
  638. })
  639. },
  640. // submitForm(index) {
  641. // 工程机多帐号
  642. // this.$refs.engineForm.validate((valid) => {
  643. // if (valid) {
  644. // const params = {
  645. // enginUserName: this.engineForm.engineList[index].enginUserName,
  646. // enginPassword: this.engineForm.engineList[index].enginPassword,
  647. // isReset: this.engineForm.engineList[index].adminUserId !== ''
  648. // };
  649. // bindEngineAccount(params).then((res) => {
  650. // if (res.code === 200) {
  651. // this.$successMsg("绑定成功,工程机系统");
  652. // this.$store.dispatch("user/getInfo").then(() => {
  653. // this.userInfo = JSON.parse(localStorage.getItem("supply_user"));
  654. // this.engineForm.engineList = this.userInfo.bindEnginList
  655. // });
  656. // } else {
  657. // this.$errorMsg(res.message);
  658. // }
  659. // });
  660. // }
  661. // });
  662. // },
  663. // delAccountForm(index) {
  664. // if (this.engineForm.engineList[index].id) {
  665. // this.$confirm('此操作将删除账号, 是否继续?', '提示', {
  666. // confirmButtonText: '确定',
  667. // cancelButtonText: '取消',
  668. // type: 'warning',
  669. // center: true
  670. // }).then(() => {
  671. // delEngineAccount({id: this.engineForm.engineList[index].id}).then(() => {
  672. // this.$store.dispatch("user/getInfo").then(() => {
  673. // this.userInfo = JSON.parse(localStorage.getItem("supply_user"));
  674. // this.engineForm.engineList = this.userInfo.bindEnginList
  675. // });
  676. // this.$successMsg("删除成功");
  677. // })
  678. // }).catch(() => {
  679. // });
  680. // } else {
  681. // this.engineForm.engineList.splice(index, 1)
  682. // }
  683. // }
  684. initWebSocket: function () {
  685. // WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
  686. // var userId = this.$store.getters.userid;
  687. //
  688. // var url = process.env.VUE_APP_BASE_API.replace("https://","wss://").replace("http://","ws://").replace("api","supply")+"websocket/"+userId;
  689. // console.debug(userId, url);
  690. // let token = getToken()
  691. // this.websock = new WebSocket(url, [token]);
  692. // this.websock.onopen = this.websocketOnopen;
  693. // this.websock.onerror = this.websocketOnerror;
  694. // this.websock.onmessage = this.websocketOnmessage;
  695. // this.websock.onclose = this.websocketOnclose;
  696. },
  697. websocketOnopen: function () {
  698. console.debug('WebSocket连接成功')
  699. // 心跳检测重置
  700. // this.heartCheck.reset().start();
  701. },
  702. websocketOnerror: function (e) {
  703. console.debug('WebSocket连接发生错误,第%s次', this.wsConnectErrorTime)
  704. this.wsConnectErrorTime = this.wsConnectErrorTime + 1
  705. if (this.wsConnectErrorTime > 5) {
  706. console.debug('WebSocket连接错误超过5次,就不再重新连了!')
  707. this.lockReconnect = true
  708. return
  709. }
  710. this.reconnect()
  711. },
  712. websocketOnmessage: function (e) {
  713. console.debug('-----接收消息-------', e.data)
  714. const data = eval('(' + e.data + ')') // 解析对象
  715. if (data.type === 'RebateOrderMsg') {
  716. if (data.res.hasMessage) {
  717. this.$notify.info({
  718. title: '消息',
  719. message: res.data.messages,
  720. position: 'bottom-right',
  721. duration: 4000,
  722. showClose: false
  723. })
  724. }
  725. }
  726. },
  727. websocketOnclose: function (e) {
  728. console.debug('connection closed (' + e + ')')
  729. if (e) {
  730. console.debug('connection closed (' + e.code + ')')
  731. }
  732. this.reconnect()
  733. },
  734. websocketSend(text) {
  735. // 数据发送
  736. try {
  737. this.websock.send(text)
  738. } catch (err) {
  739. console.debug('send failed (' + err.code + ')')
  740. }
  741. },
  742. reconnect() {
  743. var that = this
  744. if (that.lockReconnect) return
  745. that.lockReconnect = true
  746. // 没连接上会一直重连,设置延迟避免请求过多
  747. setTimeout(function () {
  748. console.debug('尝试重连...')
  749. that.initWebSocket()
  750. that.lockReconnect = false
  751. }, 20000)
  752. },
  753. handleShow() {
  754. ;(this.isLogistics = true), this.getListInvoiceOrder()
  755. },
  756. // 更改每页数量
  757. handleSizeChange2(val) {
  758. this.pageSize2 = val
  759. this.currentPage2 = 1
  760. this.getNoticeList()
  761. },
  762. // 更改当前页
  763. handleCurrentChange2(val) {
  764. this.currentPage2 = val
  765. this.getNoticeList()
  766. },
  767. // 更改每页数量
  768. handleSizeChange(val) {
  769. this.pageSize = val
  770. this.currentPage = 1
  771. this.getListInvoiceOrder()
  772. },
  773. // 更改当前页
  774. handleCurrentChange(val) {
  775. this.currentPage = val
  776. this.getListInvoiceOrder()
  777. },
  778. handLogistics(row) {
  779. getListOrderTrack({ orderId: row.id }).then(res => {
  780. this.logisticsDetail = res.data
  781. })
  782. this.orderId = row.id
  783. this.visible = true
  784. },
  785. onClose() {
  786. this.logisticsDetail = []
  787. this.orderId = ''
  788. this.visible = false
  789. },
  790. handleJump(id) {
  791. this.$router.push({ path: `/exwarehouse/sum_list?id=${id}` })
  792. this.isLogistics = false
  793. },
  794. handleChangeArea(changeNum) {
  795. setUserChanging({ changeNum }).then(res => {
  796. localStorage.setItem('user_change_num', changeNum)
  797. this.$router.go(0)
  798. this.$successMsg('切换成功')
  799. })
  800. }
  801. }
  802. }
  803. </script>
  804. <style lang="scss" scoped>
  805. @import '~@/styles/variables.scss';
  806. .right-menu-item {
  807. ::v-deep .el-input__inner {
  808. width: 80px;
  809. font-size: 16px;
  810. color: #333333;
  811. border: 0 !important;
  812. }
  813. }
  814. ::v-deep .is-fixed {
  815. right: 10px !important;
  816. }
  817. .flex {
  818. margin-top: 30px;
  819. display: flex;
  820. align-items: center;
  821. justify-content: space-between;
  822. }
  823. .navbar {
  824. width: 100%;
  825. height: 50px;
  826. overflow: hidden;
  827. background: #{$navbarBg};
  828. box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
  829. .hamburger-container {
  830. line-height: 46px;
  831. height: 100%;
  832. color: #{$navbarText};
  833. float: left;
  834. cursor: pointer;
  835. transition: background 0.3s;
  836. -webkit-tap-highlight-color: transparent;
  837. border-right: 1px solid #eaeaea;
  838. &:hover {
  839. background: rgba(0, 0, 0, 0.025);
  840. }
  841. }
  842. .navmenu {
  843. float: left;
  844. }
  845. .breadcrumb-container {
  846. float: left;
  847. }
  848. .right-menu {
  849. float: right;
  850. height: 100%;
  851. line-height: 50px;
  852. & > div {
  853. float: left;
  854. }
  855. &:focus {
  856. outline: none;
  857. }
  858. .user-container {
  859. height: 50px;
  860. .user {
  861. i {
  862. font-size: 18px;
  863. margin-right: 5px;
  864. }
  865. span {
  866. font-size: 16px;
  867. }
  868. }
  869. }
  870. .right-menu-item {
  871. display: inline-block;
  872. padding: 0 15px;
  873. height: 100%;
  874. font-size: 18px;
  875. color: #{$navbarText};
  876. vertical-align: text-bottom;
  877. border-left: 1px solid #eaeaea;
  878. &.hover-effect {
  879. cursor: pointer;
  880. transition: background 0.3s;
  881. &:hover {
  882. background: rgba(0, 0, 0, 0.025);
  883. }
  884. }
  885. .notice-icon {
  886. padding-top: 0;
  887. padding-bottom: 0;
  888. }
  889. }
  890. }
  891. }
  892. </style>
  893. <style lang="scss">
  894. .navbar {
  895. .right-menu {
  896. .right-menu-item {
  897. .notice-icon > i {
  898. font-size: 18px;
  899. }
  900. sup {
  901. top: 12px;
  902. right: 25px;
  903. }
  904. }
  905. }
  906. }
  907. .tip {
  908. margin: 50px auto;
  909. text-align: center;
  910. }
  911. </style>