index.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. //
  22. open(prop) {
  23. this.visible = true;
  24. this.fetchItem(prop);
  25. },
  26. //
  27. hide() {
  28. this.visible = false;
  29. },
  30. // 查询详细
  31. async fetchItem(prop) {
  32. try {
  33. this.loading = true;
  34. const { code, msg, data } = await ITEM(prop);
  35. if (code === 200) {
  36. this.params = data;
  37. this.$notify.success({ title: msg });
  38. } else {
  39. this.$notify.warning({ title: msg });
  40. }
  41. } catch (err) {
  42. //
  43. } finally {
  44. this.loading = false;
  45. }
  46. },
  47. },
  48. created() {},
  49. mounted() {},
  50. destroyed() {},
  51. };
  52. </script>
  53. <template>
  54. <el-dialog :visible.sync="visible" title="明细">
  55. <el-descriptions :column="2" border>
  56. <el-descriptions-item
  57. v-if="params[column.key]"
  58. v-for="(column, index) in columns"
  59. :key="index"
  60. :label="column.title"
  61. >
  62. <dict-tag
  63. v-if="column.referName"
  64. :size="size"
  65. :value="params[column.key]"
  66. :options="dict.type[column.referName]"
  67. />
  68. <span v-else>{{ params[column.key] }}</span>
  69. </el-descriptions-item>
  70. </el-descriptions>
  71. </el-dialog>
  72. </template>