Няма описание
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916
  1. <template>
  2. <div class="h5-container">
  3. <van-nav-bar title="考试任务" @click-left="onClickLeft" @click-right="handAdd">
  4. <template #right>
  5. <van-icon name="add" size="25" color="#000" />
  6. </template>
  7. </van-nav-bar>
  8. <van-search v-model="query.checkName" show-action placeholder="请输入检查任务名称" @search="onRefresh"
  9. @cancel="handdelect" />
  10. <!-- 项目列表 -->
  11. <van-pull-refresh v-model="isRefreshing" success-text="刷新成功" @refresh="onRefresh">
  12. <van-list v-model:loading="isLoading" :finished="isFinished" finished-text="没有更多了" offset="200" @load="onLoad">
  13. <div v-for="(item, idx) in resultData" :key="item.id">
  14. <van-swipe-cell title-style="color: #007aff" style="height: 80px;" :ref="el => getSwipeCellRef(el, idx)">
  15. <template #default>
  16. <div class="swipe-cell-default">
  17. <van-cell style="height: 100%; display: flex; align-items: center;" @click="edits(item)">
  18. <template #title>
  19. <div class="cell-title">
  20. {{ item.checkName }}
  21. </div>
  22. </template>
  23. <template #label>
  24. <div> 试卷规则:{{ruleIds.find(i => i.id === item.testRole)?.name}} ||检查时间:{{ item.checkTime }}</div>
  25. <div style="width: 112px" :class="getStatusClass(item.testType)">
  26. 类型:
  27. <span v-if="item.testType === '相同试题'" style="width: 200px">相同试题</span>
  28. <span v-else-if="item.testType === '不同试题'" style="width: 200px">不同试题</span>
  29. <span v-else>未知</span>
  30. </div>
  31. </template>
  32. </van-cell>
  33. <div class="swipe-cell-default-icon">
  34. <van-icon v-if="openStatus[idx]" name="arrow-double-left" @click.stop="openSwipe(idx)" />
  35. <van-icon v-else name="arrow-double-right" @click.stop="closeSwipe(idx)" />
  36. </div>
  37. </div>
  38. </template>
  39. <template #right>
  40. <van-button square class="delete-button" text="删除" @click="handleDelete(item)" />
  41. <van-button square class="submit-button" text="添加人员" @click="goaddPeo(item)" />
  42. </template>
  43. </van-swipe-cell>
  44. </div>
  45. </van-list>
  46. </van-pull-refresh>
  47. <!-- 删除确认弹窗 -->
  48. <van-dialog v-model:show="deleteDialogVisible" show-cancel-button @confirm="confirmDelete">
  49. <template #title>
  50. <div>删除确认</div>
  51. </template>
  52. <div style="padding: 30px;">确定要删除该项目吗?</div>
  53. </van-dialog>
  54. <!-- 二维码弹窗 -->
  55. <van-dialog
  56. v-model:show="qrDialogVisible"
  57. title="扫码添加人员"
  58. show-cancel-button
  59. close-on-popstate
  60. @cancel="qrDialogVisible = false"
  61. >
  62. <div class="qr-dialog-content">
  63. <img v-if="qrDataUrl" :src="qrDataUrl" alt="二维码" class="qr-code" />
  64. <p class="qr-tip">请使用手机扫码 App 扫描上方二维码</p>
  65. </div>
  66. </van-dialog>
  67. </div>
  68. </template>
  69. <script setup>
  70. import { ref, reactive, onMounted, getCurrentInstance, nextTick, toRaw } from 'vue';
  71. import { Dialog, showDialog, showSuccessToast, showToast, Toast } from 'vant';
  72. const { proxy } = getCurrentInstance();
  73. //生成二维码
  74. import QRCode from 'qrcode';
  75. // 新增状态
  76. const qrDialogVisible = ref(false);
  77. const qrDataUrl = ref('');
  78. const currentExamItem = ref(null); // 用于临时保存当前 item
  79. const onClickLeft = () => {
  80. history.back();
  81. };
  82. const headers = ref({
  83. token: localStorage.getItem('token'),
  84. userId: localStorage.getItem('userId'),
  85. dept: JSON.parse(localStorage.getItem('dept'))[0].deptCode
  86. });
  87. const switchIconState = (idx) => {
  88. openStatus.value[idx] = !openStatus.value[idx]
  89. openStatus.value = new Array(resultData.value.length).fill(true);
  90. }
  91. // const onClickRight = () =>{
  92. // searchShow.value = !searchShow.value;
  93. // }
  94. const searchShow = ref(false);
  95. const query = ref({
  96. checkName: ''
  97. });
  98. function formatDate(date, format) {
  99. const year = date.getFullYear();
  100. const month = date.getMonth() + 1;
  101. const day = date.getDate();
  102. const hours = date.getHours();
  103. const minutes = date.getMinutes();
  104. const seconds = date.getSeconds();
  105. return format
  106. .replace('yyyy', year)
  107. .replace('MM', month.toString().padStart(2, '0'))
  108. .replace('dd', day.toString().padStart(2, '0'))
  109. .replace('HH', hours.toString().padStart(2, '0'))
  110. .replace('mm', minutes.toString().padStart(2, '0'))
  111. .replace('ss', seconds.toString().padStart(2, '0'));
  112. }
  113. const tableData = ref([]);
  114. const selectedRows = ref([]);
  115. const dialogVisibleLook = ref(false);
  116. const deleteDialogVisible = ref(false);
  117. const currentDeleteItem = ref([]);
  118. const dialogVisible = ref(false);
  119. const dialogVisibleFile = ref(false);
  120. const date = ref(null);
  121. const kz = ref(true);
  122. import { useRouter } from 'vue-router';
  123. const router = useRouter();
  124. const handAdd = () => {
  125. router.push({ path: "/checkList",
  126. query: {
  127. mark:-1
  128. } });
  129. };
  130. import.meta.env.VITE_BASE_API
  131. const goaddPeo = async (item) => {
  132. currentExamItem.value = item;
  133. // ✅ 构建跳转 URL(指向你的答题页面)
  134. const baseUrl = window.location.origin + '/fcbkdatistart';
  135. const url = new URL(baseUrl);
  136. url.searchParams.set('examId', item.id); // 考试ID
  137. url.searchParams.set('testRole', item.testRole); //规则id
  138. url.searchParams.set('testRole', item.checkTime); //考试时间
  139. url.searchParams.set('checkName', item.checkName || '');
  140. url.searchParams.set('testType', item.testType || '');//考试类型
  141. // 如果还需要 userId,也可以加:
  142. url.searchParams.set('addId', localStorage.getItem('userId') || '');
  143. const qrContent = url.toString(); // ← 这就是二维码内容!
  144. try {
  145. qrDataUrl.value = await QRCode.toDataURL(qrContent, {
  146. width: 240,
  147. margin: 2,
  148. color: {
  149. dark: '#000000',
  150. light: '#ffffff'
  151. }
  152. });
  153. qrDialogVisible.value = true;
  154. } catch (err) {
  155. console.error('二维码生成失败:', err);
  156. Toast('二维码生成失败,请重试');
  157. }
  158. };
  159. const edits = (row) => {
  160. kz.value = true;
  161. form.value = { ...row };
  162. router.push({ path: "/checkList",
  163. query: {
  164. mark:1,
  165. data:JSON.stringify(form.value)
  166. } });
  167. };
  168. // 定义表单数据
  169. const form = ref({
  170. hdPicId: '',
  171. hdId: '',
  172. hdType: '',
  173. discoveryTime: '',
  174. hdSubtype: '',
  175. discoverer: '',
  176. discovererOther: '',
  177. hdDescription: '',
  178. hdLevel: '',
  179. bz: '',
  180. hdLocation: '',
  181. picBefore: '',
  182. equipmentId: '',
  183. hdmanageLevel: '',
  184. handlingProcesses: '',
  185. companyId: '',
  186. repairLeader: '',
  187. repairOther: '',
  188. repairSuggest: '',
  189. repairDdl: '',
  190. repairDept: '',
  191. acceptLeader: '',
  192. acceptOther: '',
  193. picAfter: '',
  194. picTemp: '',
  195. repairDescription: '',
  196. discovererDept: '',
  197. discovererDeptCode: '',
  198. hdLocationCode: '',
  199. hdLocationName: '',
  200. status: '',
  201. hdSelect: '正常登记',
  202. id: ''
  203. });
  204. const resetForma = () => {
  205. form.value = {
  206. hdPicId: '',
  207. hdId: '',
  208. hdType: '',
  209. discoveryTime: '',
  210. hdSubtype: '',
  211. discoverer: '',
  212. discovererOther: '',
  213. hdDescription: '',
  214. hdLevel: '',
  215. bz: '',
  216. hdLocation: '',
  217. picBefore: '',
  218. equipmentId: '',
  219. hdmanageLevel: '',
  220. handlingProcesses: '',
  221. companyId: '',
  222. repairLeader: '',
  223. repairOther: '',
  224. repairSuggest: '',
  225. repairDdl: '',
  226. repairDept: '',
  227. acceptLeader: '',
  228. acceptOther: '',
  229. picAfter: '',
  230. picTemp: '',
  231. repairDescription: '',
  232. status: '',
  233. discovererDept: '',
  234. discovererDeptCode: '',
  235. hdLocationCode: '',
  236. hdLocationName: '',
  237. hdSelect: '正常登记',
  238. id: ''
  239. };
  240. };
  241. const isRefreshing = ref(false);
  242. const isLoading = ref(false);
  243. const isFinished = ref(false);
  244. const currentPage = ref(1);
  245. const pageSize = ref(10);
  246. const totalRows = ref(0);
  247. const resultData = ref([]);
  248. const dept=localStorage.getItem("dept")[0].deptCode;
  249. const getTableData = async () => {
  250. query.value.addDeptCode=dept
  251. const url = 'sgsafe/EduCheckMaster/query';
  252. const param = {
  253. page: currentPage.value,
  254. rows: pageSize.value,
  255. params: JSON.stringify(query.value)
  256. };
  257. const response = await proxy.$axios.get(url, param);
  258. if (response.data.code === 0) {
  259. tableData.value = response.data.data.records;
  260. totalRows.value = response.data.data.total;
  261. } else {
  262. showToast({
  263. type: 'error',
  264. message: '操作失败!' + response.data.msg
  265. });
  266. }
  267. };
  268. const ruleIds = ref([]);
  269. const getRuleId = () => {
  270. var url = '/sgsafe/ExamHead/getCheckRuleId'
  271. var param = {}
  272. proxy.$axios.get(url, param).then(response => {
  273. if (response.data.code == '0') {
  274. ruleIds.value = response.data.data
  275. } else {
  276. console.log("1111111");
  277. }
  278. })
  279. console.log('ruleIds', ruleIds)
  280. }
  281. const onRefresh = () => {
  282. basicReset();
  283. onLoad();
  284. };
  285. const onLoad = async () => {
  286. if (isRefreshing.value) {
  287. resultData.value = [];
  288. currentPage.value = 1;
  289. isRefreshing.value = false;
  290. }
  291. try {
  292. await getTableData();
  293. await getRuleId()
  294. if (pageSize.value * currentPage.value < totalRows.value) {
  295. resultData.value = [...resultData.value, ...tableData.value];
  296. openStatus.value = new Array(resultData.value.length).fill(true);
  297. currentPage.value++;
  298. } else {
  299. resultData.value = [...resultData.value, ...tableData.value];
  300. openStatus.value = new Array(resultData.value.length).fill(true);
  301. isFinished.value = true;
  302. }
  303. } catch (error) {
  304. console.log(error);
  305. isFinished.value = true;
  306. } finally {
  307. isLoading.value = false;
  308. }
  309. };
  310. /* 通用方法: 重置list数据 */
  311. const basicReset = () => {
  312. isFinished.value = false;
  313. isLoading.value = true;
  314. currentPage.value = 1;
  315. resultData.value = [];
  316. };
  317. /*onMounted(() => {
  318. handleSearch();
  319. });
  320. const handleSearch = () => {
  321. /!* currentPage.value = 1;
  322. isFinished.value = false;
  323. tableData.value = [];*!/
  324. basicReset()
  325. onLoad()
  326. };*/
  327. const handdelect = () => {
  328. query.value.checkName = '';
  329. onRefresh()
  330. };
  331. const handleDetailLook = (row) => {
  332. form.value = { ...row };
  333. proxy.$router.push({
  334. name: 'taiZhang_detail',
  335. query: {
  336. form: form.value.id
  337. }
  338. });
  339. // dialogVisibleLook.value = true;
  340. };
  341. const deleteData=ref({})
  342. const handleDelete = (item) => {
  343. deleteData.value=item
  344. deleteData.value.cancelFlag='1'
  345. var url = '/sgsafe/EduCheckMaster/save';
  346. var param = {
  347. json: JSON.stringify(item)
  348. };
  349. proxy.$axios.post(url, param).then(response => {
  350. if (response.data.code == '0') {
  351. showSuccessToast("删除成功")
  352. onRefresh();
  353. } else {
  354. }
  355. })
  356. };
  357. const confirmDelete = () => {
  358. for (let item of currentDeleteItem.value) {
  359. if (item.addId !== headers.value.userId) {
  360. showToast({
  361. type: 'warning',
  362. message: '只能删除自己添加的数据!'
  363. });
  364. return;
  365. }
  366. }
  367. if (currentDeleteItem.value[0].status !== '0' && currentDeleteItem.value[0].hdSelect !== '下发隐患'
  368. && currentDeleteItem.value[0].hdSelect !== '即查即改') {
  369. showToast({
  370. type: 'fail',
  371. message: '只有尚未提交流程的记录或回到起点的流程经过作废后才可以删除!'
  372. });
  373. return;
  374. }
  375. if (currentDeleteItem.value[0].status !== '2' && currentDeleteItem.value[0].hdSelect === '下发隐患'
  376. && currentDeleteItem.value[0].hdSelect !== '即查即改') {
  377. showToast({
  378. type: 'fail',
  379. message: '只有尚未提交流程的记录或回到起点的流程经过作废后才可以删除!'
  380. });
  381. return;
  382. }
  383. var url = 'sgsafe/Hiddendanger/remove';
  384. var param = {
  385. params: JSON.stringify({ ...currentDeleteItem.value.map(x => x.id) })
  386. };
  387. proxy.$axios.get(url, param).then(response => {
  388. if (response.data.code == 0) {
  389. showToast({
  390. type: 'success',
  391. message: '删除成功'
  392. });
  393. onRefresh();
  394. } else {
  395. showToast({
  396. type: 'fail',
  397. message: '操作失败!' + response.data.msg
  398. });
  399. }
  400. });
  401. };
  402. const resetForm = () => {
  403. form.value = {
  404. projectName: '',
  405. projectLeader: '',
  406. phone: '',
  407. dept: ''
  408. };
  409. };
  410. const baocun = () => {
  411. nextTick(() => {
  412. if (form.value.hdSelect === '正常登记') {
  413. form.value.status = '0';
  414. } else if (form.value.hdSelect === '下发隐患') {
  415. form.value.status = '2';
  416. } else {
  417. form.value.status = '-1';
  418. }
  419. });
  420. // 原有保存逻辑保持不变
  421. var url = 'sgsafe/Hiddendanger/save';
  422. var param = {
  423. json: JSON.stringify(form.value)
  424. };
  425. proxy.$axios.post(url, param).then(response => {
  426. if (response.data.code == '0') {
  427. showSuccessToast('保存成功!');
  428. getTableData();
  429. orJsons();
  430. // clearDeptUsers()
  431. } else {
  432. showToast({
  433. type: 'fail',
  434. message: '操作失败!' + response.data.msg
  435. });
  436. }
  437. });
  438. };
  439. //处理人员code
  440. const repairLL = ref('');
  441. const repairOO = ref('');
  442. const acceptLL = ref('');
  443. const orJsons = () => {
  444. // console.log('forms',form.value)
  445. if (form.value.hdSelect === '正常登记') {
  446. nextTick(() => {
  447. nextTick(() => {
  448. repairLL.value = qq('repairLL', form.value.discoverer);//隐患发现人
  449. nextTick(() => {
  450. repairOO.value = qq('repairOO', form.value.discovererOther);//其他隐患发现人
  451. nextTick(() => {
  452. acceptLL.value = qq('acceptLL', form.value.discoverer);//隐患销号人
  453. });
  454. });
  455. });
  456. // acceptOO.value = qq('acceptOO', form.value.acceptOther)
  457. });
  458. } else {
  459. // console.log('noiajdoifjpoewjfopjp')
  460. nextTick(() => {
  461. nextTick(() => {
  462. repairLL.value = qq('repairLL', form.value.acceptLeader);//隐患发现人
  463. nextTick(() => {
  464. repairOO.value = qq('repairOO', form.value.acceptOther);//其他隐患发现人
  465. nextTick(() => {
  466. acceptLL.value = qq('acceptLL', form.value.discoverer);//隐患销号人
  467. });
  468. });
  469. });
  470. // acceptOO.value = qq('acceptOO', form.value.acceptOther)
  471. });
  472. }
  473. };
  474. const jsons = ref({});
  475. const qq = (a, val) => {
  476. let aa = '';
  477. var url = 'sgsafe/Hiddendanger/qqId';
  478. var param = {
  479. params: val
  480. };
  481. proxy.$axios.post(url, param).then(response => {
  482. if (response.data.code == 0) {
  483. aa = response.data.data;
  484. switch (a) {
  485. case 'repairLL':
  486. repairLL.value = response.data.data;
  487. // console.log('repairLL',repairLL.value);
  488. break;
  489. case 'repairOO':
  490. repairOO.value = response.data.data;
  491. // console.log('repairOO',repairLL.value);
  492. break;
  493. case 'acceptLL':
  494. acceptLL.value = response.data.data;
  495. // console.log('acceptLL',repairLL.value);
  496. break;
  497. default:
  498. break;
  499. }
  500. jsons.value = {
  501. hdConfirm: repairLL.value,
  502. hdConfirmO: repairOO.value,
  503. hdCancel: acceptLL.value
  504. };
  505. // 处理函数
  506. function processValue(value) {
  507. // 将逗号替换为分号
  508. const replacedValue = value.replace(/,/g, ';');
  509. // 分割值
  510. const parts = replacedValue.split(';');
  511. // 每个部分前加上 U_
  512. const processedParts = parts.map(part => `U_${part.trim()}`);
  513. // 重新组合
  514. return processedParts.join(';');
  515. }
  516. // 处理整个对象
  517. const processedData = {};
  518. for (const key in jsons.value) {
  519. if (jsons.value.hasOwnProperty(key)) {
  520. processedData[key] = processValue(jsons.value[key]);
  521. }
  522. }
  523. console.log('对象', toRaw(processedData));
  524. let b = {
  525. acceptL: processedData.hdConfirm,
  526. acceptO: processedData.hdConfirmO,
  527. id: form.value.id
  528. };
  529. if (form.value.hdSelect === '即查即改') {
  530. b = {
  531. hdFxr: processedData.hdCancel,
  532. id: form.value.id
  533. };
  534. }
  535. if (form.value.hdSelect === '正常登记') {
  536. b = {
  537. // hdConfirm: processedData.hdConfirm,
  538. // hdConfirmO: processedData.hdConfirmO,
  539. id: form.value.id
  540. };
  541. }
  542. const aaa = JSON.stringify(toRaw(b));
  543. sessionStorage.setItem('variables', aaa);
  544. console.log('aaa', aaa);
  545. } else {
  546. showToast({
  547. type: 'fail',
  548. message: '操作失败!' + response.data.msg
  549. });
  550. }
  551. });
  552. return aa;
  553. };
  554. const reback = () => {
  555. // 返回逻辑
  556. };
  557. const deleteRow = (row) => {
  558. selectedRows.value = [row];
  559. handleDelete(row);
  560. };
  561. const deleteRowa = (row) => {
  562. deleteRow(row);
  563. };
  564. const bm = (val) => {
  565. // 部门选择逻辑
  566. };
  567. //提交审批流程
  568. import { workflowSubmit, workflowCancel } from '@/tools/workflow.js';
  569. const flowId = ref('');
  570. flowId.value = 'hazardManagementFlowId';
  571. const handleSubmit2 = (val, idx) => {
  572. openStatus.value[idx] = !openStatus.value[idx]
  573. openStatus.value = new Array(resultData.value.length).fill(true);
  574. console.log('提交');
  575. console.log('selectedRows', selectedRows.value);
  576. let row = val;
  577. form.value = { ...row }
  578. form.value.workCreate = headers.value.dept;
  579. let b = {
  580. id: form.value.id,
  581. }
  582. const aaa = JSON.stringify(toRaw(b))
  583. sessionStorage.setItem('variables', aaa)
  584. if (form.value.hdSelect === '正常登记') {
  585. flowId.value = 'hazardManagementFlowId'
  586. } else if (form.value.hdSelect === '下发隐患') {
  587. flowId.value = 'hazardImmediatelyCM'
  588. form.value.status = '2'
  589. } else {
  590. flowId.value = 'hazardImmediatelyCMUpdate'
  591. form.value.status = '-1'
  592. }
  593. console.log('----');
  594. console.log(flowId.value);
  595. console.log(sessionStorage.getItem('variables'));
  596. console.log(row.workId);
  597. console.log(row.trackId);
  598. let titles = '隐患排查治理'
  599. showDialog({
  600. title: '提示',
  601. message: '确定提交审批?',
  602. showCancelButton: true,
  603. confirmButtonText: '确定',
  604. type: 'warning',
  605. cancelButtonText: '取消'
  606. }
  607. ).then(() => {
  608. return workflowSubmit(
  609. flowId.value,
  610. '隐患排查治理',
  611. '初始化提交',
  612. // JSON.stringify({}),
  613. sessionStorage.getItem('variables'),
  614. row.workId,
  615. row.trackId);
  616. }).then((result) => {
  617. if (result.status === 'success') {
  618. // 将结果返回的workId和trackId保存
  619. var url = 'sgsafe/Hiddendanger/saveProcessInfo';
  620. console.log('id', result, row.id);
  621. var process = {
  622. 'id': form.value.id,
  623. 'workId': result.workId,
  624. 'trackId': result.trackId
  625. };
  626. var param = {
  627. json: JSON.stringify(process)
  628. };
  629. proxy.$axios.post(url, param).then(response => {
  630. if (response.data.code === 0) {
  631. form.value = response.data.data;
  632. console.log('我要进来啦保存成功');
  633. showToast({
  634. type: 'success',
  635. message: '提交审批成功'
  636. });
  637. onRefresh()
  638. }
  639. });
  640. } else {
  641. showToast({
  642. type: 'error',
  643. message: '提交审批失败,' + result.msg
  644. });
  645. }
  646. }).catch(() => {
  647. showToast({
  648. type: 'info',
  649. message: '已取消提交'
  650. });
  651. });
  652. };
  653. const getStatusClass = (status) => {
  654. switch (status) {
  655. case '相同试题':
  656. return 'status-analyzing';
  657. case '不同试题':
  658. return 'status-rectifying';
  659. default:
  660. return 'status-closed';
  661. }
  662. };
  663. /**
  664. * 按钮实现swipe-cell滑动
  665. */
  666. const openStatus = ref([])
  667. const swipeCellRefs = ref([])
  668. const getSwipeCellRef = (el, index) => {
  669. if (el) {
  670. swipeCellRefs.value[index] = el;
  671. }
  672. }
  673. const openSwipe = (idx) => {
  674. openStatus.value = new Array(resultData.value.length).fill(true);
  675. if (idx >= 0 && idx < swipeCellRefs.value.length) {
  676. openStatus.value[idx] = false
  677. swipeCellRefs.value[idx].open('right')
  678. }
  679. document.addEventListener('click', handleDocumentClick)
  680. }
  681. /**
  682. * 当点击滑动单元格时,开始监听点击事件
  683. */
  684. const handleDocumentClick = (event) => {
  685. openStatus.value = new Array(resultData.value.length).fill(true);
  686. }
  687. const closeSwipe = (idx) => {
  688. if (idx >= 0 && idx < swipeCellRefs.value.length) {
  689. openStatus.value[idx] = true
  690. swipeCellRefs.value[idx].close()
  691. }
  692. }
  693. </script>
  694. <style scoped>
  695. .h5-container {
  696. width: 100%;
  697. padding: 5px;
  698. box-sizing: border-box;
  699. }
  700. .status-pending {
  701. background-color: #fff3cd;
  702. color: #856404;
  703. padding: 2px 4px;
  704. border-radius: 4px;
  705. }
  706. .status-registered {
  707. background-color: #d1ecf1;
  708. color: #0c5460;
  709. padding: 2px 4px;
  710. border-radius: 4px;
  711. }
  712. .status-analyzing {
  713. background-color: #fff8e1;
  714. color: #ff8f00;
  715. padding: 2px 4px;
  716. border-radius: 4px;
  717. }
  718. .status-rectifying {
  719. background-color: #e8f5e9;
  720. color: #2e7d32;
  721. padding: 2px 4px;
  722. border-radius: 4px;
  723. }
  724. .status-accepting {
  725. background-color: #e3f2fd;
  726. color: #1565c0;
  727. padding: 2px 4px;
  728. border-radius: 4px;
  729. }
  730. .status-closed {
  731. background-color: #f8bbd0;
  732. color: #b71c1c;
  733. padding: 2px 4px;
  734. border-radius: 4px;
  735. }
  736. .status-finished {
  737. background-color: #e8eaf6;
  738. color: #311b92;
  739. padding: 2px 4px;
  740. border-radius: 4px;
  741. }
  742. .status-unknown {
  743. background-color: #efebe9;
  744. color: #424242;
  745. padding: 2px 4px;
  746. border-radius: 4px;
  747. }
  748. .cell-title {
  749. display: -webkit-box;
  750. /* 旧版弹性盒子模型 */
  751. -webkit-box-orient: vertical;
  752. /* 内容垂直排列 */
  753. -webkit-line-clamp: 2;
  754. /* 限制显示行数 */
  755. overflow: hidden;
  756. /* 超出隐藏 */
  757. text-overflow: ellipsis;
  758. /* 省略号 */
  759. line-height: 1.5;
  760. /* 可选:设置行高 */
  761. max-height: calc(1.5em * 2);
  762. /* 可选:根据行高限制最大高度 */
  763. font-size: 16px;
  764. font-weight: bold;
  765. color: #333;
  766. /* 字号 */
  767. }
  768. .swipe-cell-default {
  769. display: flex;
  770. background-color: #ffffff;
  771. justify-content: center;
  772. align-items: center;
  773. }
  774. .swipe-cell-default-icon {
  775. width: 60px;
  776. display: flex;
  777. justify-content: center;
  778. }
  779. .delete-button {
  780. height: 100%;
  781. border: none;
  782. color: #ff0000;
  783. background-image: url('@/assets/img/del.png');
  784. background-size: auto 100%;
  785. background-repeat: no-repeat;
  786. }
  787. .submit-button {
  788. height: 100%;
  789. border: none;
  790. color: #07c160;
  791. background-image: url('@/assets/img/sub.png');
  792. background-size: auto 100%;
  793. background-repeat: no-repeat;
  794. }
  795. .subsuccess {
  796. height: 100%;
  797. border: none;
  798. color: #07c160;
  799. background-image: url('@/assets/img/sub1.png');
  800. background-size: auto 100%;
  801. background-repeat: no-repeat;
  802. }
  803. .qr-dialog-content {
  804. display: flex;
  805. flex-direction: column;
  806. align-items: center;
  807. padding: 20px 0;
  808. }
  809. .qr-code {
  810. width: 240px;
  811. height: 240px;
  812. background: #fff;
  813. padding: 8px;
  814. border-radius: 8px;
  815. box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  816. }
  817. .qr-tip {
  818. margin-top: 12px;
  819. font-size: 13px;
  820. color: #666;
  821. text-align: center;
  822. }
  823. </style>