index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. <template>
  2. <div class="winseaview-top" id="winseaview-top">
  3. <div class="top-bar__left">
  4. <!-- 伸缩icon -->
  5. <div
  6. class="winseaview-breadcrumb"
  7. :class="[{ 'winseaview-breadcrumb--active': isCollapse }]"
  8. >
  9. <i class="iconfont icon-shouqi" @click="setCollapse"></i>
  10. </div>
  11. <!-- </div>
  12. <div class="top-bar__title"> -->
  13. <!-- 面包屑 -->
  14. <div class="top-bar__item top-bar__item--show">
  15. <top-menu v-if="showMenu"></top-menu>
  16. <bread-crumb v-if="!showMenu" />
  17. <smallTips v-if="showTooltip" />
  18. </div>
  19. <span class="top-bar__item" v-if="showSearch">
  20. <top-search></top-search>
  21. </span>
  22. </div>
  23. <div class="top-bar__right">
  24. <!-- 使用租户 -->
  25. <div class="hidden-content">
  26. <el-input ref="hiddenFocus" class="input-Style" v-model="barCode" size="small" @focus="focus" @blur="blur" @keyup.enter.native="payCode" placeholder="扫码枪内容"></el-input>
  27. <div v-show="isOpenCodeGun">扫码枪已连接</div>
  28. <div v-show="!isOpenCodeGun" @click="setCodeGun">点我扫码</div>
  29. <el-dialog title="扫描二维码" :visible.sync="smAlert">
  30. <el-button v-hasPermission="`acquisitionManagement.acquisitionQuality.initial`" @click="goToPage(1)">去初检</el-button>
  31. <el-button v-hasPermission="`acquisitionManagement.acquisitionQuality.con`" @click="goToPage(2)">去确认质检</el-button>
  32. <el-button v-hasPermission="`acquisitionManagement.acquisitionQuality.again`" @click="goToPage(3)">去复检</el-button>
  33. <el-button v-hasPermission="`acquisitionManagement.acquisitionWeight.mao`" @click="goToPage(4)">去称毛重</el-button>
  34. <el-button v-hasPermission="`acquisitionManagement.acquisitionPay.add`" @click="goToPage(5)">去结算</el-button>
  35. <el-button v-hasPermission="`acquisitionManagement.acquisitionWeight.weight`" @click="goToPage(6)">去称皮重</el-button>
  36. <el-button @click="smAlert = false" class="btn">关闭</el-button>
  37. </el-dialog>
  38. </div>
  39. <div v-if="getDay" class="right-menu-item hover-effect dayClass">
  40. {{ $t('common.trialDays') }}
  41. <span style="padding: 0 2px">{{ getDay }}</span
  42. >{{ $t('common.days') }}
  43. </div>
  44. <el-tooltip
  45. v-if="showColor"
  46. effect="dark"
  47. :content="$t('navbar.color')"
  48. placement="bottom"
  49. >
  50. <div class="top-bar__item">
  51. <top-color></top-color>
  52. </div>
  53. </el-tooltip>
  54. <el-tooltip
  55. v-if="showTheme"
  56. effect="dark"
  57. :hide-after="1500"
  58. :content="$t('navbar.theme')"
  59. placement="bottom"
  60. >
  61. <div class="top-bar__item top-bar__item--show">
  62. <top-theme></top-theme>
  63. </div>
  64. </el-tooltip>
  65. <!-- <el-tooltip effect="dark"
  66. :content="$t('navbar.language')"
  67. placement="bottom">
  68. <div class="top-bar__item top-bar__item--show">
  69. <top-lang></top-lang>
  70. </div>
  71. </el-tooltip> -->
  72. <el-tooltip
  73. v-if="showFullScren"
  74. effect="dark"
  75. :content="
  76. isFullScren ? $t('navbar.screenfull') : $t('navbar.screenfullF')
  77. "
  78. placement="bottom"
  79. >
  80. <div class="top-bar__item">
  81. <i
  82. :class="isFullScren ? 'el-icon-full-screen' : 'el-icon-full-screen'"
  83. @click="handleScreen"
  84. ></i>
  85. </div>
  86. </el-tooltip>
  87. <img class="top-bar__img" v-lazy="userInfo.avatar" />
  88. <el-dropdown>
  89. <span class="el-dropdown-link">
  90. <span>{{ userInfo.showRoleName }} : {{ userInfo.staffName }}</span>
  91. <i class="el-icon-arrow-down el-icon--right"></i>
  92. </span>
  93. <el-dropdown-menu slot="dropdown">
  94. <el-dropdown-item
  95. icon="el-icon-s-custom"
  96. @click.native="personalFlag = true"
  97. >
  98. {{ $t('navbar.personalInformation') }}
  99. </el-dropdown-item>
  100. <el-dropdown-item
  101. icon="el-icon-s-promotion"
  102. @click.native="passwordFlag = true"
  103. >
  104. {{ $t('navbar.uploadPsw') }}
  105. </el-dropdown-item>
  106. <!-- <el-dropdown-item>
  107. <router-link to="/info/index">{{$t('navbar.userinfo')}}</router-link>
  108. </el-dropdown-item> -->
  109. <el-dropdown-item
  110. v-if="showSetting"
  111. icon="el-icon-s-tools"
  112. @click.native="settingDrawer = true"
  113. >{{ $t('navbar.layoutSetting') }}</el-dropdown-item
  114. >
  115. <el-dropdown-item @click.native="logout" divided>{{
  116. $t('navbar.logOut')
  117. }}</el-dropdown-item>
  118. </el-dropdown-menu>
  119. </el-dropdown>
  120. </div>
  121. <topSetting
  122. v-model="settingDrawer"
  123. @close="() => (settingDrawer = !settingDrawer)"
  124. />
  125. <!--个人信息-->
  126. <WinseaContentModal
  127. v-model="personalFlag"
  128. :title="$t('navbar.personalInformation')"
  129. >
  130. <el-form
  131. ref="personalMsg"
  132. :model="passwordMsg"
  133. label-position="right"
  134. label-width="150px"
  135. >
  136. <el-form-item :label="$t('login.name')" prop="originalPassword">
  137. {{ userInfo.staffName }}
  138. </el-form-item>
  139. <el-form-item :label="$t('login.account')" prop="newPassword">
  140. {{ account }}
  141. </el-form-item>
  142. <el-form-item :label="$t('login.phone')" prop="newPassword">
  143. {{ userInfo.staffMobilePhone }}
  144. </el-form-item>
  145. <el-form-item :label="$t('login.role')" prop="newPassword">
  146. {{ userInfo.showRoleName }}
  147. </el-form-item>
  148. <el-form-item :label="$t('login.dept')" prop="newPassword">
  149. {{ userInfo.deptName }}
  150. </el-form-item>
  151. <el-form-item :label="$t('login.company')" prop="newPassword">
  152. <div class="company-info">
  153. {{ userInfo.compName }}
  154. </div>
  155. </el-form-item>
  156. </el-form>
  157. </WinseaContentModal>
  158. <!--修改密码-->
  159. <WinseaContentModal v-model="passwordFlag" :title="$t('navbar.uploadPsw')">
  160. <el-form
  161. ref="passwordMsg"
  162. :model="passwordMsg"
  163. :label-width="language == 'en' ? '156px' : '100px'"
  164. :rules="passwordMsgRules"
  165. >
  166. <el-form-item
  167. :label="$t('login.originalPassword') + $t('common.colon')"
  168. prop="originalPassword"
  169. >
  170. <ws-input
  171. type="password"
  172. :placeholder="$t('login.message04')"
  173. v-model="passwordMsg.originalPassword"
  174. style="width: 318px"
  175. />
  176. </el-form-item>
  177. <el-form-item
  178. :label="$t('login.newPassword') + $t('common.colon')"
  179. prop="newPassword"
  180. >
  181. <ws-input
  182. type="password"
  183. v-model="passwordMsg.newPassword"
  184. :placeholder="$t('login.verification01')"
  185. style="width: 318px"
  186. />
  187. </el-form-item>
  188. <el-form-item
  189. :label="$t('login.confirmPassword') + $t('common.colon')"
  190. prop="password"
  191. >
  192. <ws-input
  193. type="password"
  194. v-model="passwordMsg.password"
  195. :placeholder="$t('login.verification01')"
  196. style="width: 318px"
  197. />
  198. </el-form-item>
  199. </el-form>
  200. <span slot="footer" class="dialog-footer">
  201. <ws-button @click="passwordFlag = false">{{
  202. $t('showMessage.cancel')
  203. }}</ws-button>
  204. <ws-button type="primary" @click="savePassword('passwordMsg')">{{
  205. $t('showMessage.confirm')
  206. }}</ws-button>
  207. </span>
  208. </WinseaContentModal>
  209. </div>
  210. </template>
  211. <script>
  212. import { changePasswordByPwd } from '@/model/indexRx'
  213. import { mapActions, mapGetters, mapState } from 'vuex'
  214. import { fullscreenToggel, listenfullscreen } from '@/utils/util'
  215. import topMenu from './top-menu'
  216. import topSearch from './top-search'
  217. import topTheme from './top-theme'
  218. import topColor from './top-color'
  219. import topNotice from './top-notice'
  220. import topLang from './top-lang'
  221. import topSetting from './top-setting'
  222. import breadCrumb from '@/components/Breadcrumb'
  223. import { EventBus } from 'base-core-lib'
  224. import { validPassword } from '@/utils/validate'
  225. import smallTips from '@/components/WinseaCom/smallTips'
  226. import {getLook } from '@/model/warehouse/index'
  227. const validPasswordRule = function (rule, value, callback) {
  228. if (!validPassword(value)) {
  229. callback(new Error(this.$t('login.verification01')))
  230. } else {
  231. callback()
  232. }
  233. }
  234. const validPasswordRule2 = function (rule, value, callback) {
  235. if (!value) {
  236. callback(new Error(this.$t('login.verification02')))
  237. } else if (value !== this.passwordMsg.newPassword) {
  238. callback(new Error(this.$t('login.verification03')))
  239. } else {
  240. callback()
  241. }
  242. }
  243. export default {
  244. components: {
  245. topMenu,
  246. topSearch,
  247. topTheme,
  248. topColor,
  249. topNotice,
  250. topLang,
  251. topSetting,
  252. breadCrumb,
  253. smallTips,
  254. },
  255. name: 'top',
  256. data() {
  257. return {
  258. userINfo:{},
  259. barCode:'',
  260. isOpenCodeGun:false,
  261. smAlert:false,
  262. showList: [
  263. 'maintenancePlanList',
  264. 'maintenanceReportList',
  265. 'navigationMaterialList',
  266. 'protectionEntry',
  267. 'protection',
  268. 'newlyIncreased',
  269. 'clientEdit',
  270. 'staticDetail',
  271. 'maApplicationAdd',
  272. 'maApplicationEdit',
  273. 'maApplicationLabel',
  274. 'monthContrastList',
  275. ],
  276. settingDrawer: false,
  277. personalFlag: false,
  278. passwordFlag: false,
  279. passwordMsgRules: {
  280. originalPassword: [{ required: true, message: ' ', trigger: 'blur' }],
  281. // newPassword: [
  282. // {
  283. // required: true,
  284. // trigger: 'blur',
  285. // validator: validPasswordRule.bind(this),
  286. // },
  287. // ],
  288. // password: [
  289. // {
  290. // required: true,
  291. // trigger: 'blur',
  292. // validator: validPasswordRule2.bind(this),
  293. // },
  294. // ],
  295. },
  296. passwordMsg: {
  297. originalPassword: '', // 原始密码
  298. newPassword: '', // 新密码
  299. password: '', // 二次输入密码
  300. },
  301. // roleName: '',
  302. // phone: '',
  303. // roleId: '',
  304. // deptName: '',
  305. // deptId: '',
  306. // staffName: '',
  307. account: localStorage.getItem('ws-pf_account'),
  308. // compName: '',
  309. companyId: localStorage.getItem('ws-pf_compId'),
  310. }
  311. },
  312. filters: {},
  313. created() {
  314. // this.getUserInfo()
  315. this.getUserWorseHouse();
  316. this.userINfo = {
  317. userCompany:localStorage.getItem('ws-pf_compId'),
  318. userName:localStorage.getItem('ws-pf_staffName'),
  319. userJurisdiction:""
  320. }
  321. },
  322. mounted() {
  323. listenfullscreen(this.setScreen)
  324. },
  325. computed: {
  326. ...mapState({
  327. showDebug: (state) => state.commonStore.showDebug,
  328. showTheme: (state) => state.commonStore.showTheme,
  329. showLock: (state) => state.commonStore.showLock,
  330. showFullScren: (state) => state.commonStore.showFullScren,
  331. showCollapse: (state) => state.commonStore.showCollapse,
  332. showSearch: (state) => state.commonStore.showSearch,
  333. showSetting: (state) => state.commonStore.showSetting,
  334. showMenu: (state) => state.commonStore.showMenu,
  335. showColor: (state) => state.commonStore.showColor,
  336. }),
  337. ...mapGetters([
  338. 'userInfo',
  339. 'isFullScren',
  340. 'tagWel',
  341. 'tagList',
  342. 'isCollapse',
  343. 'tag',
  344. 'logsLen',
  345. 'logsFlag',
  346. 'language',
  347. ]),
  348. getDay() {
  349. const { statusFlag = -1, daysRemaining } =
  350. JSON.parse(localStorage.getItem('ws_login_getTenantInfoByUser')) || {}
  351. return statusFlag * 1 === 2 ? daysRemaining + '' : ''
  352. },
  353. showTooltip() {
  354. return this.showList.indexOf(this.$route.name) > -1 && !this.showMenu
  355. },
  356. },
  357. methods: {
  358. ...mapActions('common', ['setLocalVessels']),
  359. payCode(){
  360. console.log("input",this.barCode)
  361. let _userCompId = this.barCode.split(',')[0]
  362. let _userId = this.barCode.split(',')[1]
  363. let _userFlag = this.barCode.split(',')[2]
  364. let _userHouseId = this.barCode.split(',')[3]
  365. //判断当前账号公司
  366. if(this.userINfo.userCompany!=_userCompId){
  367. this.$message.error('当前身份不可操作');
  368. return
  369. }
  370. //判断当前账号仓库
  371. this.getLook(_userHouseId,this.userINfo.userName)
  372. //扫码枪扫码后显示弹框
  373. this.smAlert = true
  374. //根据判断显示不同按钮
  375. //获取跳转数据
  376. },
  377. async getLook(compId,userName) {
  378. await getLook({
  379. id: compId,
  380. })
  381. .toPromise()
  382. .then((response) => {
  383. if(response.personCharge!=userName||response.otherPersonCharge.indexOf(userName)<=-1){
  384. this.$message.error('当前身份不可操作');
  385. return
  386. }
  387. // this.deptBudgetList = response
  388. })
  389. },
  390. setCodeGun(){
  391. this.$refs['hiddenFocus'].focus()
  392. },
  393. focus(){
  394. console.log("当前焦点状态")
  395. this.isOpenCodeGun = true
  396. },
  397. blur(){
  398. console.log("当前已失去焦点状态")
  399. this.isOpenCodeGun = false
  400. },
  401. goToPage(type){
  402. let _url = ''
  403. if(type===1){
  404. // this.$router.push({
  405. // path: 'inspectInfo',
  406. // query: {
  407. // type: index,
  408. // cangid: this.cangid,
  409. // id: row.id,
  410. // warehouseName: this.warehouseName,
  411. // count: this.warehouseCount,
  412. // warehouseNo: this.warehouseNo,
  413. // allowEdit:this.allowEdit,
  414. // status:row.status
  415. // },
  416. // })
  417. }else if(type===2){
  418. _url = ''
  419. }else if(type===3){
  420. _url = ''
  421. }else if(type===4){
  422. _url = ''
  423. }else if(type===5){
  424. _url = ''
  425. }else if(type===6){
  426. _url = ''
  427. }
  428. },
  429. //获取当前用户管理的仓库
  430. getUserWorseHouse(){
  431. },
  432. handleScreen() {
  433. fullscreenToggel()
  434. },
  435. setCollapse() {
  436. this.$store.commit('SET_COLLAPSE')
  437. },
  438. setScreen() {
  439. this.$store.commit('SET_FULLSCREN')
  440. },
  441. cancelPaw() {
  442. this.$refs.passwordMsg.resetFields()
  443. },
  444. // 修改管理员密码
  445. savePassword(formName) {
  446. this.$refs[formName].validate((valid) => {
  447. if (valid) {
  448. const data = {
  449. originalPassword: this.passwordMsg.originalPassword,
  450. password: this.passwordMsg.password,
  451. }
  452. changePasswordByPwd(data)
  453. .toPromise()
  454. .then(() => {
  455. EventBus.$emit('success', this.$t('message.updateMessage'))
  456. this.passwordFlag = false
  457. })
  458. } else {
  459. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  460. return false
  461. }
  462. })
  463. },
  464. // async getUserInfo () {
  465. // this.staffName = this.userInfo.staffName
  466. // this.phone = this.userInfo.staffMobilePhone
  467. // this.deptName = this.userInfo.deptName
  468. // this.roleName = this.userInfo.showRoleName
  469. // this.roleId = this.userInfo.showRoleId
  470. // this.compName = this.userInfo.compName
  471. // },
  472. toggleSideBar() {
  473. this.$store.dispatch('app/toggleSideBar')
  474. },
  475. logout() {
  476. this.$confirm(this.$t('logoutTip'), this.$t('tip'), {
  477. confirmButtonText: this.$t('submitText'),
  478. cancelButtonText: this.$t('cancelText'),
  479. type: 'warning',
  480. }).then(async () => {
  481. localStorage.removeItem('ws-pf_roleName')
  482. localStorage.removeItem('ws-pf_roleId')
  483. localStorage.removeItem('ws-pf_staffName')
  484. localStorage.removeItem('ws-pf_deptId')
  485. localStorage.removeItem('ws-pf_deptName')
  486. localStorage.removeItem('ws-pf_organMonetaryKey')
  487. localStorage.removeItem('ws-pf_organMonetaryValue')
  488. localStorage.removeItem('ws-pf_vessels')
  489. localStorage.removeItem('ws-pf_isLandBasedFlag')
  490. await this.$store.dispatch('user/logout')
  491. this.$router.push(
  492. process.env.VUE_APP_PACKAGE_ENV === 'ship' ? '/ship_login' : '/login'
  493. )
  494. })
  495. },
  496. },
  497. }
  498. </script>
  499. <style lang="scss" scoped>
  500. .dayClass {
  501. font-size: 14px !important;
  502. span {
  503. font-weight: 600;
  504. font-size: 14px;
  505. color: #ff3838;
  506. }
  507. }
  508. .hamburger-container {
  509. line-height: 40px;
  510. height: 100%;
  511. float: left;
  512. cursor: pointer;
  513. transition: background 0.3s;
  514. -webkit-tap-highlight-color: transparent;
  515. &:hover {
  516. background: rgba(0, 0, 0, 0.025);
  517. }
  518. }
  519. .breadcrumb-container {
  520. float: left;
  521. position: relative;
  522. }
  523. .errLog-container {
  524. display: inline-block;
  525. vertical-align: top;
  526. }
  527. .right-menu {
  528. float: right;
  529. height: 100%;
  530. line-height: 40px;
  531. &:focus {
  532. outline: none;
  533. }
  534. .right-menu-item {
  535. display: inline-block;
  536. padding: 0 8px;
  537. height: 100%;
  538. font-size: 18px;
  539. color: #5a5e66;
  540. // vertical-align: text-bottom;
  541. &.hover-effect {
  542. cursor: pointer;
  543. transition: background 0.3s;
  544. &:hover {
  545. background: rgba(0, 0, 0, 0.025);
  546. }
  547. }
  548. }
  549. .avatar-container {
  550. margin-right: 30px;
  551. .avatar-wrapper {
  552. position: relative;
  553. span {
  554. height: 40px;
  555. line-height: 40px;
  556. font-size: 12px;
  557. }
  558. .user-avatar {
  559. cursor: pointer;
  560. width: 40px;
  561. height: 40px;
  562. border-radius: 10px;
  563. }
  564. .el-icon-caret-bottom {
  565. cursor: pointer;
  566. position: absolute;
  567. right: -20px;
  568. top: 15px;
  569. font-size: 12px;
  570. }
  571. }
  572. }
  573. }
  574. .hidden-content{
  575. display: flex;
  576. font-size: 16px;
  577. }
  578. .input-Style{
  579. opacity: 0;
  580. }
  581. .btn{
  582. background: #5878e8;
  583. color: white;
  584. }
  585. </style>