|
@@ -2,27 +2,112 @@
|
|
|
<div class="work-common">
|
|
|
<div class="common-title">
|
|
|
<span>常用功能</span>
|
|
|
- <span class="set"><i class="icon-set"></i> 设置</span>
|
|
|
+ <span class="set" @click="setFunctions"><i class="icon-set"></i> 设置</span>
|
|
|
</div>
|
|
|
+ <div class="common-lists">
|
|
|
+ <div class="list-item" v-for="(item, index) in commonList" :key="index" @click="openRouter(item.url)">
|
|
|
+ <img class="item-img" :src="item.img" alt="">
|
|
|
+ <span class="item-name">{{item.name}}</span>
|
|
|
+ </div>
|
|
|
+ <div v-if="commonList && commonList.length < 8" class="list-add" @click="setFunctions">
|
|
|
+ <span class="icon-add"></span>
|
|
|
+ <span class="add-text">添加常用功能</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 设置常用功能dialog -->
|
|
|
+ <el-dialog
|
|
|
+ custom-class="fn-dialog"
|
|
|
+ :visible.sync="dialogFn"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :show-close="false"
|
|
|
+ center
|
|
|
+ width="696px"
|
|
|
+ v-if="dialogFn"
|
|
|
+ >
|
|
|
+ <Card @onCancel="dialogFn = false" @onConfirm="confirmSaveFn">
|
|
|
+ <div slot="header">常用功能设置</div>
|
|
|
+ <div class="transfer-content">
|
|
|
+ <Transfer :left="allFuncitons" :right="commonList" @onSave="saveFunData"></Transfer>
|
|
|
+ </div>
|
|
|
+ <p class="more-tips">最多可选择 <em style="color:#2CB7CA;">8</em> 个常用功能</p>
|
|
|
+ </Card>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-// import { Popover } from 'element-ui'
|
|
|
+import { Dialog } from 'element-ui'
|
|
|
+import Card from '@/components/selector/SelectorCard'
|
|
|
+import Transfer from './Transfer'
|
|
|
+import { getAllFunctions, getCanUseFunctions, saveCommonFunctions } from '@/api/modules'
|
|
|
export default {
|
|
|
name: 'work-common',
|
|
|
computed: {},
|
|
|
components: {
|
|
|
- // [Popover.name]: Popover
|
|
|
+ [Dialog.name]: Dialog,
|
|
|
+ Card,
|
|
|
+ Transfer
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
-
|
|
|
+ dialogFn: false,
|
|
|
+ commonList: [], // 常用功能
|
|
|
+ allFuncitons: [], // 所有功能
|
|
|
+ saveData: [] // 要提交的数据
|
|
|
}
|
|
|
},
|
|
|
- created () {},
|
|
|
+ created () {
|
|
|
+ this.getCanUseFunctions()
|
|
|
+ this.getAllFunctions()
|
|
|
+ },
|
|
|
mounted () {},
|
|
|
methods: {
|
|
|
+ // 获取所有功能
|
|
|
+ getAllFunctions () {
|
|
|
+ // 平台参数 platform 平台:默认PC,微信:WX,app:APP, 可不传
|
|
|
+ getAllFunctions().then(res => {
|
|
|
+ if (res.error_code === 0 && res.data) {
|
|
|
+ this.allFuncitons = res.data
|
|
|
+ } else {
|
|
|
+ this.allFuncitons = []
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取常用功能
|
|
|
+ getCanUseFunctions () {
|
|
|
+ getCanUseFunctions().then(res => {
|
|
|
+ if (res.error_code === 0 && res.data) {
|
|
|
+ this.commonList = res.data
|
|
|
+ } else {
|
|
|
+ this.commonList = []
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ setFunctions () {
|
|
|
+ this.dialogFn = true
|
|
|
+ },
|
|
|
+ // 穿梭框子组件传来的组件
|
|
|
+ saveFunData (data) {
|
|
|
+ this.saveData = data
|
|
|
+ },
|
|
|
+ // dialog 卡片组件保存按钮提交事件
|
|
|
+ confirmSaveFn () {
|
|
|
+ console.log('保存', this.saveData)
|
|
|
+ saveCommonFunctions({
|
|
|
+ platform: 'PC',
|
|
|
+ names: this.saveData.toString()
|
|
|
+ }).then(res => {
|
|
|
+ if (res.error_code === 0 && res.data) {
|
|
|
+ this.dialogFn = false
|
|
|
+ this.getCanUseFunctions()
|
|
|
+ } else {
|
|
|
+ this.$toast(res.error_msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ openRouter (url) {
|
|
|
+ window.open(url)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -33,6 +118,35 @@ export default {
|
|
|
background: #fff;
|
|
|
border-radius: 4px;
|
|
|
box-shadow: 0px 0px 18px 0px rgba(0,0,0,0.02);
|
|
|
+ ::v-deep{
|
|
|
+ .fn-dialog{
|
|
|
+ .el-dialog__header,.el-dialog__body{
|
|
|
+ padding: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .transfer-content{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ }
|
|
|
+ .selector-card-header{
|
|
|
+ margin: 0 0 28px!important;
|
|
|
+ }
|
|
|
+ .selector-card.s-card{
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+ .selector-card-content{
|
|
|
+ display: block!important;
|
|
|
+ padding: 0 30px;
|
|
|
+ }
|
|
|
+ .more-tips{
|
|
|
+ margin-top: 20px;
|
|
|
+ font-size: 14px;
|
|
|
+ line-height: 22px;
|
|
|
+ text-align: center;
|
|
|
+ color: #686868;
|
|
|
+ }
|
|
|
+ }
|
|
|
.common-title{
|
|
|
position: relative;
|
|
|
display: flex;
|
|
@@ -68,5 +182,40 @@ export default {
|
|
|
background-size: contain;
|
|
|
}
|
|
|
}
|
|
|
+ .common-lists{
|
|
|
+ padding: 0 20px;
|
|
|
+ display: flex;
|
|
|
+ .list-item,
|
|
|
+ .list-add{
|
|
|
+ width: 120px;
|
|
|
+ height: 120px;
|
|
|
+ padding: 18px 0 24px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ text-align: center;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .item-name,.add-text{
|
|
|
+ margin-top: 10px;
|
|
|
+ font-size: 14px;
|
|
|
+ line-height: 20px;
|
|
|
+ color: #1D1D1D;
|
|
|
+ }
|
|
|
+ .item-img{
|
|
|
+ width: 44px;
|
|
|
+ height: 44px;
|
|
|
+ }
|
|
|
+ .icon-add{
|
|
|
+ display: inline-block;
|
|
|
+ width: 44px;
|
|
|
+ height: 44px;
|
|
|
+ background: url('~@/assets/images/icon/icon-add.png') no-repeat center center;
|
|
|
+ background-size: contain;
|
|
|
+ }
|
|
|
+ .add-text{
|
|
|
+ color: #686868;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|