123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <script>
- import { TableColumns as Columns } from "../column";
- import { item } from "@/api/business/purchase/task";
- import { initColumns, initDicts, initRules, initParams } from "@/utils/init";
- const NewColumns = initColumns(Columns);
- export default {
- name: "SeeDrawer",
- dicts: initDicts(NewColumns),
- components: {
- DrInputDialog: () => import("@/components/input-dialog/index.vue"),
- },
- data() {
- return {
- size: "mini",
- visible: false,
- loading: false,
- columns: NewColumns,
- rules: initRules(NewColumns),
- params: initParams(NewColumns),
- };
- },
- computed: {},
- watch: {},
- methods: {
- setVisible(prop) {
- this.visible = prop;
- },
- // 查询详细
- async fetchItem(prop) {
- try {
- this.loading = true;
- const { code, msg, data } = await item(prop);
- if (code === 200) {
- this.params = data;
- this.$notify.success({ title: msg });
- } else {
- this.$notify.warning({ title: msg });
- }
- } catch (err) {
- this.$notify.error({ title: "error", message: err });
- } finally {
- this.loading = false;
- }
- },
- // 取消
- handleCancel() {
- this.setVisible(false);
- this.params = initParams(this.columns, "key", "value");
- },
- // 保存
- handleSava() {
- this.setVisible(false);
- },
- },
- created() {
- console.log("ADD CREATED");
- },
- mounted() {},
- destroyed() {},
- };
- </script>
- <template>
- <el-drawer
- direction="btt"
- size="100%"
- :with-header="false"
- :visible.sync="visible"
- >
- <el-form
- v-loading="loading"
- :size="size"
- label-position="right"
- label-width="135px"
- :model="params"
- :rules="rules"
- >
- <el-card
- :body-style="{
- padding: '20px',
- display: 'flex',
- 'flex-wrap': 'wrap',
- }"
- style="margin: 10px"
- >
- <div
- slot="header"
- style="
- display: flex;
- justify-content: space-between;
- align-items: center;
- "
- >
- <h3>查 看</h3>
- <div style="text-align: right">
- <el-button :size="size" @click="handleCancel">取 消</el-button>
- </div>
- </div>
- <el-row>
- <el-col
- v-for="(column, index) in columns"
- :key="index"
- :span="column.span || 6"
- >
- <el-form-item :prop="column.key" :label="column.title">
- {{ params[column.key] }}
- </el-form-item>
- </el-col>
- </el-row>
- </el-card>
- </el-form>
- </el-drawer>
- </template>
|