• 实习项目总结-Pandroid仿真数据管理平台


    目录

    一. 主页

    (一). 实现功能

    主页配置:

    我的数据:

    (二). 实现效果

    1.主页配置

    1.1主页配置弹窗

    1.2拖拽排序

    1.3模块订阅

    1.4列数更改

    1.5重置订阅

    2.我的数据

    2.1主页数据展示

    2.2查看全部跳转

    2.3主页链接跳转

    2.4查看全部链接跳转

    2.5echarts展示数据

    (二). 实现代码

    1.主页+订阅弹窗页面

    2.订阅模块

    点击查看订阅模块实现代码

    3.订阅模块配置文件

    4.查看全部(组件复用)

    二. 更改所有者

    (一)实现功能

    (二)实现效果

     (三)实现代码

    1.dialog

    2.code值

    3.按钮


    一. 主页

    (一). 实现功能

    主页配置:

    动态更改订阅模块的顺序、显示。

    数据库添加字段,设置部分模块重置效果。

    我的数据:

    根据用户需求选择各个模块配置。存在配置文件。根据用户需求动态化设计。

    模块数据部分展示,展示前十条。

    模块位置动态展示。

    模块内容关键字跳转。

    查看全部按钮,展示全部数据。

    (二). 实现效果

    1.主页配置

    1.1主页配置弹窗

    1.2拖拽排序

    1.3模块订阅

    1.4列数更改

    1.5重置订阅

    2.我的数据

    2.1主页数据展示

    2.2查看全部跳转

    2.3主页链接跳转

    2.4查看全部链接跳转

    2.5echarts展示数据

    (二). 实现代码

    1.主页+订阅弹窗页面

    dashboard文件夹=>index.vue

    1. <template>
    2. <div class="dashboard-container firstPage">
    3. <div class="dashboard-text">
    4. <el-card style="min-height: calc(100vh - 120px)">
    5. <div slot="header" class="card-title">
    6. <span>我的数据span>
    7. <el-button type="primary" @click="showSubscribe" style="float: right"
    8. >主页配置
    9. >
    10. div>
    11. <el-row :gutter="15" v-loading="pageLoading">
    12. <el-col
    13. :span="24 / subscribe.layoutCols"
    14. class="dataBox align-center"
    15. v-for="item in subscribe.sortedItems"
    16. :key="item.name"
    17. >
    18. <component
    19. :is="item.name"
    20. :user="user"
    21. :colNum="subscribe.layoutCols"
    22. >
    23. component>
    24. el-col>
    25. el-row>
    26. el-card>
    27. div>
    28. <el-dialog
    29. title="主页配置"
    30. :visible.sync="subscribe.show"
    31. width="40%"
    32. :before-close="closedia"
    33. class="a1"
    34. >
    35. <el-form style="height:600px,overflow:hidden">
    36. <el-form-item label="布局列数:">
    37. <el-select v-model="subscribe.colNum" placeholder="请选择布局列数">
    38. <el-option label="2列" value="2"> el-option>
    39. <el-option label="3列" value="3"> el-option>
    40. <el-option label="4列" value="4"> el-option>
    41. el-select>
    42. el-form-item>
    43. <el-form-item label="订阅模块:">
    44. <div class="drags">
    45. <div
    46. class="item"
    47. :class="'item' + subscribe.colNum"
    48. v-for="(item, index) in subscribe.items"
    49. :key="item + index + 'key'"
    50. draggable
    51. @dragstart="startDrag($event, item)"
    52. @dragover.prevent="handDragOver($event, item)"
    53. @dragenter="handDragEnter($event, item)"
    54. @dragend="endDrag($event, item)"
    55. :style="{ background: item.color }"
    56. :ref="item.color"
    57. >
    58. <div class="bc">
    59. <div class="item-title">{{ item.cname }}div>
    60. <el-switch
    61. v-model="item.subscribed"
    62. inactive-color="#ff4949"
    63. active-text="订阅"
    64. inactive-text="取消"
    65. >
    66. el-switch>
    67. div>
    68. div>
    69. div>
    70. el-form-item>
    71. el-form>
    72. <span slot="footer" class="dialog-footer">
    73. <el-button type="success" @click="updateConfigurationListByRole"
    74. >重 置
    75. >
    76. <el-button type="primary" @click="updateUserConfiguration"
    77. >确 定
    78. >
    79. span>
    80. el-dialog>
    81. div>
    82. template>
    83. <script>
    84. import { mapGetters, mapState } from "vuex";
    85. import MyCounts from "./components/statisticsAnalysis/myCount";
    86. import FileCount from "./components/statisticsAnalysis/fileCount";
    87. import MyMessages from "./components/statisticsAnalysis/MyMsgs";
    88. import MyAssigns from "./components/statisticsAnalysis/TaskCount";
    89. import MyDataStatistics from "./components/statisticsAnalysis/dataCount";
    90. import MyOperations from "./components/statisticsAnalysis/myOperates";
    91. import MyTools from "./components/statisticsAnalysis/toolsRunning";
    92. import MyProjects from "./components/myDatas/myProjects";
    93. import MyItems from "./components/myDatas/myAnalysisTargets";
    94. import MyVersions from "./components/myDatas/myVersions";
    95. import MyModels from "./components/myDatas/myModels";
    96. import MySolvingFiles from "./components/myDatas/mySolvingFiles";
    97. import MyReports from "./components/myDatas/myReports";
    98. import MyResults from "./components/myDatas/myReuslts";
    99. import MyAllKeyResults from "./components/myDatas/myAllKeyResult";
    100. import MyToDoTaskNode from "./components/myDatas/myToDoTaskNode";
    101. import MyApproval from "./components/myDatas/myApply";
    102. import MyTasks from "./components/myDatas/myWork";
    103. import MyCreateTask from "./components/myDatas/myCreateTask";
    104. import MyPersonInfo from "./components/myDatas/myPersonInfo";
    105. import { getUserConfiguration } from "@/api/statistics";
    106. import { getAllConfiguration } from "@/api/statistics";
    107. import { updateUserConfiguration } from "@/api/statistics";
    108. import { findConfigurationListByRole } from "@/api/statistics";
    109. export default {
    110. name: "Dashboard",
    111. computed: {
    112. ...mapGetters(["name"]),
    113. ...mapState({
    114. user: (state) => state.user.user,
    115. }),
    116. },
    117. components: {
    118. // CountTo,
    119. MyCounts,
    120. FileCount,
    121. MyMessages,
    122. MyAssigns,
    123. MyDataStatistics,
    124. MyOperations,
    125. MyTools,
    126. MyProjects,
    127. MyItems,
    128. MyVersions,
    129. MyModels,
    130. MySolvingFiles,
    131. MyReports,
    132. MyResults,
    133. MyAllKeyResults,
    134. MyToDoTaskNode,
    135. MyTasks,
    136. MyCreateTask,
    137. MyApproval,
    138. MyPersonInfo,
    139. },
    140. data() {
    141. return {
    142. pageLoading: false,
    143. subscribe: {
    144. colNum: 3,
    145. layoutCols: 3,
    146. objectid: "",
    147. show: false,
    148. ending: null,
    149. dragging: null,
    150. items: [],
    151. sortedItems: [],
    152. cacheItems: [],
    153. cacheCols: 3,
    154. },
    155. defaultConfig: {
    156. column: 4,
    157. default: [],
    158. },
    159. allConfig: [],
    160. };
    161. },
    162. methods: {
    163. // 获取个人主页配置
    164. getUserConfiguration() {
    165. return getUserConfiguration();
    166. },
    167. // 获取全部主页配置
    168. getAllConfiguration() {
    169. return getAllConfiguration();
    170. },
    171. // 根据用户角色获取默认配置
    172. findConfigurationListByRole() {
    173. return findConfigurationListByRole();
    174. },
    175. async configuration() {
    176. let UserConfiguration = await this.getUserConfiguration();
    177. let AllConfiguration = await this.getAllConfiguration();
    178. let DefaultConfiguration = await this.findConfigurationListByRole();
    179. let userConfig = UserConfiguration.data;
    180. let allConfig = AllConfiguration.data;
    181. let defaultConfig = DefaultConfiguration.data;
    182. console.log(userConfig);
    183. console.log(allConfig);
    184. this.allConfig = JSON.parse(JSON.stringify(allConfig));
    185. this.defaultConfig = defaultConfig;
    186. let subscribeid =
    187. userConfig.subscribe.length != 0
    188. ? userConfig.subscribe
    189. : defaultConfig.default;
    190. var subed = [];
    191. for (var item of subscribeid) {
    192. for (var allItem of allConfig) {
    193. if (allItem.objectid == item) {
    194. allItem.subscribed = true;
    195. subed.push(allItem);
    196. break;
    197. }
    198. }
    199. }
    200. var notSub = allConfig.filter((item) => {
    201. if (!subscribeid.includes(item.objectid)) {
    202. item.subscribed = false;
    203. return item
    204. }
    205. });
    206. var config = [...subed, ...notSub];
    207. console.log(config);
    208. // var config = allConfig.map((item) => {
    209. // item.subscribed = subscribeid.includes(item.objectid) ? true : false;
    210. // return item;
    211. // });
    212. this.subscribe.items = JSON.parse(JSON.stringify(config));
    213. console.log(this.subscribe.items);
    214. this.subscribe.colNum =
    215. userConfig.column.length != 0
    216. ? userConfig.column
    217. : defaultConfig.column;
    218. // this.subscribe.objectid = userconfig.objectid;
    219. this.sortConfirm();
    220. this.pageLoading = false;
    221. },
    222. // 更新个人主页
    223. updateUserConfiguration() {
    224. var user = JSON.parse(localStorage.getItem("user")); //数组对象
    225. let userId = user.objectid;
    226. var subids = [];
    227. for (var item of this.subscribe.items) {
    228. if (item.subscribed == true) {
    229. subids.push(item.objectid);
    230. }
    231. }
    232. let data = {
    233. user: userId,
    234. column: this.subscribe.colNum,
    235. subscribeList: subids,
    236. };
    237. updateUserConfiguration(data).then((res) => {
    238. if (res) {
    239. console.log(res);
    240. this.sortConfirm();
    241. }
    242. });
    243. },
    244. // 根据用户角色获取默认配置
    245. updateConfigurationListByRole() {
    246. let arr = this.allConfig.map((item) => {
    247. item.subscribed = this.defaultConfig.default.includes(item.objectid)
    248. ? true
    249. : false;
    250. return item;
    251. });
    252. this.subscribe.items = JSON.parse(JSON.stringify(arr));
    253. this.subscribe.colNum = this.defaultConfig.column;
    254. },
    255. startDrag(e, item) {
    256. console.log(e, item);
    257. this.subscribe.dragging = item;
    258. console.log(this.$refs[item.color]);
    259. },
    260. handDragOver(e, item) {
    261. console.log(e, item);
    262. e.dataTransfer.dropEffect = "move";
    263. },
    264. handDragEnter(e, item) {
    265. console.log(e, item);
    266. e.dataTransfer.effectAllowed = "move";
    267. this.subscribe.ending = item;
    268. },
    269. endDrag(e, item) {
    270. console.log(e, item);
    271. if (this.subscribe.ending.name === this.subscribe.dragging.name) {
    272. return;
    273. }
    274. let newItems = [...this.subscribe.items];
    275. const src = newItems.indexOf(this.subscribe.dragging);
    276. const dst = newItems.indexOf(this.subscribe.ending);
    277. newItems.splice(src, 1);
    278. newItems.splice(dst, 0, this.subscribe.dragging);
    279. this.subscribe.items = newItems;
    280. this.$nextTick(() => {
    281. this.subscribe.dragging = null;
    282. this.subscribe.ending = null;
    283. });
    284. },
    285. showSubscribe() {
    286. this.subscribe.show = true;
    287. },
    288. sortConfirm() {
    289. this.subscribe.sortedItems = this.subscribe.items.filter((v) => {
    290. return v.subscribed;
    291. });
    292. this.subscribe.layoutCols = this.subscribe.colNum;
    293. this.subscribe.cacheItems = this.subscribe.items;
    294. this.subscribe.cacheCols = this.subscribe.colNum;
    295. this.subscribe.show = false;
    296. },
    297. closedia(done) {
    298. this.subscribe.items = this.subscribe.cacheItems;
    299. this.subscribe.colNum = this.subscribe.cacheCols;
    300. if (done) {
    301. done();
    302. }
    303. },
    304. },
    305. created() {
    306. this.pageLoading = true;
    307. this.configuration();
    308. },
    309. mounted() {},
    310. };
    311. script>
    312. <style lang="scss" scoped>
    313. .a1{
    314. height: 100%;
    315. ::v-deep .el-dialog__body{
    316. height: 40rem;
    317. overflow: auto;
    318. }
    319. }
    320. .dashboard {
    321. &-container {
    322. margin: 30px;
    323. }
    324. }
    325. .firstPage {
    326. .card-title {
    327. font-size: 20px;
    328. font-weight: bold;
    329. }
    330. ::v-deep .dataBox {
    331. height: calc(50vh - 150px);
    332. margin-bottom: 15px;
    333. .border-box {
    334. border: 1px solid #eef;
    335. border-radius: 5px;
    336. height: calc(50vh - 150px);
    337. box-sizing: border-box;
    338. padding: 15px 0;
    339. }
    340. #smChart {
    341. height: 100px;
    342. width: 200px;
    343. }
    344. .readBox {
    345. line-height: 28px;
    346. }
    347. .card-sub-title {
    348. font-size: 18px;
    349. font-weight: bold;
    350. line-height: 20px;
    351. .messageIcon {
    352. color: #409eff;
    353. font-size: 18px;
    354. display: inline-block;
    355. vertical-align: middle;
    356. margin: 0 5px;
    357. }
    358. .messageNum {
    359. display: inline-block;
    360. vertical-align: middle;
    361. font-size: 14px;
    362. color: #679;
    363. margin: 0 5px;
    364. }
    365. }
    366. .chartTitle {
    367. font-size: 18px;
    368. font-weight: bold;
    369. padding-left: 15px;
    370. }
    371. .middleChartBox {
    372. height: 300px;
    373. }
    374. .chartBox {
    375. height: 300px;
    376. }
    377. .label {
    378. color: #999;
    379. }
    380. .bo {
    381. font-size: 30px;
    382. }
    383. .card-panel-num {
    384. font-size: 40px;
    385. line-height: 200px;
    386. }
    387. }
    388. ::v-deep .drags {
    389. display: flex;
    390. flex-wrap: wrap;
    391. .item {
    392. height: 100px;
    393. // width: 200px;
    394. // background: #f5f9ff;
    395. margin-right: 20px;
    396. margin-bottom: 20px;
    397. text-align: center;
    398. .bc {
    399. width: calc(100% -20px);
    400. background: #f5f9ff;
    401. }
    402. .item-title {
    403. line-height: 60px;
    404. }
    405. &.item2 {
    406. width: calc(50% - 20px);
    407. }
    408. &.item3 {
    409. width: calc(33% - 20px);
    410. }
    411. &.item4 {
    412. width: calc(25% - 20px);
    413. }
    414. }
    415. .el-switch__label--left {
    416. &.is-active {
    417. color: #ff4949;
    418. }
    419. }
    420. .el-switch__label--right.is-active {
    421. &.is-active {
    422. color: #1890ff;
    423. }
    424. }
    425. }
    426. }
    427. style>

    2.订阅模块

    点击查看订阅模块实现代码

    3.订阅模块配置文件

    1. {
    2. "myAllKeyResult": {
    3. "label": [
    4. "名称",
    5. "性能结果类型",
    6. "创建者",
    7. "所有者",
    8. "创建时间",
    9. "结果",
    10. "描述"
    11. ]
    12. },
    13. "myAnalysisTargets": {
    14. "label": [
    15. "对象名称",
    16. "项目",
    17. "分析对象定义",
    18. "上层分析对象",
    19. "创建者",
    20. "所有者",
    21. "创建时间",
    22. "描述"
    23. ]
    24. },
    25. "myApply": {
    26. "label": [
    27. "名称",
    28. "审批对象名称",
    29. "类型",
    30. "申请时间",
    31. "状态"
    32. ]
    33. },
    34. "myCreateTask": {
    35. "label": [
    36. "任务名称",
    37. "项目",
    38. "版本",
    39. "阶段",
    40. "类型",
    41. "上层任务",
    42. "任务负责人",
    43. "创建时间",
    44. "任务状态"
    45. ]
    46. },
    47. "myModels": {
    48. "label": [
    49. "模型名称",
    50. "版本方案",
    51. "项目",
    52. "分析对象",
    53. "阶段",
    54. "模型定义",
    55. "模型实例类型",
    56. "上层模型",
    57. "格式",
    58. "密级",
    59. "创建者",
    60. "所有者",
    61. "创建时间",
    62. "描述"
    63. ]
    64. },
    65. "myProjects": {
    66. "label": [
    67. "项目名称",
    68. "项目长名",
    69. "项目类型",
    70. "上层项目",
    71. "创建者",
    72. "所有者",
    73. "创建时间",
    74. "项目状态",
    75. "描述"
    76. ]
    77. },
    78. "myReports": {
    79. "label": [
    80. "名称",
    81. "项目",
    82. "关联数据",
    83. "密级",
    84. "报告类型",
    85. "创建者",
    86. "所有者",
    87. "创建时间",
    88. "描述"
    89. ]
    90. },
    91. "myReuslts": {
    92. "label": [
    93. "名称",
    94. "项目",
    95. "分析对象",
    96. "版本",
    97. "模型定义",
    98. "结果类型",
    99. "分析类型",
    100. "计算文件",
    101. "格式",
    102. "研制阶段",
    103. "创建者",
    104. "所有者",
    105. "创建时间",
    106. "结果描述"
    107. ]
    108. },
    109. "mySolvingFiles": {
    110. "label": [
    111. "模型名称",
    112. "项目",
    113. "分析对象",
    114. "版本方案",
    115. "模型实例类型",
    116. "模型定义",
    117. "分析类型",
    118. "分析工具",
    119. "格式",
    120. "密级",
    121. "阶段",
    122. "创建者",
    123. "所有者",
    124. "创建时间",
    125. "描述"
    126. ]
    127. },
    128. "myToDoTaskNode": {
    129. "label": [
    130. "名称",
    131. "审批对象名称",
    132. "申请人",
    133. "类型",
    134. "申请时间"
    135. ]
    136. },
    137. "myVersions": {
    138. "label": [
    139. "版本名称",
    140. "分析对象",
    141. "项目",
    142. "分析对象定义",
    143. "版本方案定义",
    144. "上层版本方案",
    145. "阶段",
    146. "创建者",
    147. "所有者",
    148. "创建时间",
    149. "描述"
    150. ]
    151. },
    152. "myWork": {
    153. "label": [
    154. "任务名称",
    155. "项目",
    156. "版本",
    157. "阶段",
    158. "类型",
    159. "上层任务",
    160. "任务负责人",
    161. "创建时间",
    162. "任务状态"
    163. ]
    164. }
    165. }

    4.查看全部(组件复用)

    myDatasList文件夹=>index.vue

    1. <template>
    2. <div class="dashboard-container firstPage">
    3. <div class="dashboard-text">
    4. <el-card class="box-card" style="min-height: calc(100vh - 80px)">
    5. <div slot="header" class="clearfix">
    6. <span>{{$route.query.title}}span>
    7. div>
    8. <myProjects :page='currentPage' :pagesize="pagesize" @retotal="totalChange" v-if=" $route.query.title === '我的项目' ">myProjects>
    9. <myItems :page='currentPage' :pagesize="pagesize" @retotal="totalChange" v-if=" $route.query.title === '我的分析对象' ">myItems>
    10. <myVersions :page='currentPage' :pagesize="pagesize" @retotal="totalChange" v-if=" $route.query.title === '我的版本方案' ">myVersions>
    11. <myModels :page='currentPage' :pagesize="pagesize" @retotal="totalChange" v-if=" $route.query.title==='我的模型'">myModels>
    12. <mySolvingFiles :page='currentPage' :pagesize="pagesize" @retotal="totalChange" v-if=" $route.query.title === '我的求解文件'" >mySolvingFiles>
    13. <myReports :page='currentPage' :pagesize="pagesize" @retotal="totalChange" v-if=" $route.query.title === '我的分析报告' ">myReports>
    14. <myResults :page='currentPage' :pagesize="pagesize" @retotal="totalChange" v-if=" $route.query.title === '我的仿真结果'" >myResults>
    15. <myAllKeyResults :page='currentPage' :pagesize="pagesize" @retotal="totalChange" v-if=" $route.query.title === '我的性能结果' ">myAllKeyResults>
    16. <myTasks :page='currentPage' :pagesize="pagesize" @retotal="totalChange" v-if=" $route.query.title === '我的任务' ">myTasks>
    17. <myCreateTask :page='currentPage' :pagesize="pagesize" @retotal="totalChange" v-if=" $route.query.title === '我创建的任务' ">myCreateTask>
    18. <myApproval :page='currentPage' :pagesize="pagesize" @retotal="totalChange" v-if=" $route.query.title === '我的审批申请' ">myApproval>
    19. <myToDoTaskNode :page='currentPage' :pagesize="pagesize" @retotal="totalChange" v-if=" $route.query.title === '我的代办审批'">myToDoTaskNode>
    20. <div class="mt15" style="text-align: right">
    21. <el-pagination
    22. @size-change="handleSizeChange"
    23. @current-change="handleCurrentChange"
    24. :current-page="currentPage"
    25. :page-sizes="[10, 20, 30, 40]"
    26. :page-size="pagesize"
    27. layout="total, prev, pager, next, sizes, jumper"
    28. :total="total"
    29. >
    30. el-pagination>
    31. div>
    32. el-card>
    33. div>
    34. div>
    35. template>
    36. <script>
    37. import MyProjects from "../dashboard/components/myDatas/myProjects";
    38. import MyItems from "../dashboard/components/myDatas/myAnalysisTargets";
    39. import MyVersions from "../dashboard/components/myDatas/myVersions";
    40. import MyModels from "../dashboard/components/myDatas/myModels";
    41. import MySolvingFiles from "../dashboard/components/myDatas/mySolvingFiles";
    42. import MyReports from "../dashboard/components/myDatas/myReports";
    43. import MyResults from "../dashboard/components/myDatas/myReuslts";
    44. import MyAllKeyResults from "../dashboard/components/myDatas/myAllKeyResult";
    45. import MyToDoTaskNode from "../dashboard/components/myDatas/myToDoTaskNode";
    46. import MyApproval from "../dashboard/components/myDatas/myApply";
    47. import MyTasks from "../dashboard/components/myDatas/myWork";
    48. import MyCreateTask from "../dashboard/components/myDatas/myCreateTask";
    49. export default {
    50. name: "myDatasList",
    51. components: {
    52. MyProjects,
    53. MyItems,
    54. MyVersions,
    55. MyModels,
    56. MySolvingFiles,
    57. MyReports,
    58. MyResults,
    59. MyAllKeyResults,
    60. MyToDoTaskNode,
    61. MyApproval,
    62. MyTasks,
    63. MyCreateTask,
    64. },
    65. data(){
    66. return{
    67. currentPage:1,
    68. pagesize:10,
    69. total:0,
    70. }
    71. },
    72. methods:{
    73. totalChange(val){
    74. this.total = val;
    75. this.prev = val
    76. },
    77. handleSizeChange(val){
    78. this.pagesize = val
    79. this.$emit("add",this.page)
    80. this.$emit("add",this.pagesize)
    81. },
    82. handleCurrentChange(val){
    83. this.currentPage = val
    84. },
    85. },
    86. };
    87. script>

    二. 更改所有者

    (一)实现功能

    校验登录用户身份,校验不同文件类型,更改所对应所有者。

    (二)实现效果

     (三)实现代码

    1.dialog

    1. <template>
    2. <div class="updateOwner">
    3. <el-dialog
    4. title="更改所有者"
    5. :visible.sync="value"
    6. width="500px"
    7. :before-close="handleClose"
    8. :close-on-click-modal="false"
    9. @close="handleAssignUserClose"
    10. >
    11. <el-form
    12. :inline="true"
    13. ref="assignUserForm"
    14. :model="formInline"
    15. class="demo-form-inline"
    16. >
    17. <el-form-item label="项目" required>
    18. <el-cascader
    19. v-model="formInline.project"
    20. :options="projectData"
    21. :props="projectProps"
    22. placeholder="请选择项目"
    23. clearable
    24. :disabled="true"
    25. >
    26. el-cascader>
    27. el-form-item>
    28. el-form>
    29. <div class="projectBox">
    30. <el-tag style="margin: 2px" size="small">
    31. {{ currentowner.name }}
    32. el-tag>
    33. div>
    34. <el-table
    35. :data="tableData"
    36. border
    37. style="width: 100%"
    38. class="mt15"
    39. size="mini"
    40. >
    41. <el-table-column prop="realName" label="用户名"> el-table-column>
    42. <el-table-column label="操作" width="100">
    43. <template slot-scope="scope">
    44. <el-button
    45. type="text"
    46. size="mini"
    47. v-if="!(scope.row.userId==currentowner.id)"
    48. @click="handleAdd(scope.row)"
    49. >更改
    50. >
    51. template>
    52. el-table-column>
    53. el-table>
    54. <div class="mt15 align-right clear">
    55. <el-pagination
    56. @current-change="handleCurrentChange"
    57. :current-page.sync="currentPage"
    58. :page-size="10"
    59. layout="total, prev, pager, next, jumper"
    60. :total="total"
    61. size="mini"
    62. >
    63. el-pagination>
    64. div>
    65. <span slot="footer" class="dialog-footer">
    66. <el-button @click="handleAssignUserClose">取 消el-button>
    67. <el-button type="primary" @click="assignProjectForUser"
    68. >提 交
    69. >
    70. span>
    71. el-dialog>
    72. div>
    73. template>
    74. <script>
    75. import { updateAuth } from '@/utils/statusCode'
    76. import { findAllRole } from "@/api/authorization/role";
    77. import { getUserListByPage } from "@/api/authorization/user";
    78. import request from "@/utils/request";
    79. import { mapState } from "vuex";
    80. export default {
    81. name: "updateOwner",
    82. computed: {
    83. ...mapState({
    84. user: (state) => state.user.user,
    85. }),
    86. },
    87. props: {
    88. value: {
    89. type: Boolean,
    90. default: false,
    91. required: true,
    92. },
    93. projectData: {
    94. type: Array,
    95. },
    96. updateAcObj: {
    97. type: Object,
    98. },
    99. // ownerId: { type: String },
    100. },
    101. data() {
    102. return {
    103. projectProps: {
    104. value: "objectid",
    105. label: "name",
    106. children: "children",
    107. checkStrictly: true,
    108. },
    109. updateAuth,
    110. tableData: [],
    111. currentPage: 1,
    112. total: 0,
    113. formInline: {},
    114. userList: [],
    115. expirationDate: "",
    116. roleList: [],
    117. associatedUserList: [],
    118. projectUserList: [],
    119. currentowner: { name: "", id: "" },
    120. };
    121. },
    122. methods: {
    123. initForm(projectDetail) {
    124. // debugger
    125. this.currentowner.id = this.updateAcObj.ownerId;
    126. this.formInline.project = projectDetail.objectid;
    127. this.formInline.parentProject = projectDetail.parent;
    128. this.getUsersByProjectId(this.formInline.project);
    129. this.$emit("input", true);
    130. },
    131. assignProjectForUser() {
    132. let typeObj = {
    133. project: 1,
    134. item: 2,
    135. version: 3,
    136. model: 4,
    137. inputDeck: 5,
    138. result: 6,
    139. report: 7,
    140. imageResult: 9,
    141. valueResult: 10,
    142. docResult: 11,
    143. movieResult: 12,
    144. curveResult: 13,
    145. itemDef: 15,
    146. versionDef: 16,
    147. Scenario: 17,
    148. modelDef: 18,
    149. studyDoc:19,
    150. studyDocTag:20
    151. };
    152. let data = {
    153. objectId: this.updateAcObj.objectId,
    154. type: typeObj[this.updateAcObj.type],
    155. owner: this.currentowner.id,
    156. };
    157. console.log(data);
    158. request({
    159. url: "/datamanager/updateAuth/updateOwner",
    160. method: "get",
    161. params: data,
    162. })
    163. .then((res) => {
    164. this.$message.success("分配成功");
    165. this.handleClose();
    166. this.$emit("refreshBasic", {
    167. owner: this.currentowner.name,
    168. ownerId: this.currentowner.id,
    169. });
    170. })
    171. .catch((err) => {
    172. this.$message.error("请添加用户!");
    173. });
    174. return;
    175. },
    176. getUsersByProjectId(projectId) {
    177. this.getUserListByPage();
    178. },
    179. handleAdd(row) {
    180. // debugger
    181. this.currentowner.name = row.realName;
    182. this.currentowner.id = row.userId;
    183. },
    184. handleCurrentChange(val) {
    185. this.currentPage = val;
    186. this.getUserListByPage();
    187. },
    188. getUserListByPage() {
    189. var self = this;
    190. let data = {
    191. start: this.currentPage,
    192. limit: 10,
    193. userRealName: this.formInline.userRealName || "",
    194. };
    195. getUserListByPage(data).then((res) => {
    196. if (res) {
    197. this.tableData = res.data.records;
    198. for (let i = 0; i < this.tableData.length; i++) {
    199. this.tableData[i].dis = false;
    200. this.tableData[i].roleId = this.roleList[0].ownerid;
    201. for (let j = 0; j < this.associatedUserList.length; j++) {
    202. if (
    203. this.associatedUserList[j].objectid == this.tableData[i].userId
    204. ) {
    205. this.tableData[i].transmit =
    206. this.associatedUserList[j].transmit;
    207. this.tableData[i].dis = true;
    208. this.tableData[i].roleId = this.associatedUserList[j].role;
    209. }
    210. }
    211. this.tableData[i].realName =
    212. "" + self.tableData[i].lastname + self.tableData[i].firstname;
    213. if (this.tableData[i].userId === this.currentowner.id) {
    214. this.currentowner.name = this.tableData[i].realName;
    215. }
    216. }
    217. this.total = res.data.total;
    218. }
    219. });
    220. },
    221. findAllRole() {
    222. findAllRole().then((res) => {
    223. if (res) {
    224. res.data.forEach((item) => {
    225. if (item.type == 2) {
    226. this.roleList.push(item);
    227. }
    228. });
    229. }
    230. });
    231. },
    232. handleAssignUserClose() {
    233. this.associatedUserList = [];
    234. this.currentPage = 1;
    235. this.formInline = {
    236. realName: null,
    237. };
    238. this.$emit("input", false);
    239. },
    240. async handleClose(done) {
    241. await this.$emit("input", false);
    242. done();
    243. },
    244. },
    245. created() {
    246. this.findAllRole();
    247. },
    248. };
    249. script>
    250. <style lang="scss" scoped>
    251. .assignUser {
    252. .label {
    253. line-height: 40px;
    254. width: 100px;
    255. }
    256. }
    257. style>

    2.code值

    1. export var updateAuth = {
    2. "item": '202',//分析对象更改所有者'
    3. "version": '205',//'版本方案更改所有者'
    4. "model": '208',//:'模型更改所有者'
    5. "inputDeck": '211',//:'计算文件更改所有者'
    6. "result": '214',//:'结果更改所有者'
    7. "keyResult": '217',//:'性能结果更改所有者'
    8. "report": '220',//:'报告更改所有者'
    9. "docTags":"223",//文档分类更改所有者
    10. "docs":"226",//知识文档更改所有者
    11. "project":"227",//项目更改所有者
    12. "itemDef":"228",//对象定义更改所有者
    13. "versionDef":"229",//版本方案定义更改所有者
    14. "modelDef":"230",//模型定义更改所有者
    15. "scenario":"231",//分析类型更改所有者
    16. }

    3.按钮

    1. <div class="fl btnItem" :class="{ disabled: editStatus }" @click="!editStatus ? updateOwner() : null" v-if="updateAcObj.showBtn">
    2. <svg-icon icon-class="user" class="btnIcon" />
    3. <p>更改所有者p>
    4. <i class="el-icon-setting smIcon">i>
    5. div>
    1. <updateOwner
    2. ref="updateOwner"
    3. v-model="updateOwnerVisible"
    4. :updateAcObj="updateAcObj"
    5. :projectData="projectData"
    6. @refreshBasic="updOwner"
    7. >updateOwner>
    1. import updateOwner from "@/components/project/updateOwner";
    2. updateOwner() {
    3. this.$refs.updateOwner.initForm(this.projectDetail);
    4. },

  • 相关阅读:
    找实习之从0开始的后端学习日记【9.17】
    猿创征文|docker本地仓库的搭建(简易可快速使用的本地仓库)
    Docker(1)
    宠物网页作业HTML 大一作业HTML宠物网页作业 web期末大作业HTML 动物网页作业HTML HTML制作宠物网页作业css
    2023 电赛 E 题 K210 方案
    java 调用合约使用nonce 可能会出现的问题
    ASCII 码、Unicode、UTF-8
    手把手教程6-2: F460把debug printf功能改到UART1
    校招/社招/秋招/春招求职指南
    C# - Opencv应用(2) 之矩阵Mat使用[矩阵创建、图像显示、像素读取与赋值]
  • 原文地址:https://blog.csdn.net/m0_65912225/article/details/126302211