You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

692 lines
32 KiB

3 weeks ago
  1. 
  2. @{
  3. ViewBag.Title = "";
  4. Layout = "~/Views/Shared/_Form.cshtml";
  5. }
  6. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  7. <!--引入 element-ui 的样式,-->
  8. <link rel="stylesheet" href="~/Content/element-ui/lib/theme-chalk/index.css">
  9. <script src="~/Content/vue/dist/vue.js"></script>
  10. <script src="~/Content/element-ui/lib/index.js"></script>
  11. <script src="~/Content/axios.min.js"></script>
  12. <style>
  13. </style>
  14. <form id="form1">
  15. <div id="app">
  16. <template>
  17. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  18. <el-divider>主表信息</el-divider>
  19. <el-row :gutter="24">
  20. <el-col :span="6">
  21. <el-form-item label="检验项目组代码" prop="GroupCode">
  22. <el-input v-model="form.GroupCode" placeholder="请输入内容" size="mini" :disabled="disabled4RulesCode"></el-input>
  23. </el-form-item>
  24. </el-col>
  25. <el-col :span="6">
  26. <el-form-item label="检验项目组名称" prop="GroupName">
  27. <el-input v-model="form.GroupName" placeholder="请输入内容" size="mini"></el-input>
  28. </el-form-item>
  29. </el-col>
  30. @*<el-col :span="6">
  31. <el-form-item label="Aql描述" prop="RulesDesc">
  32. <el-input v-model="form.RulesDesc" placeholder="请输入内容" size="mini"></el-input>
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span="6">
  36. <el-form-item label="Aql类别" prop="Type">
  37. <el-input v-model="form.Type" placeholder="请输入内容" size="mini"></el-input>
  38. </el-form-item>
  39. </el-col>*@
  40. @*<el-col :span="6">
  41. <el-form-item label="维护人" prop="MUSERName">
  42. <el-input v-model="form.MUSERName" placeholder="请输入内容" size="mini"></el-input>
  43. </el-form-item>
  44. </el-col>
  45. <el-col :span="6">
  46. <el-form-item label="维护时间" prop="MTIME">
  47. <el-input v-model="form.MTIME" placeholder="请输入内容" size="mini"></el-input>
  48. </el-form-item>
  49. </el-col>*@
  50. </el-row>
  51. <el-row :gutter="24">
  52. <el-col :span="6">
  53. <el-form-item label="启用" prop="Enable">
  54. <el-switch v-model="form.Enable" active-color="#13ce66" inactive-color="#ff4949">
  55. </el-switch>
  56. </el-form-item>
  57. </el-col>
  58. </el-row>
  59. <el-divider>子表信息</el-divider>
  60. <el-row :gutter="24">
  61. <el-col :span="24">
  62. @*<el-button type="primary" size="mini" v-on:click="addLine()">新增</el-button>*@
  63. <a id="NF-Add" authorize="no" style="margin-left:3px;" class="btn btn-primary" v-on:click="addLine()"><i class="fa fa-pencil-square-o"></i>新增</a>
  64. </el-col>
  65. </el-row>
  66. <el-row :gutter="24">
  67. @*<el-col :span="2">
  68. </el-col>*@
  69. <el-col :span="24">
  70. <el-table ref="singleTable" highlight-current-row
  71. :data="dataSource4Detail"
  72. style="width: 100%"
  73. stripe border
  74. size="mini"
  75. height="500"
  76. v-on:current-change="handleCurrentChange">
  77. <el-table-column prop="EATTRIBUTE6" label="检验类型" width="140">
  78. <template slot-scope="scope">
  79. <el-select v-model="scope.row.EATTRIBUTE6" placeholder="请选择" size="mini">
  80. <el-option v-for="item in dataSourceType"
  81. :key="item.Code"
  82. :label="item.Name"
  83. :value="item.Code">
  84. </el-option>
  85. </el-select>
  86. </template>
  87. </el-table-column>
  88. @*<el-table-column type="index" width="50"></el-table-column>*@
  89. <el-table-column prop="ListCode" label="检验项目代码" width="140">
  90. <template slot-scope="scope">
  91. <!-- 新增 filterable 和 filter-method 属性 -->
  92. <el-select v-model="scope.row.ListCode"
  93. placeholder="请选择或输入"
  94. size="mini"
  95. filterable
  96. :filter-method="(val) => filterListCode(val, scope.$index)"
  97. v-on:change="(val) => ListCodeChange(val, scope.$index)">
  98. <el-option v-for="item in scope.row.filteredListCode || dataSourceListCode"
  99. :key="item.Code"
  100. :label="item.Name"
  101. :value="item.Code">
  102. </el-option>
  103. </el-select>
  104. </template>
  105. </el-table-column>
  106. <el-table-column prop="ListName" label="检验项目名称" width="140">
  107. <template slot-scope="scope">
  108. <el-input v-model="scope.row.ListName" controls-position="right" size="small" disabled="disabled"></el-input>
  109. </template>
  110. </el-table-column>
  111. <el-table-column prop="SetValueMin" label="标准下限" width="140">
  112. <template slot-scope="scope">
  113. <el-input-number v-model="scope.row.SetValueMin" controls-position="right" :min="0" size="small"></el-input-number>
  114. </template>
  115. </el-table-column>
  116. <el-table-column prop="SetValueMax" label="标准上限" width="140">
  117. <template slot-scope="scope">
  118. <el-input-number v-model="scope.row.SetValueMax" controls-position="right" :min="0" size="small"></el-input-number>
  119. </template>
  120. </el-table-column>
  121. <el-table-column prop="Unit" label="单位" width="140">
  122. <template slot-scope="scope">
  123. <el-select v-model="scope.row.Unit" placeholder="请选择" size="mini">
  124. <el-option v-for="item in dataSourceUom"
  125. :key="item.Name"
  126. :label="item.Name"
  127. :value="item.Name">
  128. </el-option>
  129. </el-select>
  130. </template>
  131. </el-table-column>
  132. <el-table-column prop="EATTRIBUTE7" label="检验仪器" width="140">
  133. <template slot-scope="scope">
  134. <!-- 新增 filterable 和 filter-method,绑定检验仪器的查询方法 -->
  135. <el-select v-model="scope.row.EATTRIBUTE7"
  136. placeholder="请选择或输入"
  137. size="mini"
  138. filterable
  139. :filter-method="(val) => filterDevice(val, scope.$index)">
  140. <!-- 优先使用过滤后的选项,无过滤时显示原始数据源 -->
  141. <el-option v-for="item in scope.row.filteredDevice || dataSourceDevice"
  142. :key="item.Name"
  143. :label="item.Name"
  144. :value="item.Name">
  145. </el-option>
  146. </el-select>
  147. </template>
  148. </el-table-column>
  149. <el-table-column prop="EATTRIBUTE1" label="检验标准" width="140">
  150. <template slot-scope="scope">
  151. <el-input v-model="scope.row.EATTRIBUTE1" controls-position="right" size="small"></el-input>
  152. </template>
  153. </el-table-column>
  154. @*<el-table-column prop="EATTRIBUTE2" label="抽样水准" width="140">
  155. <template slot-scope="scope">
  156. <el-input v-model="scope.row.EATTRIBUTE2" controls-position="right" size="small"></el-input>
  157. </template>
  158. </el-table-column>
  159. <el-table-column prop="EATTRIBUTE3" label="允收标准" width="140">
  160. <template slot-scope="scope">
  161. <el-input v-model="scope.row.EATTRIBUTE3" controls-position="right" size="small"></el-input>
  162. </template>
  163. </el-table-column>*@
  164. <el-table-column prop="EATTRIBUTE4" label="检验实际值是否必填" width="150">
  165. <template slot-scope="scope">
  166. <el-switch v-model="scope.row.EATTRIBUTE4" active-color="#13ce66" inactive-color="#ff4949">
  167. </el-switch>
  168. </template>
  169. </el-table-column>
  170. <el-table-column prop="EATTRIBUTE5" label="AQL代码" width="140">
  171. <template slot-scope="scope">
  172. <!-- 新增 filterable 和 filter-method,绑定AQL代码的查询方法 -->
  173. <el-select v-model="scope.row.EATTRIBUTE5"
  174. placeholder="请选择或输入"
  175. size="mini"
  176. filterable
  177. :filter-method="(val) => filterAqlCode(val, scope.$index)">
  178. <!-- 优先使用过滤后的选项,无过滤时显示原始数据源 -->
  179. <el-option v-for="item in scope.row.filteredAqlCode || dataSourceAql"
  180. :key="item.Code"
  181. :label="item.Code"
  182. :value="item.Code">
  183. </el-option>
  184. </el-select>
  185. </template>
  186. </el-table-column>
  187. <el-table-column prop="Enable" label="启用" width="150">
  188. <template slot-scope="scope">
  189. <el-switch v-model="scope.row.Enable" active-color="#13ce66" inactive-color="#ff4949">
  190. </el-switch>
  191. </template>
  192. </el-table-column>
  193. <el-table-column label="操作">
  194. <template slot-scope="scope">
  195. <a id="NF-Delete" authorize="yes" class="btn btn-primary" v-on:click="handleDelete(scope.$index, scope.row)"><i class="fa fa-trash-o"></i>删除</a>
  196. @*<el-button size="mini" type="danger" v-on:click="handleDelete(scope.$index, scope.row)">删除</el-button>*@
  197. </template>
  198. </el-table-column>
  199. </el-table>
  200. </el-col>
  201. @*<el-col :span="2">
  202. &nbsp; &nbsp;
  203. </el-col>*@
  204. </el-row>
  205. </el-form>
  206. </template>
  207. </div>
  208. </form>
  209. <script type="text/javascript">
  210. //const { Console } = require("node:console");
  211. var Muser = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
  212. var date = GetDate();
  213. var CurrentRow = 0;
  214. var vm = new Vue({
  215. el: '#app',
  216. data: {
  217. id:'',
  218. userCode: "",
  219. ssList: [],
  220. dataSourceType: [],
  221. dataSourceUom: [],
  222. dataSourceListCode: [],
  223. dataSourceAql: [],
  224. dataSourceDevice: [],
  225. form: {},
  226. detail: {
  227. key: 0,
  228. ListCode: '',
  229. ListName:'',
  230. SetValueMin: 0,
  231. SetValueMax: 0,
  232. SampleQuantity: 0,
  233. Unit: '',
  234. Enable:true,
  235. EATTRIBUTE1: '',
  236. //EATTRIBUTE2: '',
  237. //EATTRIBUTE3: '',
  238. EATTRIBUTE4: '',
  239. EATTRIBUTE5: '',
  240. EATTRIBUTE6: '',
  241. EATTRIBUTE7: '',
  242. },
  243. dataSource4Detail: [],
  244. disabled4SetValue: false,
  245. currentRow: null,
  246. rules: {
  247. GroupCode: [{ required: true, message: '请输入', trigger: 'blur' },],
  248. GroupName: [{ required: true, message: '请输入', trigger: 'blur' },],
  249. },
  250. disabled4RulesCode:false,
  251. },
  252. //挂在DOM 触发
  253. mounted() {
  254. let reactiveObject = {
  255. GroupCode: '',
  256. GroupName: '',
  257. Enable: true,
  258. DetailList: [],
  259. };
  260. this.form = reactiveObject;
  261. // this.loadGrid();
  262. // this.show();
  263. this.id = '@ViewData["ids"]';
  264. this.initControl();
  265. this.getType();
  266. this.getListCode();
  267. this.getUom();
  268. this.getDevice();
  269. this.getAql();
  270. // console.log(this.id);
  271. },
  272. beforeDestroy() {
  273. // this.autoScrol1(true);
  274. },
  275. methods: {
  276. initControl: function () {
  277. let that = this;
  278. let orgName = '';
  279. this.disabled4RulesCode = this.id ? true : false;
  280. let userName = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserName';
  281. // console.log(userName);
  282. this.getData();
  283. },
  284. //change4EATTRIBUTE6(val) {
  285. // debugger;
  286. // console.log(val);
  287. // let currentSelect = this.dataSourceType.filter(x => x.Code == val)[0];
  288. // console.log(currentSelect);
  289. // if (currentSelect)
  290. // this.disabled4SetValue = currentSelect.Name == "尺寸" ? false : true;
  291. // else {
  292. // this.disabled4SetValue = true;
  293. // }
  294. //},
  295. getData() {
  296. if (!this.id) return;
  297. axios
  298. .get('/DHAY/IQCQuality/GetGroup?keyValue=' + this.id)
  299. .then(function (res) {
  300. // console.log(res.data);
  301. //this.ssList = res.data;
  302. //if (res.data != null) {
  303. // res.data.forEach(function (el, i) {
  304. // Vue.set(vm.ssList, i, el)
  305. // });
  306. //}
  307. debugger;
  308. if (res.data) {
  309. for (var i in res.data) {
  310. Vue.set(vm.form, i, res.data[i]);
  311. }
  312. res.data.DetailList.forEach(function (el, i) {
  313. debugger;
  314. if (el.EATTRIBUTE4 == "true") {
  315. el.EATTRIBUTE4 = true;
  316. }
  317. else
  318. {
  319. el.EATTRIBUTE4 = false;
  320. }
  321. if (el.Enable == "1") {
  322. el.Enable = true;
  323. }
  324. else {
  325. el.Enable = false;
  326. }
  327. Vue.set(vm.dataSource4Detail, i, el)
  328. });
  329. }
  330. })
  331. .catch(function (error) { // 请求失败处理
  332. alert(error);
  333. });
  334. },
  335. getType() {
  336. axios
  337. .get('/WMS/BasicSettings/GetICSType?Type=EATTRIBUTE6&TableCode=ICSInspectionList')
  338. .then(function (res) {
  339. if (res.data) {
  340. res.data.forEach(function (el, i) {
  341. Vue.set(vm.dataSourceType, i, el)
  342. });
  343. }
  344. })
  345. .catch(function (error) { // 请求失败处理
  346. alert(error);
  347. });
  348. },
  349. getListCode() {
  350. axios
  351. .get('/WMS/BasicSettings/GetInspectListCode')
  352. .then(function (res) {
  353. if (res.data) {
  354. res.data.forEach(function (el, i) {
  355. Vue.set(vm.dataSourceListCode, i, el)
  356. });
  357. }
  358. })
  359. .catch(function (error) { // 请求失败处理
  360. alert(error);
  361. });
  362. },
  363. getAql() {
  364. axios
  365. .get('/DHAY/IQCQuality/GetICSAql')
  366. .then(function (res) {
  367. if (res.data) {
  368. res.data.forEach(function (el, i) {
  369. Vue.set(vm.dataSourceAql, i, el)
  370. });
  371. }
  372. })
  373. .catch(function (error) { // 请求失败处理
  374. alert(error);
  375. });
  376. },
  377. getUom() {
  378. axios
  379. .get('/WMS/BasicSettings/GetUom')
  380. .then(function (res) {
  381. if (res.data) {
  382. res.data.forEach(function (el, i) {
  383. Vue.set(vm.dataSourceUom, i, el)
  384. });
  385. }
  386. })
  387. .catch(function (error) { // 请求失败处理
  388. alert(error);
  389. });
  390. },
  391. getDevice() {
  392. axios
  393. .get('/WMS/BasicSettings/GetDevice')
  394. .then(function (res) {
  395. if (res.data) {
  396. res.data.forEach(function (el, i) {
  397. Vue.set(vm.dataSourceDevice, i, el)
  398. });
  399. }
  400. })
  401. .catch(function (error) { // 请求失败处理
  402. alert(error);
  403. });
  404. },
  405. // 【新增】检验项目代码模糊查询方法
  406. filterListCode(inputVal, index) {
  407. const row = this.dataSource4Detail[index];
  408. if (!inputVal) {
  409. // 输入为空时,显示所有原始选项
  410. row.filteredListCode = null;
  411. return;
  412. }
  413. // 模糊查询:输入值匹配 编码(Code)或 名称(Name),不区分大小写
  414. row.filteredListCode = this.dataSourceListCode.filter(item =>
  415. item.Code.toLowerCase().includes(inputVal.toLowerCase()) ||
  416. item.Name.toLowerCase().includes(inputVal.toLowerCase())
  417. );
  418. },
  419. // 【新增】检验仪器模糊查询方法
  420. filterDevice(inputVal, index) {
  421. const row = this.dataSource4Detail[index];
  422. if (!inputVal) {
  423. // 输入为空时,显示所有原始选项
  424. row.filteredDevice = null;
  425. return;
  426. }
  427. // 模糊查询:输入值匹配检验仪器名称(Name),不区分大小写
  428. row.filteredDevice = this.dataSourceDevice.filter(item =>
  429. item.Name.toLowerCase().includes(inputVal.toLowerCase())
  430. );
  431. },
  432. // 【新增】AQL代码模糊查询方法
  433. filterAqlCode(inputVal, index) {
  434. const row = this.dataSource4Detail[index];
  435. if (!inputVal) {
  436. // 输入为空时,显示所有原始选项
  437. row.filteredAqlCode = null;
  438. return;
  439. }
  440. // 模糊查询:输入值匹配 AQL代码(Code)或 名称(Name),不区分大小写
  441. row.filteredAqlCode = this.dataSourceAql.filter(item =>
  442. item.Code.toLowerCase().includes(inputVal.toLowerCase())
  443. );
  444. },
  445. addLine() {
  446. // 不修改原数组的情况下获取最大key
  447. let maxKey = 0;
  448. if (this.dataSource4Detail.length > 0) {
  449. // 使用reduce替代sort来获取最大key,避免改变原数组顺序
  450. maxKey = this.dataSource4Detail.reduce((max, item) => {
  451. return item.key > max ? item.key : max;
  452. }, 0);
  453. }
  454. let obj = {
  455. key: maxKey + 1, // 确保key始终递增
  456. ListCode: '',
  457. ListName: '', // 注意修正了拼写错误
  458. SetValueMin: 0,
  459. SetValueMax: 0,
  460. SampleQuantity: 0,
  461. Unit: '',
  462. Enable: true,
  463. EATTRIBUTE1: '',
  464. //EATTRIBUTE2: '',
  465. //EATTRIBUTE3: '',
  466. EATTRIBUTE4: true,
  467. EATTRIBUTE5: '',
  468. EATTRIBUTE6: '',
  469. EATTRIBUTE7: '',
  470. filteredListCode: null, // 【新增】过滤后的选项临时存储字段
  471. filteredDevice: null, // 检验仪器过滤字段(原有)
  472. filteredAqlCode: null // 【新增】AQL代码过滤字段
  473. };
  474. this.dataSource4Detail.push(obj);
  475. },
  476. //删除行
  477. handleDelete(index, row) {
  478. // console.log(index, row);
  479. this.dataSource4Detail = this.dataSource4Detail.filter(x => x.key != row.key);
  480. },
  481. //选中行变化
  482. handleCurrentChange(val) {
  483. this.currentRow = val;
  484. // console.log(val);
  485. },
  486. CurrentRowClick(row, column, event) {
  487. CurrentRow = row.key;
  488. },
  489. CurrentCellClick(row, column, event) {
  490. CurrentRow = row.key;
  491. },
  492. ListCodeChange(val, index) {
  493. // 如果未选择值则清空名称
  494. if (!val) {
  495. this.dataSource4Detail[index].ListName = '';
  496. return;
  497. }
  498. axios
  499. .get('/WMS/BasicSettings/GetListName?ListCode=' + val)
  500. .then(function (res) {
  501. if (res.data && res.data[0].ListName) {
  502. // 填充当前行的检验项目名称
  503. vm.dataSource4Detail[index].ListName = res.data[0].ListName;
  504. } else {
  505. // 未找到对应名称时清空
  506. vm.dataSource4Detail[index].ListName = '';
  507. }
  508. })
  509. .catch(function (error) {
  510. alert('获取检验项目名称失败:' + error);
  511. });
  512. },
  513. submitCheck() {
  514. debugger;
  515. this.dataSource4Detail = this.dataSource4Detail.sort((a, b) => a.SetValueMin - b.SetValueMin);
  516. if (this.dataSource4Detail.length == 0) {
  517. $.modalMsg("必须存在规则信息行", "warning");
  518. return false;
  519. }
  520. let allNum = [];
  521. //debugger;
  522. for (var i = 0; i < this.dataSource4Detail.length; i++) {
  523. let item = this.dataSource4Detail[i];
  524. if(item.Enable == true)
  525. {
  526. debugger;
  527. if (item.EATTRIBUTE5=="")
  528. {
  529. $.modalMsg("当启用时,AQL值必选必填,行号 " + (i + 1), "warning");
  530. return false;
  531. }
  532. }
  533. if (item.EATTRIBUTE6 == '') {
  534. $.modalMsg("第" + (i + 1)+"行检验类型不能为空!", "warning");
  535. return false;
  536. }
  537. if (item.ListCode == '') {
  538. $.modalMsg("第" + (i + 1) + "行检验项目代码不能为空!", "warning");
  539. return false;
  540. }
  541. if (item.EATTRIBUTE6 == "Size") {
  542. if ( item.SetValueMax==='' || item.SetValueMin==='') {
  543. $.modalMsg("当属性为定量时,最大值最小值单位必填,行号 " + (i + 1), "warning");
  544. return false;
  545. }
  546. // 2. 额外校验:必须是有效数字(避免输入字母、符号等)
  547. const minNum = Number(item.SetValueMin);
  548. const maxNum = Number(item.SetValueMax);
  549. if (isNaN(minNum) || isNaN(maxNum)) {
  550. $.modalMsg("当属性为定量时,最大值最小值必须为有效数字,行号 " + (i + 1), "warning");
  551. return false;
  552. }
  553. if (item.SetValueMin != 0 || item.SetValueMax != 0) {
  554. if (item.SetValueMin >= item.SetValueMax) {
  555. $.modalMsg("下限必须小于上限,行号 " + (i + 1), "warning");
  556. return false;
  557. }
  558. }
  559. if (item.Unit == '' || item.EATTRIBUTE7 == '') {
  560. $.modalMsg("当属性为定量时,单位与检验仪器必填,行号 " + (i + 1), "warning");
  561. return false;
  562. }
  563. }
  564. if (item.EATTRIBUTE6 == "Size") {
  565. }
  566. else {
  567. item.SetValueMax = null;
  568. item.SetValueMin = null;
  569. }
  570. //let item = this.dataSource4Detail[i];
  571. //if (item.SetValueMin >= item.SetValueMax) {
  572. // $.modalMsg("下限必须小于上限,行号 "+(i+1), "warning");
  573. // return false;
  574. //}
  575. allNum.push(item.SetValueMin);
  576. allNum.push(item.SetValueMax);
  577. }
  578. //for (var i = 0; i < allNum.length; i++) {
  579. // if (i == 0) {
  580. // continue;
  581. // }
  582. // if (i <= allNum.length - 1) {
  583. // if (allNum[i - 1] >= allNum[i]) {
  584. // $.modalMsg("区间范围重复,重复值: " + allNum[i - 1], "warning");
  585. // return false;
  586. // }
  587. // }
  588. //}
  589. this.form.DetailList = this.dataSource4Detail;
  590. this.$refs['form'].validate((valid) => {
  591. if (valid) {
  592. //alert('submit!');
  593. $.submitForm({
  594. url: "/DHAY/IQCQuality/SaveCheckGroup",
  595. param: { keyValue: JSON.stringify(this.form) },
  596. success: function () {
  597. $.currentWindow().$("#gridList").trigger("reloadGrid");
  598. }
  599. })
  600. } else {
  601. console.log('error submit!!');
  602. return false;
  603. }
  604. });
  605. // console.log(result);
  606. },
  607. },
  608. });
  609. function submitForm() {
  610. //debugger;
  611. vm.submitCheck();
  612. //if (!$('#form1').formValid()) {
  613. // $.modalMsg("验证未通过", "warning");
  614. // return false;
  615. //}
  616. //let obj = {
  617. // CheckFixtureNo: $("#F_CheckFixtureNo").val(),
  618. // CheckFixtureName: $("#F_CheckFixtureName").val(),
  619. // CustomerItemCode: $("#F_CustomerItemCode").val(),
  620. // ID: $("#ids").val(),
  621. // Useage: $("#F_Useage").val(),
  622. // Unit: $("#F_Unit").val(),
  623. // Remark: $("#F_Remark").val(),
  624. // Std: $("#F_Std").val(),
  625. //};
  626. ////if (!obj.line) {
  627. //// return false;
  628. ////}
  629. //if (!obj.CheckFixtureNo) {
  630. // return false;
  631. //}
  632. //$.submitForm({
  633. // url: "/DHAY/CheckingFixture/SaveCheckingFixture",
  634. // param: { keyValue: JSON.stringify(obj) },
  635. // success: function () {
  636. // $.currentWindow().$("#gridList").trigger("reloadGrid");
  637. // }
  638. //})
  639. }
  640. function GetDate() {
  641. let currentTime = new Date();
  642. let year = currentTime.getFullYear();
  643. let month = currentTime.getMonth() + 1; // 注意,月份是从0开始的,所以要加1
  644. let date = currentTime.getDate();
  645. let hours = currentTime.getHours();
  646. let minutes = currentTime.getMinutes();
  647. let seconds = currentTime.getSeconds();
  648. // 格式化时间,补全前导零
  649. month = month < 10 ? '0' + month : month;
  650. date = date < 10 ? '0' + date : date;
  651. hours = hours < 10 ? '0' + hours : hours;
  652. minutes = minutes < 10 ? '0' + minutes : minutes;
  653. seconds = seconds < 10 ? '0' + seconds : seconds;
  654. // 拼接时间字符串
  655. let formattedTime = `${year}-${month}-${date} ${hours}:${minutes}:${seconds}`;
  656. return formattedTime;
  657. }
  658. </script>