|
|
@@ -0,0 +1,182 @@
|
|
|
+<template>
|
|
|
+ <a-button type="primary" @click="showDrawer" :disabled="disabled">编辑</a-button>
|
|
|
+ <a-drawer
|
|
|
+ v-model:open="visible"
|
|
|
+ class="custom-class"
|
|
|
+ title="编辑费用订制方案"
|
|
|
+ placement="right"
|
|
|
+ width="600"
|
|
|
+ :closable="false"
|
|
|
+ @close="onClose">
|
|
|
+ <a-form ref="formRef" :model="form" layout="vertical">
|
|
|
+ <a-row :gutter="16">
|
|
|
+ <template v-for="(item) in data">
|
|
|
+ <a-col :span="12" v-if="item.param == 'apportiontype'">
|
|
|
+ <a-form-item :label="item.paramname" :name="item.paramname" :rules="[{ required: true, message:item }]">
|
|
|
+ <a-select v-model:value="form[item.paramname]">
|
|
|
+ <a-select-option v-for="(cash,cashi) in cashbillrectype" :key="cashi" :value="cash.value">{{ cash.remarks }}</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12" v-if="item.param == 'value'">
|
|
|
+ <a-form-item :label="item.paramname" :name="item.paramname" :rules="[{ required: true,validator: checkNumber,message:item }]">
|
|
|
+ <a-input-group>
|
|
|
+ <a-input v-model:value="form[item.paramname]" style="width: 60%" />
|
|
|
+ <a-select v-model:value="form['满足条件']" style="width:100px">
|
|
|
+ <a-select-option v-for="(cond,condi) in condition" :key="condi" :value="cond.value">{{ cond.remarks }}</a-select-option>
|
|
|
+ <a-select-option value="Jiangsu">Jiangsu</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-input-group>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12" v-if="item.param == 'itemfield'">
|
|
|
+ <a-form-item :label="item.paramname" :name="item.paramname" :rules="[{ required: true, message:item }]">
|
|
|
+ <a-select v-model:value="form[item.paramname]">
|
|
|
+ <a-select-option v-for="(field,fieldi) in itemfield" :key="fieldi" :value="field.value">{{ field.remarks }}</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12" v-if="item.param == 'unitfee'">
|
|
|
+ <a-form-item :label="item.paramname" :name="item.paramname" :rules="[{ required: true,validator: checkNumber,message:item }]">
|
|
|
+ <a-input v-model:value="form[item.paramname]" style="width: 100%" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12" v-if="item.param == 'isreturn'">
|
|
|
+ <a-form-item :label="item.paramname" :name="item.paramname" :rules="[{ required: true,message:item }]">
|
|
|
+ <a-radio-group v-model:value="form[item.paramname]">
|
|
|
+ <a-radio value="1">是</a-radio>
|
|
|
+ <a-radio value="0">否</a-radio>
|
|
|
+ </a-radio-group>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12" v-if="item.param == 'ispay'">
|
|
|
+ <a-form-item :label="item.paramname" :name="item.paramname" :rules="[{ required: true,message:item }]">
|
|
|
+ <a-radio-group v-model:value="form[item.paramname]">
|
|
|
+ <a-radio value="1">是</a-radio>
|
|
|
+ <a-radio value="0">否</a-radio>
|
|
|
+ </a-radio-group>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12" v-if="item.param == 'isaccumulation'">
|
|
|
+ <a-form-item :label="item.paramname" :name="item.paramname" :rules="[{ required: true,message:item }]">
|
|
|
+ <a-radio-group v-model:value="form[item.paramname]">
|
|
|
+ <a-radio value="1">是</a-radio>
|
|
|
+ <a-radio value="0">否</a-radio>
|
|
|
+ </a-radio-group>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12" v-if="item.param == 'iscombination'">
|
|
|
+ <a-form-item :label="item.paramname" :name="item.paramname" :rules="[{ required: true,message:item }]">
|
|
|
+ <a-radio-group v-model:value="form[item.paramname]">
|
|
|
+ <a-radio value="1">是</a-radio>
|
|
|
+ <a-radio value="0">否</a-radio>
|
|
|
+ </a-radio-group>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12" v-if="item.param == 'ordertype'">
|
|
|
+ <a-form-item :label="item.paramname" :name="item.paramname" :rules="[{ required: true, message:item }]">
|
|
|
+ <a-select v-model:value="form[item.paramname]">
|
|
|
+ <a-select-option v-for="(order,orderi) in ordertype" :key="orderi" :value="order.value">{{ order.value }}</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ </template>
|
|
|
+
|
|
|
+
|
|
|
+ </a-row>
|
|
|
+ </a-form>
|
|
|
+ <template #extra>
|
|
|
+ <a-space>
|
|
|
+ <a-button @click="onClose">关闭</a-button>
|
|
|
+ <a-button type="primary" @click="submit">保存</a-button>
|
|
|
+ </a-space>
|
|
|
+ </template>
|
|
|
+ </a-drawer>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import {ref,defineEmits,defineProps,defineExpose, onMounted} from 'vue'
|
|
|
+import {PlusOutlined} from '@ant-design/icons-vue';
|
|
|
+import Api from '@/api/api'
|
|
|
+import utils from '@/utils/utils'
|
|
|
+const emit = defineEmits(['onSuccess'])
|
|
|
+const props = defineProps(['data','disabled'])
|
|
|
+const visible = ref(false)
|
|
|
+let form = ref({})
|
|
|
+const showDrawer = ()=>{
|
|
|
+ props.data.forEach(item => {
|
|
|
+ form.value[item.paramname] = item.value
|
|
|
+ })
|
|
|
+ console.log(form.value,'参数',props.data);
|
|
|
+ visible.value = true
|
|
|
+}
|
|
|
+const onClose = () => {
|
|
|
+ visible.value = false;
|
|
|
+ formRef.value.resetFields();
|
|
|
+};
|
|
|
+const formRef = ref()
|
|
|
+
|
|
|
+const checkNumber = async (_rule, value) => {
|
|
|
+ if (value === '' || value == null) {
|
|
|
+ return Promise.reject('该输入项不能为空');
|
|
|
+ } else if(value <=0){
|
|
|
+ return Promise.reject('输的的值必须大于0');
|
|
|
+ } else {
|
|
|
+ return Promise.resolve();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const submit = async ()=>{
|
|
|
+ try {
|
|
|
+ const values = await formRef.value.validateFields();
|
|
|
+ let items = []
|
|
|
+ Object.keys(form.value).forEach((item,index) => {
|
|
|
+ items[index] = {
|
|
|
+ sys_datafunction_paramsid:props.data.filter(item2 => item2.paramname == item)[0].sys_datafunction_paramsid,
|
|
|
+ value:form.value[item],
|
|
|
+ }
|
|
|
+ })
|
|
|
+ const res = await Api.requested({
|
|
|
+ "content": {
|
|
|
+ "items": items
|
|
|
+ },
|
|
|
+ "id": 20231211141802,
|
|
|
+ })
|
|
|
+ utils.message(res,'操作成功',()=>{
|
|
|
+ emit('onSuccess')
|
|
|
+ visible.value = false
|
|
|
+ })
|
|
|
+ } catch (errorInfo) {
|
|
|
+ console.log('Failed:', errorInfo);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+let cashbillrectype = ref('')
|
|
|
+let itemfield = ref('')
|
|
|
+let condition = ref('')
|
|
|
+let ordertype = ref('')
|
|
|
+
|
|
|
+onMounted(async () => {
|
|
|
+ const res = await Api.optionstype('apportiontype')
|
|
|
+ cashbillrectype.value = res.data
|
|
|
+ console.log(cashbillrectype.value,'分摊方式');
|
|
|
+
|
|
|
+ const res1 = await Api.optionstype('itemfield')
|
|
|
+ itemfield.value = res1.data
|
|
|
+ console.log(itemfield.value,'计算依据');
|
|
|
+
|
|
|
+ const res2 = await Api.optionstype('condition')
|
|
|
+ condition.value = res2.data
|
|
|
+ console.log(condition.value,'满足条件');
|
|
|
+
|
|
|
+ const res3 = await Api.optionstype('ordertype')
|
|
|
+ ordertype.value = res3.data
|
|
|
+ console.log(ordertype.value,'订单类型');
|
|
|
+})
|
|
|
+
|
|
|
+defineExpose({
|
|
|
+ visible
|
|
|
+})
|
|
|
+</script>
|
|
|
+<style>
|
|
|
+</style>
|