feat(customform): 动态表单接入

duizhaopin_ui
duan 2 years ago
parent 10428072c2
commit f6e876f551

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

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

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

Loading…
Cancel
Save