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.

409 lines
12 KiB

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
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
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
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
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
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
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
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
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div class="examinationcategory">
  3. <div>
  4. <span>项目类别</span>
  5. <el-select
  6. v-model="value"
  7. placeholder="请选择"
  8. style="margin-left: 20px"
  9. @change="getprojectgroups"
  10. clearable
  11. >
  12. <el-option
  13. v-for="item in options"
  14. :key="item.id"
  15. :label="item.displayName"
  16. :value="item.id"
  17. >
  18. </el-option>
  19. </el-select>
  20. </div>
  21. <div class="mainarea">
  22. <div class="mainarealeftbox">
  23. <el-table
  24. :header-cell-style="{ background: '#eef1f6' }"
  25. :data="tabledata"
  26. @selection-change="handleSelectionChange"
  27. >
  28. <el-table-column type="selection"></el-table-column>
  29. <el-table-column
  30. label="未选组合项目"
  31. prop="displayName"
  32. ></el-table-column>
  33. </el-table>
  34. </div>
  35. <div class="mainbutton">
  36. <div>
  37. <el-button
  38. type="primary"
  39. style="margin-top: 10px"
  40. @click="addselecteditems"
  41. >移除 <i class="el-icon-arrow-left"></i
  42. ></el-button>
  43. </div>
  44. <div>
  45. <el-button type="primary" style="margin-top: 10px" @click="removedata"
  46. >添加 <i class="el-icon-arrow-right"></i
  47. ></el-button>
  48. </div>
  49. <div>
  50. <el-button
  51. style="margin-top: 10px"
  52. :disabled="saveornot"
  53. @click="Onsubmit"
  54. >保存
  55. </el-button>
  56. </div>
  57. </div>
  58. <!-- -->
  59. <div class="mainarearightbox">
  60. <el-table
  61. :header-cell-style="{ background: '#eef1f6' }"
  62. :data="personnelUnit.nogroupselected"
  63. @selection-change="selecteditems"
  64. >
  65. <!-- temporaryselection personnelUnit.nogroupselected-->
  66. <el-table-column type="selection"></el-table-column>
  67. <el-table-column
  68. label="已选组合项目"
  69. width="110"
  70. prop="displayName"
  71. ></el-table-column>
  72. <el-table-column label="价格" prop="price">
  73. <template slot-scope="scope">
  74. <el-input
  75. type="text"
  76. v-model="personnelUnit.nogroupselected[scope.$index].price"
  77. />
  78. </template>
  79. </el-table-column>
  80. </el-table>
  81. </div>
  82. <div class="operatebottom">
  83. <div>
  84. <el-button type="primary" @click="packagerepicion"
  85. >复制套餐</el-button
  86. >
  87. </div>
  88. <div style="margin-top: 10px">
  89. <el-button type="primary" @click="copygroup">复制分组</el-button>
  90. </div>
  91. </div>
  92. </div>
  93. <!-- 复制套餐弹框 -->
  94. <el-dialog title="编辑" :visible.sync="dialogVisible" width="60%">
  95. <el-table :data="packagelist">
  96. <el-table-column label="编号" prop="id"></el-table-column>
  97. <el-table-column label="名称" prop="displayName"></el-table-column>
  98. <el-table-column label="创建者" prop="creatorName"></el-table-column>
  99. <el-table-column label="创建时间" prop="creatorName">
  100. <template slot-scope="scope">
  101. {{ scope.row.creationTime | dateFormat }}
  102. </template>
  103. </el-table-column>
  104. <el-table-column
  105. label="修改者"
  106. prop="lastModifierName"
  107. ></el-table-column>
  108. <el-table-column label="修改时间" prop="lastModificationTime">
  109. <template slot-scope="scope">
  110. {{ scope.row.lastModificationTime | dateFormat }}
  111. </template>
  112. </el-table-column>
  113. </el-table>
  114. <span slot="footer" class="dialog-footer">
  115. <el-button @click="dialogVisible = false"> </el-button>
  116. <el-button type="primary" @click="dialogVisible = false"
  117. > </el-button
  118. >
  119. </span>
  120. </el-dialog>
  121. <!-- 复制分组 弹框-->
  122. <el-dialog
  123. title="复制分组"
  124. :visible.sync="copyGroupdialogVisible"
  125. width="50%"
  126. >
  127. <el-table>
  128. <el-table-column label="编号"></el-table-column>
  129. <el-table-column label="创建者"></el-table-column>
  130. <el-table-column label="创建时间"></el-table-column>
  131. <el-table-column label="修改者"></el-table-column>
  132. <el-table-column label="修改时间"></el-table-column>
  133. </el-table>
  134. <span slot="footer" class="dialog-footer">
  135. <el-button @click="copyGroupdialogVisible = false"> </el-button>
  136. <el-button type="primary" @click="copyGroupdialogVisible = false"
  137. > </el-button
  138. >
  139. </span>
  140. </el-dialog>
  141. <!-- -->
  142. </div>
  143. </template>
  144. <script>
  145. import { getapi, postapi } from "@/api/api";
  146. import { mapState } from "vuex";
  147. export default {
  148. data() {
  149. return {
  150. saveornot: true, //保存按钮
  151. selecteddata: [], //已选数据
  152. unselecteddata: [], //未选数据
  153. unselecteddata: [], //右边勾选中
  154. rightselctedata: [], //右侧已选
  155. options: [],
  156. value: "",
  157. dialogVisible: false,
  158. copyGroupdialogVisible: false,
  159. packagelist: [],
  160. tabledata: [],
  161. temporaryselection: [], //已选组合项目table
  162. copegroupdata: [], //复制分组
  163. addrulst: [], //添加保存的Id
  164. price: "", //价格
  165. };
  166. },
  167. computed: {
  168. ...mapState(["personnelUnit"]),
  169. },
  170. created() {
  171. this.getitemtype();
  172. this.getportfolioitems();
  173. },
  174. methods: {
  175. inputchang(row, newVal) {
  176. this.price = row.price;
  177. console.log(this.price);
  178. },
  179. //保存按钮
  180. Onsubmit() {
  181. if (!this.personnelUnit.customerOrgGroupId) {
  182. alert("请先选择单位分组");
  183. return;
  184. } else {
  185. console.log(this.personnelUnit.nogroupselected);
  186. postapi("/api/app/customer-org-group-detail/many", this.addrulst).then(
  187. (res) => {
  188. this.$message.success("操作成功");
  189. console.log(this.addrulst);
  190. }
  191. );
  192. }
  193. // console.log(this.addrulst);
  194. // // console.log(this.personnelUnit.form.id);
  195. // if (this.addrulst[customerOrgGroupId] == undefined) {
  196. // this.$message.warning("请先选择单位分组");
  197. // } else {
  198. // postapi("/api/app/customer-org-group-detail/many", this.addrulst).then(
  199. // (res) => {
  200. // console.log(this.personnelUnit.form.id);
  201. // this.$message.success("操作成功");
  202. // }
  203. // );
  204. // }
  205. },
  206. //移除按钮
  207. addselecteditems() {
  208. console.log(this.personnelUnit.id);
  209. if (this.personnelUnit.form.id == "") {
  210. alert("请先选择单位类别");
  211. } else {
  212. // 让按钮恢复禁用
  213. this.saveornot = false;
  214. //personnelUnit.nogroupselected
  215. if (this.rightselctedata.length == 0) {
  216. this.$message.warning("已选数据为空无法移动");
  217. } else {
  218. let count = this.rightselctedata.length - 1;
  219. for (var i = count; i >= 0; i--) {
  220. // this.personnelUnit.nogroupselected.splice(i, 1);
  221. // !this.rightselctedata.includes(this.rightselctedata[i].displayName)
  222. [...new Set(this.rightselctedata)];
  223. this.tabledata.push(this.rightselctedata[i]);
  224. this.personnelUnit.nogroupselected.splice(i, 1);
  225. // this.tabledata.push(this.rightselctedata[i]);
  226. }
  227. console.log(this.personnelUnit.customerOrgGroupId);
  228. // this.
  229. this.rightselctedata.forEach((item) => {
  230. this.addrulst.push({
  231. asbitemId: item.id,
  232. price: price,
  233. // price: this.price,
  234. customerOrgGroupId: this.personnelUnit.customerOrgGroupId,
  235. });
  236. });
  237. }
  238. }
  239. },
  240. //右侧勾选按钮
  241. selecteditems(val) {
  242. this.rightselctedata = val;
  243. // this.personnelUnit.nogroupselected = val;
  244. console.log(this.rightselctedata);
  245. },
  246. // 添加按钮
  247. removedata() {
  248. if (this.personnelUnit.form.id == "") {
  249. alert("请先选择单位分组");
  250. } else {
  251. if (this.unselecteddata.length == 0) {
  252. this.$message.warning("未选数据为空无法移动");
  253. } else {
  254. this.saveornot = false;
  255. let count = this.unselecteddata.length - 1;
  256. for (var i = count; i >= 0; i--) {
  257. // this.tabledata.splice(i, 1);
  258. if ([...new Set(this.unselecteddata)]) {
  259. // this.unselecteddata.push(this.unselecteddata[i]);
  260. this.personnelUnit.nogroupselected.push(this.unselecteddata[i]);
  261. this.tabledata.splice(i, 1);
  262. }
  263. // this.personnelUnit.nogroupselected.push(this.unselecteddata[i]);
  264. }
  265. console.log(this.personnelUnit.customerOrgGroupId);
  266. this.unselecteddata.forEach((item) => {
  267. // var price = "";
  268. // if (this.price == "") {
  269. // price = item.price;
  270. // } else {
  271. // price = this.price;
  272. // }
  273. //获取最新价格
  274. });
  275. let prices = "";
  276. this.personnelUnit.nogroupselected.forEach((items) => {
  277. prices = items.price;
  278. console.log(prices);
  279. // this.price = item.price;
  280. console.log(price);
  281. this.addrulst.push({
  282. asbitemId: "3a0b2f0c-f884-bec4-a350-79b46b455a2d",
  283. // price: prices,
  284. price: this.psrice,
  285. customerOrgGroupId: this.personnelUnit.customerOrgGroupId,
  286. });
  287. });
  288. console.log(this.addrulst, "hhhhhhh");
  289. }
  290. }
  291. },
  292. // 左侧未选
  293. handleSelectionChange(val) {
  294. // this.selecteddata = val;
  295. this.unselecteddata = val;
  296. console.log(this.unselecteddata);
  297. },
  298. //获取所有组合项目
  299. getportfolioitems() {
  300. getapi("/api/app/asbitem/in-filter?Filter").then((res) => {
  301. this.tabledata = res.data.items;
  302. });
  303. },
  304. //项目类别选择
  305. getprojectgroups(v) {
  306. if (v !== "") {
  307. getapi(`/api/app/asbitem/in-item-type/${v}`).then((res) => {
  308. console.log(res);
  309. this.tabledata = res.data;
  310. });
  311. } else {
  312. getapi("/api/app/asbitem/in-filter?Filter").then((res) => {
  313. this.tabledata = res.data.items;
  314. });
  315. }
  316. },
  317. //复制分组弹框
  318. copygroup() {
  319. if (this.personnelUnit.form == "") {
  320. this.$message.warning("请选择分组");
  321. } else {
  322. this.copyGroupdialogVisible = true;
  323. getapi(
  324. `/api/app/customer-org-group-detail/customer-org-group-detail-in-asbitem?CustomerOrgGroupId=${this.personnelUnit.form.id}`
  325. ).then((res) => {
  326. console.log(res);
  327. this.personnelUnit.form = res.data;
  328. });
  329. }
  330. },
  331. //复制套餐
  332. packagerepicion() {
  333. this.dialogVisible = true;
  334. getapi("/api/app/medical-package").then((res) => {
  335. this.packagelist = res.data.items;
  336. console.log(res);
  337. });
  338. },
  339. //
  340. getitemtype() {
  341. getapi("/api/app/item-type/by-code-all").then((res) => {
  342. this.options = res.data;
  343. });
  344. },
  345. //获取当前列列表数据
  346. listeninglist() {
  347. getapi(
  348. `/api/app/customer-org-group/${this.personnelUnit.customerOrgGroupId}`
  349. ).then((res) => {
  350. this.personnelUnit.form = res.data;
  351. console.log(res);
  352. });
  353. getapi(
  354. `/api/app/customer-org-group-detail/customer-org-group-detail-in-asbitem?CustomerOrgGroupId=${this.personnelUnit.form.id}`
  355. ).then((res) => {
  356. console.log(res, "res");
  357. this.personnelUnit.nogroupselected = res.data;
  358. });
  359. },
  360. // getapi(`/api/app/customer-org-group/${row.id}`).then((res)
  361. },
  362. //监听事件
  363. watch: {
  364. //
  365. "personnelUnit.customerOrgGroupId"(newVal, oldVal) {
  366. //console.log('patientRegister.addTimes newVal:',newVal,' oldVal:',oldVal)
  367. if (newVal != oldVal) {
  368. console.log("newVal", newVal);
  369. this.listeninglist();
  370. //
  371. }
  372. },
  373. },
  374. };
  375. </script>
  376. <style scoped>
  377. .operatebottom {
  378. margin-left: 5%;
  379. }
  380. .mainarearightbox {
  381. width: 30%;
  382. border: 1px solid #000;
  383. height: 300px;
  384. margin-left: 7%;
  385. }
  386. .mainbutton {
  387. margin-left: 5%;
  388. padding: 5px 10px;
  389. margin-top: 5%;
  390. }
  391. .mainarea {
  392. display: flex;
  393. margin-top: 20px;
  394. }
  395. .mainarealeftbox {
  396. width: 20%;
  397. border: 1px solid #000;
  398. height: 300px;
  399. margin-left: 7%;
  400. }
  401. .examinationcategory {
  402. margin-top: 30px;
  403. }
  404. </style>