handleFeedback.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <div class="feedback-page">
  3. <el-button :icon="Back" @click="backList">返回</el-button>
  4. <div
  5. ><singleProblem
  6. :problem-data="singleFeedback"
  7. :is-handle="false"
  8. style="margin-top: 24px; margin-bottom: 40px"
  9. /></div>
  10. <el-form
  11. ref="ruleFormRef"
  12. :model="ruleForm"
  13. :rules="rules"
  14. label-position="left"
  15. label-width="90px"
  16. class="demo-ruleForm"
  17. size="default"
  18. status-icon
  19. >
  20. <el-form-item label="处理人:" prop="name">
  21. <el-input v-model="ruleForm.name" placeholder="请输入" style="width: 160px" />
  22. </el-form-item>
  23. <el-form-item label="处理措施:" prop="solution">
  24. <el-input
  25. v-model="ruleForm.solution"
  26. placeholder="请输入多行文字"
  27. :autosize="{ minRows: 7, maxRows: 7 }"
  28. type="textarea"
  29. style="height: 160px"
  30. />
  31. </el-form-item>
  32. </el-form>
  33. <el-button type="primary" @click="subHandle" class="sub-btn" :disabled="!isFormValid"> 提交 </el-button>
  34. <el-dialog
  35. v-model="dialogVisible"
  36. title="提交成功"
  37. width="500"
  38. align-center
  39. @close="closeDialog"
  40. >
  41. <span>提交成功,可以在【已处理】中查看</span>
  42. <template #footer>
  43. <div class="dialog-footer">
  44. <!-- <el-button @click="dialogVisible = false">Cancel</el-button> -->
  45. <el-button type="primary" @click="closeDialog"> 确定 </el-button>
  46. </div>
  47. </template>
  48. </el-dialog>
  49. </div>
  50. </template>
  51. <script setup lang="ts">
  52. import { ref, reactive, watch,computed } from 'vue';
  53. import { Back } from '@element-plus/icons-vue';
  54. import { useRouter } from 'vue-router';
  55. import singleProblem from './component/singleProblem.vue';
  56. import type { FormInstance, FormRules } from 'element-plus';
  57. import useHandleStore from './useHandleStore';
  58. import { storeToRefs } from 'pinia';
  59. import { STATUS, updateFeedback } from '@/api/feedback/feedback';
  60. const useSingleStore = useHandleStore();
  61. const { singleFeedback } = storeToRefs(useSingleStore);
  62. const router = useRouter();
  63. const ruleFormRef = ref<FormInstance>();
  64. interface RuleForm {
  65. name: string;
  66. solution: string;
  67. }
  68. const ruleForm = reactive<RuleForm>({
  69. name: '',
  70. solution: '',
  71. });
  72. const rules = reactive<FormRules>({
  73. name: [{ required: true, message: '处理人不能为空', trigger: 'blur' }],
  74. });
  75. const isFormValid = computed(()=>{
  76. return Object.keys(rules).every(item => ruleForm[item].length>0)
  77. })
  78. const backList = () => {
  79. router.push('/feedback/list');
  80. };
  81. const dialogVisible = ref<boolean>(false);
  82. const subHandle = () => {
  83. if (!ruleFormRef.value) return;
  84. ruleFormRef.value.validate((valid) => {
  85. if (!valid) {
  86. return;
  87. }
  88. const subData = {
  89. id: singleFeedback.value.id,
  90. problemStatus: STATUS.handled,
  91. processorName: ruleForm.name,
  92. dealMethod: ruleForm.solution,
  93. };
  94. updateFeedback(subData).then(() => {
  95. dialogVisible.value = true;
  96. });
  97. });
  98. };
  99. const closeDialog = () => {
  100. dialogVisible.value = false;
  101. backList();
  102. };
  103. </script>
  104. <style scoped>
  105. .feedback-page {
  106. position: relative;
  107. height: calc(100vh - 64px - 12px);
  108. background-color: #ffffff;
  109. padding-top: 20px;
  110. padding-left: 20px;
  111. padding-right: 20px;
  112. }
  113. .sub-btn {
  114. margin-top: 6px;
  115. margin-left: 88px;
  116. }
  117. </style>