华西海圻ELN前端工程
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.

909 lines
26 KiB

  1. <template>
  2. <div class="step-container">
  3. <el-button v-if="isShowAddStep()" type="primary" @click="addStep" icon="el-icon-plus">添加步骤</el-button>
  4. <div class="step-list">
  5. <draggable v-model="steps" ghost-class="ghost" handle=".drag-handle" @end="onDragEnd" :animation="200">
  6. <div v-for="(step, index) in steps" :key="step.id" class="step-list-item">
  7. <div class="step-content">
  8. <i class="el-icon-rank drag-handle" v-if="templateFillType === 'preFill'" style="cursor: move; margin-right: 10px; margin-top: 6px;"></i>
  9. <span class="step-title">{{ index + 1 }}</span>
  10. <HandleFormItem type="select" placeholder="请选择" class="step-type-select" :item="stepSelectConfig"
  11. v-model="step.type" @change="onTypeChange(index)" />
  12. <!-- 根据步骤类型显示对应的表单 -->
  13. <component class="flex1" :sn="step.type" :is="getStepComponent(step.type)" :formData="step.formData"
  14. @update="onFormUpdate(index, $event)" :stepIndex = "index" :ref="'stepCompRef_' + index">
  15. </component>
  16. <div v-if="templateFillType === 'preFill'" class="step-header-item">
  17. <el-popconfirm
  18. @confirm="removeStep(index)"
  19. title="确定删除当前步骤吗?"
  20. >
  21. <el-button type="text" slot="reference" icon="el-icon-delete"
  22. class="delete-btn"></el-button>
  23. </el-popconfirm>
  24. </div>
  25. </div>
  26. </div>
  27. </draggable>
  28. </div>
  29. </div>
  30. </template>
  31. <script>
  32. import draggable from 'vuedraggable';
  33. import { duplicateResource,justUpdateFilledFormData } from '@/utils/index.js';
  34. import HandleFormItem from './HandleFormItem.vue';
  35. import Czdd from './StepComponents/ry/czdd.vue';//溶液-操作地点
  36. import Czhj from './StepComponents/ry/czhj.vue';//溶液-操作方法
  37. import Xzrq from './StepComponents/ry/xzrq.vue';//溶液-选择容器
  38. import Jrry from './StepComponents/ry/jrry.vue';//溶液-加入溶液
  39. import Tpjydd from './StepComponents/ry/tpjydd.vue';//溶液-天平校验(单点)
  40. import Tpjysd from './StepComponents/ry/tpjysd.vue';//溶液-天平校验(双点)
  41. import Qywz from './StepComponents/ry/qywz.vue';//溶液-取用物质
  42. import Clfcz from './StepComponents/ry/clfcz.vue';//溶液-称量(非传值)
  43. import Clcz from './StepComponents/ry/clcz.vue';//溶液-称量(传值)
  44. import Bdtj from './StepComponents/ry/bdtj.vue';//溶液-标定(体积)
  45. import Bdzl from './StepComponents/ry/bdzl.vue';//溶液-标定(质量)
  46. import Tjphcz from './StepComponents/ry/tjphcz.vue';//溶液-调节PH(传值)
  47. import Tjphfcz from './StepComponents/ry/tjphfcz.vue';//溶液-调节PH(非传值)
  48. import Lx from './StepComponents/ry/lx.vue';//溶液-离心
  49. import Hwhy from './StepComponents/ry/hwhy.vue';//溶液-恒温混匀
  50. import Zyhy from './StepComponents/ry/zyhy.vue';//溶液-振摇混匀
  51. import Wxhy from "./StepComponents/ry/wxhy.vue";//溶液-涡旋混匀
  52. import Ddhy from "./StepComponents/ry/ddhy.vue";//溶液-颠倒混匀
  53. import Ym from "./StepComponents/ry/ym.vue";//溶液-研磨
  54. import Jb from "./StepComponents/ry/jb.vue";//溶液-搅拌
  55. import Jrjb from "./StepComponents/ry/jrjb.vue";//溶液-加热搅拌
  56. import Cs from "./StepComponents/ry/cs.vue";//溶液-超声
  57. import Sy from "./StepComponents/ry/sy.vue";//溶液-水浴
  58. import Zy from "./StepComponents/ry/zy.vue";//溶液-正压
  59. import Dc from "./StepComponents/ry/dc.vue";//溶液-氮吹
  60. import Jd from "./StepComponents/ry/jd.vue";//溶液-解冻
  61. import Jz from "./StepComponents/ry/jz.vue";//溶液-静置
  62. import Glzd from "./StepComponents/ry/glzd.vue";//溶液-过滤(自动)
  63. import Glsd from "./StepComponents/ry/glsd.vue";//溶液-过滤(手动)
  64. import Fy from "./StepComponents/ry/fy.vue";//溶液-孵育
  65. import Qcyy from "./StepComponents/ry/qcyy.vue";//溶液-取出原药
  66. import Frdrq from "./StepComponents/ry/frdrq.vue";//溶液-复溶(多容器)
  67. import Fr from "./StepComponents/ry/fr.vue";//溶液-复溶
  68. import Hb from "./StepComponents/ry/hb.vue";//溶液-合并
  69. import Rs from "./StepComponents/ry/rs.vue";//溶液-染色
  70. import Js from "./StepComponents/ry/js.vue";//溶液-计数
  71. import Mj from "./StepComponents/ry/mj.vue";//溶液-灭菌
  72. import Fs from "./StepComponents/ry/fs.vue";//溶液-复苏
  73. import Fb from "./StepComponents/ry/fb.vue";//溶液-封板
  74. import Zlfz from "./StepComponents/ry/zlfz.vue";//溶液-质量分装
  75. //罗开凡新增
  76. import kbyq from "./StepComponents/ry/kbyq.vue";//溶液-空白仪器
  77. import kbsjgsp from "./StepComponents/ry/kbsjgsp.vue";//溶液-空白(试剂/供试品)
  78. import kb from "./StepComponents/ry/kb.vue";//溶液-空白
  79. import jr from "./StepComponents/ry/jr.vue";//溶液-加热
  80. //罗开凡新增
  81. //表配置
  82. import jrry_b from './StepComponents/b/jrry_b.vue';//表配置-加入溶液
  83. //表配置-离心:使用溶液-离心
  84. import cl from './StepComponents/b/cl.vue';//表配置-称量
  85. //表配置-超声:使用溶液-超声
  86. //表配置-恒温混匀:使用溶液-恒温混匀
  87. //表配置-振摇混匀:使用溶液-振摇混匀
  88. //表配置-涡旋混匀:使用溶液-涡旋混匀
  89. //表配置-颠倒混匀:使用溶液-颠倒混匀
  90. //表配置-搅拌:使用溶液-搅拌
  91. //表配置-加热搅拌:使用溶液-加热搅拌
  92. //表配置-水浴:使用溶液-水浴
  93. //表配置-正压:使用溶液-正压
  94. //表配置-氮吹:使用溶液-氮吹
  95. //表配置-过滤(自动):使用溶液-过滤(自动)
  96. //表配置-过滤(手动):使用溶液-过滤(手动)
  97. //表配置-静置:使用溶液-静置
  98. //表配置-解冻:使用溶液-解冻
  99. //表配置-孵育:使用溶液-孵育
  100. //表配置-复溶:使用溶液-复溶
  101. //生物样品分析
  102. //生物样品分析-解冻:使用溶液-解冻
  103. //生物样品分析-涡旋混匀:使用溶液-涡旋混匀
  104. //生物样品分析-选择容器:使用溶液-选择容器
  105. import jryp from './StepComponents/swypfx/jryp.vue';//生物样品分析-加入样品
  106. //生物样品分析-衍生反应:使用溶液-离心
  107. import hhspe from './StepComponents/swypfx/hhspe.vue';//生物样品分析-活化(SPE)
  108. //生物样品分析-平衡(SPE):使用溶液-活化(SPE)
  109. //生物样品分析-上样(SPE):使用溶液-活化(SPE)
  110. //生物样品分析-淋洗(SPE):使用溶液-活化(SPE)
  111. //生物样品分析-洗脱(SPE):使用溶液-活化(SPE)
  112. import zyfc from './StepComponents/swypfx/zyfc.vue';//生物样品分析-转移(分层)
  113. //生物样品分析-氮吹:使用溶液-氮吹
  114. //生物样品分析-正压:使用溶液-正压
  115. //生物样品分析-孵育:使用溶液-孵育
  116. //生物样品分析-复溶:使用溶液-复溶
  117. //色谱匀浆组织表
  118. import jszz from './StepComponents/spyjzzb/jszz.vue';//色谱匀浆组织表-剪碎组织
  119. //色谱匀浆组织表-称取组织:使用色谱匀浆组织表-剪碎组织
  120. import jryjry from './StepComponents/spyjzzb/jryjry.vue';//色谱匀浆组织表-加入匀浆溶液
  121. import ymyj from './StepComponents/spyjzzb/ymyj.vue';//色谱匀浆组织表-研磨匀浆
  122. import yjyfz2 from './StepComponents/spyjzzb/yjyfz2.vue';//色谱匀浆组织表-匀浆液分装2
  123. //色谱匀浆组织表-匀浆液分装3:使用色谱匀浆组织表-匀浆液分装2
  124. import yjbc from './StepComponents/spyjzzb/yjbc.vue';//色谱匀浆组织表-匀浆保存
  125. //色谱匀浆组织表-匀浆液混合:使用色谱匀浆组织表-剪碎组织
  126. //色谱匀浆组织表-加入溶液:使用溶液-加入溶液
  127. import fy_spyjzzb from './StepComponents/spyjzzb/fy_spyjzzb.vue';//色谱匀浆组织表-孵育
  128. //色谱匀浆组织表-天平校验双点:使用溶液-天平校验双点
  129. //色谱匀浆组织表-天平校验单点:使用溶液-天平校验单点
  130. //色谱匀浆组织表-离心:使用溶液-离心
  131. import jz_spyjzzb from './StepComponents/spyjzzb/jz_spyjzzb.vue';//色谱匀浆组织表-静置
  132. //全血稳定性
  133. //全血稳定性-颠倒混匀:使用溶液-颠倒混匀
  134. //全血稳定性-恒温平衡:使用溶液-恒温混匀
  135. import qxfz from './StepComponents/qxwdx/qxfz.vue';//全血稳定性-全血分装
  136. import qxjz from './StepComponents/qxwdx/qxjz.vue';//全血稳定性-全血静置
  137. import qxlx from './StepComponents/qxwdx/qxlx.vue';//全血稳定性-全血离心
  138. //全血稳定性-全血取样:使用全血稳定性-全血静置
  139. //全血稳定性-静置后离心:使用全血稳定性-全血离心
  140. //样品分取
  141. import fq2 from './StepComponents/ypfq/fq2.vue';//样品分取-分取2
  142. //样品分取-分取3:使用样品分取-分取2
  143. import hh from './StepComponents/ypfq/hh.vue';//样品分取-混合
  144. //组织清洗
  145. import qx from './StepComponents/zzqx/qx.vue';//组织清洗-清洗
  146. import zc from './StepComponents/zzqx/zc.vue';//组织清洗-暂存
  147. import qy from './StepComponents/zzqx/qy.vue';//组织清洗-弃液
  148. //PCR
  149. import sjjy from './StepComponents/pcr/sjjy.vue';//PCR-试剂加样
  150. import jryp_pcr from './StepComponents/pcr/jryp_pcr.vue';//PCR-加入样品
  151. import bzyp from './StepComponents/pcr/bzyp.vue';//PCR-补足样品
  152. import jz_pcr from './StepComponents/pcr/jz_pcr.vue';//PCR-静置
  153. import nscyp from './StepComponents/pcr/nscyp.vue';//PCR-NSC样品
  154. import qrhy from './StepComponents/pcr/qrhy.vue';//PCR-轻柔混匀
  155. //PCR-PE板位放置:使用PCR-轻柔混匀
  156. import tgbwfz from './StepComponents/pcr/tgbwfz.vue';//PCR-天根板位放置
  157. //PCR-罗氏板位放置:使用PCR-轻柔混匀
  158. import tqsj from './StepComponents/pcr/tqsj.vue';//PCR-提取上机
  159. import lssj from './StepComponents/pcr/lssj.vue';//PCR-罗氏上机
  160. import yqzt from './StepComponents/pcr/yqzt.vue';//PCR-仪器暂停
  161. import ecsj from './StepComponents/pcr/ecsj.vue';//PCR-二次上机
  162. import czclcl from './StepComponents/pcr/czclcl.vue';//PCR-磁珠残留处理
  163. import ypzy from './StepComponents/pcr/ypzy.vue';//PCR-样品转移
  164. import hsypfz from './StepComponents/pcr/hsypfz.vue';//PCR-核酸样品分装
  165. import ypbc from './StepComponents/pcr/ypbc.vue';//PCR-样品保存
  166. import jd_pcr from './StepComponents/pcr/jd_pcr.vue';//PCR-解冻
  167. import sjjyst from './StepComponents/pcr/sjjyst.vue';//PCR-试剂加样(手提)
  168. import ddhy_pcr from './StepComponents/pcr/ddhy_pcr.vue';//PCR-颠倒混匀
  169. import wxhy_pcr from './StepComponents/pcr/wxhy_pcr.vue';//PCR-涡旋混匀
  170. import sy_pcr from './StepComponents/pcr/sy_pcr.vue';//PCR-水浴
  171. import sslx from './StepComponents/pcr/sslx.vue';//PCR-瞬时离心
  172. import xfzcl from './StepComponents/pcr/xfzcl.vue';//PCR-吸附柱处理
  173. import lxdy from './StepComponents/pcr/lxdy.vue';//PCR-离心(倒液)
  174. import xfzzysjg from './StepComponents/pcr/xfzzysjg.vue';//PCR-吸附柱转移(收集管)
  175. import xfzzylxg from './StepComponents/pcr/xfzzylxg.vue';//PCR-吸附柱转移(离心管)
  176. import xt from './StepComponents/pcr/xt.vue';//PCR-洗脱
  177. import ecxt from './StepComponents/pcr/ecxt.vue';//PCR-二次洗脱
  178. //PCR分析核酸提取浓度测定表
  179. import ndcd from './StepComponents/pcrfx/ndcd.vue';//PCR分析核酸提取浓度测定表-浓度测定
  180. //PCR采集管称重记录表
  181. import jrry_pcrcjg from './StepComponents/pcrcjg/jrry_pcrcjg.vue';//PCR采集管称重记录表-加入溶液
  182. //PCR匀浆表(知管重、知组织重、常规)
  183. import jszz_pcryj from './StepComponents/pcryj/jszz_pcryj.vue';//PCR采集管称重记录表-剪碎组织
  184. import cqzz_pcryj from './StepComponents/pcryj/cqzz_pcryj.vue';//PCR采集管称重记录表-称取组织
  185. import jryjry_pcryj from './StepComponents/pcryj/jryjry_pcryj.vue';//PCR采集管称重记录表-加入匀浆溶液
  186. //PCR采集管称重记录表-研磨匀浆:使用色谱匀浆组织表-研磨匀浆
  187. //PCR采集管称重记录表-水浴:使用PCR分析核酸提取样品处理表-水浴
  188. //PCR采集管称重记录表-离心:使用PCR分析核酸提取样品处理表-水浴
  189. //PCR采集管称重记录表-天平校验(双点):使用溶液-天平校验(双点)
  190. //PCR采集管称重记录表-天平校验(单点):使用溶液-天平校验(单点)
  191. import { public_templateStepList } from '@/api/business/public/public';
  192. // const stepTypes = [
  193. // { label: '操作地点', value: 'czdd' },
  194. // { label: '操作方法', value: 'czhj' },
  195. // { label: '选择容器', value: 'xzrq' },
  196. // { label: '加入溶液', value: 'jrry' },
  197. // { label: '天平校验(单点)', value: 'tpjydd' },
  198. // { label: '天平校验(双点)', value: 'tpjysd' },
  199. // { label: '取用物质', value: 'qywz' },
  200. // { label: '称量(非传值)', value: 'clfcz' },
  201. // { label: '称量(传值)', value: 'clcz' },
  202. // { label: '标定(体积)', value: 'bdtj' },
  203. // { label: '标定(质量)', value: 'bdzl' },
  204. // { label: '调节PH(传值)', value: 'tjphcz' },
  205. // { label: '调节PH(非传值)', value: 'tjphfcz' },
  206. // { label: '离心', value: 'lx' },
  207. // { label: '恒温混匀', value: 'hwhy' },
  208. // { label: '振摇混匀', value: 'zyhy' },
  209. // { label: '涡旋混匀', value: 'wxhy' },
  210. // { label: '颠倒混匀', value: 'ddhy' },
  211. // { label: '研磨', value: 'ym' },
  212. // { label: '搅拌', value: 'jb' },
  213. // { label: '加热搅拌', value: 'jrjb' },
  214. // { label: '超声', value: 'cs' },
  215. // { label: '水浴', value: 'sy' },
  216. // { label: '正压', value: 'zy' },
  217. // { label: '氮吹', value: 'dc' },
  218. // { label: '解冻', value: 'jd' },
  219. // { label: '静置', value: 'jz' },
  220. // { label: '过滤(自动)', value: 'glzd' },
  221. // { label: '过滤(手动)', value: 'glsd' },
  222. // { label: '孵育', value: 'fy' },
  223. // { label: '取出原药', value: 'qcyy' },
  224. // { label: '复溶(多容器)', value: 'frdrq' },
  225. // { label: '复溶', value: 'fr' },
  226. // { label: '合并', value: 'hb' },
  227. // { label: '染色', value: 'rs' },
  228. // { label: '计数', value: 'js' },
  229. // { label: '灭菌', value: 'mj' },
  230. // { label: '复苏', value: 'fs' },
  231. // { label: '封板', value: 'fb' },
  232. // { label: '质量分装', value: 'zlfz' },
  233. // ];
  234. export default {
  235. inject: ['templateFillType','templateData'],
  236. name: 'Step',
  237. props: {
  238. formData: {
  239. type: Array,
  240. default: () => []
  241. }
  242. },
  243. data() {
  244. return {
  245. stepSelectConfig: {
  246. options: [],
  247. fillType: "preFill",
  248. placeholder: "请选择步骤类型"
  249. },
  250. steps: [],
  251. stepId: 1,
  252. componentMap: null
  253. }
  254. },
  255. components: {
  256. draggable,
  257. HandleFormItem,
  258. Czdd,
  259. Czhj,
  260. Xzrq,
  261. Jrry,
  262. Tpjydd,
  263. Tpjysd,
  264. Qywz,
  265. Clfcz,
  266. Clcz,
  267. Bdtj,
  268. Bdzl,
  269. Tjphcz,
  270. Tjphfcz,
  271. Lx,
  272. Hwhy,
  273. Zyhy,
  274. Wxhy,
  275. Ddhy,
  276. Ym,
  277. Jb,
  278. Jrjb,
  279. Cs,
  280. Sy,
  281. Zy,
  282. Dc,
  283. Jd,
  284. Jz,
  285. Glzd,
  286. Glsd,
  287. Fy,
  288. Qcyy,
  289. Frdrq,
  290. Fr,
  291. Hb,
  292. Rs,
  293. Js,
  294. Mj,
  295. Fs,
  296. Fb,
  297. Zlfz,
  298. //罗开凡新增
  299. kbyq,
  300. kbsjgsp,
  301. kb,
  302. jr,
  303. //罗开凡新增
  304. //表配置
  305. jrry_b,
  306. cl,
  307. //生物样品分析
  308. jryp,
  309. hhspe,
  310. zyfc,
  311. //色谱匀浆组织表
  312. jszz,
  313. jryjry,
  314. ymyj,
  315. yjyfz2,
  316. yjbc,
  317. fy_spyjzzb,
  318. jz_spyjzzb,
  319. //全血稳定性
  320. qxfz,
  321. qxjz,
  322. qxlx,
  323. //样品分取
  324. fq2,
  325. hh,
  326. //组织清洗
  327. qx,
  328. zc,
  329. qy,
  330. //PCR
  331. sjjy,
  332. jryp_pcr,
  333. bzyp,
  334. jz_pcr,
  335. nscyp,
  336. qrhy,
  337. tgbwfz,
  338. tqsj,
  339. lssj,
  340. yqzt,
  341. ecsj,
  342. czclcl,
  343. ypzy,
  344. hsypfz,
  345. ypbc,
  346. jd_pcr,
  347. sjjyst,
  348. ddhy_pcr,
  349. wxhy_pcr,
  350. sy_pcr,
  351. sslx,
  352. xfzcl,
  353. lxdy,
  354. xfzzysjg,
  355. xfzzylxg,
  356. xt,
  357. ecxt,
  358. //PCR分析核酸提取浓度测定表
  359. ndcd,
  360. //PCR采集管称重记录表
  361. jrry_pcrcjg,
  362. //PCR匀浆表(知管重、知组织重、常规)
  363. jszz_pcryj,
  364. cqzz_pcryj,
  365. jryjry_pcryj,
  366. },
  367. computed: {
  368. stepComponentMap() {
  369. if (!this.componentMap) {
  370. this.componentMap = {
  371. 'czdd': 'Czdd',
  372. 'czhj': 'Czhj',
  373. 'xzrq': 'Xzrq',
  374. 'jrry': 'Jrry',
  375. 'tpjydd': 'Tpjydd',
  376. 'tpjysd': 'Tpjysd',
  377. 'qywz': 'Qywz',
  378. 'clfcz': 'Clfcz',
  379. 'clcz': 'Clcz',
  380. 'bdtj': 'Bdtj',
  381. 'bdzl': 'Bdzl',
  382. 'tjphcz': 'Tjphcz',
  383. 'tjphfcz': 'Tjphfcz',
  384. 'lx': 'Lx',
  385. 'hwhy': 'Hwhy',
  386. 'zyhy': 'Zyhy',
  387. 'wxhy': 'Wxhy',
  388. 'ddhy': 'Ddhy',
  389. 'ym': 'Ym',
  390. 'jb': 'Jb',
  391. 'jrjb': 'Jrjb',
  392. 'sy': 'Sy',
  393. 'zy': 'Zy',
  394. 'cs': 'Cs',
  395. 'dc': 'Dc',
  396. 'jd': 'Jd',
  397. 'jz': 'Jz',
  398. 'glzd': 'Glzd',
  399. 'glsd': 'Glsd',
  400. 'fy': 'Fy',
  401. 'qcyy': 'Qcyy',
  402. 'frdrq': 'Frdrq',
  403. 'fr': 'Fr',
  404. 'hb': 'Hb',
  405. 'rs': 'Rs',
  406. 'js': 'Js',
  407. 'mj': 'Mj',
  408. 'fs': 'Fs',
  409. 'fb': 'Fb',
  410. 'zlfz': 'Zlfz',
  411. //罗开凡新增
  412. 'kbyq': 'kbyq',
  413. 'kbsjgsp': 'kbsjgsp',
  414. 'kb': 'kb',
  415. 'jr': 'jr',
  416. // 'fz': 'fz',
  417. //罗开凡新增
  418. //标配配置
  419. 'jrry_b': 'jrry_b',
  420. 'cl': 'cl',
  421. 'lx_b': 'Lx',
  422. 'cs_b': 'Cs',
  423. 'hwhy_b': 'Hwhy',
  424. 'zyhy_b': 'Zyhy',
  425. 'wxhy_b': 'Wxhy',
  426. 'ddhy_b': 'Ddhy',
  427. 'jb_b': 'Jb',
  428. 'jrjb_b': 'Jrjb',
  429. 'sy_b': 'Sy',
  430. 'zy_b': 'Zy',
  431. 'dc_b': 'Dc',
  432. 'glzd_b': 'Glzd',
  433. 'glsd_b': 'Glsd',
  434. 'jz_b': 'Jz',
  435. 'jd_b': 'Jd',
  436. 'fy_b': 'Fy',
  437. 'fr_b': 'Fr',
  438. //生物样品分析
  439. 'jd_swypfx': 'Jd',
  440. 'jryp': 'jryp',
  441. 'ysfy': 'Lx',
  442. 'hhspe': 'hhspe',
  443. 'phspe': 'hhspe',
  444. 'syspe': 'hhspe',
  445. 'lxspe': 'hhspe',
  446. 'xtspe': 'hhspe',
  447. 'zyfc': 'zyfc',
  448. //色谱匀浆组织表
  449. 'jszz':'jszz',
  450. 'cqzz':'jszz',
  451. 'jryjry':'jryjry',
  452. 'ymyj':'ymyj',
  453. 'yjyfz2':'yjyfz2',
  454. 'yjyfz3':'yjyfz2',
  455. 'yjbc':'yjbc',
  456. 'yjyhh':'jszz',
  457. 'fy_spyjzzb':'fy_spyjzzb',
  458. 'jz_spyjzzb':'jz_spyjzzb',
  459. //全血稳定性
  460. 'ddhy_qxwdx': 'Ddhy',
  461. 'hwph':'Hwhy',
  462. 'qxfz':'qxfz',
  463. 'qxjz':'qxjz',
  464. 'qxlx':'qxlx',
  465. 'qxqy':'qxjz',
  466. 'jzhlx':'qxlx',
  467. //样品分取
  468. 'fq2':'fq2',
  469. 'fq3':'fq2',
  470. 'hh':'hh',
  471. //组织清洗
  472. 'qx':'qx',
  473. 'zc':'zc',
  474. 'qy':'qy',
  475. //PCR
  476. 'sjjy':'sjjy',
  477. 'jryp_pcr':'jryp_pcr',
  478. 'bzyp':'bzyp',
  479. 'jz_pcr':'jz_pcr',
  480. 'nscyp':'nscyp',
  481. 'qrhy':'qrhy',
  482. 'pebwfz':'qrhy',
  483. 'tgbwfz':'tgbwfz',
  484. 'lsbwfz':'qrhy',
  485. 'tqsj':'tqsj',
  486. 'lssj':'lssj',
  487. 'yqzt':'yqzt',
  488. 'ecsj':'ecsj',
  489. 'czclcl':'czclcl',
  490. 'ypzy':'ypzy',
  491. 'hsypfz':'hsypfz',
  492. 'ypbc':'ypbc',
  493. 'jd_pcr':'jd_pcr',
  494. 'sjjyst':'sjjyst',
  495. 'ddhy_pcr':'ddhy_pcr',
  496. 'wxhy_pcr':'wxhy_pcr',
  497. 'sy_pcr':'sy_pcr',
  498. 'sslx':'sslx',
  499. 'xfzcl':'xfzcl',
  500. 'lxdy':'lxdy',
  501. 'xfzzysjg':'xfzzysjg',
  502. 'xfzzylxg':'xfzzylxg',
  503. 'xt':'xt',
  504. 'ecxt':'ecxt',
  505. //PCR分析核酸提取浓度测定表
  506. 'ndcd':'ndcd',
  507. //PCR采集管称重记录表
  508. 'jrry_pcrcjg':'jrry_pcrcjg',
  509. //PCR匀浆表(知管重、知组织重、常规)
  510. 'jszz_pcryj':'jszz_pcryj',
  511. 'cqzz_pcryj':'cqzz_pcryj',
  512. 'jryjry_pcryj':'jryjry_pcryj',
  513. }
  514. }
  515. return this.componentMap
  516. }
  517. },
  518. created() {
  519. // // 初始化步骤数据
  520. // if (this.value && this.value.length > 0) {
  521. // this.steps = this.value.map((step) => ({
  522. // id: this.stepId++,
  523. // type: step.type || '',
  524. // formData: step.formData || {}
  525. // }))
  526. // } else {
  527. // // 默认添加一个步骤
  528. // this.addStep()
  529. // }
  530. this.getStepList()
  531. },
  532. watch: {
  533. // steps: {
  534. // handler(newVal) {
  535. // this.$emit('input', newVal);
  536. // },
  537. // deep: true
  538. // },
  539. formData: {
  540. handler(newVal) {
  541. if (!newVal || newVal.length === 0) return
  542. this.steps = newVal;
  543. },
  544. deep: true,
  545. immediate: true
  546. }
  547. },
  548. methods: {
  549. onDragEnd(evt) {
  550. justUpdateFilledFormData();
  551. },
  552. getStepList(){
  553. public_templateStepList({templateId:this.templateData.templateId}).then(response => {
  554. let options = []
  555. _.forEach(response.data,(item)=>{
  556. options.push({ label: item.name, value: item.sn })
  557. })
  558. this.stepSelectConfig.options = options
  559. });
  560. },
  561. isShowAddStep() {
  562. return this.templateFillType === 'preFill';
  563. },
  564. addStep() {
  565. try {
  566. this.steps.push({
  567. id: this.stepId++,
  568. type: '',
  569. formData: {}
  570. })
  571. justUpdateFilledFormData();
  572. this.$emit('step-added', this.steps.length)
  573. } catch (error) {
  574. console.error('添加步骤失败:', error)
  575. this.$message.error('添加步骤失败,请重试')
  576. }
  577. },
  578. removeStep(index) {
  579. if (this.steps.length > 1) {
  580. const removedStep = this.steps.splice(index, 1)[0]
  581. justUpdateFilledFormData();
  582. this.$emit('step-removed', { index, step: removedStep, remaining: this.steps.length })
  583. } else {
  584. this.$message.warning('至少需要保留一个步骤')
  585. }
  586. },
  587. onTypeChange(index) {
  588. // 切换步骤类型时重置表单数据,并确保数据更新
  589. const oldType = this.steps[index].type
  590. this.$set(this.steps[index], 'formData', {})
  591. // 可选:添加类型变化的回调
  592. this.$emit('step-type-changed', {
  593. index,
  594. newType: this.steps[index].type,
  595. oldType
  596. })
  597. },
  598. onFormUpdate(stepIndex, formData) {
  599. this.steps[stepIndex].formData = formData
  600. },
  601. getStepComponent(type) {
  602. // 使用计算属性中的映射,提高性能
  603. return this.stepComponentMap[type]
  604. },
  605. // 公共方法:获取所有步骤数据
  606. getFormData() {
  607. return new Promise(async (resolve, reject) => {
  608. // 检查是否有步骤数据
  609. if (this.steps.length === 0) {
  610. // this.$message.error(this.$t('template.common.addStepError'))
  611. reject({ errorType: "step" });
  612. return
  613. }
  614. try {
  615. const stepData = await Promise.all(
  616. this.steps.map(async (step, index) => {
  617. const stepComponentRef = this.$refs[`stepCompRef_${index}`];
  618. if (stepComponentRef && stepComponentRef.length > 0) {
  619. try {
  620. const stepFormData = await stepComponentRef[0].getFormData();
  621. return { type: step.type, formData: stepFormData }
  622. } catch (error) {
  623. // 如果某个步骤的getFormData方法失败,抛出错误
  624. throw error;
  625. }
  626. } else {
  627. // 如果没有找到组件引用,返回原始数据
  628. return { type: step.type, formData: step.formData }
  629. }
  630. })
  631. );
  632. resolve({ stepData });
  633. } catch (error) {
  634. reject(error);
  635. }
  636. })
  637. },
  638. getStepResource(){
  639. const sj = [];
  640. let yq = [];
  641. this.steps.map((step, index) => {
  642. const stepComponentRef = this.$refs[`stepCompRef_${index}`];
  643. if(stepComponentRef && stepComponentRef.length > 0){
  644. const {sjResource,yqResource} = this.$refs[`stepCompRef_${index}`][0]?.getSjResource();
  645. if(sjResource && sjResource.length > 0){
  646. sj.push(...sjResource);
  647. }
  648. if(yqResource && yqResource.length > 0){
  649. yq.push(...yqResource);
  650. }
  651. }
  652. })
  653. const resource = duplicateResource(sj, yq);
  654. return { sjResource: resource.sj, yqResource: resource.yq };
  655. },
  656. // 直接获取表单数据,不做校验
  657. getFilledFormData() {
  658. const stepData = this.steps.map((step, index) => {
  659. const stepComponentRef = this.$refs[`stepCompRef_${index}`];
  660. if(stepComponentRef && stepComponentRef.length > 0){
  661. const stepFormData = this.$refs[`stepCompRef_${index}`][0]?.getFilledFormData();
  662. return { type: step.type, formData: stepFormData }
  663. }else{
  664. return { type: step.type, formData: step.formData }
  665. }
  666. })
  667. return { stepData }
  668. },
  669. // 公共方法:设置步骤数据
  670. setStepData(data) {
  671. if (Array.isArray(data)) {
  672. this.steps = data.map(step => ({
  673. id: this.stepId++,
  674. type: step.type || '',
  675. formData: step.formData || {}
  676. }))
  677. }
  678. },
  679. // 公共方法:重置所有步骤
  680. resetSteps() {
  681. this.steps = [{
  682. id: this.stepId++,
  683. type: '',
  684. formData: {}
  685. }]
  686. this.$emit('steps-reset')
  687. },
  688. // 公共方法:获取指定步骤的数据
  689. getStepDataByIndex(index) {
  690. if (index >= 0 && index < this.steps.length) {
  691. return {
  692. type: this.steps[index].type,
  693. formData: this.steps[index].formData
  694. }
  695. }
  696. return null
  697. },
  698. // 公共方法:验证所有步骤
  699. async validateSteps() {
  700. const errors = []
  701. for (let index = 0; index < this.steps.length; index++) {
  702. const step = this.steps[index];
  703. if (!step.type) {
  704. errors.push(`步骤 ${index + 1}: 请选择步骤类型`)
  705. continue;
  706. }
  707. // 获取当前步骤的组件实例
  708. const stepComponentRef = this.$refs[`stepCompRef_${index}`];
  709. if (stepComponentRef && stepComponentRef.length > 0) {
  710. try {
  711. // 调用子组件的getFormData方法进行验证(不抛出错误,只验证)
  712. await stepComponentRef[0].validateAndMarkRed();
  713. } catch (error) {
  714. // validateAndMarkRed方法不应该抛出错误,但如果有的话捕获它
  715. console.error(`步骤 ${index + 1} 验证时出错:`, error);
  716. }
  717. }
  718. }
  719. return {
  720. isValid: errors.length === 0,
  721. errors
  722. }
  723. },
  724. // 公共方法:批量导入步骤数据
  725. importSteps(stepDataArray) {
  726. if (Array.isArray(stepDataArray)) {
  727. this.steps = stepDataArray.map((step, index) => ({
  728. id: this.stepId++,
  729. type: step.type || '',
  730. formData: step.formData || {}
  731. }))
  732. this.$emit('steps-imported', this.steps.length)
  733. }
  734. },
  735. // 公共方法:获取步骤统计信息
  736. getStepStatistics() {
  737. const stats = {
  738. total: this.steps.length,
  739. byType: {},
  740. filled: 0
  741. }
  742. this.steps.forEach(step => {
  743. // 统计各类型数量
  744. if (step.type) {
  745. stats.byType[step.type] = (stats.byType[step.type] || 0) + 1
  746. }
  747. // 统计已填写的步骤
  748. if (step.type && Object.keys(step.formData).length > 0) {
  749. stats.filled++
  750. }
  751. })
  752. return stats
  753. }
  754. },
  755. }
  756. </script>
  757. <style lang="scss" scoped>
  758. .step-container {
  759. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  760. margin-top: 24px;
  761. padding: 24px;
  762. border-radius: 5px 5px;
  763. .step-header {
  764. margin-bottom: 20px;
  765. padding: 15px;
  766. background: #f5f7fa;
  767. border-radius: 6px;
  768. }
  769. .flex1 {
  770. flex:1
  771. }
  772. .step-list {
  773. padding-top: 10px;
  774. .step-list-item {
  775. page-break-inside: avoid;
  776. padding-top: 10px;
  777. border-radius: 6px;
  778. overflow: hidden;
  779. transition: background-color 0.2s;
  780. &:hover {
  781. // background-color: #f5f7fa;
  782. }
  783. &.ghost {
  784. background-color: transparent !important;
  785. }
  786. .drag-handle {
  787. color: #909399;
  788. transition: color 0.2s;
  789. &:hover {
  790. color: #409eff;
  791. }
  792. }
  793. .step-title {
  794. margin-right: 10px;
  795. margin-top: 6px;
  796. }
  797. .step-type-select {
  798. width: 200px;
  799. margin-right: 10px;
  800. max-width: 200px;
  801. }
  802. .delete-btn {
  803. color: #f56c6c;
  804. &:hover {
  805. color: #f78989;
  806. }
  807. &:disabled {
  808. color: #c0c4cc;
  809. }
  810. }
  811. .step-content {
  812. display: flex;
  813. align-items: flex-start;
  814. }
  815. }
  816. }
  817. }
  818. </style>