|
@@ -6,7 +6,6 @@
|
|
import { ElMessage } from 'element-plus';
|
|
import { ElMessage } from 'element-plus';
|
|
import { useResponse } from '/@/utils/useResponse';
|
|
import { useResponse } from '/@/utils/useResponse';
|
|
import * as api from '../api';
|
|
import * as api from '../api';
|
|
-import { getStaffsOptions } from '../api';
|
|
|
|
import { Close, Finished } from '@element-plus/icons-vue';
|
|
import { Close, Finished } from '@element-plus/icons-vue';
|
|
|
|
|
|
|
|
|
|
@@ -28,7 +27,7 @@ const currentRow: any = ref(null);
|
|
onBeforeMount(() => {
|
|
onBeforeMount(() => {
|
|
fetchStaffsOptions();
|
|
fetchStaffsOptions();
|
|
fetchExistingStaff();
|
|
fetchExistingStaff();
|
|
-})
|
|
|
|
|
|
+});
|
|
|
|
|
|
function handleClose(done: any) {
|
|
function handleClose(done: any) {
|
|
staffSelect.value = '';
|
|
staffSelect.value = '';
|
|
@@ -70,29 +69,27 @@ async function fetchExistingStaff() {
|
|
}
|
|
}
|
|
|
|
|
|
async function addStaffs() {
|
|
async function addStaffs() {
|
|
- staffLoading.value = true;
|
|
|
|
const body = {
|
|
const body = {
|
|
- id: currentRow.id,
|
|
|
|
- user_ids: staffTags.map((tag: any) => tag.id)
|
|
|
|
|
|
+ id: rowData?.id,
|
|
|
|
+ user_ids: staffTags.value.map((tag: any) => tag.id)
|
|
};
|
|
};
|
|
try {
|
|
try {
|
|
- // const resp = await api.postStaffs(body);
|
|
|
|
- // if (resp.code === 2000) {
|
|
|
|
- // ElMessage.error('编辑成功!');
|
|
|
|
- // await fetchExistingStaff(currentRow);
|
|
|
|
- // }
|
|
|
|
|
|
+ const resp = await useResponse(api.postStaffs, body, staffLoading)
|
|
|
|
+ if (resp.code === 2000) {
|
|
|
|
+ ElMessage.success('编辑成功!');
|
|
|
|
+ fetchExistingStaff();
|
|
|
|
+ }
|
|
} catch (error) {
|
|
} catch (error) {
|
|
ElMessage.error('编辑失败!');
|
|
ElMessage.error('编辑失败!');
|
|
} finally {
|
|
} finally {
|
|
staffSelect.value = '';
|
|
staffSelect.value = '';
|
|
- staffLoading.value = false;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
function cancelDialog() {
|
|
function cancelDialog() {
|
|
staffSelect.value = '';
|
|
staffSelect.value = '';
|
|
staffTags.value = [];
|
|
staffTags.value = [];
|
|
- noticeDialog.value.visible = false
|
|
|
|
|
|
+ noticeDialog.value.visible = false;
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
@@ -130,21 +127,26 @@ function cancelDialog() {
|
|
<span class="ml-1" style="color: #909399">仅可添加已绑定邮箱的用户</span>
|
|
<span class="ml-1" style="color: #909399">仅可添加已绑定邮箱的用户</span>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
- <div class="flex flex-wrap gap-1.5">
|
|
|
|
|
|
+ <div class="flex flex-wrap gap-1.5 min-h-6">
|
|
<el-tag
|
|
<el-tag
|
|
v-for="tag in staffTags"
|
|
v-for="tag in staffTags"
|
|
:key="tag.id"
|
|
:key="tag.id"
|
|
closable
|
|
closable
|
|
|
|
+ round
|
|
|
|
+ effect="plain"
|
|
@close="removeTag(tag)">
|
|
@close="removeTag(tag)">
|
|
{{ tag.username }}
|
|
{{ tag.username }}
|
|
</el-tag>
|
|
</el-tag>
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
|
|
+
|
|
<el-divider style="margin: 12px 0 20px 0"></el-divider>
|
|
<el-divider style="margin: 12px 0 20px 0"></el-divider>
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
|
|
|
+ <template #footer>
|
|
<el-button :icon="Close" @click="cancelDialog">取 消</el-button>
|
|
<el-button :icon="Close" @click="cancelDialog">取 消</el-button>
|
|
<el-button :icon="Finished" :loading="staffLoading" type="primary" @click="addStaffs">确 定</el-button>
|
|
<el-button :icon="Finished" :loading="staffLoading" type="primary" @click="addStaffs">确 定</el-button>
|
|
- </span>
|
|
|
|
|
|
+ </template>
|
|
|
|
+ <!--<span slot="footer" class="dialog-footer">-->
|
|
|
|
+ <!-- -->
|
|
|
|
+ <!--</span>-->
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|