|
|
@@ -53,7 +53,35 @@
|
|
53
|
53
|
<br />
|
|
54
|
54
|
|
|
55
|
55
|
<el-card shadow="never">
|
|
56
|
|
- <el-table v-loading="loading" :data="tableList" border>
|
|
|
56
|
+ <div slot="header" class="table-card-header">
|
|
|
57
|
+ <el-button
|
|
|
58
|
+ v-hasPermi="['diseaseTreatment:medicalResource:publish']"
|
|
|
59
|
+ type="primary"
|
|
|
60
|
+ plain
|
|
|
61
|
+ size="mini"
|
|
|
62
|
+ :disabled="!selectedRows.length"
|
|
|
63
|
+ @click="handleBatchPublish"
|
|
|
64
|
+ >{{ dtCommon("batchPublish") }}</el-button>
|
|
|
65
|
+ <el-button
|
|
|
66
|
+ v-hasPermi="['diseaseTreatment:medicalResource:offline']"
|
|
|
67
|
+ type="warning"
|
|
|
68
|
+ plain
|
|
|
69
|
+ size="mini"
|
|
|
70
|
+ :disabled="!selectedRows.length"
|
|
|
71
|
+ @click="handleBatchOffline"
|
|
|
72
|
+ >{{ dtCommon("batchOffline") }}</el-button>
|
|
|
73
|
+ <el-button
|
|
|
74
|
+ v-if="showColAccount"
|
|
|
75
|
+ v-hasPermi="['diseaseTreatment:medicalResource:assignAccount']"
|
|
|
76
|
+ type="success"
|
|
|
77
|
+ plain
|
|
|
78
|
+ size="mini"
|
|
|
79
|
+ :disabled="!selectedRows.length"
|
|
|
80
|
+ @click="handleBatchAssignAccount"
|
|
|
81
|
+ >{{ dtCommon("batchAssignAccount") }}</el-button>
|
|
|
82
|
+ </div>
|
|
|
83
|
+ <el-table ref="table" v-loading="loading" :data="tableList" border @selection-change="handleSelectionChange">
|
|
|
84
|
+ <el-table-column type="selection" width="50" align="center" />
|
|
57
|
85
|
<el-table-column :label="dtT('colResourceName')" prop="resourceName" align="center" min-width="110" :show-overflow-tooltip="true" />
|
|
58
|
86
|
<el-table-column :label="dtT('colIntro')" prop="introduction" align="center" min-width="140" :show-overflow-tooltip="true" />
|
|
59
|
87
|
<el-table-column v-if="showColContact" :label="dtT('colContact')" prop="contactPhone" align="center" width="120" />
|
|
|
@@ -420,7 +448,10 @@ import {
|
|
420
|
448
|
delMedicalResource,
|
|
421
|
449
|
publishMedicalResource,
|
|
422
|
450
|
offlineMedicalResource,
|
|
423
|
|
- assignAccountMedicalResource
|
|
|
451
|
+ assignAccountMedicalResource,
|
|
|
452
|
+ batchPublishMedicalResource,
|
|
|
453
|
+ batchOfflineMedicalResource,
|
|
|
454
|
+ batchAssignAccountMedicalResource
|
|
424
|
455
|
} from "@/api/diseaseTreatment/medicalResource"
|
|
425
|
456
|
import { listInformationCategoryChildren } from "@/api/category/informationCategory"
|
|
426
|
457
|
|
|
|
@@ -468,6 +499,7 @@ export default {
|
|
468
|
499
|
formKey: 0,
|
|
469
|
500
|
total: 0,
|
|
470
|
501
|
tableList: [],
|
|
|
502
|
+ selectedRows: [],
|
|
471
|
503
|
resourceTypeOptions: [],
|
|
472
|
504
|
queryParams: {
|
|
473
|
505
|
pageNum: 1,
|
|
|
@@ -801,6 +833,102 @@ export default {
|
|
801
|
833
|
: (this.isVetType(resourceType) || this.isOrgType(resourceType)) && Number(row.accountAssigned) === 0 && canModify
|
|
802
|
834
|
}
|
|
803
|
835
|
},
|
|
|
836
|
+ clearTableSelection() {
|
|
|
837
|
+ this.selectedRows = []
|
|
|
838
|
+ this.$refs.table && this.$refs.table.clearSelection()
|
|
|
839
|
+ },
|
|
|
840
|
+ handleSelectionChange(selection) {
|
|
|
841
|
+ this.selectedRows = selection
|
|
|
842
|
+ },
|
|
|
843
|
+ unselectBatchInvalidRows(invalidRows) {
|
|
|
844
|
+ const table = this.$refs.table
|
|
|
845
|
+ if (!table || !invalidRows.length) {
|
|
|
846
|
+ return
|
|
|
847
|
+ }
|
|
|
848
|
+ invalidRows.forEach((row) => {
|
|
|
849
|
+ table.toggleRowSelection(row, false)
|
|
|
850
|
+ })
|
|
|
851
|
+ },
|
|
|
852
|
+ /** 批量操作:筛掉不可操作行并取消勾选,返回仍可操作的行 */
|
|
|
853
|
+ prepareBatchShelfRows(checkFn, autoUncheckMsgKey) {
|
|
|
854
|
+ const rows = this.selectedRows
|
|
|
855
|
+ if (!rows.length) {
|
|
|
856
|
+ this.$modal.msgWarning(this.dtT("msgSelectRows"))
|
|
|
857
|
+ return null
|
|
|
858
|
+ }
|
|
|
859
|
+ const invalidRows = rows.filter((row) => !checkFn(row))
|
|
|
860
|
+ const validRows = rows.filter((row) => checkFn(row))
|
|
|
861
|
+ if (invalidRows.length) {
|
|
|
862
|
+ this.unselectBatchInvalidRows(invalidRows)
|
|
|
863
|
+ const names = invalidRows
|
|
|
864
|
+ .map((row) => row.resourceName || this.$t("diseaseTreatment.status.dash"))
|
|
|
865
|
+ .filter(Boolean)
|
|
|
866
|
+ .join("、")
|
|
|
867
|
+ this.$modal.msgWarning(this.dtT(autoUncheckMsgKey, { names }))
|
|
|
868
|
+ }
|
|
|
869
|
+ if (!validRows.length) {
|
|
|
870
|
+ return null
|
|
|
871
|
+ }
|
|
|
872
|
+ return validRows
|
|
|
873
|
+ },
|
|
|
874
|
+ runBatchShelfAction(options) {
|
|
|
875
|
+ const { checkFn, autoUncheckMsgKey, confirmKey, loadingKey, requestFn, successMsgKey } = options
|
|
|
876
|
+ const validRows = this.prepareBatchShelfRows(checkFn, autoUncheckMsgKey)
|
|
|
877
|
+ if (!validRows) {
|
|
|
878
|
+ return
|
|
|
879
|
+ }
|
|
|
880
|
+ const ids = validRows.map((row) => row.id)
|
|
|
881
|
+ this.$nextTick(() => {
|
|
|
882
|
+ this.$modal
|
|
|
883
|
+ .confirm(this.dtT(confirmKey))
|
|
|
884
|
+ .then(() => {
|
|
|
885
|
+ this.$modal.loading(this.dtCommon(loadingKey))
|
|
|
886
|
+ return requestFn(ids)
|
|
|
887
|
+ })
|
|
|
888
|
+ .then(() => {
|
|
|
889
|
+ this.$modal.msgSuccess(this.dtCommon(successMsgKey))
|
|
|
890
|
+ this.clearTableSelection()
|
|
|
891
|
+ this.getList()
|
|
|
892
|
+ })
|
|
|
893
|
+ .catch(() => {})
|
|
|
894
|
+ .finally(() => {
|
|
|
895
|
+ this.$modal.closeLoading()
|
|
|
896
|
+ })
|
|
|
897
|
+ })
|
|
|
898
|
+ },
|
|
|
899
|
+ handleBatchPublish() {
|
|
|
900
|
+ this.runBatchShelfAction({
|
|
|
901
|
+ checkFn: (row) => row.canPublish,
|
|
|
902
|
+ autoUncheckMsgKey: "msgBatchAutoUncheckPublish",
|
|
|
903
|
+ confirmKey: "confirmBatchPublish",
|
|
|
904
|
+ loadingKey: "batchPublishing",
|
|
|
905
|
+ requestFn: batchPublishMedicalResource,
|
|
|
906
|
+ successMsgKey: "msgPubOk"
|
|
|
907
|
+ })
|
|
|
908
|
+ },
|
|
|
909
|
+ handleBatchOffline() {
|
|
|
910
|
+ this.runBatchShelfAction({
|
|
|
911
|
+ checkFn: (row) => row.canOffline,
|
|
|
912
|
+ autoUncheckMsgKey: "msgBatchAutoUncheckOffline",
|
|
|
913
|
+ confirmKey: "confirmBatchOffline",
|
|
|
914
|
+ loadingKey: "batchOfflining",
|
|
|
915
|
+ requestFn: batchOfflineMedicalResource,
|
|
|
916
|
+ successMsgKey: "msgOffOk"
|
|
|
917
|
+ })
|
|
|
918
|
+ },
|
|
|
919
|
+ handleBatchAssignAccount() {
|
|
|
920
|
+ if (!this.showColAccount) {
|
|
|
921
|
+ return
|
|
|
922
|
+ }
|
|
|
923
|
+ this.runBatchShelfAction({
|
|
|
924
|
+ checkFn: (row) => row.canAssignAccount,
|
|
|
925
|
+ autoUncheckMsgKey: "msgBatchAutoUncheckAssignAccount",
|
|
|
926
|
+ confirmKey: "confirmBatchAssign",
|
|
|
927
|
+ loadingKey: "batchAssigning",
|
|
|
928
|
+ requestFn: batchAssignAccountMedicalResource,
|
|
|
929
|
+ successMsgKey: "msgAssignOk"
|
|
|
930
|
+ })
|
|
|
931
|
+ },
|
|
804
|
932
|
getList() {
|
|
805
|
933
|
this.loading = true
|
|
806
|
934
|
listMedicalResource(this.queryParams)
|
|
|
@@ -1208,4 +1336,10 @@ export default {
|
|
1208
|
1336
|
white-space: pre-wrap;
|
|
1209
|
1337
|
word-break: break-word;
|
|
1210
|
1338
|
}
|
|
|
1339
|
+.table-card-header {
|
|
|
1340
|
+ display: flex;
|
|
|
1341
|
+ justify-content: flex-end;
|
|
|
1342
|
+ align-items: center;
|
|
|
1343
|
+ gap: 8px;
|
|
|
1344
|
+}
|
|
1211
|
1345
|
</style>
|