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.

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