bugfix 0706 zentao
This commit is contained in:
@@ -75,9 +75,7 @@
|
||||
:label="opt.label"
|
||||
:value="opt.value">
|
||||
<span>{{ opt.label }}</span>
|
||||
<span
|
||||
v-if="col.customLabel"
|
||||
style="display: inline-clock; margin-left: 12px; font-size: 0.9em;">
|
||||
<span v-if="col.customLabel" style="display: inline-clock; margin-left: 12px; font-size: 0.9em">
|
||||
{{ opt[col.customLabel] || "-" }}
|
||||
</span>
|
||||
</el-option>
|
||||
@@ -187,10 +185,14 @@ export default {
|
||||
const savedDatalist = {};
|
||||
const cachedList = {};
|
||||
const watchList = [];
|
||||
const resetFields = [];
|
||||
|
||||
this.configs.form.rows.forEach((row) => {
|
||||
row.forEach((col) => {
|
||||
if (col == null) return
|
||||
if (col == null) return;
|
||||
if (!col.disableOnEdit && !col.forceDisabled && !col.forceDisabledSelect) {
|
||||
resetFields.push(col.prop);
|
||||
}
|
||||
if (!col.eraseOnSubmit && col.prop) dataForm[col.prop] = col.default ?? null;
|
||||
else shadowDataForm[col.prop] = col.default ?? null;
|
||||
|
||||
@@ -206,6 +208,7 @@ export default {
|
||||
});
|
||||
|
||||
return {
|
||||
resetFields,
|
||||
loadingStatus: false,
|
||||
dataForm,
|
||||
shadowDataForm,
|
||||
@@ -401,7 +404,7 @@ export default {
|
||||
|
||||
this.configs.form.rows.forEach((row) => {
|
||||
row.forEach((col) => {
|
||||
if (col == null) return
|
||||
if (col == null) return;
|
||||
if (col.fetchData && typeof col.fetchData === "function" && !col.hasPrev) {
|
||||
getData(col);
|
||||
}
|
||||
@@ -411,7 +414,7 @@ export default {
|
||||
/** 必须要遍历两遍 */
|
||||
this.configs.form.rows.forEach((row) => {
|
||||
row.forEach((col) => {
|
||||
if (col == null) return
|
||||
if (col == null) return;
|
||||
if (col.fetchData && typeof col.fetchData === "function" && col.hasPrev) {
|
||||
console.log("[hasPrev] set watcher: ", col.hasPrev);
|
||||
|
||||
@@ -481,7 +484,7 @@ export default {
|
||||
IsNotAvaliable(col) {
|
||||
return this.detailMode || (col.disableOnEdit && this.editMode);
|
||||
},
|
||||
handleFilelistUpdate(newFilelist, isDelete=false) {
|
||||
handleFilelistUpdate(newFilelist, isDelete = false) {
|
||||
// TODO: 直接访问 .files 可能不太合适
|
||||
this.dataForm.files = newFilelist.map((file) => ({
|
||||
id: file.id,
|
||||
@@ -492,7 +495,8 @@ export default {
|
||||
// 更新请求
|
||||
// if ("id" in this.dataForm && this.dataForm.id != null) this.addOrUpdate("PUT");
|
||||
// else
|
||||
!isDelete && this.$notify({
|
||||
!isDelete &&
|
||||
this.$notify({
|
||||
title: "等待保存",
|
||||
message: "已添加文件,请手动点击保存!",
|
||||
type: "warning",
|
||||
@@ -510,6 +514,18 @@ export default {
|
||||
return notDetailMode && (showAlways || ((editMode || addMode) && permission));
|
||||
},
|
||||
|
||||
resetSpecificFields(fields) {
|
||||
Object.keys(this.dataForm).forEach((key) => {
|
||||
// console.log(`${key} ${fields}`, key in fields, fields.indexOf(key))
|
||||
if (fields.indexOf(key) !== -1) {
|
||||
// console.log(`key ${key} in fields`)
|
||||
// this.dataForm[key] = null;
|
||||
this.$set(this.dataForm, key, null)
|
||||
}
|
||||
});
|
||||
console.log("this.dataform", this.dataForm);
|
||||
},
|
||||
|
||||
resetForm(excludeId = false, immediate = false) {
|
||||
setTimeout(
|
||||
() => {
|
||||
@@ -718,6 +734,11 @@ export default {
|
||||
case "reset":
|
||||
this.resetForm(true, true); // true means exclude id, immediate execution
|
||||
break;
|
||||
case "resetSpecific":
|
||||
// qualityInspectionRecord config 里引用
|
||||
console.log("resetFields", this.resetFields);
|
||||
this.resetSpecificFields(this.resetFields);
|
||||
break;
|
||||
case "add":
|
||||
case "update":
|
||||
this.addOrUpdate(payload.name === "add" ? "POST" : "PUT");
|
||||
|
||||
Reference in New Issue
Block a user