|
|
@@ -45,7 +45,10 @@
|
|
|
:reportList="item.reportList"
|
|
|
:showMore="item.showMore"
|
|
|
@toggleReport="item.showMore = !item.showMore; item.showMore && refreshReportEntry(index)"
|
|
|
- @refreshReportList="refreshReportEntry(index)">
|
|
|
+ @refreshReportList="refreshReportEntry(index)"
|
|
|
+ @deleteReport="e=>deleteReportEntry(e,index)"
|
|
|
+ @sendReport="e=>sendReportEntry(e,index,item)"
|
|
|
+ @reCreateReport="e=>reCreateReportEntry(e,index)">
|
|
|
</reportList>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -114,7 +117,20 @@
|
|
|
<el-button :loading="buttonLoading" type="primary" @click="submitForm">保 存</el-button>
|
|
|
<el-button @click="cancel" style="margin-right: 5%;">取 消</el-button>
|
|
|
</div>
|
|
|
- </el-dialog>
|
|
|
+ </el-dialog>
|
|
|
+ <el-dialog width="40%" :visible.sync="sendReportShow" title="发送报告" @close="sendReportShow=false">
|
|
|
+ <div>
|
|
|
+ <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
|
|
|
+ <div style="margin: 15px 0;"></div>
|
|
|
+ <el-checkbox-group v-model="checkedUsers" @change="handleCheckedUsersChange">
|
|
|
+ <el-checkbox v-for="user in reportUsers" :label="user.userId" :key="user.userId">{{user.realName}}</el-checkbox>
|
|
|
+ </el-checkbox-group>
|
|
|
+ </div>
|
|
|
+ <div class="demo-drawer__footer" style="display: flex;justify-content: end;margin-top: 20px;">
|
|
|
+ <el-button type="primary" @click="submitReportSend">保 存</el-button>
|
|
|
+ <el-button @click="sendReportShow=false" style="margin-right: 5%;">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -125,7 +141,7 @@
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
const uploadUrl = `${window.SITE_CONFIG["apiURL"]}/sys/oss/uploadFile`
|
|
|
const uploadHeaders = {token:Cookies.get("token")};
|
|
|
- import { getQuestionnaireList, addQuestionnaire, updateQuestionnaire, deleteQuestionnaire, getTeamQuestionnaireList, getTeamReportWjList } from '@/api/agent/index.js'
|
|
|
+ import { getQuestionnaireList, addQuestionnaire, updateQuestionnaire, deleteQuestionnaire, getTeamQuestionnaireList, getTeamReportWjList, deleteTeamReportWj, sendReportUsers, reCreateReport } from '@/api/agent/index.js'
|
|
|
|
|
|
const queryParams = ref({
|
|
|
page:1,
|
|
|
@@ -144,6 +160,13 @@
|
|
|
const dataList = ref([])
|
|
|
const expandedReportRows = ref([])
|
|
|
const currentReportRow = ref(null)
|
|
|
+ const sendReportShow = ref(false)
|
|
|
+ const reportUsers = ref([])
|
|
|
+ const checkedUsers = ref([])
|
|
|
+ const checkAll = ref(false)
|
|
|
+ const isIndeterminate = ref(false)
|
|
|
+ const selectedReportId = ref('')
|
|
|
+ const selectedReportIndex = ref(-1)
|
|
|
const total = ref(0)
|
|
|
const loading = ref(false)
|
|
|
const show = ref(false)
|
|
|
@@ -255,10 +278,12 @@
|
|
|
}
|
|
|
|
|
|
const getList = async () => {
|
|
|
- let query = {...queryParams.value};
|
|
|
- loading.value = true;
|
|
|
- const res = await getQuestionnaireList(query);
|
|
|
- dataList.value = res.data.list.map(prepareQuestionnaireRow);
|
|
|
+ let query = {...queryParams.value};
|
|
|
+ loading.value = true;
|
|
|
+ const res = await getQuestionnaireList(query);
|
|
|
+ expandedReportRows.value = []
|
|
|
+ currentReportRow.value = null
|
|
|
+ dataList.value = res.data.list.map(prepareQuestionnaireRow);
|
|
|
total.value = res.data.total;
|
|
|
loading.value = false;
|
|
|
}
|
|
|
@@ -298,6 +323,45 @@
|
|
|
if (res.code !== 0) return proxy.$message.error(res.msg)
|
|
|
entry.reportList = res.data
|
|
|
}
|
|
|
+ const deleteReportEntry = async (id, index) => {
|
|
|
+ await proxy.$modal.confirm('确认删除该报告吗?如确认会立即执行!')
|
|
|
+ const res = await deleteTeamReportWj([id])
|
|
|
+ if (res.code !== 0) return proxy.$message.error(res.msg)
|
|
|
+ proxy.$message.success('删除成功!')
|
|
|
+ await refreshReportEntry(index)
|
|
|
+ }
|
|
|
+ const sendReportEntry = (id, index, item) => {
|
|
|
+ selectedReportId.value = id
|
|
|
+ selectedReportIndex.value = index
|
|
|
+ reportUsers.value = item.memberInfos || []
|
|
|
+ sendReportShow.value = true
|
|
|
+ }
|
|
|
+ const submitReportSend = async () => {
|
|
|
+ if (checkedUsers.value.length === 0) return proxy.$message.error('请选择需要发送报告的成员!')
|
|
|
+ const res = await sendReportUsers({ id: selectedReportId.value, userIds: checkedUsers.value })
|
|
|
+ if (res.code !== 0) return proxy.$message.error(res.msg)
|
|
|
+ proxy.$message.success('发送成功!')
|
|
|
+ sendReportShow.value = false
|
|
|
+ checkedUsers.value = []
|
|
|
+ checkAll.value = false
|
|
|
+ isIndeterminate.value = false
|
|
|
+ await refreshReportEntry(selectedReportIndex.value)
|
|
|
+ }
|
|
|
+ const handleCheckAllChange = value => {
|
|
|
+ checkedUsers.value = value ? reportUsers.value.map(user => user.userId) : []
|
|
|
+ isIndeterminate.value = false
|
|
|
+ }
|
|
|
+ const handleCheckedUsersChange = value => {
|
|
|
+ const checkedCount = value.length
|
|
|
+ checkAll.value = checkedCount === reportUsers.value.length
|
|
|
+ isIndeterminate.value = checkedCount > 0 && checkedCount < reportUsers.value.length
|
|
|
+ }
|
|
|
+ const reCreateReportEntry = async (id, index) => {
|
|
|
+ const res = await reCreateReport(id)
|
|
|
+ if (res.code !== 0) return proxy.$message.error(res.msg)
|
|
|
+ proxy.$message.success('重新生成成功!')
|
|
|
+ await refreshReportEntry(index)
|
|
|
+ }
|
|
|
const handleSizeChange = (e)=>{
|
|
|
queryParams.value.limit = e;
|
|
|
getList();
|