index.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. this.$notify.error({ title: "error", message: err });
  37. } finally {
  38. this.loading = false;
  39. }
  40. },
  41. },
  42. created() {},
  43. mounted() {},
  44. destroyed() {},
  45. };
  46. </script>
  47. <template>
  48. <el-dialog :visible.sync="visible">
  49. <el-descriptions :column="2" title="明细" border>
  50. <el-descriptions-item
  51. v-if="params[column.key]"
  52. v-for="(column, index) in columns"
  53. :key="index"
  54. :label="column.title"
  55. >
  56. <dict-tag
  57. v-if="column.referName"
  58. :size="size"
  59. :value="params[column.key]"
  60. :options="dict.type[column.referName]"
  61. />
  62. <span v-else>{{ params[column.key] }}</span>
  63. </el-descriptions-item>
  64. </el-descriptions>
  65. </el-dialog>
  66. </template>