update 0710反馈
This commit is contained in:
@@ -154,7 +154,7 @@
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
:current-page.sync="attrPage"
|
||||
:page-sizes="[5, 10, 20]"
|
||||
:page-sizes="[10, 20, 50]"
|
||||
:page-size="attrSize"
|
||||
:total="attrTotal"
|
||||
layout="total, sizes, prev, next"></el-pagination>
|
||||
@@ -411,7 +411,7 @@ export default {
|
||||
scrollingContainer: null,
|
||||
},
|
||||
attrPage: 1,
|
||||
attrSize: 10,
|
||||
attrSize: 20,
|
||||
attrTotal: 0,
|
||||
fileList: [],
|
||||
imgPreviewDialogVisible: false,
|
||||
@@ -463,7 +463,7 @@ export default {
|
||||
dialogVisible: function (val) {
|
||||
if (!!val) {
|
||||
this.attrPage = 1;
|
||||
this.attrSize = 10;
|
||||
this.attrSize = 20;
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -10,26 +10,35 @@
|
||||
:width="'30%'"
|
||||
:modal="false"
|
||||
:fullscreen="false"
|
||||
:top="'10vh'"
|
||||
>
|
||||
:top="'10vh'">
|
||||
<!-- :append-to-body="appendToBody"> -->
|
||||
<div>
|
||||
<div v-loading="loading">
|
||||
<el-form ref="dataForm" :model="dataForm">
|
||||
<el-row v-for="(row, rowIndex) in configs.rows" :key="'row_' + rowIndex" :gutter="20">
|
||||
<el-col v-for="(col, colIndex) in row" :key="colIndex" :span="col.span ?? 24 / row.length">
|
||||
<el-form-item :prop="col.prop" :rules="col.rules || null" :label="col.label">
|
||||
<el-input v-if="col.input" v-model="dataForm[col.prop]" clearable :disabled="detailMode" v-bind="col.elparams" />
|
||||
<el-input
|
||||
v-if="col.input"
|
||||
v-model="dataForm[col.prop]"
|
||||
clearable
|
||||
:disabled="detailMode"
|
||||
v-bind="col.elparams" />
|
||||
<el-select
|
||||
v-if="col.select"
|
||||
v-model="dataForm[col.prop]"
|
||||
clearable
|
||||
:disabled="detailMode"
|
||||
v-bind="col.elparams"
|
||||
@change="handleSelectChange(col, $event)"
|
||||
>
|
||||
<el-option v-for="(opt, optIdx) in col.options" :key="'option_' + optIdx" :label="opt.label" :value="opt.value">
|
||||
@change="handleSelectChange(col, $event)">
|
||||
<el-option
|
||||
v-for="(opt, optIdx) in col.options"
|
||||
:key="'option_' + optIdx"
|
||||
:label="opt.label"
|
||||
:value="opt.value">
|
||||
<span>{{ opt.label }}</span>
|
||||
<span v-if="col.customLabel" style="display: inline-clock; margin-left: 12px; font-size: .9em;">{{ opt[col.customLabel] || '-' }}</span>
|
||||
<span v-if="col.customLabel" style="display: inline-clock; margin-left: 12px; font-size: 0.9em">
|
||||
{{ opt[col.customLabel] || "-" }}
|
||||
</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-switch
|
||||
@@ -38,9 +47,13 @@
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
@change="handleSwitchChange"
|
||||
:disabled="detailMode" />
|
||||
<el-input
|
||||
v-if="col.textarea"
|
||||
type="textarea"
|
||||
v-model="dataForm[col.prop]"
|
||||
:disabled="detailMode"
|
||||
/>
|
||||
<el-input v-if="col.textarea" type="textarea" v-model="dataForm[col.prop]" :disabled="detailMode" v-bind="col.elparams" />
|
||||
v-bind="col.elparams" />
|
||||
<!-- add more... -->
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -56,9 +69,9 @@
|
||||
:key="'operation_' + index"
|
||||
:type="operate.type"
|
||||
@click="handleBtnClick(operate)"
|
||||
:loading="(operate.name === 'add' || operate.name === 'update') && btnLoading"
|
||||
>{{ operate.label }}</el-button
|
||||
>
|
||||
:loading="(operate.name === 'add' || operate.name === 'update') && btnLoading">
|
||||
{{ operate.label }}
|
||||
</el-button>
|
||||
</template>
|
||||
<el-button @click="handleBtnClick({ name: 'cancel' })">取消</el-button>
|
||||
</div>
|
||||
@@ -99,10 +112,20 @@ export default {
|
||||
col,
|
||||
"options",
|
||||
!col.customLabel
|
||||
? res.data.list.map((item) => ({ label: item.name, value: item.id }))
|
||||
: res.data.list.map((item) => ({ label: item.name, value: item.id, [col.customLabel]: item[col.customLabel] }))
|
||||
? res.data.list.map((item) => ({ label: item[col.optionLabel ?? "name"], value: item.id }))
|
||||
: res.data.list.map((item) => ({
|
||||
label: item[col.optionLabel ?? "name"],
|
||||
value: item.id,
|
||||
[col.customLabel]: item[col.customLabel],
|
||||
}))
|
||||
);
|
||||
console.log(
|
||||
res.data.list.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
[col.customLabel]: item[col.customLabel],
|
||||
}))
|
||||
);
|
||||
console.log(res.data.list.map((item) => ({ label: item.name, value: item.id, [col.customLabel]: item[col.customLabel] })))
|
||||
} else {
|
||||
this.$set(col, "options", []);
|
||||
}
|
||||
@@ -111,6 +134,7 @@ export default {
|
||||
});
|
||||
|
||||
return {
|
||||
loading: false,
|
||||
btnLoading: false,
|
||||
visible: false,
|
||||
detailMode: false,
|
||||
@@ -132,7 +156,7 @@ export default {
|
||||
resetForm(excludeId = false) {
|
||||
setTimeout(() => {
|
||||
Object.keys(this.dataForm).forEach((key) => {
|
||||
console.log(">>> clearing key: ", key);
|
||||
// console.log(">>> clearing key: ", key);
|
||||
if (excludeId && key === "id") return;
|
||||
this.dataForm[key] = null;
|
||||
});
|
||||
@@ -141,7 +165,8 @@ export default {
|
||||
},
|
||||
|
||||
init(id, isdetail = false) {
|
||||
console.log("[small dialog] init", id, isdetail);
|
||||
// console.log("[small dialog] init", id, isdetail);
|
||||
this.visible = true;
|
||||
|
||||
this.detailMode = isdetail;
|
||||
if (this.$refs.dataForm) this.$refs.dataForm.clearValidate();
|
||||
@@ -152,16 +177,22 @@ export default {
|
||||
|
||||
if (this.dataForm.id) {
|
||||
// 如果是编辑
|
||||
this.$http.get(this.urls.subase + `/${this.dataForm.id}`).then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
const dataFormKeys = Object.keys(this.dataForm);
|
||||
this.dataForm = __pick(res.data, dataFormKeys);
|
||||
}
|
||||
this.visible = true;
|
||||
});
|
||||
} else {
|
||||
// 如果不是编辑
|
||||
this.visible = true;
|
||||
this.loading = true;
|
||||
this.$http
|
||||
.get(this.urls.subase + `/${this.dataForm.id}`)
|
||||
.then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
const dataFormKeys = Object.keys(this.dataForm);
|
||||
this.dataForm = __pick(res.data, dataFormKeys);
|
||||
} else {
|
||||
throw new Error(res.msg);
|
||||
}
|
||||
this.loading = false;
|
||||
})
|
||||
.catch((err) => {
|
||||
this.loading = false;
|
||||
this.$message.error(err.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user