add.vue 59 KB

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