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.

295 lines
12 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div style="display: flex;">
  3. <div style="width: 150px;height:500px;margin-top: -30px;overflow: scroll;border: 1px solid;">
  4. <el-tree :data="patientRegister.customerOrgTreeAll" :props="customerOrg.treeprops" @node-click="handleNode" />
  5. </div>
  6. <div style="display: block;width:650px;margin-top: -30px; margin-left: 5px;">
  7. <el-table :data="dataCusOrgOCX" border height="450" highlight-current-row @row-click="rowick" size="small"
  8. @selection-change="handleSelectionChange" @cell-contextmenu="onCellRightClick">
  9. <el-table-column prop="customerOrgId" label="体检单位" width="130">
  10. <template slot-scope="scope">
  11. <el-cascader v-model="scope.row.customerOrgId" :options="patientRegister.customerOrgTreeAll"
  12. :props="{ checkStrictly: true, expandTrigger: 'hover', ...customerOrg.treeprops, }" placeholder="请选择单位"
  13. :show-all-levels="false" disabled clearable size="small" @change="changeCustomerOrgId" style="width:125px;">
  14. </el-cascader>
  15. </template>
  16. </el-table-column>
  17. <el-table-column prop="customerOrgId" label="次数" width="50" align="center">
  18. <template slot-scope="scope">
  19. <el-select v-model="scope.row.customerOrgRegister" placeholder="次数" style="width: 50px" size="small"
  20. :disabled="scope.row.customerOrgId == dict.personOrgId"
  21. @change="changeMedicalTimes(scope.row.customerOrgId)" value-key="id">
  22. <el-option v-for="item in scope.row.customerOrgRegisterList" :key="item.id" :label="item.medicalTimes"
  23. :value="item" />
  24. </el-select>
  25. </template>
  26. </el-table-column>
  27. <el-table-column prop="dateType" label="日期方式" width="85" align="center">
  28. <template slot-scope="scope">
  29. <el-select v-model="scope.row.dateType" placeholder="请选择" filterable clearable size="small">
  30. <el-option label="登记日期" value="creationTime" />
  31. <el-option label="体检日期" value="medicalStartDate" />
  32. <el-option label="总检日期" value="summaryDate" />
  33. </el-select>
  34. </template>
  35. </el-table-column>
  36. <el-table-column prop="startDate" label="起始日期" width="80" align="center">
  37. <template slot-scope="scope">
  38. <el-date-picker v-model="scope.row.startDate" type="date" placeholder="截止日期" size="small" />
  39. </template>
  40. </el-table-column>
  41. <el-table-column prop="endDate" label="截止日期" width="80" align="center">
  42. <template slot-scope="scope">
  43. <el-date-picker v-model="scope.row.endDate" type="date" placeholder="截止日期" size="small" />
  44. </template>
  45. </el-table-column>
  46. <el-table-column prop="customerOrgGroupIds" label="分组" width="215">
  47. <template slot-scope="scope">
  48. <el-select v-model="scope.row.customerOrgGroupIds" multiple collapse-tags filterable clearable style="width:210px;"
  49. placeholder="请选择分组" size="small" @focus="getCustGroup(scope.$index,scope.row.customerOrgRegister.id)">
  50. <el-option v-for="item in scope.row.customerOrgGroupList" :key="item.value" :label="item.displayName" :value="item.id" />
  51. </el-select>
  52. </template>
  53. </el-table-column>
  54. </el-table>
  55. <div style="display: flex;margin-top: 8px;margin-left: 15px;">
  56. <div style="display: block;">
  57. <div>
  58. <span>日期方式</span>
  59. <el-radio-group v-model="dateType">
  60. <el-radio label="creationTime">登记日期</el-radio>
  61. <el-radio label="medicalStartDate">体检日期</el-radio>
  62. <el-radio label="summaryDate">总检日期 </el-radio>
  63. </el-radio-group>
  64. </div>
  65. <div style="margin-top: 5px;">
  66. <span>单位作为查询条件</span>
  67. <el-checkbox v-model="useCusOrg" />
  68. </div>
  69. </div>
  70. <div style="margin-left: 50px;margin-top: 5px;">
  71. <el-button type="primary" @click="readIdCard">确定</el-button>
  72. <el-button type="danger" @click="report.dialogCusOrgOCX = false">关闭</el-button>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </template>
  78. <script>
  79. import { mapState } from "vuex";
  80. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  81. import { tcdate } from "../../utlis/proFunc";
  82. import { getTreePids, getTreeAllChildIdsById } from "../../utlis/tree";
  83. export default {
  84. components: {},
  85. data() {
  86. return {
  87. preNodeId: '', //上一次点击树节点
  88. curNodeId: '', //本次点击树节点
  89. parentIds: [], //上级Id 数组
  90. childIds: [], //下级Id 数组
  91. dateType: 'creationTime',
  92. useCusOrg: true, //是否使用单位
  93. //体检单位,体检次数,日期类型,起止日期,分组
  94. dataCusOrgOCX: [{
  95. customerOrgId: '',
  96. customerOrgRegister: '', //已选的体检次数
  97. customerOrgRegisterList: [], //当前单位的体检次数信息
  98. dateType: 'creationTime', // 登记日期:creationTime;体检日期:medicalStartDate;总检日期:summaryDate
  99. startDate: '',
  100. endDate: '',
  101. customerOrgGroupIds: [], //已选分组
  102. customerOrgGroupList: [], //可选的分组
  103. }],
  104. };
  105. },
  106. //<el-tree :data="$store.state.customerOrg.customerOrgTree" :props="$store.state.customerOrg.treeprops" @node-click="treeclick"></el-tree>
  107. computed: {
  108. ...mapState(["dict", "customerOrg", "patientRegister", "report"]),
  109. },
  110. //创建组件后
  111. created() {
  112. this.dataCusOrgOCX = this.report.dataCusOrgOCX;
  113. },
  114. //挂载组件完成
  115. mounted() {
  116. //获取体检单位列表树信息
  117. this.getCustomerOrgTree();
  118. },
  119. methods: {
  120. //获取体检单位列表树信息
  121. getCustomerOrgTree() {
  122. getapi("/api/app/customerorg/getbycodeall").then((res) => {
  123. //customerOrgTree = res.data;
  124. console.log("res.data", res.data);
  125. this.patientRegister.customerOrgTreeAll = res.data;
  126. //tcdate(this.patientRegister.customerOrgTreeAll)
  127. });
  128. },
  129. //获取体检单位父级ID api/app/customer-org/parent/[CustomerOrgld
  130. getCustomerOrgParentId(customerOrgld) {
  131. if (customerOrgld == this.dict.personOrgId) {
  132. this.patientRegister.query.CustomerOrgParentId = this.dict.personOrgId;
  133. return;
  134. }
  135. getapi(`/api/app/customer-org/parent/${customerOrgld}`).then((res) => {
  136. console.log("res.data", res.data);
  137. if (res.code == 1) {
  138. this.patientRegister.query.CustomerOrgParentId = res.data;
  139. }
  140. });
  141. },
  142. //点击树节点
  143. treeclick(data) {
  144. this.patientRegister.query.customerOrgId = data.id;
  145. this.getCustomerOrgParentId(data.id);
  146. this.patientRegister.query.times++; //用于触发查询条件
  147. },
  148. //树控件--伪双击事件
  149. handleNode(data, node, prop) {
  150. console.log(data, node, prop);
  151. if (!this.preNodeId) {
  152. this.preNodeId = data.id;
  153. } else {
  154. this.curNodeId = data.id;
  155. }
  156. //双击事件
  157. if (this.preNodeId == this.curNodeId) { //第一次点击的节点和第二次点击的节点id相同
  158. this.preNodeId = null;
  159. this.curNodeId = null;
  160. this.treeDbClick(data);
  161. return;
  162. }
  163. this.nodeTimer = setTimeout(() => { //300ms内没有第二次点击就把第一次点击的清空
  164. this.preNodeId = null;
  165. }, 300)
  166. },
  167. //双击树节点 后续处理
  168. async treeDbClick(node) {
  169. this.parentIds = getTreePids(this.patientRegister.customerOrgTreeAll, 'children', 'parentId', 'id', node.id);
  170. this.childIds = getTreeAllChildIdsById(this.patientRegister.customerOrgTreeAll, 'children', 'id', node.id);
  171. //待添加的记录
  172. let ldate = new Date();
  173. let record = {
  174. customerOrgId: '',
  175. customerOrgRegister: {}, //已选的体检次数
  176. customerOrgRegisterList: [], //当前单位的体检次数信息
  177. dateType: 'creationTime', // 登记日期:creationTime;体检日期:medicalStartDate;总检日期:summaryDate
  178. startDate: ldate,
  179. endDate: ldate,
  180. customerOrgGroupIds: [], //已选的体检分组
  181. customerOrgGroupList: [], //可选的分组
  182. }
  183. record.customerOrgId = node.id;
  184. if(node.id != this.dict.personOrgId){
  185. try {
  186. //let res =
  187. let res1 = await getapi(`/api/app/customerorgregister/getlistincustomerorgid?CustomerOrgId=${cusOrgId}`);
  188. record.customerOrgRegisterList = res1.data;
  189. if(res1.data && res1.data.length > 0){
  190. record.customerOrgRegister = res1.data[res1.data.length - 1];
  191. record.startDate = res1.data[res1.data.length - 1].beginTime;
  192. record.endDate = res1.data[res1.data.length - 1].isComplete == 'N' ? ldate : res1.data[res1.data.length - 1].endTime;
  193. }
  194. } catch (error) {
  195. console.log(`get: /api/app/customerorgregister/getlistincustomerorgid?CustomerOrgId=${cusOrgId}`,error)
  196. }
  197. }
  198. let insableMsg = '';
  199. this.dataCusOrgOCX.forEach(e =>{
  200. if(this.parentIds.indexOf(e.customerOrgId) > - 1 && e.customerOrgRegister.id == record.customerOrgRegister.id){
  201. insableMsg = "已经添加了上级节点,不可再添加此节点";
  202. }
  203. if(this.childIds.indexOf(e.customerOrgId) > - 1 && e.customerOrgRegister.id == record.customerOrgRegister.id){
  204. insableMsg = "已经添加了下级节点,不可再添加此节点";
  205. }
  206. });
  207. if(insableMsg){
  208. this.$message.warning(insableMsg);
  209. return;
  210. }
  211. this.dataCusOrgOCX.push(record);
  212. },
  213. //选分组
  214. getCustGroup(index,groupId){
  215. ///api/app/customerorggroup/getlistinfilter?CustomerOrgRegisterId=3fa85f64-5717-4562-b3fc-2c963f66afa6
  216. getapi(`/api/app/customerorggroup/getlistinfilter?CustomerOrgRegisterId=${groupId}`).then(res =>{
  217. if(res.code != - 1){
  218. this.dataCusOrgOCX[index].customerOrgGroupList = res.data.items;
  219. }
  220. })
  221. },
  222. //选择单位
  223. changeCustomerOrgId(v) {
  224. console.log(v)
  225. if (!v) {
  226. this.patientRegister.query.customerOrgRegister = null;
  227. return;
  228. }
  229. let customerOrgId = v[0];
  230. if (customerOrgId == this.dict.personOrgId) {
  231. this.patientRegister.query.customerOrgRegister = null;
  232. return;
  233. }
  234. getapi(
  235. `/api/app/customerorgregister/getlistincustomerorgid?CustomerOrgId=${customerOrgId}`
  236. ).then((res) => {
  237. //console.log('res.data',res.data)
  238. if (res.code != -1) {
  239. this.customerOrg.customerOrgRegisterList = res.data;
  240. if (res.data.length > 0) {
  241. this.patientRegister.query.customerOrgRegister = res.data[res.data.length - 1];
  242. this.patientRegister.query.dateRange = [
  243. res.data[res.data.length - 1].beginTime,
  244. res.data[res.data.length - 1].isComplete == 'N' ? new Date() : res.data[res.data.length - 1].endTime
  245. ]
  246. }
  247. }
  248. });
  249. },
  250. },
  251. };
  252. </script>
  253. <style lang="scss" scoped>
  254. ::v-deep .el-input__inner {
  255. /*text-align: center;*/
  256. padding-left: 1px;
  257. padding-right: 1px;
  258. }
  259. ::v-deep .el-table th.el-table__cell {
  260. /*text-align: center;*/
  261. padding-left: 1px;
  262. padding-right: 1px;
  263. }
  264. ::v-deep .el-table td.el-table__cell {
  265. padding-left: 1px;
  266. padding-right: 1px;
  267. }
  268. ::v-deep .el-table .cell {
  269. padding-left: 1px;
  270. padding-right: 1px;
  271. }
  272. ::v-deep .el-icon-date:before {
  273. content: ""
  274. }
  275. </style>