|
|
@@ -9,9 +9,14 @@
|
|
|
<table class="form">
|
|
|
<tr>
|
|
|
<th style="width:130px;">检查日期</th>
|
|
|
- <td><input name="jcrq" type="date" onchange="loadBaseData()"/></td>
|
|
|
+ <td>
|
|
|
+ <datep.ss name="jcrq" fmt="yyyy-MM-dd" width="220px"/>
|
|
|
+ </td>
|
|
|
<th style="width:130px;">检查类型</th>
|
|
|
- <td><select name="fjlx" id="fjlx"></select></td>
|
|
|
+ <td>
|
|
|
+ <objp.ss name="fjlx" cb="fjjcJclx" inp="true" val="1"
|
|
|
+ width="220px" chg="loadViolations"/>
|
|
|
+ </td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<th>责任部门</th>
|
|
|
@@ -76,6 +81,7 @@
|
|
|
let classRows = [];
|
|
|
let violationRows = [];
|
|
|
let submitting = false;
|
|
|
+ let dateWatchReady = false;
|
|
|
|
|
|
function todayText() {
|
|
|
const now = new Date();
|
|
|
@@ -118,10 +124,31 @@
|
|
|
}
|
|
|
|
|
|
function selectedDate() {
|
|
|
+ const vm = formVm();
|
|
|
+ if (vm && vm.jcrq != null && vm.jcrq !== "")
|
|
|
+ return String(vm.jcrq);
|
|
|
const input = document.querySelector("input[name='jcrq']");
|
|
|
return input ? input.value : "";
|
|
|
}
|
|
|
|
|
|
+ function initDateControl() {
|
|
|
+ const vm = formVm();
|
|
|
+ if (!vm || !document.querySelector(".ss-date-picker")) {
|
|
|
+ setTimeout(initDateControl, 50);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (vm.jcrq == null || vm.jcrq === "")
|
|
|
+ vm.jcrq = todayText();
|
|
|
+ if (!dateWatchReady) {
|
|
|
+ dateWatchReady = true;
|
|
|
+ vm.$watch("jcrq", (value, oldValue) => {
|
|
|
+ if (String(value || "") !== String(oldValue || ""))
|
|
|
+ loadBaseData();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ loadBaseData();
|
|
|
+ }
|
|
|
+
|
|
|
function callSsService(ssServ, extraParams = {}) {
|
|
|
return new Promise((resolve) => {
|
|
|
$.ajax({
|
|
|
@@ -164,23 +191,11 @@
|
|
|
const data = res.ssData || {};
|
|
|
setSelectedBmid(data.bmid);
|
|
|
classRows = data.classes || [];
|
|
|
- renderTypes(data.types || []);
|
|
|
renderClasses();
|
|
|
loadViolations();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- function renderTypes(types) {
|
|
|
- const select = document.getElementById("fjlx");
|
|
|
- const current = select.value;
|
|
|
- select.innerHTML = types.map((item) =>
|
|
|
- '<option value="' + esc(item.code) + '">' + esc(item.name) + '</option>'
|
|
|
- ).join("");
|
|
|
- if (current && types.some((item) => String(item.code) === String(current)))
|
|
|
- select.value = current;
|
|
|
- select.onchange = loadViolations;
|
|
|
- }
|
|
|
-
|
|
|
function renderClasses() {
|
|
|
const body = document.querySelector("#classTable tbody");
|
|
|
if (!classRows.length) {
|
|
|
@@ -381,8 +396,7 @@
|
|
|
}
|
|
|
|
|
|
window.onload = function () {
|
|
|
- document.querySelector("input[name='jcrq']").value = todayText();
|
|
|
- loadBaseData();
|
|
|
+ initDateControl();
|
|
|
};
|
|
|
</script>
|
|
|
<style>
|