index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <script>
  2. import { TableColumns as Columns } from "../column";
  3. import { item } from "@/api/business/purchase/task";
  4. import { initColumns, initDicts, initRules, initParams } from "@/utils/init";
  5. const NewColumns = initColumns(Columns);
  6. export default {
  7. name: "SeeDrawer",
  8. dicts: initDicts(NewColumns),
  9. components: {
  10. DrInputDialog: () => import("@/components/input-dialog/index.vue"),
  11. },
  12. data() {
  13. return {
  14. size: "mini",
  15. visible: false,
  16. loading: false,
  17. columns: NewColumns,
  18. rules: initRules(NewColumns),
  19. params: initParams(NewColumns),
  20. };
  21. },
  22. computed: {},
  23. watch: {},
  24. methods: {
  25. setVisible(prop) {
  26. this.visible = prop;
  27. },
  28. // 查询详细
  29. async fetchItem(prop) {
  30. try {
  31. this.loading = true;
  32. const { code, msg, data } = await item(prop);
  33. if (code === 200) {
  34. this.params = data;
  35. this.$notify.success({ title: msg });
  36. } else {
  37. this.$notify.warning({ title: msg });
  38. }
  39. } catch (err) {
  40. this.$notify.error({ title: "error", message: err });
  41. } finally {
  42. this.loading = false;
  43. }
  44. },
  45. // 取消
  46. handleCancel() {
  47. this.setVisible(false);
  48. this.params = initParams(this.columns, "key", "value");
  49. },
  50. // 保存
  51. handleSava() {
  52. this.setVisible(false);
  53. },
  54. },
  55. created() {
  56. console.log("ADD CREATED");
  57. },
  58. mounted() {},
  59. destroyed() {},
  60. };
  61. </script>
  62. <template>
  63. <el-drawer
  64. direction="btt"
  65. size="100%"
  66. :with-header="false"
  67. :visible.sync="visible"
  68. >
  69. <el-form
  70. v-loading="loading"
  71. :size="size"
  72. label-position="right"
  73. label-width="135px"
  74. :model="params"
  75. :rules="rules"
  76. >
  77. <el-card
  78. :body-style="{
  79. padding: '20px',
  80. display: 'flex',
  81. 'flex-wrap': 'wrap',
  82. }"
  83. style="margin: 10px"
  84. >
  85. <div
  86. slot="header"
  87. style="
  88. display: flex;
  89. justify-content: space-between;
  90. align-items: center;
  91. "
  92. >
  93. <h3>查 看</h3>
  94. <div style="text-align: right">
  95. <el-button :size="size" @click="handleCancel">取 消</el-button>
  96. </div>
  97. </div>
  98. <el-row>
  99. <el-col
  100. v-for="(column, index) in columns"
  101. :key="index"
  102. :span="column.span || 6"
  103. >
  104. <el-form-item :prop="column.key" :label="column.title">
  105. {{ params[column.key] }}
  106. </el-form-item>
  107. </el-col>
  108. </el-row>
  109. </el-card>
  110. </el-form>
  111. </el-drawer>
  112. </template>