index.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <script>
  2. import { TableColumns as Columns } from "../column";
  3. import { ITEM } from "@/api/business/purchase/task";
  4. import { initDicts, initParams } from "@/utils/init";
  5. export default {
  6. name: "SeeDialog",
  7. dicts: initDicts(Columns),
  8. components: {},
  9. data() {
  10. return {
  11. size: "mini",
  12. visible: false,
  13. loading: false,
  14. columns: Columns,
  15. params: initParams(Columns),
  16. };
  17. },
  18. computed: {},
  19. watch: {},
  20. methods: {
  21. setVisible(prop) {
  22. this.visible = prop;
  23. },
  24. // 查询详细
  25. async beforeOpenDoSome(prop) {
  26. try {
  27. this.loading = true;
  28. const { code, msg, data } = await ITEM(prop);
  29. if (code === 200) {
  30. this.params = data;
  31. this.$notify.success({ title: msg });
  32. } else {
  33. this.$notify.warning({ title: msg });
  34. }
  35. } catch (err) {
  36. //
  37. } finally {
  38. this.loading = false;
  39. }
  40. },
  41. },
  42. created() {},
  43. mounted() {},
  44. destroyed() {},
  45. };
  46. </script>
  47. <template>
  48. <el-dialog
  49. :visible.sync="visible"
  50. title="明细"
  51. append-to-body
  52. destroy-on-close
  53. >
  54. <el-descriptions :column="2" border>
  55. <el-descriptions-item
  56. v-if="params[column.key]"
  57. v-for="(column, index) in columns"
  58. :key="index"
  59. :label="column.title"
  60. >
  61. <dict-tag
  62. v-if="column.referName"
  63. :size="size"
  64. :value="params[column.key]"
  65. :options="dict.type[column.referName]"
  66. />
  67. <span v-else>{{ params[column.key] }}</span>
  68. </el-descriptions-item>
  69. </el-descriptions>
  70. </el-dialog>
  71. </template>