ruleManage.vue 56 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739
  1. <template>
  2. <div class="container-box">
  3. <el-row :gutter="20" class="h-100">
  4. <el-col :span="6" class="h-100">
  5. <div class="h-100">
  6. <el-card class="box-card h-100">
  7. <div class="tree-container">
  8. <el-scrollbar>
  9. <el-tree
  10. lazy
  11. :load="loadNode"
  12. @node-click="handleNodeClick"
  13. :props="defaultProps"
  14. :expand-on-click-node="false"
  15. :default-expanded-keys="defaultExpandedKeys"
  16. :current-node-key="curreenttid"
  17. highlight-current
  18. node-key="primaryKeyId"
  19. ref="tree"
  20. ></el-tree>
  21. </el-scrollbar>
  22. </div>
  23. </el-card>
  24. </div>
  25. </el-col>
  26. <template v-if="!isShowDetail">
  27. <el-col :span="18" class="h-100" v-if="isShowList">
  28. <div class="h-100 rule-box-all">
  29. <el-card class="box-card h-100">
  30. <div slot="header" class="clearfix">
  31. <el-link type="primary" @click="goBackFirst">
  32. <i class="el-icon-arrow-left" style="margin-right: 5px; "></i>
  33. <span>退出</span>
  34. </el-link>
  35. <div style="float: right;">
  36. <el-button
  37. :disabled="!treeId"
  38. icon="el-icon-plus"
  39. size="small"
  40. style="background-color:#2550A2;color:white;font-weight:bold;"
  41. plain
  42. @click="addRule"
  43. >新增
  44. </el-button>
  45. <el-button
  46. :disabled="!treeId"
  47. icon="el-icon-document-copy"
  48. size="small"
  49. style="background-color:#FFA042;color:white;font-weight:bold;"
  50. plain
  51. @click="manageFolder"
  52. >管理
  53. </el-button>
  54. </div>
  55. </div>
  56. <div v-if="ruleItemOptions.length>0">
  57. <div class="rule-box" v-loading="ruleLoading">
  58. <div class="rule-box-item" v-for="(item,index) in ruleItemOptions" :key="index" @click="ruleDetailClick(item)" >
  59. <div class="rule-box-item-icon">
  60. <i class="el-icon-folder" style=" cursor: pointer; font-size: 48px;color:orange"></i>
  61. </div>
  62. <div class="rule-box-item-title">{{ item.name }}</div>
  63. </div>
  64. </div>
  65. <el-pagination
  66. style="margin-top: 30px;text-align: center;"
  67. @size-change="handleSizeChange"
  68. @current-change="handleCurrentChange"
  69. :current-page="currentPage"
  70. :page-size="pageSize"
  71. :total="total"
  72. layout="prev, pager, next,total,jumper"
  73. class="pagination"
  74. >
  75. </el-pagination>
  76. </div>
  77. <el-empty description="暂无数据" v-else class="empty-container"></el-empty>
  78. </el-card>
  79. </div>
  80. </el-col>
  81. <el-col :span="18" class="h-100" v-if="!isShowList">
  82. <div class="h-100 rule-box-all">
  83. <el-card class="box-card h-100">
  84. <div slot="header" class="clearfix">
  85. <el-link type="primary" @click="goBack">
  86. <i class="el-icon-arrow-left" style="margin-right: 5px;"></i>
  87. <span >返回上一级</span>
  88. </el-link>
  89. <div style="float: right;">
  90. <el-button
  91. icon="el-icon-plus"
  92. size="small"
  93. style="background-color:#2550A2;color:white;font-weight:bold;"
  94. plain
  95. @click="addFile"
  96. >新增
  97. </el-button>
  98. <el-button
  99. icon="el-icon-document-copy"
  100. size="small"
  101. style="background-color:#FFA042;color:white;font-weight:bold;"
  102. plain
  103. @click="manageFolder"
  104. >管理
  105. </el-button>
  106. </div>
  107. </div>
  108. <div class="rule-box" v-loading="ruleItemOptionsDetailLoading" v-if="ruleItemOptionsDetail.length>0">
  109. <div class="rule-box-item" v-for="item in ruleItemOptionsDetail" :key="item.id" @click="ruleDetailClick1(item)">
  110. <div class="rule-box-item-icon">
  111. <i class="el-icon-tickets" style=" cursor: pointer; font-size: 48px;color:#2550A2"></i>
  112. </div>
  113. <div class="rule-box-item-title">{{ item.name }}</div>
  114. </div>
  115. </div>
  116. <el-empty description="暂无数据" v-else class="empty-container"></el-empty>
  117. <el-pagination
  118. style="margin-top: 30px;text-align: center;"
  119. @size-change="handleSizeChange1"
  120. @current-change="handleCurrentChange1"
  121. :current-page="currentPage1"
  122. :page-size="pageSize1"
  123. :total="total1"
  124. layout="prev, pager, next,total,jumper"
  125. class="pagination"
  126. >
  127. </el-pagination>
  128. </el-card>
  129. </div>
  130. </el-col>
  131. </template>
  132. <el-col :span="18" class="h-100" v-if="isShowDetail">
  133. <el-card class="box-card h-100" v-if="isShowYpList">
  134. <div slot="header" class="clearfix">
  135. <el-link type="primary" @click="goBack1">
  136. <i class="el-icon-arrow-left" style="margin-right: 5px;"></i>
  137. <span >返回上一级</span>
  138. </el-link>
  139. </div>
  140. <div class="box-card-title">
  141. {{ ruleDataDetail.name }}
  142. </div>
  143. <div class="box-card-content1">
  144. <div class="box-card-content1-left">
  145. <div class="box-card-content1-left-item">
  146. 下达日期:{{ ruleDataDetail.issueDate }}
  147. </div>
  148. <div class="box-card-content1-left-item">
  149. 实施日期:{{ ruleDataDetail.actualizeDate }}
  150. </div>
  151. <div>
  152. <i class="el-icon-document"></i>
  153. <el-link v-for="item in ruleDataDetail.standardFiles" :key="item.id" type="primary" :href="item.standardFileUrl" style="margin-right: 5px;">{{ item.fileName }}</el-link>
  154. </div>
  155. </div>
  156. <div class="box-card-content1-right">
  157. <el-button type="danger" size="small" @click="previewRes">效果预览</el-button>
  158. <el-button type="warning" size="small" @click="refreshRule" :loading="refreshLoad">规范更新</el-button>
  159. </div>
  160. </div>
  161. <div class="box-card-content2">
  162. <div class="box-card-content2-top">
  163. <div class="box-card-content2-title">
  164. <div class="title-container">
  165. <span>样品信息</span>
  166. <i class="el-icon-circle-plus" @click="addYp"></i>
  167. </div>
  168. </div>
  169. <div class="box-card-content2-list">
  170. <div class="box-card-content2-list-item" v-for="(item, index) in ypList" :key="index">
  171. <div class="box-card-content2-list-item-title">
  172. <span class="eg">if()</span>
  173. <span>{{ item.name }}</span>
  174. </div>
  175. <div class="box-card-content2-list-item-list">
  176. <span class="basic-info">基础信息</span>
  177. <div class="box-card-content2-list-item-list-basic">
  178. <div class="basic-item-info" v-for="(item1,index1) in item.info":key="index1" >
  179. {{ item1.name }}
  180. </div>
  181. <div class="operation-icons">
  182. <i class="el-icon-edit" @click.stop="handleEdit(item, index)"></i>
  183. <i class="el-icon-delete" @click.stop="handleDelete(item,index)"></i>
  184. </div>
  185. </div>
  186. </div>
  187. </div>
  188. </div>
  189. </div>
  190. <div class="box-card-content2-top">
  191. <div class="box-card-content2-title">
  192. <div class="title-container">
  193. <span>技术指标</span>
  194. <i class="el-icon-circle-plus" @click="addJs"></i>
  195. </div>
  196. </div>
  197. <div class="box-card-content2-list">
  198. <div class="box-card-content2-list-item" v-for="(item, index) in jsList" :key="index">
  199. <div class="box-card-content2-list-item-title">
  200. <span class="eg">else()</span>
  201. <span>{{ item.name }}</span>
  202. </div>
  203. <div class="box-card-content2-list-item-list">
  204. <span class="basic-info">内容</span>
  205. <div class="box-card-content2-list-item-list-basic">
  206. <div class="basic-item-info" v-for="(item1,index1) in item.info":key="index1" >
  207. {{ item1.symbolName }}
  208. </div>
  209. <div class="operation-icons">
  210. <i class="el-icon-edit" @click.stop="handleEditJs1(item, index)"></i>
  211. <i class="el-icon-delete" @click.stop="handleDelete1(item,index)"></i>
  212. </div>
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. </div>
  218. </div>
  219. </el-card>
  220. <el-card class="box-card h-100" v-if="!isShowYpList&&!isShowJsList">
  221. <template >
  222. <div slot="header" class="clearfix" >
  223. <el-link type="primary" @click="showYpList">
  224. <i class="el-icon-arrow-left" style="margin-right: 5px; cursor: pointer;" ></i>
  225. <span >退出</span>
  226. </el-link>
  227. </div>
  228. <div class="add-yp-title">
  229. <span>{{ isEditYp?'编辑':'新增' }}</span>
  230. </div>
  231. <div class="add-yp-detail">
  232. <el-form label-position="left" label-width="80px" :model="ypDetail" :rules="ypRuleForm" ref="ypFormRef">
  233. <el-form-item label="样品信息" prop="name">
  234. <el-input v-model="ypDetail.name"></el-input>
  235. </el-form-item>
  236. <el-form-item label="基础信息">
  237. <div class="input-with-icon" v-for="(item, index) in ypDetail.info" :key="index">
  238. <el-input v-model="item.name"></el-input>
  239. <i class="el-icon-circle-plus-outline" @click="addBasicInfo(index)" ></i>
  240. <i class="el-icon-remove-outline" @click="removeBasicInfo(item,index)" v-if="index!==0"></i>
  241. </div>
  242. </el-form-item>
  243. </el-form>
  244. </div>
  245. <div class="add-yp-footer">
  246. <el-button type="primary" @click="saveYpForm" :loading="saveYpLoad">保存</el-button>
  247. </div>
  248. </template>
  249. </el-card>
  250. <el-card v-if="isShowJsList&&!isShowYpList">
  251. <div slot="header" class="clearfix" >
  252. <el-link type="primary" @click="showYpList">
  253. <i class="el-icon-arrow-left" style="margin-right: 5px; cursor: pointer;" ></i>
  254. <span >退出</span>
  255. </el-link>
  256. </div>
  257. <div class="add-yp-title">
  258. <span>{{ isEditJs?'编辑':'新增' }}</span>
  259. <div>
  260. <el-button size="small" style="background: rgb(168, 86, 248);color: white;" icon="el-icon-office-building" @click="conditionsSet">条件设置</el-button>
  261. <el-button size="small" style="background:rgb(37, 80, 162);;color: white;" icon="el-icon-connection" @click="linkEle">关联元素</el-button>
  262. </div>
  263. </div>
  264. <div class="add-yp-detail">
  265. <el-form label-position="left" label-width="80px" :model="jsDetail" :rules="jsRuleForm" ref="jsFormRef">
  266. <el-form-item label="检测项" prop="name">
  267. <el-input v-model="jsDetail.name"></el-input>
  268. </el-form-item>
  269. <el-form-item label="技术指标" prop="info">
  270. <div class="input-with-icon" v-for="(item, index) in jsDetail.info" :key="index">
  271. <el-input placeholder="请输入内容" v-model="item.name" class="input-with-select">
  272. <el-select v-model="item.symbol" slot="prepend" placeholder="请选择符号" style="width: 150px;">
  273. <el-option v-for="(item1,index) in fqOptions" :key="index" :label="item1.dictKey" :value="item1.dictKey"></el-option>
  274. </el-select>
  275. </el-input>
  276. <i class="el-icon-circle-plus-outline" @click="addBasicInfo1(index)" ></i>
  277. <i class="el-icon-remove-outline" @click="removeBasicInfo1(item,index)" v-if="index!==0"></i>
  278. </div>
  279. </el-form-item>
  280. </el-form>
  281. </div>
  282. <div class="add-yp-footer">
  283. <el-button type="primary" @click="addJsForm" :loading="addJsFormLoad">保存</el-button>
  284. </div>
  285. </el-card>
  286. </el-col>
  287. </el-row>
  288. <!-- 新增文件夹 -->
  289. <el-dialog
  290. title="新增"
  291. :visible.sync="addDialogVisible"
  292. width="30%"
  293. append-to-body
  294. >
  295. <div class="input-container">
  296. <span>规范文件夹名称</span>
  297. <el-input v-model="titleInput" placeholder="请输入内容" style="width: 300px;"></el-input>
  298. </div>
  299. <span slot="footer" class="dialog-footer">
  300. <el-button @click="addDialogVisible = false">取 消</el-button>
  301. <el-button type="primary" @click="addSaveFileClick" :loading="addSaveFileLoad">确 定</el-button>
  302. </span>
  303. </el-dialog>
  304. <!-- 管理规范 -->
  305. <el-dialog title="管理" :visible.sync="manageVisible" width="50%" append-to-body>
  306. <el-table :data="manageData" border height="550">
  307. <el-table-column property="name" label="规范名称" >
  308. <template slot-scope="scope">
  309. <el-input v-model="scope.row.name" placeholder="请输入内容"></el-input>
  310. </template>
  311. </el-table-column>
  312. <el-table-column property="name" label="文件名称" v-if="!isShowList" >
  313. <template slot-scope="scope">
  314. <div style="display: flex; ">
  315. <el-input v-model="scope.row.standardFile.fileName" placeholder="请输入内容"></el-input>
  316. <el-button
  317. type="text"
  318. size="small"
  319. style="color: rgb(219, 55, 55);"
  320. @click="delFile(scope.row,scope.$index )"
  321. >
  322. <i class="el-icon-delete"></i>
  323. </el-button>
  324. </div>
  325. </template>
  326. </el-table-column>
  327. <el-table-column label="操作" width="150">
  328. <template slot-scope="scope">
  329. <div style="display: flex; ">
  330. <el-upload
  331. v-if="!isShowList"
  332. class="upload-demo"
  333. action="#"
  334. :on-change="file => handleFileUpload(file, scope.row, scope.$index)"
  335. :show-file-list="false"
  336. :auto-upload="false"
  337. accept=".pdf, application/pdf"
  338. >
  339. <el-button size="small" type="text" style="margin-right: 5px;">上传文件</el-button>
  340. </el-upload>
  341. <el-button type="text" size="small" style="color: rgb(219, 55, 55);" @click="delManange(scope.$index, scope.row)">删除</el-button>
  342. </div>
  343. </template>
  344. </el-table-column>
  345. </el-table>
  346. <div slot="footer" class="dialog-footer">
  347. <el-button @click="manageVisible = false">取 消</el-button>
  348. <el-button type="primary" @click="manageSave" :loading="manageLoad">确 定</el-button>
  349. </div>
  350. </el-dialog>
  351. <!-- 新增规范文件 -->
  352. <el-dialog title="新增" :visible.sync="addFileDialogVisible" append-to-body width="30%" @close="closeAddFile">
  353. <el-form :model="fileForm" label-position="left" label-width="80px" :rules="fileRuleForm" ref="fileFormRef">
  354. <el-form-item label="规范名称" prop="name" >
  355. <el-input v-model="fileForm.name" ></el-input>
  356. </el-form-item>
  357. <el-form-item label="下达日期" prop="issueDate">
  358. <el-date-picker
  359. style="width: 100%;"
  360. format="yyyy 年 MM 月 dd 日"
  361. value-format="yyyy-MM-dd"
  362. v-model="fileForm.issueDate"
  363. type="date"
  364. placeholder="选择日期">
  365. </el-date-picker>
  366. </el-form-item>
  367. <el-form-item label="实施日期" prop="actualizeDate">
  368. <el-date-picker
  369. format="yyyy 年 MM 月 dd 日"
  370. value-format="yyyy-MM-dd"
  371. style="width: 100%;"
  372. v-model="fileForm.actualizeDate"
  373. type="date"
  374. placeholder="选择日期">
  375. </el-date-picker>
  376. </el-form-item>
  377. <el-form-item label="规范文件" >
  378. <el-upload
  379. :auto-upload="false"
  380. multiple
  381. class="upload-demo"
  382. action="#"
  383. :file-list="fileForm.standardFileUrl"
  384. :on-change="uploadImportData"
  385. accept=".pdf, application/pdf"
  386. :on-exceed="handleExceed"
  387. :on-remove="handleFileRemove"
  388. :limit="1"
  389. >
  390. <el-button size="small" type="primary">点击上传</el-button>
  391. <div slot="tip" class="el-upload__tip">允许文件格式.pdf</div>
  392. </el-upload>
  393. </el-form-item>
  394. </el-form>
  395. <div slot="footer" class="dialog-footer">
  396. <el-button @click="addFileDialogVisible = false">取 消</el-button>
  397. <el-button type="primary" @click="addFileRoleForm" :loading="addFileRuleLoad">确 定</el-button>
  398. </div>
  399. </el-dialog>
  400. <!-- 条件设置 -->
  401. <ConditionsSet ref="conditionsSetRef" @confirm="handleConditionsConfirm" />
  402. <!-- 关联元素 -->
  403. <LinkEle ref="linkEleRef" @confirm="confirmLinkEle" />
  404. <!-- 效果预览 -->
  405. <PreviewResult ref="previewResultRef" :ypList="ypList"/>
  406. </div>
  407. </template>
  408. <script>
  409. import {getLazytree} from "@/api/manager/wbsprivate";
  410. import ConditionsSet from './ConditionsSet.vue'
  411. import LinkEle from "./LinkEle.vue";
  412. import PreviewResult from './PreviewResult.vue'
  413. import {getPage,edit,add,deleteItem,getById, addInfo,editInfo,getInfoPage,deleteItemInfo,updateTypeByTwo,standardUpdate } from "@/api/ruleManage/fileRule.js";
  414. import { getStore, setStore } from "@/util/store";
  415. import { getDictionary } from "@/api/system/dict";
  416. export default {
  417. components: {
  418. ConditionsSet,
  419. LinkEle,
  420. PreviewResult
  421. },
  422. data() {
  423. return {
  424. id: '',
  425. parentId: '',
  426. tenant_id:'',
  427. projectid:'',
  428. treeId: '',
  429. treePid: '',
  430. defaultProps: {
  431. children: "children",
  432. label: "title",
  433. isLeaf: function (data) {
  434. return !data.hasChildren || (data.isExistForm==1);
  435. },
  436. },
  437. defaultExpandedKeys: [],
  438. curreenttid: '',
  439. expandName: this.$route.fullPath,
  440. ruleItemOptions:[
  441. ],
  442. total: 0,
  443. ruleLoading: false,
  444. addDialogVisible:false,
  445. saveBatchLoading: false,
  446. addSaveFileLoad:false,
  447. titleInput:'',
  448. isShowList:true,
  449. ruleItemOptionsDetail:[],
  450. ruleItemOptionsDetailLoading: false,
  451. currentPage: 1,
  452. pageSize: 35, // 8列 * 5行 = 40
  453. total: 0,
  454. currentPage1: 1,
  455. ruleItem: {},
  456. ruleItemDetail: {},
  457. pageSize1: 35, // 8列 * 5行 = 40
  458. total1: 0,
  459. isShowYpList:true,
  460. isShowDetail:false,
  461. ruleDataDetail: {},
  462. ypDetail: {
  463. name: '',
  464. info: [{ name: '' }]
  465. },
  466. saveYpLoad: false,
  467. ypRuleForm: {
  468. name: [
  469. { required: true, message: '请输入样品名称', trigger: 'blur' }
  470. ],
  471. },
  472. manageVisible: false,
  473. manageData: [],
  474. manageLoad: false,
  475. addFileDialogVisible:false,
  476. addFileRuleLoad:false,
  477. fileForm:{
  478. standardFileUrl: [], // 用于展示的文件列表
  479. files: [] // 存储实际的文件对象
  480. },
  481. fileRuleForm:{
  482. name: [
  483. { required: true, message: '请输入规范名称', trigger: 'blur' }
  484. ],
  485. issueDate: [
  486. { required: true, message: '请输入下达日期', trigger: 'blur' }
  487. ],
  488. actualizeDate: [
  489. { required: true, message: '请输入实施日期', trigger: 'blur' }
  490. ],
  491. },
  492. ypList:[
  493. {id:1,name:'样品名称',
  494. info:
  495. [{}]
  496. },
  497. ],
  498. jsList:[
  499. {id:1,name:'技术指标名称',
  500. info:
  501. []
  502. },
  503. ],
  504. isShowJsList:false,
  505. isEditYp: false,
  506. isEditJs: false,
  507. jsDetail: {
  508. name: '',
  509. info: [{ name: '',symbol:'' }, ]
  510. },
  511. addJsFormLoad: false,
  512. jsRuleForm: {
  513. name: [
  514. { required: true, message: '请输入技术指标名称', trigger: 'blur' }
  515. ],
  516. info: {
  517. validator: (rule, value, callback) => {
  518. if (!value || !value.every(item => item.symbol)) {
  519. callback(new Error('每一项技术指标都必须选择符号'));
  520. } else {
  521. callback();
  522. }
  523. },
  524. trigger: 'blur'
  525. }
  526. },
  527. fqOptions: [
  528. ],
  529. conditionsSetVisible:false,//条件设置弹窗是否显示
  530. isUploadVisible:false,//上传文件弹窗是否显示
  531. delIds:[],
  532. delFileIds:[],
  533. refreshLoad:false
  534. };
  535. },
  536. created(){
  537. console.log(111111111111);
  538. this.getFqOptions()
  539. const { id, tenant_id,projectid} = this.$route.query;
  540. this.id = id;
  541. this.parentId = 0;
  542. this.tenant_id = tenant_id;
  543. this.projectid = projectid;
  544. this.defaultExpandedKeys = getStore({ name: this.expandName });
  545. this.curreenttid= getStore({ name:'curreenttid' });
  546. this.treePid = getStore({ name:'treePid' });
  547. console.log(this.curreenttid,'this.curreenttid');
  548. if (this.curreenttid) {
  549. this.treeId = this.curreenttid;
  550. this.getRuleItemOptions();
  551. }
  552. },
  553. beforeRouteLeave(to, from, next) {
  554. this.curreenttid=''
  555. setStore({
  556. name: 'curreenttid',
  557. content: this.curreenttid,
  558. type: true, // sessionStorage
  559. });
  560. next();
  561. },
  562. methods: {
  563. //获取符号字典
  564. getFqOptions(){
  565. getDictionary({
  566. code: "u_standard_symbol",
  567. }).then((res) => {
  568. this.fqOptions = res.data.data;
  569. });
  570. },
  571. //获取规范文件夹数据
  572. getRuleItemOptions() {
  573. this.ruleLoading = true;
  574. getPage({
  575. privateId:this.treeId,
  576. current:this.currentPage,
  577. size:this.pageSize,
  578. type: 1,
  579. }).then((res) => {
  580. this.ruleLoading = false;
  581. if (res.data.code === 200) {
  582. this.ruleItemOptions = res.data.data.records;
  583. this.total = res.data.data.total;
  584. } else {
  585. this.ruleItemOptions=[]
  586. this.total = 0;
  587. this.$message.error(res.data.msg);
  588. }
  589. });
  590. },
  591. handleNodeClick(data,node) {
  592. this.currentPage = 1;
  593. this.currentPage1 = 1;
  594. this.treeId = data.primaryKeyId;
  595. this.treePid = data.id;
  596. this.getRuleItemOptions()
  597. //获取节点展开路径
  598. this.getExpandedKeys(node);
  599. setStore({
  600. name: 'curreenttid',
  601. content: data.primaryKeyId,
  602. type: true, //sessionStorage
  603. });
  604. setStore({
  605. name: 'treePid',
  606. content: data.id,
  607. type: true, //sessionStorage
  608. });
  609. this.isShowList = true;
  610. this.isShowDetail=false
  611. },
  612. getExpandedKeys(node) {
  613. let expandedKeys = [];
  614. while (node.parent) {
  615. expandedKeys.push(node.data.primaryKeyId);
  616. node = node.parent;
  617. }
  618. setStore({
  619. name: this.expandName,
  620. content: expandedKeys,
  621. type: true,
  622. });
  623. },
  624. loadNode(node, resolve) {
  625. let pid = 0;
  626. if (node.level != 0) {
  627. pid = node.data.id;
  628. }
  629. getLazytree(this.id, pid, this.tenant_id, this.projectid, {
  630. wbsType: 2,
  631. }).then((res) => {
  632. let arr = [];
  633. if (Array.isArray(res.data.data)) {
  634. arr = res.data.data;
  635. }
  636. return resolve(arr);
  637. });
  638. },
  639. goBackFirst() {
  640. this.isShowList = true;
  641. this.$router.go(-1);
  642. },
  643. goBack() {
  644. this.isShowList = true;
  645. },
  646. goBack1() {
  647. this.isShowDetail = false;
  648. this.getRuleDetail(this.ruleItem)
  649. },
  650. addRule(){
  651. this.titleInput = '';
  652. this.manageLoad=false
  653. this.addDialogVisible = true;
  654. },
  655. addSaveFileClick() {
  656. this.addSaveFileLoad = true;
  657. if (!this.titleInput) {
  658. this.$message.error('请输入规范文件夹名称');
  659. this.addSaveFileLoad = false;
  660. return;
  661. }
  662. const formData = new FormData();
  663. // 添加基本信息
  664. let objData={
  665. name: this.titleInput,
  666. type:1,
  667. privateId: this.treeId,
  668. }
  669. formData.append('data', new Blob([JSON.stringify(objData)], {
  670. type: 'application/json'
  671. }));
  672. add(
  673. formData
  674. ).then((res) => {
  675. this.addSaveFileLoad = false;
  676. if(res.data.code==200){
  677. this.$message.success(res.data.msg)
  678. this.addDialogVisible=false
  679. this.getRuleItemOptions();
  680. }else{
  681. this.$message.error(res.data.msg)
  682. }
  683. }).finally(() => {
  684. this.saveBatchLoading = false;
  685. });
  686. },
  687. ruleDetailClick(item){
  688. this.isShowList = false;
  689. this.getRuleDetail(item);
  690. this.ruleItem=item
  691. },
  692. //点击规范文件夹详情
  693. getRuleDetail(item) {
  694. this.ruleItemOptionsDetailLoading = true;
  695. getPage({
  696. current: this.currentPage1,
  697. size: this.pageSize1,
  698. type: 2,
  699. parentId: item.id,
  700. privateId: this.treeId,
  701. }).then((res) => {
  702. this.ruleItemOptionsDetailLoading = false;
  703. if (res.data.code === 200) {
  704. this.ruleItemOptionsDetail = res.data.data.records;
  705. this.total1 = res.data.data.total;
  706. } else {
  707. this.$message.error(res.msg);
  708. this.total1 = 0;
  709. }
  710. });
  711. },
  712. //
  713. ruleDetailClick1(item){
  714. this.getRuleDataDetail(item);
  715. this.getRuleDataDetail1(item);
  716. this.ruleItemDetail=item
  717. this.isShowDetail = true;
  718. },
  719. //获取规范数据详情
  720. getRuleDataDetail(item){
  721. getById({
  722. id: item.id,
  723. }).then((res) => {
  724. if (res.data.code === 200) {
  725. this.ruleDataDetail = res.data.data;
  726. console.log( this.ruleDataDetail,' this.ruleDataDetail');
  727. } else {
  728. this.$message.error(res.data.msg);
  729. }
  730. });
  731. },
  732. //获取规范数据详情
  733. getRuleDataDetail1(item,type){
  734. getInfoPage({
  735. current:1,
  736. size:100,
  737. type,
  738. standardId: item.id,
  739. }).then((res) => {
  740. this.ruleLoading = false;
  741. if (res.data.code === 200) {
  742. //
  743. if(type===1){
  744. this.ypList = res.data.data.records;
  745. }else if(type===2){
  746. this.jsList = res.data.data.records;
  747. }else{
  748. const records = res.data.data.records;
  749. // 根据 type 分类数据
  750. this.ypList = records.filter(record => record.type === 1);
  751. this.jsList = records.filter(record => record.type === 2);
  752. }
  753. } else {
  754. this.ypList = [];
  755. this.jsList = [];
  756. this.$message.error(res.data.msg);
  757. }
  758. });
  759. },
  760. addFile(){
  761. //新增规范文件
  762. this.addFileDialogVisible = true;
  763. },
  764. uploadImportData(file,fileList) {
  765. // 检查文件类型
  766. const isPDF = file.raw.type === 'application/pdf';
  767. const isCorrectExtension = file.raw.name.endsWith('.pdf');
  768. if (!isPDF || !isCorrectExtension) {
  769. this.$message.error('只能上传PDF文件!');
  770. const filteredList = fileList.filter((f) => f.raw.type === "application/pdf" && f.name.endsWith(".pdf"));
  771. this.fileForm.standardFileUrl = filteredList;
  772. return false; ; // 阻止后续处理
  773. }
  774. // 将文件对象存入 files 数组
  775. if (!this.fileForm.files) {
  776. this.fileForm.files = [];
  777. }
  778. this.fileForm.files.push(file.raw);
  779. // 更新显示的文件列表
  780. this.fileForm.standardFileUrl = this.fileForm.files.map(file => ({
  781. name: file.name,
  782. }));
  783. },
  784. handleFileRemove(file, fileList) {
  785. // return this.$confirm(`确定移除 ${file.name}?`);
  786. const index = this.fileForm.standardFileUrl.findIndex(f => f.name === file.name);
  787. console.log(index,'index');
  788. if (index !== -1) {
  789. this.fileForm.standardFileUrl.splice(index, 1); // 从数组中移除文件
  790. this.fileForm.files.splice(index, 1); // 从文件数组中移除文件
  791. }
  792. },
  793. handleExceed(files, fileList) {
  794. this.$message.warning(`当前限制只能上传一个文件,您已选择了 ${files.length + fileList.length} 个文件,请重新选择!`);
  795. },
  796. async addFileRoleForm(){
  797. const isValid = await this.$refs.fileFormRef.validate()
  798. if (!isValid) {
  799. this.$message.error('请填写完整的规范信息');
  800. return;
  801. }
  802. const formData = new FormData();
  803. // 添加基本信息
  804. let objData={
  805. name: this.fileForm.name,
  806. issueDate: this.fileForm.issueDate,
  807. actualizeDate: this.fileForm.actualizeDate,
  808. type: 2,
  809. privateId: this.treeId,
  810. parentId: this.ruleItem.id,
  811. }
  812. let data = JSON.stringify(objData);
  813. formData.append('data', new Blob([JSON.stringify(objData)], {
  814. type: 'application/json'
  815. }));
  816. // 添加文件
  817. if (this.fileForm.files && this.fileForm.files.length > 0) {
  818. this.fileForm.files.forEach(file => {
  819. formData.append('files', file);
  820. });
  821. }
  822. // add({
  823. // ...this.fileForm,
  824. // type: 2,
  825. // privateId: this.treeId,
  826. // parentId: this.ruleItem.id,
  827. // })
  828. console.log(formData,'formData');
  829. this.addFileRuleLoad=true
  830. add(formData)
  831. .then((res) => {
  832. this.addFileRuleLoad=false
  833. if(res.data.code==200){
  834. this.$message.success(res.data.msg)
  835. this.addFileDialogVisible=false
  836. this.getRuleDetail(this.ruleItem);
  837. }else{
  838. this.$message.error(res.data.msg)
  839. }
  840. }).finally(() => {
  841. this.addFileRuleLoad = false;
  842. });
  843. },
  844. closeAddFile(){
  845. this.addFileDialogVisible=false
  846. this.fileForm={
  847. }
  848. },
  849. handleCurrentChange(val) {
  850. this.currentPage = val
  851. this.getRuleItemOptions(); // 刷新数据
  852. },
  853. handleSizeChange(val) {
  854. this.pageSize = val
  855. this.currentPage = 1
  856. this.getRuleItemOptions(); // 刷新数据
  857. },
  858. handleCurrentChange1(val) {
  859. this.currentPage1 = val
  860. this.getRuleDetail(this.ruleItem);
  861. },
  862. handleSizeChange1(val) {
  863. this.pageSize1 = val
  864. this.currentPage1= 1
  865. this.getRuleDetail(this.ruleItem); // 刷新数据
  866. },
  867. addYp(){
  868. this.isShowYpList = false;
  869. this.isShowJsList = false;
  870. this.isEditYp = false;
  871. this.ypDetail = {
  872. name: '',
  873. info: [{ name: '' }]
  874. };
  875. },
  876. showYpList() {
  877. this.isShowYpList = true;
  878. },
  879. // 添加基础信息行
  880. addBasicInfo(index) {
  881. this.ypDetail.info.splice(index + 1, 0, { name: '' });
  882. },
  883. // 删除基础信息行
  884. removeBasicInfo(item,index) {
  885. if(item.id==''){
  886. this.ypDetail.info.splice(index, 1);
  887. }else{
  888. this.$confirm('删除后,数据将无法恢复,是否确认删除!', '提示', {
  889. confirmButtonText: '确定',
  890. cancelButtonText: '取消',
  891. type: 'warning'
  892. }).then(() => {
  893. deleteItemInfo({id:item.id}).then((res) => {
  894. if(res.data.code==200){
  895. this.$message.success(res.data.msg);
  896. this.getRuleDataDetail(this.ruleItemDetail);
  897. this.getRuleDataDetail1(this.ruleItemDetail,1);
  898. this.ypDetail.info.splice(index, 1);
  899. }else{
  900. this.$message.error(res.data.msg);
  901. }
  902. });
  903. }).catch(() => {
  904. this.$message.info('已取消删除');
  905. })
  906. }
  907. },
  908. async saveYpForm(){
  909. const isValid = await this.$refs.ypFormRef.validate()
  910. if (!isValid) {
  911. this.$message.error('请填写完整的样品信息');
  912. return;
  913. }
  914. this.saveYpLoad = true;
  915. this.ypDetail.info.forEach((item)=>{
  916. item.type=1
  917. })
  918. if(!this.isEditYp){
  919. addInfo({
  920. ...this.ypDetail,
  921. type: 1,
  922. standardId: this.ruleItemDetail.id,
  923. // parentId: this.ruleItemDetail.id,
  924. }).then((res) => {
  925. if(res.data.code==200){
  926. this.$message.success(res.data.msg)
  927. this.getRuleDataDetail(this.ruleItemDetail);
  928. this.getRuleDataDetail1(this.ruleItemDetail,1);
  929. this.isShowYpList= true;
  930. this.isShowJsList=true
  931. }else{
  932. this.$message.error(res.data.msg)
  933. }
  934. }).finally(() => {
  935. this.saveYpLoad = false;
  936. });
  937. }else{
  938. editInfo({
  939. ...this.ypDetail,
  940. type: 1,
  941. standardId: this.ruleItemDetail.id,
  942. // parentId: this.ruleItemDetail.id,
  943. }).then((res) => {
  944. if(res.data.code==200){
  945. this.$message.success(res.data.msg)
  946. this.getRuleDataDetail(this.ruleItemDetail);
  947. this.getRuleDataDetail1(this.ruleItemDetail,1);
  948. this.isShowYpList= true;
  949. this.isShowJsList=true
  950. }else{
  951. this.$message.error(res.data.msg)
  952. }
  953. }).finally(() => {
  954. this.saveYpLoad = false;
  955. });
  956. }
  957. },
  958. // 管理文件夹
  959. manageFolder(){
  960. this.delFileIds=[];
  961. this.delIds=[];
  962. this.manageVisible = true;
  963. if(!this.isShowList){
  964. this.manageData=JSON.parse(JSON.stringify(this.ruleItemOptionsDetail));
  965. this.manageData.forEach(item=>{
  966. item.filesCount=0;
  967. if(item.standardFile===null){
  968. item.standardFile=[];
  969. }
  970. })
  971. }else{
  972. this.manageData=JSON.parse(JSON.stringify(this.ruleItemOptions));
  973. }
  974. },
  975. delManange(index,row){
  976. console.log(this.isShowList,'isShowList');
  977. if(this.isShowList){
  978. this.$confirm('删除后,数据将无法恢复,是否确认删除!', '提示', {
  979. confirmButtonText: '确定',
  980. cancelButtonText: '取消',
  981. type: 'warning'
  982. }).then(() => {
  983. // this.manageData.splice(index, 1);
  984. deleteItem({id:row.id}).then((res) => {
  985. if(res.data.code==200){
  986. this.$message.success(res.data.msg);
  987. this.getRuleItemOptions();
  988. this.manageData.splice(index, 1);
  989. }else{
  990. this.$message.error(res.data.msg);
  991. }
  992. });
  993. }).catch(() => {
  994. this.$message.info('已取消删除');
  995. })
  996. }else{
  997. this.$confirm('删除后,数据将无法恢复,是否确认删除!', '提示', {
  998. confirmButtonText: '确定',
  999. cancelButtonText: '取消',
  1000. type: 'warning'
  1001. }).then(() => {
  1002. this.delIds.push(row.id)
  1003. this.manageData.splice(index, 1);
  1004. row.filesCount = 0; // 设置文件大小
  1005. }).catch(() => {
  1006. this.$message.info('已取消删除');
  1007. })
  1008. }
  1009. },
  1010. putFile(item,index){
  1011. this.isUploadVisible = true;
  1012. },
  1013. handleFileUpload(file,row,index) {
  1014. const isPDF = file.raw.type === 'application/pdf';
  1015. const isCorrectExtension = file.raw.name.endsWith('.pdf');
  1016. if (!isPDF || !isCorrectExtension) {
  1017. this.$message.error('只能上传PDF文件!');
  1018. return false; // 阻止后续处理
  1019. }
  1020. if(!file) return
  1021. row.file=file.raw; // 获取原始文件对象
  1022. row.standardFile.fileName = file.name; // 设置文件名
  1023. row.filesCount = 1; // 设置文件大小
  1024. // 强制更新视图,确保文件上传按钮显示正确
  1025. this.$nextTick(() => {
  1026. this.manageData = [...this.manageData]; // 强制更新视图
  1027. });
  1028. // 在这里处理文件上传逻辑
  1029. },
  1030. delFile(row,id){
  1031. console.log(row,'row');
  1032. const {standardFile}=row;
  1033. console.log(standardFile,'standardFile');
  1034. if(standardFile&&standardFile.id){
  1035. this.delFileIds.push(standardFile.id)
  1036. }
  1037. row.filesCount = 0; // 设置文件大小
  1038. row.file=null; // 获取原始文件对象
  1039. row.standardFile.fileName = ''; // 设置文件名
  1040. // 如果有文件ID,则执行删除操作
  1041. },
  1042. manageSave(){
  1043. this.manageLoad = true;
  1044. const arr = this.manageData.map(item => ({ id: item.id, name: item.name,type:this.isShowList?1:2 }));
  1045. console.log(arr,'arr');
  1046. if(this.isShowList){
  1047. edit(arr ).then((res) => {
  1048. if (res.data.code === 200) {
  1049. this.$message.success(res.data.msg);
  1050. this.manageVisible = false;
  1051. if(!this.isShowList){
  1052. this.getRuleDetail(this.ruleItem);
  1053. this.manageData = JSON.parse(JSON.stringify(this.ruleItemOptionsDetail));
  1054. }else{
  1055. this.getRuleItemOptions();
  1056. this.manageData = JSON.parse(JSON.stringify(this.ruleItemOptions));
  1057. }
  1058. } else {
  1059. this.$message.error(res.data.msg);
  1060. }
  1061. }).finally(() => {
  1062. this.manageLoad = false;
  1063. });
  1064. }else{
  1065. let objData=this.manageData.map(item => ({ id: item.id, name: item.name,filesCount: item.filesCount,file:item.file }));
  1066. let filesArr=this.manageData.map(item => item.file);
  1067. const formData = new FormData();
  1068. console.log(objData,'objData');
  1069. let objData1=this.manageData.map(item => ({ id: item.id, name: item.name,filesCount: item.filesCount}));
  1070. formData.append('data', new Blob([JSON.stringify(objData1)], {
  1071. type: 'application/json'
  1072. }))
  1073. let ids=this.delIds
  1074. formData.append('delIds', new Blob([JSON.stringify(ids)], {
  1075. type: 'application/json'
  1076. }))
  1077. let delFileIds=this.delFileIds;
  1078. formData.append('delFileIds', new Blob([JSON.stringify(delFileIds)], {
  1079. type: 'application/json'
  1080. }))
  1081. console.log(filesArr,'filesArr');
  1082. if(filesArr.length>0){
  1083. for(let i=0;i<filesArr.length;i++){
  1084. formData.append('files', filesArr[i]);
  1085. }
  1086. }
  1087. console.log(formData,'formData');
  1088. console.log(this.delFileIds,'this.delFileIds;');
  1089. console.log(this.delIds,'this.delIds;');
  1090. updateTypeByTwo(formData ).then((res) => {
  1091. if (res.data.code === 200) {
  1092. this.$message.success(res.data.msg);
  1093. this.manageVisible = false;
  1094. if(!this.isShowList){
  1095. this.getRuleDetail(this.ruleItem);
  1096. this.manageData = JSON.parse(JSON.stringify(this.ruleItemOptionsDetail));
  1097. }else{
  1098. this.getRuleItemOptions();
  1099. this.manageData = JSON.parse(JSON.stringify(this.ruleItemOptions));
  1100. }
  1101. } else {
  1102. this.$message.error(res.data.msg);
  1103. }
  1104. }).finally(() => {
  1105. this.manageLoad = false;
  1106. });
  1107. }
  1108. },
  1109. handleEdit(item, index) {
  1110. this.isShowYpList = false;
  1111. this.isShowJsList = false;
  1112. this.ypDetail = JSON.parse(JSON.stringify(item));
  1113. this.isEditYp = true;
  1114. },
  1115. handleDelete(item,index) {
  1116. this.$confirm('删除后,数据无法恢复,是否确认删除?', '删除确认', {
  1117. confirmButtonText: '确定',
  1118. cancelButtonText: '取消',
  1119. type: 'warning'
  1120. }).then(() => {
  1121. // this.ypList.splice(index, 1);
  1122. deleteItemInfo({ id: item.id }).then((res) => {
  1123. if(res.data.code==200){
  1124. this.$message.success(res.data.msg)
  1125. this.getRuleDataDetail(this.ruleItemDetail);
  1126. this.getRuleDataDetail1(this.ruleItemDetail,1);
  1127. }else{
  1128. this.$message.error(res.data.msg)
  1129. }
  1130. });
  1131. }).catch(() => {});
  1132. },
  1133. handleDelete1(item,index) {
  1134. this.$confirm('删除后,数据无法恢复,是否确认删除?', '删除确认', {
  1135. confirmButtonText: '确定',
  1136. cancelButtonText: '取消',
  1137. type: 'warning'
  1138. }).then(() => {
  1139. // this.jsList.splice(index, 1);
  1140. deleteItemInfo({ id: item.id }).then((res) => {
  1141. if(res.data.code==200){
  1142. this.$message.success(res.data.msg)
  1143. this.getRuleDataDetail(this.ruleItemDetail);
  1144. this.getRuleDataDetail1(this.ruleItemDetail,2);
  1145. }else{
  1146. this.$message.error(res.data.msg)
  1147. }
  1148. });
  1149. }).catch(() => {});
  1150. },
  1151. //新增技术指标
  1152. addJs(){
  1153. this.isShowJsList = true;
  1154. this.isShowYpList = false;
  1155. this.isEditJs = false;
  1156. this.jsDetail = {
  1157. name: '',
  1158. info: [{ name: '',select:'' }]
  1159. };
  1160. },
  1161. handleEditJs1(item, index) {
  1162. // 处理编辑逻辑
  1163. this.jsDetail = JSON.parse(JSON.stringify(item));
  1164. console.log( this.jsDetail,' this.jsDetail');
  1165. this.isEditJs = true;
  1166. this.isShowJsList = true;
  1167. this.isShowYpList = false;
  1168. },
  1169. addBasicInfo1(index) {
  1170. this.jsDetail.info.splice(index + 1, 0, { name: '', select: '' });
  1171. },
  1172. async addJsForm() {
  1173. const isValid = await this.$refs.jsFormRef.validate();
  1174. if (!isValid) {
  1175. this.$message.error('请填写完整的技术指标信息,并确保每一项都选择了符号');
  1176. return;
  1177. }
  1178. this.addJsFormLoad = true;
  1179. this.jsDetail.info.forEach((item)=>{
  1180. item.type=2
  1181. })
  1182. if(!this.isEditJs){
  1183. addInfo({
  1184. ...this.jsDetail,
  1185. type: 2,
  1186. standardId: this.ruleItemDetail.id,
  1187. }).then((res) => {
  1188. if(res.data.code==200){
  1189. this.$message.success(res.data.msg)
  1190. this.getRuleDataDetail(this.ruleItemDetail);
  1191. this.getRuleDataDetail1(this.ruleItemDetail,2);
  1192. this.isShowYpList= true;
  1193. this.isShowJsList=false
  1194. }else{
  1195. this.$message.error(res.data.msg)
  1196. }
  1197. }).finally(() => {
  1198. this.addJsFormLoad = false;
  1199. });
  1200. }else{
  1201. editInfo({
  1202. ...this.jsDetail,
  1203. type: 2,
  1204. standardId: this.ruleItemDetail.id,
  1205. }).then((res) => {
  1206. if(res.data.code==200){
  1207. this.$message.success(res.data.msg)
  1208. this.getRuleDataDetail(this.ruleItemDetail);
  1209. this.getRuleDataDetail1(this.ruleItemDetail,2);
  1210. this.isShowYpList= true;
  1211. this.isShowJsList=false
  1212. }else{
  1213. this.$message.error(res.data.msg)
  1214. }
  1215. }).finally(() => {
  1216. this.addJsFormLoad = false;
  1217. });
  1218. }
  1219. //新增技术指标
  1220. },
  1221. // 删除基础信息行
  1222. removeBasicInfo1(item,index) {
  1223. if(item.id==''){
  1224. this.jsDetail.info.splice(index, 1);
  1225. }else{
  1226. this.$confirm('删除后,数据将无法恢复,是否确认删除!', '提示', {
  1227. confirmButtonText: '确定',
  1228. cancelButtonText: '取消',
  1229. type: 'warning'
  1230. }).then(() => {
  1231. deleteItemInfo({id:item.id}).then((res) => {
  1232. if(res.data.code==200){
  1233. this.$message.success(res.data.msg);
  1234. this.jsDetail.info.splice(index, 1);
  1235. this.getRuleDataDetail(this.ruleItemDetail);
  1236. this.getRuleDataDetail1(this.ruleItemDetail,1);
  1237. this.ypDetail.info.splice(index, 2);
  1238. }else{
  1239. this.$message.error(res.data.msg);
  1240. }
  1241. });
  1242. }).catch(() => {
  1243. this.$message.info('已取消删除');
  1244. })
  1245. }
  1246. },
  1247. //条件设置
  1248. conditionsSet(){
  1249. if(!this.jsDetail.id){
  1250. this.$message.error('请先保存技术指标信息');
  1251. return;
  1252. }
  1253. if(this.jsDetail.info[0].name === '') {
  1254. this.$message.error('请先添加技术指标内容');
  1255. return;
  1256. }
  1257. this.$refs.conditionsSetRef.show(this.jsDetail.info,this.ruleItemDetail.id,this.jsDetail.id);
  1258. },
  1259. // 添加确认取消处理方法
  1260. handleConditionsConfirm() {
  1261. console.log('确认条件设置')
  1262. },
  1263. handleConditionsCancel() {
  1264. console.log('取消条件设置')
  1265. },
  1266. //关联元素
  1267. linkEle() {
  1268. if(!this.jsDetail.id){
  1269. this.$message.error('请先保存技术指标信息');
  1270. return;
  1271. }
  1272. if(this.jsDetail.info[0].name === '') {
  1273. this.$message.error('请先添加技术指标内容');
  1274. return;
  1275. }
  1276. console.log(this.treePid,'this.treePid)');
  1277. this.$refs.linkEleRef.show(this.jsDetail.info, this.treeId,this.id, this.projectid,this.ruleItemDetail.id,this.treePid,this.jsDetail.id);
  1278. },
  1279. confirmLinkEle() {
  1280. console.log('确认关联元素')
  1281. },
  1282. //效果预览
  1283. previewRes() {
  1284. this.$refs.previewResultRef.show()
  1285. },
  1286. //更新
  1287. refreshRule(){
  1288. this.refreshLoad=true
  1289. standardUpdate({
  1290. id: this.ruleItemDetail.id,
  1291. }).then((res) => {
  1292. if(res.data.code==200){
  1293. this.$message.success(res.data.msg)
  1294. this.getRuleDataDetail({id:res.data.data});
  1295. this.getRuleDataDetail1({id:res.data.data});
  1296. }else{
  1297. this.$message.error(res.data.msg)
  1298. }
  1299. }).finally(() => {
  1300. this.refreshLoad=false
  1301. });
  1302. }
  1303. }
  1304. }
  1305. </script>
  1306. <style scoped lang="scss">
  1307. .container-box {
  1308. height: calc(100vh - 120px);
  1309. box-sizing: border-box;
  1310. }
  1311. .h-100 {
  1312. height: 100%;
  1313. }
  1314. .tree-container {
  1315. height: calc(100vh - 120px);
  1316. overflow-y: auto;
  1317. }
  1318. .box-card {
  1319. display: flex;
  1320. flex-direction: column;
  1321. height: 100%;
  1322. // 内容区域
  1323. .el-card__body {
  1324. flex: 1;
  1325. display: flex;
  1326. flex-direction: column;
  1327. overflow: hidden;
  1328. }
  1329. }
  1330. .rule-box{
  1331. width: 100%;
  1332. display: grid;
  1333. grid-template-columns: repeat(7, 1fr);
  1334. grid-template-rows: repeat(4, 1fr);
  1335. gap: 50px;
  1336. padding: 20px;
  1337. height: 600px;
  1338. overflow-y:hidden;
  1339. .rule-box-item{
  1340. text-align: center;
  1341. display: flex;
  1342. flex-direction: column;
  1343. align-items: center;
  1344. }
  1345. .rule-box-item-icon {
  1346. margin-bottom: 8px;
  1347. }
  1348. .rule-box-item-title {
  1349. // width: 100px; /* 设置一个固定的宽度,可以根据需要调整 */
  1350. font-size: 14px;
  1351. width: 100%;
  1352. overflow: hidden;
  1353. text-overflow: ellipsis;
  1354. // white-space: nowrap;
  1355. }
  1356. }
  1357. .input-container {
  1358. display: flex;
  1359. align-items: center;
  1360. }
  1361. .input-container span {
  1362. margin-right: 10px; /* 根据需要调整间距 */
  1363. }
  1364. .box-card-title{
  1365. font-weight: bolder;
  1366. font-size: 24px;
  1367. }
  1368. .box-card-content1{
  1369. margin-top: 10px;
  1370. display: flex;
  1371. justify-content: space-between;
  1372. width: 100%;
  1373. .box-card-content1-left{
  1374. display: flex;
  1375. .box-card-content1-left-item{
  1376. margin-right: 25px;
  1377. }
  1378. }
  1379. }
  1380. .box-card-content2{
  1381. margin-top: 10px;
  1382. // border: 1px solid red;
  1383. height: calc(100vh - 270px);
  1384. .box-card-content2-title{
  1385. margin-top: 10px;
  1386. color: rgba(130, 130, 130, 1);
  1387. font-size: 10px;;
  1388. width: 98%;
  1389. padding-left: 20px;
  1390. font-size: 18px;
  1391. line-height: 40px;
  1392. background: rgb(240, 240, 240);
  1393. .title-container {
  1394. display: flex;
  1395. justify-content: space-between;
  1396. align-items: center;
  1397. padding-right: 20px;
  1398. i {
  1399. cursor: pointer;
  1400. font-size: 22px;
  1401. color: #2550A2;
  1402. // 添加过渡效果
  1403. &:hover {
  1404. color: #409EFF;
  1405. }
  1406. }
  1407. }
  1408. }
  1409. }
  1410. .box-card-content2-bottom{
  1411. margin-top: 20px;
  1412. }
  1413. .add-yp-title{
  1414. font-size: 20px;
  1415. font-weight: bold;
  1416. padding: 10px;
  1417. display: flex;
  1418. justify-content: space-between;
  1419. }
  1420. .input-with-icon {
  1421. display: flex;
  1422. align-items: center;
  1423. margin-bottom: 15px;
  1424. .el-input {
  1425. flex: 1;
  1426. }
  1427. i {
  1428. margin-left: 10px;
  1429. font-size: 20px;
  1430. cursor: pointer;
  1431. &.el-icon-circle-plus-outline {
  1432. color: #409EFF;
  1433. &:hover {
  1434. color: #66b1ff;
  1435. }
  1436. }
  1437. &.el-icon-remove-outline {
  1438. color: #F56C6C;
  1439. &:hover {
  1440. color: #f78989;
  1441. }
  1442. }
  1443. }
  1444. }
  1445. .add-yp-detail{
  1446. flex: 1;
  1447. overflow-y: auto;
  1448. padding: 20px;
  1449. height: calc(100vh - 342px); /* 减去标题和底部按钮的高度 */
  1450. }
  1451. // 新增底部按钮容器样式
  1452. .add-yp-footer {
  1453. display: flex;
  1454. justify-content: center;
  1455. padding: 20px 0;
  1456. // 可选: 添加上边框
  1457. border-top: 1px solid #EBEEF5;
  1458. }
  1459. .box-card-content2-top{
  1460. display: flex;
  1461. flex-direction: column;
  1462. height: 50%;
  1463. // border: 1px solid orangered;
  1464. }
  1465. .box-card-content2-list{
  1466. margin-top: 20px;
  1467. // height: 250px;
  1468. overflow-y: auto;
  1469. // border: 1px solid blue;
  1470. .eg{
  1471. color:rgba(37, 80, 162, 1);
  1472. margin-right: 10px;
  1473. }
  1474. .box-card-content2-list-item{
  1475. height: 80px;
  1476. padding: 10px;
  1477. border: 2px solid #EBEEF5;
  1478. margin-bottom: 10px;
  1479. }
  1480. .box-card-content2-list-item-list{
  1481. display: flex;
  1482. margin-top: 20px;
  1483. align-items: center;
  1484. position: relative;
  1485. .operation-icons {
  1486. position: absolute;
  1487. right: 10px;
  1488. top: 10px;
  1489. display: flex;
  1490. gap: 10px;
  1491. i {
  1492. cursor: pointer;
  1493. font-size: 16px;
  1494. &.el-icon-edit {
  1495. color: #409EFF;
  1496. &:hover {
  1497. color: #66b1ff;
  1498. }
  1499. }
  1500. &.el-icon-delete {
  1501. color: #F56C6C;
  1502. &:hover {
  1503. color: #f78989;
  1504. }
  1505. }
  1506. }
  1507. }
  1508. .basic-info{
  1509. color: gray;
  1510. font-size: 14px;
  1511. }
  1512. .box-card-content2-list-item-list-basic{
  1513. display: flex;
  1514. margin-left: 10px;
  1515. width: 100%;
  1516. overflow-x: auto;
  1517. flex: 1;
  1518. .basic-item-info{
  1519. margin-right: 10px;
  1520. margin-right: 20px;
  1521. flex-shrink: 0; // 防止项目被压缩
  1522. }
  1523. }
  1524. }
  1525. }
  1526. .empty-container{
  1527. height: 600px;
  1528. }
  1529. .dialog-footer{
  1530. text-align: center;
  1531. }
  1532. </style>