index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. <template>
  2. <view class="ti_page">
  3. <view class="form">
  4. <view class="form-item adfacjb">
  5. <view class="form-item-title red">团队名称</view>
  6. <view class="form-item-inp">
  7. <u-input v-model="teamInfo.teamName" placeholder="请输入团队名称" placeholder-style="color:#B3BFC8;" border="none" inputAlign="right" fontSize="30rpx" color="#667E90"/>
  8. </view>
  9. </view>
  10. <view class="form-item adfacjb">
  11. <view class="form-item-title red">所在公司</view>
  12. <view class="form-item-inp">
  13. <u-input v-model="teamInfo.enterpriseName" placeholder="请输入公司名称" placeholder-style="color:#B3BFC8;" border="none" inputAlign="right" fontSize="30rpx" color="#667E90"/>
  14. </view>
  15. </view>
  16. <view class="form-item adfacjb">
  17. <view class="form-item-title red">企业官网</view>
  18. <view class="form-item-inp">
  19. <u-input v-model="teamInfo.enterpriseWebsite" maxlength="500" placeholder="无官网请填写“无”" placeholder-style="color:#B3BFC8;" border="none" inputAlign="right" fontSize="30rpx" color="#667E90" />
  20. </view>
  21. </view>
  22. <view class="form-item adfacjb">
  23. <view class="form-item-title red">所属地区</view>
  24. <view class="form-item-inp adfac" @click="pickerShow('areaShow')">
  25. <text :class="{'active':areaText!=='请选择'}">{{areaText}}</text>
  26. <u-icon name="arrow-right" size="24rpx" color="#B9C0C8"></u-icon>
  27. </view>
  28. </view>
  29. <view class="form-item adfacjb">
  30. <view class="form-item-title red">所属行业</view>
  31. <view class="form-item-inp adfac" @click="turnPage('industry')">
  32. <text :class="{'active':industryText!=='请选择'}">{{industryText}}</text>
  33. <u-icon name="arrow-right" size="20rpx" color="#B9C0C8"></u-icon>
  34. </view>
  35. </view>
  36. <view class="form-item adfacjb">
  37. <view class="form-item-title" :class="{'red':isqtype}">团队职能类型</view>
  38. <view class="form-item-inp adfac" @click="turnPage('function')">
  39. <text :class="{'active':functionTypeText!=='请选择'}">{{functionTypeText}}</text>
  40. <u-icon name="arrow-right" size="20rpx" color="#B9C0C8"></u-icon>
  41. </view>
  42. </view>
  43. <view class="form-item adfacjb">
  44. <view class="form-item-title" :class="{'red':isqtype}">团队模式类型</view>
  45. <view class="form-item-inp adfac" @click="turnPage('architecture')">
  46. <text :class="{'active':architectureTypeText!=='请选择'}">{{architectureTypeText}}</text>
  47. <u-icon name="arrow-right" size="20rpx" color="#B9C0C8"></u-icon>
  48. </view>
  49. </view>
  50. <view class="form-item adfacjb">
  51. <view class="form-item-title" :class="{'red':isqtype}">团队规模</view>
  52. <view class="form-item-inp adfac" @click="selectShow('teamScaleShow')">
  53. <text :class="{'active':teamScaleText!=='请选择'}">{{teamScaleText}}</text>
  54. <u-icon name="arrow-right" size="20rpx" color="#B9C0C8"></u-icon>
  55. </view>
  56. </view>
  57. <!-- <view class="form-item adfacjb">
  58. <view class="form-item-title" :class="{'red':isqtype}">团队层级</view>
  59. <view class="form-item-inp adfac" @click="selectShow('teamLevelShow')">
  60. <text :class="{'active':teamLevelText!=='请选择'}">{{teamLevelText}}</text>
  61. <u-icon name="arrow-right" size="20rpx" color="#B9C0C8"></u-icon>
  62. </view>
  63. </view> -->
  64. </view>
  65. <view class="box">
  66. <view class="box-title-row">
  67. <view class="box-title" :class="{'red':isqtype}">团队简介</view>
  68. <view class="box-title-tip" @click="briefTipShow=true">
  69. <u-icon name="question-circle" size="32rpx" color="#B3BFC8"></u-icon>
  70. </view>
  71. </view>
  72. <view class="box-textarea">
  73. <u-textarea border="none" height="320rpx" maxlength="-1" style="color: #667E90;padding: 0;" :placeholderStyle="{'color':'#B3BFC8','font-size':'30rpx','line-height':'40rpx'}"
  74. v-model="teamInfo.brief" placeholder="示例:这是一个为推动公司ERP系统升级后的落地应用而组建的团队,36名成员由公司副总经理、各部门总监以及核心骨干组成,大部分成员在该公司同事超过10年,团队成员的工作地点分布在香港、深圳、上海、苏州和东莞等地。公司升级ERP系统是配合”中国区业务战略统一”的大方向,促进建立一致性的运作流程体系。但在新ERP系统落地应用的过程中,不同区域、不同业务单元的认知理解不一,推动新系统应用的力度也参差不去,还造成了不同业务单元之间、不同职能部门之间的协作混乱。公司董事会期待这个团队能够精诚合作,打破部门壁垒,积极推动新ERP系统的落地应用,促进公司战略目标达成。"></u-textarea>
  75. </view>
  76. </view>
  77. <cus-team-background-files ref="backgroundRef" :teamId="teamId" :initialCount="teamInfo.backgroundFileCount || 0" @countChange="backgroundCountChange" />
  78. <view class="zt_btn" :class="{ disabled: confirming || submitting }" @click="handleConfirm">{{confirming || submitting ? '处理中...' : confirmText}}</view>
  79. <view class="dialog" v-if="areaShow">
  80. <view class="dialog-box">
  81. <cus-province-city-area @cancel="areaShow=false" @confirm="areaConfirm"></cus-province-city-area>
  82. </view>
  83. </view>
  84. <cus-select :show="teamScaleShow" title="选择团队规模" :list="teamScaleData" @close="teamScaleShow=false" @confirmTeam="e=>selectConfirm(e,'scale','teamScaleText','teamScaleShow')"></cus-select>
  85. <!-- <cus-select :show="teamLevelShow" title="选择团队层级" :list="teamLevelData" @close="teamLevelShow=false" @confirmTeam="e=>selectConfirm(e,'hierarchy','teamLevelText','teamLevelShow')"></cus-select> -->
  86. <!-- 团队简介提示弹层 -->
  87. <u-popup :show="briefTipShow" mode="center" :round="20" :closeable="true" @close="briefTipShow=false">
  88. <view class="brief-tip-content">
  89. <view class="brief-tip-title">示例</view>
  90. <view class="brief-tip-text">这是一个为推动公司ERP系统升级后的落地应用而组建的团队,36名成员由公司副总经理、各部门总监以及核心骨干组成,大部分成员在该公司同事超过10年,团队成员的工作地点分布在香港、深圳、上海、苏州和东莞等地。</view>
  91. <view class="brief-tip-text">公司升级ERP系统是配合"中国区业务战略统一"的大方向,促进建立一致性的运作流程体系。但在新ERP系统落地应用的过程中,不同区域、不同业务单元的认知理解不一,推动新系统应用的力度也参差不齐,还造成了不同业务单元之间、不同职能部门之间的协作混乱。</view>
  92. <view class="brief-tip-text">公司董事会期待这个团队能够精诚合作,打破部门壁垒,积极推动新ERP系统的落地应用,促进公司战略目标达成。</view>
  93. </view>
  94. </u-popup>
  95. </view>
  96. </template>
  97. <script>
  98. import CusSelect from '@/components/CusSelect/index.vue'
  99. import CusProvinceCityArea from '@/components/CusProvinceCityArea/index.vue'
  100. import CusTeamBackgroundFiles from '@/components/CusTeamBackgroundFiles/index.vue'
  101. import teamBackgroundRules from '@/utils/teamBackgroundFile.js'
  102. const { createTeamSubmitPayload, validateEnterpriseWebsite } = teamBackgroundRules
  103. export default {
  104. components:{ CusSelect, CusProvinceCityArea, CusTeamBackgroundFiles },
  105. props:{
  106. confirmText:{
  107. type:String,
  108. default:'下一步'
  109. },
  110. qtype:{
  111. type:Boolean,
  112. default:false
  113. },
  114. teamId: { type: [String, Number], default: '' },
  115. submitting: { type: Boolean, default: false }
  116. },
  117. options: { styleIsolation: 'shared' },
  118. data(){
  119. return {
  120. teamInfo:{
  121. teamName:'',
  122. enterpriseName:'',
  123. enterpriseWebsite:'',
  124. provinceId:'',
  125. cityId:'',
  126. districtId:'',
  127. industryId:'',
  128. functionIds:[],
  129. orgIds:[],
  130. scale:'',
  131. hierarchy:'',
  132. brief:'',
  133. backgroundFileCount:0
  134. },
  135. areaShow:false,
  136. areaText:'请选择',
  137. industryText:'请选择',
  138. functionTypeText:'请选择',
  139. architectureTypeText:'请选择',
  140. teamScaleShow:false,
  141. teamScaleData:[],
  142. teamScaleText:'请选择',
  143. teamLevelShow:false,
  144. teamLevelData:[],
  145. teamLevelText:'请选择',
  146. isqtype:false,
  147. briefTipShow:false,
  148. confirming:false
  149. }
  150. },
  151. mounted() {
  152. this.isqtype = this.$props.qtype||false;
  153. },
  154. methods:{
  155. backgroundCountChange(count){
  156. this.teamInfo.backgroundFileCount = count;
  157. },
  158. flushBackgroundFiles(teamId) {
  159. return this.$refs.backgroundRef.flushPendingFiles(teamId)
  160. },
  161. hasDeferredPcUpload() {
  162. return this.$refs.backgroundRef.hasDeferredPcUpload()
  163. },
  164. waitForDeferredPcUpload(teamId) {
  165. return this.$refs.backgroundRef.waitForDeferredPcUpload(teamId)
  166. },
  167. hasUnresolvedBackgroundFiles() {
  168. return this.$refs.backgroundRef.hasUnresolvedFiles()
  169. },
  170. isBackgroundUploadActive() {
  171. return this.$refs.backgroundRef.isUploadActive()
  172. },
  173. getTeamScaleData(){
  174. this.$api.get('/getListByType/team_scale').then(({data:res})=>{
  175. if(res.code!==0) return this.$showToast(res.msg)
  176. this.teamScaleData = res.data.map(d=>({name:d.dictLabel,id:d.dictValue}))
  177. })
  178. },
  179. getTeamHierarchyData(){
  180. this.$api.get('/getListByType/team_hierarchy').then(({data:res})=>{
  181. if(res.code!==0) return this.$showToast(res.msg)
  182. this.teamLevelData = res.data.map(d=>({name:d.dictLabel,id:d.dictValue}))
  183. })
  184. },
  185. setTeamInfo(info){
  186. this.teamInfo = Object.assign({
  187. teamName:'', enterpriseName:'', enterpriseWebsite:'', provinceId:'', cityId:'',
  188. districtId:'', industryId:'', functionIds:[], orgIds:[], scale:'',
  189. hierarchy:'', brief:'', backgroundFileCount:0
  190. }, info || {});
  191. },
  192. confirm(e) {
  193. const { value } = e;
  194. this.areaText = value.map(item => item.label).join('-');
  195. this.areaShow = false;
  196. },
  197. cancel() {
  198. this.areaShow = false;
  199. },
  200. close() {
  201. this.areaShow = false;
  202. },
  203. pickerShow(key){
  204. this[key] = true;
  205. },
  206. turnPage(type){
  207. if(type==='industry'){
  208. uni.navigateTo({
  209. url:'/pagesPublish/industry',
  210. events:{
  211. selectConfirm:data=>{
  212. this.teamInfo.industryId = data.industryId;
  213. this.industryText = data.industryName;
  214. }
  215. }
  216. })
  217. }else{
  218. uni.navigateTo({
  219. url:'/pagesPublish/teamTypeMultiple?type='+type,
  220. events:{
  221. selectConfirm:data=>{
  222. if(data.type==='function'){
  223. this.teamInfo.functionIds = data.ids;
  224. this.functionTypeText = data.names.join(',');
  225. }else if(data.type==='architecture'){
  226. this.teamInfo.orgIds = data.ids;
  227. this.architectureTypeText = data.names.join(',');
  228. }
  229. }
  230. }
  231. })
  232. }
  233. },
  234. selectShow(key){
  235. this[key] = true;
  236. this.$nextTick(()=>{
  237. if(key==='teamScaleShow') this.getTeamScaleData();
  238. if(key==='teamLevelShow') this.getTeamHierarchyData();
  239. })
  240. },
  241. pickerConfirm(e,key1,key2,key3){
  242. this.teamInfo[key1] = e.value[0].id;
  243. this[key2] = e.value[0].name;
  244. this[key3] = false;
  245. },
  246. selectConfirm(e,key1,key2,key3){
  247. this.teamInfo[key1] = e.id;
  248. this[key2] = e.name;
  249. this[key3] = false;
  250. },
  251. async handleConfirm(){
  252. if(this.confirming || this.submitting) return
  253. if(!this.teamInfo.teamName) return this.$showToast('请输入团队名称')
  254. if(!this.teamInfo.enterpriseName) return this.$showToast('请输入公司名称')
  255. const enterpriseWebsite = String(this.teamInfo.enterpriseWebsite || '').trim()
  256. const websiteError = validateEnterpriseWebsite(enterpriseWebsite)
  257. if(websiteError) return this.$showToast(websiteError)
  258. this.teamInfo.enterpriseWebsite = enterpriseWebsite
  259. if(!this.teamInfo.districtId) return this.$showToast('请选择所属地区')
  260. if(!this.teamInfo.industryId) return this.$showToast('请选择所属行业')
  261. if(this.isqtype){
  262. if(this.teamInfo.functionIds.length===0) return this.$showToast('请选择团队职能类型')
  263. if(this.teamInfo.orgIds.length===0) return this.$showToast('请选择团队模式类型')
  264. if(!this.teamInfo.scale) return this.$showToast('请选择团队规模')
  265. // if(!this.teamInfo.hierarchy) return this.$showToast('请选择团队层级')
  266. if(!this.teamInfo.brief) return this.$showToast('请输入团队简介')
  267. }
  268. this.confirming = true
  269. try {
  270. if(this.teamId){
  271. const uploadResult = await this.flushBackgroundFiles(this.teamId)
  272. if(uploadResult.failed > 0 || this.hasUnresolvedBackgroundFiles()){
  273. this.$showToast('仍有背景资料未上传成功,请重试后再保存')
  274. return
  275. }
  276. }
  277. this.$emit('handleConfirm',createTeamSubmitPayload(this.teamInfo))
  278. } catch(error) {
  279. this.$showToast(error && (error.message || error.msg) || '背景资料处理失败,请重试')
  280. } finally {
  281. this.confirming = false
  282. }
  283. },
  284. areaConfirm(e){
  285. const { provinceId, cityId,districtId,provinceName,cityName,districtName } = e
  286. this.teamInfo.provinceId = provinceId;
  287. this.teamInfo.cityId = cityId;
  288. this.teamInfo.districtId = districtId;
  289. this.areaText = provinceName+' '+cityName+' '+districtName;
  290. this.areaShow = false;
  291. }
  292. }
  293. }
  294. </script>
  295. <style scoped lang="scss">
  296. ::v-deep .u-textarea{
  297. padding: 36rpx 0 !important;
  298. }
  299. ::v-deep .u-textarea textarea{
  300. font-family: PingFangSC, PingFang SC;
  301. font-weight: 400;
  302. font-size: 30rpx;
  303. color: #667E90;
  304. line-height: 40rpx;
  305. }
  306. .ti_page{
  307. width: 100%;
  308. padding: 0 24rpx 162rpx;
  309. box-sizing: border-box;
  310. .form{
  311. background: #FFFFFF;
  312. border-radius: 24rpx;
  313. &-item{
  314. padding: 28rpx 24rpx;
  315. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #EFEFEF;
  316. &-title{
  317. width: 180rpx;
  318. font-family: PingFangSC, PingFang SC;
  319. font-weight: 400;
  320. font-size: 30rpx;
  321. color: #002846;
  322. line-height: 42rpx;
  323. position: relative;
  324. box-sizing: border-box;
  325. &.red{
  326. &::after{
  327. content: "*";
  328. font-family: PingFangSC, PingFang SC;
  329. font-weight: 400;
  330. font-size: 30rpx;
  331. color: #FD4F66;
  332. line-height: 42rpx;
  333. position: absolute;
  334. left: -16rpx;
  335. }
  336. }
  337. }
  338. &-inp{
  339. width: calc(100% - 180rpx);
  340. padding-left: 20rpx;
  341. box-sizing: border-box;
  342. display: flex;
  343. align-items: center;
  344. justify-content: flex-end;
  345. text{
  346. font-family: PingFangSC, PingFang SC;
  347. font-weight: 400;
  348. font-size: 30rpx;
  349. color: #B3BFC8;
  350. line-height: 40rpx;
  351. margin-right: 10rpx;
  352. &.active{
  353. color: #667E90;
  354. line-height: 30rpx;
  355. }
  356. }
  357. }
  358. }
  359. }
  360. .box{
  361. background: #FFFFFF;
  362. box-shadow: inset 0rpx -1rpx 0rpx 0rpx rgba(229,231,235,0.5);
  363. border-radius: 24rpx;
  364. margin-top: 20rpx;
  365. padding: 28rpx 24rpx;
  366. &-title{
  367. font-family: PingFangSC, PingFang SC;
  368. font-weight: 400;
  369. font-size: 30rpx;
  370. color: #002846;
  371. line-height: 42rpx;
  372. position: relative;
  373. &.red{
  374. &::after{
  375. content: "*";
  376. font-family: PingFangSC, PingFang SC;
  377. font-weight: 400;
  378. font-size: 30rpx;
  379. color: #FD4F66;
  380. line-height: 42rpx;
  381. position: absolute;
  382. left: -16rpx;
  383. }
  384. }
  385. }
  386. &-title-row{
  387. display: flex;
  388. align-items: center;
  389. }
  390. &-title-tip{
  391. margin-left: 12rpx;
  392. display: flex;
  393. align-items: center;
  394. }
  395. }
  396. .brief-tip-content{
  397. width: 600rpx;
  398. max-height: 70vh;
  399. padding: 40rpx 32rpx;
  400. box-sizing: border-box;
  401. overflow-y: auto;
  402. }
  403. .brief-tip-title{
  404. font-family: PingFangSC, PingFang SC;
  405. font-weight: 500;
  406. font-size: 32rpx;
  407. color: #002846;
  408. line-height: 44rpx;
  409. margin-bottom: 24rpx;
  410. text-align: center;
  411. }
  412. .brief-tip-text{
  413. font-family: PingFangSC, PingFang SC;
  414. font-weight: 400;
  415. font-size: 28rpx;
  416. color: #667E90;
  417. line-height: 44rpx;
  418. margin-bottom: 20rpx;
  419. text-indent: 2em;
  420. }
  421. .zt_btn{
  422. width: calc(100% - 100rpx);
  423. position: fixed;
  424. left: 50rpx;
  425. bottom: 54rpx;
  426. z-index: 1000;
  427. &.disabled{
  428. opacity: .55;
  429. }
  430. }
  431. }
  432. </style>