containerDetail.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964
  1. <template>
  2. <div>
  3. <transition appear enter-active-class="animated fadeIn">
  4. <q-table
  5. class="my-sticky-header-column-table shadow-24"
  6. :data="table_list"
  7. row-key="id"
  8. :separator="separator"
  9. :loading="loading"
  10. :columns="columns"
  11. hide-bottom
  12. :pagination.sync="pagination"
  13. no-data-label="No data"
  14. no-results-label="No data you want"
  15. :table-style="{ height: height }"
  16. flat
  17. bordered
  18. >
  19. <template v-slot:header-cell="props">
  20. <q-th :props="props" @dblclick="handleHeaderDblClick(props.col)">
  21. <!-- 为特定列添加下拉选择器 -->
  22. <template v-if="['status'].includes(props.col.name)">
  23. <q-select
  24. dense
  25. outlined
  26. v-model="filterModels[props.col.name]"
  27. :options="getFilterOptions(props.col.name)"
  28. option-label="label"
  29. option-value="value"
  30. emit-value
  31. map-options
  32. clearable
  33. @input="handleFilterChange"
  34. style="min-width: 120px"
  35. >
  36. <template v-slot:prepend>
  37. <span class="text-caption">{{ props.col.label }}</span>
  38. </template>
  39. </q-select>
  40. </template>
  41. <template v-else>
  42. {{ props.col.label }}
  43. </template>
  44. </q-th>
  45. </template>
  46. <template v-slot:top>
  47. <q-btn-group push>
  48. <q-btn :label="$t('refresh')" icon="refresh" @click="reFresh()">
  49. <q-tooltip
  50. content-class="bg-amber text-black shadow-4"
  51. :offset="[10, 10]"
  52. content-style="font-size: 12px"
  53. >{{ $t("refreshtip") }}</q-tooltip
  54. >
  55. </q-btn>
  56. <!-- <q-btn :label="'日志'" icon="logout" @click="getlog()"> </q-btn> -->
  57. </q-btn-group>
  58. <q-space />
  59. <div class="flex items-center">
  60. <div class="q-mr-md">{{ $t("download_center.createTime") }}</div>
  61. <q-input
  62. readonly
  63. outlined
  64. dense
  65. v-model="createDate2"
  66. :placeholder="interval"
  67. >
  68. <template v-slot:append>
  69. <q-icon name="event" class="cursor-pointer">
  70. <q-popup-proxy
  71. ref="qDateProxy"
  72. transition-show="scale"
  73. transition-hide="scale"
  74. >
  75. <q-date v-model="createDate1" range>
  76. <div class="row items-center justify-end q-gutter-sm">
  77. <q-btn
  78. :label="$t('index.cancel')"
  79. color="primary"
  80. flat
  81. v-close-popup
  82. />
  83. <q-btn
  84. :label="$t('index.clear')"
  85. color="primary"
  86. @click="
  87. createDate2 = '';
  88. createDate1 = '';
  89. "
  90. v-close-popup
  91. />
  92. </div>
  93. </q-date>
  94. </q-popup-proxy>
  95. </q-icon>
  96. </template>
  97. </q-input>
  98. <q-btn-group push class="q-ml-md"> </q-btn-group>
  99. <q-input
  100. outlined
  101. rounded
  102. dense
  103. debounce="300"
  104. color="primary"
  105. v-model="filter"
  106. :placeholder="$t('search')"
  107. @input="getSearchList()"
  108. @keyup.enter="getSearchList()"
  109. >
  110. <template v-slot:append>
  111. <q-icon name="search" @click="getSearchList()" />
  112. </template>
  113. </q-input>
  114. </div>
  115. </template>
  116. <template v-slot:body="props">
  117. <q-tr :props="props" :style="getRowStyle(props.row)">
  118. <q-td
  119. v-for="col in columns.filter((c) => c.name !== 'expand')"
  120. :key="col.name"
  121. :props="props"
  122. >
  123. <span v-if="col.name === 'status'">
  124. {{ checkStatusToText(props.row[col.field]) }}
  125. </span>
  126. <span v-else-if="col.name !== 'status'">
  127. {{ col.field ? props.row[col.field] : props.row[col.name] }}
  128. </span>
  129. </q-td>
  130. <q-td>
  131. <q-btn
  132. size="sm"
  133. round
  134. icon="edit"
  135. @click="handleEditRow(props.row)"
  136. />
  137. <q-tooltip
  138. content-class="bg-amber text-black shadow-4"
  139. :offset="[10, 10]"
  140. content-style="font-size: 12px"
  141. >
  142. {{ "编辑批次" }}
  143. </q-tooltip>
  144. </q-td>
  145. </q-tr>
  146. </template>
  147. </q-table>
  148. </transition>
  149. <q-dialog v-model="editDialog">
  150. <q-card style="width: 700px; max-width: 80vw">
  151. <q-card-section class="row items-center q-pb-none">
  152. <div class="text-h6">编辑批次</div>
  153. <q-space />
  154. <q-btn icon="close" flat round dense v-close-popup />
  155. </q-card-section>
  156. <q-card-section>
  157. <!-- 基础信息组 -->
  158. <q-card-section class="q-pa-none">
  159. <div class="text-subtitle1 q-mb-md">基础信息</div>
  160. <div class="row q-col-gutter-md">
  161. <q-input
  162. class="col-6"
  163. v-model="editForm.bound_number"
  164. label="管理批次"
  165. dense
  166. outlined
  167. />
  168. <q-input
  169. class="col-6"
  170. v-model="editForm.goods_code"
  171. label="存货编码"
  172. dense
  173. outlined
  174. />
  175. <q-input
  176. class="col-6"
  177. v-model="editForm.goods_desc"
  178. label="存货名称"
  179. dense
  180. outlined
  181. />
  182. <q-input
  183. class="col-6"
  184. v-model="editForm.note"
  185. label="备注"
  186. dense
  187. outlined
  188. />
  189. <q-input
  190. class="col-6"
  191. v-model="editForm.goods_qty"
  192. label="扫描数目"
  193. dense
  194. outlined
  195. />
  196. <q-input
  197. class="col-6"
  198. v-model="editForm.goods_out_qty"
  199. label="出库数目"
  200. dense
  201. outlined
  202. />
  203. </div>
  204. </q-card-section>
  205. <!-- 分隔线 -->
  206. <q-separator class="q-my-md" />
  207. <!-- 出入库信息组(只读) -->
  208. <q-card-section class="q-pa-none">
  209. <div class="text-subtitle1 q-mb-md">出入库信息</div>
  210. <div class="row q-col-gutter-md">
  211. <q-input
  212. class="col-6"
  213. v-model="editForm.goods_qty"
  214. label="扫描数目"
  215. dense
  216. outlined
  217. readonly
  218. />
  219. <q-input
  220. class="col-6"
  221. v-model="editForm.goods_out_qty"
  222. label="出库数目"
  223. dense
  224. outlined
  225. readonly
  226. />
  227. <q-input
  228. class="col-12"
  229. v-model="editForm.create_time"
  230. label="创建时间"
  231. dense
  232. outlined
  233. readonly
  234. />
  235. </div>
  236. </q-card-section>
  237. </q-card-section>
  238. <q-card-actions align="right">
  239. <q-btn flat label="取消" color="primary" v-close-popup />
  240. <q-btn flat label="保存" color="primary" @click="saveEditRow" />
  241. </q-card-actions>
  242. </q-card>
  243. </q-dialog>
  244. <template>
  245. <div v-show="max !== 0" class="q-pa-lg flex flex-center">
  246. <div>{{ total }}</div>
  247. <q-pagination
  248. v-model="current"
  249. color="black"
  250. :max="max"
  251. :max-pages="6"
  252. boundary-links
  253. @click="
  254. getSearchList(current);
  255. paginationIpt = current;
  256. "
  257. />
  258. <div>
  259. <input
  260. v-model="paginationIpt"
  261. @blur="changePageEnter"
  262. @keyup.enter="changePageEnter"
  263. style="width: 60px; text-align: center"
  264. />
  265. </div>
  266. </div>
  267. <div v-show="max === 0" class="q-pa-lg flex flex-center">
  268. <q-btn flat push color="dark" :label="$t('no_data')"></q-btn>
  269. </div>
  270. </template>
  271. <containercard
  272. v-if="showInventoryDetails"
  273. ref="containercard"
  274. :container-number="select_container_number"
  275. :container-code="select_container_code"
  276. :key="select_container_number"
  277. @close="showInventoryDetails = false"
  278. />
  279. <q-dialog v-model="checkDialog">
  280. <q-card style="min-width: 350px">
  281. <q-card-section>
  282. <div class="text-h6">输入抽检托盘数量</div>
  283. </q-card-section>
  284. <q-card-section class="q-pt-none">
  285. <q-input
  286. dense
  287. v-model="checkQuantity"
  288. autofocus
  289. label="抽检托盘数量"
  290. type="number"
  291. min="1"
  292. :rules="[(val) => val > 0 || '必须输入大于0的数值']"
  293. @keyup.enter="confirmCheck"
  294. />
  295. </q-card-section>
  296. <q-card-actions align="right" class="text-primary">
  297. <q-btn flat label="取消" v-close-popup />
  298. <q-btn flat label="确定" @click="confirmCheck" />
  299. </q-card-actions>
  300. </q-card>
  301. </q-dialog>
  302. </div>
  303. </template>
  304. <router-view />
  305. <script>
  306. import { getauth, postauth, putauth } from "boot/axios_request";
  307. import { date, LocalStorage } from "quasar";
  308. import containercard from "components/containercard.vue";
  309. export default {
  310. name: "PageTask",
  311. components: {
  312. containercard,
  313. },
  314. data() {
  315. return {
  316. createDate1: "",
  317. createDate2: "",
  318. date_range: "",
  319. proxyDate: "",
  320. date: "",
  321. goods_code: "",
  322. goods_desc: "",
  323. openid: "",
  324. login_name: "",
  325. authin: "0",
  326. searchUrl: "",
  327. pathname: "container/detail/",
  328. pathname_previous: "",
  329. pathname_next: "",
  330. separator: "cell",
  331. loading: false,
  332. height: "",
  333. viewForm: false,
  334. editDialog: false,
  335. table_list: [],
  336. columns: [
  337. {
  338. name: "id",
  339. label: "序号",
  340. field: "id",
  341. align: "left",
  342. headerStyle: "width: 50px",
  343. },
  344. {
  345. name: "status",
  346. label: "状态",
  347. field: "status",
  348. align: "center",
  349. headerStyle: "width: 50px",
  350. },
  351. {
  352. name: "bound_number",
  353. label: "管理批次",
  354. align: "center",
  355. field: "bound_number",
  356. },
  357. {
  358. name: "goods_code",
  359. label: "存货编码",
  360. field: "goods_code",
  361. align: "center",
  362. },
  363. {
  364. name: "goods_desc",
  365. label: "存货名称",
  366. field: "goods_desc",
  367. align: "center",
  368. },
  369. // {
  370. // name: 'bound_batch_order',
  371. // label: '批号',
  372. // field: 'bound_batch_order',
  373. // align: 'center',
  374. // sortable: true
  375. // },
  376. {
  377. name: "goods_qty",
  378. label: "扫入数目",
  379. field: "goods_qty",
  380. align: "center",
  381. },
  382. // {
  383. // name: 'goods_in_qty',
  384. // label: '已入库/组盘数目',
  385. // field: 'goods_in_qty',
  386. // align: 'center'
  387. // },
  388. {
  389. name: "goods_out_qty",
  390. label: "已出数目",
  391. field: "goods_out_qty",
  392. align: "center",
  393. },
  394. // {
  395. // name: 'goods_std',
  396. // label: '规格型号',
  397. // field: 'goods_std',
  398. // align: 'center',
  399. // headerStyle: 'width: 20px'
  400. // },
  401. // {
  402. // name: 'goods_unit',
  403. // label: '单位',
  404. // field: 'goods_unit',
  405. // align: 'center',
  406. // headerStyle: 'width: 20px'
  407. // },
  408. // {
  409. // name: 'goods_package',
  410. // label: '包装',
  411. // field: 'goods_package',
  412. // align: 'center',
  413. // headerStyle: 'width: 20px'
  414. // },
  415. // {
  416. // name: 'check_status',
  417. // label: '质检状态',
  418. // field: 'check_status',
  419. // align: 'center',
  420. // headerStyle: 'width: 20px'
  421. // },
  422. {
  423. name: "create_time",
  424. label: "创建时间",
  425. field: "create_time",
  426. align: "center",
  427. headerStyle: "width: 40px",
  428. },
  429. {
  430. name: "is_delete",
  431. label: "是否删除",
  432. field: "is_delete",
  433. align: "center",
  434. headerStyle: "width: 80px",
  435. },
  436. {
  437. name: "action",
  438. label: "操作",
  439. field: "action",
  440. align: "center",
  441. headerStyle: "width: 80px",
  442. },
  443. ],
  444. filter: "",
  445. pagination: {
  446. page: 1,
  447. rowsPerPage: 11,
  448. },
  449. current: 1,
  450. max: 0,
  451. total: 0,
  452. paginationIpt: 1,
  453. containers: {},
  454. timer: null,
  455. showInventoryDetails: false,
  456. select_container_number: 0,
  457. select_container_code: 0,
  458. filterModels: {
  459. bound_department: null,
  460. },
  461. editForm: {
  462. id: "",
  463. bound_number: "",
  464. goods_code: "",
  465. goods_desc: "",
  466. goods_qty: "",
  467. goods_unit: "",
  468. goods_package: "",
  469. goods_in_qty: "",
  470. goods_out_qty: "",
  471. goods_std: "",
  472. check_status: "",
  473. check_user: "默认质检人",
  474. create_time: "",
  475. note: "无",
  476. },
  477. activeSearchField: "",
  478. activeSearchLabel: "",
  479. filterdata: {},
  480. checkDialog: false,
  481. checkQuantity: 0,
  482. selectedBatchId: null,
  483. };
  484. },
  485. computed: {
  486. interval() {
  487. return (
  488. this.$t("download_center.start") +
  489. " - " +
  490. this.$t("download_center.end")
  491. );
  492. },
  493. },
  494. methods: {
  495. handleCheck(batchId) {
  496. this.selectedBatchId = batchId;
  497. this.checkQuantity = 1;
  498. this.checkDialog = true;
  499. },
  500. handleEditRow(row) {
  501. this.editForm = { ...row }; // 复制当前行的数据到表单
  502. this.editForm.note = this.editForm.note || "无"; // 防止note为空
  503. this.editForm.check_user = this.editForm.check_user || "默认质检人"; // 防止check_user为空
  504. console.log(this.editForm);
  505. this.editDialog = true; // 打开对话框
  506. },
  507. saveEditRow() {
  508. const _this = this;
  509. putauth(`container/detail/${_this.editForm.id}/`, _this.editForm) // 假设修改API是这样的
  510. .then((res) => {
  511. _this.editDialog = false; // 关闭对话框
  512. if (res.status_code !== 400) {
  513. _this.$q.notify({ message: "修改成功", color: "positive" });
  514. _this.getSearchList(); // 刷新列表
  515. } else {
  516. // 错误信息的键值映射到中文字段名称
  517. const errorFieldMap = {
  518. note: "备注",
  519. check_user: "质检人",
  520. };
  521. // 遍历 res 对象的属性,查找错误信息
  522. let errorMessage = "修改失败";
  523. for (const key in res) {
  524. if (Array.isArray(res[key]) && res[key].length > 0) {
  525. const fieldLabel = errorFieldMap[key] || key;
  526. errorMessage = `${fieldLabel}: ${res[key].join(" ")}`;
  527. break;
  528. }
  529. }
  530. console.error("修改失败", errorMessage);
  531. _this.$q.notify({ message: errorMessage, color: "negative" });
  532. }
  533. })
  534. .catch((error) => {
  535. console.error("修改失败", error);
  536. _this.$q.notify({
  537. message: "发生未知错误,请联系管理员",
  538. color: "negative",
  539. });
  540. });
  541. },
  542. checkStatusToText(status) {
  543. const statusTexts = {
  544. 0: "空盘",
  545. 2: "在盘",
  546. 3: "离库",
  547. };
  548. return statusTexts[status] || "未知状态";
  549. },
  550. getRowStyle(row) {
  551. // 根据check_status值返回不同的背景色
  552. const statusColors = {
  553. 0: "#fff9c4", // 空盘
  554. 2: "#c8e6c9", // 在盘
  555. 3: "#ffcdd2", // 离库
  556. };
  557. const color = statusColors[row.status] || "";
  558. return color ? { backgroundColor: color } : {};
  559. },
  560. // 处理过滤变化
  561. handleFilterChange() {
  562. this.pagination.page = 1;
  563. this.getSearchList(1);
  564. },
  565. getFilterOptions(columnName) {
  566. switch (columnName) {
  567. case "type":
  568. return [
  569. { label: "生产入库", value: 1 },
  570. { label: "采购入库", value: 2 },
  571. { label: "其他入库", value: 3 },
  572. { label: "调拨入库", value: 4 },
  573. ];
  574. case "bound_status":
  575. return [
  576. { label: "待审核", value: 0 },
  577. { label: "质检合格", value: 1 },
  578. ];
  579. case "bound_department":
  580. return this.bound_department_list;
  581. case "status":
  582. return [
  583. { label: "空盘", value: 0 },
  584. { label: "在盘", value: 2 },
  585. { label: "离库", value: 3 },
  586. ];
  587. default:
  588. return [];
  589. }
  590. },
  591. handleHeaderDblClick(column) {
  592. // 排除不需要搜索的列
  593. if (["detail", "action"].includes(column.name)) return;
  594. this.activeSearchField = column.field;
  595. this.activeSearchLabel = column.label;
  596. // 弹出搜索对话框
  597. this.$q
  598. .dialog({
  599. title: `搜索${column.label}`,
  600. message: `请输入${column.label}的搜索条件`,
  601. prompt: {
  602. model: "",
  603. type: "text",
  604. },
  605. cancel: true,
  606. persistent: true,
  607. })
  608. .onOk((data) => {
  609. // 执行搜索
  610. this.executeColumnSearch(column.field, data);
  611. })
  612. .onCancel(() => {
  613. this.activeSearchField = "";
  614. this.activeSearchLabel = "";
  615. });
  616. },
  617. // 执行列搜索
  618. executeColumnSearch(field, value) {
  619. // 构建搜索参数
  620. if (
  621. field === "id" ||
  622. field === "bound_number" ||
  623. field === "save_status" ||
  624. field === "bound_status"
  625. ) {
  626. const searchParams = {
  627. [field]: value,
  628. };
  629. // 清除其他搜索条件
  630. this.filter = "";
  631. this.date_range = "";
  632. // 执行搜索
  633. this.getList({
  634. ...searchParams,
  635. page: 1,
  636. });
  637. this.filterdata = searchParams;
  638. this.$q.notify({
  639. message: `已搜索 ${this.activeSearchLabel} 含有 "${value}" 的结果`,
  640. icon: "search",
  641. color: "positive",
  642. });
  643. // 重置激活的搜索字段
  644. this.activeSearchField = "";
  645. this.activeSearchLabel = "";
  646. } else {
  647. const searchParams = {
  648. [field + "__icontains"]: value,
  649. };
  650. // 清除其他搜索条件
  651. this.filter = "";
  652. this.date_range = "";
  653. // 执行搜索
  654. this.getList({
  655. ...searchParams,
  656. page: 1,
  657. });
  658. this.filterdata = searchParams;
  659. this.$q.notify({
  660. message: `已搜索 ${this.activeSearchLabel} 含有 "${value}" 的结果`,
  661. icon: "search",
  662. color: "positive",
  663. });
  664. // 重置激活的搜索字段
  665. this.activeSearchField = "";
  666. this.activeSearchLabel = "";
  667. }
  668. },
  669. handle_container_detail(container) {
  670. var _this = this;
  671. _this.showInventoryDetails = true;
  672. console.log("点击状态", _this.showInventoryDetails);
  673. console.log("点击", container.id);
  674. _this.select_container_number = container.id;
  675. _this.select_container_code = container.container_code;
  676. _this.$refs.containercard.handleclick();
  677. },
  678. class_to_name(class_id) {
  679. const class_map = {
  680. 1: "整盘",
  681. 2: "托盘组",
  682. 3: "零盘",
  683. };
  684. return class_map[class_id];
  685. },
  686. getlog() {
  687. // console.log(this.table_list)
  688. console.log("当前loading状态:", this.loading);
  689. },
  690. getList(params = {}) {
  691. var _this = this;
  692. _this.loading = true;
  693. // 合并基础参数
  694. const baseParams = {
  695. page: _this.current,
  696. page_size: _this.pagination.rowsPerPage,
  697. };
  698. // 创建URLSearchParams处理参数
  699. const queryParams = new URLSearchParams({
  700. ...baseParams,
  701. ...params,
  702. });
  703. console.log(queryParams);
  704. // 过滤空值参数
  705. Array.from(queryParams.entries()).forEach(([key, value]) => {
  706. if (value === "" || value === null || value === undefined) {
  707. queryParams.delete(key);
  708. }
  709. });
  710. getauth(`${_this.pathname}?${queryParams}`)
  711. .then((res) => {
  712. _this.table_list = res.results.map((item) => ({
  713. ...item,
  714. expand: false,
  715. containers: [
  716. // {
  717. // id: 0,
  718. // container_code: 0,
  719. // current_location: '0',
  720. // goods_qty: 0,
  721. // class: 0
  722. // }
  723. ],
  724. loading: false,
  725. }));
  726. _this.total = res.count;
  727. _this.max = Math.ceil(res.count / _this.pagination.rowsPerPage) || 0;
  728. _this.pathname_previous = res.previous;
  729. _this.pathname_next = res.next;
  730. })
  731. .catch((err) => {
  732. _this.$q.notify({
  733. message: err.detail,
  734. icon: "close",
  735. color: "negative",
  736. });
  737. })
  738. .finally(() => {
  739. _this.loading = false;
  740. });
  741. },
  742. changePageEnter() {
  743. if (Number(this.paginationIpt) < 1) {
  744. this.current = 1;
  745. this.paginationIpt = 1;
  746. } else if (Number(this.paginationIpt) > this.max) {
  747. this.current = this.max;
  748. this.paginationIpt = this.max;
  749. } else {
  750. this.current = Number(this.paginationIpt);
  751. }
  752. this.getSearchList(this.current);
  753. },
  754. // 修改搜索方法以包含过滤条件
  755. getSearchList(page = 1) {
  756. this.current = page;
  757. this.paginationIpt = page;
  758. // 构建过滤参数
  759. const filterParams = {};
  760. for (const [key, value] of Object.entries(this.filterModels)) {
  761. if (value !== null && value !== "") {
  762. filterParams[key] = value;
  763. }
  764. }
  765. this.getList({
  766. number__icontains: this.filter,
  767. create_time__range: this.date_range,
  768. ...filterParams, // 添加过滤条件
  769. ...this.filterdata, // 添加其他过滤条件
  770. });
  771. },
  772. getListPrevious() {
  773. var _this = this;
  774. if (LocalStorage.has("auth")) {
  775. getauth(_this.pathname_previous, {})
  776. .then((res) => {
  777. _this.table_list = res.results;
  778. _this.pathname_previous = res.previous;
  779. _this.pathname_next = res.next;
  780. })
  781. .catch((err) => {
  782. _this.$q.notify({
  783. message: err.detail,
  784. icon: "close",
  785. color: "negative",
  786. });
  787. });
  788. } else {
  789. }
  790. },
  791. getListNext() {
  792. var _this = this;
  793. if (LocalStorage.has("auth")) {
  794. getauth(_this.pathname_next, {})
  795. .then((res) => {
  796. _this.table_list = res.results;
  797. _this.pathname_previous = res.previous;
  798. _this.pathname_next = res.next;
  799. })
  800. .catch((err) => {
  801. _this.$q.notify({
  802. message: err.detail,
  803. icon: "close",
  804. color: "negative",
  805. });
  806. });
  807. }
  808. },
  809. reFresh() {
  810. var _this = this;
  811. this.filterdata = {};
  812. this.filterModels = {
  813. bound_department: null,
  814. };
  815. _this.getSearchList();
  816. },
  817. updateProxy() {
  818. var _this = this;
  819. _this.proxyDate = _this.date;
  820. },
  821. },
  822. created() {
  823. var _this = this;
  824. if (LocalStorage.has("openid")) {
  825. _this.openid = LocalStorage.getItem("openid");
  826. } else {
  827. _this.openid = "";
  828. LocalStorage.set("openid", "");
  829. }
  830. if (LocalStorage.has("login_name")) {
  831. _this.login_name = LocalStorage.getItem("login_name");
  832. } else {
  833. _this.login_name = "";
  834. LocalStorage.set("login_name", "");
  835. }
  836. if (LocalStorage.has("auth")) {
  837. const timeStamp = Date.now();
  838. const formattedString = date.formatDate(timeStamp, "YYYY/MM/DD");
  839. _this.date = formattedString;
  840. console.log(_this.date);
  841. _this.authin = "1";
  842. _this.getList();
  843. } else {
  844. _this.authin = "0";
  845. }
  846. },
  847. mounted() {
  848. var _this = this;
  849. if (_this.$q.platform.is.electron) {
  850. _this.height = String(_this.$q.screen.height - 290) + "px";
  851. } else {
  852. _this.height = _this.$q.screen.height - 290 + "" + "px";
  853. }
  854. // _this.timer = setInterval(() => {
  855. // _this.getlog()
  856. // }, 1000)
  857. },
  858. updated() {},
  859. destroyed() {},
  860. // 在 watch 或方法中添加调试代码
  861. watch: {
  862. createDate1(val) {
  863. if (val) {
  864. if (val.to) {
  865. this.createDate2 = `${val.from} - ${val.to}`;
  866. this.date_range = `${val.from},${val.to} `;
  867. // this.downloadhUrl = this.pathname + 'filelist/?' + 'create_time__range=' + this.date_range
  868. } else {
  869. this.createDate2 = `${val}`;
  870. this.dateArray = val.split("/");
  871. this.searchUrl =
  872. this.pathname +
  873. "?" +
  874. "create_time__year=" +
  875. this.dateArray[0] +
  876. "&" +
  877. "create_time__month=" +
  878. this.dateArray[1] +
  879. "&" +
  880. "create_time__day=" +
  881. this.dateArray[2];
  882. // this.downloadhUrl = this.pathname + 'filelist/?' + 'create_time__year=' + this.dateArray[0] + '&' + 'create_time__month=' + this.dateArray[1] + '&' + 'create_time__day=' + this.dateArray[2]
  883. }
  884. this.date_range = this.date_range.replace(/\//g, "-");
  885. this.getSearchList();
  886. this.$refs.qDateProxy.hide();
  887. } else {
  888. this.createDate2 = "";
  889. this.date_range = "";
  890. this.getSearchList();
  891. }
  892. },
  893. },
  894. };
  895. </script>
  896. <style scoped>
  897. /* 添加在 <style> 中 */
  898. .q-date__calendar-item--selected {
  899. transition: all 0.3s ease;
  900. background-color: #1976d2 !important;
  901. }
  902. .q-date__range {
  903. background-color: rgba(25, 118, 210, 0.1);
  904. }
  905. .custom-title {
  906. font-size: 0.9rem; /* 推荐使用相对单位 */
  907. font-weight: 500;
  908. }
  909. /* 添加以下样式 */
  910. .custom-timeline {
  911. --q-timeline-color: #e0e0e0; /* 覆盖时间轴线颜色变量 */
  912. }
  913. .custom-node .q-timeline__dot {
  914. background: #485573 !important; /* 节点填充色 */
  915. border: 2px solid #5c6b8c !important; /* 节点边框色 */
  916. }
  917. .custom-node .q-timeline__content {
  918. color: #485573; /* 文字颜色 */
  919. }
  920. </style>