Bez popisu
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.

accident.vue 23KB

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