|
|
@@ -7,6 +7,10 @@
|
|
7
|
7
|
/>
|
|
8
|
8
|
<page-content ref="pageContentRef" :contentTableConfig="contentTableConfig" pageName="/patient/patient"
|
|
9
|
9
|
:isExport="false" @newBtnClick="handleNewData" @editBtnClick="handleEditData">
|
|
|
10
|
+ <template #otherHandler>
|
|
|
11
|
+ <el-button type="primary" @click="batchLabels(1)">批量添加标签</el-button>
|
|
|
12
|
+ <el-button type="danger" @click="batchLabels(0)">批量删除标签</el-button>
|
|
|
13
|
+ </template>
|
|
10
|
14
|
<template #patientId="{ row }">
|
|
11
|
15
|
<el-button type="primary" link @click="buttonHandle(row.patientId)">{{ row.name }}</el-button>
|
|
12
|
16
|
</template>
|
|
|
@@ -36,7 +40,7 @@ import { useRouter } from 'vue-router';
|
|
36
|
40
|
import PageSearch from '@/components/page-search'
|
|
37
|
41
|
import PageContent from '@/components/page-content'
|
|
38
|
42
|
import PageModal from '@/components/page-modal'
|
|
39
|
|
-import { setLabel } from '@/api/patient/patient';
|
|
|
43
|
+import { setLabel, cancelLabel } from '@/api/patient/patient';
|
|
40
|
44
|
|
|
41
|
45
|
import { searchFormConfig } from './config/search.config'
|
|
42
|
46
|
import { contentTableConfig } from './config/content.config'
|
|
|
@@ -117,11 +121,23 @@ export default defineComponent({
|
|
117
|
121
|
})
|
|
118
|
122
|
|
|
119
|
123
|
|
|
120
|
|
- const batchLabels = async () => {
|
|
|
124
|
+ const batchLabels = async (type) => {
|
|
|
125
|
+
|
|
|
126
|
+ const selectRows = pageContentRef.value.getSelectionRows()
|
|
|
127
|
+ if (selectRows.length <= 0) {
|
|
|
128
|
+ ElMessage({
|
|
|
129
|
+ message: '请选择要操作的数据',
|
|
|
130
|
+ type: 'warning',
|
|
|
131
|
+ })
|
|
|
132
|
+
|
|
|
133
|
+ return
|
|
|
134
|
+ }
|
|
121
|
135
|
|
|
|
136
|
+ const boxTitle = type ? '批量添加标签' : '批量取消标签'
|
|
|
137
|
+ const boxTip = type ? '请输入新的标签' : '请输入粘贴要取消的标签'
|
|
122
|
138
|
|
|
123
|
139
|
|
|
124
|
|
- ElMessageBox.prompt('请输入新的标签', '批量打标签', {
|
|
|
140
|
+ ElMessageBox.prompt(boxTip, boxTitle, {
|
|
125
|
141
|
confirmButtonText: '确定',
|
|
126
|
142
|
cancelButtonText: '取消',
|
|
127
|
143
|
inputPattern: /^[\w\u4E00-\u9FA5]{0,10}$/,
|
|
|
@@ -129,13 +145,16 @@ export default defineComponent({
|
|
129
|
145
|
})
|
|
130
|
146
|
.then(async ({ value }) => {
|
|
131
|
147
|
// 获取选择的编号
|
|
132
|
|
- const selectRows = pageContentRef.value.getSelectionRows()
|
|
133
|
148
|
|
|
134
|
149
|
if (selectRows.length > 0) {
|
|
135
|
150
|
const ids = selectRows.map((o) => o.patientId);
|
|
136
|
151
|
|
|
137
|
|
- console.log(ids, 'ids');
|
|
138
|
|
- const result = await setLabel(ids.join(','), value);
|
|
|
152
|
+ let result;
|
|
|
153
|
+ if (type === 1) {
|
|
|
154
|
+ result = await setLabel(ids, value);
|
|
|
155
|
+ } else {
|
|
|
156
|
+ result = await cancelLabel(ids, value);
|
|
|
157
|
+ }
|
|
139
|
158
|
|
|
140
|
159
|
if (result.state === 'success') {
|
|
141
|
160
|
ElMessage({
|