userCenterUnitInformation.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <div>
  3. <div style="width:500px;margin: auto;margin-top: 30px;">
  4. <div style="margin-left: -50px; font-size: 14px;font-weight: 700;color: #666;padding: 4px 10px;border-left: 2px solid #666;">{{$t('common.UnitInformation')}}</div>
  5. <div style="height: 100px;position: relative;">
  6. <span style="position: absolute;left: 23%;top: 50%;transform: translate(-50%,-50%);font-size: 14px;color: #606266;">{{$t('common.Logo')}}</span>
  7. <img :src="'api/file/pub/'+ form.photo" alt="" style="width: 100px;position: absolute;left: 50%;top: 50%;transform: translate(-50%,-50%);"/>
  8. </div>
  9. </div>
  10. <div style="width: 100%;">
  11. <el-form ref="form" :model="form" label-width="140px" class="demo-ruleForm" :rules="rules" style="margin-left: 250px;margin-top: 20px;">
  12. <el-form-item :label="$t('common.NameOfEnterprise')" prop='name'>
  13. <el-input v-model="form.unitName" disabled></el-input>
  14. </el-form-item>
  15. <el-form-item :label="$t('common.Continent')">
  16. <el-input v-model="form.are" disabled></el-input>
  17. </el-form-item>
  18. <el-form-item :label="$t('common.UCountry')">
  19. <el-input v-model="form.unitCountry" disabled></el-input>
  20. </el-form-item>
  21. <el-form-item :label="$t('common.Nature')">
  22. <el-input v-model="form.enterpriseProperty" disabled></el-input>
  23. </el-form-item>
  24. <el-form-item :label="$t('common.UIndustry')">
  25. <el-input v-model="form.industry" disabled></el-input>
  26. </el-form-item>
  27. <el-form-item :label="$t('common.UScope')">
  28. <el-input v-model="form.unitScope" disabled></el-input>
  29. </el-form-item>
  30. <el-form-item :label="$t('common.RegisteredCapital')">
  31. <el-input v-model="form.registerMoney" disabled></el-input>
  32. </el-form-item>
  33. <el-form-item :label="$t('common.EstablishmentTime')">
  34. <el-input v-model="form.setUpDate" disabled></el-input>
  35. </el-form-item>
  36. <el-form-item :label="$t('common.Website')">
  37. <el-input v-model="form.officialWebsitePath" disabled></el-input>
  38. </el-form-item>
  39. <el-form-item :label="$t('common.UIntroduction')">
  40. <el-input type="textarea" :rows="2" v-html="form.unitIntrodution" disabled></el-input>
  41. </el-form-item>
  42. </el-form>
  43. </div>
  44. <div style="clear: both;"></div>
  45. <div v-if="this.isUnitPersonnel== true" style="height: 200px;">
  46. <div style="margin-top: 100px;">
  47. <el-button type="primary" @click="confirm" style="margin-left: 300px;">{{$t('common.Confirm')}}</el-button>
  48. <el-button style="margin-left: 30px;">{{$t('common.Reset')}}</el-button>
  49. </div>
  50. </div>
  51. </div>
  52. </template>
  53. <script>
  54. import {getUnitInfo,addUnit} from "@/api/userCenter/unitPersonnel";
  55. import { formatDate } from "@/utils/formatUtils";
  56. export default {
  57. name: 'userCenterUnitInformation',
  58. data () {
  59. return {
  60. informationsClass:'1',
  61. dialogVisible: false,
  62. ifDiaslog:'',
  63. title:'',
  64. isUnitPersonnel:false,
  65. preferredMobile:'',
  66. email:'',
  67. form: {
  68. unitName: '',
  69. unitCode: '',
  70. registerMoney: '',
  71. unitCountry: '',
  72. unitCountryDict: '',
  73. unitProvince: '',
  74. unitProvinceDict: '',
  75. unitCity: '',
  76. unitCityDict: '',
  77. unitRegion: '',
  78. setUpDate: '',
  79. corporateName: '',
  80. corporateIdCard: '',
  81. corporateDuty: '',
  82. officialWebsitePath: '',
  83. unitAddress: '',
  84. dynamic: '',
  85. dynamicDict: '',
  86. unitsSystem: '',
  87. unitsSystemDict: '',
  88. councilMembers: '',
  89. councilMembersDict: '',
  90. are: '',
  91. industry: '',
  92. industryDict: '',
  93. areDict: '',
  94. unitLabel: '',
  95. unitIntrodution: '',
  96. status: '',
  97. statusDict: '',
  98. language: '',
  99. enterpriseProperty: '',
  100. photo: '/def/enterpriseDefault.png',
  101. enterprisePropertyDict: '',
  102. baseEntityId:'',
  103. },
  104. show: true,
  105. count: '',
  106. timer: null,
  107. rules: {
  108. name: [
  109. { required: true, message: '请输入昵称', trigger: 'blur' },
  110. { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
  111. ],
  112. },
  113. rulesEn: {
  114. name: [
  115. { required: true, message: 'Please enter your nickname', trigger: 'blur' },
  116. { min: 3, max: 5, message: 'The length is between 3 and 5 characters', trigger: 'blur' }
  117. ],
  118. }
  119. }
  120. },
  121. watch: {
  122. "$i18n.locale"() {
  123. this.getInformation();
  124. },
  125. },
  126. mounted () {
  127. this.getInformation();
  128. },
  129. methods:{
  130. getInformation(){
  131. //根据用户的手机或者邮箱查询
  132. if(this.$i18n.locale.toUpperCase()=="EN"){
  133. this.rules = this.rulesEn
  134. }
  135. var users=localStorage.getItem('user');
  136. var user = JSON.parse(users);
  137. var baseEntityId = user.umsUser.unitEntityId;
  138. this.preferredMobile = user.umsUser.userPreferredMobile;
  139. this.email = user.umsUser.userEmail;
  140. var params ={};
  141. params.baseEntityId = baseEntityId;
  142. params.language = this.$i18n.locale;
  143. if(!baseEntityId){
  144. this.isUnitPersonnel = true;
  145. params.preferredMobile=this.preferredMobile;
  146. params.email=this.email;
  147. }
  148. getUnitInfo(params).then(result => {
  149. if(result.data){
  150. this.form = result.data;
  151. this.form.setUpDate = this.form.setUpDate
  152. ? formatDate(this.form.setUpDate, "YYYY-MM-DD HH:mm:ss")
  153. : "";
  154. if(!this.form.photo){
  155. this.form.photo = "/def/enterpriseDefault.png";
  156. }
  157. }
  158. }).catch((error) => {
  159. this.$message({
  160. message: error.msg,
  161. type: 'error'
  162. });
  163. })
  164. },
  165. confirm() {
  166. if(this.form.baseEntityId == "" || this.form.baseEntityId == null){
  167. this.$message({
  168. message: "您未被邀请加入单位!",
  169. type: 'success'
  170. });
  171. return ;
  172. }
  173. var status = "已确认";
  174. var statusDict="1";
  175. var unitPersonnelInformation ={};
  176. unitPersonnelInformation.statusDict = statusDict;
  177. unitPersonnelInformation.status =status;
  178. unitPersonnelInformation.preferredMobile = this.preferredMobile;
  179. unitPersonnelInformation.email=this.email;
  180. unitPersonnelInformation.baseEntityId=this.form.baseEntityId;
  181. this.$confirm('确认加入该单位, 是否继续?', '提示', {
  182. confirmButtonText: '确定',
  183. cancelButtonText: '取消',
  184. type: 'warning'
  185. }).then(() => {
  186. addUnit(unitPersonnelInformation).then(res=>{
  187. this.isUnitPersonnel=false;
  188. var umsUser = this.$store.state.user.user.umsUser;
  189. umsUser.unitEntityId = unitPersonnelInformation.baseEntityId;
  190. this.$store.state.user.user.umsUser = umsUser;
  191. localStorage.setItem('user', JSON.stringify(this.$store.state.user.user));
  192. this.$message({
  193. message: "加入成功!",
  194. type: 'success'
  195. });
  196. }).catch((error) => {
  197. this.$message.error(error.msg);
  198. })
  199. }).catch(() => {
  200. this.$message({
  201. type: 'info',
  202. message: '已取消加入'
  203. });
  204. });
  205. },
  206. }
  207. }
  208. </script>
  209. <style scoped>
  210. .box1:after{
  211. display:block;
  212. clear:both;
  213. content:"";
  214. visibility:hidden;
  215. height:0
  216. }
  217. .el-input {
  218. width: 75%;
  219. }
  220. .el-form {
  221. width: 500px !important;
  222. }
  223. .el-button {
  224. width: 200px;
  225. height: 45px;
  226. }
  227. </style>