|
@@ -4,14 +4,17 @@
|
|
<span style="font-size: 14px; color: #666;">(最多10个标签)</span>
|
|
<span style="font-size: 14px; color: #666;">(最多10个标签)</span>
|
|
<div class="mb-15">
|
|
<div class="mb-15">
|
|
<v-chip
|
|
<v-chip
|
|
- v-for="(item, index) in chosenChipList" :key="index"
|
|
|
|
|
|
+ v-for="(item, index) in chosen" :key="index"
|
|
class="chip mx-2 mt-4"
|
|
class="chip mx-2 mt-4"
|
|
- label closable color="primary"
|
|
|
|
- >{{ item.name }}</v-chip>
|
|
|
|
|
|
+ label color="primary"
|
|
|
|
+ >
|
|
|
|
+ {{ item }}
|
|
|
|
+ <v-icon size="18" color="primary" style="margin-left: 6px;" @click="closeClick(item)">mdi-close-circle</v-icon>
|
|
|
|
+ </v-chip>
|
|
<div>
|
|
<div>
|
|
<div v-if="customTag" class="d-flex align-center mx-2 mt-4">
|
|
<div v-if="customTag" class="d-flex align-center mx-2 mt-4">
|
|
- <TextUI class="mr-2" :item="textItem"></TextUI>
|
|
|
|
- <!-- <v-btn prepend-icon="mdi-content-save-outline" color="warning" variant="tonal" @click="appendInnerClick">{{ $t('common.save') }}</v-btn> -->
|
|
|
|
|
|
+ <TextUI class="mr-2" :item="textItem" @appendInnerClick.stop="appendInnerClick"></TextUI>
|
|
|
|
+ <v-icon size="22" color="#ccc" style="cursor: pointer;" @click="customTag = false">mdi-close</v-icon>
|
|
</div>
|
|
</div>
|
|
<div v-else @click="customTag = true">
|
|
<div v-else @click="customTag = true">
|
|
<v-chip class="chip mx-2 mt-4" label color="orange"><v-icon icon="mdi-plus" start></v-icon>自定义标签</v-chip>
|
|
<v-chip class="chip mx-2 mt-4" label color="orange"><v-icon icon="mdi-plus" start></v-icon>自定义标签</v-chip>
|
|
@@ -24,74 +27,91 @@
|
|
v-for="(item, index) in chipList" :key="index"
|
|
v-for="(item, index) in chipList" :key="index"
|
|
class="chip mx-2 mt-4"
|
|
class="chip mx-2 mt-4"
|
|
label color="primary"
|
|
label color="primary"
|
|
- :disabled="chosenChipIds.includes(item.name)"
|
|
|
|
|
|
+ :disabled="chosen.includes(item)"
|
|
|
|
+ @click="choseClick(item)"
|
|
>
|
|
>
|
|
<v-icon icon="mdi-plus" start></v-icon>
|
|
<v-icon icon="mdi-plus" start></v-icon>
|
|
- {{ item.name }}
|
|
|
|
|
|
+ {{ item }}
|
|
</v-chip>
|
|
</v-chip>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
import TextUI from '@/components/FormUI/TextInput'
|
|
import TextUI from '@/components/FormUI/TextInput'
|
|
|
|
+import Snackbar from '@/plugins/snackbar'
|
|
|
|
+import Confirm from '@/plugins/confirm'
|
|
|
|
+import { useI18n } from '@/hooks/web/useI18n'; const { t } = useI18n()
|
|
|
|
+import { getEnterpriseBaseInfo, updateEnterpriseWelfare } from '@/api/enterprise'
|
|
import { ref } from 'vue';
|
|
import { ref } from 'vue';
|
|
defineOptions({name: 'informationSettingsComponents-welfareLabel'})
|
|
defineOptions({name: 'informationSettingsComponents-welfareLabel'})
|
|
const customTag = ref(false)
|
|
const customTag = ref(false)
|
|
-const appendInnerClick = () => {
|
|
|
|
|
|
+const limitNum = ref(10)
|
|
|
|
+let chosen = ref([])
|
|
|
|
+// 删除
|
|
|
|
+const closeClick = (item) => {
|
|
|
|
+ Confirm('系统提示', '是否确认删除?').then(async () => {
|
|
|
|
+ chosen.value = chosen.value.filter(e => e !== item)
|
|
|
|
+ handleSave('删除')
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+// 从推荐标签添加
|
|
|
|
+const choseClick = (item) => {
|
|
|
|
+ if (chosen.value?.length >= limitNum.value) return Snackbar.warning('最多可加10个标签')
|
|
|
|
+ chosen.value.push(item)
|
|
|
|
+ handleSave('添加')
|
|
|
|
+}
|
|
|
|
+// 保存自定义
|
|
|
|
+const appendInnerClick = (value) => {
|
|
|
|
+ if (chosen.value?.length >= limitNum.value) return Snackbar.warning('最多可加10个标签')
|
|
|
|
+ if (!value) return Snackbar.warning(t('common.pleaseEnter')+t('enterprise.infoSetting.welfareLabel'))
|
|
|
|
+ const index = chosen.value.findIndex(e => e === value)
|
|
|
|
+ if (index !== -1) return Snackbar.warning(t('common.alreadyExists'))
|
|
|
|
+ chosen.value.push(value)
|
|
|
|
+ handleSave('保存')
|
|
|
|
+}
|
|
|
|
+// 保存
|
|
|
|
+const handleSave = async (type) => {
|
|
|
|
+ const appAdminEnterpriseWelfareReqVO = { welfareList: chosen.value }
|
|
|
|
+ await updateEnterpriseWelfare(appAdminEnterpriseWelfareReqVO)
|
|
customTag.value = false
|
|
customTag.value = false
|
|
|
|
+ Snackbar.success(`${type}成功`)
|
|
|
|
+ setTimeout(() => { // 马上获取数据数据会不同步故setTimeout
|
|
|
|
+ getData()
|
|
|
|
+ }, 5000)
|
|
|
|
+}
|
|
|
|
+// 获取数据
|
|
|
|
+const getData = async () => {
|
|
|
|
+ const data = await getEnterpriseBaseInfo()
|
|
|
|
+ chosen.value = data?.welfareList || []
|
|
}
|
|
}
|
|
|
|
+getData()
|
|
const textItem = ref({
|
|
const textItem = ref({
|
|
type: 'text',
|
|
type: 'text',
|
|
width: 250,
|
|
width: 250,
|
|
hideDetails: true,
|
|
hideDetails: true,
|
|
|
|
+ autofocus: true, // 聚焦。
|
|
value: '',
|
|
value: '',
|
|
label: '请输入自定义标签',
|
|
label: '请输入自定义标签',
|
|
- appendInnerIcon: 'mdi-content-save-outline',
|
|
|
|
|
|
+ // appendInnerIcon: 'mdi-content-save-outline',
|
|
|
|
+ appendInnerIcon: 'mdi-checkbox-marked-circle',
|
|
appendInnerClick: appendInnerClick,
|
|
appendInnerClick: appendInnerClick,
|
|
})
|
|
})
|
|
-let chosenChipIds = ref([])
|
|
|
|
-const chosenChipList = ref([
|
|
|
|
- { name: '五险一金' },
|
|
|
|
- { name: '节日礼物' },
|
|
|
|
- { name: '技能培训' },
|
|
|
|
- { name: '带薪年假' },
|
|
|
|
- { name: '岗位晋升' },
|
|
|
|
- { name: '美女多' },
|
|
|
|
- { name: '帅哥多' },
|
|
|
|
- { name: '领导好' },
|
|
|
|
- { name: '午餐补贴' },
|
|
|
|
-])
|
|
|
|
-chosenChipIds.value = chosenChipList.value.map(e => e.name)
|
|
|
|
-//
|
|
|
|
-const chipList = ref([
|
|
|
|
- { name: '2五险一金' },
|
|
|
|
- { name: '2节日礼物' },
|
|
|
|
- { name: '五险一金' },
|
|
|
|
- { name: '节日礼物' },
|
|
|
|
- { name: '技能培训' },
|
|
|
|
- { name: '美女多' },
|
|
|
|
- { name: '帅哥多' },
|
|
|
|
- { name: '领导好' },
|
|
|
|
- { name: '午餐补贴' },
|
|
|
|
- { name: '2技能培训' },
|
|
|
|
- { name: '2带薪年假' },
|
|
|
|
- { name: '2岗位晋升' },
|
|
|
|
- { name: '带薪年假' },
|
|
|
|
- { name: '岗位晋升' },
|
|
|
|
- { name: '2美女多' },
|
|
|
|
- { name: '2帅哥多' },
|
|
|
|
- { name: '2领导好' },
|
|
|
|
- { name: '2午餐补贴' },
|
|
|
|
- { name: '3五险一金' },
|
|
|
|
- { name: '3节日礼物' },
|
|
|
|
- { name: '3技能培训' },
|
|
|
|
- { name: '3带薪年假' },
|
|
|
|
- { name: '3岗位晋升' },
|
|
|
|
- { name: '3美女多' },
|
|
|
|
- { name: '3帅哥多' },
|
|
|
|
- { name: '3领导好' },
|
|
|
|
- { name: '3午餐补贴' },
|
|
|
|
-])
|
|
|
|
|
|
+// 推荐标签
|
|
|
|
+const chipList = [
|
|
|
|
+ '五险一金',
|
|
|
|
+ '交通补助',
|
|
|
|
+ '节日礼物',
|
|
|
|
+ '技能培训',
|
|
|
|
+ '午餐补贴',
|
|
|
|
+ '话补补贴',
|
|
|
|
+ '带薪年假',
|
|
|
|
+ '住房补贴',
|
|
|
|
+ '岗位晋升',
|
|
|
|
+ '住房优惠',
|
|
|
|
+ '美女多',
|
|
|
|
+ '帅哥多',
|
|
|
|
+ '领导好'
|
|
|
|
+]
|
|
</script>
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
.chip {
|
|
.chip {
|