feat(customform): 动态表单接入

duizhaopin_ui
duan 2 years ago
parent 10428072c2
commit f6e876f551

@ -23,3 +23,11 @@ export function del(data) {
data
})
}
export function get_use(data) {
return request({
url: '/api/drug_form/get_use',
method: 'get',
data
})
}

@ -1,7 +1,7 @@
<template>
<div>
<el-row :gutter="15">
<el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="70px">
<el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="80px">
<el-col :span="24">
<el-form-item label="试剂名称" prop="name">
<el-input v-model="formData.name" placeholder="请输入试剂名称" clearable :style="{width: '100%'}" />
@ -110,6 +110,11 @@
<el-input v-model="formData.total" placeholder="请输入预估质量" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col v-for="item in extra_form" :key="item.id" :span="12">
<el-form-item :label="item.name" :prop="item.name">
<el-input v-model="formData[item.name]" :placeholder="'请输入' + item.name " clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
</el-form>
</el-row>
<div style="text-align: center">
@ -119,6 +124,7 @@
</template>
<script>
import { throttle } from '@/utils'
import { get_use } from '@/api/reagent/customform'
export default {
name: 'ReagentForm',
// title dialog title
@ -165,7 +171,8 @@ export default {
trigger: 'blur'
}],
total: []
}
},
extra_form: []
}
},
watch: {
@ -177,6 +184,11 @@ export default {
immediate: true
}
},
created() {
get_use().then(res => {
this.extra_form = res.data
})
},
methods: {
handleConfirm: throttle(function() {
this.$refs['elForm'].validate(valid => {

@ -22,6 +22,7 @@
</div>
</div>
<el-table
ref="table"
v-loading="loading"
:data="tableData"
stripe
@ -138,6 +139,15 @@
label="最后使用人"
align="center"
/>
<el-table-column
v-for="item in extra_form"
:key="item.id"
align="center"
:prop="item.name"
:label="item.name"
width="100"
show-overflow-tooltip
/>
</el-table>
<div class="my-pagination" style="text-align: center">
<el-pagination
@ -347,6 +357,11 @@
<!-- <el-switch v-model="formData.is_weigh" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col v-for="item in extra_form" :key="item.id" :span="12">
<el-form-item :label="item.name" :prop="item.name">
<el-input v-model="formData[item.name]" :placeholder="'请输入' + item.name " clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
</el-form>
</el-row>
<div style="text-align: center">
@ -370,6 +385,7 @@ import {
set_drug_empty_bottle
} from '@/api/reagent/management'
import stringify from '@/utils/stringify'
import { get_use } from '@/api/reagent/customform'
export default {
name: 'Management',
mixins: [getClients],
@ -386,7 +402,7 @@ export default {
name: null,
multipleSelection: [],
tableData: [],
loading: false,
loading: true,
//
dialogHistoryVisible: false,
loadingHistory: false,
@ -479,11 +495,15 @@ export default {
// is_supervise: [],
// is_weigh: []
},
dialogEditVisible: false
dialogEditVisible: false,
extra_form: []
}
},
created() {
get_use().then(res => {
this.extra_form = res.data
this.getList()
})
},
methods: {
//
@ -498,7 +518,7 @@ export default {
drug_list(stringify(data)).then(res => {
this.tableData = res.data.data
this.total = res.data.total_count
}).finally(() => { this.loading = false })
}).finally(() => { this.$refs['table'].doLayout(); this.loading = false })
},
//

Loading…
Cancel
Save