checkItem.js 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. /*
  2. * @Author: code4eat awesomedema@gmail.com
  3. * @Date: 2024-01-01 10:00:00
  4. * @LastEditors: code4eat awesomedema@gmail.com
  5. * @LastEditTime: 2024-01-01 10:00:00
  6. * @FilePath: /pfmBackMana/mock/checkItem.js
  7. * @Description: 查核项管理mock数据
  8. */
  9. // 查核项分类树mock数据
  10. const checkItemTreeData = [
  11. {
  12. key: '1',
  13. title: '地面干净无水迹',
  14. children: [
  15. {
  16. key: '1-1',
  17. title: '科内无专管',
  18. },
  19. {
  20. key: '1-2',
  21. title: '科内不知晓专管员',
  22. },
  23. {
  24. key: '1-3',
  25. title: '麻醉药品未放入保险柜',
  26. },
  27. {
  28. key: '1-4',
  29. title: '使用PDA时扫描帐后未查看PDA各项信息是否准确',
  30. },
  31. {
  32. key: '1-5',
  33. title: '对无法有效沟通的患者,未让陪同人员除述患者姓名或未查看腕带',
  34. },
  35. ],
  36. },
  37. {
  38. key: '2',
  39. title: '防火门关情况',
  40. children: [
  41. {
  42. key: '2-1',
  43. title: '防火门未正常关闭',
  44. },
  45. {
  46. key: '2-2',
  47. title: '防火门被锁死',
  48. },
  49. ],
  50. },
  51. {
  52. key: '3',
  53. title: '防烟面具、指挥棒、任意门其他应急物品情况',
  54. children: [
  55. {
  56. key: '3-1',
  57. title: '应急物品缺失',
  58. },
  59. {
  60. key: '3-2',
  61. title: '应急物品损坏',
  62. },
  63. ],
  64. },
  65. {
  66. key: '4',
  67. title: '疏散指示灯情况',
  68. children: [
  69. {
  70. key: '4-1',
  71. title: '指示灯不亮',
  72. },
  73. {
  74. key: '4-2',
  75. title: '指示灯损坏',
  76. },
  77. ],
  78. },
  79. {
  80. key: '5',
  81. title: '科室消防安全自查表',
  82. children: [
  83. {
  84. key: '5-1',
  85. title: '未按要求填写自查表',
  86. },
  87. {
  88. key: '5-2',
  89. title: '自查表内容不完整',
  90. },
  91. ],
  92. },
  93. {
  94. key: '6',
  95. title: '消防情况',
  96. children: [
  97. {
  98. key: '6-1',
  99. title: '消防设施损坏',
  100. },
  101. {
  102. key: '6-2',
  103. title: '消防通道堵塞',
  104. },
  105. ],
  106. },
  107. ];
  108. // 查核项列表mock数据
  109. const checkItemListData = {
  110. 1: [
  111. {
  112. id: 1,
  113. name: '科内无专管',
  114. score: 2.0,
  115. description: '科室内未配置专门管理人员',
  116. categoryId: '1',
  117. },
  118. {
  119. id: 2,
  120. name: '科内不知晓专管员',
  121. score: 1.5,
  122. description: '科室人员不知道专管员是谁',
  123. categoryId: '1',
  124. },
  125. {
  126. id: 3,
  127. name: '麻醉药品未放入保险柜',
  128. score: 1.0,
  129. description: '麻醉药品未按规定放入保险柜',
  130. categoryId: '1',
  131. },
  132. {
  133. id: 4,
  134. name: '使用PDA时扫描帐后未查看PDA各项信息是否准确',
  135. score: 0.5,
  136. description: '使用PDA时未核实信息准确性',
  137. categoryId: '1',
  138. },
  139. {
  140. id: 5,
  141. name: '对无法有效沟通的患者,未让陪同人员除述患者姓名或未查看腕带',
  142. score: 1.0,
  143. description: '对沟通困难患者未按规定核实身份',
  144. categoryId: '1',
  145. },
  146. ],
  147. 2: [
  148. {
  149. id: 6,
  150. name: '防火门未正常关闭',
  151. score: 3.0,
  152. description: '防火门应保持关闭状态',
  153. categoryId: '2',
  154. },
  155. {
  156. id: 7,
  157. name: '防火门被锁死',
  158. score: 5.0,
  159. description: '防火门不得锁死,影响疏散',
  160. categoryId: '2',
  161. },
  162. ],
  163. 3: [
  164. {
  165. id: 8,
  166. name: '应急物品缺失',
  167. score: 2.0,
  168. description: '防烟面具、指挥棒等应急物品缺失',
  169. categoryId: '3',
  170. },
  171. {
  172. id: 9,
  173. name: '应急物品损坏',
  174. score: 1.5,
  175. description: '应急物品存在损坏情况',
  176. categoryId: '3',
  177. },
  178. ],
  179. 4: [
  180. {
  181. id: 10,
  182. name: '指示灯不亮',
  183. score: 1.0,
  184. description: '疏散指示灯不能正常工作',
  185. categoryId: '4',
  186. },
  187. {
  188. id: 11,
  189. name: '指示灯损坏',
  190. score: 2.0,
  191. description: '疏散指示灯外观损坏',
  192. categoryId: '4',
  193. },
  194. ],
  195. 5: [
  196. {
  197. id: 12,
  198. name: '未按要求填写自查表',
  199. score: 1.0,
  200. description: '科室未按时填写消防安全自查表',
  201. categoryId: '5',
  202. },
  203. {
  204. id: 13,
  205. name: '自查表内容不完整',
  206. score: 0.5,
  207. description: '自查表填写内容不完整或不准确',
  208. categoryId: '5',
  209. },
  210. ],
  211. 6: [
  212. {
  213. id: 14,
  214. name: '消防设施损坏',
  215. score: 3.0,
  216. description: '消防器材、设施存在损坏',
  217. categoryId: '6',
  218. },
  219. {
  220. id: 15,
  221. name: '消防通道堵塞',
  222. score: 4.0,
  223. description: '消防通道被堵塞,影响疏散',
  224. categoryId: '6',
  225. },
  226. ],
  227. };
  228. let currentId = 16; // 用于新增数据时的ID生成
  229. export default {
  230. // 获取查核项分类树
  231. 'GET /manager/checkItem/getCheckItemTree': (req, res) => {
  232. setTimeout(() => {
  233. res.json({
  234. success: true,
  235. data: checkItemTreeData,
  236. });
  237. }, 200);
  238. },
  239. // 获取查核项列表
  240. 'GET /manager/checkItem/getCheckItemList': (req, res) => {
  241. const { current = 1, pageSize = 10, categoryId, keywords } = req.query;
  242. let data = checkItemListData[categoryId] || [];
  243. // 关键字搜索
  244. if (keywords) {
  245. data = data.filter(
  246. (item) =>
  247. item.name.includes(keywords) ||
  248. (item.description && item.description.includes(keywords)),
  249. );
  250. }
  251. const start = (current - 1) * pageSize;
  252. const end = start + parseInt(pageSize);
  253. const list = data.slice(start, end);
  254. setTimeout(() => {
  255. res.json({
  256. success: true,
  257. list,
  258. totalCount: data.length,
  259. pageSize: parseInt(pageSize),
  260. currPage: parseInt(current),
  261. totalPage: Math.ceil(data.length / pageSize),
  262. });
  263. }, 300);
  264. },
  265. // 新增查核项
  266. 'POST /manager/checkItem/addCheckItem': (req, res) => {
  267. const { name, score, description, categoryId } = req.body;
  268. const newItem = {
  269. id: currentId++,
  270. name,
  271. score,
  272. description,
  273. categoryId,
  274. createTime: new Date().toISOString(),
  275. };
  276. if (!checkItemListData[categoryId]) {
  277. checkItemListData[categoryId] = [];
  278. }
  279. checkItemListData[categoryId].push(newItem);
  280. setTimeout(() => {
  281. res.json({
  282. success: true,
  283. message: '新增成功',
  284. data: newItem,
  285. });
  286. }, 500);
  287. },
  288. // 编辑查核项
  289. 'POST /manager/checkItem/editCheckItem': (req, res) => {
  290. const { id, name, score, description, categoryId } = req.body;
  291. if (checkItemListData[categoryId]) {
  292. const index = checkItemListData[categoryId].findIndex(
  293. (item) => item.id === id,
  294. );
  295. if (index !== -1) {
  296. checkItemListData[categoryId][index] = {
  297. ...checkItemListData[categoryId][index],
  298. name,
  299. score,
  300. description,
  301. updateTime: new Date().toISOString(),
  302. };
  303. }
  304. }
  305. setTimeout(() => {
  306. res.json({
  307. success: true,
  308. message: '编辑成功',
  309. });
  310. }, 500);
  311. },
  312. // 删除查核项
  313. 'POST /manager/checkItem/deleteCheckItem': (req, res) => {
  314. const { id } = req.query;
  315. // 从所有分类中查找并删除
  316. Object.keys(checkItemListData).forEach((categoryId) => {
  317. const index = checkItemListData[categoryId].findIndex(
  318. (item) => item.id == id,
  319. );
  320. if (index !== -1) {
  321. checkItemListData[categoryId].splice(index, 1);
  322. }
  323. });
  324. setTimeout(() => {
  325. res.json({
  326. success: true,
  327. message: '删除成功',
  328. });
  329. }, 500);
  330. },
  331. // 获取分类详情
  332. 'GET /manager/checkItem/getCategoryDetail': (req, res) => {
  333. const { categoryId } = req.query;
  334. // 模拟分类详情数据
  335. const categoryDetails = {
  336. 1: {
  337. id: '1',
  338. name: '地面干净无水迹',
  339. type: 'multiple',
  340. score: 5,
  341. checkMethod: 'observe',
  342. isStatistics: true,
  343. description: '应知应会:疏散通道畅通,无杂物堆品',
  344. },
  345. };
  346. setTimeout(() => {
  347. res.json({
  348. success: true,
  349. data: categoryDetails[categoryId] || null,
  350. });
  351. }, 200);
  352. },
  353. };