Skip to content

Commit

Permalink
修复bug
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Mar 4, 2019
1 parent f61c90f commit a589124
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 44 deletions.
71 changes: 28 additions & 43 deletions src/components/CrudTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
* 基于CommonTable以及CommonToolbar二次封装一个增删改查table
-->
<template>
<div
id="crud_table"
class="widget-box">

<div id="crud_table" class="widget-box">
<common-tool-bar
:option-json ="jsonData.config.columnList"
:search-arr ="listQuery.searchArr"
@addEvent ="New"
@searchEvent ="Refresh"
@clearEvent ="Clear"
:option-json="jsonData.config.columnList"
:search-arr="listQuery.searchArr"
@addEvent="New"
@searchEvent="Refresh"
@clearEvent="Clear"
:toolbarButton="toolbarButton"
/>

Expand All @@ -31,48 +28,36 @@
:handleButton="handleButton"
/>


<el-dialog
:title="textMap[dialogStatus]"
:visible.sync="dialogFormVisible"
v-if="dialogFormVisible"
width="80%">
width="80%"
>
<generate-form
ref="generateForm"
:data="jsonData"
:value="entity"
:entity.sync="models"
:disabled="handleButton.includes('detail')"
/>

<div
slot="footer"
class="dialog-footer">
<div slot="footer" class="dialog-footer">
<template v-if="dialogStatus === 'detail'">
<v-btn @click="dialogFormVisible = false" color="white">关 闭</v-btn>

<v-btn @click="dialogFormVisible = false" color="white">关 闭</v-btn>
</template>

<template v-else>
<v-btn @click="dialogFormVisible = false" color="white">取 消</v-btn>
<v-btn
v-if="dialogStatus=='create'"
color="blue"
@click="create">新 增</v-btn>
<v-btn
v-else
color="blue"
@click="update">修 改</v-btn>
<v-btn @click="dialogFormVisible = false" color="white">取 消</v-btn>
<v-btn v-if="dialogStatus=='create'" color="blue" @click="create">新 增</v-btn>
<v-btn v-else color="blue" @click="update">修 改</v-btn>
</template>

</div>
</el-dialog>

</div>

</template>

<script>
import { GetFormDetail } from '@/api/system/form';
import { newGuid } from '@/utils/index';
import GenerateForm from '@/components/FormDesigner/GenerateForm';
Expand Down Expand Up @@ -103,6 +88,7 @@ export default {
},
data() {
return {
models: {}, // 表单内部实体
entity: {}, // 当前表单实体model
jsonData: {
list: [],
Expand Down Expand Up @@ -135,11 +121,11 @@ export default {
asyncCondition: {
deep: true,
handler(val) {
console.log(val)
this.listQuery.searchArr[0].SearchKey = val.searchKey
this.listQuery.searchArr[0].SearchValue = val.searchValue
this.listQuery.searchArr[0].SearchOperator = '='
this.Refresh()
console.log(val);
this.listQuery.searchArr[0].SearchKey = val.searchKey;
this.listQuery.searchArr[0].SearchValue = val.searchValue;
this.listQuery.searchArr[0].SearchOperator = '=';
this.Refresh();
},
},
},
Expand All @@ -152,15 +138,14 @@ export default {
},
methods: {
newGuid,
getObj() {
this.axios({
url: `/${this.tableName}/getObj`,
method: 'post',
}).then((res) => {
this.entity = res.data;
})
});
},
Refresh() {
Expand All @@ -176,14 +161,14 @@ export default {
this.list = response.data.list;
this.listQuery.totalCount = response.total;
this.listLoading = false;
})
});
},
New() {
this.dialogStatus = 'create';
Object.keys(this.entity).forEach((k) => {
this.entity[k] = ''
})
this.entity[k] = '';
});
this.dialogFormVisible = true;
},
Delete(id) {
Expand All @@ -197,7 +182,7 @@ export default {
method: 'post',
params: { id },
}).then(() => {
this.Refresh()
this.Refresh();
});
});
},
Expand Down Expand Up @@ -248,7 +233,7 @@ export default {
data: this.entity,
}).then(() => {
this.dialogFormVisible = false;
this.Refresh()
this.Refresh();
});
})
.catch(() => {
Expand All @@ -270,7 +255,7 @@ export default {
data: this.entity,
}).then(() => {
this.dialogFormVisible = false;
this.Refresh()
this.Refresh();
});
})
.catch(() => {
Expand All @@ -282,5 +267,5 @@ export default {
});
},
},
}
};
</script>
7 changes: 7 additions & 0 deletions src/components/FormDesigner/GenerateForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ export default {
this.models = { ...this.models, ...val };
},
},
models: {
deep: true,
handler(val) {
this.$emit('update:entity', val)
},
},
},
created() {
this.generateModle(this.data.list);
Expand Down Expand Up @@ -129,6 +135,7 @@ export default {
});
});
},
},
};
</script>
5 changes: 4 additions & 1 deletion src/components/FormDesigner/WidgetConfig.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<template>
<div v-if="show">
<el-form label-position="top">

<el-form-item
label="是否隐藏">
<el-switch v-model="data.hidden" />
</el-form-item>
<el-form-item
v-if="Object.keys(data.options).includes('uploadParams')"
label="附件类型">
Expand Down
14 changes: 14 additions & 0 deletions src/components/FormDesigner/componentsConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export const basicComponents = [
type: 'input',
name: '单行文本',
icon: 'regular/keyboard',
hidden: false,
options: {
width: '100%',
defaultValue: '',
Expand All @@ -16,6 +17,7 @@ export const basicComponents = [
type: 'textarea',
name: '多行文本',
icon: 'regular/keyboard',
hidden: false,
options: {
width: '100%',
defaultValue: '',
Expand All @@ -30,6 +32,7 @@ export const basicComponents = [
type: 'number',
name: '计数器',
icon: 'sort-numeric-up',
hidden: false,
options: {
width: '100%',
required: false,
Expand All @@ -45,6 +48,7 @@ export const basicComponents = [
type: 'radio',
name: '单选框组',
icon: 'regular/dot-circle',
hidden: false,
options: {
inline: false,
defaultValue: '',
Expand Down Expand Up @@ -74,6 +78,7 @@ export const basicComponents = [
type: 'checkbox',
name: '多选框组',
icon: 'regular/check-square',
hidden: false,
options: {
inline: false,
defaultValue: [],
Expand Down Expand Up @@ -101,6 +106,7 @@ export const basicComponents = [
type: 'time',
name: '时间选择器',
icon: 'regular/clock',
hidden: false,
options: {
defaultValue: '21:19:56',
readonly: false,
Expand All @@ -121,6 +127,7 @@ export const basicComponents = [
type: 'date',
name: '日期选择器',
icon: 'regular/calendar-alt',
hidden: false,
options: {
defaultValue: '',
readonly: false,
Expand All @@ -141,6 +148,7 @@ export const basicComponents = [
type: 'rate',
name: '评分',
icon: 'regular/star',
hidden: false,
options: {
defaultValue: null,
max: 5,
Expand All @@ -153,6 +161,7 @@ export const basicComponents = [
type: 'color',
name: '颜色选择器',
icon: 'palette',
hidden: false,
options: {
defaultValue: '',
disabled: false,
Expand All @@ -164,6 +173,7 @@ export const basicComponents = [
type: 'select',
name: '下拉选择框',
icon: 'regular/caret-square-down',
hidden: false,
options: {
defaultValue: '',
multiple: false,
Expand Down Expand Up @@ -195,6 +205,7 @@ export const basicComponents = [
type: 'switch',
name: '开关',
icon: 'toggle-off',
hidden: false,
options: {
defaultValue: false,
required: false,
Expand All @@ -205,6 +216,7 @@ export const basicComponents = [
type: 'slider',
name: '滑块',
icon: 'sliders-h',
hidden: false,
options: {
defaultValue: 0,
disabled: false,
Expand All @@ -225,6 +237,7 @@ export const advanceComponents = [
type: 'upload',
name: '文件上传',
icon: 'upload',
hidden: false,
options: {
uploadParams: {
Param: {
Expand All @@ -240,6 +253,7 @@ export const advanceComponents = [
type: 'richtext',
name: '富文本',
icon: 'text-height',
hidden: false,
options: {
defaultValue: '',

Expand Down

0 comments on commit a589124

Please sign in to comment.