|
|
@ -1,174 +0,0 @@
|
|
|
|
<template>
|
|
|
|
|
|
|
|
<a-modal title="编辑配置" :width="800" :visible="visible" :confirmLoading="confirmLoading" @cancel="handleCancel">
|
|
|
|
|
|
|
|
<template slot="footer"> <span></span> </template>
|
|
|
|
|
|
|
|
<div class="model-btn-list">
|
|
|
|
|
|
|
|
<a-button type="primary" class="btn" @click="FnSave">保存</a-button>
|
|
|
|
|
|
|
|
<a-button type="primary" class="btn" @click="FnSave('Close')">保存并关闭</a-button>
|
|
|
|
|
|
|
|
<a-button type="primary" class="btn" @click="FnSave('New')">保存并新建</a-button>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<a-spin :spinning="confirmLoading">
|
|
|
|
|
|
|
|
<a-form :form="form">
|
|
|
|
|
|
|
|
<a-row>
|
|
|
|
|
|
|
|
<a-col :span="24">
|
|
|
|
|
|
|
|
<a-form-item label="字段名称" :labelCol="labelCol2" :wrapperCol="wrapperCol2" has-feedback>
|
|
|
|
|
|
|
|
<a-select
|
|
|
|
|
|
|
|
placeholder="请选择字段名称"
|
|
|
|
|
|
|
|
show-search
|
|
|
|
|
|
|
|
:default-active-first-option="false"
|
|
|
|
|
|
|
|
:show-arrow="false"
|
|
|
|
|
|
|
|
:filter-option="false"
|
|
|
|
|
|
|
|
:not-found-content="null"
|
|
|
|
|
|
|
|
@search="handleSearch"
|
|
|
|
|
|
|
|
v-decorator="['field', { rules: [{ required: true, message: '请选择字段名称!' }] }]"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<a-select-option v-for="item in FieldNameList" :key="item.code" :value="item.code">
|
|
|
|
|
|
|
|
{{ item.name }}
|
|
|
|
|
|
|
|
</a-select-option>
|
|
|
|
|
|
|
|
</a-select>
|
|
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
|
|
</a-col>
|
|
|
|
|
|
|
|
<a-col :span="24">
|
|
|
|
|
|
|
|
<a-form-item label="默认值" :labelCol="labelCol2" :wrapperCol="wrapperCol2" has-feedback>
|
|
|
|
|
|
|
|
<a-textarea
|
|
|
|
|
|
|
|
placeholder="请输入默认值"
|
|
|
|
|
|
|
|
:auto-size="{ minRows: 3, maxRows: 5 }"
|
|
|
|
|
|
|
|
v-decorator="['code', { rules: [{ required: true, message: '请输入默认值!' }] }]"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
|
|
</a-col>
|
|
|
|
|
|
|
|
<a-col :span="24">
|
|
|
|
|
|
|
|
<a-form-item label="说明" :labelCol="labelCol2" :wrapperCol="wrapperCol2" has-feedback>
|
|
|
|
|
|
|
|
<a-input placeholder="请输入说明" v-decorator="['remarks']" />
|
|
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
|
|
</a-col>
|
|
|
|
|
|
|
|
</a-row>
|
|
|
|
|
|
|
|
</a-form>
|
|
|
|
|
|
|
|
</a-spin>
|
|
|
|
|
|
|
|
</a-modal>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
import { BookingOrderGetFieldName, DjyTenantConfigSave } from '@/api/modular/main/DjyTenantConfig'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
|
|
data() {
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
FieldNameList: [],
|
|
|
|
|
|
|
|
FieldNameList2: [],
|
|
|
|
|
|
|
|
labelCol2: {
|
|
|
|
|
|
|
|
xs: { span: 24 },
|
|
|
|
|
|
|
|
sm: { span: 3 }
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
wrapperCol2: {
|
|
|
|
|
|
|
|
xs: { span: 24 },
|
|
|
|
|
|
|
|
sm: { span: 20 }
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
visible: false,
|
|
|
|
|
|
|
|
confirmLoading: false,
|
|
|
|
|
|
|
|
form: this.$form.createForm(this),
|
|
|
|
|
|
|
|
data: []
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
// 初始化方法
|
|
|
|
|
|
|
|
edit(record, loadData) {
|
|
|
|
|
|
|
|
console.log(record)
|
|
|
|
|
|
|
|
this.data = loadData
|
|
|
|
|
|
|
|
this.visible = true
|
|
|
|
|
|
|
|
BookingOrderGetFieldName().then(res => {
|
|
|
|
|
|
|
|
let FieldNameList = []
|
|
|
|
|
|
|
|
Object.keys(res.data[0]).forEach(item => {
|
|
|
|
|
|
|
|
FieldNameList.push({
|
|
|
|
|
|
|
|
code: item,
|
|
|
|
|
|
|
|
name: res.data[0][item]
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
this.FieldNameList = FieldNameList
|
|
|
|
|
|
|
|
this.FieldNameList2 = FieldNameList
|
|
|
|
|
|
|
|
console.log(this.FieldNameList)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
this.form.setFieldsValue({
|
|
|
|
|
|
|
|
field: record.field,
|
|
|
|
|
|
|
|
code: record.code,
|
|
|
|
|
|
|
|
remarks: record.remarks
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
console.log(this.form.getFieldsValue())
|
|
|
|
|
|
|
|
}, 100)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
handleSearch(value) {
|
|
|
|
|
|
|
|
console.log(value)
|
|
|
|
|
|
|
|
let Rdata = []
|
|
|
|
|
|
|
|
if (value) {
|
|
|
|
|
|
|
|
this.FieldNameList2.forEach(item => {
|
|
|
|
|
|
|
|
if (item.name.indexOf(value) > -1) {
|
|
|
|
|
|
|
|
Rdata.push(item)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Rdata = this.FieldNameList2
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.FieldNameList = Rdata
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FnSave(type) {
|
|
|
|
|
|
|
|
const {
|
|
|
|
|
|
|
|
form: { validateFields }
|
|
|
|
|
|
|
|
} = this
|
|
|
|
|
|
|
|
this.confirmLoading = true
|
|
|
|
|
|
|
|
validateFields((errors, values) => {
|
|
|
|
|
|
|
|
if (!errors) {
|
|
|
|
|
|
|
|
this.FieldNameList2.forEach(item => {
|
|
|
|
|
|
|
|
if (item.code == values.field) {
|
|
|
|
|
|
|
|
values.fieldName = item.name
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
let configJson = []
|
|
|
|
|
|
|
|
this.data.forEach((item, index) => {
|
|
|
|
|
|
|
|
if (item.field == values.field) {
|
|
|
|
|
|
|
|
this.data[index] = values
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
configJson = [...this.data]
|
|
|
|
|
|
|
|
let data = { type: 'booking_default_value', configJson: JSON.stringify(configJson) }
|
|
|
|
|
|
|
|
DjyTenantConfigSave(data)
|
|
|
|
|
|
|
|
.then(res => {
|
|
|
|
|
|
|
|
if (res.success) {
|
|
|
|
|
|
|
|
this.$message.success('编辑成功')
|
|
|
|
|
|
|
|
this.confirmLoading = false
|
|
|
|
|
|
|
|
this.$emit('ok', values)
|
|
|
|
|
|
|
|
if (type == 'Close') {
|
|
|
|
|
|
|
|
this.handleCancel()
|
|
|
|
|
|
|
|
} else if (type == 'New') {
|
|
|
|
|
|
|
|
this.form.resetFields()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.$message.error(`编辑失败,${res.message}`)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.finally(res => {
|
|
|
|
|
|
|
|
this.confirmLoading = false
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.confirmLoading = false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
handleCancel() {
|
|
|
|
|
|
|
|
this.form.resetFields()
|
|
|
|
|
|
|
|
this.visible = false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
|
|
|
.model-btn-list {
|
|
|
|
|
|
|
|
margin-bottom: 15px;
|
|
|
|
|
|
|
|
.btn {
|
|
|
|
|
|
|
|
margin-right: 6px;
|
|
|
|
|
|
|
|
&.ant-btn-primary {
|
|
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|