|
|
|
@ -0,0 +1,172 @@
|
|
|
|
|
<template>
|
|
|
|
|
<a-modal
|
|
|
|
|
title="参数选项"
|
|
|
|
|
:width="1100"
|
|
|
|
|
:visible="visible"
|
|
|
|
|
:confirmLoading="confirmLoading"
|
|
|
|
|
@ok="handleSubmit"
|
|
|
|
|
@cancel="handleCancel"
|
|
|
|
|
>
|
|
|
|
|
<template slot="footer"> </template>
|
|
|
|
|
<a-spin :spinning="confirmLoading">
|
|
|
|
|
<vxe-toolbar>
|
|
|
|
|
<template #buttons>
|
|
|
|
|
<vxe-button icon="vxe-icon-square-plus" @click="insertEvent()">新增</vxe-button>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-toolbar>
|
|
|
|
|
<vxe-table
|
|
|
|
|
border
|
|
|
|
|
resizable
|
|
|
|
|
show-overflow
|
|
|
|
|
ref="xTable"
|
|
|
|
|
height="500"
|
|
|
|
|
:row-config="{ isHover: true }"
|
|
|
|
|
:data="tableData"
|
|
|
|
|
@cell-dblclick="cellDBLClickEvent"
|
|
|
|
|
>
|
|
|
|
|
<vxe-column type="seq" width="60"></vxe-column>
|
|
|
|
|
<vxe-column field="name" title="Name"></vxe-column>
|
|
|
|
|
<vxe-column field="sex" title="Sex" :formatter="formatterSex"></vxe-column>
|
|
|
|
|
<vxe-column field="age" title="Age"></vxe-column>
|
|
|
|
|
<vxe-column field="address" title="Address" show-overflow></vxe-column>
|
|
|
|
|
<vxe-column title="操作" width="100" show-overflow>
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<vxe-button type="text" icon="vxe-icon-edit" @click="editEvent(row)"></vxe-button>
|
|
|
|
|
<vxe-button type="text" icon="vxe-icon-delete" @click="removeEvent(row)"></vxe-button>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
</vxe-table>
|
|
|
|
|
</a-spin>
|
|
|
|
|
</a-modal>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { DJYTenantParamGetParamItem, DJYTenantParamEdit } from '@/api/modular/main/DJYTenantParam'
|
|
|
|
|
import { sysDictDataPage } from '@/api/modular/system/dictDataManage'
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
TypeData: [],
|
|
|
|
|
labelCol: {
|
|
|
|
|
xs: { span: 24 },
|
|
|
|
|
sm: { span: 7 }
|
|
|
|
|
},
|
|
|
|
|
wrapperCol: {
|
|
|
|
|
xs: { span: 24 },
|
|
|
|
|
sm: { span: 15 }
|
|
|
|
|
},
|
|
|
|
|
labelCol2: {
|
|
|
|
|
xs: { span: 24 },
|
|
|
|
|
sm: { span: 3 }
|
|
|
|
|
},
|
|
|
|
|
wrapperCol2: {
|
|
|
|
|
xs: { span: 24 },
|
|
|
|
|
sm: { span: 21 }
|
|
|
|
|
},
|
|
|
|
|
typeData: [],
|
|
|
|
|
visible: false,
|
|
|
|
|
confirmLoading: false,
|
|
|
|
|
form: this.$form.createForm(this),
|
|
|
|
|
data: {},
|
|
|
|
|
tableData: []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
// sysDictDataPage({ pageNo: 1, pageSize: 999, typeId: '349716496130117' }).then(res => {
|
|
|
|
|
// this.TypeData = res.data.rows
|
|
|
|
|
// console.log(this.TypeData)
|
|
|
|
|
// })
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
async insertEvent(row) {
|
|
|
|
|
const $table = this.$refs.xTable
|
|
|
|
|
const record = {
|
|
|
|
|
itemName: '',
|
|
|
|
|
remark: ''
|
|
|
|
|
}
|
|
|
|
|
const { row: newRow } = await $table.insertAt(record, row)
|
|
|
|
|
await $table.setActiveCell(newRow, 'name')
|
|
|
|
|
},
|
|
|
|
|
editRowEvent(row) {
|
|
|
|
|
const $table = this.$refs.xTable
|
|
|
|
|
$table.setActiveRow(row)
|
|
|
|
|
},
|
|
|
|
|
cancelRowEvent(row) {
|
|
|
|
|
const $table = this.$refs.xTable
|
|
|
|
|
$table.clearActived().then(() => {
|
|
|
|
|
// 还原行数据
|
|
|
|
|
$table.revertData(row)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
saveRowEvent() {
|
|
|
|
|
const $table = this.$refs.xTable
|
|
|
|
|
$table.clearActived().then(() => {
|
|
|
|
|
this.loading = true
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.loading = false
|
|
|
|
|
VXETable.modal.message({ content: '保存成功!', status: 'success' })
|
|
|
|
|
}, 300)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 初始化方法
|
|
|
|
|
edit(record) {
|
|
|
|
|
this.data = record
|
|
|
|
|
console.log(record)
|
|
|
|
|
DJYTenantParamGetParamItem({ paraCode: record.paraCode }).then(res => {
|
|
|
|
|
this.tableData = res.data
|
|
|
|
|
})
|
|
|
|
|
this.visible = true
|
|
|
|
|
// const typeOption = this.$options
|
|
|
|
|
// this.typeData = typeOption.filters['dictData']('edi_type')
|
|
|
|
|
// setTimeout(() => {
|
|
|
|
|
// this.form.setFieldsValue({
|
|
|
|
|
// paraName: record.paraName,
|
|
|
|
|
// paraCode: record.paraCode,
|
|
|
|
|
// remark: record.remark
|
|
|
|
|
// })
|
|
|
|
|
// console.log(this.form.getFieldsValue())
|
|
|
|
|
// }, 100)
|
|
|
|
|
},
|
|
|
|
|
handleSubmit() {
|
|
|
|
|
const {
|
|
|
|
|
form: { validateFields }
|
|
|
|
|
} = this
|
|
|
|
|
this.confirmLoading = true
|
|
|
|
|
validateFields((errors, values) => {
|
|
|
|
|
console.log(errors, values)
|
|
|
|
|
if (!errors) {
|
|
|
|
|
for (const key in values) {
|
|
|
|
|
console.log(key, 1)
|
|
|
|
|
if (typeof values[key] === 'object' && !(values[key] === null)) {
|
|
|
|
|
values[key] = JSON.stringify(values[key])
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
console.log(this.form, values.id)
|
|
|
|
|
values.id = this.data.id
|
|
|
|
|
console.log(values)
|
|
|
|
|
DJYTenantParamEdit(values)
|
|
|
|
|
.then(res => {
|
|
|
|
|
if (res.success) {
|
|
|
|
|
this.$message.success('编辑成功')
|
|
|
|
|
this.confirmLoading = false
|
|
|
|
|
this.$emit('ok', values)
|
|
|
|
|
this.handleCancel()
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(`编辑失败,${res.message}`)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.finally(res => {
|
|
|
|
|
this.confirmLoading = false
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.confirmLoading = false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleCancel() {
|
|
|
|
|
this.form.resetFields()
|
|
|
|
|
this.visible = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|