searchBoxNew.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763
  1. <template>
  2. <div id="searchBoxNew">
  3. <div class="inputListBox" v-if="topType">
  4. <div class="fon_s">商品类型:</div>
  5. <div>
  6. <el-button
  7. :type="formData.goodsType === item.value ? 'primary' : ''"
  8. :size="size"
  9. v-for="(item, index) in lists"
  10. :key="index"
  11. @click="topSearch(item.value)"
  12. >{{ item.label }}</el-button
  13. >
  14. </div>
  15. </div>
  16. <div class="inputListBox" v-if="shType">
  17. <div class="fon_s">审核状态:</div>
  18. <div>
  19. <el-button
  20. :type="formData.status === item.value ? 'primary' : ''"
  21. :size="size"
  22. v-for="(item, index) in lists5"
  23. :key="index"
  24. @click="topSearchsh(item.value)"
  25. >{{ item.label }}</el-button
  26. >
  27. </div>
  28. </div>
  29. <!-- <div class="inputListBox" v-if="classType">
  30. <div>
  31. <el-button
  32. :type="formData.goodsType === item.value ? 'primary' : ''"
  33. :size="size"
  34. v-for="(item, index) in classLists"
  35. :key="index"
  36. @click="classSearch(item.value)"
  37. >{{ item.label }}</el-button
  38. >
  39. </div>
  40. </div> -->
  41. <div class="inputListBoxs">
  42. <div class="fon_sIcon" v-if="redIcon">
  43. <el-tooltip
  44. effect="light"
  45. class="item"
  46. content="该页面中的数据查询,针对的是「有效、有课程内容」的视频商品"
  47. placement="bottom-start"
  48. >
  49. <i class="el-icon-warning-outline iconStyS"></i>
  50. </el-tooltip>
  51. </div>
  52. <div
  53. class="fon_s"
  54. style="padding-top: 10px; width: 70px; text-align: end"
  55. v-else
  56. >
  57. 筛选:
  58. </div>
  59. <el-form :inline="true" :model="formData" class="tsxnz demo-form-inline">
  60. <el-form-item
  61. v-for="(item, index) in formListComput(formList)"
  62. :key="index"
  63. :label="item.label"
  64. >
  65. <!-- 教育类型 -->
  66. <el-select
  67. v-if="item.scope === 'educationType'"
  68. v-model="formData[item.prop]"
  69. :placeholder="item.placeholder"
  70. :size="size"
  71. @change="changeEducationType"
  72. >
  73. <el-option
  74. v-for="(items, indexs) in educationType"
  75. :key="indexs"
  76. :label="items.educationName"
  77. :value="items.id"
  78. ></el-option>
  79. </el-select>
  80. <!-- 业务层次 -->
  81. <el-select
  82. v-else-if="item.scope === 'businessLevel'"
  83. v-model="formData[item.prop]"
  84. :placeholder="item.placeholder"
  85. :size="size"
  86. @change="changeBusinessLevel"
  87. >
  88. <el-option
  89. v-for="(items, indexs) in newBusinessLevel"
  90. :key="indexs"
  91. :label="items.projectName + '-' + items.businessName"
  92. :value="items.id"
  93. ></el-option>
  94. </el-select>
  95. <!-- 院校 -->
  96. <el-select
  97. v-else-if="item.scope === 'schoolList'"
  98. v-model="formData[item.prop]"
  99. :placeholder="item.placeholder"
  100. :size="size"
  101. >
  102. <el-option
  103. v-for="(items, indexs) in newSchoolList"
  104. :key="indexs"
  105. :label="items.schoolName"
  106. :value="items.id"
  107. ></el-option>
  108. </el-select>
  109. <!-- 专业-根据教育类型筛选 -->
  110. <el-select
  111. v-else-if="item.scope === 'Professional'"
  112. v-model="formData[item.prop]"
  113. :placeholder="item.placeholder"
  114. :size="size"
  115. >
  116. <el-option
  117. v-for="(items, indexs) in newProfessional"
  118. :key="indexs"
  119. :label="items.categoryName"
  120. :value="items.id"
  121. ></el-option>
  122. </el-select>
  123. <!-- 专业 -->
  124. <el-select
  125. v-else-if="item.scope === 'ProfessionalList'"
  126. v-model="formData[item.prop]"
  127. :placeholder="item.placeholder"
  128. :size="size"
  129. >
  130. <el-option
  131. v-for="(items, indexs) in Professional"
  132. :key="indexs"
  133. :label="items.categoryName"
  134. :value="items.id"
  135. ></el-option>
  136. </el-select>
  137. <!-- 科目 -->
  138. <el-select
  139. v-else-if="item.scope === 'sujectType'"
  140. v-model="formData[item.prop]"
  141. :placeholder="item.placeholder"
  142. :size="size"
  143. >
  144. <el-option
  145. v-for="(items, indexs) in newSujectType"
  146. :key="indexs"
  147. :label="items.subjectName"
  148. :value="items.id"
  149. ></el-option>
  150. </el-select>
  151. <!-- 题目类型 -->
  152. <el-select
  153. v-else-if="item.scope === 'selectBank'"
  154. v-model="formData[item.prop]"
  155. :placeholder="item.placeholder"
  156. :size="size"
  157. >
  158. <el-option
  159. v-for="(items, indexs) in optionsBank"
  160. :key="indexs"
  161. :label="items.label"
  162. :value="items.value"
  163. ></el-option>
  164. </el-select>
  165. <!-- 试卷类型 -->
  166. <el-select
  167. v-else-if="item.scope === 'paperType'"
  168. v-model="formData[item.prop]"
  169. :placeholder="item.placeholder"
  170. :size="size"
  171. >
  172. <el-option
  173. v-for="(items, indexs) in paperType"
  174. :key="indexs"
  175. :label="items.label"
  176. :value="items.value"
  177. ></el-option>
  178. </el-select>
  179. <!-- 证书类型 -->
  180. <el-select
  181. v-else-if="item.scope === 'certificate'"
  182. v-model="formData[item.prop]"
  183. :placeholder="item.placeholder"
  184. :size="size"
  185. >
  186. <el-option
  187. v-for="(items, indexs) in certificate"
  188. :key="indexs"
  189. :label="items.certificateName"
  190. :value="items.id"
  191. ></el-option>
  192. </el-select>
  193. <!-- 考试标题 -->
  194. <el-select
  195. v-else-if="item.scope === 'examList'"
  196. v-model="formData[item.prop]"
  197. :placeholder="item.placeholder"
  198. :size="size"
  199. >
  200. <el-option
  201. v-for="(items, indexs) in examList"
  202. :key="indexs"
  203. :label="items.applyName"
  204. :value="items.applyId"
  205. ></el-option>
  206. </el-select>
  207. <!-- 考试地点 -->
  208. <el-select
  209. v-else-if="item.scope === 'applySiteAddress'"
  210. v-model="formData[item.prop]"
  211. :placeholder="item.placeholder"
  212. :size="size"
  213. >
  214. <el-option
  215. v-for="(items, indexs) in applySiteAddress"
  216. :key="indexs"
  217. :label="items.siteAddress"
  218. :value="item.getType === 1 ? items.siteAddress : items.siteId"
  219. ></el-option>
  220. </el-select>
  221. <!-- 前培标题 -->
  222. <el-select
  223. v-else-if="item.scope === 'beforeList'"
  224. v-model="formData[item.prop]"
  225. :placeholder="item.placeholder"
  226. :size="size"
  227. >
  228. <el-option
  229. v-for="(items, indexs) in beforeList"
  230. :key="indexs"
  231. :label="items.beforeName"
  232. :value="items.beforeId"
  233. ></el-option>
  234. </el-select>
  235. <!-- 自定义select -->
  236. <el-select
  237. :clearable="item.noClear === false ? false : true"
  238. v-else-if="item.scope === 'select'"
  239. v-model="formData[item.prop]"
  240. :placeholder="item.placeholder"
  241. :size="size"
  242. >
  243. <el-option
  244. v-for="(items, indexs) in item.options"
  245. :key="indexs"
  246. :label="items.label"
  247. :value="items.value"
  248. :disabled="items.disable"
  249. ></el-option>
  250. </el-select>
  251. <div v-else-if="item.scope === 'numList'">
  252. <el-input-number
  253. :controls="false"
  254. v-model="formData[item.prop1]"
  255. controls-position="right"
  256. :min="0"
  257. :max="100"
  258. :size="size"
  259. @change="
  260. handleChanges(formData[item.prop1], formData[item.prop2])
  261. "
  262. ></el-input-number
  263. >~
  264. <el-input-number
  265. :controls="false"
  266. v-model="formData[item.prop2]"
  267. controls-position="right"
  268. :min="0"
  269. :max="100"
  270. :size="size"
  271. @change="
  272. handleChanges(formData[item.prop1], formData[item.prop2])
  273. "
  274. ></el-input-number>
  275. </div>
  276. <el-input-number
  277. v-else-if="item.scope === 'inputNumber'"
  278. v-model="formData[item.prop]"
  279. controls-position="right"
  280. :min="0"
  281. :max="100"
  282. :size="size"
  283. ></el-input-number>
  284. <el-input
  285. v-else-if="item.scope === 'textarea' && formData[item.prop]"
  286. type="textarea"
  287. :size="size"
  288. readonly
  289. :rows="3"
  290. placeholder="请输入身份证"
  291. v-model="formData[item.prop]"
  292. >
  293. </el-input>
  294. <el-cascader
  295. v-else-if="item.scope === 'cascader'"
  296. v-model="formData[item.prop]"
  297. :options="item.options"
  298. :size="size"
  299. :props="{
  300. label: item.props.label,
  301. value: item.props.value,
  302. checkStrictly: true,
  303. emitPath: false,
  304. }"
  305. ></el-cascader>
  306. <el-cascader
  307. v-else-if="item.scope === 'cascaderDZ'"
  308. v-model="formData[item.prop]"
  309. :options="item.options"
  310. :size="size"
  311. :props="{
  312. label: item.props.label,
  313. value: item.props.value,
  314. checkStrictly: true,
  315. emitPath: false,
  316. }"
  317. clearable
  318. ></el-cascader>
  319. <el-date-picker
  320. v-else-if="item.scope === 'datePicker'"
  321. v-model="formData[item.prop]"
  322. type="datetimerange"
  323. :picker-options="pickerOptions"
  324. range-separator="至"
  325. start-placeholder="开始日期"
  326. end-placeholder="结束日期"
  327. align="right"
  328. :size="size"
  329. value-format="timestamp"
  330. >
  331. </el-date-picker>
  332. <el-date-picker
  333. v-else-if="item.scope === 'datePickerA'"
  334. v-model="formData[item.prop]"
  335. type="datetime"
  336. :size="size"
  337. placeholder="选择日期时间"
  338. value-format="timestamp"
  339. >
  340. </el-date-picker>
  341. <div v-else-if="item.scope === 'moreDataPicker'">
  342. <el-date-picker
  343. v-model="formData[item.prop1]"
  344. :type="item.Diszing ? 'datetime':'date'"
  345. value-format="timestamp"
  346. :size="size"
  347. :placeholder="item.placeholder1"
  348. @change="change1(item.prop1, item.prop2)"
  349. >
  350. </el-date-picker>
  351. <el-date-picker
  352. style="margin-left: 10px"
  353. v-model="formData[item.prop2]"
  354. :type="item.Diszing ? 'datetime':'date'"
  355. :size="size"
  356. value-format="timestamp"
  357. :placeholder="item.placeholder2"
  358. @change="change2(item.prop1, item.prop2)"
  359. >
  360. </el-date-picker>
  361. </div>
  362. <el-input
  363. v-else-if="!item.scope"
  364. clearable
  365. v-model="formData[item.prop]"
  366. :placeholder="item.placeholder"
  367. :size="size"
  368. ></el-input>
  369. </el-form-item>
  370. <el-form-item>
  371. <el-button
  372. v-if="advanced"
  373. :size="size"
  374. type="success"
  375. @click="emitAdvanced"
  376. >{{ advancedName }}</el-button
  377. >
  378. <el-button :size="size" type="primary" @click="search"
  379. >查询</el-button
  380. >
  381. <el-button :size="size" @click="init">重置</el-button>
  382. </el-form-item>
  383. </el-form>
  384. </div>
  385. </div>
  386. </template>
  387. <script>
  388. import { mapGetters } from "vuex";
  389. export default {
  390. props: [
  391. "formList",
  392. "topType",
  393. "formData",
  394. "shType",
  395. "redIcon",
  396. "advanced",
  397. "advancedName",
  398. ], //参考文档 component.md
  399. data() {
  400. return {
  401. tireStatus: "", //当前选择的教育类型tireStatus
  402. lists: [
  403. {
  404. label: "全部",
  405. value: "",
  406. },
  407. {
  408. label: "视频",
  409. value: 1,
  410. },
  411. {
  412. label: "题库",
  413. value: 2,
  414. },
  415. {
  416. label: "补考",
  417. value: 3,
  418. },
  419. {
  420. label: "前培",
  421. value: 4,
  422. },
  423. ],
  424. lists5: [
  425. {
  426. label: "全部",
  427. value: "",
  428. },
  429. {
  430. label: "通过",
  431. value: 1,
  432. },
  433. {
  434. label: "待审核",
  435. value: 2,
  436. },
  437. {
  438. label: "不通过",
  439. value: 3,
  440. },
  441. ],
  442. // classLists: [
  443. // {
  444. // label: "全部",
  445. // value: "",
  446. // },
  447. // {
  448. // label: "二建继教",
  449. // value: 1,
  450. // },
  451. // {
  452. // label: "七大员继教",
  453. // value: 2,
  454. // },
  455. // {
  456. // label: "七大员新考",
  457. // value: 3,
  458. // },
  459. // ],
  460. paperType: [
  461. {
  462. label: "发布",
  463. value: 1,
  464. },
  465. {
  466. label: "未发布",
  467. value: 0,
  468. },
  469. ],
  470. optionsBank: [
  471. {
  472. label: "单选题",
  473. value: 1,
  474. },
  475. {
  476. label: "多选题",
  477. value: 2,
  478. },
  479. {
  480. label: "判断题",
  481. value: 3,
  482. },
  483. {
  484. label: "案例题",
  485. value: 4,
  486. },
  487. {
  488. label: "简答题",
  489. value: 5,
  490. },
  491. ], //题目类型
  492. size: "small", //输入框尺寸类型
  493. newBusinessLevel: [], //业务层次-筛选后的数据
  494. newSchoolList: [], //院校-筛选后的数据
  495. newProfessional: [], //专业-筛选后的数据
  496. newSujectType: [], //科目-筛选后的数据
  497. pickerOptions: {
  498. //日期选择器近期功能
  499. shortcuts: [
  500. {
  501. text: "最近一周",
  502. onClick(picker) {
  503. const end = new Date();
  504. const start = new Date();
  505. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  506. picker.$emit("pick", [start, end]);
  507. },
  508. },
  509. {
  510. text: "最近一个月",
  511. onClick(picker) {
  512. const end = new Date();
  513. const start = new Date();
  514. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  515. picker.$emit("pick", [start, end]);
  516. },
  517. },
  518. {
  519. text: "最近三个月",
  520. onClick(picker) {
  521. const end = new Date();
  522. const start = new Date();
  523. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  524. picker.$emit("pick", [start, end]);
  525. },
  526. },
  527. ],
  528. },
  529. };
  530. },
  531. computed: {
  532. ...mapGetters([
  533. "educationType",
  534. "Professional",
  535. "examList",
  536. "beforeList",
  537. "applySiteAddress",
  538. "certificate"
  539. ]),
  540. /**
  541. * @remarks 过滤选择器列表
  542. */
  543. formListComput: function () {
  544. return function (item) {
  545. var newOption = JSON.parse(JSON.stringify(item));
  546. const arrsy = newOption.filter((items) => {
  547. if (
  548. items.scope === "businessLevel" ||
  549. items.scope === "schoolList" ||
  550. items.scope === "Professional" ||
  551. items.scope === "sujectType"
  552. ) {
  553. if (!this.formData[items.edu]) {
  554. } else {
  555. const indexType = this.educationType.findIndex((its) => {
  556. return its.id === this.formData[items.edu];
  557. });
  558. if (
  559. items.scope === "businessLevel" &&
  560. this.educationType[indexType].tireStatus.indexOf("2") !== -1
  561. ) {
  562. return items;
  563. }
  564. if (
  565. items.scope === "schoolList" &&
  566. this.educationType[indexType].tireStatus.indexOf("3") !== -1
  567. ) {
  568. return items;
  569. }
  570. if (
  571. items.scope === "Professional" &&
  572. this.educationType[indexType].tireStatus.indexOf("4") !== -1
  573. ) {
  574. return items;
  575. }
  576. }
  577. } else {
  578. if (items.diff === "gfxs") {
  579. if (this.formData["studyStatus"] == 2) {
  580. return items;
  581. }
  582. } else {
  583. return items;
  584. }
  585. }
  586. });
  587. return arrsy;
  588. };
  589. },
  590. },
  591. methods: {
  592. /**
  593. * @remark 高级搜索
  594. */
  595. emitAdvanced() {
  596. this.$emit("Advanced", this.formData);
  597. },
  598. /**
  599. *
  600. * @param {int} data1
  601. * @param {int} data2
  602. * @remark 日期搜索-时间开始选择器触发
  603. */
  604. change1(data1, data2) {
  605. if (this.formData[data1]) {
  606. if (
  607. this.formData[data2] &&
  608. this.formData[data1] > this.formData[data2]
  609. ) {
  610. this.formData[data1] = "";
  611. this.$message.warning("开始时间不能大于结束时间,请重新选择开始时间");
  612. }
  613. }
  614. },
  615. /**
  616. *
  617. * @param {int} data1
  618. * @param {int} data2
  619. * @remark 日期搜索-时间结束选择器触发
  620. */
  621. change2(data1, data2) {
  622. if (this.formData[data2]) {
  623. if (
  624. this.formData[data1] &&
  625. this.formData[data2] < this.formData[data1]
  626. ) {
  627. this.formData[data2] = "";
  628. this.$message.warning("结束时间不能小于开始时间,请重新选择结束时间");
  629. }
  630. }
  631. },
  632. /**
  633. *
  634. * @param {int} status
  635. * @remark 顶部定制按钮-根据商品类型点击快速搜索
  636. */
  637. topSearch(status) {
  638. this.formData.goodsType = status;
  639. this.$emit("search", 3);
  640. },
  641. /**
  642. *
  643. * @param {int} status
  644. * @remark 顶部定制按钮-根据审核状态点击快速搜索
  645. */
  646. topSearchsh(types) {
  647. this.formData.status = types;
  648. this.$emit("search", 3);
  649. },
  650. /**
  651. * @remark 搜索
  652. */
  653. search() {
  654. this.$emit("search", 1);
  655. },
  656. /**
  657. * @remark 重置
  658. */
  659. init() {
  660. this.$emit("init");
  661. },
  662. /**
  663. *
  664. * @param {int} int1
  665. * @param {int} int2
  666. * @remark 数值取值范围选择器
  667. */
  668. handleChanges(int1, int2) {
  669. if (int1 !== undefined && int2 !== undefined) {
  670. if (int1 > int2) {
  671. this.$message.error("请规范输入取值范围");
  672. }
  673. }
  674. },
  675. /**
  676. *
  677. * @param {int} id
  678. * @remark 点击教育类型触发事件
  679. */
  680. changeEducationType(id) {
  681. const indexs = this.educationType.findIndex((item) => {
  682. return item.id === id;
  683. });
  684. this.tireStatus = this.educationType[indexs].tireStatus;
  685. if (this.formData.businessId) {
  686. this.formData.businessId = "";
  687. }
  688. if (this.formData.schoolId) {
  689. this.formData.schoolId = "";
  690. }
  691. if (this.formData.ProfessionalId) {
  692. this.formData.ProfessionalId = "";
  693. }
  694. if (this.formData.subjectId) {
  695. this.formData.subjectId = "";
  696. }
  697. this.$api
  698. .inquirebusinessList({ status: 1, educationId: id })
  699. .then((res) => {
  700. this.newBusinessLevel = res.rows;
  701. });
  702. this.$api
  703. .inquireUserSchool({ status: 1, educationId: id })
  704. .then((res) => {
  705. this.newSchoolList = res.rows;
  706. });
  707. this.$api
  708. .inquireCourseMajor({ status: 1, educationId: id })
  709. .then((res) => {
  710. this.newProfessional = res.rows;
  711. });
  712. this.$api
  713. .inquireCourseSubject({ status: 1, educationId: id })
  714. .then((res) => {
  715. this.newSujectType = res.rows;
  716. });
  717. },
  718. /**
  719. *
  720. * @param {int} id
  721. * @remark 点击业务层次触发事件
  722. */
  723. changeBusinessLevel(id) {},
  724. },
  725. };
  726. </script>
  727. <style lang="less" scoped>
  728. .fon_s {
  729. font-size: 14px;
  730. color: #6b6b6b;
  731. }
  732. .fon_sIcon {
  733. width: 50px;
  734. display: flex;
  735. align-items: center;
  736. justify-content: center;
  737. }
  738. .iconStyS {
  739. font-size: 24px;
  740. font-weight: bold;
  741. color: red;
  742. }
  743. .inputListBox {
  744. display: flex;
  745. align-items: center;
  746. margin-bottom: 12px;
  747. }
  748. .inputListBoxs {
  749. display: flex;
  750. margin-bottom: 12px;
  751. }
  752. .tsxnz {
  753. flex: 1;
  754. /deep/ .el-form-item {
  755. margin-bottom: 0px;
  756. }
  757. }
  758. </style>