index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  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" :class="{'red':isqtype}">团队简介</view>
  67. <view class="box-textarea">
  68. <u-textarea border="none" height="320rpx" maxlength="-1" style="color: #667E90;padding: 0;" :placeholderStyle="{'color':'#B3BFC8','font-size':'30rpx','line-height':'40rpx'}"
  69. v-model="teamInfo.brief" placeholder="示例:这是一个为公司ERP系统升级而组建的36人团队,成员由公司副总经理、各部门总监以及各部门核心骨干组成。团队成员工作地点分布在香港、上海、苏州、深圳和东莞等地。团队成员年龄在35-50岁之间,男女比例比较均衡,大部份成员在该公司同事超过十年。"></u-textarea>
  70. </view>
  71. </view>
  72. <cus-team-background-files ref="backgroundRef" :teamId="teamId" :initialCount="teamInfo.backgroundFileCount || 0" @countChange="backgroundCountChange" />
  73. <view class="zt_btn" :class="{ disabled: confirming || submitting }" @click="handleConfirm">{{confirming || submitting ? '处理中...' : confirmText}}</view>
  74. <view class="dialog" v-if="areaShow">
  75. <view class="dialog-box">
  76. <cus-province-city-area @cancel="areaShow=false" @confirm="areaConfirm"></cus-province-city-area>
  77. </view>
  78. </view>
  79. <cus-select :show="teamScaleShow" title="选择团队规模" :list="teamScaleData" @close="teamScaleShow=false" @confirmTeam="e=>selectConfirm(e,'scale','teamScaleText','teamScaleShow')"></cus-select>
  80. <!-- <cus-select :show="teamLevelShow" title="选择团队层级" :list="teamLevelData" @close="teamLevelShow=false" @confirmTeam="e=>selectConfirm(e,'hierarchy','teamLevelText','teamLevelShow')"></cus-select> -->
  81. </view>
  82. </template>
  83. <script>
  84. import CusSelect from '@/components/CusSelect/index.vue'
  85. import CusProvinceCityArea from '@/components/CusProvinceCityArea/index.vue'
  86. import CusTeamBackgroundFiles from '@/components/CusTeamBackgroundFiles/index.vue'
  87. import teamBackgroundRules from '@/utils/teamBackgroundFile.js'
  88. const { createTeamSubmitPayload, validateEnterpriseWebsite } = teamBackgroundRules
  89. export default {
  90. components:{ CusSelect, CusProvinceCityArea, CusTeamBackgroundFiles },
  91. props:{
  92. confirmText:{
  93. typeof:String,
  94. default:'下一步'
  95. },
  96. qtype:{
  97. typeof:Boolean,
  98. default:false
  99. },
  100. teamId: { type: [String, Number], default: '' },
  101. submitting: { type: Boolean, default: false }
  102. },
  103. options: { styleIsolation: 'shared' },
  104. data(){
  105. return {
  106. teamInfo:{
  107. teamName:'',
  108. enterpriseName:'',
  109. enterpriseWebsite:'',
  110. provinceId:'',
  111. cityId:'',
  112. districtId:'',
  113. industryId:'',
  114. functionIds:[],
  115. orgIds:[],
  116. scale:'',
  117. hierarchy:'',
  118. brief:'',
  119. backgroundFileCount:0
  120. },
  121. areaShow:false,
  122. areaText:'请选择',
  123. industryText:'请选择',
  124. functionTypeText:'请选择',
  125. architectureTypeText:'请选择',
  126. teamScaleShow:false,
  127. teamScaleData:[],
  128. teamScaleText:'请选择',
  129. teamLevelShow:false,
  130. teamLevelData:[],
  131. teamLevelText:'请选择',
  132. isqtype:false,
  133. confirming:false
  134. }
  135. },
  136. mounted() {
  137. this.isqtype = this.$props.qtype||false;
  138. },
  139. methods:{
  140. backgroundCountChange(count){
  141. this.teamInfo.backgroundFileCount = count;
  142. },
  143. flushBackgroundFiles(teamId) {
  144. return this.$refs.backgroundRef.flushPendingFiles(teamId)
  145. },
  146. hasDeferredPcUpload() {
  147. return this.$refs.backgroundRef.hasDeferredPcUpload()
  148. },
  149. waitForDeferredPcUpload(teamId) {
  150. return this.$refs.backgroundRef.waitForDeferredPcUpload(teamId)
  151. },
  152. hasUnresolvedBackgroundFiles() {
  153. return this.$refs.backgroundRef.hasUnresolvedFiles()
  154. },
  155. isBackgroundUploadActive() {
  156. return this.$refs.backgroundRef.isUploadActive()
  157. },
  158. getTeamScaleData(){
  159. this.$api.get('/getListByType/team_scale').then(({data:res})=>{
  160. if(res.code!==0) return this.$showToast(res.msg)
  161. this.teamScaleData = res.data.map(d=>({name:d.dictLabel,id:d.dictValue}))
  162. })
  163. },
  164. getTeamHierarchyData(){
  165. this.$api.get('/getListByType/team_hierarchy').then(({data:res})=>{
  166. if(res.code!==0) return this.$showToast(res.msg)
  167. this.teamLevelData = res.data.map(d=>({name:d.dictLabel,id:d.dictValue}))
  168. })
  169. },
  170. setTeamInfo(info){
  171. this.teamInfo = Object.assign({
  172. teamName:'', enterpriseName:'', enterpriseWebsite:'', provinceId:'', cityId:'',
  173. districtId:'', industryId:'', functionIds:[], orgIds:[], scale:'',
  174. hierarchy:'', brief:'', backgroundFileCount:0
  175. }, info || {});
  176. },
  177. confirm(e) {
  178. const { value } = e;
  179. this.areaText = value.map(item => item.label).join('-');
  180. this.areaShow = false;
  181. },
  182. cancel() {
  183. this.areaShow = false;
  184. },
  185. close() {
  186. this.areaShow = false;
  187. },
  188. pickerShow(key){
  189. this[key] = true;
  190. },
  191. turnPage(type){
  192. if(type==='industry'){
  193. uni.navigateTo({
  194. url:'/pagesPublish/industry',
  195. events:{
  196. selectConfirm:data=>{
  197. this.teamInfo.industryId = data.industryId;
  198. this.industryText = data.industryName;
  199. }
  200. }
  201. })
  202. }else{
  203. uni.navigateTo({
  204. url:'/pagesPublish/teamTypeMultiple?type='+type,
  205. events:{
  206. selectConfirm:data=>{
  207. if(data.type==='function'){
  208. this.teamInfo.functionIds = data.ids;
  209. this.functionTypeText = data.names.join(',');
  210. }else if(data.type==='architecture'){
  211. this.teamInfo.orgIds = data.ids;
  212. this.architectureTypeText = data.names.join(',');
  213. }
  214. }
  215. }
  216. })
  217. }
  218. },
  219. selectShow(key){
  220. this[key] = true;
  221. this.$nextTick(()=>{
  222. if(key==='teamScaleShow') this.getTeamScaleData();
  223. if(key==='teamLevelShow') this.getTeamHierarchyData();
  224. })
  225. },
  226. pickerConfirm(e,key1,key2,key3){
  227. this.teamInfo[key1] = e.value[0].id;
  228. this[key2] = e.value[0].name;
  229. this[key3] = false;
  230. },
  231. selectConfirm(e,key1,key2,key3){
  232. this.teamInfo[key1] = e.id;
  233. this[key2] = e.name;
  234. this[key3] = false;
  235. },
  236. async handleConfirm(){
  237. if(this.confirming || this.submitting) return
  238. if(!this.teamInfo.teamName) return this.$showToast('请输入团队名称')
  239. if(!this.teamInfo.enterpriseName) return this.$showToast('请输入公司名称')
  240. const enterpriseWebsite = String(this.teamInfo.enterpriseWebsite || '').trim()
  241. const websiteError = validateEnterpriseWebsite(enterpriseWebsite)
  242. if(websiteError) return this.$showToast(websiteError)
  243. this.teamInfo.enterpriseWebsite = enterpriseWebsite
  244. if(!this.teamInfo.districtId) return this.$showToast('请选择所属地区')
  245. if(!this.teamInfo.industryId) return this.$showToast('请选择所属行业')
  246. if(this.isqtype){
  247. if(this.teamInfo.functionIds.length===0) return this.$showToast('请选择团队职能类型')
  248. if(this.teamInfo.orgIds.length===0) return this.$showToast('请选择团队模式类型')
  249. if(!this.teamInfo.scale) return this.$showToast('请选择团队规模')
  250. // if(!this.teamInfo.hierarchy) return this.$showToast('请选择团队层级')
  251. if(!this.teamInfo.brief) return this.$showToast('请输入团队简介')
  252. }
  253. this.confirming = true
  254. try {
  255. if(this.teamId){
  256. const uploadResult = await this.flushBackgroundFiles(this.teamId)
  257. if(uploadResult.failed > 0 || this.hasUnresolvedBackgroundFiles()){
  258. this.$showToast('仍有背景资料未上传成功,请重试后再保存')
  259. return
  260. }
  261. }
  262. this.$emit('handleConfirm',createTeamSubmitPayload(this.teamInfo))
  263. } catch(error) {
  264. this.$showToast(error && (error.message || error.msg) || '背景资料处理失败,请重试')
  265. } finally {
  266. this.confirming = false
  267. }
  268. },
  269. areaConfirm(e){
  270. const { provinceId, cityId,districtId,provinceName,cityName,districtName } = e
  271. this.teamInfo.provinceId = provinceId;
  272. this.teamInfo.cityId = cityId;
  273. this.teamInfo.districtId = districtId;
  274. this.areaText = provinceName+' '+cityName+' '+districtName;
  275. this.areaShow = false;
  276. }
  277. }
  278. }
  279. </script>
  280. <style scoped lang="scss">
  281. ::v-deep .u-textarea{
  282. padding: 36rpx 0 !important;
  283. }
  284. ::v-deep .u-textarea textarea{
  285. font-family: PingFangSC, PingFang SC;
  286. font-weight: 400;
  287. font-size: 30rpx;
  288. color: #667E90;
  289. line-height: 40rpx;
  290. }
  291. .ti_page{
  292. width: 100%;
  293. padding: 0 24rpx 162rpx;
  294. box-sizing: border-box;
  295. .form{
  296. background: #FFFFFF;
  297. border-radius: 24rpx;
  298. &-item{
  299. padding: 28rpx 24rpx;
  300. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #EFEFEF;
  301. &-title{
  302. width: 180rpx;
  303. font-family: PingFangSC, PingFang SC;
  304. font-weight: 400;
  305. font-size: 30rpx;
  306. color: #002846;
  307. line-height: 42rpx;
  308. position: relative;
  309. box-sizing: border-box;
  310. &.red{
  311. &::after{
  312. content: "*";
  313. font-family: PingFangSC, PingFang SC;
  314. font-weight: 400;
  315. font-size: 30rpx;
  316. color: #FD4F66;
  317. line-height: 42rpx;
  318. position: absolute;
  319. left: -16rpx;
  320. }
  321. }
  322. }
  323. &-inp{
  324. width: calc(100% - 180rpx);
  325. padding-left: 20rpx;
  326. box-sizing: border-box;
  327. display: flex;
  328. align-items: center;
  329. justify-content: flex-end;
  330. text{
  331. font-family: PingFangSC, PingFang SC;
  332. font-weight: 400;
  333. font-size: 30rpx;
  334. color: #B3BFC8;
  335. line-height: 40rpx;
  336. margin-right: 10rpx;
  337. &.active{
  338. color: #667E90;
  339. line-height: 30rpx;
  340. }
  341. }
  342. }
  343. }
  344. }
  345. .box{
  346. background: #FFFFFF;
  347. box-shadow: inset 0rpx -1rpx 0rpx 0rpx rgba(229,231,235,0.5);
  348. border-radius: 24rpx;
  349. margin-top: 20rpx;
  350. padding: 28rpx 24rpx;
  351. &-title{
  352. font-family: PingFangSC, PingFang SC;
  353. font-weight: 400;
  354. font-size: 30rpx;
  355. color: #002846;
  356. line-height: 42rpx;
  357. position: relative;
  358. &.red{
  359. &::after{
  360. content: "*";
  361. font-family: PingFangSC, PingFang SC;
  362. font-weight: 400;
  363. font-size: 30rpx;
  364. color: #FD4F66;
  365. line-height: 42rpx;
  366. position: absolute;
  367. left: -16rpx;
  368. }
  369. }
  370. }
  371. }
  372. .zt_btn{
  373. width: calc(100% - 100rpx);
  374. position: fixed;
  375. left: 50rpx;
  376. bottom: 54rpx;
  377. z-index: 1000;
  378. &.disabled{
  379. opacity: .55;
  380. }
  381. }
  382. }
  383. </style>