riku
2025-04-25 4a836815f12e8ba717702cc8ed431e1b4f96134c
src/views/overlay-clue/report/components/ClueReportQuestion.vue
@@ -4,29 +4,23 @@
    <template v-for="(item, index) in questionList" :key="index">
      <DescriptionsList :title="item.cqUid">
        <template #extra>
          <el-button-group>
            <!-- <el-button
            type="warning"
            size="small"
            plain
            icon="Upload"
            @click="pushQuestion(item)"
            :disabled="item.pushing ? true : item.cqUploaded"
            >{{
              item.cqUploaded
                ? '已推送'
                : item.pushing
                ? '推送中'
                : '推送问题'
            }}</el-button
          > -->
          <div>
            <el-button
              v-if="!clueData.cuploaded"
              type="danger"
              size="small"
              icon="Delete"
              @click="deleteQuestion(item)"
            ></el-button>
            <el-button
              type="primary"
              size="small"
              @click="checkQuestion(item)"
              >问题详情</el-button
              >{{
                clueData.cuploaded ? '问题详情' : '修改问题'
              }}</el-button
            >
          </el-button-group>
          </div>
        </template>
        <DescriptionsListItem
          label="问题名称"
@@ -44,7 +38,10 @@
      <!-- <el-divider /> -->
    </template>
    <div class="btn-wrap">
      <el-button type="primary" @click="openDialog"
      <el-button
        v-if="!clueData.cuploaded"
        type="primary"
        @click="openDialog"
        >添加问题</el-button
      >
    </div>
@@ -57,7 +54,8 @@
    </el-empty>
  </div>
  <QuestionDetail
    :clueId="clueId"
    :clueData="clueData"
    :uploaded="clueData.cuploaded"
    v-model:show="dialogShow"
    :question="selectedQuestion"
    @on-submit="getQuestion"
@@ -65,12 +63,25 @@
</template>
<script setup>
import { ref, watch, computed } from 'vue';
import { ref, watch, computed, inject } from 'vue';
import clueQuestionApi from '@/api/clue/clueQuestionApi';
import QuestionDetail from './QuestionDetail.vue';
import {
  useMessageBoxTip,
  useMessageBox
} from '@/composables/messageBox';
// 决定当前是否是内部线索相关操作
const isInternal = inject('isInternal', false);
const props = defineProps({
  clueId: Number
  // clueId: Number,
  clueData: {
    type: Object,
    default: () => {
      return {};
    }
  }
});
// 线索结论
@@ -78,9 +89,10 @@
// 上报弹出框
const dialogShow = ref(false);
const selectedQuestion = ref();
const deleteLoading = ref(false);
watch(
  () => props.clueId,
  () => props.clueData,
  () => {
    getQuestion();
  }
@@ -97,13 +109,35 @@
  selectedQuestion.value = item;
  dialogShow.value = true;
}
// 删除问题
function deleteQuestion(item) {
  useMessageBoxTip({
    confirmMsg: '确认是否删除问题',
    confirmTitle: '删除问题',
    onConfirm: () => {
      return clueQuestionApi
        .deleteQuestion(item.cqId)
        .then((res) => {
          if (res) {
            const index = questionList.value.indexOf(item);
            questionList.value.splice(index, 1);
          }
        })
        .finally(() => (deleteLoading.value = true));
    }
  });
}
/**
 * 获取线索结论
 */
function getQuestion() {
  clueQuestionApi.getQuestion(props.clueId).then((res) => {
    questionList.value = res;
  });
  clueQuestionApi
    .getQuestion(props.clueData.cid, isInternal)
    .then((res) => {
      questionList.value = res;
    });
}
function pushQuestion(item) {