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.

1072 lines
39 KiB

3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
6 months ago
3 years ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
2 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
2 years ago
6 months ago
2 years ago
3 years ago
6 months ago
3 years ago
6 months ago
2 years ago
3 years ago
6 months ago
3 years ago
3 years ago
3 years ago
6 months ago
3 years ago
2 years ago
3 years ago
6 months ago
3 years ago
3 years ago
3 years ago
2 years ago
6 months ago
2 years ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
3 years ago
6 months ago
3 years ago
6 months ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
2 years ago
6 months ago
3 years ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
6 months ago
3 years ago
3 years ago
6 months ago
2 years ago
6 months ago
2 years ago
6 months ago
2 years ago
6 months ago
3 years ago
3 years ago
2 years ago
3 years ago
6 months ago
2 years ago
6 months ago
2 years ago
3 years ago
3 years ago
2 years ago
6 months ago
2 years ago
6 months ago
2 years ago
6 months ago
3 years ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
3 years ago
3 years ago
3 years ago
6 months ago
3 years ago
2 years ago
6 months ago
3 years ago
3 years ago
3 years ago
2 years ago
6 months ago
3 years ago
2 years ago
3 years ago
3 years ago
6 months ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
3 years ago
6 months ago
3 years ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
6 months ago
3 years ago
3 years ago
3 years ago
6 months ago
3 years ago
3 years ago
6 months ago
3 years ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
3 years ago
3 years ago
6 months ago
3 years ago
3 years ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
3 years ago
6 months ago
3 years ago
3 years ago
3 years ago
2 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
2 years ago
6 months ago
3 years ago
6 months ago
3 years ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
3 years ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
3 years ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
4 months ago
6 months ago
3 years ago
3 years ago
6 months ago
3 years ago
2 years ago
3 years ago
3 years ago
6 months ago
3 years ago
2 years ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
3 years ago
3 years ago
2 years ago
6 months ago
2 years ago
2 years ago
6 months ago
2 years ago
3 years ago
6 months ago
3 years ago
6 months ago
3 years ago
2 years ago
3 years ago
6 months ago
3 years ago
  1. <template>
  2. <div style="display: flex; margin-top:5px;">
  3. <div :style="'display: flex;width:' + (window.pageWidth - window.pageMarginWidth - 110 - 5) + 'px;font-size:14px;'">
  4. <!--未选组合项目-->
  5. <div style="display: block; width:300px;">
  6. <div>
  7. <span>项目类别</span>
  8. <el-cascader :options="dict.itemTypeTree" v-model="itemTypeIds" popper-class="example"
  9. style="margin-left: 3px;width:240px;"
  10. :props="{ checkStrictly: true, expandTrigger: 'hover', ...customerOrg.treeprops, }" clearable filterable
  11. @change="getAsbItemByItemType" size="small">
  12. </el-cascader>
  13. </div>
  14. <div class="box">
  15. <el-table :data="dict.asbItem" border size="small" highlight-current-row :height="tableHeight"
  16. @row-dblclick="dbClickChoosedAsb" row-key="id" @selection-change="selectLeft"
  17. :row-class-name="handleRowClassName" @row-click="chooseAsbItem">
  18. <!--
  19. <el-table-column type="selection" align="center" ></el-table-column>
  20. -->
  21. <el-table-column type="index" align="center" width="40" />
  22. <el-table-column label="未选组合项目" min-width="170" prop="displayName" align="center"></el-table-column>
  23. </el-table>
  24. </div>
  25. </div>
  26. <!--中间操作按钮-->
  27. <div style="display: block;margin: 40px 10px 0 15px;width:110px;">
  28. <div v-show="checkPagePriv(pagePriv.privs, '添加')" style="padding: 5px 0;">
  29. <el-button class="commonbutton" @click="addAbs(asbItemChoosed, 'choosed')">添加 <i
  30. class="el-icon-arrow-right"></i></el-button>
  31. </div>
  32. <div v-show="checkPagePriv(pagePriv.privs, '全部添加')" style="padding: 5px 0;">
  33. <el-button class="difference" @click="addAbs(asbItemChoosed, 'all')">全部添加</el-button>
  34. </div>
  35. <div v-show="checkPagePriv(pagePriv.privs, '移除')" style="padding: 5px 0;">
  36. <el-button class="commonbutton" @click="delAbs(customerOrgGroupAsbitemsChoosed, 'choosed')">移除 <i
  37. class="el-icon-arrow-left"></i></el-button>
  38. </div>
  39. <div v-show="checkPagePriv(pagePriv.privs, '全部移除')" style="padding: 5px 0;">
  40. <el-button class="difference" @click="delAbs(customerOrgGroupAsbitemsChoosed, 'all')">全部移除</el-button>
  41. </div>
  42. </div>
  43. <!--已选组合项目-->
  44. <div
  45. :style="'display: block; width:' + (window.pageWidth - 300 - 120 - window.pageMarginWidth - 110 - 5) + 'px;'">
  46. <div style="height:32px;">
  47. <div v-show="checkPagePriv(pagePriv.privs, '快速选择')">
  48. <span>快速选择</span>
  49. <el-select v-model="asbItemId" placeholder="快速选择组合项目" size="small" filterable default-first-option
  50. :filter-method="filterMethod" clearable @clear="quickAsb = deepCopy(dict.asbItemQuick)"
  51. @change="quickChoosedAsb" ref="quickAsbOCX" style="margin-left: 3px;width:240px;">
  52. <el-option v-for="item in quickAsb" :key="item.id" :value="item.id" :label="item.displayName" />
  53. </el-select>
  54. </div>
  55. </div>
  56. <div class="box">
  57. <el-table :data="customerOrgGroupAsbitems" border size="small" @selection-change="selectRight"
  58. highlight-current-row :height="tableHeight" :summary-method="getSummaries" show-summary
  59. :row-class-name="handleRowClassName" @row-dblclick="removeAbs" @row-click="removeAsbItem"
  60. ref="tableCustomerOrgGroupAsbitems">
  61. <!--
  62. <el-table-column type="selection"></el-table-column>
  63. -->
  64. <el-table-column type="index" width="40" align="center" />
  65. <el-table-column label="已选组合项目" min-width="140" prop="displayName"></el-table-column>
  66. <el-table-column label="标准价格" prop="price" min-width="60" align="center" />
  67. <el-table-column label="折扣" min-width="40" align="center">
  68. <template slot-scope="scope">
  69. <el-input @input="changeDiscount(scope.$index)" type="number" size="small"
  70. v-model="scope.row.discount" />
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="应收价格" prop="customerOrgGroupDetailPrice" min-width="60" align="center">
  74. <template slot-scope="scope">
  75. <el-input @input="changePrices(scope.$index)" type="number" size="small"
  76. v-model="scope.row.customerOrgGroupDetailPrice" />
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="数量" prop="customerOrgGroupDetailAmount" width="50" align="center">
  80. <template slot-scope="scope">
  81. <el-input @input="changePrices(scope.$index)" type="number" size="small"
  82. v-model="scope.row.customerOrgGroupDetailAmount" />
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="标准金额" prop="asbitemMoney" min-width="60" align="center">
  86. </el-table-column>
  87. <el-table-column label="应收金额" prop="customerOrgGroupDetailMoney" min-width="60" align="center">
  88. </el-table-column>
  89. </el-table>
  90. </div>
  91. </div>
  92. </div>
  93. <!--批量操作按钮复制套餐与分组-->
  94. <div style="display: block;margin-left: 5px;">
  95. <div v-show="checkPagePriv(pagePriv.privs, '复制分组')" style="margin-top: 50px;">
  96. <el-button class="commonbutton" @click="btnCopyGroup">复制分组</el-button>
  97. </div>
  98. <div v-show="checkPagePriv(pagePriv.privs, '复制套餐')" style="margin-top: 10px;">
  99. <el-button class="commonbutton" @click="btnCopyMedicalPackage">复制套餐</el-button>
  100. </div>
  101. <div v-show="checkPagePriv(pagePriv.privs, '保存')" style="margin-top: 10px;">
  102. <el-button class="commonbutton" @click="btnSave">保存</el-button>
  103. </div>
  104. </div>
  105. <!--复制套餐-->
  106. <el-dialog title="复制体检套餐" :visible.sync="medicalPackageVisble" width="800px" height="500" :show-close="false"
  107. :close-on-click-modal="false" :append-to-body="true">
  108. <el-table :data="dict.medicalPackage" border height="350" row-key="id" size="small" highlight-current-row
  109. @row-click="packageRowClick" @row-dblclick="rowDblclick" ref="patientList">
  110. <!-- "displayName": "健康体检套餐",
  111. "price": 20.00,
  112. "forSexId": "0",
  113. "isActive": "Y",
  114. "remark": "2",
  115. "displayOrder": 1,
  116. "simpleCode": "JKTJTC",
  117. "creatorName": "admin",
  118. "lastModifierName": "users",
  119. "lastModificationTime": "2023-08-04T16:34:02.94408",
  120. "lastModifierId": "3a0ca83b-3116-da05-3916-dfd4c0c548cb",
  121. "creationTime": "2023-07-10T19:53:30.210553",
  122. "creatorId": "3a0c4180-107c-0c89-b25b-0bd34666dcec",
  123. "id": "3a0c51d3-2345-38df-ba0b-1862a3c3606f" -->
  124. <el-table-column type="index" width="50" />
  125. <el-table-column prop="displayName" label="套餐名称" width="180" />
  126. <el-table-column prop="price" label="价格" width="80" />
  127. <el-table-column prop="forSexId" label="适用性别" width="80">
  128. <template slot-scope="scope">
  129. <div>
  130. {{ dddw(dict.forSex, "id", scope.row.forSexId, "displayName") }}
  131. </div>
  132. </template>
  133. </el-table-column>
  134. <el-table-column prop="remark" label="备注" width="100" />
  135. <el-table-column prop="creatorName" label="创建人员" width="80" />
  136. <el-table-column prop="creationTime" label="创建日期" width="100">
  137. <template slot-scope="scope">
  138. <div v-if="scope.row.creationTime">
  139. {{ moment(scope.row.creationTime).format("yyyy-MM-DD") }}
  140. </div>
  141. </template>
  142. </el-table-column>
  143. <el-table-column prop="lastModifierName" label="修改人员" width="80" />
  144. <el-table-column prop="lastModificationTime" label="修改日期" width="100">
  145. <template slot-scope="scope">
  146. <div v-if="scope.row.lastModificationTime">
  147. {{ moment(scope.row.lastModificationTime).format("yyyy-MM-DD") }}
  148. </div>
  149. </template>
  150. </el-table-column>
  151. </el-table>
  152. <span slot="footer" class="dialog-footer">
  153. <el-button class="commonbutton" type="primary" @click="copyMedicalPackage" style="width:90px;">确定</el-button>
  154. <el-button class="commonbutton" @click="medicalPackageVisble = false" style="width:90px;">取消</el-button>
  155. </span>
  156. </el-dialog>
  157. <!--复制分组-->
  158. <el-dialog title="复制单位分组" :visible.sync="groupVisble" width="800px" height="500" :show-close="false"
  159. :close-on-click-modal="false" :append-to-body="true">
  160. <div>
  161. <div style="display: flex">
  162. <div>
  163. <span>体检单位</span>
  164. <el-select v-model="customerOrgId" placeholder="请选择体检单位" :filter-method="filterMethodOrg" default-first-option
  165. clearable filterable @clear="customerOrgDisp = deepCopy(customerOrgAll)" style="margin-left: 10px"
  166. @change="changeCustomerOrg" size="small">
  167. <el-option v-for="item in customerOrgDisp" :key="item.id" :label="item.displayName" :value="item.id">
  168. {{ item.displayName }}
  169. </el-option>
  170. </el-select>
  171. </div>
  172. <div style="margin-left: 20px">
  173. <span>单位体检次数</span>
  174. <el-select v-model="customerOrgRegister" placeholder="次数" style="width: 60px; margin-left: 10px"
  175. size="small" @change="changeTimes" value-key="id">
  176. <el-option v-for="item in customerOrgRegisterList" :key="item.id" :label="item.medicalTimes"
  177. :value="item" />
  178. </el-select>
  179. </div>
  180. </div>
  181. <el-table :data="customerOrgGroups" ref="customerOrgGroups" style="margin-top: 2px" row-key="id" border
  182. height="450px" size="small" highlight-current-row :row-class-name="handleRowClassName"
  183. @row-click="groupRowClick" @row-dblclick="groupRowDblclick">
  184. >
  185. <el-table-column type="index" label="序号" min-width="50" align="center" />
  186. <el-table-column prop="displayName" label="名称" min-width="150" />
  187. <el-table-column prop="price" label="价格" min-width="60" align="center" />
  188. <el-table-column prop="forSexId" label="适用性别" min-width="60" align="center">
  189. <template slot-scope="scope">
  190. {{ dddw(dict.forSex, "id", scope.row.forSexId, "displayName") }}
  191. </template>
  192. </el-table-column>
  193. <el-table-column prop="maritalStatusId" label="适用婚姻状况" min-width="80" align="center">
  194. <template slot-scope="scope">
  195. {{
  196. dddw(
  197. dict.forMaritalStatus,
  198. "id",
  199. scope.row.maritalStatusId,
  200. "displayName"
  201. )
  202. }}
  203. </template>
  204. </el-table-column>
  205. <el-table-column prop="creatorName" label="创建者" min-width="60" align="center" />
  206. <el-table-column label="创建时间" min-width="150" align="center">
  207. <template slot-scope="scope">
  208. {{
  209. scope.row.creationTime
  210. ? moment(scope.row.creationTime).format("yyyy-MM-DD HH:mm:ss")
  211. : ""
  212. }}
  213. </template>
  214. </el-table-column>
  215. </el-table>
  216. <div style="display: flex;justify-content: space-between;margin-top: 10px;">
  217. <div></div>
  218. <span slot="footer" class="dialog-footer">
  219. <el-button class="commonbutton" type="primary" @click="copyGroup" style="width:90px;">确定</el-button>
  220. <el-button class="commonbutton" @click="groupVisble = false" style="width:90px;">取消</el-button>
  221. </span>
  222. </div>
  223. </div>
  224. </el-dialog>
  225. </div>
  226. </template>
  227. <script>
  228. import moment from 'moment';
  229. import { mapState } from "vuex";
  230. import { getapi, postapi, putapi } from "@/api/api";
  231. import { getPagePriv, checkPagePriv, arrayExistObj, tcdate, arrayFilter, arrayReduce, deepCopy, objCopy,dddw } from "../../utlis/proFunc";
  232. export default {
  233. props: ['customerOrgGroup', 'curOrgGroups','customerOrgAll','curOrgRegister','curOrgRegisterList','refreshMoney'],
  234. data() {
  235. return {
  236. pagePriv: {
  237. routeUrlorPageName: 'customerOrgGroup', //当前页面归属路由或归属页面权限名称
  238. privs: [] // 页面权限
  239. },
  240. groupPrice: 0, //分组总价
  241. customerOrgGroupAsbitems: [], //分组包含组合项目(显示)
  242. customerOrgGroupAsbitemsChoosed: [], //分组包含组合项目(显示) 被选中
  243. itemTypeIds: [], //项目类别
  244. asbItemId: '', //当前快速选到的给合项目ID
  245. quickAsb: [], //过滤显示的组合项目
  246. asbItemChoosed: [], //勾选的 未选组合项目
  247. startPoint: -1,
  248. PstartPoint: -1,
  249. medicalPackageVisble: false, //复制套餐
  250. curPackageId: '', //当前选中套餐ID
  251. packageAsbitems: [], //套餐中包含的组合项目
  252. groupVisble: false, //复制分组
  253. customerOrgGroups: [], //历次分组
  254. curGroupId: '', //当前选中套餐ID
  255. groupAsbitems: [], //选中分组包含组合项目
  256. customerOrgId:'', // 当前选中企业ID
  257. customerOrgDisp:[], // 显示单位
  258. customerOrgRegisterList:[], //当前体检次数集合
  259. customerOrgRegister:{}, // 当前选择体检次数
  260. dialogVisible: false,
  261. copyGroupdialogVisible: false,
  262. packagelist: [],
  263. tabledata: [],
  264. temporaryselection: [], //已选组合项目table
  265. copegroupdata: [], //复制分组
  266. addrulst: [], //添加保存的Id
  267. price: "", //价格
  268. title: 1,
  269. };
  270. },
  271. computed: {
  272. ...mapState(["window", "dict", "dataTransOpts", "customerOrg"]),
  273. tableHeight() {
  274. let height = 600
  275. if (this.window.pageHeight > 600) {
  276. height = this.window.pageHeight
  277. }
  278. // console.log(height - this.window.pageHeaderHeight - this.window.pageMarginHeight - 240 - 96 - 10)
  279. return height - this.window.pageHeaderHeight - this.window.pageMarginHeight - 240 - 96 - 36
  280. }
  281. },
  282. created() {
  283. //获取用户当前页面的权限
  284. let userPriv = window.sessionStorage.getItem('userPriv')
  285. if (userPriv) this.pagePriv.privs = deepCopy(getPagePriv(this.pagePriv.routeUrlorPageName))
  286. this.dictInit()
  287. },
  288. mounted() {
  289. this.getCustomerOrgGroupAsbitems(this.customerOrgGroup.id);
  290. },
  291. updated() {
  292. this.refreshTable('tableCustomerOrgGroupAsbitems')
  293. },
  294. methods: {
  295. moment, dddw, deepCopy, checkPagePriv,
  296. //表格强制刷新
  297. refreshTable(tableRef) {
  298. this.$nextTick(() => {
  299. this.$refs[tableRef].doLayout()
  300. })
  301. },
  302. //初始数据
  303. dictInit() {
  304. //体检类别 树结构
  305. getapi("/api/app/item-type/by-code-all").then((res) => {
  306. if (res.code != -1) {
  307. this.dict.itemTypeTree = res.data;
  308. tcdate(this.dict.itemTypeTree);
  309. }
  310. });
  311. //获取所有组合项目 api/app/asbitem/GetBasicList
  312. postapi("/api/app/asbitem/GetBasicList", { isFilterActive: 'Y' }).then((res) => {
  313. if (res.code != -1) {
  314. this.dict.asbItemAll = res.data;
  315. this.dict.asbItemAll.forEach(e => {
  316. e.choosed = false
  317. })
  318. this.dict.asbItem = deepCopy(this.dict.asbItemAll);
  319. this.dict.asbItemQuick = deepCopy(res.data);
  320. this.quickAsb = deepCopy(res.data);
  321. }
  322. });
  323. //套餐 ()
  324. postapi("/api/app/medicalpackage/getmedicalpackagelist", {}).then((res) => {
  325. if (res.code != -1) {
  326. this.dict.medicalPackage = res.data;
  327. }
  328. });
  329. },
  330. // 过滤体检单位
  331. filterMethodOrg(keyWords) {
  332. if (keyWords) {
  333. this.customerOrgDisp = [];
  334. this.customerOrgAll.forEach((item) => {
  335. if (
  336. item.displayName.toLowerCase().indexOf(keyWords.toLowerCase()) > -1 ||
  337. item.simpleCode.toLowerCase().indexOf(keyWords.toLowerCase()) > -1
  338. // || item.shortName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  339. ) {
  340. this.customerOrgDisp.push(item);
  341. }
  342. });
  343. } else {
  344. this.customerOrgDisp = deepCopy(this.customerOrgAll);
  345. }
  346. },
  347. //选择单位
  348. changeCustomerOrg(v) {
  349. if (!v) {
  350. this.customerOrgRegisterList = [];
  351. this.customerOrgRegister = {};
  352. this.customerOrgGroups = [];
  353. this.isDrag = false;
  354. this.form.id = "";
  355. setTimeout(() => {
  356. this.dataTransOpts.refresh.customer_org_group_detail.M++;
  357. }, 20);
  358. return;
  359. }
  360. getapi(
  361. `/api/app/customerorgregister/getlistincustomerorgid?CustomerOrgId=${v}`
  362. ).then((res) => {
  363. if (res.code != -1) {
  364. this.customerOrgRegisterList = res.data;
  365. if (res.data.length > 0) {
  366. this.customerOrgRegister = res.data[res.data.length - 1];
  367. this.getCustomerOrgGroup(this.customerOrgRegister.id);
  368. } else {
  369. this.customerOrgRegister = {};
  370. this.customerOrgGroups = [];
  371. this.isDrag = false;
  372. }
  373. objCopy(this.formInit, this.form);
  374. setTimeout(() => {
  375. this.dataTransOpts.refresh.customer_org_group_detail.M++;
  376. }, 20);
  377. }
  378. });
  379. },
  380. //选择体检次数
  381. changeTimes(v) {
  382. this.getCustomerOrgGroup(v.id);
  383. },
  384. //获取体检次数下的分组
  385. getCustomerOrgGroup(customerOrgRegisterId) {
  386. // this.isDrag = false;
  387. // objCopy(this.formInit, this.form);
  388. // this.form.customerOrgRegisterId = customerOrgRegisterId;
  389. this.customerOrgGroups = [];
  390. getapi(
  391. `/api/app/customerorggroup/getlistinfilter?CustomerOrgRegisterId=${customerOrgRegisterId}`
  392. ).then((res) => {
  393. if (res.code != -1) {
  394. this.customerOrgGroups = res.data;
  395. this.customerOrgGroups.forEach((e) => {
  396. e.customerOrgRegisterId = customerOrgRegisterId;
  397. });
  398. }
  399. });
  400. },
  401. handleRowClassName({ row, rowIndex }) {
  402. // highLightBg 为 'selected'的高亮
  403. //console.log(rowIndex, row)
  404. //return row.highLightBg == 'selected' ? 'high-light-bg' : '';
  405. if (row.choosed) {
  406. return 'current-row';
  407. } else {
  408. return '';
  409. }
  410. },
  411. //项目类别过滤 组合项目,未过滤已选择的组合项目
  412. getAsbItemByItemTypeAll() {
  413. //console.log('getAsbItemByItemType', typeof this.itemTypeIds, this.itemTypeIds)
  414. let lv = "";
  415. if (typeof this.itemTypeIds === "object") {
  416. lv = this.itemTypeIds[this.itemTypeIds.length - 1];
  417. }
  418. if (lv) {
  419. this.dict.asbItem = arrayFilter(this.dict.asbItemAll, "itemTypeId", lv);
  420. } else {
  421. this.dict.asbItem = deepCopy(this.dict.asbItemAll);
  422. }
  423. //console.log('lv,this.dict.asbItem', lv, this.dict.asbItem)
  424. this.dict.asbItemQuick = deepCopy(this.dict.asbItemAll);
  425. },
  426. //按项目类别显示组合项目,并过滤已选择的组合项目
  427. getAsbItemByItemType() {
  428. this.getAsbItemByItemTypeAll()
  429. //刷新显示 未选组合项目
  430. arrayReduce(this.dict.asbItem, [...this.customerOrgGroupAsbitems], "id=asbitemId");
  431. arrayReduce(this.dict.asbItemQuick, [...this.customerOrgGroupAsbitems], "id=asbitemId");
  432. this.quickAsb = Object.assign(this.dict.asbItemQuick)
  433. },
  434. //快速选择组合项目时,调整可按拼间简码及简称查找
  435. filterMethod(keyWords) {
  436. //console.log('filterMethod',this.dict.asbItemQuick)
  437. if (keyWords) {
  438. this.quickAsb = [];
  439. this.dict.asbItemQuick.forEach(item => {
  440. if (item.displayName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  441. || item.simpleCode.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  442. || item.shortName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1) {
  443. this.quickAsb.push(item);
  444. }
  445. });
  446. } else {
  447. this.quickAsb = deepCopy(this.dict.asbItemQuick);
  448. }
  449. },
  450. // 添加组合项目
  451. ///api/app/register-asbitem/many/3fa85f64-5717-4562-b3fc-2c963f66afa6'
  452. async addAbs(asbItemChoosed, oprType) {
  453. // console.log('this.customerOrgGroup',this.customerOrgGroup)
  454. // console.log('asbItemChoosed', asbItemChoosed)
  455. if (!this.customerOrgGroup.id) {
  456. this.$message.warning({ showClose: true, message: "请先选中单位分组" })
  457. return
  458. }
  459. if (this.customerOrgGroup.isComplete && this.customerOrgGroup.isComplete.toUpperCase() == 'Y') {
  460. this.$message.warning({ showClose: true, message: "体检次数已完成,不允许操作" })
  461. return
  462. }
  463. let message = []
  464. let checked = true
  465. let lfind = -1
  466. //oprType 不传值时,兼容勾选方式
  467. //勾选时不需要此操作 start
  468. if (oprType && oprType == 'all') {
  469. asbItemChoosed = deepCopy(this.dict.asbItem)
  470. } else if (oprType && oprType == 'choosed') {
  471. asbItemChoosed = []
  472. this.dict.asbItem.forEach(e => {
  473. if (e.choosed) {
  474. asbItemChoosed.push(e)
  475. e.choosed = false
  476. }
  477. })
  478. }
  479. //勾选时不需要此操作 end
  480. if (asbItemChoosed.length < 1) {
  481. this.$message.warning({ showClose: true, message: "请选择要添加的组合项目" })
  482. return
  483. }
  484. //性别、年龄判断
  485. // "displayName": "身高体重",
  486. // "shortName": "哈f哈",
  487. // "forSexId": "F",
  488. // "itemTypeId": "3a0b16de-75b9-c910-c61b-844709a88940",
  489. // "price": 0,
  490. // for (let i = 0; i < asbItemChoosed.length; i++) {
  491. // if (this.customerOrgGroup.forSexId == 'A') break //未选性别时,无需判断组合项目性别限制
  492. // if (asbItemChoosed[i].forSexId == 'A' || asbItemChoosed[i].forSexId == 'U') continue
  493. // if (asbItemChoosed[i].forSexId != this.customerOrgGroup.sexId) {
  494. // this.$message.warning(`所选项目:${asbItemChoosed[i].displayName},不适合当前人员性别`)
  495. // checked = false
  496. // break
  497. // }
  498. // }
  499. // //console.log(222,checked)
  500. // if (!checked) return
  501. // 去掉重复的项目
  502. arrayReduce(asbItemChoosed, this.customerOrgGroupAsbitems, "id=asbitemId")
  503. for (let i = asbItemChoosed.length - 1; i > - 1; i--) {
  504. if (this.customerOrgGroup.forSexId == 'A') break //未选性别时,无需判断组合项目性别限制
  505. if (asbItemChoosed[i].forSexId == 'A' || asbItemChoosed[i].forSexId == 'U') continue
  506. if (asbItemChoosed[i].forSexId != this.customerOrgGroup.forSexId) {
  507. message.push(asbItemChoosed[i].displayName) //.warning(`所选项目:${asbItemChoosed[i].displayName},不适合当前人员性别`)
  508. checked = false
  509. asbItemChoosed.splice(i, 1)
  510. }
  511. }
  512. //console.log(222,checked)
  513. if (!checked) this.$message.warning(`所选项目【${JSON.stringify(message)}】不适合当前人员性别`)
  514. for (let i = 0; i < asbItemChoosed.length; i++) {
  515. let pojo = {
  516. asbitemId: asbItemChoosed[i].id,
  517. displayName: asbItemChoosed[i].displayName,
  518. discount: 100,
  519. customerOrgGroupDetailAmount: 1,
  520. price: asbItemChoosed[i].price,
  521. customerOrgGroupDetailPrice: asbItemChoosed[i].price,
  522. customerOrgGroupDetailMoney: asbItemChoosed[i].price,
  523. asbitemMoney: asbItemChoosed[i].price,
  524. }
  525. this.customerOrgGroupAsbitems.push(pojo)
  526. //this.customerOrgGroupAsbitems.push({ ...pojo, asbitemName: asbItemChoosed[i].displayName })
  527. lfind = arrayExistObj(this.dict.asbItem, 'id', asbItemChoosed[i].id)
  528. if (lfind > -1) this.dict.asbItem.splice(lfind, 1)
  529. lfind = arrayExistObj(this.dict.asbItemQuick, 'id', asbItemChoosed[i].id)
  530. if (lfind > -1) this.dict.asbItemQuick.splice(lfind, 1)
  531. }
  532. },
  533. //双击选择组合项目
  534. dbClickChoosedAsb(row) {
  535. this.addAbs([row]);
  536. },
  537. //快速选择组合项目
  538. quickChoosedAsb(v) {
  539. //远程查询时,设置了 value-key 也不管用,只能取到value console.log('quickChoosedAsb',v)
  540. let lfind = -1
  541. if (v) {
  542. lfind = arrayExistObj(this.dict.asbItemQuick, 'id', v)
  543. if (lfind > -1) {
  544. this.addAbs([this.dict.asbItemQuick[lfind]])
  545. }
  546. }
  547. this.$nextTick(() => {
  548. this.$refs['quickAsbOCX'].blur(); //total asbItemId
  549. this.asbItemId = ''
  550. this.quickAsb = deepCopy(this.dict.asbItemQuick)
  551. this.$refs['quickAsbOCX'].focus(); //total asbItemId
  552. });
  553. },
  554. //选择 未选的组合项目
  555. chooseAsbItem(row) {
  556. this.dict.asbItem.forEach((e, index) => {
  557. e.index = index;
  558. return e
  559. });
  560. // 按住了shift键
  561. if (this.window.shift) {
  562. //清除所有选择
  563. this.dict.asbItem.forEach(e => {
  564. e.choosed = false;
  565. return e
  566. });
  567. if (this.startPoint == - 1) {
  568. this.dict.asbItem[row.index].choosed = true;
  569. this.startPoint = row.index;
  570. return
  571. }
  572. if (this.startPoint > row.index) {
  573. for (let i = row.index; i <= this.startPoint; i++) {
  574. this.dict.asbItem[i].choosed = true
  575. }
  576. } else if (this.startPoint <= row.index) {
  577. for (let i = this.startPoint; i <= row.index; i++) {
  578. this.dict.asbItem[i].choosed = true
  579. }
  580. }
  581. return
  582. }
  583. // 按住了ctrl 键
  584. if (this.window.ctrl) {
  585. console.log('this.window.ctrl', this.window.ctrl, this.dict.asbItem)
  586. this.dict.asbItem[row.index].choosed = true;
  587. this.startPoint = row.index;
  588. return
  589. }
  590. // 未按住了ctrl 、shift 键
  591. //清除所有选择
  592. //console.log('清除所有选择')
  593. this.dict.asbItem.forEach(e => {
  594. e.choosed = false;
  595. return e
  596. });
  597. this.dict.asbItem[row.index].choosed = true;
  598. this.startPoint = row.index;
  599. },
  600. //删除 人员已选中的组合项目
  601. ///api/app/register-asbitem/many?RegisterAsbitemIds=3fa85f64-5717-4562-b3fc-2c963f66afa6
  602. delAbs(absForDel, oprType) {
  603. if (!this.customerOrgGroup.id) {
  604. this.$message.warning({ showClose: true, message: "请先选中单位分组" })
  605. return
  606. }
  607. if (this.customerOrgGroup.isComplete && this.customerOrgGroup.isComplete.toUpperCase() == 'Y') {
  608. this.$message.warning({ showClose: true, message: "体检次数已完成,不允许操作" })
  609. return
  610. }
  611. let lfind = -1
  612. //勾选时不需要此操作 start
  613. if (oprType && oprType == 'all') {
  614. absForDel = deepCopy(this.customerOrgGroupAsbitems)
  615. } else if (oprType && oprType == 'choosed') {
  616. absForDel = []
  617. this.customerOrgGroupAsbitems.forEach(e => {
  618. if (e.choosed) {
  619. absForDel.push(deepCopy(e))
  620. e.choosed = false
  621. }
  622. })
  623. }
  624. //勾选时不需要此操作 end
  625. if (absForDel.length < 1) {
  626. this.$message.warning({ showClose: true, message: "请选择要移除的组合项目" })
  627. return
  628. }
  629. for (let i = 0; i < absForDel.length; i++) {
  630. lfind = arrayExistObj(this.customerOrgGroupAsbitems, 'asbitemId', absForDel[i].asbitemId)
  631. if (lfind > -1) this.customerOrgGroupAsbitems.splice(lfind, 1)
  632. absForDel.splice(i, 1)
  633. i--
  634. continue
  635. }
  636. //刷新
  637. this.getAsbItemByItemType()
  638. },
  639. //双击删除已选项目
  640. removeAbs(row) {
  641. this.delAbs([row]);
  642. },
  643. //选择 已选的组合项目
  644. removeAsbItem(row) {
  645. this.customerOrgGroupAsbitems.forEach((e, index) => {
  646. e.index = index;
  647. return e
  648. });
  649. // 按住了shift键
  650. if (this.window.shift) {
  651. //清除所有选择
  652. this.customerOrgGroupAsbitems.forEach(e => {
  653. e.choosed = false;
  654. return e
  655. });
  656. if (this.PstartPoint == - 1) {
  657. this.customerOrgGroupAsbitems[row.index].choosed = true;
  658. this.PstartPoint = row.index;
  659. return
  660. }
  661. if (this.PstartPoint > row.index) {
  662. for (let i = row.index; i <= this.PstartPoint; i++) {
  663. this.customerOrgGroupAsbitems[i].choosed = true
  664. }
  665. } else if (this.PstartPoint <= row.index) {
  666. for (let i = this.PstartPoint; i <= row.index; i++) {
  667. this.customerOrgGroupAsbitems[i].choosed = true
  668. }
  669. }
  670. return
  671. }
  672. // 按住了ctrl 键
  673. if (this.window.ctrl) {
  674. console.log('this.window.ctrl', this.window.ctrl, this.customerOrgGroupAsbitems)
  675. this.customerOrgGroupAsbitems[row.index].choosed = true;
  676. this.PstartPoint = row.index;
  677. return
  678. }
  679. // 未按住了ctrl 、shift 键
  680. //清除所有选择
  681. //console.log('清除所有选择')
  682. this.customerOrgGroupAsbitems.forEach(e => {
  683. e.choosed = false;
  684. return e
  685. });
  686. this.customerOrgGroupAsbitems[row.index].choosed = true;
  687. this.PstartPoint = row.index;
  688. },
  689. changeDiscount(index) {
  690. this.customerOrgGroupAsbitems[index].customerOrgGroupDetailPrice =
  691. (this.customerOrgGroupAsbitems[index].discount * this.customerOrgGroupAsbitems[index].price / 100).toFixed(2)
  692. this.customerOrgGroupAsbitems[index].customerOrgGroupDetailMoney =
  693. (this.customerOrgGroupAsbitems[index].customerOrgGroupDetailPrice * this.customerOrgGroupAsbitems[index].customerOrgGroupDetailAmount).toFixed(2)
  694. //this.getSummaries()
  695. },
  696. //修改价格或数量
  697. changePrices(index) {
  698. this.customerOrgGroupAsbitems[index].customerOrgGroupDetailMoney =
  699. (this.customerOrgGroupAsbitems[index].customerOrgGroupDetailPrice * this.customerOrgGroupAsbitems[index].customerOrgGroupDetailAmount).toFixed(2)
  700. this.customerOrgGroupAsbitems[index].asbitemMoney =
  701. (this.customerOrgGroupAsbitems[index].price * this.customerOrgGroupAsbitems[index].customerOrgGroupDetailAmount).toFixed(2)
  702. this.customerOrgGroupAsbitems[index].discount = (this.customerOrgGroupAsbitems[index].customerOrgGroupDetailPrice * 100 / this.customerOrgGroupAsbitems[index].price).toFixed(2)
  703. //this.getSummaries()
  704. },
  705. //合计
  706. getSummaries(param) {
  707. console.log('getSummaries param', param)
  708. // if(!param){
  709. // param = {
  710. // columns:[{}, {}, {}, {}, {}, {}, {property: 'asbitemMoney'},{property: 'customerOrgGroupDetailMoney'}],
  711. // data:this.customerOrgGroupAsbitems
  712. // }
  713. // }
  714. const { columns, data } = param;
  715. const sumCol = [6, 7] //需合计的列
  716. const sums = [];
  717. columns.forEach((column, index) => {
  718. //console.log('column, index,data',column, index,data)
  719. //显示合计列
  720. if (index === 1) {
  721. sums[index] = '合计';
  722. return;
  723. }
  724. //不合计的列
  725. if (sumCol.indexOf(index) == -1) {
  726. sums[index] = '';
  727. return;
  728. }
  729. sums[index] = 0
  730. data.forEach(e => {
  731. if (!isNaN(e[column.property])) sums[index] += Number(e[column.property])// * e['amount']
  732. })
  733. sums[index] = sums[index].toFixed(2) //+ ' 元';
  734. });
  735. this.groupPrice = sums[7];
  736. // console.log('getSummaries',sums)
  737. // if (!this.totalFoucs) this.total = sums[5];
  738. // if (!this.discountFoucs) this.discount = Number(this.total * 100 / this.totalStand).toFixed(2);
  739. return sums;
  740. },
  741. //复制分组
  742. btnCopyGroup() {
  743. console.log('this.customerOrgGroup', this.customerOrgGroup)
  744. if (!this.customerOrgGroup.id) {
  745. this.$message.warning({ showClose: true, message: "请先选中单位分组" })
  746. return
  747. }
  748. if (this.customerOrgGroup.isComplete && this.customerOrgGroup.isComplete.toUpperCase() == 'Y') {
  749. this.$message.warning({ showClose: true, message: "体检次数已完成,不允许操作" })
  750. return
  751. }
  752. this.groupVisble = true
  753. /*
  754. getapi(
  755. `/api/app/customerorggroup/getlistinfilter?CustomerOrgRegisterId=${this.customerOrgGroup.customerOrgRegisterId}`
  756. ).then((res) => {
  757. if (res.code != -1) {
  758. this.customerOrgGroups = res.data;
  759. if (this.customerOrgGroups.length < 2) {
  760. this.$message.warning({ showClose: true, message: "暂无其他分组可供复制" })
  761. } else {
  762. this.groupVisble = true
  763. }
  764. }
  765. });
  766. */
  767. },
  768. //选中分组
  769. async groupRowClick(row) {
  770. this.curGroupId = row.id
  771. this.groupAsbitems = []
  772. try {
  773. let res = await getapi(`/api/app/customerorggroupdetail/getcustomerorggroupdetailinasbitem?CustomerOrgGroupId=${row.id}`)
  774. if (res.code != -1) this.groupAsbitems = res.data
  775. } catch (error) {
  776. console.log(error)
  777. }
  778. },
  779. //双击选分组,并确认复制
  780. async groupRowDblclick(row) {
  781. await this.groupRowClick(row)
  782. this.copyGroup()
  783. },
  784. //复制分组(确认选中分组)
  785. copyGroup() {
  786. if (!this.curGroupId) {
  787. this.$message.warning({ showClose: true, message: "请先选择要复制的套餐!" })
  788. return
  789. }
  790. console.log('this.packageAsbitems', this.groupAsbitems)
  791. this.addAbs(deepCopy(this.groupAsbitems))
  792. this.groupVisble = false
  793. },
  794. //复制套餐
  795. btnCopyMedicalPackage() {
  796. // console.log('this.customerOrgGroup',this.customerOrgGroup)
  797. if (!this.customerOrgGroup.id) {
  798. this.$message.warning({ showClose: true, message: "请先选中单位分组" })
  799. return
  800. }
  801. if (this.customerOrgGroup.isComplete && this.customerOrgGroup.isComplete.toUpperCase() == 'Y') {
  802. this.$message.warning({ showClose: true, message: "体检次数已完成,不允许操作" })
  803. return
  804. }
  805. this.medicalPackageVisble = true
  806. },
  807. //选中套餐
  808. async packageRowClick(row) {
  809. this.curPackageId = row.id
  810. this.packageAsbitems = []
  811. try {
  812. let res = await postapi('/api/app/medicalpackagedetail/getmedicalpackageinasbitem', { medicalPackageId: row.id })
  813. this.packageAsbitems = res.data
  814. } catch (error) {
  815. console.log(error)
  816. }
  817. },
  818. //双击选套餐,并确认复制
  819. async rowDblclick(row) {
  820. await this.packageRowClick(row)
  821. this.copyMedicalPackage()
  822. },
  823. //复制套餐(确认选中套餐)
  824. copyMedicalPackage() {
  825. if (!this.curPackageId) {
  826. this.$message.warning({ showClose: true, message: "请先选择要复制的套餐!" })
  827. return
  828. }
  829. console.log('this.packageAsbitems', this.packageAsbitems)
  830. this.addAbs(deepCopy(this.packageAsbitems))
  831. this.medicalPackageVisble = false
  832. },
  833. //保存按钮
  834. btnSave() {
  835. if (!this.customerOrgGroup.id) {
  836. this.$message.warning({ showClose: true, message: "请先选中单位分组" })
  837. return
  838. }
  839. if (this.customerOrgGroup.isComplete && this.customerOrgGroup.isComplete.toUpperCase() == 'Y') {
  840. this.$message.warning({ showClose: true, message: "体检次数已完成,不允许操作" })
  841. return
  842. }
  843. let body = {
  844. customerOrgGroupId: this.customerOrgGroup.id,
  845. details: []
  846. }
  847. // {
  848. // "customerOrgGroupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  849. // "details": [
  850. // {
  851. // "customerOrgGroupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  852. // "asbitemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  853. // "price": 0,
  854. // "amount": 0
  855. // }
  856. // ]
  857. // }
  858. this.customerOrgGroupAsbitems.forEach(e => {
  859. body.details.push({
  860. customerOrgGroupId: this.customerOrgGroup.id,
  861. asbitemId: e.asbitemId,
  862. price: e.customerOrgGroupDetailPrice,
  863. amount: e.customerOrgGroupDetailAmount
  864. })
  865. })
  866. let group = deepCopy(this.customerOrgGroup);
  867. postapi('/api/app/customerorggroupdetail/createcustomerorggroupdetailmany', body
  868. )
  869. // .then(res => {
  870. // if(res.code != -1){
  871. // delete group.id;
  872. // delete group.customerOrgId;
  873. // delete group.isComplete;
  874. // group.price = this.groupPrice
  875. // // console.log('this.customerOrgGroup',this.customerOrgGroup)
  876. // // console.log('group',group)
  877. // return putapi(`/api/app/customer-org-group/${this.customerOrgGroup.id}`, group)
  878. // }
  879. // }) 后台合并事务
  880. .then(res => {
  881. if (res && res.code != -1) {
  882. console.log("操作成功");
  883. group.price = this.groupPrice
  884. group.id = this.customerOrgGroup.id
  885. this.refreshMoney(group)
  886. this.$message.success({ showClose: true, message: "保存成功" })
  887. }
  888. })
  889. },
  890. //右侧勾选按钮
  891. selectRight(val) {
  892. this.customerOrgGroupAsbitemsChoosed = val;
  893. },
  894. // 左侧未选
  895. selectLeft(val) {
  896. this.asbItemChoosed = val;
  897. },
  898. //获取当前列列表数据
  899. getCustomerOrgGroupAsbitems(customerOrgGroupId) {
  900. if (customerOrgGroupId) {
  901. getapi(
  902. `/api/app/customerorggroupdetail/getcustomerorggroupdetailinasbitem?CustomerOrgGroupId=${customerOrgGroupId}`
  903. ).then((res) => {
  904. if (res.code != -1) {
  905. this.customerOrgGroupAsbitems = res.data;
  906. this.getAsbItemByItemType()
  907. }
  908. });
  909. } else {
  910. this.customerOrgGroupAsbitems = []
  911. this.getAsbItemByItemType()
  912. }
  913. },
  914. },
  915. //监听事件
  916. watch: {
  917. // 体检分组ID未切换换时 也可以强制刷新数据
  918. "dataTransOpts.refresh.customer_org_group_detail.M": {
  919. // immediate:true,
  920. handler(newVal, oldVal) {
  921. console.log(`watch 体检分组 newVal:${newVal} oldVal:${oldVal} registerCheckId: ${this.customerOrgGroup.id}`);
  922. this.getCustomerOrgGroupAsbitems(this.customerOrgGroup.id);
  923. }
  924. },
  925. // 显示复制分组页面时,刷单位与体检次数数据
  926. "groupVisble":{
  927. handler(newVal, oldVal) {
  928. if(newVal){
  929. console.log('customerOrgGroup',this.customerOrgGroup,this.customerOrgAll,this.curOrgRegisterList)
  930. this.customerOrgDisp = deepCopy(this.customerOrgAll)
  931. this.customerOrgRegisterList = deepCopy(this.curOrgRegisterList)
  932. this.customerOrgRegister = deepCopy(this.curOrgRegister)
  933. this.customerOrgId = this.customerOrgGroup.customerOrgId
  934. this.customerOrgGroups = deepCopy(this.curOrgGroups)
  935. }
  936. }
  937. }
  938. },
  939. };
  940. </script>
  941. <style scoped>
  942. .box {
  943. margin-top: 5px;
  944. /* border: 1px solid #000; */
  945. }
  946. .btnClass {
  947. width: 100px;
  948. margin-bottom: 5px
  949. }
  950. </style>