Skip to content

Commit

Permalink
fix 部分Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Feb 17, 2019
1 parent da93e04 commit faf5d16
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 17 deletions.
6 changes: 6 additions & 0 deletions src/components/CommonTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,10 @@ export default {
.el-table tr.table-header-row {
background: #e5c5d2; /* 示例, 对表格样式上的修饰 */
}
.v-btn{
min-width:unset!important;
width:50px!important;
}
</style>
45 changes: 33 additions & 12 deletions src/components/CrudTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
:list-query="listQuery"
:list-loading="listLoading"
@handleEdit="Edit"
@handleDetail="Detail"
@handleDelete="Delete"
@handleCurrentChange="Refresh"
@handleSizeChange="Refresh"
Expand All @@ -36,25 +37,33 @@
:visible.sync="dialogFormVisible"
v-if="dialogFormVisible"
width="80%">

<generate-form
ref="generateForm"
:data="jsonData"
:value="entity"
:disabled="handleButton.includes('detail')"
/>

<div
slot="footer"
class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button
<template v-if="dialogStatus === 'detail'">
<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'"
type="primary"
@click="create">新 增</el-button>
<el-button
color="blue"
@click="create">新 增</v-btn>
<v-btn
v-else
type="primary"
@click="update">修 改</el-button>
color="blue"
@click="update">修 改</v-btn>
</template>

</div>
</el-dialog>

Expand Down Expand Up @@ -188,7 +197,7 @@ export default {
method: 'post',
params: { id },
}).then(() => {
this.fetchData(this.listQuery);
this.Refresh()
});
});
},
Expand All @@ -209,7 +218,19 @@ export default {
method: 'post',
params: { id },
}).then((response) => {
this.fetchData(this.listQuery);
this.entity = response.data;
this.dialogFormVisible = true;
});
},
Detail(id) {
this.dialogStatus = 'detail';
this.axios({
url: `/${this.tableName}/detail`,
method: 'post',
params: { id },
}).then((response) => {
this.entity = response.data;
this.dialogFormVisible = true;
});
Expand All @@ -227,7 +248,7 @@ export default {
data: this.entity,
}).then(() => {
this.dialogFormVisible = false;
this.fetchData(this.listQuery);
this.Refresh()
});
})
.catch(() => {
Expand All @@ -249,7 +270,7 @@ export default {
data: this.entity,
}).then(() => {
this.dialogFormVisible = false;
this.fetchData(this.listQuery);
this.Refresh()
});
})
.catch(() => {
Expand Down
4 changes: 3 additions & 1 deletion src/components/FormDesigner/GenerateForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
:key="citem.key"
:models.sync="models"
:rules="rules"
:widget="citem"/>
:widget="citem"
:disabled="disabled"/>
</template>
</el-col>
</el-row>
Expand All @@ -38,6 +39,7 @@
:models.sync="models"
:rules="rules"
:widget="item"
:disabled="disabled"
/>
</template>

Expand Down
13 changes: 12 additions & 1 deletion src/components/FormDesigner/GenerateFormItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,13 @@ export default {
Tinymce,
UploadAffix,
},
props: ['widget', 'models', 'rules'],
props: ['widget', 'models', 'rules', 'disabled'],
data() {
return {
dataModel: this.models[this.widget.model],
}
},
watch: {
dataModel: {
deep: true,
Expand All @@ -202,6 +203,16 @@ export default {
})
},
},
disabled: {
deep: true,
immediate: true,
handler(val) {
this.dataModel = val[this.widget.model]
if (this.widget.options.uploadParams) {
this.widget.options.uploadParams.IsDetail = this.disabled
}
},
},
models: {
deep: true,
immediate: true,
Expand Down
3 changes: 1 addition & 2 deletions src/components/UploadAffix/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
>


<v-btn color="indigo" style="float:left;margin-top:10px 0"
dark>
<v-btn color="indigo" style="float:left;margin-top:10px 0" dark>
<v-icon dark>backup</v-icon>
</v-btn>
</el-upload>
Expand Down
2 changes: 1 addition & 1 deletion src/views/Archive/person_detail.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<crud-table tableName="person" toolbarButton="clear,search" handleButton="detail"></crud-table>
<crud-table tableName="person" toolbarButton="clear,search" handleButton="detail" disabled></crud-table>
</div>
</template>
<script>
Expand Down

0 comments on commit faf5d16

Please sign in to comment.