bugfix 0706 zentao

This commit is contained in:
lb 2023-07-06 09:59:08 +08:00
parent b8765af77f
commit eac4976304
6 changed files with 62 additions and 28 deletions

View File

@ -75,9 +75,7 @@
:label="opt.label" :label="opt.label"
:value="opt.value"> :value="opt.value">
<span>{{ opt.label }}</span> <span>{{ opt.label }}</span>
<span <span v-if="col.customLabel" style="display: inline-clock; margin-left: 12px; font-size: 0.9em">
v-if="col.customLabel"
style="display: inline-clock; margin-left: 12px; font-size: 0.9em;">
{{ opt[col.customLabel] || "-" }} {{ opt[col.customLabel] || "-" }}
</span> </span>
</el-option> </el-option>
@ -187,10 +185,14 @@ export default {
const savedDatalist = {}; const savedDatalist = {};
const cachedList = {}; const cachedList = {};
const watchList = []; const watchList = [];
const resetFields = [];
this.configs.form.rows.forEach((row) => { this.configs.form.rows.forEach((row) => {
row.forEach((col) => { 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; if (!col.eraseOnSubmit && col.prop) dataForm[col.prop] = col.default ?? null;
else shadowDataForm[col.prop] = col.default ?? null; else shadowDataForm[col.prop] = col.default ?? null;
@ -206,6 +208,7 @@ export default {
}); });
return { return {
resetFields,
loadingStatus: false, loadingStatus: false,
dataForm, dataForm,
shadowDataForm, shadowDataForm,
@ -401,7 +404,7 @@ export default {
this.configs.form.rows.forEach((row) => { this.configs.form.rows.forEach((row) => {
row.forEach((col) => { row.forEach((col) => {
if (col == null) return if (col == null) return;
if (col.fetchData && typeof col.fetchData === "function" && !col.hasPrev) { if (col.fetchData && typeof col.fetchData === "function" && !col.hasPrev) {
getData(col); getData(col);
} }
@ -411,7 +414,7 @@ export default {
/** 必须要遍历两遍 */ /** 必须要遍历两遍 */
this.configs.form.rows.forEach((row) => { this.configs.form.rows.forEach((row) => {
row.forEach((col) => { row.forEach((col) => {
if (col == null) return if (col == null) return;
if (col.fetchData && typeof col.fetchData === "function" && col.hasPrev) { if (col.fetchData && typeof col.fetchData === "function" && col.hasPrev) {
console.log("[hasPrev] set watcher: ", col.hasPrev); console.log("[hasPrev] set watcher: ", col.hasPrev);
@ -481,7 +484,7 @@ export default {
IsNotAvaliable(col) { IsNotAvaliable(col) {
return this.detailMode || (col.disableOnEdit && this.editMode); return this.detailMode || (col.disableOnEdit && this.editMode);
}, },
handleFilelistUpdate(newFilelist, isDelete=false) { handleFilelistUpdate(newFilelist, isDelete = false) {
// TODO: 访 .files // TODO: 访 .files
this.dataForm.files = newFilelist.map((file) => ({ this.dataForm.files = newFilelist.map((file) => ({
id: file.id, id: file.id,
@ -492,7 +495,8 @@ export default {
// //
// if ("id" in this.dataForm && this.dataForm.id != null) this.addOrUpdate("PUT"); // if ("id" in this.dataForm && this.dataForm.id != null) this.addOrUpdate("PUT");
// else // else
!isDelete && this.$notify({ !isDelete &&
this.$notify({
title: "等待保存", title: "等待保存",
message: "已添加文件,请手动点击保存!", message: "已添加文件,请手动点击保存!",
type: "warning", type: "warning",
@ -510,6 +514,18 @@ export default {
return notDetailMode && (showAlways || ((editMode || addMode) && permission)); 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) { resetForm(excludeId = false, immediate = false) {
setTimeout( setTimeout(
() => { () => {
@ -718,6 +734,11 @@ export default {
case "reset": case "reset":
this.resetForm(true, true); // true means exclude id, immediate execution this.resetForm(true, true); // true means exclude id, immediate execution
break; break;
case "resetSpecific":
// qualityInspectionRecord config
console.log("resetFields", this.resetFields);
this.resetSpecificFields(this.resetFields);
break;
case "add": case "add":
case "update": case "update":
this.addOrUpdate(payload.name === "add" ? "POST" : "PUT"); this.addOrUpdate(payload.name === "add" ? "POST" : "PUT");

View File

@ -11,7 +11,8 @@ import i18n from "@/i18n";
const table = { const table = {
sex: { sex: {
'0': '男', '0': '男',
'1': '女' '1': '女',
'2': '保密'
}, },
userStatus: { userStatus: {
'0': i18n.t('user.status0'), '0': i18n.t('user.status0'),

View File

@ -15,6 +15,7 @@
:refresh-layout-key="refreshLayoutKey" /> :refresh-layout-key="refreshLayoutKey" />
<el-pagination <el-pagination
v-if="navigator"
class="mt-5 flex justify-end" class="mt-5 flex justify-end"
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handlePageChange" @current-change="handlePageChange"
@ -50,7 +51,11 @@
filename="bomTemplate.xlsx" filename="bomTemplate.xlsx"
@refresh-list="getList" @refresh-list="getList"
@uploadSuccess="getList" @uploadSuccess="getList"
@destroy-dialog="() => { uploadDialogVisible = false }" /> @destroy-dialog="
() => {
uploadDialogVisible = false;
}
" />
<Overlay v-if="overlayVisible" /> <Overlay v-if="overlayVisible" />
</div> </div>
</template> </template>
@ -81,6 +86,10 @@ export default {
Overlay, Overlay,
}, },
props: { props: {
navigator: {
type: Boolean,
default: true
},
tableConfig: { tableConfig: {
type: Object, type: Object,
default: () => ({ default: () => ({
@ -126,11 +135,11 @@ export default {
this.refreshLayoutKey = this.layoutTable(); this.refreshLayoutKey = this.layoutTable();
}, },
watch: { watch: {
page: val => { page: (val) => {
console.log('page changed:', val) console.log("page changed:", val);
}, },
size: val => { size: (val) => {
console.log('size changed:', val) console.log("size changed:", val);
}, },
triggerUpdate(val, oldVal) { triggerUpdate(val, oldVal) {
if (val && val !== oldVal) { if (val && val !== oldVal) {
@ -157,7 +166,7 @@ export default {
refreshLayoutKey: null, refreshLayoutKey: null,
uploadDialogVisible: false, uploadDialogVisible: false,
overlayVisible: false, overlayVisible: false,
cachedSearchCondition: {} cachedSearchCondition: {},
}; };
}, },
inject: ["urls"], inject: ["urls"],
@ -177,7 +186,7 @@ export default {
? { ...queryParams, page: this.page, limit: this.size } ? { ...queryParams, page: this.page, limit: this.size }
: { : {
page: this.page, page: this.page,
limit: this.size limit: this.size,
}; };
if (!queryParams && this.listQueryExtra && this.listQueryExtra.length) { if (!queryParams && this.listQueryExtra && this.listQueryExtra.length) {
@ -189,7 +198,7 @@ export default {
}); });
} }
}); });
this.cachedSearchCondition = Object.assign({}, params) this.cachedSearchCondition = Object.assign({}, params);
} }
this.$http[this.urls.pageIsPostApi ? "post" : "get"]( this.$http[this.urls.pageIsPostApi ? "post" : "get"](
@ -231,6 +240,8 @@ export default {
id: item._id ?? item.id, id: item._id ?? item.id,
})); }));
this.totalPage = res.data.total; this.totalPage = res.data.total;
} else if (Array.isArray(res.data)) {
this.dataList = res.data
} else { } else {
this.dataList.splice(0); this.dataList.splice(0);
this.totalPage = 0; this.totalPage = 0;
@ -273,7 +284,7 @@ export default {
promptName = data[deleteConfig.promptField]; promptName = data[deleteConfig.promptField];
} }
let currenPageListLength = this.dataList.length let currenPageListLength = this.dataList.length;
// //
return this.$confirm(`确定要删除记录 "${promptName}" 吗?`, "提示", { return this.$confirm(`确定要删除记录 "${promptName}" 吗?`, "提示", {
confirmButtonText: "确认", confirmButtonText: "确认",
@ -296,8 +307,8 @@ export default {
// this.page = 1; // this.page = 1;
// this.size = // this.size =
// "defaultPageSize" in this.tableConfig.column ? this.tableConfig.column.defaultPageSize : 20; // "defaultPageSize" in this.tableConfig.column ? this.tableConfig.column.defaultPageSize : 20;
if (currenPageListLength == 1) this.page = this.page > 1 ? this.page - 1 : 1 if (currenPageListLength == 1) this.page = this.page > 1 ? this.page - 1 : 1;
this.getList(); this.getList();
} else { } else {
this.$message({ this.$message({
@ -359,7 +370,7 @@ export default {
break; break;
} }
case "view-attachment-justform-version": { case "view-attachment-justform-version": {
console.log(data) console.log(data);
break; break;
} }
case "view-recipe": { case "view-recipe": {
@ -573,7 +584,7 @@ export default {
this.openDialog(); this.openDialog();
return; return;
} }
case "查询": { case "查询": {
if (typeof payload === "object") { if (typeof payload === "object") {
// BaseSearchForm // BaseSearchForm
Object.assign(this.cachedSearchCondition, payload); Object.assign(this.cachedSearchCondition, payload);

View File

@ -4,7 +4,8 @@
:table-config="tableConfig" :table-config="tableConfig"
:head-config="headFormConfigs" :head-config="headFormConfigs"
:dialog-configs="dialogConfigs" :dialog-configs="dialogConfigs"
:listQueryExtra="['']" /> :listQueryExtra="['']"
:navigator="false" />
</template> </template>
<script> <script>

View File

@ -39,7 +39,7 @@ export default function () {
const headFormFields = [ const headFormFields = [
{ {
prop: "orderId", prop: "order",
label: "订单号", label: "订单号",
fieldOptionLabel: 'code', fieldOptionLabel: 'code',
// fieldOptionValue: 'id', // fieldOptionValue: 'id',
@ -253,7 +253,7 @@ export default function () {
operations: [ operations: [
{ name: "add", label: "保存", type: "primary", permission: "", showOnEdit: false }, { name: "add", label: "保存", type: "primary", permission: "", showOnEdit: false },
{ name: "update", label: "更新", type: "primary", permission: "", showOnEdit: true }, { name: "update", label: "更新", type: "primary", permission: "", showOnEdit: true },
{ name: "reset", label: "重置", type: "warning", showAlways: true }, { name: "resetSpecific", label: "重置", type: "warning", showAlways: true },
], ],
}, },
}; };

View File

@ -6,11 +6,11 @@ import { timeFilter } from "@/utils/filters";
export default function () { export default function () {
const tableProps = [ const tableProps = [
{ type: "index", label: "序号" }, { type: "index", label: "序号" },
{ prop: "kilnCode", label: "窑炉" }, // { prop: "kilnCode", label: "窑炉" },
{ width: 120, prop: "orderCode", label: "主订单号" }, { width: 120, prop: "orderCode", label: "主订单号" },
{ width: 60, prop: "orderCate", label: "子号" }, { width: 60, prop: "orderCate", label: "子号" },
{ width: 210, prop: "code", label: "检测包装订单号" }, { width: 210, prop: "code", label: "检测包装订单号" },
{ width: 60, prop: "percent", label: "进度", filter: (val) => (val !== null && val !== undefined ? val + " %" : "-") }, { width: 60, prop: "percent1", label: "进度", filter: (val) => (val !== null && val !== undefined ? val + " %" : "-") },
// { // {
// prop: "statusDictValue", // prop: "statusDictValue",
// label: "订单状态", // label: "订单状态",
@ -18,7 +18,7 @@ export default function () {
// }, // },
// { width: 120, prop: "startTime", label: "开始时间" }, // { width: 120, prop: "startTime", label: "开始时间" },
{ width: 120, prop: "shapeCode", label: "砖型" }, { width: 120, prop: "shapeCode", label: "砖型" },
{ width: 90, prop: "ai", label: "版本号" }, { width: 90, prop: "packTech", label: "版本号" },
{ width: 90, prop: "qty1", label: "检测量" }, { width: 90, prop: "qty1", label: "检测量" },
{ width: 120, prop: "qty1Complete", label: "完成量" }, { width: 120, prop: "qty1Complete", label: "完成量" },
{ width: 120, prop: "goodqty1", label: "检测合格量" }, { width: 120, prop: "goodqty1", label: "检测合格量" },