| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294 |
- <template>
- <view class="page-container">
- <nav-bar title="公司信息"></nav-bar>
- <view class="content">
- <view class="num-title">
- <text class="current-num">6</text>
- <text>/6</text>
- </view>
-
- <view class="main-title">人才发展</view>
- <view>介绍公司可提供的员工培养&晋升制度,良好的职业成长空间对人才更有吸引力</view>
-
- <view class="section">
- <view class="title">晋升制度</view>
- <view class="tags">
- <view
- class="tag"
- :class="{ 'active-tag': selectedUp.includes(index) }"
- v-for="(item, index) in upList"
- :key="index"
- @click="checkUp(index)"
- >{{ item }}</view>
- </view>
- </view>
-
- <view class="section">
- <view class="title">人才激励</view>
- <view class="tags">
- <view
- class="tag"
- :class="{ 'active-tag': selectedPeople.includes(index) }"
- v-for="(item, index) in peopleList"
- :key="index"
- @click="checkPeople(index)"
- >{{ item }}</view>
- </view>
- </view>
-
- <view class="section">
- <view class="title">能力培养</view>
- <view class="tags">
- <view
- class="tag"
- :class="{ 'active-tag': selectedPower.includes(index) }"
- v-for="(item, index) in powerList"
- :key="index"
- @click="checkPower(index)"
- >{{ item }}</view>
- </view>
- </view>
- </view>
- <view class="fixed-button">
- <view class="button" @click="goJobPostingSecond">保存</view>
- </view>
- </view>
- </template>
- <script>
- import navBar from "@/components/nav-bar/index.vue";
- export default {
- data() {
- return {
- companyId: '',
- loading: false,
- upList: ["考核晋升", "定期晋升", "完善的晋升机制"],
- selectedUp: [], // 改为数组存储多个选择
- peopleList: [
- "定期普调",
- "定期绩效调薪",
- "晋级涨薪",
- "项目奖金",
- "团队奖金",
- "个人奖金",
- "绩效提成",
- "股票期权",
- "人才补贴",
- ],
- selectedPeople: [], // 改为数组存储多个选择
- powerList: [
- "老员工带新",
- "导师一对一",
- "岗前带薪培训",
- "内部定期培训",
- "专业技能培训",
- "内部课程资源",
- "大牛带队",
- "人脉积累",
- "国内外进修",
- "校招培养",
- ],
- selectedPower: [], // 改为数组存储多个选择
- // companyData: {},
- companyPeopleDevelop: [],
- isUpdateMode: false // 新增:标记是否为编辑模式
- };
- },
- components: {
- navBar,
- },
- onLoad(options) {
- this.getCompanyInfo()
- },
- methods: {
- // 获取公司信息
- getCompanyInfo() {
- uni.showLoading({ title: '加载中' })
- this.$Request.get('/app/company/selectCompanyByUserId')
- .then((res) => {
- if (res.code != 0) {
- uni.showToast({
- title: res.msg || '查询状态失败',
- icon: 'none'
- });
- return
- }
- this.companyId = res.data.companyId
- this.initData(res.data)
- uni.hideLoading()
- })
- .catch((err) => {
- uni.hideLoading()
- uni.showToast({
- title: '网络异常',
- icon: 'none'
- })
- })
- },
-
- initData(companyInfo) {
- if (companyInfo?.companyPeopleDevelop) {
- // 处理字符串并分割为数组
- const savedPeopleDevelop = companyInfo.companyPeopleDevelop
- .replace(/,/g, ',') // 替换中文逗号
- .split(',') // 分割
- .map(item => item.trim()) // 去除空格
- .filter(item => item); // 过滤空值
-
- console.log('加载的人才发展数据:', savedPeopleDevelop);
-
- // 清空之前的选中
- this.selectedUp = [];
- this.selectedPeople = [];
- this.selectedPower = [];
-
- // 恢复晋升制度选择
- this.upList.forEach((item, index) => {
- if (savedPeopleDevelop.includes(item)) {
- this.selectedUp.push(index);
- }
- });
-
- // 恢复人才激励选择
- this.peopleList.forEach((item, index) => {
- if (savedPeopleDevelop.includes(item)) {
- this.selectedPeople.push(index);
- }
- });
-
- // 恢复能力培养选择
- this.powerList.forEach((item, index) => {
- if (savedPeopleDevelop.includes(item)) {
- this.selectedPower.push(index);
- }
- });
- console.log('人才发展数据已加载完成');
- }
- },
- // 晋升制度多选
- checkUp(index) {
- const idx = this.selectedUp.indexOf(index);
- if (idx > -1) {
- // 如果已选中,则取消选中
- this.selectedUp.splice(idx, 1);
- } else {
- // 如果未选中,则添加
- this.selectedUp.push(index);
- }
- },
- // 人才激励多选
- checkPeople(index) {
- const idx = this.selectedPeople.indexOf(index);
- if (idx > -1) {
- this.selectedPeople.splice(idx, 1);
- } else {
- this.selectedPeople.push(index);
- }
- },
- // 能力培养多选
- checkPower(index) {
- const idx = this.selectedPower.indexOf(index);
- if (idx > -1) {
- this.selectedPower.splice(idx, 1);
- } else {
- this.selectedPower.push(index);
- }
- },
- goJobPostingSecond() {
- if (this.loading) return
- // 清空之前的数组
- this.companyPeopleDevelop = [];
- // 添加选中的晋升制度
- this.selectedUp.forEach(index => {
- if (this.upList[index]) {
- this.companyPeopleDevelop.push(this.upList[index]);
- }
- });
- // 添加选中的人才激励
- this.selectedPeople.forEach(index => {
- if (this.peopleList[index]) {
- this.companyPeopleDevelop.push(this.peopleList[index]);
- }
- });
- // 添加选中的能力培养
- this.selectedPower.forEach(index => {
- if (this.powerList[index]) {
- this.companyPeopleDevelop.push(this.powerList[index]);
- }
- });
- // 验证是否至少选择了一项
- if (this.companyPeopleDevelop.length === 0) {
- uni.showToast({
- title: "请至少选择一项人才发展方向",
- icon: "none",
- });
- return;
- }
- this.loading = true
- uni.showLoading({ title: '保存中' })
- let companyData = {
- companyId: this.companyId,
- companyPeopleDevelop: this.companyPeopleDevelop.join(',')
- }
- this.$Request.postJson('/app/company/updateCompany', companyData)
- .then(res => {
- if (res.code == 0) {
- uni.showToast({
- title: '提交成功',
- duration: 1500,
- });
- setTimeout(() => {
- uni.$emit('updateCompanyInfo')
- uni.navigateBack()
- }, 500)
- }
- this.loading = false
- uni.hideLoading()
- })
- .catch(() => {
- this.loading = false
- uni.hideLoading()
- })
- // 如果是编辑模式,同时更新缓存
- // if (this.isUpdateMode) {
- // try {
- // let companyInfo = uni.getStorageSync('companyInfo');
- // if (companyInfo) {
- // companyInfo.companyPeopleDevelop = companyData.companyPeopleDevelop;
- // uni.setStorageSync('companyInfo', companyInfo);
- // console.log('已更新缓存中的人才发展数据');
- // }
- // } catch (error) {
- // console.error('更新缓存失败:', error);
- // }
- // }
- // 跳转到下一步
- // uni.navigateTo({
- // url: "/my/renzheng/editCompanyDesc?companyData=" +
- // encodeURIComponent(JSON.stringify(companyData)) +
- // (this.isUpdateMode ? "&update=true" : "")
- // });
- }
- },
- };
- </script>
- <style lang="scss" scoped>
- @import './company.scss';
- </style>
|