Commit 4f2abe4a authored by whidy#mbp's avatar whidy#mbp

Merge branch 'dev' of ssh://cloud.wodcloud.com:10022/apaas/apaas-system-ui into dev0508

parents e4af79bc 2b2c2195
# platform: # platform:
# runner: 10.11.92.37 # runner: 10.11.92.37
kind: pipeline kind: pipeline
name: dev0508 name: dev
trigger: trigger:
branch: branch:
- dev0508 - dev
clone: clone:
disable: true disable: true
...@@ -65,7 +65,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行 ...@@ -65,7 +65,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
base: registry.cn-qingdao.aliyuncs.com/wod/nginx:1.19.5 # 基础镜像,根据项目需求进行使用,如果第三方登录改成ui-base base: registry.cn-qingdao.aliyuncs.com/wod/nginx:1.19.5 # 基础镜像,根据项目需求进行使用,如果第三方登录改成ui-base
dockerfile: .beagle/dockerfile dockerfile: .beagle/dockerfile
repo: wod/apaas-system-ui # 生成镜像的 分组/名称 repo: wod/apaas-system-ui # 生成镜像的 分组/名称
version: "5.0.15" # 版本号 version: "5.0.14" # 版本号
channel: amd64 channel: amd64
args: "TARGETOS=linux,TARGETARCH=amd64" # 不同架构的构建参数 args: "TARGETOS=linux,TARGETARCH=amd64" # 不同架构的构建参数
registry: registry.cn-qingdao.aliyuncs.com # 私有仓库地址 registry: registry.cn-qingdao.aliyuncs.com # 私有仓库地址
...@@ -77,10 +77,10 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行 ...@@ -77,10 +77,10 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
- name: deploy-amd64 - name: deploy-amd64
image: registry.cn-qingdao.aliyuncs.com/wod/devops-kubernetes:1.0 image: registry.cn-qingdao.aliyuncs.com/wod/devops-kubernetes:1.0
settings: settings:
namespace: apaas-v5 namespace: apaas-v5-demo
deployment: apaas-manage-ui deployment: apaas-manage-ui
container: apaas-manage-ui container: apaas-manage-ui
image: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0.15-amd64 image: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0.14-amd64
environment: environment:
KUBERNETES_SERVER: KUBERNETES_SERVER:
from_secret: KUBERNETES_SERVER from_secret: KUBERNETES_SERVER
...@@ -96,7 +96,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行 ...@@ -96,7 +96,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
base: registry.cn-qingdao.aliyuncs.com/wod/nginx:1.19.5-arm64 base: registry.cn-qingdao.aliyuncs.com/wod/nginx:1.19.5-arm64
dockerfile: .beagle/dockerfile dockerfile: .beagle/dockerfile
repo: wod/apaas-system-ui repo: wod/apaas-system-ui
version: "5.0.15" version: "5.0.14"
channel: arm64 channel: arm64
args: "TARGETOS=linux,TARGETARCH=arm64" args: "TARGETOS=linux,TARGETARCH=arm64"
registry: registry.cn-qingdao.aliyuncs.com registry: registry.cn-qingdao.aliyuncs.com
...@@ -114,7 +114,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行 ...@@ -114,7 +114,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
base: registry.cn-qingdao.aliyuncs.com/wod/nginx:1.19.5-ppc64le base: registry.cn-qingdao.aliyuncs.com/wod/nginx:1.19.5-ppc64le
dockerfile: .beagle/dockerfile dockerfile: .beagle/dockerfile
repo: wod/apaas-system-ui repo: wod/apaas-system-ui
version: "5.0.15" version: "5.0.14"
channel: ppc64le channel: ppc64le
args: "TARGETOS=linux,TARGETARCH=ppc64le" args: "TARGETOS=linux,TARGETARCH=ppc64le"
registry: registry.cn-qingdao.aliyuncs.com registry: registry.cn-qingdao.aliyuncs.com
...@@ -132,7 +132,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行 ...@@ -132,7 +132,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
base: registry.cn-qingdao.aliyuncs.com/wod/nginx:1.19.5-mips64le base: registry.cn-qingdao.aliyuncs.com/wod/nginx:1.19.5-mips64le
dockerfile: .beagle/dockerfile dockerfile: .beagle/dockerfile
repo: wod/apaas-system-ui repo: wod/apaas-system-ui
version: "5.0.15" version: "5.0.14"
channel: mips64le channel: mips64le
args: "TARGETOS=linux,TARGETARCH=mips64le" args: "TARGETOS=linux,TARGETARCH=mips64le"
registry: registry.cn-qingdao.aliyuncs.com registry: registry.cn-qingdao.aliyuncs.com
...@@ -145,8 +145,8 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行 ...@@ -145,8 +145,8 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker-manifest:1.0 image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker-manifest:1.0
settings: settings:
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/mips64le platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/mips64le
template: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0.15-ARCH template: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0.14-ARCH
target: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0.15 target: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0.14
username: username:
from_secret: REGISTRY_USER_ALIYUN from_secret: REGISTRY_USER_ALIYUN
password: password:
...@@ -181,7 +181,7 @@ steps: ...@@ -181,7 +181,7 @@ steps:
REGISTRY_PASSWORD: REGISTRY_PASSWORD:
from_secret: REGISTRY_PASSWORD_ALIYUN from_secret: REGISTRY_PASSWORD_ALIYUN
settings: settings:
source: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0.15-amd64 source: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0.14-amd64
target: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0-amd64 target: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0-amd64
registry: registry.cn-qingdao.aliyuncs.com registry: registry.cn-qingdao.aliyuncs.com
...@@ -199,7 +199,7 @@ steps: ...@@ -199,7 +199,7 @@ steps:
REGISTRY_PASSWORD: REGISTRY_PASSWORD:
from_secret: REGISTRY_PASSWORD_ALIYUN from_secret: REGISTRY_PASSWORD_ALIYUN
settings: settings:
source: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0.15-arm64 source: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0.14-arm64
target: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0-arm64 target: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0-arm64
registry: registry.cn-qingdao.aliyuncs.com registry: registry.cn-qingdao.aliyuncs.com
...@@ -217,7 +217,7 @@ steps: ...@@ -217,7 +217,7 @@ steps:
REGISTRY_PASSWORD: REGISTRY_PASSWORD:
from_secret: REGISTRY_PASSWORD_ALIYUN from_secret: REGISTRY_PASSWORD_ALIYUN
settings: settings:
source: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0.15-ppc64le source: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0.14-ppc64le
target: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0-ppc64le target: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0-ppc64le
registry: registry.cn-qingdao.aliyuncs.com registry: registry.cn-qingdao.aliyuncs.com
...@@ -235,7 +235,7 @@ steps: ...@@ -235,7 +235,7 @@ steps:
REGISTRY_PASSWORD: REGISTRY_PASSWORD:
from_secret: REGISTRY_PASSWORD_ALIYUN from_secret: REGISTRY_PASSWORD_ALIYUN
settings: settings:
source: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0.15-mips64le source: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0.14-mips64le
target: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0-mips64le target: registry.cn-qingdao.aliyuncs.com/wod/apaas-system-ui:5.0-mips64le
##--------------对于需要保密的信息隐藏,减少账户信息的泄密⬇-----------------## ##--------------对于需要保密的信息隐藏,减少账户信息的泄密⬇-----------------##
--- ---
......
...@@ -2,25 +2,46 @@ ...@@ -2,25 +2,46 @@
<div class="item_card" :style="{ height: props.flag ? '242px' : '206px' }"> <div class="item_card" :style="{ height: props.flag ? '242px' : '206px' }">
<div class="action_box" v-if="props.flag"> <div class="action_box" v-if="props.flag">
<div class="can_click_text" @click="deleteItem(props.item)">删除</div> <div class="can_click_text" @click="deleteItem(props.item)">删除</div>
<div class="can_click_text" @click="move(1)" :class="props.item.canDown ? '' : 'disabled'">下移</div> <div class="can_click_text" @click="move(1)" :class="props.item.canDown ? '' : 'disabled'">
<div class="can_click_text" @click="move(2)" :class="props.item.canUp ? '' : 'disabled'">上移</div> 下移
</div>
<div class="can_click_text" @click="move(2)" :class="props.item.canUp ? '' : 'disabled'">
上移
</div>
</div> </div>
<div class="top_info" :style="{ 'padding-left': !props.flag ? '8px' : '24px' }"> <div class="top_info" :style="{ 'padding-left': !props.flag ? '8px' : '24px' }">
<template v-if="props.item.isSelected">
<el-checkbox
v-if="!props.flag"
class="select_box"
v-model="props.item.isSelected"
:disabled="props.item.isSelected"
@change="changeSelectedList"></el-checkbox>
</template>
<el-checkbox <el-checkbox
v-if="!props.flag" v-else-if="!props.flag"
class="select_box" class="select_box"
v-model="props.item.checked" v-model="checked"
@change="change_check"></el-checkbox> @change="changeSelectedList"></el-checkbox>
<div class="logo"> <div class="logo">
<img v-if="props.item.ability_logo" :src="JSON.parse(props.item.ability_logo)[0].url" alt="" /> <img
v-if="props.item.ability_logo !== '[]'"
:src="JSON.parse(props.item.ability_logo)[0].url"
alt="" />
<img v-else src="../assets/imgs/img_cover_ability.png" alt="" /> <img v-else src="../assets/imgs/img_cover_ability.png" alt="" />
</div> </div>
<div class="info"> <div class="info">
<div class="name"> <div class="name">
<el-tooltip class="box-item" effect="light" :content="props.item.ability_name" placement="top"> <el-tooltip
class="box-item"
effect="light"
:content="props.item.ability_name"
placement="top">
<span class="ability_name">{{ props.item.ability_name }}</span> <span class="ability_name">{{ props.item.ability_name }}</span>
</el-tooltip> </el-tooltip>
<span class="icon_box openness" :class="openClassObj[props.item.openness_id]">{{ props.item.openness }}</span> <span class="icon_box openness" :class="openClassObj[props.item.openness_id]">{{
props.item.openness
}}</span>
<span class="icon_box mock" v-if="props.item.include_mock_service">mock</span> <span class="icon_box mock" v-if="props.item.include_mock_service">mock</span>
</div> </div>
<div class="count"> <div class="count">
...@@ -33,7 +54,8 @@ ...@@ -33,7 +54,8 @@
<div class="line"></div> <div class="line"></div>
<div class="box2"> <div class="box2">
阅读{{ 阅读{{
props.item.browse_count == 0 || (props.item.browse_count && props.item.browse_count < 10000) props.item.browse_count == 0 ||
(props.item.browse_count && props.item.browse_count < 10000)
? props.item.browse_count ? props.item.browse_count
: props.item.browse_count < 10000000 : props.item.browse_count < 10000000
? Math.floor(props.item.browse_count / 10000) + "万+" ? Math.floor(props.item.browse_count / 10000) + "万+"
...@@ -53,7 +75,9 @@ ...@@ -53,7 +75,9 @@
</div> </div>
</div> </div>
</div> </div>
<div class="bottom_info" :style="{ height: props.flag ? 'calc(100% - 128px)' : 'calc(100% - 92px)' }"> <div
class="bottom_info"
:style="{ height: props.flag ? 'calc(100% - 128px)' : 'calc(100% - 92px)' }">
<div class="desc" :title="props.item.synopsis"> <div class="desc" :title="props.item.synopsis">
{{ props.item.synopsis }} {{ props.item.synopsis }}
</div> </div>
...@@ -68,8 +92,9 @@ ...@@ -68,8 +92,9 @@
</template> </template>
<script setup> <script setup>
import { ref } from "vue";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
const checked = ref(false);
const router = useRouter(); const router = useRouter();
const props = defineProps({ const props = defineProps({
item: { item: {
...@@ -81,7 +106,7 @@ const props = defineProps({ ...@@ -81,7 +106,7 @@ const props = defineProps({
default: false, default: false,
}, },
}); });
const emit = defineEmits(["change_check", "deleteItem", "move"]); const emit = defineEmits(["changeSelectedList", "deleteItem", "move"]);
const openClassObj = { const openClassObj = {
"9de06ba6-6ee2-4449-91d9-31a1c7554311": "open", "9de06ba6-6ee2-4449-91d9-31a1c7554311": "open",
"4e8b4c37-e565-4195-8303-3b1ccd48dd13": "share", "4e8b4c37-e565-4195-8303-3b1ccd48dd13": "share",
...@@ -89,9 +114,8 @@ const openClassObj = { ...@@ -89,9 +114,8 @@ const openClassObj = {
"4e8b4c37-e565-4195-8303-3b1ccd48dd16": "sensitive", "4e8b4c37-e565-4195-8303-3b1ccd48dd16": "sensitive",
}; };
const change_check = () => { const changeSelectedList = () => {
console.log(props.item); emit("changeSelectedList", props.item, checked.value);
emit("change_check", props.item);
}; };
const deleteItem = (item) => { const deleteItem = (item) => {
emit("deleteItem", item); emit("deleteItem", item);
...@@ -106,6 +130,10 @@ const move = (type) => { ...@@ -106,6 +130,10 @@ const move = (type) => {
}; };
emit("move", temp); emit("move", temp);
}; };
defineExpose({
checked
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
<template> <template>
<div v-if="!props.flag && props.loading === true">
<div class="empty-tips">数据加载中...</div>
</div>
<div class="card_list"> <div class="card_list">
<div v-for="(e, i) in props.list" :key="'card' + i" class="item"> <template v-if="props.list.length > 0">
<ability-card <div v-for="(item, i) in props.list" :key="'card' + i" class="item">
v-if="e.id" <ability-card
:item="e" ref="itemRefs"
@change_check="changeCheck" :item="item"
:flag="props.flag" @change-selected-list="changeSelectedList"
@deleteItem="deleteItem" :flag="props.flag"
@move="move" /> @deleteItem="deleteItem"
<div v-else class="empty_card" @click="open"> @move="move" />
</div>
</template>
<div class="item" v-if="props.flag">
<div v-if="props.list.length < 9" class="empty_card" @click="open">
<span>+</span> <span>+</span>
</div> </div>
</div> </div>
...@@ -16,7 +23,9 @@ ...@@ -16,7 +23,9 @@
</template> </template>
<script setup> <script setup>
import { onMounted, ref } from "vue";
import abilityCard from "./ability-card.vue"; import abilityCard from "./ability-card.vue";
const itemRefs = ref([]);
const props = defineProps({ const props = defineProps({
list: { list: {
type: Array, type: Array,
...@@ -26,13 +35,16 @@ const props = defineProps({ ...@@ -26,13 +35,16 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
loading: {
type: Boolean,
default: false,
},
}); });
const emit = defineEmits(["changeCheck", "openBox", "deleteItem", "move"]); const emit = defineEmits(["changeSelectedList", "openBox", "deleteItem", "move"]);
const changeCheck = (item) => { const changeSelectedList = (item, checked) => {
emit("changeCheck", item); emit("changeSelectedList", item, checked);
}; };
const open = () => { const open = () => {
console.log(3333);
emit("openBox"); emit("openBox");
}; };
const deleteItem = (item) => { const deleteItem = (item) => {
...@@ -41,6 +53,19 @@ const deleteItem = (item) => { ...@@ -41,6 +53,19 @@ const deleteItem = (item) => {
const move = (temp) => { const move = (temp) => {
emit("move", temp); emit("move", temp);
}; };
// const setRef = (el, index) => {
// itemRefs.value.push(el)
// }
onMounted(() => {
console.log(itemRefs);
})
defineExpose({
list: props.list,
itemRefs
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -67,5 +92,9 @@ const move = (temp) => { ...@@ -67,5 +92,9 @@ const move = (temp) => {
font-size: 48px; font-size: 48px;
font-weight: 100; font-weight: 100;
} }
.empty-tips {
text-align: center;
}
} }
</style> </style>
...@@ -11,14 +11,14 @@ ...@@ -11,14 +11,14 @@
@changeType="changeType"></type-form> @changeType="changeType"></type-form>
<div class="ability_select"> <div class="ability_select">
<div class="title"> <div class="title">
<span>已选择能力({{ selectArrNew.length }}/9)</span> <span>已选择能力({{ selectedItemList.length }}/9)</span>
<el-tooltip class="box-item" effect="light" content="最少需选择6个能力" placement="top"> <el-tooltip class="box-item" effect="light" content="最少需选择6个能力" placement="top">
<bg-icon icon="#bg-ic-circle-warning" style="color: #7784a6"></bg-icon> <bg-icon icon="#bg-ic-circle-warning" style="color: #7784a6"></bg-icon>
</el-tooltip> </el-tooltip>
</div> </div>
<div class="select_arr"> <div class="select_arr">
<ability-list <ability-list
:list="selectArr" :list="selectedItemList"
:flag="true" :flag="true"
@openBox="openDialog" @openBox="openDialog"
@deleteItem="deleteItem" @deleteItem="deleteItem"
...@@ -37,7 +37,12 @@ ...@@ -37,7 +37,12 @@
</div> </div>
</div> </div>
</div> </div>
<el-dialog class="select_dialog" title="选择能力" v-model="selectDialog" width="1220px"> <el-dialog
class="select_dialog"
title="选择能力"
v-model="selectDialog"
width="1220px"
:before-close="cancelSelectDialog">
<div class="select_box"> <div class="select_box">
<div class="topFilter"> <div class="topFilter">
<div class="right"> <div class="right">
...@@ -97,13 +102,20 @@ ...@@ -97,13 +102,20 @@
</div> </div>
<div> <div>
<span>已选择</span> <span>已选择</span>
<span class="num">({{ selectArrNew.length }}/9)</span> <span class="num"
>({{ selectedItemList.length + toBeAddedItemList.length }}/9)</span
>
<span></span> <span></span>
<span class="can_click_text" @click="clearSelection">清空</span> <span class="can_click_text" @click="clearSelection">清空</span>
</div> </div>
</div> </div>
<div class="user_table bg-scroll"> <div class="user_table bg-scroll">
<ability-list :list="list" @changeCheck="changeCheck"></ability-list> <ability-list
ref="abilityListRef"
:list="list"
:loading="abilityLoading"
:flag="false"
@change-selected-list="changeSelectedList"></ability-list>
</div> </div>
</div> </div>
</div> </div>
...@@ -117,8 +129,8 @@ ...@@ -117,8 +129,8 @@
:pageSizes="[15, 30, 50]"> :pageSizes="[15, 30, 50]">
</bg-pagination> </bg-pagination>
<div class="apaas_button"> <div class="apaas_button">
<el-button type="default" @click="selectDialog = false">取 消</el-button> <el-button type="default" @click="cancelSelectDialog">取 消</el-button>
<el-button type="primary" @click="conform">确 定</el-button> <el-button type="primary" @click="confirm">确 定</el-button>
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
...@@ -137,13 +149,14 @@ import abilityList from "@/components/ability-list.vue"; ...@@ -137,13 +149,14 @@ import abilityList from "@/components/ability-list.vue";
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
const typeFormRef = ref(null); const typeFormRef = ref(null);
const abilityListRef = ref(null);
const state = reactive({ const state = reactive({
formData: { formData: {
business_type_id: "", business_type_id: "",
logo: [], logo: [],
state: 1, state: 1,
}, },
selectArr: ["", "", "", "", "", "", "", "", ""], selectedItemList: [],
selectDialog: false, selectDialog: false,
dialogFilter: { dialogFilter: {
openness: [], openness: [],
...@@ -176,7 +189,8 @@ const state = reactive({ ...@@ -176,7 +189,8 @@ const state = reactive({
], ],
businessList: [], businessList: [],
list: [], list: [],
selectArrNew: [], abilityLoading: false,
toBeAddedItemList: [],
}); });
const getDetail = (id) => { const getDetail = (id) => {
...@@ -185,30 +199,25 @@ const getDetail = (id) => { ...@@ -185,30 +199,25 @@ const getDetail = (id) => {
.then((res) => { .then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
const data = res.data.data; const data = res.data.data;
console.log(data);
typeFormRef.value.setForm({ typeFormRef.value.setForm({
business_type_id: data.business_type_id, business_type_id: data.business_type_id,
logo: data.logo ? [{ url: data.logo }] : [], logo: data.logo ? [{ url: data.logo }] : [],
}); });
state.selectArr = []; state.selectedItemList = [];
state.selectArrNew = []; state.toBeAddedItemList = [];
state.formData.state = data.state; state.formData.state = data.state;
state.formData.business_type_id = data.business_type_id; state.formData.business_type_id = data.business_type_id;
state.selectArrNew = data.ability_list || []; state.selectedItemList = data.ability_list || [];
state.selectArrNew.forEach((e, i) => { state.selectedItemList.forEach((e, i) => {
e.canDown = true; e.canDown = true;
e.canUp = true; e.canUp = true;
if (i == 0) { if (i == 0) {
e.canUp = false; e.canUp = false;
} }
if (i == state.selectArrNew.length - 1) { if (i == state.selectedItemList.length - 1) {
e.canDown = false; e.canDown = false;
} }
}); });
state.selectArr.push(...state.selectArrNew);
for (var i = 0; i < 9 - state.selectArrNew.length; i++) {
state.selectArr.push("");
}
} else { } else {
ElMessage.error(res.data.data); ElMessage.error(res.data.data);
} }
...@@ -230,36 +239,33 @@ const getOrgList = () => { ...@@ -230,36 +239,33 @@ const getOrgList = () => {
const changeType = (val) => { const changeType = (val) => {
state.formData.business_type_id = val; state.formData.business_type_id = val;
state.selectArr = ["", "", "", "", "", "", "", "", ""]; state.selectedItemList = [];
state.selectArrNew = []; state.toBeAddedItemList = [];
}; };
const getAbilityList = () => { const getAbilityList = () => {
state.abilityLoading = true;
let params = { let params = {
...state.dialogFilter, ...state.dialogFilter,
business_type: state.formData.business_type_id, business_type: state.formData.business_type_id,
}; };
params.organization_id = params.organization_id =
params.organization_id && params.organization_id.length > 0 ? params.organization_id.join(",") : ""; params.organization_id && params.organization_id.length > 0
? params.organization_id.join(",")
: "";
params.openness = params.openness && params.openness.length > 0 ? params.openness.join(",") : ""; params.openness = params.openness && params.openness.length > 0 ? params.openness.join(",") : "";
axios.get(`/apaas/system/v5/recommend/ability/list`, { params }).then((res) => { axios.get(`/apaas/system/v5/recommend/ability/list`, { params }).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
let selecteItemIdList = state.selectedItemList.map((e) => e.id);
state.list = res.data.data.ability_list || []; state.list = res.data.data.ability_list || [];
state.selectArrNew = []; state.list.forEach((item) => {
state.total = res.data.data.ability_total; if (selecteItemIdList.indexOf(item.id) > -1) {
nextTick(() => { item.isSelected = true;
state.list.forEach((e) => { }
e.checked = false;
state.selectArr.forEach((k) => {
if (k.id) {
if (e.id == k.id) {
e.checked = true;
state.selectArrNew.push(e);
}
}
});
});
}); });
state.total = res.data.data.ability_total;
} }
state.abilityLoading = false;
}); });
}; };
...@@ -269,58 +275,60 @@ const openDialog = () => { ...@@ -269,58 +275,60 @@ const openDialog = () => {
}; };
const deleteItem = (item) => { const deleteItem = (item) => {
changeCheck(item, true); let selecteItemIdList = state.selectedItemList.map((e) => e.id);
state.selectedItemList.splice(selecteItemIdList.indexOf(item.id), 1);
moveAbleChanging();
}; };
const move = (temp) => { const move = (temp) => {
let id = temp.item.id; let id = temp.item.id;
let index = null; let index = null;
state.selectArr.forEach((e, i) => { state.selectedItemList.forEach((e, i) => {
if (e.id == id) { if (e.id == id) {
index = i; index = i;
} }
}); });
if (temp.type == 1) { if (temp.type == 1) {
state.selectArr[index] = state.selectArr[index + 1]; state.selectedItemList[index] = state.selectedItemList[index + 1];
state.selectArr[index + 1] = temp.item; state.selectedItemList[index + 1] = temp.item;
} else { } else {
state.selectArr[index] = state.selectArr[index - 1]; state.selectedItemList[index] = state.selectedItemList[index - 1];
state.selectArr[index - 1] = temp.item; state.selectedItemList[index - 1] = temp.item;
} }
state.selectArr.forEach((e, i) => { state.selectedItemList.forEach((e, i) => {
if (e != "") { if (e != "") {
e.canDown = true; e.canDown = true;
e.canUp = true; e.canUp = true;
if (i == 0) { if (i == 0) {
e.canUp = false; e.canUp = false;
} }
if (i == state.selectArrNew.length - 1) { if (i == state.selectedItemList.length - 1) {
e.canDown = false; e.canDown = false;
} }
} }
}); });
state.selectArrNew = state.selectArr.filter((e) => e )
}; };
const changePage = (val) => { const changePage = (val) => {
state.dialogFilter.page = 1; state.dialogFilter.page = val;
getAbilityList(); getAbilityList();
}; };
const changeSize = (val) => { const changeSize = (val) => {
state.dialogFilter.limit = val; state.dialogFilter.limit = val;
changePage(1); changePage(val);
}; };
const changeCollation = (val) => { const changeCollation = (val) => {
state.dialogFilter.collation = val; state.dialogFilter.collation = val;
changePage(1); changePage(val);
}; };
const clearSelection = () => { const clearSelection = () => {
state.list.forEach((e) => { state.toBeAddedItemList = [];
e.checked = false; abilityListRef.value.itemRefs.forEach((item) => {
item.checked = false;
}); });
state.selectArrNew = [];
}; };
const searchAction = () => { const searchAction = () => {
changePage(1); changePage(1);
...@@ -337,59 +345,73 @@ const clearAction = () => { ...@@ -337,59 +345,73 @@ const clearAction = () => {
changePage(1); changePage(1);
}; };
const changeCheck = (item, deleteFlag) => { const changeSelectedList = (item, checked) => {
let arr = state.selectArrNew.map((e) => e.id) || []; if (checked) {
if (arr.indexOf(item.id) > -1) { state.toBeAddedItemList.push(item);
state.selectArrNew.splice(arr.indexOf(item.id), 1);
} else { } else {
state.selectArrNew.push(item); let _toBeAddedItemIdList = state.toBeAddedItemList.map((e) => e.id);
state.toBeAddedItemList.splice(_toBeAddedItemIdList.indexOf(item.id), 1);
} }
state.selectArrNew.forEach((e, i) => { moveAbleChanging();
};
const moveAbleChanging = () => {
state.selectedItemList.forEach((e, i) => {
e.canDown = true; e.canDown = true;
e.canUp = true; e.canUp = true;
if (i == 0) { if (i == 0) {
e.canUp = false; e.canUp = false;
} }
if (i == state.selectArrNew.length - 1) { if (i == state.selectedItemList.length - 1) {
e.canDown = false; e.canDown = false;
} }
}); });
if (deleteFlag) {
conform();
}
}; };
const submit = () => { const submit = () => {
typeFormRef.value.submitForm(); typeFormRef.value.submitForm();
}; };
const conform = () => { const cancelSelectDialog = () => {
if (state.selectArrNew.length > 9) { state.selectDialog = false;
state.toBeAddedItemList = [];
state.list = [];
};
const confirm = () => {
if (
state.toBeAddedItemList.length > 9 ||
state.selectedItemList.length + state.toBeAddedItemList.length > 9
) {
ElMessage.error("最多可选择9个能力"); ElMessage.error("最多可选择9个能力");
return; return;
} }
state.selectArr = JSON.parse(JSON.stringify(state.selectArrNew)); const _newItemList = [];
if (state.selectArr.length < 9) { state.toBeAddedItemList.forEach((toBeAddedItem) => {
let arr = []; const hasItem = state.selectedItemList.some(
for (var i = 0; i < 9 - state.selectArr.length; i++) { (selectedItem) => toBeAddedItem.id === selectedItem.id
arr.push(""); );
if (!hasItem) {
_newItemList.push(toBeAddedItem);
} }
state.selectArr.push(...arr); });
} state.selectedItemList.push(..._newItemList);
state.selectDialog = false; state.toBeAddedItemList.length = 0;
moveAbleChanging();
cancelSelectDialog();
}; };
const submitFormData = (data) => { const submitFormData = (data) => {
if (state.selectArrNew.length < 6) { if (state.selectedItemList.length < 6) {
ElMessage.error("最少选择6个能力"); ElMessage.error("最少选择6个能力");
return; return;
} }
if (data) { if (data) {
Object.assign(state.formData, data); Object.assign(state.formData, data);
console.log(state.formData);
if (route.query.id) { if (route.query.id) {
// 编辑 // 编辑
let abilitys = []; let abilitys = [];
state.selectArrNew.forEach((e) => { state.selectedItemList.forEach((e) => {
abilitys.push(e.ability_id); abilitys.push(e.ability_id);
}); });
let params = { let params = {
...@@ -409,7 +431,7 @@ const submitFormData = (data) => { ...@@ -409,7 +431,7 @@ const submitFormData = (data) => {
}); });
} else { } else {
let abilitys = []; let abilitys = [];
state.selectArrNew.forEach((e) => { state.selectedItemList.forEach((e) => {
abilitys.push(e.ability_id); abilitys.push(e.ability_id);
}); });
let params = { let params = {
...@@ -461,16 +483,16 @@ onBeforeMount(() => { ...@@ -461,16 +483,16 @@ onBeforeMount(() => {
const { const {
formData, formData,
selectArr, selectedItemList,
selectDialog, selectDialog,
dialogFilter, dialogFilter,
typeList, typeList,
total, total,
orgList, orgList,
collationArr, collationArr,
selection,
list, list,
selectArrNew, abilityLoading,
toBeAddedItemList,
businessList, businessList,
} = toRefs(state); } = toRefs(state);
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment