train2.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <template>
  2. <div class="app-container">
  3. <div style="margin-top:3%">
  4. <div class="readme">正在练习中,考试时间 30 分钟</div>
  5. <div class="djs">距离考试结束还有{{ time }}</div>
  6. </div>
  7. <el-row>
  8. <h4 class="h4">更换件列表</h4>
  9. <el-table
  10. :data="tableData" border
  11. style="text-align:center;margin-top:1%;"
  12. max-height="550">
  13. <el-table-column
  14. prop="name"
  15. label="更换件类型"
  16. >
  17. <template slot-scope="scope">
  18. <el-input v-model="scope.row.address" ></el-input>
  19. </template>
  20. </el-table-column>
  21. <el-table-column
  22. prop="number"
  23. label="状态">
  24. <template slot-scope="scope">
  25. <el-input v-model="scope.row.address" ></el-input>
  26. </template>
  27. </el-table-column>
  28. <el-table-column
  29. prop="reason"
  30. label="申请时间" >
  31. <template slot-scope="scope">
  32. <el-input v-model="scope.row.address" ></el-input>
  33. </template>
  34. </el-table-column>
  35. <el-table-column
  36. fixed="right"
  37. label="操作">
  38. <template slot-scope="scope">
  39. <el-button
  40. @click.native.prevent="AddRow(scope.$index, tableData)"
  41. type="text"
  42. size="small">
  43. 追加
  44. </el-button>
  45. <el-button
  46. @click.native.prevent="deleteRow(scope.$index, tableData)"
  47. type="text"
  48. size="small">
  49. 移除
  50. </el-button>
  51. </template>
  52. </el-table-column>
  53. </el-table>
  54. </el-row>
  55. <el-row>
  56. <h4 class="h4">维修报告列表</h4>
  57. <el-table
  58. :data="tableData1" border
  59. style="text-align:center;margin-top:1%;"
  60. max-height="550">
  61. <el-table-column
  62. prop="name"
  63. label="故障现象">
  64. <template slot-scope="scope">
  65. <el-input v-model="scope.row.address" ></el-input>
  66. </template>
  67. </el-table-column>
  68. <el-table-column
  69. prop="number"
  70. label="可能原因">
  71. <template slot-scope="scope">
  72. <el-input v-model="scope.row.address" ></el-input>
  73. </template>
  74. </el-table-column>
  75. <el-table-column
  76. prop="reason"
  77. label="故障部位" >
  78. <template slot-scope="scope">
  79. <el-input v-model="scope.row.address" ></el-input>
  80. </template>
  81. </el-table-column>
  82. <el-table-column
  83. prop="reason"
  84. label="排除方法" >
  85. <template slot-scope="scope">
  86. <el-input v-model="scope.row.address" ></el-input>
  87. </template>
  88. </el-table-column>
  89. <el-table-column
  90. fixed="right"
  91. label="操作">
  92. <template slot-scope="scope">
  93. <el-button
  94. @click.native.prevent="AddRow1(scope.$index, tableData1)"
  95. type="text"
  96. size="small">
  97. 追加
  98. </el-button>
  99. <el-button
  100. @click.native.prevent="deleteRow1(scope.$index, tableData1)"
  101. type="text"
  102. size="small">
  103. 移除
  104. </el-button>
  105. </template>
  106. </el-table-column>
  107. </el-table>
  108. </el-row>
  109. <el-form ref="elForm" :model="formData" :rules="rules" size="medium" style="margin-top: 1%;text-align: center;">
  110. <el-form-item label="修复结论" prop="field101">
  111. <el-select v-model="formData.field101" placeholder="请选择修复结论" clearable :style="{width: '95%'}">
  112. <el-option v-for="(item, index) in field101Options" :key="index" :label="item.label"
  113. :value="item.value" :disabled="item.disabled"></el-option>
  114. </el-select>
  115. </el-form-item>
  116. <el-form-item size="large">
  117. <el-button type="primary" @click="submitForm" style="width: 8%;">交卷</el-button>
  118. </el-form-item>
  119. </el-form>
  120. </div>
  121. </template>
  122. <style>
  123. .readme {
  124. margin-top:2%;
  125. text-align: center;
  126. line-height:8px;
  127. font-size:22px;
  128. }
  129. .djs {
  130. margin-top:2%;
  131. text-align: center;
  132. line-height:8px;
  133. font-size:22px;
  134. color:red;
  135. margin-bottom: 3%;
  136. }
  137. </style>
  138. <script>
  139. import { listUser } from "@/api/system/user";
  140. export default {
  141. name: "AuthRole",
  142. data() {
  143. return {
  144. duration: 1800, // 假设倒计时1800秒
  145. tableData: [{
  146. name: '1111',
  147. number: '',
  148. reason: ''
  149. }, {
  150. name: '2222',
  151. number: '',
  152. reason: ''
  153. }],
  154. tableData1: [{
  155. name: '',
  156. number: '',
  157. reason: '',
  158. reason: ''
  159. }, {
  160. name: '',
  161. number: '',
  162. reason: '',
  163. reason: ''
  164. }],
  165. formData: {
  166. field101: undefined,
  167. },
  168. rules: {
  169. field101: [{
  170. required: true,
  171. message: '请选择下拉选择',
  172. trigger: 'change'
  173. }],
  174. },
  175. field101Options: [{
  176. "label": "选项一",
  177. "value": 1
  178. }, {
  179. "label": "选项二",
  180. "value": 2
  181. }, {
  182. "label": "选项三",
  183. "value": 3
  184. }],
  185. // 遮罩层
  186. loading: true,
  187. // 分页信息
  188. total: 0,
  189. pageNum: 1,
  190. pageSize: 10,
  191. // 选中角色编号
  192. roleIds:[],
  193. // 角色信息
  194. roles: [],
  195. // 用户信息
  196. form: {},
  197. // 列信息
  198. columns: [
  199. { key: 0, label: `更换件类型`, visible: true },
  200. { key: 1, label: `状态`, visible: true },
  201. { key: 2, label: `申请时间`, visible: true },
  202. ],
  203. };
  204. },
  205. created() {
  206. const userId = this.$route.params && this.$route.params.userId;
  207. if (userId) {
  208. this.loading = true;
  209. getAuthRole(userId).then((response) => {
  210. this.form = response.user;
  211. this.roles = response.roles;
  212. this.total = this.roles.length;
  213. this.$nextTick(() => {
  214. this.roles.forEach((row) => {
  215. if (row.flag) {
  216. // this.$refs.table.toggleRowSelection(row);
  217. }
  218. });
  219. });
  220. this.loading = false;
  221. });
  222. }
  223. },
  224. methods: {
  225. deleteRow(index, rows) {
  226. console.log(index+"@@@@")
  227. console.log(rows+"####")
  228. rows.splice(index, 1);
  229. },
  230. AddRow(index, rows) {
  231. const newRow = {
  232. name: '',
  233. number: '',
  234. reason: '',
  235. };
  236. this.tableData.push(newRow); // 追加新行
  237. },
  238. deleteRow1(index, rows) {
  239. console.log(index+"@@@@")
  240. console.log(rows+"####")
  241. rows.splice(index, 1);
  242. },
  243. AddRow1(index, rows) {
  244. const newRow = {
  245. name: '',
  246. number: '',
  247. reason: '',
  248. };
  249. this.tableData1.push(newRow); // 追加新行
  250. },
  251. // 多选框选中数据
  252. handleSelectionChange(selection) {
  253. this.roleIds = selection.map((item) => item.roleId);
  254. },
  255. // 保存选中的数据编号
  256. getRowKey(row) {
  257. return row.roleId;
  258. },
  259. /** 提交按钮 */
  260. submitForm() {
  261. const userId = this.form.userId;
  262. // const roleIds = this.roleIds.join(",");
  263. // updateAuthRole({ userId: userId, roleIds: roleIds }).then((response) => {
  264. // this.$modal.msgSuccess("授权成功");
  265. // this.close();
  266. // });
  267. this.$router.push("/people/train-train3/trainid/5");
  268. },
  269. /** 关闭按钮 */
  270. close() {
  271. const obj = { path: "/system/user" };
  272. this.$tab.closeOpenPage(obj);
  273. },
  274. },
  275. computed: {
  276. time() {
  277. //let hours = Math.floor(this.duration / 3600);
  278. let minutes = Math.floor((this.duration % 3600) / 60);
  279. let seconds = this.duration % 60;
  280. return `${minutes}分${seconds}秒`;
  281. },
  282. },
  283. mounted() {
  284. let timer = setInterval(() => {
  285. this.duration--;
  286. if (this.duration <= 0) {
  287. clearInterval(timer);
  288. }
  289. }, 1000);
  290. },
  291. };
  292. </script>