personalInformation.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. <!-- 个人信息 -->
  2. <template>
  3. <div>
  4. <div class="block">
  5. <div class="titlePanel">
  6. <div class="titlePanelBor">个人信息</div>
  7. </div>
  8. <div class="flexBox">
  9. <div class="flexItem"><span class="label">用户名:</span>{{userInfo.username}}</div>
  10. <div class="flexItem"><span class="label">账户类型:</span>{{roleType}}</div>
  11. <div class="flexItem"><span class="label">独占类型:</span>{{userInfo.useTypeName}}</div>
  12. <div class="flexItem"><span class="label">所属公司:</span>{{userInfo.company}}</div>
  13. <div class="flexItem"><span class="label">联系人:</span>{{userInfo.nickname}}</div>
  14. <div class="flexItem"><span class="label">联系方式:</span>{{userInfo.phone}}<span class="textButton" @click="changePhone">修改联系方式</span></div>
  15. <div class="flexItem"><span class="label">密码:</span>{{"***********"}}<span class="textButton" @click="changePassword">修改密码</span></div>
  16. </div>
  17. </div>
  18. <div class="block">
  19. <div class="titlePanel">
  20. <div class="titlePanelBor">配置信息</div>
  21. </div>
  22. <div class="flexBox">
  23. <div class="flexItem"><span class="label2">可创建子账户数量:</span>{{configInfo.numCreateUser}}</div>
  24. <div class="flexItem"><span class="label2">可创建测试包数量:</span>{{configInfo.numCreateScenePackage}}</div>
  25. <div class="flexItem"><span class="label2">测试包最大场景数量:</span>{{configInfo.numScenePerPackage}}</div>
  26. <div class="flexItem"></div>
  27. <div class="flexItem"><span class="label2">仿真软件license:</span>{{clusterInfo.numSimulationLicense}}</div>
  28. <div class="flexItem"><span class="label2">到期时间:</span>{{clusterInfo.dateSimulationLicense}}</div>
  29. <div class="flexItem"><span class="label2">动力学软件license:</span>{{clusterInfo.numDynamicLicense}}</div>
  30. <div class="flexItem"><span class="label2">到期时间:</span>{{clusterInfo.dateDynamicLicense}}</div>
  31. </div>
  32. </div>
  33. <div class="block">
  34. <div class="titlePanel">
  35. <div class="titlePanelBor">场景资源</div>
  36. <tableList
  37. ref="table"
  38. style="min-width: 900px;margin: auto;"
  39. :columns="columns"
  40. :getDataWay="getDataWay"
  41. index
  42. >
  43. </tableList>
  44. </div>
  45. </div>
  46. <el-dialog
  47. title="修改联系方式"
  48. :visible.sync="phoneDialogVisible"
  49. width="690px"
  50. :close-on-click-modal="false"
  51. :close-on-press-escape="false"
  52. >
  53. <el-form
  54. ref="phoneForm"
  55. :model="phoneForm"
  56. :rules="phoneRules"
  57. label-width="108px"
  58. >
  59. <el-form-item label="联系人:" prop="nickname">
  60. <el-input
  61. v-autoTrim="{
  62. obj: phoneForm,
  63. key: 'nickname',
  64. }"
  65. v-model="phoneForm.nickname"
  66. placeholder="请输入"
  67. maxlength="20"
  68. ></el-input>
  69. </el-form-item>
  70. <el-form-item label="联系方式:" prop="phone">
  71. <el-input
  72. v-autoTrim="{
  73. obj: phoneForm,
  74. key: 'phone',
  75. }"
  76. v-model="phoneForm.phone"
  77. placeholder="请输入"
  78. maxlength="20"
  79. ></el-input>
  80. </el-form-item>
  81. </el-form>
  82. <span slot="footer">
  83. <el-button type="primary" @click="confirmChangePhone">确 定</el-button>
  84. <el-button @click="phoneDialogVisible = false">取 消</el-button>
  85. </span>
  86. </el-dialog>
  87. <el-dialog
  88. title="修改密码"
  89. :visible.sync="passwordDialogVisible"
  90. width="690px"
  91. :close-on-click-modal="false"
  92. :close-on-press-escape="false"
  93. >
  94. <el-form
  95. ref="passwordForm"
  96. :model="passwordForm"
  97. :rules="passwordRules"
  98. label-width="108px"
  99. >
  100. <el-form-item label="原密码:" prop="oldPassword">
  101. <el-input
  102. type="password"
  103. v-model="passwordForm.oldPassword"
  104. placeholder="请输入"
  105. maxlength="20"
  106. ></el-input>
  107. </el-form-item>
  108. <el-form-item label="新密码:" prop="newPassword">
  109. <el-input
  110. type="password"
  111. v-model="passwordForm.newPassword"
  112. placeholder="请输入"
  113. maxlength="20"
  114. ></el-input>
  115. </el-form-item>
  116. <el-form-item label="确认密码:" prop="confirmPassword">
  117. <el-input
  118. type="password"
  119. v-model="passwordForm.confirmPassword"
  120. placeholder="请输入"
  121. maxlength="20"
  122. ></el-input>
  123. </el-form-item>
  124. </el-form>
  125. <span slot="footer">
  126. <el-button type="primary" @click="confirmChangePassword">确 定</el-button>
  127. <el-button @click="passwordDialogVisible = false ">取 消</el-button>
  128. </span>
  129. </el-dialog>
  130. </div>
  131. </template>
  132. <script>
  133. import tableList from "@/components/grid/TableList";
  134. export default {
  135. components: {tableList},
  136. data(){
  137. return {
  138. userInfo: {
  139. id: "",
  140. username: "",
  141. nickname: "",
  142. password: "",
  143. phone: "",
  144. photo: "",
  145. company: "",
  146. roleCode: "",
  147. useType: "",
  148. visible: "",
  149. createTime: "",
  150. createUserName: "",
  151. },
  152. configInfo: {
  153. numCreateScenePackage: "",
  154. numCreateUser: "",
  155. numScenePerPackage: "",
  156. },
  157. clusterInfo: {
  158. numSimulationLicense: '',
  159. dateSimulationLicense: '',
  160. numDynamicLicense: '',
  161. dateDynamicLicense: ''
  162. },
  163. roleCodeList:[],
  164. getDataWay: {
  165. dataType: "url",
  166. type: "post",
  167. data: this.$api.userInfo.getSceneResource,
  168. param: {
  169. //userId: this.$route.query.userId
  170. },
  171. },
  172. columns: [
  173. {
  174. label: "场景包名称",
  175. prop: "packageName",
  176. },
  177. {
  178. label: "自然驾驶仿真场景",
  179. prop: "zrCount",
  180. },
  181. {
  182. label: "交通事故仿真场景",
  183. prop: "jtCount",
  184. },
  185. {
  186. label: "标准法规仿真场景",
  187. prop: "bzCount",
  188. },
  189. {
  190. label: "泛化场景",
  191. prop: "fhCount"
  192. },
  193. {
  194. label: "合计",
  195. prop: "totalCount"
  196. }
  197. ],
  198. phoneDialogVisible: false,
  199. passwordDialogVisible: false,
  200. phoneForm: {
  201. nickname: '',
  202. phone: ''
  203. },
  204. phoneRules: {
  205. nickname: [
  206. { required: true, message: "请输入", trigger: "blur" },
  207. ],
  208. phone: [
  209. { required: true, message: "请输入", trigger: "blur" },
  210. {
  211. validator: (rule, value, callback) => {
  212. if(this.$validatePhone(value)){
  213. callback()
  214. }else{
  215. callback(new Error('格式错误'))
  216. }
  217. },
  218. trigger: "blur"
  219. }
  220. ]
  221. },
  222. passwordForm: {
  223. oldPassword: '',
  224. newPassword: '',
  225. confirmPassword: '',
  226. },
  227. passwordRules: {
  228. oldPassword: [{ required: true, message: "请输入", trigger: "blur" },],
  229. newPassword: [{ required: true, message: "请输入", trigger: "blur" },],
  230. confirmPassword: [{ required: true, message: "请输入", trigger: "blur" },]
  231. }
  232. }
  233. },
  234. async mounted(){
  235. await this.$dicsListsInit({
  236. roleCodeList: "roleCode"
  237. });
  238. this.getUserInfo()
  239. this.getParameter()
  240. this.getCluster()
  241. },
  242. computed: {
  243. roleType(){
  244. let label = ''
  245. this.roleCodeList.map(item => {
  246. if(item.code == this.userInfo.roleCode){
  247. label = item.caption
  248. }
  249. })
  250. return label
  251. }
  252. },
  253. methods: {
  254. getUserInfo(){
  255. this.$axios({
  256. method: "POST",
  257. url: this.$api.userInfo.getCurrentUserInfo,
  258. data: {}
  259. }).then(res => {
  260. if (res.code == 200 && res.info) {
  261. this.userInfo = res.info
  262. }else{
  263. this.$message.error(res.message || '获取用户信息失败')
  264. }
  265. })
  266. },
  267. getParameter(){
  268. this.$axios({
  269. method: "POST",
  270. url: this.$api.userInfo.getParameterByUserId,
  271. data: {}
  272. }).then(res => {
  273. if (res.code == 200) {
  274. if(res.info){
  275. this.configInfo = res.info
  276. }
  277. }else{
  278. this.$message.error(res.message || '获取配置信息失败')
  279. }
  280. })
  281. },
  282. getCluster(){
  283. this.$axios({
  284. method: "POST",
  285. url: this.$api.userInfo.getClusterByUserId,
  286. data: {}
  287. }).then(res => {
  288. if (res.code == 200) {
  289. if(res.info){
  290. this.clusterInfo = res.info
  291. }
  292. }else{
  293. this.$message.error(res.message || '获取配置信息失败')
  294. }
  295. })
  296. },
  297. changePhone(){
  298. this.phoneForm = {
  299. nickname: this.userInfo.nickname,
  300. phone: this.userInfo.phone
  301. }
  302. this.phoneDialogVisible = true
  303. },
  304. changePassword(){
  305. this.passwordForm = {
  306. oldPassword: '',
  307. newPassword: '',
  308. confirmPassword: ''
  309. }
  310. this.passwordDialogVisible = true
  311. },
  312. confirmChangePhone(){
  313. this.$refs.phoneForm.validate(valid => {
  314. if(valid){
  315. this.$axios({
  316. method: 'POST',
  317. url: this.$api.userInfo.savePhone,
  318. data: {
  319. id: this.userInfo.id,
  320. nickname: this.phoneForm.nickname,
  321. phone: this.phoneForm.phone
  322. }
  323. }).then(res => {
  324. if (res.code == 200) {
  325. this.$message.success('修改联系方式成功')
  326. this.getUserInfo()
  327. this.phoneDialogVisible = false
  328. }else{
  329. this.$message.error(res.message || '修改联系方式失败')
  330. }
  331. })
  332. }
  333. })
  334. },
  335. confirmChangePassword(){
  336. if(this.passwordForm.newPassword !== this.passwordForm.confirmPassword){
  337. this.$message.warning('新密码与确认密码必须保持一致')
  338. return
  339. }
  340. if(this.passwordForm.newPassword == this.passwordForm.oldPassword){
  341. this.$message.warning('新密码不能与旧密码相同')
  342. return
  343. }
  344. this.$refs.passwordForm.validate(valid => {
  345. if(valid){
  346. this.$axios({
  347. method: 'POST',
  348. url: this.$api.userInfo.savePassword,
  349. data: {
  350. id: this.userInfo.id,
  351. password: this.passwordForm.oldPassword,
  352. newPassword: this.passwordForm.newPassword
  353. }
  354. }).then(res => {
  355. if (res.code == 200) {
  356. this.$message.success('修改密码成功')
  357. this.getUserInfo()
  358. this.passwordDialogVisible = false
  359. }else{
  360. this.$message.error(res.message || '修改密码失败')
  361. }
  362. })
  363. }
  364. })
  365. }
  366. }
  367. }
  368. </script>
  369. <style scoped lang="less">
  370. .block{
  371. width: 88%;
  372. margin: 24px auto 0;
  373. }
  374. .titlePanel {
  375. padding: 22px 0;
  376. }
  377. .flexItem{
  378. width: 40%;
  379. margin-bottom: 10px;
  380. .label{
  381. display: inline-block;
  382. width: 140px;
  383. text-align: right;
  384. }
  385. .label2{
  386. display: inline-block;
  387. width: 140px;
  388. text-align: right;
  389. }
  390. }
  391. .textButton{
  392. padding-left: 5px;
  393. color: @themeColor;
  394. cursor: pointer;
  395. }
  396. </style>