index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <div class="app-container home">
  3. <!-- <el-row :gutter="20"></el-row>
  4. <el-row :gutter="20"></el-row>
  5. <el-divider/>
  6. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  7. <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
  8. :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
  9. :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
  10. <i class="el-icon-upload"></i>
  11. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  12. <div class="el-upload__tip text-center" slot="tip">
  13. <div class="el-upload__tip" slot="tip">
  14. <el-checkbox v-model="upload.updateSupport"/>
  15. 是否更新已经存在的用户数据
  16. </div>
  17. <span>仅允许导入xls、xlsx格式文件。</span>
  18. <el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
  19. @click="importTemplate">下载模板
  20. </el-link>
  21. </div>
  22. </el-upload>
  23. <div slot="footer" class="dialog-footer">
  24. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  25. <el-button @click="upload.open = false">取 消</el-button>
  26. </div>
  27. </el-dialog>
  28. <button @click="upload.open = true">上传文件</button>
  29. <el-row :gutter="20">
  30. <el-col :xs="24" :sm="24" :md="12" :lg="8"></el-col>
  31. <el-col :xs="24" :sm="24" :md="12" :lg="8">
  32. <el-card class="update-log">
  33. <div slot="header" class="clearfix">
  34. <span>更新日志</span>
  35. </div>
  36. <el-collapse accordion> 123123</el-collapse>
  37. </el-card>
  38. </el-col>
  39. <el-col :xs="24" :sm="24" :md="12" :lg="8">
  40. <el-card class="update-log">
  41. <div slot="header" class="clearfix">
  42. <span>捐赠支持</span>
  43. </div>
  44. <div class="body"></div>
  45. </el-card>
  46. </el-col>
  47. </el-row> -->
  48. <div class="info-content">
  49. <div class="header" @click="toPersonalCenter">
  50. <img :src="avatar" class="user-avatar" />
  51. </div>
  52. <div class="name">{{ nickName }}</div>
  53. <div class="tenant-name">{{ tenantName }}</div>
  54. <div class="date">{{ date }}</div>
  55. <!-- <div class="title">欢迎登录Mec OS 工业应用操作系统</div> -->
  56. <div class="title mt20">欢迎登录{{ title }}</div>
  57. </div>
  58. </div>
  59. </template>
  60. <script>
  61. import { formatDate } from "@/utils";
  62. import { getToken } from "@/utils/auth";
  63. import { mapGetters, mapState } from "vuex";
  64. export default {
  65. name: "Index",
  66. data() {
  67. return {
  68. title: "",
  69. // 用户导入参数
  70. upload: {
  71. // 是否显示弹出层(用户导入)
  72. open: false,
  73. // 弹出层标题(用户导入)
  74. title: "",
  75. // 是否禁用上传
  76. isUploading: false,
  77. // 是否更新已经存在的用户数据
  78. updateSupport: 0,
  79. // 设置上传的请求头部
  80. headers: { Authorization: "Bearer " + getToken() },
  81. // 上传的地址
  82. url: process.env.VUE_APP_BASE_API3 + "common/importDataInfo",
  83. },
  84. // 版本号
  85. version: "3.8.5",
  86. };
  87. },
  88. methods: {
  89. /** 导入按钮操作 */
  90. handleImport() {
  91. this.upload.title = "用户导入";
  92. this.upload.open = true;
  93. },
  94. /** 下载模板操作 */
  95. importTemplate() {
  96. this.download(
  97. "system/user/importTemplate",
  98. {},
  99. `user_template_${new Date().getTime()}.xlsx`
  100. );
  101. },
  102. // 文件上传中处理
  103. handleFileUploadProgress(event, file, fileList) {
  104. this.upload.isUploading = true;
  105. },
  106. // 文件上传成功处理
  107. handleFileSuccess(response, file, fileList) {
  108. this.upload.open = false;
  109. this.upload.isUploading = false;
  110. this.$refs.upload.clearFiles();
  111. this.$alert(
  112. "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
  113. response.msg +
  114. "</div>",
  115. "导入结果",
  116. { dangerouslyUseHTMLString: true }
  117. );
  118. this.getList();
  119. },
  120. // 提交上传文件
  121. submitFileForm() {
  122. this.$refs.upload.submit();
  123. },
  124. goTarget(href) {
  125. window.open(href, "_blank");
  126. },
  127. toPersonalCenter() {
  128. this.$router.push("/user/profile");
  129. },
  130. },
  131. computed: {
  132. ...mapState({
  133. username: (state) => state.user.name,
  134. owner: (state) => state.user?.tenant.owner,
  135. tenantName: (state) => state.user?.tenant.tenantName,
  136. nickName: (state) => state.user?.nickName,
  137. }),
  138. ...mapGetters(["avatar"]),
  139. date: () => {
  140. return formatDate(new Date());
  141. },
  142. },
  143. mounted() {
  144. // this.title = window.sessionStorage.getItem("title") || "智能制造平台";
  145. this.title = window.sessionStorage.getItem("title") || "生产协同管理系统";
  146. },
  147. };
  148. </script>
  149. <style lang="scss" scoped>
  150. .home {
  151. position: relative;
  152. width: 100%;
  153. // height: 500px;
  154. min-height: calc(100vh - 140px);
  155. .info-content {
  156. position: absolute;
  157. left: 50%;
  158. top: 30%;
  159. transform: translateX(-50%);
  160. display: flex;
  161. flex-direction: column;
  162. align-items: center;
  163. .header {
  164. white-space: nowrap;
  165. margin-bottom: 5px;
  166. cursor: pointer;
  167. .user-avatar {
  168. width: 160px;
  169. border-radius: 50%;
  170. }
  171. }
  172. .name {
  173. font-size: 30px;
  174. margin-bottom: 5px;
  175. }
  176. .tenant-name {
  177. font-size: 20px;
  178. }
  179. .date {
  180. margin-bottom: 10px;
  181. }
  182. .title {
  183. // font-size: 16px;
  184. font-size: 20px;
  185. }
  186. }
  187. }
  188. .home {
  189. blockquote {
  190. padding: 10px 20px;
  191. margin: 0 0 20px;
  192. font-size: 17.5px;
  193. /* border-left: 5px solid #eee; */
  194. }
  195. hr {
  196. margin-top: 20px;
  197. margin-bottom: 20px;
  198. border: 0;
  199. border-top: 1px solid #eee;
  200. }
  201. .col-item {
  202. margin-bottom: 20px;
  203. }
  204. ul {
  205. padding: 0;
  206. margin: 0;
  207. }
  208. font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  209. font-size: 13px;
  210. color: #676a6c;
  211. overflow-x: hidden;
  212. ul {
  213. list-style-type: none;
  214. }
  215. h4 {
  216. margin-top: 0px;
  217. }
  218. h2 {
  219. margin-top: 10px;
  220. font-size: 26px;
  221. font-weight: 100;
  222. }
  223. p {
  224. margin-top: 10px;
  225. b {
  226. font-weight: 700;
  227. }
  228. }
  229. .update-log {
  230. ol {
  231. display: block;
  232. list-style-type: decimal;
  233. margin-block-start: 1em;
  234. margin-block-end: 1em;
  235. margin-inline-start: 0;
  236. margin-inline-end: 0;
  237. padding-inline-start: 40px;
  238. }
  239. }
  240. }
  241. </style>