info2.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <div>
  3. <div class="padding top flex flex-center flex-justify-between">
  4. <span>入库智能预警</span>
  5. <div class="flex flex-center grey-6">
  6. <el-icon><InfoFilled /></el-icon>
  7. <span class="ml-5">可以根据文件名在入库附件清单中,进行查看</span>
  8. </div>
  9. </div>
  10. <div class="padding-left padding-right" style="padding: 20px">
  11. <avue-crud
  12. :option="option"
  13. :data="active === 1 ? data : data2"
  14. ref="crud"
  15. v-model="form"
  16. :before-open="beforeOpen"
  17. >
  18. <template #menu-left>
  19. <div class="flex flex-center flex-justify-start padding-left">
  20. <el-button type="primary" :plain="active === 2" @click="change(1)"
  21. >系统问题预警</el-button
  22. >
  23. <el-button type="primary" :plain="active === 1" @click="change(2)"
  24. >项目预审问题</el-button
  25. >
  26. </div>
  27. </template>
  28. <template #menu-right>
  29. <el-button
  30. type="primary"
  31. plain
  32. v-if="user.info.viewStage === 1"
  33. @click="show = true"
  34. >新 增
  35. </el-button>
  36. </template>
  37. <template #isFixed="{ row }">
  38. <div>
  39. <el-tag v-if="row.isFixed === 0">未处理</el-tag>
  40. <el-tag v-else-if="row.warnStatus === 1">已解决</el-tag>
  41. <el-tag v-else-if="row.warnStatus === 2">已忽略</el-tag>
  42. </div>
  43. </template>
  44. </avue-crud>
  45. </div>
  46. <el-dialog v-model="show" title="新增预审问题" width="800px">
  47. <div>
  48. <el-input type="textarea" rows="5" v-model="problem"></el-input>
  49. <div class="full-width flex flex-justify-end mt-20">
  50. <el-button plain type="primary" @click="show = false"
  51. >取 消
  52. </el-button>
  53. <el-button type="primary" @click="addIssue">确 定</el-button>
  54. </div>
  55. </div>
  56. </el-dialog>
  57. </div>
  58. </template>
  59. <script>
  60. import { useStore } from '@/store/user.js'
  61. export default {
  62. setup() {
  63. const user = useStore()
  64. return { user }
  65. },
  66. props: {
  67. info: {
  68. type: Object,
  69. default: null
  70. }
  71. },
  72. data() {
  73. return {
  74. active: 1,
  75. problem: '',
  76. show: false,
  77. form: {},
  78. data: [],
  79. data2: [],
  80. option: {
  81. align: 'center',
  82. menuAlign: 'center',
  83. menuWidth: 180,
  84. height: 525,
  85. size: 'mini',
  86. delBtn: false,
  87. viewBtn: true,
  88. addBtn: false,
  89. editBtnText: '解决',
  90. viewBtnText: '忽略',
  91. refreshBtn: false,
  92. columnBtn: false,
  93. labelWidth: 140,
  94. border: true,
  95. column: [
  96. {
  97. label: '存在问题描述',
  98. prop: 'content'
  99. },
  100. {
  101. label: '文件名称',
  102. prop: 'fileName'
  103. },
  104. {
  105. label: '状态',
  106. prop: 'isFixed',
  107. width: 100,
  108. slot: true
  109. },
  110. {
  111. label: '创建实际',
  112. prop: 'createTime'
  113. }
  114. ]
  115. }
  116. }
  117. },
  118. created() {
  119. this.pid = this.$route.query.id
  120. this.onLoad()
  121. },
  122. methods: {
  123. addIssue() {
  124. if (this.problem.length === 0) {
  125. this.$message.error('请输入预审问题描述')
  126. return
  127. }
  128. this.$api.store
  129. .addIssue({
  130. projectId: this.info.projectId,
  131. content: this.problem,
  132. type: 2,
  133. preId: this.pid,
  134. fileId: ''
  135. })
  136. .then(res => {
  137. if (res.code === 200) {
  138. this.show = false
  139. this.$message.success(res.msg)
  140. this.onLoad()
  141. } else {
  142. this.$message.error(res.msg)
  143. }
  144. })
  145. },
  146. onLoad() {
  147. this.$api.store.fileList({ id: this.pid }).then(res => {
  148. if (res.code === 200 && res.data.files.length > 0) {
  149. this.data = res.data.warnings.filter(ele => ele.type === 1)
  150. this.data2 = res.data.warnings.filter(ele => ele.type === 2)
  151. }
  152. })
  153. },
  154. beforeOpen(done, type) {
  155. this.$api.store
  156. .changeWarn({ id: this.form.id, type: type === 'view' ? 2 : 1 })
  157. .then(res => {
  158. if (res.code === 200) {
  159. this.$message.success(res.msg)
  160. this.onLoad()
  161. } else {
  162. this.$message.error(res.msg)
  163. }
  164. })
  165. },
  166. change(index) {
  167. this.active = index
  168. this.option.column[1].hide = false
  169. if (index === 2) {
  170. this.option.column[1].hide = true
  171. }
  172. }
  173. }
  174. }
  175. </script>
  176. <style lang="scss" scoped>
  177. .top {
  178. height: 35px;
  179. border-radius: var(--el-card-border-radius);
  180. background-color: #f5f5f3;
  181. }
  182. </style>