123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949 |
- <template>
- <div class="navbar">
- <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
- <breadcrumb v-if="showBreadcrumb" class="breadcrumb-container" />
- <!-- <NavMenu class="navmenu" /> -->
- <div class="right-menu">
- <!-- <div class="right-menu-item hover-effect">
- <el-tooltip effect="dark" content="家用工程机登录" placement="bottom">
- <i
- class="el-icon-s-platform"
- style="font-size: 24px; line-height: 50px"
- @click="toEngine"
- ></i>
- </el-tooltip>
- </div> -->
- <div class="right-menu-item" style="display: flex" v-if="isHongGe">
- <el-select v-model="changeNum" filterable :disabled="!isHongGe" @change="handleChangeArea">
- <el-option v-for="item in areaOpti" :key="item.value" :label="item.label" :value="item.value"> </el-option>
- </el-select>
- </div>
- <!-- <div class="right-menu-item hover-effect" style="display: flex" @click="handleShow">
- <el-badge>
- <i class="el-icon-message-solid" style="font-size: 24px; line-height: 50px" />
- </el-badge>
- <span style="font-size: 16px; margin-left: 15px">物流通知</span>
- </div> -->
- <div class="right-menu-item hover-effect" style="display: flex" @click="handleNotice('click')">
- <el-badge value="示">
- <i class="el-icon-message-solid" style="font-size: 24px; line-height: 50px" />
- </el-badge>
- <span style="font-size: 16px; margin-left: 15px">物流到货通知</span>
- </div>
- <div class="right-menu-item hover-effect" @click="toEngine">
- <i class="el-icon-s-platform" style="font-size: 18px" />
- <span style="font-size: 16px; margin-left: 6px">家用工程机登录</span>
- </div>
- <el-badge :value="noticeCount" :max="10" :hidden="!noticeVisible" class="right-menu-item hover-effect">
- <el-tooltip effect="dark" content="系统消息" placement="bottom">
- <i class="el-icon-message-solid" style="font-size: 24px; line-height: 50px" @click="goNotice" />
- </el-tooltip>
- <!-- <el-button icon="el-icon-message-solid" type="text" class="notice-icon" @click="goNotice"></el-button> -->
- </el-badge>
- <template v-if="device !== 'mobile'">
- <screenfull id="screenfull" class="right-menu-item hover-effect" />
- </template>
- <el-dropdown class="user-container" trigger="click">
- <div class="user right-menu-item hover-effect">
- <i class="el-icon-user-solid" />
- <span>{{ name }}</span>
- </div>
- <el-dropdown-menu slot="dropdown" class="user-dropdown">
- <router-link to="/setting/personal">
- <el-dropdown-item>个人信息</el-dropdown-item>
- </router-link>
- <el-dropdown-item divided @click.native="logout">
- <span style="display: block">退出登录</span>
- </el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- <el-dialog title="绑定工程机系统" :visible.sync="dialogFormVisible" :modal="false" width="30%">
- <el-form ref="engineForm" :model="engineForm" :rules="engineFormRules">
- <el-form-item label="账号" :label-width="formLabelWidth" prop="account">
- <el-input v-model="engineForm.account" placeholder="请输入账号" autocomplete="off" />
- </el-form-item>
- <el-form-item label="密码" :label-width="formLabelWidth" prop="password">
- <el-input v-model="engineForm.password" placeholder="请输入密码" autocomplete="off" show-password />
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialogFormVisible = false">取 消</el-button>
- <el-button type="primary" @click="submitForm">确 定</el-button>
- </div>
- </el-dialog>
- <el-dialog
- title="到货通知"
- :modal="false"
- width="70%"
- :visible.sync="hasNotice"
- :append-to-body="true"
- @close="handleNotice(false)"
- >
- <div style="margin-top: 20px">
- <el-radio-group v-model="noticeType" size="mini" @change="handleChangeNotice">
- <el-radio-button :label="1">物流通知</el-radio-button>
- <el-radio-button :label="2">到货通知</el-radio-button>
- </el-radio-group>
- </div>
- <div v-show="noticeType === 2" class="mymain-container">
- <el-form ref="form" :model="form" label-width="80px" label-position="left" size="mini">
- <el-row>
- <el-col>
- <el-form-item prop="specification" label="规格型号">
- <div style="display: flex">
- <el-input v-model="form.specification" clearable style="margin-right: 10px" />
- <el-button
- @click="
- form.specification = ''
- getNoticeList()
- "
- >重置</el-button
- >
- <el-button type="primary" @click="getNoticeLists">查询</el-button>
- </div>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div class="table">
- <el-table v-loading="listLoading" :data="noticeList" border>
- <el-table-column
- property="materialOldNumber"
- align="left"
- min-width="120"
- label="产品编号"
- show-overflow-tooltip
- />
- <el-table-column
- property="materialNumber"
- align="left"
- min-width="100"
- label="物料编码"
- show-overflow-tooltip
- />
- <el-table-column
- property="materialName"
- align="left"
- min-width="250"
- label="产品名称"
- show-overflow-tooltip
- />
- <el-table-column
- property="specification"
- align="left"
- min-width="350"
- label="规格型号"
- show-overflow-tooltip
- />
- <el-table-column property="stockName" align="left" min-width="100" label="到货仓库" show-overflow-tooltip />
- <el-table-column
- property="updateTime"
- align="left"
- min-width="200"
- label="到货通知时间"
- show-overflow-tooltip
- />
- </el-table>
- <div class="flex">
- <div />
- <div class="fr">
- <el-pagination
- :current-page="currentPage2"
- :page-sizes="[10, 20, 30, 50]"
- :page-size="10"
- layout="total, prev, pager, next"
- :total="listTotal2"
- @size-change="handleSizeChange2"
- @current-change="handleCurrentChange2"
- />
- </div>
- </div>
- </div>
- </div>
- <div v-show="noticeType === 1" class="mymain-container">
- <div class="table">
- <el-table
- ref="table"
- v-loading="listLoading"
- :data="invoiceOrderList"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- >
- <el-table-column align="center" type="index" min-width="160" show-overflow-tooltip />
- <el-table-column align="center" label="发货单" prop="id" min-width="160" show-overflow-tooltip>
- <template slot-scope="scope">
- <el-link v-if="!isCustomer" type="primary" :underline="false" @click="handleJump(scope.row.id)">{{
- scope.row.id
- }}</el-link>
- <template v-else>{{ scope.row.id }}</template>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="内容"
- prop="orderTrackStatus"
- min-width="160"
- show-overflow-tooltip
- />
- <el-table-column align="center" label="时间" prop="orderTrackTime" min-width="160" show-overflow-tooltip />
- <el-table-column align="center" label="收货地址" prop="address" min-width="160" show-overflow-tooltip>
- <template slot-scope="scope">
- {{ scope.row.address ? scope.row.address : '——' }}
- </template>
- </el-table-column>
- <el-table-column align="center" label="收货客户" prop="receivingName" min-width="160" show-overflow-tooltip>
- <template slot-scope="scope">{{ scope.row.receivingName ? scope.row.receivingName : '——' }}</template>
- </el-table-column>
- <el-table-column align="center" label="" min-width="80" show-overflow-tooltip fixed="right">
- <template slot-scope="scope">
- <el-button type="text" class="textColor" @click="handLogistics(scope.row)">查看</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!-- 分页 -->
- <div class="flex">
- <div></div>
- <div class="fr">
- <el-pagination
- :current-page="currentPage"
- :page-sizes="[10, 20, 30, 50]"
- :page-size="10"
- layout="total, sizes, prev, pager, next, jumper"
- :total="listTotal"
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- />
- </div>
- </div>
- </div>
- </div>
- </el-dialog>
- <el-dialog title="物流通知" :visible.sync="isLogistics" width="60%" :modal="true" @close="isLogistics = false">
- <div class="table">
- <el-table
- ref="table"
- v-loading="listLoading"
- :data="invoiceOrderList"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- >
- <el-table-column align="center" type="index" min-width="160" show-overflow-tooltip />
- <el-table-column align="center" label="发货单" prop="id" min-width="160" show-overflow-tooltip>
- <template slot-scope="scope">
- <el-link v-if="!isCustomer" type="primary" :underline="false" @click="handleJump(scope.row.id)">{{
- scope.row.id
- }}</el-link>
- <template v-else>{{ scope.row.id }}</template>
- </template>
- </el-table-column>
- <el-table-column align="center" label="内容" prop="orderTrackStatus" min-width="160" show-overflow-tooltip />
- <el-table-column align="center" label="时间" prop="orderTrackTime" min-width="160" show-overflow-tooltip />
- <el-table-column align="center" label="收货地址" prop="address" min-width="160" show-overflow-tooltip>
- <template slot-scope="scope">
- {{ scope.row.address ? scope.row.address : '——' }}
- </template>
- </el-table-column>
- <el-table-column align="center" label="收货客户" prop="receivingName" min-width="160" show-overflow-tooltip>
- <template slot-scope="scope">{{ scope.row.receivingName ? scope.row.receivingName : '——' }}</template>
- </el-table-column>
- <el-table-column align="center" label="" min-width="80" show-overflow-tooltip fixed="right">
- <template slot-scope="scope">
- <el-button type="text" class="textColor" @click="handLogistics(scope.row)">查看</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <!-- 分页 -->
- <div class="fr">
- <el-pagination
- :current-page="currentPage"
- :page-sizes="[10, 20, 30, 50]"
- :page-size="10"
- layout="total, sizes, prev, pager, next, jumper"
- :total="listTotal"
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- />
- </div>
- <br />
- <br />
- </el-dialog>
- <el-dialog
- title="物流信息"
- :visible.sync="visible"
- width="60%"
- @close="onClose"
- :modal="false"
- :close-on-click-modal="false"
- >
- <el-timeline class="logistics" :reverse="false" v-if="logisticsDetail.length">
- <el-timeline-item
- placement="top"
- type="success"
- v-for="(item, index) in logisticsDetail"
- :key="index"
- :timestamp="item.time"
- >
- <el-row :gutter="20">
- <el-col class="logistics-title"> {{ item.status }} </el-col>
- <el-col>
- <div class="flex">
- <div>{{ item.context }}</div>
- <!-- <div>{{ item.createTime }}</div> -->
- </div>
- </el-col>
- </el-row>
- </el-timeline-item>
- </el-timeline>
- <div v-else class="tip">暂无物流信息</div>
- </el-dialog>
- <!-- 工程机多帐号-->
- <!-- <el-dialog-->
- <!-- title="绑定工程机系统"-->
- <!-- :visible.sync="dialogFormVisible"-->
- <!-- :modal="false"-->
- <!-- width="60%"-->
- <!-- >-->
- <!-- <el-form ref="engineForm" :model="engineForm">-->
- <!-- <el-row v-for="(row, index) in engineForm.engineList" :key="row.id" :gutter="20">-->
- <!-- <el-col :span="8">-->
- <!-- <el-form-item-->
- <!-- :label="'账号' + (index+1)"-->
- <!-- :label-width="formLabelWidth"-->
- <!-- :prop="'engineList.' + index + '.enginUserName'"-->
- <!-- :rules="{required: true, message: '请输入工程机账号', trigger: 'blur'}"-->
- <!-- >-->
- <!-- <el-input v-model="row.enginUserName" placeholder="请输入账号" autocomplete="off"></el-input>-->
- <!-- </el-form-item>-->
- <!-- </el-col>-->
- <!-- <el-col :span="8">-->
- <!-- <el-form-item-->
- <!-- :label="'密码' + (index+1)"-->
- <!-- :label-width="formLabelWidth"-->
- <!-- :prop="'engineList.' + index + '.enginPassword'"-->
- <!-- :rules="{required: true, message: '请输入工程机密码', trigger: 'blur'}"-->
- <!-- >-->
- <!-- <el-input v-model="row.enginPassword" placeholder="请输入密码" autocomplete="off" show-password></el-input>-->
- <!-- </el-form-item>-->
- <!-- </el-col>-->
- <!-- <el-col :span="8">-->
- <!-- <template v-if="row.adminUserId">-->
- <!-- <el-button @click="submitForm(index)">重验</el-button>-->
- <!-- </template>-->
- <!-- <template v-else>-->
- <!-- <el-button @click="submitForm(index)">验证</el-button>-->
- <!-- </template>-->
- <!-- <el-button v-if="row.adminUserId" @click="toEngine(index)">打开</el-button>-->
- <!-- <el-button @click="delAccountForm(index)">删除</el-button>-->
- <!-- </el-col>-->
- <!-- </el-row>-->
- <!-- </el-form>-->
- <!-- <div slot="footer" class="dialog-footer">-->
- <!-- <el-button @click="addRowEngine">新增账号</el-button>-->
- <!-- <el-button @click="dialogFormVisible = false">取 消</el-button>-->
- <!-- </div>-->
- <!-- </el-dialog>-->
- </div>
- </template>
- <script>
- import { mapGetters } from 'vuex'
- import Breadcrumb from '@/components/Breadcrumb'
- import Hamburger from '@/components/Hamburger'
- import Screenfull from '@/components/Screenfull'
- import NavMenu from '@/components/NavMenu'
- import { getNoticeListCount } from '@/api/notice'
- import { getNoticeList } from '@/api/stock'
- import { getListOrderTrack } from '@/api/supply/pickup'
- import { getListInvoiceOrder } from '@/api/dashboard'
- import { bindEngineAccount, checkEngineAccount, setUserChanging } from '@/api/setting'
- import mixin from '@/mixin'
- export default {
- components: {
- Breadcrumb,
- Hamburger,
- Screenfull,
- NavMenu
- },
- mixins: [mixin],
- data() {
- return {
- noticeType: 1,
- intivalId: '',
- timer: '',
- noticeCount: 0,
- userInfo: '',
- engineForm: {
- account: '',
- password: ''
- // engineList: []
- },
- engineFormRules: {
- account: [{ required: true, message: '请输入工程机账号', trigger: 'blur' }],
- password: [{ required: true, message: '请输入工程机密码', trigger: 'blur' }]
- },
- formLabelWidth: '100px',
- dialogFormVisible: false,
- // websocket错误连接次数
- wsConnectErrorTime: 1,
- websock: null,
- lockReconnect: false,
- noticeList: [],
- form: {
- specification: ''
- },
- isLogistics: false,
- visible: false,
- orderId: '',
- logisticsDetail: [],
- invoiceOrderList: [],
- currentPage: 1, // 当前页码
- pageSize: 10, // 每页数量
- listTotal: 0, // 列表总数
- currentPage2: 1, // 当前页码
- pageSize2: 10, // 每页数量
- listTotal2: 0, // 列表总数
- myType: '',
- changeNum: localStorage.getItem('user_change_num') || '1',
- areaOpti: [
- { label: '弘格', value: '1' },
- { label: '广州', value: '2' },
- { label: '佛山', value: '3' }
- ]
- }
- },
- mounted() {
- const that = this
- // 开定时器轮询未读消息接口(写在全局vuex里比较好)
- // that.initNotice();
- // that.tcMessage();
- // this.intivalId = setInterval(function () {
- // that.tcMessage();
- // }, 5000);
- // this.timer = setInterval(function () {
- // that.initNotice();
- // }, 3000);
- // 长链接
- // this.initWebSocket();
- },
- created() {
- this.userInfo = JSON.parse(localStorage.getItem('supply_user'))
- },
- beforeDestroy() {
- window.clearInterval(this.intivalId)
- window.clearInterval(this.timer)
- this.websocketOnclose()
- },
- computed: {
- showBreadcrumb() {
- return this.$store.state.settings.breadcrumb
- },
- noticeVisible() {
- return this.noticeCount > 0
- },
- hasNotice: {
- get() {
- // 数据为空是不展示消息通知弹框
- if (!this.noticeList.length && !this.myType) {
- return false
- } else {
- // if (this.noticeList.length) {
- // return true
- // }
- return this.isNotice
- }
- },
- set(e) {
- return e
- }
- },
- ...mapGetters(['sidebar', 'avatar', 'device', 'name', 'isNotice', 'isCustomer', 'isHongGe'])
- },
- methods: {
- getList() {
- // this.getNoticeList()
- },
- handleChangeNotice(e) {
- if (e === 2) {
- this.currentPage2 = 1
- this.pageSize2 = 10
- this.getNoticeList()
- } else {
- this.pageSize = 1
- this.currentPage = 10
- this.getListInvoiceOrder()
- }
- },
- getNoticeList() {
- // this.listLoading = true
- getNoticeList({
- pageNum: this.currentPage2,
- pageSize: this.pageSize2,
- specification: this.form.specification
- }).then(res => {
- this.noticeList = res.data.records
- this.listTotal2 = res.data.total
- // this.listLoading = false
- })
- },
- getNoticeLists() {
- // this.listLoading = true
- getNoticeList({
- pageNum: 1,
- pageSize: this.pageSize2,
- specification: this.form.specification
- }).then(res => {
- this.noticeList = res.data.records
- this.listTotal2 = res.data.total
- // this.listLoading = false
- })
- },
- // 获取物流列表
- getListInvoiceOrder(data) {
- // this.listLoading = true
- getListInvoiceOrder({
- pageSize: this.pageSize,
- pageNum: this.currentPage
- }).then(res => {
- this.invoiceOrderList = res.data.records
- this.listTotal = res.data.total
- // this.listLoading = false
- })
- },
- handleNotice(flag = true) {
- if (flag || flag == 'click') {
- if (flag == 'click') {
- this.myType = flag
- }
- this.getListInvoiceOrder()
- this.$store.commit('user/SET_STATUS', true)
- } else {
- if (!flag) {
- this.myType = ''
- }
- this.noticeType = 1
- this.$store.commit('user/SET_STATUS', false)
- }
- },
- toggleSideBar() {
- this.$store.dispatch('app/toggleSideBar')
- },
- async logout() {
- await this.$store.dispatch('user/logout')
- // this.$router.push(`/login?redirect=${this.$route.fullPath}`)
- this.$store.commit('tagsView/SET_RESET_VIES')
- this.$router.push(`/login`)
- },
- initNotice() {
- getNoticeListCount().then(res => {
- if (res.data > 0 && this.noticeCount !== res.data) {
- this.noticeCount = res.data
- } else if (res.data === 0 && this.noticeCount !== res.data) {
- this.noticeCount = 0
- }
- })
- },
- // async tcMessage() {
- // // 长链接
- // // let data = {
- // // type: 'RebateOrderMsg',
- // // params: {
- // // }
- // // }
- // // this.websocketSend(JSON.stringify(data))
- // let res = await getRebateOrderMsg();
- // if (res.data.hasMessage) {
- // this.$notify.info({
- // title: "消息",
- // message: res.data.messages,
- // position: "bottom-right",
- // duration: 4000,
- // showClose: false,
- // });
- // }
- // },
- goNotice() {
- this.$router.push('/notice/index')
- },
- openEngineAccount() {
- this.engineForm.engineList = this.userInfo.bindEnginList
- this.dialogFormVisible = true
- },
- toEngine() {
- const userInfoCopy = this.userInfo
- if (userInfoCopy && userInfoCopy.bindEngin) {
- checkEngineAccount().then(res => {
- if (res.code === 200) {
- // this.$refs.engineSubmit.click()
- const { href } = this.$router.resolve({
- name: 'open_engin'
- })
- window.open(href, '_blank')
- } else {
- this.$errorMsg('账号密码错误,请重新绑定')
- this.dialogFormVisible = true
- }
- })
- } else {
- this.dialogFormVisible = true
- }
- },
- // toEngine(index) {
- // 工程机多帐号
- // const { href } = this.$router.resolve({
- // name: "open_engin",
- // query: {
- // index: index
- // }
- // });
- // window.open(href, "_blank");
- // },
- // addRowEngine() {
- // this.engineForm.engineList.push({
- // adminUserId: '',
- // enginPassword: '',
- // enginUserName: '',
- // status: '',
- // })
- // },
- submitForm() {
- this.$refs.engineForm.validate(valid => {
- if (valid) {
- const params = {
- enginUserName: this.engineForm.account,
- enginPassword: this.engineForm.password
- }
- bindEngineAccount(params).then(res => {
- if (res.code === 200) {
- this.$successMsg('绑定成功,正在打开工程机系统')
- this.dialogFormVisible = false
- this.$store.dispatch('user/getInfo').then(() => {
- this.userInfo = JSON.parse(localStorage.getItem('supply_user'))
- const { href } = this.$router.resolve({
- name: 'open_engin'
- })
- window.open(href, '_blank')
- })
- } else {
- this.$errorMsg(res.message)
- }
- })
- }
- })
- },
- // submitForm(index) {
- // 工程机多帐号
- // this.$refs.engineForm.validate((valid) => {
- // if (valid) {
- // const params = {
- // enginUserName: this.engineForm.engineList[index].enginUserName,
- // enginPassword: this.engineForm.engineList[index].enginPassword,
- // isReset: this.engineForm.engineList[index].adminUserId !== ''
- // };
- // bindEngineAccount(params).then((res) => {
- // if (res.code === 200) {
- // this.$successMsg("绑定成功,工程机系统");
- // this.$store.dispatch("user/getInfo").then(() => {
- // this.userInfo = JSON.parse(localStorage.getItem("supply_user"));
- // this.engineForm.engineList = this.userInfo.bindEnginList
- // });
- // } else {
- // this.$errorMsg(res.message);
- // }
- // });
- // }
- // });
- // },
- // delAccountForm(index) {
- // if (this.engineForm.engineList[index].id) {
- // this.$confirm('此操作将删除账号, 是否继续?', '提示', {
- // confirmButtonText: '确定',
- // cancelButtonText: '取消',
- // type: 'warning',
- // center: true
- // }).then(() => {
- // delEngineAccount({id: this.engineForm.engineList[index].id}).then(() => {
- // this.$store.dispatch("user/getInfo").then(() => {
- // this.userInfo = JSON.parse(localStorage.getItem("supply_user"));
- // this.engineForm.engineList = this.userInfo.bindEnginList
- // });
- // this.$successMsg("删除成功");
- // })
- // }).catch(() => {
- // });
- // } else {
- // this.engineForm.engineList.splice(index, 1)
- // }
- // }
- initWebSocket: function () {
- // WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
- // var userId = this.$store.getters.userid;
- //
- // var url = process.env.VUE_APP_BASE_API.replace("https://","wss://").replace("http://","ws://").replace("api","supply")+"websocket/"+userId;
- // console.debug(userId, url);
- // let token = getToken()
- // this.websock = new WebSocket(url, [token]);
- // this.websock.onopen = this.websocketOnopen;
- // this.websock.onerror = this.websocketOnerror;
- // this.websock.onmessage = this.websocketOnmessage;
- // this.websock.onclose = this.websocketOnclose;
- },
- websocketOnopen: function () {
- console.debug('WebSocket连接成功')
- // 心跳检测重置
- // this.heartCheck.reset().start();
- },
- websocketOnerror: function (e) {
- console.debug('WebSocket连接发生错误,第%s次', this.wsConnectErrorTime)
- this.wsConnectErrorTime = this.wsConnectErrorTime + 1
- if (this.wsConnectErrorTime > 5) {
- console.debug('WebSocket连接错误超过5次,就不再重新连了!')
- this.lockReconnect = true
- return
- }
- this.reconnect()
- },
- websocketOnmessage: function (e) {
- console.debug('-----接收消息-------', e.data)
- const data = eval('(' + e.data + ')') // 解析对象
- if (data.type === 'RebateOrderMsg') {
- if (data.res.hasMessage) {
- this.$notify.info({
- title: '消息',
- message: res.data.messages,
- position: 'bottom-right',
- duration: 4000,
- showClose: false
- })
- }
- }
- },
- websocketOnclose: function (e) {
- console.debug('connection closed (' + e + ')')
- if (e) {
- console.debug('connection closed (' + e.code + ')')
- }
- this.reconnect()
- },
- websocketSend(text) {
- // 数据发送
- try {
- this.websock.send(text)
- } catch (err) {
- console.debug('send failed (' + err.code + ')')
- }
- },
- reconnect() {
- var that = this
- if (that.lockReconnect) return
- that.lockReconnect = true
- // 没连接上会一直重连,设置延迟避免请求过多
- setTimeout(function () {
- console.debug('尝试重连...')
- that.initWebSocket()
- that.lockReconnect = false
- }, 20000)
- },
- handleShow() {
- ;(this.isLogistics = true), this.getListInvoiceOrder()
- },
- // 更改每页数量
- handleSizeChange2(val) {
- this.pageSize2 = val
- this.currentPage2 = 1
- this.getNoticeList()
- },
- // 更改当前页
- handleCurrentChange2(val) {
- this.currentPage2 = val
- this.getNoticeList()
- },
- // 更改每页数量
- handleSizeChange(val) {
- this.pageSize = val
- this.currentPage = 1
- this.getListInvoiceOrder()
- },
- // 更改当前页
- handleCurrentChange(val) {
- this.currentPage = val
- this.getListInvoiceOrder()
- },
- handLogistics(row) {
- getListOrderTrack({ orderId: row.id }).then(res => {
- this.logisticsDetail = res.data
- })
- this.orderId = row.id
- this.visible = true
- },
- onClose() {
- this.logisticsDetail = []
- this.orderId = ''
- this.visible = false
- },
- handleJump(id) {
- this.$router.push({ path: `/exwarehouse/sum_list?id=${id}` })
- this.isLogistics = false
- },
- handleChangeArea(changeNum) {
- setUserChanging({ changeNum }).then(res => {
- localStorage.setItem('user_change_num', changeNum)
- this.$router.go(0)
- this.$successMsg('切换成功')
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import '~@/styles/variables.scss';
- .right-menu-item {
- ::v-deep .el-input__inner {
- width: 80px;
- font-size: 16px;
- color: #333333;
- border: 0 !important;
- }
- }
- ::v-deep .is-fixed {
- right: 10px !important;
- }
- .flex {
- margin-top: 30px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .navbar {
- width: 100%;
- height: 50px;
- overflow: hidden;
- background: #{$navbarBg};
- box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
- .hamburger-container {
- line-height: 46px;
- height: 100%;
- color: #{$navbarText};
- float: left;
- cursor: pointer;
- transition: background 0.3s;
- -webkit-tap-highlight-color: transparent;
- border-right: 1px solid #eaeaea;
- &:hover {
- background: rgba(0, 0, 0, 0.025);
- }
- }
- .navmenu {
- float: left;
- }
- .breadcrumb-container {
- float: left;
- }
- .right-menu {
- float: right;
- height: 100%;
- line-height: 50px;
- & > div {
- float: left;
- }
- &:focus {
- outline: none;
- }
- .user-container {
- height: 50px;
- .user {
- i {
- font-size: 18px;
- margin-right: 5px;
- }
- span {
- font-size: 16px;
- }
- }
- }
- .right-menu-item {
- display: inline-block;
- padding: 0 15px;
- height: 100%;
- font-size: 18px;
- color: #{$navbarText};
- vertical-align: text-bottom;
- border-left: 1px solid #eaeaea;
- &.hover-effect {
- cursor: pointer;
- transition: background 0.3s;
- &:hover {
- background: rgba(0, 0, 0, 0.025);
- }
- }
- .notice-icon {
- padding-top: 0;
- padding-bottom: 0;
- }
- }
- }
- }
- </style>
- <style lang="scss">
- .navbar {
- .right-menu {
- .right-menu-item {
- .notice-icon > i {
- font-size: 18px;
- }
- sup {
- top: 12px;
- right: 25px;
- }
- }
- }
- }
- .tip {
- margin: 50px auto;
- text-align: center;
- }
- </style>
|