chemicalAnalysisReport.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. <template>
  2. <div class="examination secondApprove">
  3. <div class="common-head-search">
  4. <el-form :inline="true">
  5. <el-form-item label="样品类型">
  6. <el-select v-model="search.sampleTypeCode" clearable filterable collapse-tags size="small"
  7. style="width: 150px" placeholder="请选择">
  8. <el-option v-for="item in sampleTypeNameType" :key="item.baseCode" :label="item.baseName"
  9. :value="item.baseCode">
  10. </el-option>
  11. </el-select>
  12. </el-form-item>
  13. <el-form-item label="样品名称">
  14. <el-input v-model="search.matName" size="small" placeholder="请输入样品名称" style="width: 150px"
  15. clearable></el-input>
  16. </el-form-item>
  17. <el-form-item label="中心编号">
  18. <el-input v-model="search.sampleNo" size="small" placeholder="请输入中心编号" style="width: 150px"
  19. clearable></el-input>
  20. </el-form-item>
  21. <el-form-item label="委托编号">
  22. <el-input v-model="search.carNo" size="small" placeholder="请输入委托编号" style="width: 150px" clearable></el-input>
  23. </el-form-item>
  24. <el-form-item label="委托日期">
  25. <el-date-picker v-model="search.stateTime[0]" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date"
  26. placeholder="开始日期" size="mini" style="width: 150px">
  27. </el-date-picker>
  28. <span>至</span>
  29. <el-date-picker v-model="search.stateTime[1]" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date"
  30. placeholder="结束日期" size="mini" style="width: 150px">
  31. </el-date-picker>
  32. <!-- <el-date-picker v-model="search.stateTime" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="daterange"
  33. range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" size="mini" style="width: 200px">
  34. </el-date-picker> -->
  35. </el-form-item>
  36. <el-form-item>
  37. <el-button icon="el-icon-search" type="goon" size="mini" :loading="dataLoading"
  38. @click="searchData">查询</el-button>
  39. <el-button icon="el-icon-refresh" type="info" plain size="mini" @click="reset">重置</el-button>
  40. </el-form-item>
  41. </el-form>
  42. </div>
  43. <el-row>
  44. <el-col :span="4">
  45. <div class="common-title-div">
  46. <div class="common-title-name">
  47. <img style="width: 25px; height: 25px" src="../../../assets/img/imgScreen/logo.png" />
  48. <span style="font-size: 15px">物料名称</span>
  49. </div>
  50. </div>
  51. <div class="common-table-div">
  52. <el-table ref="tableMain11" :height="singleTableHeight" v-loading="tableLoading" :data="table.list"
  53. highlight-current-row @row-click="handleCurrentChange" :summary-method="getSummaries"
  54. :header-cell-style="tableHeaderCellStyle" show-summary border style="width: 100%" :icorePanelShown="100"
  55. :icore-filter-flag="icoreFilterFlag">
  56. <el-table-column sortable show-overflow-tooltip align="center" min-width="100" prop="MAT_NAME"
  57. label="物料名称"></el-table-column>
  58. </el-table>
  59. </div>
  60. </el-col>
  61. <el-col :span="20">
  62. <div class="common-title-div">
  63. <div class="common-title-name">
  64. <img style="width: 25px; height: 25px" src="../../../assets/img/imgScreen/logo.png" />
  65. 台账信息
  66. </div>
  67. <div class="common-button-div">
  68. <el-button icon="el-icon-download" type="goon" size="mini" :loading="tableExportLoading"
  69. @click="maintenance">维护上下限</el-button>
  70. <el-button icon="el-icon-download" type="goon" size="mini" :loading="tableExportLoading"
  71. @click="doExport">导出</el-button>
  72. </div>
  73. </div>
  74. <div class="common-table-div" id="topTable">
  75. <el-table ref="el_table_1" border :height="singleTableHeight" width="100%" highlight-current-row
  76. @selection-change="searchFollow" :data="table.list1">
  77. <el-table-column type="selection" width="55" align="center"></el-table-column>
  78. <el-table-column sortable show-overflow-tooltip align="center" width="160" prop="CAR_NO"
  79. label="委托编号"></el-table-column>
  80. <el-table-column sortable show-overflow-tooltip align="center" width="120" prop="SAMPLE_NO"
  81. label="中心编号"></el-table-column>
  82. <el-table-column sortable show-overflow-tooltip align="center" width="120" prop="MAT_NAME"
  83. label="物料名称"></el-table-column>
  84. <el-table-column sortable show-overflow-tooltip align="center" width="120" prop="MEMO"
  85. label="委托备注"></el-table-column>
  86. <el-table-column v-for="col in cols" :prop="col.ANLY_ITEM_NO" show-overflow-tooltip align="center"
  87. :key="col.ANLY_ITEM_NO" :label="col.ANLY_ITEM_NAME">
  88. <template slot-scope="scope">
  89. <span :style="redStyle(scope.row.SA_ID, col.ANLY_ITEM_NO)">{{
  90. scope.row[col.ANLY_ITEM_NO]
  91. }}</span>
  92. </template>
  93. </el-table-column>
  94. <el-table-column sortable show-overflow-tooltip align="center" width="120" prop="UPDATE_TIME"
  95. label="开始时间"></el-table-column>
  96. <el-table-column sortable show-overflow-tooltip align="center" width="120" prop="CREATE_TIME"
  97. label="结束时间"></el-table-column>
  98. </el-table>
  99. </div>
  100. <div class="common-foot-style">
  101. <el-pagination @size-change="pageSizeChange" @current-change="pageCurrentChange" :current-page="page.pageNum"
  102. :page-sizes="[50, 100, 200, 500, 1000]" :page-size="page.pageSize"
  103. layout="total, sizes, prev, pager, next, jumper" :total="page.totalPage" background>
  104. </el-pagination>
  105. </div>
  106. </el-col>
  107. </el-row>
  108. <el-dialog :close-on-click-modal="false" @close="closebatch" width="100%" :visible.sync="recallShow" top="0">
  109. <div slot="title" class="titleBox">
  110. <i class="el-icon-document" style="font-size: 20px"></i>
  111. <span style="margin-left: 10px; font-size: 18px">维护信息</span>
  112. </div>
  113. <div class="common-table-div">
  114. <el-table border ref="dataTable123" :data="recallList" :height="theight2" @selection-change="recallSelection"
  115. highlight-current-row>
  116. <el-table-column type="selection" width="45" align="center"></el-table-column>
  117. <el-table-column show-overflow-tooltip sortable min-width="80" align="center" prop="ANLY_ITEM_NAME"
  118. label="检测项目"></el-table-column>
  119. <el-table-column show-overflow-tooltip sortable min-width="80" align="center" prop="MIN_SIGN" label="下限符号">
  120. <template slot-scope="scope">
  121. <input v-model="scope.row.MIN_SIGN" size="small" @keydown="keyDown($event, scope.row, scope.$index)"
  122. :id="scope.column.id + '--' + scope.$index" @change="inputDataPl($event, scope.$index)" style="
  123. width: 100%;
  124. height: 28px;
  125. line-height: 28px;
  126. border: 0px;
  127. padding-left: 3px;
  128. text-align: center;
  129. font-size: 15px;
  130. " />
  131. </template>
  132. </el-table-column>
  133. <el-table-column show-overflow-tooltip sortable min-width="80" align="center" prop="MIN_VALUE" label="下限值">
  134. <template slot-scope="scope">
  135. <input v-model="scope.row.MIN_VALUE" size="small" @keydown="keyDown($event, scope.row, scope.$index)"
  136. :id="scope.column.id + '--' + scope.$index" @change="inputDataPl($event, scope.$index)"
  137. oninput="value=value.replace(/[^0-9\[.\]{1}-]/g,'')" style="
  138. width: 100%;
  139. height: 28px;
  140. line-height: 28px;
  141. border: 0px;
  142. padding-left: 3px;
  143. text-align: center;
  144. font-size: 15px;
  145. " />
  146. </template>
  147. </el-table-column>
  148. <el-table-column show-overflow-tooltip sortable min-width="80" align="center" prop="MAX_SIGN" label="上限符号">
  149. <template slot-scope="scope">
  150. <input v-model="scope.row.MAX_SIGN" size="small" @keydown="keyDown($event, scope.row, scope.$index)"
  151. :id="scope.column.id + '--' + scope.$index" @change="inputDataPl($event, scope.$index)" style="
  152. width: 100%;
  153. height: 28px;
  154. line-height: 28px;
  155. border: 0px;
  156. padding-left: 3px;
  157. text-align: center;
  158. font-size: 15px;
  159. " />
  160. </template>
  161. </el-table-column>
  162. <el-table-column show-overflow-tooltip sortable min-width="80" align="center" prop="MAX_VALUE" label="上限值">
  163. <template slot-scope="scope">
  164. <input v-model="scope.row.MAX_VALUE" size="small" @keydown="keyDown($event, scope.row, scope.$index)"
  165. :id="scope.column.id + '--' + scope.$index" @change="inputDataPl($event, scope.$index)"
  166. oninput="value=value.replace(/[^0-9\[.\]{1}-]/g,'')" style="
  167. width: 100%;
  168. height: 28px;
  169. line-height: 28px;
  170. border: 0px;
  171. padding-left: 3px;
  172. text-align: center;
  173. font-size: 15px;
  174. " />
  175. </template>
  176. </el-table-column>
  177. </el-table>
  178. </div>
  179. <span slot="footer" class="dialog-footer">
  180. <el-button type="goon" size="mini" icon="el-icon-check" :loading="batchLoading"
  181. @click="determineList()">确认</el-button>
  182. <el-button size="mini" type="goon" icon="el-icon-remove-outline" @click="closebatch">取消</el-button>
  183. </span>
  184. </el-dialog>
  185. </div>
  186. </template>
  187. <script>
  188. import { getCookie, formatDate } from "@/utils/util.js";
  189. import { cookieUserId, cookieUserName } from "@/config/config.js";
  190. import { exportToExcel } from "../../../utils/utils.js";
  191. let userName = getCookie(cookieUserName);
  192. let userId = getCookie(cookieUserId);
  193. export default {
  194. data() {
  195. return {
  196. search: {
  197. sampleTypeCode: "",
  198. sampleNo: "",
  199. carNo: "",
  200. matName: "",
  201. stateTime: [],
  202. },
  203. dataLoading: false,
  204. dataLoading1: false,
  205. sampleTypeNameType: [], //样品类型
  206. saveMainData: [], //勾选数据
  207. tableList: {},
  208. table: {
  209. list: [],
  210. list1: [],
  211. },
  212. page: {
  213. pageNum: 1,
  214. pageSize: 100,
  215. totalPage: 0,
  216. },
  217. cols: ["无"],
  218. redDataCk: [], //显红的数据
  219. singleTableHeight: 600,
  220. icoreFilterFlag: true,
  221. tableLoading: false,
  222. tableExportLoading: false,
  223. batchLoading: false,
  224. recallShow: false,
  225. recallList: [],
  226. theight2: 0,
  227. recallSelectionList: [],
  228. };
  229. },
  230. created() {
  231. this.singleTableHeight = window.innerHeight - 190;
  232. this.theight2 = window.innerHeight - 180;
  233. let aaa = new Date();
  234. let bbb = new Date().getTime() - 60000 * 60 * 24 * 7;
  235. aaa.setTime(bbb);
  236. this.search.stateTime = [this.getYNM(aaa), this.getYNM(new Date())];
  237. },
  238. mounted() {
  239. this.axios
  240. .post(
  241. "pass/baseManagement/v1/limsbaseinfos/queryBaseInfoByBaseCode",
  242. { validFlag: 1, baseCode: 4801 },
  243. { individualType: "json" }
  244. )
  245. .then((res) => {
  246. this.sampleTypeNameType = res.data;
  247. });
  248. },
  249. methods: {
  250. getYNM(date) {
  251. let year = date.getFullYear().toString();
  252. let month = date.getMonth() + 1;
  253. let day = date.getDate();
  254. month = month < 10 ? "0" + month : month;
  255. day = day < 10 ? "0" + day : day;
  256. return `${year}-${month}-${day}`;
  257. },
  258. mainData() {
  259. this.page.pageNum = 1;
  260. this.page.pageSize = 100;
  261. this.searchData();
  262. },
  263. searchFollow(val) {
  264. this.saveMainData = val;
  265. },
  266. searchData1() {
  267. let startTime = "";
  268. let endTime = "";
  269. if (!this.search.stateTime) {
  270. } else {
  271. startTime = this.search.stateTime[0];
  272. endTime = this.search.stateTime[1];
  273. }
  274. let obj = {
  275. matName: this.search.matName,
  276. sampleTypeCode: this.search.sampleTypeCode,
  277. sampleNo: this.search.sampleNo,
  278. carNo: this.search.carNo,
  279. stateFlag: 1,
  280. validFlag: 1,
  281. startTime: startTime,
  282. endTime: endTime,
  283. };
  284. if (this.tableList.MAT_NO != null) {
  285. this.searchData()
  286. } else {
  287. this.dataLoading = true;
  288. this.axios
  289. .post(
  290. "pass/baseManagement/v1/limssamplereleases/queryParameterMatName",
  291. obj,
  292. { individualType: "json" }
  293. )
  294. .then((res) => {
  295. if (res.code == 0 || res.code == 200) {
  296. this.table.list = res.data;
  297. } else {
  298. this.$message.error(res.message);
  299. }
  300. this.dataLoading = false;
  301. })
  302. .catch((err) => {
  303. this.dataLoading = false;
  304. this.$message.error(err.message);
  305. });
  306. }
  307. },
  308. searchData() {
  309. let startTime = "";
  310. let endTime = "";
  311. if (!this.search.stateTime) {
  312. } else {
  313. startTime = this.search.stateTime[0];
  314. endTime = this.search.stateTime[1];
  315. }
  316. let obj = {
  317. sampleTypeCode: this.search.sampleTypeCode,
  318. sampleNo: this.search.sampleNo,
  319. carNo: this.search.carNo,
  320. pageIndex: this.page.pageNum,
  321. pageSize: this.page.pageSize,
  322. stateFlag: 1,
  323. validFlag: 1,
  324. startTime: startTime,
  325. endTime: endTime,
  326. matName: this.search.matName
  327. };
  328. this.dataLoading = true;
  329. this.axios
  330. .post("pass/baseManagement/v1/limssamplereleases/queryParameter", obj, {
  331. individualType: "json",
  332. })
  333. .then((res) => {
  334. if (res.code == 0 || res.code == 200) {
  335. if (res.data.head[0] != null) {
  336. this.cols = res.data.head;
  337. } else {
  338. this.cols = [];
  339. }
  340. this.table.list1 = res.data.badyData.list;
  341. if (this.table.list1 != null && this.table.list1.length > 0) {
  342. this.table.list = res.data.badyData.list[0].sampleResults
  343. } else {
  344. this.table.list = []
  345. }
  346. this.page.totalPage = res.data.badyData.total;
  347. this.redDataCk = res.data.redMap || {};
  348. } else {
  349. this.$message.error(res.message);
  350. }
  351. this.dataLoading = false;
  352. })
  353. .catch((err) => {
  354. this.dataLoading = false;
  355. this.$message.error(err.message);
  356. });
  357. },
  358. closebatch() {
  359. this.recallShow = false;
  360. this.recallList = [];
  361. },
  362. recallSelection(val) {
  363. this.recallSelectionList = val;
  364. },
  365. determineList() {
  366. if (this.recallSelectionList.length < 1) {
  367. this.$message.warning("请勾选要确定的数据!");
  368. return;
  369. }
  370. let arr = [];
  371. this.saveMainData.forEach((s) => {
  372. arr.push(s.SA_ID);
  373. });
  374. let obj = {
  375. list: arr,
  376. map: this.recallSelectionList,
  377. };
  378. this.batchLoading = true;
  379. this.axios
  380. .post(
  381. "pass/baseManagement/v1/limssamplereleaseds/updateLimsSampleReleaseD",
  382. obj,
  383. { individualType: "json" }
  384. )
  385. .then((res) => {
  386. if (res.code == 0 || res.code == 200) {
  387. this.closebatch();
  388. this.$message.success("维护成功!");
  389. this.searchData();
  390. } else {
  391. this.$message.error(res.message);
  392. }
  393. this.batchLoading = false;
  394. })
  395. .catch((err) => {
  396. this.batchLoading = false;
  397. this.$message.error(err.message);
  398. });
  399. },
  400. maintenance() {
  401. if (this.saveMainData.length < 1) {
  402. this.$message.warning("请先选择一个需要维护的数据!");
  403. return;
  404. }
  405. let arr = [];
  406. this.saveMainData.forEach((s) => {
  407. arr.push(s.SA_ID);
  408. });
  409. this.tableExportLoading = true;
  410. this.axios
  411. .post(
  412. "pass/baseManagement/v1/limssamplereleaseds/maintenanceList",
  413. arr,
  414. { individualType: "json" }
  415. )
  416. .then((res) => {
  417. if (res.code == 0 || res.code == 200) {
  418. this.recallList = res.data;
  419. this.recallShow = true;
  420. } else {
  421. this.$message.error(res.message);
  422. }
  423. this.tableExportLoading = false;
  424. })
  425. .catch((err) => {
  426. this.tableExportLoading = false;
  427. this.$message.error(err.message);
  428. });
  429. },
  430. // 导出
  431. doExport() {
  432. // if (this.table.list1.length === 0) {
  433. // this.$message.warning("表格无数据不能导出");
  434. // return true;
  435. // }
  436. if (this.saveMainData.length < 1) {
  437. this.$message.warning("表格无数据不能导出");
  438. return;
  439. }
  440. this.tableExportLoading = true;
  441. let tHeader = [];
  442. let filterVal = [];
  443. tHeader = [
  444. "委托编号",
  445. "中心编号",
  446. "物料名称",
  447. "委托备注",
  448. "开始时间",
  449. "结束时间",
  450. ];
  451. filterVal = [
  452. "CAR_NO",
  453. "SAMPLE_NO",
  454. "MAT_NAME",
  455. "MEMO",
  456. "UPDATE_TIME",
  457. "CREATE_TIME",
  458. ];
  459. this.cols.forEach((s) => {
  460. tHeader.push(s.ANLY_ITEM_NAME);
  461. filterVal.push(s.ANLY_ITEM_NO);
  462. });
  463. exportToExcel(
  464. this.saveMainData,
  465. tHeader,
  466. filterVal,
  467. "台账信息",
  468. [],
  469. [],
  470. []
  471. );
  472. // setTimeout(() => {
  473. // setTimeout(() => {
  474. // setTimeout(() => {
  475. this.tableExportLoading = false;
  476. // this.doExport2();
  477. // }, 0);
  478. // }, 0);
  479. // }, 0);
  480. },
  481. doExport2() {
  482. this.$nextTick(() => {
  483. let table = document.querySelector("#topTable .el-table");
  484. let header = document.querySelector(
  485. "#topTable .el-table .el-table__header"
  486. );
  487. let body = document.querySelector(
  488. "#topTable .el-table .el-table__body"
  489. );
  490. let oTd = document.querySelectorAll("#topTable .el-table td");
  491. let oTh = document.querySelectorAll("#topTable .el-table th");
  492. header.border = "1";
  493. body.border = "1";
  494. for (let item of Array.from(oTd)) {
  495. item.style.height = "27px";
  496. }
  497. for (let item of Array.from(oTh)) {
  498. item.style.height = "27px";
  499. }
  500. let ex =
  501. '<th class="gutter" align= "left" style="width: 10px; height: 27px;"></th>';
  502. let ex2 =
  503. '<th class="gutter" align= "left" style="width: 0px; height: 27px;"></th>';
  504. ex = new RegExp(ex, "g").test(table.outerHTML) ? ex : ex2;
  505. let bd = table.outerHTML.replace(new RegExp(ex, "g"), "");
  506. bd = bd.replace("正在整理数据", "");
  507. let html =
  508. '<html><head><meta charset="utf-8" /></head><body>' +
  509. bd +
  510. "</body></html>";
  511. let blob = new Blob([html], { type: "application/vnd.ms-excel" });
  512. let link = document.createElement("a");
  513. link.download = "台账信息.xls";
  514. link.href = URL.createObjectURL(blob);
  515. link.click();
  516. header.border = "0";
  517. body.border = "0";
  518. for (let item of Array.from(oTd)) {
  519. item.style.height = "";
  520. }
  521. for (let item of Array.from(oTh)) {
  522. item.style.height = "";
  523. }
  524. });
  525. },
  526. handleCurrentChange(row) {
  527. this.search.matName = row.MAT_NAME;
  528. this.searchData();
  529. },
  530. tableHeaderCellStyle() {
  531. return "color: rgb(255,255,255);border-bottom: 1px solid #DCDFE7;";
  532. },
  533. pageSizeChange(size) {
  534. this.page.pageSize = size;
  535. this.searchData();
  536. },
  537. pageCurrentChange(index) {
  538. this.page.pageNum = index;
  539. this.searchData();
  540. },
  541. reset() {
  542. this.search = {};
  543. let aaa = new Date();
  544. let bbb = new Date().getTime() - 60000 * 60 * 24 * 7;
  545. aaa.setTime(bbb);
  546. this.search.stateTime = [this.getYNM(aaa), this.getYNM(new Date())];
  547. this.tableList = {}
  548. this.table.list = []
  549. this.table.list1 = []
  550. this.searchData();
  551. },
  552. getSummaries(param) {
  553. const { columns, data } = param;
  554. const sums = [];
  555. columns.forEach((column, index) => {
  556. if (index === 0) {
  557. sums[index] = "合计:" + data.length;
  558. }
  559. });
  560. return sums;
  561. },
  562. handleInput(val, index, prop) {
  563. let regex = /^>=?$/;
  564. let newValue = val;
  565. if (regex.test(newValue)) {
  566. this.recallList[index][prop] = newValue;
  567. } else {
  568. this.recallList[index][prop] = "";
  569. }
  570. },
  571. inputDataPl(val, index) {
  572. this.$refs.dataTable123.toggleRowSelection(this.recallList[index], true);
  573. },
  574. keyDown(event, row, rindex) {
  575. let tdTarget = event.target;
  576. let pid = tdTarget.id;
  577. if (!pid) {
  578. return true;
  579. }
  580. let ids = pid.split("--");
  581. if (ids.length != 2) {
  582. return true;
  583. }
  584. let columnId = ids[0];
  585. let index = ids[1];
  586. let that = this;
  587. while (tdTarget.tagName !== "TD") {
  588. tdTarget = tdTarget.parentElement;
  589. }
  590. // if (event.keyCode === 13) {
  591. // this.jisuanRow(row, rindex)
  592. // }
  593. // 如果按下键盘下键或者回车键
  594. if (event.keyCode === 40 || event.keyCode === 13) {
  595. let ind = Number(index) + 1;
  596. let id = "#" + columnId + "--" + ind;
  597. let input = $(id);
  598. if (input) {
  599. // this.$refs.tablePllr.setCurrentRow(this.tableData[ind])
  600. input.focus();
  601. input.select(); // 选中内容
  602. event.stopPropagation();
  603. event.stopImmediatePropagation();
  604. event.preventDefault();
  605. return false;
  606. }
  607. } else if (event.keyCode === 38) {
  608. // 键盘上键
  609. let ind = Number(index) - 1;
  610. let id = "#" + columnId + "--" + ind;
  611. let input = $(id);
  612. if (input) {
  613. // this.$refs.tablePllr.setCurrentRow(this.tableData[ind])
  614. input.focus();
  615. input.select(); // 选中内容
  616. event.stopPropagation();
  617. event.stopImmediatePropagation();
  618. event.preventDefault();
  619. return false;
  620. }
  621. } else if (event.keyCode === 37) {
  622. // 键盘左键
  623. let input =
  624. $(tdTarget).prev().find("input") &&
  625. $(tdTarget).prev().find("input")[0];
  626. if (input) {
  627. input.focus();
  628. input.select(); // 选中内容
  629. event.stopPropagation();
  630. event.stopImmediatePropagation();
  631. event.preventDefault();
  632. return false;
  633. }
  634. } else if (event.keyCode === 39) {
  635. // 键盘右键
  636. let input = $(tdTarget).next().find("input")[0];
  637. if (input) {
  638. input.focus();
  639. input.select(); // 选中内容
  640. event.stopPropagation();
  641. event.stopImmediatePropagation();
  642. event.preventDefault();
  643. return false;
  644. }
  645. }
  646. },
  647. redStyle(stId, anlyNo) {
  648. let arr = this.redDataCk[stId];
  649. if (!arr || arr.length < 1) {
  650. return {};
  651. }
  652. let obj = arr.find((ii) => ii == anlyNo);
  653. if (obj) {
  654. return { color: "red" };
  655. } else {
  656. return {};
  657. }
  658. },
  659. },
  660. };
  661. </script>
  662. <style scoped></style>