add.vue 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829
  1. <template>
  2. <div class="p-2">
  3. <!-- 新增顶部操作栏 -->
  4. <el-row type="flex" align="middle" justify="space-between" style="margin-bottom: 16px;">
  5. <el-col :span="4">
  6. <el-button type="primary" plain @click="close" style="margin-right: 20px;margin-left: 30px;">返回</el-button>
  7. <span style="font-size: 14px; vertical-align: middle;">{{ isEdit ? '修改量表' : '新增量表' }}</span>
  8. </el-col>
  9. <el-col :span="4" style="text-align: right;">
  10. <!-- <el-button type="primary" plain @click="handlePreview" style="margin-right: 8px;">预览</el-button> -->
  11. <el-button type="primary" @click="editConclusion" style="margin-right: 0px;" v-if="isEdit">编辑结论</el-button>
  12. <el-button type="primary" @click="submitForm" style="margin-right: 30px;">保存</el-button>
  13. </el-col>
  14. </el-row>
  15. <el-container class="layout-container-demo" style="height: 100vh; min-height: 100vh;">
  16. <el-aside id="leftPanel"
  17. style="background:transparent; width: 450px; min-width: 300px; max-width: 500px; flex: 0 0 auto; border-right: 2px solid #e4e7ed;">
  18. <div style="background:#f6f9fc; border-radius:4px; margin-bottom: 16px; padding: 16px 0;">
  19. <div style="font-weight:bold; font-size:16px; padding:0 24px 8px 24px; cursor:pointer;"
  20. @click="showSystemParam = !showSystemParam">
  21. 系统参数
  22. <i class="el-icon-arrow-down" :style="{
  23. float: 'right',
  24. transition: 'transform 0.2s',
  25. transform: showSystemParam ? 'rotate(0deg)' : 'rotate(-90deg)'
  26. }"></i>
  27. </div>
  28. <div v-show="showSystemParam" style="padding: 16px 16px 0 16px;">
  29. <div style="font-weight: bold; margin-bottom: 8px;">基本信息</div>
  30. <el-row :gutter="20" style="margin-bottom: 24px;">
  31. <el-col :span="8">
  32. <el-button class="param-btn" plain @click="handleBaseBtnClick('gender', '性别')">性别</el-button>
  33. </el-col>
  34. <el-col :span="8">
  35. <el-button class="param-btn" plain @click="handleBaseBtnClick('birthDate', '出生日期')">出生日期</el-button>
  36. </el-col>
  37. <el-col :span="8">
  38. <el-button class="param-btn" plain @click="handleBaseBtnClick('height', '身高')">身高</el-button>
  39. </el-col>
  40. <el-col :span="8">
  41. <el-button class="param-btn" plain @click="handleBaseBtnClick('weight', '体重')">体重</el-button>
  42. </el-col>
  43. <el-col :span="8">
  44. <el-button class="param-btn" plain @click="handleBaseBtnClick('BMI', 'BMI')">BMI</el-button>
  45. </el-col>
  46. <el-col :span="8">
  47. <el-button class="param-btn" plain
  48. @click="handleBaseBtnClick('nutritionalDiagnosis', '营养诊断')">营养诊断</el-button>
  49. </el-col>
  50. <el-col :span="8">
  51. <el-button class="param-btn" plain @click="handleBaseBtnClick('admissionDate', '入院日期')">入院日期</el-button>
  52. </el-col>
  53. </el-row>
  54. <div style="font-weight: bold; margin-bottom: 8px;">其他</div>
  55. <el-row :gutter="20">
  56. <el-col :span="8">
  57. <el-button class="param-btn" plain
  58. @click="handleOtherBtnClick('otherInfo', 'anthropometry', '人体测量')">人体测量</el-button>
  59. </el-col>
  60. <el-col :span="8">
  61. <el-button class="param-btn" plain
  62. @click="handleOtherBtnClick('otherInfo', 'dietaryStatus', '膳食状况')">膳食状况</el-button>
  63. </el-col>
  64. <el-col :span="8">
  65. <el-button class="param-btn" plain
  66. @click="handleOtherBtnClick('otherInfo', 'nutritionalBiochemical', '营养生化检查')">营养生化检查</el-button>
  67. </el-col>
  68. </el-row>
  69. </div>
  70. </div>
  71. <div style="background:#f6f9fc; border-radius:4px; margin-bottom: 16px; padding: 16px 0;">
  72. <div style="font-weight:bold; font-size:16px; padding:0 24px 8px 24px; cursor:pointer;"
  73. @click="showQuestionType = !showQuestionType">
  74. 题型选择
  75. <i class="el-icon-arrow-down" :style="{
  76. float: 'right',
  77. transition: 'transform 0.2s',
  78. transform: showQuestionType ? 'rotate(0deg)' : 'rotate(-90deg)'
  79. }"></i>
  80. </div>
  81. <div v-show="showQuestionType" style="min-height:40px; padding:0 24px 16px 24px;">
  82. <el-row :gutter="12">
  83. <el-col :span="8"><el-button class="param-btn" plain
  84. @click="handleOtherBtnClick('questionTypeSelection', 'singleChoice', '单选题')">单选题</el-button></el-col>
  85. <el-col :span="8"><el-button class="param-btn" plain
  86. @click="handleOtherBtnClick('questionTypeSelection', 'multipleChoice', '多选题')">多选题</el-button></el-col>
  87. <el-col :span="8"><el-button class="param-btn" plain
  88. @click="handleOtherBtnClick('questionTypeSelection', 'fillBlanks', '填空题')">填空题</el-button></el-col>
  89. <el-col :span="8"><el-button class="param-btn" plain
  90. @click="handleOtherBtnClick('questionTypeSelection', 'scaleQuestions', '量表题')">量表题</el-button></el-col>
  91. <el-col :span="8"><el-button class="param-btn" plain
  92. @click="handleOtherBtnClick('questionTypeSelection', 'matrixScale', '矩阵量表')">矩阵量表</el-button></el-col>
  93. </el-row>
  94. </div>
  95. </div>
  96. </el-aside>
  97. <el-container>
  98. <el-main style="padding-left: 20px;">
  99. <el-scrollbar>
  100. <div style="width: 50%;">
  101. <el-form label-width="100px" label-position="left" :model="form" ref="screeningAssessmentConfigFormRef">
  102. <el-form-item label="量表类型:" required>
  103. <el-radio-group v-model="form.type">
  104. <el-radio :label="item.label" :value="item.value" v-for="item in scale_type" :key="item.value" />
  105. </el-radio-group>
  106. </el-form-item>
  107. <el-form-item label="适用条件:" required>
  108. <!-- 可留空或加说明 -->
  109. </el-form-item>
  110. <el-form-item label="性别:" style="margin-left: 20px;">
  111. <el-radio-group v-model="form.gender" style="margin-left: -50px;">
  112. <el-radio label="不限" value="-1">不限</el-radio>
  113. </el-radio-group>
  114. </el-form-item>
  115. <el-form-item label="年龄:" style="margin-left: 20px;">
  116. <el-radio-group v-model="form.age" style="margin-left: -50px;">
  117. <el-radio label="不限" style="width: 50%" value="-1">不限</el-radio>
  118. </el-radio-group>
  119. </el-form-item>
  120. <el-form-item label="量表名称:" required>
  121. <el-input v-model="form.name" maxlength="50" show-word-limit placeholder="请输入" />
  122. </el-form-item>
  123. <el-form-item label="量表说明:">
  124. <el-input v-model="form.description" maxlength="50" show-word-limit placeholder="请输入" />
  125. </el-form-item>
  126. <el-form-item label="备注:">
  127. <el-input type="textarea" v-model="form.remark" maxlength="500" show-word-limit placeholder="请输入"
  128. :rows="3" />
  129. </el-form-item>
  130. </el-form>
  131. </div>
  132. <div v-if="baseInfo.questionType" @click="selectBaseInfo" :class="{ selectedDiv: baseInfo.selected }">
  133. <span>&nbsp;</span>
  134. <div style="width: 50%;margin-top: 32px;">
  135. <el-form label-width="100px" label-position="left">
  136. <el-form-item label="1. 标题:" required>
  137. <el-input :value="baseInfo.title" readonly size="large" />
  138. </el-form-item>
  139. <div style="margin-left: 60px;">
  140. <template v-for="ctl in baseInfo.contentList">
  141. <el-form-item label="填空:">
  142. <el-input v-model="ctl.label" readonly style="margin-left: -50px;" size="large">
  143. <template #append><el-button @click="handleBaseBtnDelete(ctl.nameEn)">-</el-button></template>
  144. </el-input>
  145. </el-form-item>
  146. </template>
  147. </div>
  148. </el-form>
  149. </div>
  150. <div style="display: flex; align-items: right;justify-content: right;padding-right: 50px;"
  151. v-show="baseInfo.selected">
  152. <el-button type="primary" icon="Delete" plain @click="deleteBaseInfo">删除</el-button>
  153. </div>
  154. <span>&nbsp;</span>
  155. </div>
  156. <template v-for="other, index in otherInfo">
  157. <div style="overflow-x: scroll;" v-if="other.questionChildType == 'scaleQuestions'">
  158. <div class="custom-radio-grid">
  159. <div v-for="n in other.contentList.length" :key="n"
  160. :class="['custom-radio-cell', { 'is-checked': other.contentList.length === n, 'is-last': n > 1 }]">
  161. {{ n }}
  162. </div>
  163. </div>
  164. <div class="custom-radio-grid">
  165. <div v-for="ctl, n in other.contentList" :key="ctl.nameEn" style="border: none;"
  166. :class="['custom-radio-cell']">
  167. {{ ctl.label }}
  168. </div>
  169. </div>
  170. </div>
  171. <div style="border-bottom: 1px solid #e5e7eb;width: 98%;" v-if="other.questionChildType == 'matrixScale'">
  172. <el-row :gutter="10" class="mb8">
  173. <el-col :span="3" style="margin-top: 30px;">
  174. </el-col>
  175. <template v-for="clt in other.contentList">
  176. <template v-if="clt.optionFlag">
  177. <el-col :span="1" align="center" style="margin-top: 30px;margin-left: 30px;">
  178. {{ clt.optionContent }}
  179. </el-col>
  180. </template>
  181. </template>
  182. </el-row>
  183. <template v-for="clt, idx in other.contentList">
  184. <el-row :gutter="10" class="mb8">
  185. <el-col :span="3" style="margin-top: 10px;">
  186. <template v-if="clt.labelFlag">
  187. 标题{{ idx + 1 }}:{{ clt.label }}
  188. </template>
  189. </el-col>
  190. <template v-for="clt2, idx in other.contentList">
  191. <el-col :span="1" align="center" style="margin-left: 30px;">
  192. <template v-if="clt2.optionFlag && clt.labelFlag">
  193. <el-radio-group>
  194. <el-radio value="1" size="large" />
  195. </el-radio-group>
  196. </template>
  197. </el-col>
  198. </template>
  199. </el-row>
  200. </template>
  201. </div>
  202. <div style="border-bottom: 1px solid #e5e7eb;width: 98%;" :class="{ selectedDiv: other.selected }"
  203. @click="selectOtherInfo(index)">
  204. <span>&nbsp;</span>
  205. <template v-if="other.questionType != 'questionTypeSelection'">
  206. <el-row :gutter="10" class="mb8">
  207. <el-col :span="12">
  208. <el-form-item :label="(index + 1 + (baseInfo.contentList.length > 0 ? 1 : 0)) + '. 标题:'" required>
  209. <el-input readonly style="width: 100%;" v-model="other.title" size="large" />
  210. </el-form-item>
  211. </el-col>
  212. <el-col :span="2" align="center">
  213. </el-col>
  214. <el-col :span="3">
  215. </el-col>
  216. <el-col :span="3">
  217. </el-col>
  218. <el-col :span="4">
  219. </el-col>
  220. </el-row>
  221. </template>
  222. <template v-if="other.questionType == 'questionTypeSelection'">
  223. <el-row :gutter="10" class="mb8">
  224. <el-col :span="12">
  225. <el-form-item :label="(index + 1 + (baseInfo.contentList.length > 0 ? 1 : 0)) + '. 标题:'" required>
  226. <el-input style="width: 100%;" v-model="other.title" placeholder="请输入标题" size="large"
  227. show-word-limit maxlength="150" />
  228. </el-form-item>
  229. </el-col>
  230. <el-col :span="2" align="center">
  231. <el-checkbox label="是否必填" v-model="other.required" />
  232. </el-col>
  233. <el-col :span="3">
  234. <el-select v-model="other.arrangement" placeholder="请选择" clearable
  235. v-if="other.questionChildType == 'multipleChoice' || other.questionChildType == 'singleChoice' || other.questionChildType == 'fillBlanks'">
  236. <el-option v-for="dict in arrangement_method" :key="dict.value" :label="dict.label"
  237. :value="dict.value"></el-option>
  238. </el-select>
  239. </el-col>
  240. <el-col :span="5">
  241. <div v-if="other.questionChildType == 'multipleChoice'">
  242. <el-form-item label="计分方式" id="jffs">
  243. <el-select v-model="other.scoreMethod" placeholder="请选择" clearable>
  244. <el-option v-for="dict in score_method" :key="dict.value" :label="dict.label"
  245. :value="dict.value"></el-option>
  246. </el-select>
  247. </el-form-item>
  248. </div>
  249. </el-col>
  250. <el-col :span="2">
  251. </el-col>
  252. </el-row>
  253. </template>
  254. <el-row :gutter="10" class="mb8" v-if="other.questionChildType == 'singleChoice'"
  255. style="background-color: #e5e7eb;height: 40px;line-height: 40px;width: 98%;">
  256. <el-col :span="12">
  257. <div style="text-align: center;">选项(单选)</div>
  258. </el-col>
  259. <el-col :span="2">
  260. <div style="text-align: center;">添加图片</div>
  261. </el-col>
  262. <el-col :span="3">
  263. <div style="text-align: center;">分值设置</div>
  264. </el-col>
  265. <el-col :span="3">
  266. <div style="text-align: left;">允许填空</div>
  267. </el-col>
  268. <el-col :span="4">
  269. </el-col>
  270. </el-row>
  271. <el-row :gutter="10" class="mb8" v-if="other.questionChildType == 'multipleChoice'"
  272. style="background-color: #e5e7eb;height: 40px;line-height: 40px;width: 98%;">
  273. <el-col :span="12">
  274. <div style="text-align: center;"> 选项(多选)</div>
  275. </el-col>
  276. <el-col :span="2">
  277. <div style="text-align: center;">添加图片</div>
  278. </el-col>
  279. <el-col :span="3">
  280. <div style="text-align: center;">分值设置</div>
  281. </el-col>
  282. <el-col :span="3">
  283. <div style="text-align: left;">允许填空</div>
  284. </el-col>
  285. <el-col :span="4">
  286. </el-col>
  287. </el-row>
  288. <el-row :gutter="10" class="mb8" v-if="other.questionChildType == 'matrixScale'"
  289. style="background-color: #e5e7eb;height: 40px;line-height: 40px;width: 98%;">
  290. <el-col :span="10">
  291. <div style="text-align: center;"> 选项题目(矩阵量表)</div>
  292. </el-col>
  293. <el-col :span="4">
  294. <div style="text-align: center;">选项内容</div>
  295. </el-col>
  296. <el-col :span="3">
  297. <div style="text-align: center;">分值设置</div>
  298. </el-col>
  299. <el-col :span="3">
  300. <div style="text-align: left;">允许填空</div>
  301. </el-col>
  302. <el-col :span="4">
  303. </el-col>
  304. </el-row>
  305. <el-row :gutter="10" class="mb8"
  306. v-if="other.questionChildType == 'anthropometry' && other.lastType == '2'"
  307. style="background-color: #e5e7eb;height: 40px;line-height: 40px;width: 98%;">
  308. <el-col :span="12">
  309. <div style="text-align: center;">选项(单选)</div>
  310. </el-col>
  311. <el-col :span="2">
  312. </el-col>
  313. <el-col :span="3">
  314. </el-col>
  315. <el-col :span="3">
  316. </el-col>
  317. <el-col :span="4">
  318. </el-col>
  319. </el-row>
  320. <el-row :gutter="10" class="mb8" v-if="(other.questionChildType == 'anthropometry' && other.lastType == '4')
  321. || (other.questionChildType == 'dietaryStatus' && other.lastType == '2')"
  322. style="background-color: #e5e7eb;height: 40px;line-height: 40px;width: 98%;">
  323. <el-col :span="12">
  324. <div style="text-align: center;">选项(单选)</div>
  325. </el-col>
  326. <el-col :span="2">
  327. <div style="text-align: center;">分值设置</div>
  328. </el-col>
  329. <el-col :span="3">
  330. </el-col>
  331. <el-col :span="3">
  332. </el-col>
  333. <el-col :span="4">
  334. </el-col>
  335. </el-row>
  336. <el-row :gutter="10" class="mb8" v-if="other.questionChildType == 'scaleQuestions'"
  337. style="background-color: #e5e7eb;height: 40px;line-height: 40px;width: 98%;">
  338. <el-col :span="12">
  339. <div style="text-align: center;">选项(量表)</div>
  340. </el-col>
  341. <el-col :span="2">
  342. <div style="text-align: center;">分值设置</div>
  343. </el-col>
  344. <el-col :span="3">
  345. </el-col>
  346. <el-col :span="3">
  347. </el-col>
  348. <el-col :span="4">
  349. </el-col>
  350. </el-row>
  351. <el-row :gutter="10" class="mb8" v-if="other.questionChildType == 'fillBlanks'"
  352. style="background-color: #e5e7eb;height: 40px;line-height: 40px;width: 98%;">
  353. <el-col :span="12">
  354. <div style="text-align: center;">选项(填空)</div>
  355. </el-col>
  356. <el-col :span="2">
  357. <div style="text-align: center;">添加图片</div>
  358. </el-col>
  359. <el-col :span="3">
  360. <div style="text-align: center;">分值设置</div>
  361. </el-col>
  362. <el-col :span="3">
  363. <div style="text-align: left;">单位</div>
  364. </el-col>
  365. <el-col :span="4">
  366. </el-col>
  367. </el-row>
  368. <template v-if="other.questionChildType == 'singleChoice' || other.questionChildType == 'fillBlanks'
  369. || other.questionChildType == 'multipleChoice'">
  370. <template v-for="ctl, idx in other.contentList">
  371. <el-row :gutter="10" class="mb8" style="margin-top: 20px;width: 98%;">
  372. <el-col :span="12">
  373. <el-form-item required style="margin-left: 40px;">
  374. <el-radio-group>
  375. <el-radio :disabled="true">
  376. 选项{{ idx + 1 }}:
  377. <el-input size="large" style="width: 430px;" v-model="ctl.label" show-word-limit
  378. maxlength="150">
  379. <template #prepend><el-button
  380. @click="handleOtherBtnAdd(index, other.questionChildType)">+</el-button></template>
  381. <template #append><el-button
  382. @click="handleOtherBtnDelete(index, idx)">-</el-button></template>
  383. </el-input>
  384. </el-radio>
  385. </el-radio-group>
  386. </el-form-item>
  387. </el-col>
  388. <el-col :span="2" align="center" style="margin-top: -5px;">
  389. <miniImageUpload :limit="1" v-model="ctl.img" />
  390. </el-col>
  391. <el-col :span="3" align="center" style="margin-top: -5px;">
  392. <el-input style="width: 60px;" size="large" v-model="ctl.score" />
  393. </el-col>
  394. <el-col :span="3" align="left" style="margin-top: -5px;">
  395. <template v-if="other.questionChildType == 'fillBlanks'">
  396. <el-input style="width: 40px;" size="large" v-model="ctl.unit" />
  397. </template>
  398. <template v-if="other.questionChildType != 'fillBlanks'">
  399. <el-checkbox v-model="ctl.allowFillBlank" />
  400. </template>
  401. </el-col>
  402. <el-col :span="4" align="center">
  403. </el-col>
  404. </el-row>
  405. </template>
  406. </template>
  407. <template v-if="other.questionChildType == 'matrixScale'">
  408. <template v-for="ctl, idx in other.contentList">
  409. <el-row :gutter="10" class="mb8" style="margin-top: 20px;width: 98%;">
  410. <el-col :span="10" style="margin-top: -5px;">
  411. <template v-if="ctl.labelFlag">
  412. <el-form-item required style="margin-left: 40px;">
  413. 行标题{{ idx + 1 }}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  414. <el-input size="large" style="width: 330px;" v-model="ctl.label" show-word-limit
  415. maxlength="150">
  416. <template #prepend><el-button
  417. @click="handleMatrixScaleAdd(index, idx, true)">+</el-button></template>
  418. <template #append><el-button
  419. @click="handleMatrixScaleDelete(index, idx, true)">-</el-button></template>
  420. </el-input>
  421. </el-form-item>
  422. </template>
  423. </el-col>
  424. <el-col :span="4" align="center" style="margin-top: -5px;">
  425. <template v-if="ctl.optionFlag">
  426. <el-input size="large" v-model="ctl.optionContent" show-word-limit maxlength="150">
  427. <template #prepend><el-button
  428. @click="handleMatrixScaleAdd(index, idx, false)">+</el-button></template>
  429. <template #append><el-button
  430. @click="handleMatrixScaleDelete(index, idx, false)">-</el-button></template>
  431. </el-input>
  432. </template>
  433. </el-col>
  434. <el-col :span="3" align="center" style="margin-top: -5px;">
  435. <el-input style="width: 60px;" size="large" v-model="ctl.score" />
  436. </el-col>
  437. <el-col :span="3" align="left" style="margin-top: -5px;">
  438. <el-checkbox v-model="ctl.allowFillBlank" />
  439. </el-col>
  440. <el-col :span="4" align="center">
  441. </el-col>
  442. </el-row>
  443. </template>
  444. </template>
  445. <template v-if="(other.questionChildType == 'anthropometry' && (other.lastType == '1' || other.lastType == '3')
  446. || (other.questionChildType == 'dietaryStatus' && other.lastType != '2'))">
  447. <template v-for="ctl, idx in other.contentList">
  448. <el-row :gutter="10" class="mb8" :style="{ marginTop: idx == 0 ? '20px' : '0px' }"
  449. style="width: 98%;">
  450. <el-col :span="12">
  451. <div style="margin-left: 60px;margin-top: -15px;">
  452. <el-form-item label="填空:">
  453. <el-input readonly size="large" v-model="ctl.label">
  454. <template #append><el-button
  455. @click="handleOtherBtnDelete(index, idx)">-</el-button></template>
  456. </el-input>
  457. </el-form-item>
  458. </div>
  459. </el-col>
  460. <el-col :span="2" align="center" style="margin-top: -5px;">
  461. </el-col>
  462. <el-col :span="3" align="center">
  463. </el-col>
  464. <el-col :span="3" align="center">
  465. </el-col>
  466. <el-col :span="4" align="center">
  467. </el-col>
  468. </el-row>
  469. </template>
  470. </template>
  471. <template v-if="((other.questionChildType == 'anthropometry' && other.lastType == '4')
  472. || (other.questionChildType == 'dietaryStatus' && other.lastType == '2'))">
  473. <template v-for="ctl, idx in other.contentList">
  474. <el-row :gutter="10" class="mb8" :style="{ marginTop: idx == 0 ? '20px' : '0px' }"
  475. style="width: 98%;">
  476. <el-col :span="12">
  477. <el-form-item required style="margin-left: 40px;"
  478. :style="{ marginTop: idx == 0 ? '0px' : '-5px' }">
  479. <el-radio-group>
  480. <el-radio :disabled="true">
  481. 选项{{ idx + 1 }}:
  482. <el-input readonly size="large" style="width: 430px;" v-model="ctl.label">
  483. <template #append><el-button
  484. @click="handleOtherBtnDelete(index, idx)">-</el-button></template>
  485. </el-input>
  486. </el-radio>
  487. </el-radio-group>
  488. </el-form-item>
  489. </el-col>
  490. <el-col :span="2" align="center" style="margin-top: -5px;">
  491. <el-input style="width: 60px;" v-model="ctl.score" size="large" />
  492. </el-col>
  493. <el-col :span="3" align="center">
  494. </el-col>
  495. <el-col :span="3" align="center">
  496. </el-col>
  497. <el-col :span="4" align="center">
  498. </el-col>
  499. </el-row>
  500. </template>
  501. </template>
  502. <template v-if="other.questionChildType == 'scaleQuestions'">
  503. <template v-for="ctl, idx in other.contentList">
  504. <el-row :gutter="10" class="mb8" :style="{ marginTop: idx == 0 ? '20px' : '0px' }"
  505. style="width: 98%;">
  506. <el-col :span="12">
  507. <el-form-item required style="margin-left: 40px;"
  508. :style="{ marginTop: idx == 0 ? '0px' : '-5px' }">
  509. {{ idx + 1 }}:
  510. <el-input size="large" style="width: 430px;" v-model="ctl.label" show-word-limit
  511. maxlength="150">
  512. <template #prepend><el-button
  513. @click="handleOtherBtnAdd(index, other.questionChildType)">+</el-button></template>
  514. <template #append><el-button
  515. @click="handleOtherBtnDelete(index, idx)">-</el-button></template>
  516. </el-input>
  517. </el-form-item>
  518. </el-col>
  519. <el-col :span="2" align="center" style="margin-top: -5px;">
  520. <el-input style="width: 60px;" v-model="ctl.score" size="large" />
  521. </el-col>
  522. <el-col :span="3" align="center">
  523. </el-col>
  524. <el-col :span="3" align="center">
  525. </el-col>
  526. <el-col :span="4" align="center">
  527. </el-col>
  528. </el-row>
  529. </template>
  530. </template>
  531. <template v-if="(other.questionChildType == 'anthropometry' && other.lastType == '2'
  532. || (other.questionChildType == 'dietaryStatus' && other.lastType == '12'))">
  533. <template v-for="ctl, idx in other.contentList">
  534. <el-row :gutter="10" class="mb8" :style="{ marginTop: idx == 0 ? '20px' : '0px' }"
  535. style="width: 98%;">
  536. <el-col :span="12">
  537. <el-form-item required style="margin-left: 40px;"
  538. :style="{ marginTop: idx == 0 ? '0px' : '-5px' }">
  539. <el-radio-group>
  540. <el-radio :disabled="true">
  541. 选项{{ idx + 1 }}:
  542. <el-input readonly size="large" style="width: 430px;" v-model="ctl.label">
  543. <template #append><el-button
  544. @click="handleOtherBtnDelete(index, idx)">-</el-button></template>
  545. </el-input>
  546. </el-radio>
  547. </el-radio-group>
  548. </el-form-item>
  549. </el-col>
  550. <el-col :span="2" align="center" style="margin-top: -5px;">
  551. </el-col>
  552. <el-col :span="3" align="center">
  553. </el-col>
  554. <el-col :span="3" align="center">
  555. </el-col>
  556. <el-col :span="4" align="center">
  557. </el-col>
  558. </el-row>
  559. </template>
  560. </template>
  561. <div style="display: flex; align-items: right;justify-content: right;padding-right: 50px;"
  562. v-show="other.selected">
  563. <el-button type="primary" icon="Top" plain :disabled="index == 0"
  564. @click="moveUp(index)">上移</el-button>
  565. <el-button type="primary" icon="Bottom" plain :disabled="index + 1 == otherInfo.length"
  566. @click="moveDown(index)">下移</el-button>
  567. <el-button type="primary" icon="Upload" plain :disabled="index == 0"
  568. @click="topUp(index)">置顶</el-button>
  569. <el-button type="primary" icon="Download" plain :disabled="index + 1 == otherInfo.length"
  570. @click="bottomUp(index)">置底</el-button>
  571. <el-button type="primary" icon="Delete" plain @click="deleteOtherInfo(index)">删除</el-button>
  572. </div>
  573. <span>&nbsp;</span>
  574. </div>
  575. </template>
  576. </el-scrollbar>
  577. </el-main>
  578. </el-container>
  579. </el-container>
  580. <!-- 修改结论 -->
  581. <el-dialog :title="dialog.title" v-model="dialog.visible" width="1000px" append-to-body>
  582. <el-row style="margin-bottom: 5px;" v-for="(item, index) in conclusionList">
  583. <el-col :span="4">
  584. <el-input v-model="item.min" placeholder="请输入" />
  585. </el-col>
  586. <el-col :span="1">
  587. <div style="margin-top: 5px;">分</div>
  588. </el-col>
  589. <el-col :span="1">
  590. <div style="margin-top: 5px;">-</div>
  591. </el-col>
  592. <el-col :span="4">
  593. <el-input v-model="item.max" placeholder="请输入" />
  594. </el-col>
  595. <el-col :span="1">
  596. <div style="margin-top: 5px;">分</div>
  597. </el-col>
  598. <el-col :span="9">
  599. <el-input v-model="item.text" placeholder="请输入结论" type="textarea" />
  600. </el-col>
  601. <el-col :span="1">
  602. </el-col>
  603. <el-col :span="2">
  604. <div class="action-buttons">
  605. <el-button class="icon-btn" @click="addRow()">
  606. <el-icon>
  607. <Plus />
  608. </el-icon>
  609. </el-button>
  610. <el-button class="icon-btn" @click="delRow(index)">
  611. <el-icon>
  612. <Delete />
  613. </el-icon>
  614. </el-button>
  615. </div>
  616. </el-col>
  617. </el-row>
  618. <template #footer>
  619. <div class="dialog-footer">
  620. <el-button :loading="buttonLoading" type="primary" @click="submitConclusionForm">确 定</el-button>
  621. <el-button @click="cancel">取 消</el-button>
  622. </div>
  623. </template>
  624. </el-dialog>
  625. </div>
  626. </template>
  627. <script setup name="ScreeningAssessmentConfig" lang="ts">
  628. import { ref, onMounted, onUnmounted } from 'vue';
  629. import { updateConclusion, getScreeningAssessmentConfig, delScreeningAssessmentConfig, addScreeningAssessmentConfig, updateScreeningAssessmentConfig } from '@/api/system/screeningAssessmentConfig';
  630. import { ScreeningAssessmentConfigVO, ScreeningAssessmentConfigQuery, ScreeningAssessmentConfigForm, QuestionAttrVO, QuestionVO } from '@/api/system/screeningAssessmentConfig/types';
  631. const route = useRoute();
  632. const showSystemParam = ref(true);
  633. const showQuestionType = ref(true);
  634. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  635. const { arrangement_method, score_method, scale_type } = toRefs<any>(proxy?.useDict('scale_type', 'arrangement_method', 'score_method'));
  636. const buttonLoading = ref(false);
  637. const loading = ref(true);
  638. const ids = ref<Array<string | number>>([]);
  639. const conclusionList = ref([{ min: null, max: null, text: null }]);
  640. const isEdit = ref(false);
  641. const baseInfo = ref<QuestionVO>({
  642. questionId: '',
  643. title: '',
  644. questionType: '',
  645. content: '',
  646. selected: false,
  647. contentList: [],
  648. });
  649. const otherInfo = ref<QuestionVO[]>([]);
  650. const screeningAssessmentConfigFormRef = ref<ElFormInstance>();
  651. const dialog = reactive<DialogOption>({
  652. visible: false,
  653. title: '修改结论'
  654. });
  655. const initFormData: ScreeningAssessmentConfigForm = {
  656. configId: undefined,
  657. type: '1',
  658. gender: '-1',
  659. age: '-1',
  660. name: undefined,
  661. conclusion: undefined,
  662. description: undefined,
  663. remark: undefined,
  664. status: undefined,
  665. baseInfo: undefined,
  666. otherInfo: undefined
  667. }
  668. const data = reactive<PageData<ScreeningAssessmentConfigForm, ScreeningAssessmentConfigQuery>>({
  669. form: { ...initFormData },
  670. queryParams: {
  671. pageNum: 1,
  672. pageSize: 10,
  673. type: undefined,
  674. gender: undefined,
  675. age: undefined,
  676. name: undefined,
  677. description: undefined,
  678. status: undefined,
  679. params: {
  680. }
  681. },
  682. rules: {
  683. age: [
  684. { required: true, message: "年龄不能为空", trigger: "blur" }
  685. ],
  686. gender: [
  687. { required: true, message: "性别不能为空", trigger: "blur" }
  688. ],
  689. type: [
  690. { required: true, message: "量表类型不能为空", trigger: "change" }
  691. ],
  692. name: [
  693. { required: true, message: "量表名称不能为空", trigger: "blur" }
  694. ],
  695. }
  696. });
  697. const { queryParams, form, rules } = toRefs(data);
  698. /** 查询筛查/评估配置列表 */
  699. const getList = async () => {
  700. const eId = route.params && route.params.id;
  701. const vId = route.params && route.params.vid;
  702. let id = undefined;
  703. if (vId) {
  704. id = vId;
  705. } else {
  706. id = eId;
  707. }
  708. if (id && id != '0') {
  709. isEdit.value = true;
  710. loading.value = true;
  711. const res = await getScreeningAssessmentConfig(id as string);
  712. Object.assign(form.value, res.data);
  713. if(form.value.conclusion){
  714. conclusionList.value=JSON.parse(form.value.conclusion);
  715. form.value.conclusion=null;
  716. }
  717. if (res.data.baseInfo) {
  718. baseInfo.value = res.data.baseInfo;
  719. }
  720. if (res.data.otherInfo) {
  721. otherInfo.value = res.data.otherInfo;
  722. otherInfo.value.forEach(item => {
  723. item.increment = item.contentList.length;
  724. });
  725. }
  726. loading.value = false;
  727. }
  728. }
  729. const addRow = () => {
  730. conclusionList.value.push({ min: null, max: null, text: null });
  731. }
  732. const submitConclusionForm = async () => {
  733. let param = ref<ScreeningAssessmentConfigForm>({});
  734. param.value.conclusion = JSON.stringify(conclusionList.value);
  735. param.value.configId=form.value.configId;
  736. await updateConclusion(param.value);
  737. proxy?.$modal.msgSuccess("操作成功");
  738. dialog.visible = false;
  739. }
  740. const delRow = (index: number) => {
  741. conclusionList.value.splice(index, 1);
  742. }
  743. /** 取消按钮 */
  744. const cancel = () => {
  745. dialog.visible = false;
  746. }
  747. /** 编辑结论 */
  748. const editConclusion = () => {
  749. dialog.visible = true;
  750. }
  751. /** 提交按钮 */
  752. const submitForm = () => {
  753. screeningAssessmentConfigFormRef.value?.validate(async (valid: boolean) => {
  754. if (valid) {
  755. if (!baseInfo.value.questionType && otherInfo.value.length == 0) {
  756. proxy?.$modal.msgError("请选择题型");
  757. return;
  758. }
  759. let baseNum = !baseInfo.value.questionType ? 0 : 1;
  760. let lineNum = 0;
  761. for (let item of otherInfo.value) {
  762. lineNum++;
  763. if (!item.title || item.title.trim().length < 1) {
  764. proxy?.$modal.msgError("第" + (baseNum + lineNum) + "行标题为空");
  765. return;
  766. }
  767. for (let ch of item.contentList) {
  768. if (item.questionChildType == 'matrixScale') {
  769. if ((ch.optionFlag && (!ch.optionContent || ch.optionContent.trim().length < 1))
  770. || (ch.labelFlag && (!ch.label || ch.label.trim().length < 1))) {
  771. proxy?.$modal.msgError("第" + (baseNum + lineNum) + "行标题的选项内容为空");
  772. return;
  773. }
  774. } else {
  775. if (!ch.label || ch.label.trim().length < 1) {
  776. proxy?.$modal.msgError("第" + (baseNum + lineNum) + "行标题的选项有空值");
  777. return;
  778. }
  779. }
  780. }
  781. }
  782. if (baseInfo.value.questionType && baseInfo.value.questionType.length > 0) {
  783. form.value.baseInfo = baseInfo.value;
  784. }
  785. if (otherInfo.value && otherInfo.value.length > 0) {
  786. form.value.otherInfo = otherInfo.value;
  787. }
  788. buttonLoading.value = true;
  789. if (form.value.configId) {
  790. await updateScreeningAssessmentConfig(form.value).finally(() => buttonLoading.value = false);
  791. } else {
  792. await addScreeningAssessmentConfig(form.value).finally(() => buttonLoading.value = false);
  793. }
  794. proxy?.$modal.msgSuccess("操作成功");
  795. close();
  796. }
  797. });
  798. }
  799. /** 关闭按钮操作 */
  800. const close = () => {
  801. const obj: RouteLocationNormalized = {
  802. fullPath: '',
  803. hash: '',
  804. matched: [],
  805. meta: undefined,
  806. name: undefined,
  807. params: undefined,
  808. query: undefined,
  809. redirectedFrom: undefined,
  810. path: '/argManage/screeningAssessmentConfig'
  811. };
  812. proxy?.$tab.closeOpenPage(obj);
  813. }
  814. function handleOtherBtnClick(questionType: string, nameEn: string, nameCn: string) {
  815. if (otherInfo.value.length > 0 && questionType == 'otherInfo') {
  816. let newList = []
  817. for (let i = 0, len = otherInfo.value.length; i < len; i++) {
  818. let other = otherInfo.value[i];
  819. if (other.questionType == 'otherInfo' && other.questionChildType == nameEn) {
  820. continue;
  821. }
  822. newList.push(other);
  823. }
  824. if (newList.length != otherInfo.value.length) {
  825. otherInfo.value = newList;
  826. }
  827. }
  828. let question: QuestionVO = {
  829. questionId: '',
  830. title: nameCn,
  831. questionType: questionType,
  832. questionChildType: nameEn,
  833. lastType: '1',
  834. selected: false,
  835. required: false,
  836. scoreMethod: '1',
  837. arrangement: '1',
  838. content: '',
  839. contentList: [],
  840. };
  841. otherInfo.value.push(question);
  842. if ('anthropometry' == nameEn) {
  843. question.contentList.push({
  844. label: '身高',
  845. value: undefined,
  846. nameEn: 'height',
  847. });
  848. question.contentList.push({
  849. label: '当前体重',
  850. value: undefined,
  851. nameEn: 'currentWeight',
  852. });
  853. question.contentList.push({
  854. label: '出生体重',
  855. value: undefined,
  856. nameEn: 'birthWeight',
  857. });
  858. question.contentList.push({
  859. label: '理想体重',
  860. value: undefined,
  861. nameEn: 'idealWeight',
  862. });
  863. question.contentList.push({
  864. label: 'BMI',
  865. value: undefined,
  866. nameEn: 'BMI',
  867. });
  868. question.contentList.push({
  869. label: '握力',
  870. value: undefined,
  871. nameEn: 'gripStrength',
  872. });
  873. question.contentList.push({
  874. label: '皮褶厚度',
  875. value: undefined,
  876. nameEn: 'leatherFoldThickness',
  877. });
  878. question.contentList.push({
  879. label: '腰围',
  880. value: undefined,
  881. nameEn: 'waistCircumference',
  882. });
  883. question.contentList.push({
  884. label: '上臂围',
  885. value: undefined,
  886. nameEn: 'upperArmCircumference',
  887. });
  888. question.contentList.push({
  889. label: '小腿围',
  890. value: undefined,
  891. nameEn: 'calfCircumference',
  892. });
  893. question.contentList.push({
  894. label: '其他测量指标',
  895. value: undefined,
  896. nameEn: 'otherMeasurementIndicators',
  897. });
  898. question = {
  899. questionId: '',
  900. title: '请选择调查时间',
  901. questionType: questionType,
  902. questionChildType: nameEn,
  903. content: '',
  904. lastType: '2',
  905. contentList: [],
  906. };
  907. otherInfo.value.push(question);
  908. question.contentList.push({
  909. label: '三个月前',
  910. formType: 'radio',
  911. value: undefined,
  912. nameEn: 'threeMonthsAgo',
  913. });
  914. question.contentList.push({
  915. label: '两个月前',
  916. value: undefined,
  917. formType: 'radio',
  918. nameEn: 'twoMonthsAgo',
  919. });
  920. question.contentList.push({
  921. label: '一个月前',
  922. formType: 'radio',
  923. value: undefined,
  924. nameEn: 'oneMonthsAgo',
  925. });
  926. question = {
  927. questionId: '',
  928. title: '请填入已选调查时间体重',
  929. questionType: questionType,
  930. questionChildType: nameEn,
  931. lastType: '3',
  932. content: '',
  933. contentList: [],
  934. };
  935. otherInfo.value.push(question);
  936. question.contentList.push({
  937. label: '过去体重',
  938. value: undefined,
  939. nameEn: 'pastWeight',
  940. });
  941. question = {
  942. questionId: '',
  943. title: '1-3个月内体重变化情况',
  944. questionType: questionType,
  945. questionChildType: nameEn,
  946. lastType: '4',
  947. content: '',
  948. contentList: [],
  949. };
  950. otherInfo.value.push(question);
  951. question.contentList.push({
  952. label: '近3个月体重无显著变化',
  953. formType: 'radioScore',
  954. value: undefined,
  955. nameEn: 'noChangeWeight',
  956. });
  957. question.contentList.push({
  958. label: '近3个月体重丢失>5%',
  959. formType: 'radioScore',
  960. value: undefined,
  961. nameEn: 'weightLoss5In3Months',
  962. });
  963. question.contentList.push({
  964. label: '近2个月体重丢失>5%',
  965. formType: 'radioScore',
  966. value: undefined,
  967. nameEn: 'weightLoss5In2Months',
  968. });
  969. question.contentList.push({
  970. label: '近1个月体重丢失>5%',
  971. formType: 'radioScore',
  972. value: undefined,
  973. nameEn: 'weightLoss5In1Months',
  974. });
  975. for (let i = 0, len = question.contentList.length; i < len; i++) {
  976. question.contentList[i].score = i.toString();
  977. }
  978. return;
  979. }
  980. if ('dietaryStatus' == nameEn) {
  981. question.contentList.push({
  982. label: '平素膳食餐次',
  983. value: undefined,
  984. nameEn: 'regularMealSchedule',
  985. });
  986. question = {
  987. questionId: '',
  988. title: '近1周食物摄入量是否减少',
  989. questionType: questionType,
  990. questionChildType: nameEn,
  991. lastType: '2',
  992. content: '',
  993. contentList: [],
  994. };
  995. otherInfo.value.push(question);
  996. question.contentList.push({
  997. label: '无变化',
  998. formType: 'radioScore',
  999. value: undefined,
  1000. nameEn: 'noChange',
  1001. });
  1002. question.contentList.push({
  1003. label: '较从前减少25%~50%',
  1004. formType: 'radioScore',
  1005. value: undefined,
  1006. nameEn: 'decreasedBy25To50',
  1007. });
  1008. question.contentList.push({
  1009. label: '较从前减少51%~75%',
  1010. formType: 'radioScore',
  1011. value: undefined,
  1012. nameEn: 'decreasedBy51To75',
  1013. });
  1014. question.contentList.push({
  1015. label: '较从前减少76%~100%',
  1016. formType: 'radioScore',
  1017. value: undefined,
  1018. nameEn: 'decreasedBy76To100',
  1019. });
  1020. for (let i = 0, len = question.contentList.length; i < len; i++) {
  1021. question.contentList[i].score = i.toString();
  1022. }
  1023. question = {
  1024. questionId: '',
  1025. title: '近1周食物摄入种类(/日)',
  1026. questionType: questionType,
  1027. questionChildType: nameEn,
  1028. lastType: '3',
  1029. content: '',
  1030. contentList: [],
  1031. };
  1032. otherInfo.value.push(question);
  1033. question.contentList.push({
  1034. label: '奶及奶制品',
  1035. value: undefined,
  1036. nameEn: 'milkAndDairyProducts',
  1037. });
  1038. question.contentList.push({
  1039. label: '坚果类',
  1040. value: undefined,
  1041. nameEn: 'nutCategory',
  1042. });
  1043. question.contentList.push({
  1044. label: '大豆类',
  1045. value: undefined,
  1046. nameEn: 'largeBeans',
  1047. });
  1048. question.contentList.push({
  1049. label: '肉蛋水产类',
  1050. value: undefined,
  1051. nameEn: 'meatEggAndAquaticProducts',
  1052. });
  1053. question.contentList.push({
  1054. label: '蔬菜类',
  1055. value: undefined,
  1056. nameEn: 'vegetables',
  1057. });
  1058. question.contentList.push({
  1059. label: '水果类',
  1060. value: undefined,
  1061. nameEn: 'fruitCategory',
  1062. });
  1063. question.contentList.push({
  1064. label: '谷薯杂豆类',
  1065. value: undefined,
  1066. nameEn: 'grainPotatoAndMixedBeans',
  1067. });
  1068. question.contentList.push({
  1069. label: '调料类',
  1070. value: undefined,
  1071. nameEn: 'seasoning',
  1072. });
  1073. question.contentList.push({
  1074. label: '水',
  1075. value: undefined,
  1076. nameEn: 'water',
  1077. });
  1078. question = {
  1079. questionId: '',
  1080. title: '近1周能量-营养素摄入分析(/日)',
  1081. questionType: questionType,
  1082. questionChildType: nameEn,
  1083. lastType: '4',
  1084. content: '',
  1085. contentList: [],
  1086. };
  1087. otherInfo.value.push(question);
  1088. question.contentList.push({
  1089. label: '总能量',
  1090. value: undefined,
  1091. nameEn: 'totalEnergy',
  1092. });
  1093. question.contentList.push({
  1094. label: '总氮量',
  1095. value: undefined,
  1096. nameEn: 'totalNitrogenContent',
  1097. });
  1098. question.contentList.push({
  1099. label: '氮/能量比值:1',
  1100. value: undefined,
  1101. nameEn: 'nitrogenEnergyRatio1',
  1102. });
  1103. question.contentList.push({
  1104. label: '蛋白质含量',
  1105. value: undefined,
  1106. nameEn: 'proteinContent',
  1107. });
  1108. question.contentList.push({
  1109. label: '脂肪含量',
  1110. value: undefined,
  1111. nameEn: 'fatContent',
  1112. });
  1113. question.contentList.push({
  1114. label: '碳水化合物含量',
  1115. value: undefined,
  1116. nameEn: 'carbohydrateContent',
  1117. });
  1118. question.contentList.push({
  1119. label: '蛋白质热比',
  1120. value: undefined,
  1121. nameEn: 'proteinHeatRatio',
  1122. });
  1123. question.contentList.push({
  1124. label: '脂肪热比',
  1125. value: undefined,
  1126. nameEn: 'protefatToHeatRatioinHeatRatio',
  1127. });
  1128. question.contentList.push({
  1129. label: '碳水化合物热比',
  1130. value: undefined,
  1131. nameEn: 'carbohydrateHeatRatio',
  1132. });
  1133. question.contentList.push({
  1134. label: '盐',
  1135. value: undefined,
  1136. nameEn: 'salt',
  1137. });
  1138. question.contentList.push({
  1139. label: '钠',
  1140. value: undefined,
  1141. nameEn: 'sodium',
  1142. });
  1143. return;
  1144. }
  1145. if ('singleChoice' == nameEn) {
  1146. question.title = undefined;
  1147. question.required = false;
  1148. question.arrangement = '1';
  1149. question.increment = 0;
  1150. question.contentList.push({
  1151. label: undefined,
  1152. value: undefined,
  1153. nameEn: 'single' + question.increment.toString(),
  1154. allowFillBlank: false,
  1155. img: undefined,
  1156. score: '0.0',
  1157. });
  1158. return;
  1159. }
  1160. if ('multipleChoice' == nameEn) {
  1161. question.title = undefined;
  1162. question.required = false;
  1163. question.arrangement = '1';
  1164. question.scoreMethod = '1';
  1165. question.increment = 0;
  1166. question.contentList.push({
  1167. label: undefined,
  1168. value: undefined,
  1169. nameEn: 'multiple' + question.increment.toString(),
  1170. allowFillBlank: false,
  1171. img: undefined,
  1172. score: '0.0',
  1173. });
  1174. return;
  1175. }
  1176. if ('fillBlanks' == nameEn) {
  1177. question.title = undefined;
  1178. question.required = false;
  1179. question.arrangement = '1';
  1180. question.increment = 0;
  1181. question.contentList.push({
  1182. label: undefined,
  1183. value: undefined,
  1184. nameEn: 'fill' + question.increment.toString(),
  1185. img: undefined,
  1186. score: '0.0',
  1187. unit: '',
  1188. });
  1189. return;
  1190. }
  1191. if ('scaleQuestions' == nameEn) {
  1192. question.title = undefined;
  1193. question.required = false;
  1194. question.increment = 0;
  1195. question.contentList.push({
  1196. label: undefined,
  1197. value: undefined,
  1198. nameEn: 'scale' + question.increment.toString(),
  1199. score: '0.0',
  1200. });
  1201. return;
  1202. }
  1203. if ('matrixScale' == nameEn) {
  1204. question.title = undefined;
  1205. question.required = false;
  1206. question.increment = 0;
  1207. question.contentList.push({
  1208. labelFlag: true,
  1209. label: undefined,
  1210. value: undefined,
  1211. nameEn: 'matrix' + question.increment.toString(),
  1212. score: '0.0',
  1213. optionContent: '',
  1214. optionFlag: true,
  1215. });
  1216. return;
  1217. }
  1218. }
  1219. function handleBaseBtnClick(nameEn: string, nameCn: string) {
  1220. if (baseInfo.value.contentList.length < 1) {
  1221. baseInfo.value.title = '基本信息';
  1222. baseInfo.value.questionType = 'baseInfo';
  1223. baseInfo.value.contentList = [];
  1224. }
  1225. let questionAttr: QuestionAttrVO = {
  1226. label: nameCn,
  1227. value: undefined,
  1228. nameEn: nameEn,
  1229. };
  1230. if (baseInfo.value.contentList.length < 1) {
  1231. baseInfo.value.contentList.push(questionAttr);
  1232. } else {
  1233. let existed = false;
  1234. for (let item of baseInfo.value.contentList) {
  1235. if (item.nameEn == nameEn) {
  1236. existed = true;
  1237. break;
  1238. }
  1239. }
  1240. if (!existed) {
  1241. baseInfo.value.contentList.push(questionAttr);
  1242. }
  1243. }
  1244. }
  1245. function handleBaseBtnDelete(nameEn: string) {
  1246. let contentList = [];
  1247. for (let item of baseInfo.value.contentList) {
  1248. if (item.nameEn != nameEn) {
  1249. contentList.push(item);
  1250. }
  1251. }
  1252. if (contentList.length < 1) {
  1253. baseInfo.value.questionType = undefined;
  1254. baseInfo.value.contentList = [];
  1255. } else {
  1256. baseInfo.value.contentList = contentList;
  1257. }
  1258. }
  1259. function deleteBaseInfo() {
  1260. baseInfo.value.contentList = [];
  1261. baseInfo.value.questionType = undefined;
  1262. }
  1263. function deleteOtherInfo(index: number) {
  1264. let newList = []
  1265. for (let i = 0, len = otherInfo.value.length; i < len; i++) {
  1266. if (i == index) {
  1267. continue;
  1268. }
  1269. newList.push(otherInfo.value[i]);
  1270. }
  1271. otherInfo.value = newList;
  1272. }
  1273. function handleOtherBtnDelete(index: number, childIndex: number) {
  1274. let other = otherInfo.value[index]
  1275. let newList = [];
  1276. for (let i = 0, len = other.contentList.length; i < len; i++) {
  1277. if (i == childIndex) {
  1278. continue;
  1279. }
  1280. newList.push(other.contentList[i]);
  1281. }
  1282. other.contentList = newList;
  1283. if (newList.length == 0) {
  1284. newList = [];
  1285. for (let i = 0, len = otherInfo.value.length; i < len; i++) {
  1286. if (i == index) {
  1287. continue;
  1288. }
  1289. newList.push(otherInfo.value[i]);
  1290. }
  1291. otherInfo.value = newList
  1292. }
  1293. }
  1294. function handleMatrixScaleAdd(index: number, childIndex: number, isLeft: boolean) {
  1295. let other = otherInfo.value[index];
  1296. if (other.contentList.length == childIndex + 1) {
  1297. other.contentList.push({
  1298. labelFlag: isLeft,
  1299. label: undefined,
  1300. value: undefined,
  1301. nameEn: 'matrix' + other.increment.toString(),
  1302. score: '0.0',
  1303. optionContent: undefined,
  1304. optionFlag: !isLeft,
  1305. });
  1306. return;
  1307. }
  1308. let effectiveNum = 0;
  1309. for (let item of other.contentList) {
  1310. if (isLeft) {
  1311. effectiveNum += (item.labelFlag ? 1 : 0);
  1312. } else {
  1313. effectiveNum += (item.optionFlag ? 1 : 0);
  1314. }
  1315. }
  1316. if (effectiveNum == other.contentList.length) {
  1317. other.contentList.push({
  1318. labelFlag: isLeft,
  1319. label: undefined,
  1320. value: undefined,
  1321. nameEn: 'matrix' + other.increment.toString(),
  1322. score: '0.0',
  1323. optionContent: undefined,
  1324. optionFlag: !isLeft,
  1325. });
  1326. } else {
  1327. let o = other.contentList[effectiveNum];
  1328. if (isLeft) {
  1329. o.labelFlag = true;
  1330. } else {
  1331. o.optionFlag = true;
  1332. }
  1333. }
  1334. for (let i = effectiveNum; i > 0; i--) {
  1335. let child = other.contentList[i]
  1336. if (i == childIndex + 1) {
  1337. if (isLeft) {
  1338. child.value = undefined;
  1339. } else {
  1340. child.optionContent = undefined;
  1341. }
  1342. break
  1343. }
  1344. let childPre = other.contentList[i - 1];
  1345. if (isLeft) {
  1346. child.value = childPre.value;
  1347. } else {
  1348. child.optionContent = childPre.optionContent;
  1349. }
  1350. }
  1351. }
  1352. function handleMatrixScaleDelete(index: number, childIndex: number, isLeft: boolean) {
  1353. let other = otherInfo.value[index];
  1354. let child = other.contentList[childIndex];
  1355. if (other.contentList.length == 1) {
  1356. if (isLeft) {
  1357. if (!child.optionFlag) {
  1358. other.contentList = [];
  1359. } else {
  1360. child.labelFlag = false;
  1361. }
  1362. } else {
  1363. if (!child.labelFlag) {
  1364. other.contentList = [];
  1365. } else {
  1366. child.optionFlag = false;
  1367. }
  1368. }
  1369. return;
  1370. }
  1371. if (other.contentList.length == childIndex + 1) {
  1372. if (isLeft) {
  1373. if (!child.optionFlag) {
  1374. other.contentList.pop();
  1375. } else {
  1376. child.labelFlag = false;
  1377. child.label = undefined;
  1378. }
  1379. } else {
  1380. if (!child.labelFlag) {
  1381. other.contentList.pop();
  1382. } else {
  1383. child.optionFlag = false;
  1384. child.optionContent = undefined;
  1385. }
  1386. }
  1387. return;
  1388. }
  1389. for (let i = childIndex + 1, len = other.contentList.length; i < len; i++) {
  1390. let childPre = other.contentList[i - 1];
  1391. child = other.contentList[i];
  1392. if (isLeft) {
  1393. childPre.labelFlag = child.labelFlag;
  1394. childPre.value = child.value;
  1395. } else {
  1396. childPre.optionFlag = child.optionFlag;
  1397. childPre.optionContent = child.optionContent;
  1398. }
  1399. }
  1400. other.contentList.pop();
  1401. }
  1402. function handleOtherBtnAdd(index: number, questionType: string) {
  1403. let other = otherInfo.value[index]
  1404. let contentList = other.contentList;
  1405. other.increment += 1;
  1406. if ('singleChoice' == questionType) {
  1407. contentList.push({
  1408. label: undefined,
  1409. value: undefined,
  1410. nameEn: 'single' + other.increment.toString(),
  1411. allowFillBlank: false,
  1412. img: undefined,
  1413. score: '0.0',
  1414. });
  1415. return;
  1416. }
  1417. if ('multipleChoice' == questionType) {
  1418. contentList.push({
  1419. label: undefined,
  1420. value: undefined,
  1421. nameEn: 'multiple' + other.increment.toString(),
  1422. allowFillBlank: false,
  1423. img: undefined,
  1424. score: '0.0',
  1425. });
  1426. return;
  1427. }
  1428. if ('fillBlanks' == questionType) {
  1429. contentList.push({
  1430. label: undefined,
  1431. value: undefined,
  1432. nameEn: 'fill' + other.increment.toString(),
  1433. img: undefined,
  1434. score: '0.0',
  1435. unit: '',
  1436. });
  1437. return;
  1438. }
  1439. if ('scaleQuestions' == questionType) {
  1440. contentList.push({
  1441. label: undefined,
  1442. value: undefined,
  1443. nameEn: 'scale' + other.increment.toString(),
  1444. score: '0.0',
  1445. });
  1446. return;
  1447. }
  1448. if ('matrixScale' == questionType) {
  1449. contentList.push({
  1450. labelFlag: true,
  1451. label: undefined,
  1452. value: undefined,
  1453. nameEn: 'matrix' + other.increment.toString(),
  1454. score: '0.0',
  1455. optionContent: undefined,
  1456. optionFlag: true,
  1457. });
  1458. return;
  1459. }
  1460. }
  1461. function selectBaseInfo() {
  1462. baseInfo.value.selected = true;
  1463. otherInfo.value.forEach(item => {
  1464. item.selected = false;
  1465. });
  1466. }
  1467. function selectOtherInfo(index: number) {
  1468. baseInfo.value.selected = false;
  1469. otherInfo.value.forEach(item => {
  1470. item.selected = false;
  1471. });
  1472. let other = otherInfo.value[index]
  1473. other.selected = true;
  1474. }
  1475. function topUp(index: number) {
  1476. let other = otherInfo.value[index];
  1477. let newList = [other];
  1478. for (let i = 0, len = otherInfo.value.length; i < len; i++) {
  1479. if (i == index) {
  1480. continue;
  1481. }
  1482. newList.push(otherInfo.value[i]);
  1483. }
  1484. otherInfo.value = newList;
  1485. }
  1486. function bottomUp(index: number) {
  1487. let other = otherInfo.value[index];
  1488. let newList = [];
  1489. for (let i = 0, len = otherInfo.value.length; i < len; i++) {
  1490. if (i == index) {
  1491. continue;
  1492. }
  1493. newList.push(otherInfo.value[i]);
  1494. }
  1495. newList.push(other);
  1496. otherInfo.value = newList;
  1497. }
  1498. function moveUp(index: number) {
  1499. let other = otherInfo.value[index];
  1500. let newList = [];
  1501. for (let i = 0, len = otherInfo.value.length; i < len; i++) {
  1502. if (i == index - 1) {
  1503. newList.push(other);
  1504. }
  1505. if (i == index) {
  1506. continue;
  1507. }
  1508. newList.push(otherInfo.value[i]);
  1509. }
  1510. otherInfo.value = newList;
  1511. }
  1512. function moveDown(index: number) {
  1513. let other = otherInfo.value[index];
  1514. let newList = [];
  1515. for (let i = 0, len = otherInfo.value.length; i < len; i++) {
  1516. if (i == index) {
  1517. continue;
  1518. }
  1519. newList.push(otherInfo.value[i]);
  1520. if (i == index + 1) {
  1521. newList.push(other);
  1522. }
  1523. }
  1524. otherInfo.value = newList;
  1525. }
  1526. const bodyWidth = ref((window.document.body.clientWidth - 500) * 0.8);
  1527. function updateBodyWidth() {
  1528. let leftPanel = window.document.querySelector('#leftPanel').clientWidth;
  1529. bodyWidth.value = (window.document.body.clientWidth - leftPanel) * 0.93;
  1530. }
  1531. onMounted(() => {
  1532. window.addEventListener('resize', updateBodyWidth);
  1533. updateBodyWidth();
  1534. getList();
  1535. });
  1536. onUnmounted(() => {
  1537. window.removeEventListener('resize', updateBodyWidth);
  1538. });
  1539. </script>
  1540. <style scoped>
  1541. .layout-container-demo .el-header {
  1542. position: relative;
  1543. background-color: var(--el-color-primary-light-7);
  1544. color: var(--el-text-color-primary);
  1545. }
  1546. .layout-container-demo .el-aside {
  1547. color: var(--el-text-color-primary);
  1548. background: var(--el-color-primary-light-8);
  1549. }
  1550. .layout-container-demo .el-menu {
  1551. border-right: none;
  1552. }
  1553. .layout-container-demo .el-main {
  1554. padding: 0;
  1555. }
  1556. .layout-container-demo .toolbar {
  1557. display: inline-flex;
  1558. align-items: center;
  1559. justify-content: center;
  1560. height: 100%;
  1561. right: 20px;
  1562. }
  1563. .param-btn {
  1564. width: 100%;
  1565. height: 48px;
  1566. font-size: 13px;
  1567. font-weight: normal;
  1568. border: 1.5px solid #bfcbd9;
  1569. border-radius: 4px;
  1570. margin-bottom: 16px;
  1571. background: #fff;
  1572. color: #222;
  1573. letter-spacing: 1px;
  1574. display: flex;
  1575. align-items: center;
  1576. justify-content: center;
  1577. text-align: center;
  1578. white-space: nowrap;
  1579. overflow: hidden;
  1580. text-overflow: ellipsis;
  1581. padding: 0 2px;
  1582. }
  1583. @media (max-width: 1200px) {
  1584. .param-btn {
  1585. font-size: 13px;
  1586. }
  1587. }
  1588. @media (max-width: 800px) {
  1589. .param-btn {
  1590. font-size: 12px;
  1591. }
  1592. }
  1593. .selectedDiv {
  1594. background-color: #e8f4ff;
  1595. }
  1596. ul .el-upload--picture-card {
  1597. --el-upload-picture-card-size: 500px
  1598. }
  1599. .custom-radio-grid {
  1600. display: flex;
  1601. /* border: 1px solid #bfc4cc; */
  1602. border-radius: 4px;
  1603. background: #fff;
  1604. margin-bottom: 16px;
  1605. }
  1606. .custom-radio-cell {
  1607. width: 100px;
  1608. flex: none;
  1609. text-align: center;
  1610. border: 1px solid #bfc4cc;
  1611. margin: 0 !important;
  1612. height: 40px;
  1613. line-height: 20px;
  1614. font-size: 18px;
  1615. font-weight: normal;
  1616. background: #fff;
  1617. border-radius: 0 !important;
  1618. cursor: pointer;
  1619. user-select: none;
  1620. transition: background 0.2s;
  1621. word-break: break-all;
  1622. white-space: normal;
  1623. overflow-wrap: break-word;
  1624. display: flex;
  1625. align-items: center;
  1626. justify-content: center;
  1627. padding: 0 5px;
  1628. }
  1629. .custom-radio-cell:last-child {
  1630. border-right: none;
  1631. }
  1632. .custom-radio-cell .el-radio__input {
  1633. display: none !important;
  1634. }
  1635. .custom-radio-cell .el-radio__label {
  1636. padding: 0;
  1637. width: 100%;
  1638. display: block;
  1639. text-align: center;
  1640. cursor: pointer;
  1641. }
  1642. .custom-radio-cell.is-checked {
  1643. border-right: 1px solid #bfc4cc;
  1644. }
  1645. .custom-radio-cell.is-last {
  1646. border-right: 1px solid #bfc4cc;
  1647. border-left: none;
  1648. }
  1649. :deep(#jffs label) {
  1650. font-weight: normal;
  1651. }
  1652. .action-buttons {
  1653. display: flex;
  1654. gap: 1px;
  1655. .icon-btn {
  1656. padding: 6px;
  1657. height: 32px;
  1658. border: 1px solid #dcdfe6;
  1659. &:hover {
  1660. border-color: var(--el-color-primary);
  1661. color: var(--el-color-primary);
  1662. }
  1663. .el-icon {
  1664. font-size: 14px;
  1665. }
  1666. }
  1667. }
  1668. </style>