You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

356 lines
13 KiB

1 year ago
  1. <template>
  2. <div style="display: flex;">
  3. <div :style="`width: 258px;height:${mainHeight}px;border: 1px solid #EEE;`">
  4. <div style="margin:2px 2px 2px 2px;">
  5. <el-input placeholder="输入关键字进行过滤" v-model="filterText" size="small" />
  6. </div>
  7. <div>
  8. <el-tree :style="`overflow: scroll;width: 200px;height:${mainHeight - 40}px;`" :data="pacsTemplateTree"
  9. :props="treeprops" @node-click="handleNode" :filter-node-method="filterNode" :expand-on-click-node="false"
  10. highlight-current ref="ref_tree">
  11. <span class="custom-tree-node" slot-scope="{ node, data }">
  12. <div>
  13. <span class="treeicons">
  14. <img style="width:20px;height:20px;vertical-align: sub;" src="@/assets/images/order.png"
  15. v-if="!data.parentId" />
  16. </span>
  17. <span :class="!data.parentId ? 'maxtitle' : 'mintitle'">{{ node.label }}
  18. </span>
  19. </div>
  20. </span>
  21. </el-tree>
  22. </div>
  23. </div>
  24. <div :style="`display: block;width:${window.pageWidth - 200 - 30}px; margin-left: 5px;`">
  25. <div style="display: flex;">
  26. <div :style="`width: ${window.pageWidth - 200 - 30 - 250}px;`">
  27. <el-table :data="description" border :height="tableHeight" highlight-current-row
  28. @selection-change="selectionChangeDes" size="small" ref="ref_description">
  29. <el-table-column type="selection" width="40" align="center" />
  30. <el-table-column prop="description" label="描述" min-width="400" />
  31. <el-table-column prop="conclusion" label="结论" min-width="150" align="center" />
  32. </el-table>
  33. </div>
  34. <div style="width: 240px;margin-left: 5px;">
  35. <el-table :data="conclusionAll" border :height="tableHeight" highlight-current-row
  36. @selection-change="selectionChangeCon" size="small" ref="ref_conclusion">
  37. <el-table-column type="selection" width="40" align="center" />
  38. <el-table-column prop="conclusion" label="结论" min-width="150" />
  39. </el-table>
  40. </div>
  41. </div>
  42. <div style="margin-top: 5px;">
  43. <span>检查结果</span>
  44. <el-input style="width: 100%;" type="textarea" v-model="result" placeholder="请输入描述"
  45. :autosize="{ minRows: 6, maxRows: 6 }" />
  46. </div>
  47. <div style="margin-top: 5px;">
  48. <span>检查结论</span>
  49. <div style="display: flex;justify-content: space-between;">
  50. <el-input style="width: 100%;" type="textarea" v-model="summary" placeholder="请输入结论"
  51. :autosize="{ minRows: 4, maxRows: 4 }" />
  52. </div>
  53. </div>
  54. <div style="display: flex;justify-content: space-between;margin-top: 10px;">
  55. <div></div>
  56. <div>
  57. <!--
  58. <el-button type="primary" @click="btnTest" class="commonbutton">测试</el-button>
  59. -->
  60. <el-button type="primary" @click="btnClear" class="commonbutton">清除</el-button>
  61. <el-button type="primary" @click="btnDefault" class="commonbutton">默认结果</el-button>
  62. <el-button type="primary" @click="btnOk" class="commonbutton">确定</el-button>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. </template>
  68. <script>
  69. import moment from "moment";
  70. import { mapState } from "vuex";
  71. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  72. import { hadoopGet, hadoopPost, hadoopPut, hadoopDel } from "../../api/hadoopApi"
  73. import { arrayReduce, arrayExistObj, deepCopy, reMadeOrgTree } from "../../utlis/proFunc";
  74. import { getTreePids, getTreeAllChildIdsById, madeTree } from "../../utlis/tree";
  75. export default {
  76. components: {},
  77. props: ["refParams", "refFuncOther"],
  78. data() {
  79. return {
  80. filterText: '',
  81. description: [], // 描述
  82. conclusion: [], // 结论
  83. descriptionChoosedPre: [], // 前次选中
  84. descriptionChoosed: [], // 所有选中的描述的集合,切换部位时可用于描述初始化选择
  85. conclusionChoosed: [], // 选中的结论
  86. conclusionAll: [], // 所有选中的描述,对应的结论
  87. result: '', // 检查结果
  88. summary: '', // 小结
  89. pacsTemplateTree: [], //类别 + 模板树
  90. treeprops: {
  91. label: "displayName", // label/displayName
  92. value: "id",
  93. id: "id",
  94. children: "children",
  95. }, //树形组件的数据结构
  96. newQuery: 0, // 0 表示新查询,新查询不执行 selectionChangeDes 的取消查询动作
  97. };
  98. },
  99. //<el-tree :data="$store.state.customerOrg.ref_tree" :props="$store.state.customerOrg.treeprops" @node-click="treeclick"></el-tree>
  100. computed: {
  101. ...mapState(["window", "dialogWin"]),
  102. mainHeight() {
  103. return this.window.pageHeight - 118;
  104. },
  105. tableHeight() {
  106. return this.mainHeight - 120 - 80 - 80;
  107. },
  108. },
  109. //创建组件后
  110. created() {
  111. },
  112. //挂载组件完成
  113. mounted() {
  114. //获取体检单位列表树信息
  115. this.getPacsTemplateTree();
  116. this.init()
  117. },
  118. methods: {
  119. // 初始化数据
  120. init() {
  121. this.btnClear()
  122. this.description = []
  123. this.result = this.refParams.result || ''
  124. this.summary = this.refParams.summary || ''
  125. },
  126. //树过滤
  127. filterNode(value, data) {
  128. //console.log(value,data)
  129. if (!value) return true;
  130. return data['displayName'].indexOf(value) > -1;
  131. },
  132. //获取pacs结果模板
  133. getPacsTemplateTree() {
  134. let resultType = [], resultTemplate = [], treeData = []
  135. postapi('/api/app/BigtextResultType/GetList')
  136. .then(res => {
  137. if (res.code > -1) {
  138. resultType = res.data
  139. return postapi('/api/app/BigtextResultTemplate/GetList', {})
  140. }
  141. })
  142. .then(res => {
  143. if (res && res.code > -1) {
  144. res.data.forEach(e => {
  145. resultTemplate.push(Object.assign({}, e, { parentId: e.bigtextResultTypeId }))
  146. });
  147. treeData = resultType.concat(resultTemplate)
  148. // console.log('treeData',treeData,resultType,)
  149. this.pacsTemplateTree = madeTree(treeData, "children", "parentId", "id", null)
  150. }
  151. })
  152. },
  153. //点击树节点
  154. handleNode(data, node, prop) {
  155. let ids = getTreeAllChildIdsById(this.pacsTemplateTree, "children", "id", data.id)
  156. ids.unshift(data.id) // 加入自身节点
  157. // hadoopPost('pacsApi', '/api/app/BigtextResultTemplate/GetBigtextResultTemplateDetail', { bigtextResultTemplateIds: ids })
  158. postapi('/api/app/BigtextResultTemplate/GetBigtextResultTemplateDetail', { bigtextResultTemplateIds: ids })
  159. .then(res => {
  160. if (res.code > -1) {
  161. this.newQuery = 0
  162. this.description = res.data.descriptionDetail
  163. this.conclusion = res.data.conclusionDetail
  164. let lfind = -1
  165. this.description.forEach((e, i) => {
  166. let conclusion = this.conclusion.filter(c => {
  167. return c.bigtextResultTemplateId == e.bigtextResultTemplateId
  168. })
  169. e["conclusion"] = ""
  170. e["conclusionList"] = []
  171. conclusion.forEach(c => {
  172. e["conclusionList"].push(c)
  173. });
  174. if (conclusion.length == 1) e["conclusion"] = conclusion[0].conclusion
  175. // 初始选中状态
  176. lfind = arrayExistObj(this.descriptionChoosed, "description", e.description)
  177. if (lfind > -1) {
  178. // console.log('this.descriptionChoosed refresh', deepCopy(this.descriptionChoosed))
  179. this.$nextTick(() => {
  180. this.$refs['ref_description'].toggleRowSelection(this.description[i], true)
  181. })
  182. }
  183. });
  184. }
  185. })
  186. },
  187. // 选择描述
  188. selectionChangeDes(v) {
  189. this.newQuery++
  190. let lfind = 0
  191. v.forEach(e => {
  192. lfind = arrayExistObj(this.descriptionChoosed, "description", e.description)
  193. if (lfind == -1) {
  194. this.descriptionChoosed.push(e)
  195. }
  196. e.conclusionList.forEach(c => {
  197. lfind = arrayExistObj(this.conclusionAll, "conclusion", c.conclusion)
  198. if (lfind == -1) this.conclusionAll.push(c)
  199. });
  200. // 单个结论时,直接选中结论,多个则将结论添加至待选结论
  201. if (e.conclusion) {
  202. lfind = arrayExistObj(this.conclusionAll, "conclusion", e.conclusion)
  203. // console.log(lfind, e)
  204. if (lfind > -1) {
  205. this.$refs['ref_conclusion'].toggleRowSelection(this.conclusionAll[lfind], true)
  206. }
  207. }
  208. if (this.result) {
  209. if (!this.result.includes(e.description)) this.result += ';' + e.description
  210. } else {
  211. this.result = e.description
  212. }
  213. });
  214. // 这一次没选中的在上一次的选中当中,说明取消选择
  215. if (this.newQuery > 1) {
  216. let unChooseed = arrayReduce(deepCopy(this.description), v, "description=description")
  217. // console.log('this.descriptionChoosedPre,unChooseed', deepCopy(this.descriptionChoosedPre), unChooseed)
  218. unChooseed.forEach(e => {
  219. lfind = arrayExistObj(this.descriptionChoosedPre, "description", e.description)
  220. if (lfind > -1) {
  221. lfind = arrayExistObj(this.descriptionChoosed, "description", e.description)
  222. if (lfind > -1) this.descriptionChoosed.splice(lfind, 1)
  223. if (this.result.includes(e.description)) this.result = this.result.replaceAll(e.description + ";", "").replaceAll(e.description, "")
  224. if (e.conclusion) {
  225. lfind = arrayExistObj(this.conclusionAll, "conclusion", e.conclusion)
  226. if (lfind > -1) this.$refs['ref_conclusion'].toggleRowSelection(this.conclusionAll[lfind], false)
  227. }
  228. }
  229. });
  230. }
  231. this.descriptionChoosedPre = deepCopy(v)
  232. if (this.result) {
  233. if (this.result.substring(this.result.length - 1, this.result.length) == ";") this.result = this.result.substring(0, this.result.length - 1)
  234. }
  235. },
  236. // 选择结论(取消选择)
  237. selectionChangeCon(v) {
  238. let summarys = []
  239. v.forEach(e => {
  240. if (this.summary) {
  241. summarys = this.summary.split(";")
  242. if (summarys.indexOf(e.conclusion) == -1) this.summary += ';' + e.conclusion
  243. } else {
  244. this.summary = e.conclusion
  245. }
  246. });
  247. // if(this.summary && this.summary.substring())
  248. // 取消选择时
  249. let lfind = -1
  250. let unChooseed = arrayReduce(deepCopy(this.conclusionAll), v, "conclusion=conclusion")
  251. unChooseed.forEach(e => {
  252. if (this.summary) {
  253. summarys = this.summary.split(";")
  254. lfind = summarys.indexOf(e.conclusion)
  255. if (lfind > -1) summarys.splice(lfind, 1)
  256. this.summary = ''
  257. summarys.forEach((c, i) => {
  258. if (i == 0) {
  259. this.summary = c
  260. } else {
  261. this.summary += ";" + c
  262. }
  263. });
  264. }
  265. });
  266. },
  267. btnTest() {
  268. console.log('this.descriptionChoosed', this.descriptionChoosed)
  269. console.log('this.conclusionChoosed', this.conclusionChoosed)
  270. },
  271. // 清除所选描述与结论
  272. btnClear() {
  273. this.result = ''
  274. this.summary = ''
  275. this.descriptionChoosed = []
  276. this.$refs['ref_description'].clearSelection();
  277. this.conclusionChoosed = []
  278. this.conclusionAll = []
  279. this.$refs['ref_conclusion'].clearSelection();
  280. },
  281. // 默认结果
  282. btnDefault() {
  283. this.btnClear()
  284. this.result = this.refParams.row.defaultResult
  285. this.summary = '未见异常'
  286. },
  287. // 确定
  288. btnOk() {
  289. this.refFuncOther(this.refParams.row, this.refParams.index, { result: this.result, summary: this.summary })
  290. this.dialogWin.PacsTemplate = false
  291. },
  292. },
  293. watch: {
  294. "filterText"(newVal, oldVal) {
  295. if (newVal != oldVal) this.$refs['ref_tree'].filter(newVal);
  296. },
  297. "refParams.row.itemId"(newVal, oldVal) {
  298. if (newVal != oldVal) this.init();
  299. },
  300. "refParams.result"(newVal, oldVal) {
  301. if (newVal != oldVal){
  302. console.log("refParams.result",newVal, oldVal)
  303. this.result = newVal
  304. }
  305. },
  306. "refParams.summary"(newVal, oldVal) {
  307. if (newVal != oldVal){
  308. console.log("refParams.summary",newVal, oldVal)
  309. this.summary = newVal
  310. }
  311. },
  312. },
  313. };
  314. </script>
  315. <style lang="scss" scoped>
  316. @import "../../assets/css/global_dialog.css";
  317. @import "../../assets/css/global_table.css";
  318. @import "../../assets/css/global_input.css";
  319. @import "../../assets/css/global.css";
  320. @import "../../assets/css/global_tree.css";
  321. :deep .el-tree-node>.el-tree-node__children {
  322. overflow: visible;
  323. }
  324. </style>