add 报工预览
This commit is contained in:
@@ -63,6 +63,12 @@
|
||||
<Overlay v-if="overlayVisible" />
|
||||
|
||||
<PrintDom ref="print" v-if="printDOMmount" @destroy="printDOMmount = false" @refresh-list="getList" />
|
||||
|
||||
<ReportDialog
|
||||
ref="car-report-dialog"
|
||||
v-if="carReportDialogVisible"
|
||||
@destroy="carReportDialog = false"
|
||||
:ids="tableSelectedIds" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -77,6 +83,7 @@ import Overlay from "@/components/Overlay.vue";
|
||||
import moment from "moment";
|
||||
import AttachmentDialog from "@/components/attachmentDialog.vue";
|
||||
import PrintDom from "../../components/PrintDom.vue";
|
||||
import ReportDialog from "../../components/ReportDialog.vue";
|
||||
|
||||
const DIALOG_WITH_MENU = "DialogWithMenu";
|
||||
const DIALOG_JUST_FORM = "DialogJustForm";
|
||||
@@ -94,6 +101,7 @@ export default {
|
||||
Overlay,
|
||||
AttachmentDialog,
|
||||
PrintDom,
|
||||
ReportDialog,
|
||||
},
|
||||
props: {
|
||||
navigator: {
|
||||
@@ -181,6 +189,8 @@ export default {
|
||||
needAttachmentDialog: false,
|
||||
tableSelectedIds: [],
|
||||
printDOMmount: false,
|
||||
queryParams: {},
|
||||
carReportDialogVisible: false,
|
||||
};
|
||||
},
|
||||
inject: ["urls"],
|
||||
@@ -190,6 +200,20 @@ export default {
|
||||
"defaultPageSize" in this.tableConfig.column ? this.tableConfig.column.defaultPageSize : 20;
|
||||
this.size = size;
|
||||
|
||||
// 如果设置了 listQueryExtra,就合并到 queryParams
|
||||
if (this.listQueryExtra && Array.isArray(this.listQueryExtra)) {
|
||||
this.listQueryExtra.map((item) => {
|
||||
if (typeof item === "string") this.$set(this.queryParams, item, "");
|
||||
else if (typeof item === "object") {
|
||||
Object.keys(item).forEach((key) => {
|
||||
this.$set(this.queryParams, key, item[key]);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
console.log("this.queryParams is: ", JSON.stringify(this.queryParams));
|
||||
|
||||
this.initDataWhenLoad && this.getList();
|
||||
},
|
||||
methods: {
|
||||
@@ -204,27 +228,18 @@ export default {
|
||||
limit: this.size,
|
||||
};
|
||||
|
||||
if (!queryParams && this.listQueryExtra && this.listQueryExtra.length) {
|
||||
this.listQueryExtra.map((nameOrObj) => {
|
||||
if (typeof nameOrObj === "string") params[nameOrObj] = "";
|
||||
else if (typeof nameOrObj === "object") {
|
||||
Object.keys(nameOrObj).forEach((key) => {
|
||||
params[key] = nameOrObj[key];
|
||||
});
|
||||
}
|
||||
});
|
||||
this.cachedSearchCondition = Object.assign({}, params);
|
||||
}
|
||||
|
||||
console.log("[http request] params is: ", params);
|
||||
this.$http[this.urls.pageIsPostApi ? "post" : "get"](
|
||||
this.urls.page,
|
||||
this.urls.pageIsPostApi
|
||||
? {
|
||||
...this.queryParams,
|
||||
...params,
|
||||
}
|
||||
: {
|
||||
params,
|
||||
params: {
|
||||
...this.queryParams,
|
||||
...params,
|
||||
},
|
||||
}
|
||||
)
|
||||
.then(({ data: res }) => {
|
||||
@@ -233,14 +248,6 @@ export default {
|
||||
if (res.code === 0) {
|
||||
// page 场景:
|
||||
if ("list" in res.data) {
|
||||
// if (res.data.list.length == 0 && res.data.total != 0) {
|
||||
// // refresh list
|
||||
// if (this.page > 1) {
|
||||
// this.page -= 1
|
||||
// this.getList()
|
||||
// return
|
||||
// } else return
|
||||
// }
|
||||
/** 破碎记录的特殊需求:数据要结合单位 material + materialUnitDictValue */
|
||||
if ("attachDictValue" in this.tableConfig.column) {
|
||||
this.dataList = res.data.list.map((row) => {
|
||||
@@ -249,12 +256,6 @@ export default {
|
||||
});
|
||||
} else this.dataList = res.data.list;
|
||||
|
||||
this.totalPage = res.data.total;
|
||||
} else if ("records" in res.data) {
|
||||
this.dataList = res.data.records.map((item) => ({
|
||||
...item,
|
||||
id: item._id ?? item.id,
|
||||
}));
|
||||
this.totalPage = res.data.total;
|
||||
} else if (Array.isArray(res.data)) {
|
||||
this.dataList = res.data;
|
||||
@@ -659,38 +660,34 @@ export default {
|
||||
return;
|
||||
}
|
||||
case "查询": {
|
||||
if (typeof payload === "object") {
|
||||
/** 必须先处理 listQueryExtra 里的数据 */
|
||||
this.listQueryExtra?.map((cond) => {
|
||||
if (typeof cond === "string") {
|
||||
if (!!payload[cond]) {
|
||||
this.cachedSearchCondition[cond] = payload[cond];
|
||||
} else {
|
||||
this.cachedSearchCondition[cond] = "";
|
||||
}
|
||||
} else if (typeof cond === "object") {
|
||||
Object.keys(cond).forEach((key) => {
|
||||
this.cachedSearchCondition[key] = cond[key];
|
||||
});
|
||||
}
|
||||
});
|
||||
// 再处理 payload 里的数据,用于刷新 上面的 数据
|
||||
Object.assign(this.cachedSearchCondition, payload);
|
||||
if ("timerange" in payload) {
|
||||
if (!!payload.timerange) {
|
||||
const [startTime, endTime] = payload["timerange"];
|
||||
this.cachedSearchCondition.startTime = moment(startTime).format("YYYY-MM-DDTHH:mm:ss");
|
||||
this.cachedSearchCondition.endTime = moment(endTime).format("YYYY-MM-DDTHH:mm:ss");
|
||||
} else {
|
||||
delete this.cachedSearchCondition.startTime;
|
||||
delete this.cachedSearchCondition.endTime;
|
||||
}
|
||||
delete this.cachedSearchCondition.timerange;
|
||||
const params = Object.assign({}, payload);
|
||||
|
||||
if ("timerange" in params) {
|
||||
if (!!params.timerange) {
|
||||
const [startTime, endTime] = params["timerange"];
|
||||
params.startTime = moment(startTime).format("YYYY-MM-DDTHH:mm:ss");
|
||||
params.endTime = moment(endTime).format("YYYY-MM-DDTHH:mm:ss");
|
||||
} else {
|
||||
params.startTime = null;
|
||||
params.endTime = null;
|
||||
}
|
||||
delete params.timerange;
|
||||
}
|
||||
|
||||
console.log("查询", this.cachedSearchCondition);
|
||||
this.getList(this.cachedSearchCondition);
|
||||
// console.log(
|
||||
// "查询 params",
|
||||
// JSON.stringify({
|
||||
// // ...this.queryParams,
|
||||
// ...params,
|
||||
// })
|
||||
// );
|
||||
|
||||
this.queryParams = {
|
||||
...this.queryParams,
|
||||
...params,
|
||||
};
|
||||
|
||||
this.getList();
|
||||
break;
|
||||
}
|
||||
case "同步":
|
||||
@@ -727,11 +724,18 @@ export default {
|
||||
// })
|
||||
this.tableSelectedIds.forEach(async (id) => {
|
||||
await this.printOnce(id);
|
||||
})
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$message.error(`批量打印出错: ${err}`);
|
||||
});
|
||||
case "报工":
|
||||
console.log("报工ids:", this.tableSelectedIds);
|
||||
this.carReportDialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs['car-report-dialog'].init();
|
||||
});
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -752,12 +756,12 @@ export default {
|
||||
// val 是新值
|
||||
this.page = 1;
|
||||
this.size = val;
|
||||
this.getList(this.cachedSearchCondition);
|
||||
this.getList();
|
||||
},
|
||||
|
||||
handlePageChange(val) {
|
||||
// val 是新值
|
||||
this.getList(this.cachedSearchCondition);
|
||||
this.getList();
|
||||
},
|
||||
|
||||
/** 打开对话框 */
|
||||
|
||||
@@ -39,7 +39,7 @@ export default function () {
|
||||
width: 90,
|
||||
subcomponent: TableOperaionComponent,
|
||||
options: [
|
||||
{ name: "edit", label: "编辑", icon: "edit-outline" },
|
||||
{ name: "edit", label: "编辑", icon: "edit-outline", enable: row => row.report == 0 },
|
||||
// {
|
||||
// name: "delete",
|
||||
// icon: "delete",
|
||||
@@ -196,14 +196,14 @@ export default function () {
|
||||
elparams: { placeholder: "请输入报废数量" },
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
richInput: true,
|
||||
label: "描述信息",
|
||||
prop: "description",
|
||||
},
|
||||
],
|
||||
[{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }],
|
||||
// [
|
||||
// {
|
||||
// richInput: true,
|
||||
// label: "描述信息",
|
||||
// prop: "description",
|
||||
// },
|
||||
// ],
|
||||
// [{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }],
|
||||
],
|
||||
operations: [
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<script>
|
||||
import initConfig from "./config";
|
||||
import ListViewWithHead from "@/views/atomViews/ListViewWithHead.vue";
|
||||
import moment from "moment";
|
||||
|
||||
export default {
|
||||
name: "CarView",
|
||||
@@ -31,12 +32,16 @@ export default {
|
||||
computed: {
|
||||
now() {
|
||||
const curr = this.headFormConfigs.fields.find((item) => item.prop == "timerange").default.value;
|
||||
const start = new Date(curr[0]);
|
||||
const end = new Date(curr[1]);
|
||||
return [
|
||||
start.toLocaleString().replace(' ', 'T').replace(/\//g, '-'),
|
||||
end.toLocaleString().replace(' ', 'T').replace(/\//g, '-'),
|
||||
]
|
||||
return [
|
||||
moment(curr[0]).format("YYYY-MM-DDTHH:mm:ss"),
|
||||
moment(curr[1]).format("YYYY-MM-DDTHH:mm:ss"),
|
||||
]
|
||||
// const start = new Date(curr[0]);
|
||||
// const end = new Date(curr[1]);
|
||||
// return [
|
||||
// start.toLocaleString().replace(' ', 'T').replace(/\//g, '-'),
|
||||
// end.toLocaleString().replace(' ', 'T').replace(/\//g, '-'),
|
||||
// ]
|
||||
},
|
||||
},
|
||||
methods: {},
|
||||
|
||||
Reference in New Issue
Block a user