searchResult.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. <template>
  2. <div style="background: white; height: 100%">
  3. <el-container style="padding: 0 20px">
  4. <el-header class="workspace-content-container-header" style="display: flex; justify-content: space-between">
  5. <div>
  6. <el-button-group class="margin-left_10">
  7. <el-tooltip v-for="item in viewList" :key="item.value" class="item" effect="dark" :content="item.title"
  8. placement="top">
  9. <el-button @click="handleChangeView(item)" size="small" :type="viewSelected === item.value ? 'primary' : ''"
  10. :icon="item.btn"></el-button>
  11. </el-tooltip>
  12. </el-button-group>
  13. </div>
  14. <!-- <div style="max-width:calc(100% - 620px)">
  15. <p><span>条件:</span>{{ searchData.searchCondition }}</p>
  16. </div> -->
  17. <div style="max-width: 800px;margin-top: 0px;display: flex;justify-content: center;align-items: center;">
  18. <search :field="field" :searchResult="true" :searchValue="false" :countryList="queryParams.countryList"
  19. @search="search"></search>
  20. <p><el-link style="width: 50px;margin-left: -60px;color: #409EFF;" @click="searches">检索式</el-link></p>
  21. </div>
  22. <div>
  23. <el-button type="primary" size="small" @click="importToProject">导入专利</el-button>
  24. <el-button size="small" type="warning" @click="handleFieldManage">显示栏位管理</el-button>
  25. </div>
  26. </el-header>
  27. <el-main id="patent-list-container" v-loading="loading">
  28. <div class="height_100">
  29. <component ref="patentViewList" :is="viewSelected" :column="columnList" :tableData="tableData"
  30. @select-change="handleSelect" :selected.sync="queryParams.selected" :patentNoList.sync="patentNoList"
  31. :view-field="patentViewField" @on-sort="handleSort" @addSelect="getChoosePatentNo"></component>
  32. </div>
  33. </el-main>
  34. <el-footer class="workspace-content-patent-page foot-total">
  35. <div>
  36. <span v-if="selectedTotal > 0">
  37. 已勾选 <b>{{ selectedTotal }}</b> 条
  38. </span>
  39. <el-popover placement="bottom" title="" width="220" trigger="click">
  40. <el-main class="patent-fast-edit-popover" v-loading="selectNumberLoading">
  41. <div class="btn" @click="handleCancelSelectNumber">取消选择</div>
  42. <div class="btn" @click="handleSelectNumber(0)">本页选择</div>
  43. <div class="btn" @click="handleSelectNumber(1)">全部选择</div>
  44. <el-divider></el-divider>
  45. <div class="select-number">
  46. <span>从</span>
  47. <el-input size="mini" v-model="queryParams.startNumber" @change="change1"></el-input>
  48. <span>到</span>
  49. <el-input size="mini" v-model="queryParams.endNumber" @change="change2"></el-input>
  50. <el-button type="text" size="" @click="handleSelectNumber(2)">确定</el-button>
  51. </div>
  52. </el-main>
  53. <el-button type="info" size="small" class="margin-left_10" slot="reference"> 选择专利<i
  54. class="el-icon-arrow-down el-icon--right"></i></el-button>
  55. </el-popover>
  56. </div>
  57. <div class="foot-total">
  58. <span class="total">共{{ total }}条</span>
  59. <el-pagination background layout="total, sizes, prev, pager, next, jumper"
  60. :current-page.sync="queryParams.current" :page-size.sync="queryParams.size" :page-sizes="pageSizes"
  61. :page-count="getPageCount()" @current-change="handleCurrentChange" @size-change="getList">
  62. </el-pagination>
  63. </div>
  64. </el-footer>
  65. </el-container>
  66. <field ref="field" type="patentProject" @getFieldList="getFieldList"></field>
  67. <!-- <projectListDialog ref="projectListDialog" :importData="searchData"></projectListDialog> -->
  68. <projectListDialog ref="projectListDialog" :importData="condition"></projectListDialog>
  69. <el-dialog custom-class="checkCondition" title="查看/编辑检索式" :visible.sync="visible" width="500px"
  70. :before-close="() => { visible = false }" :close-on-click-modal="false">
  71. <div>
  72. <el-input type="textarea" :rows="4" v-model="condition.searchCondition"></el-input>
  73. </div>
  74. <span slot="footer" class="dialog-footer">
  75. <el-button @click="visible = false">取 消</el-button>
  76. <el-button type="primary" @click="searchFinish">检 索</el-button>
  77. </span>
  78. </el-dialog>
  79. </div>
  80. </template>
  81. <script>
  82. import PatentTableListView from "@/views/project/patentCollection/components/views/Table.vue";
  83. import PatentAbstractListView from "@/views/project/patentCollection/components/views/Abstract";
  84. import PatentPictureListView from "@/views/project/patentCollection/components/views/Picture";
  85. import field from '@/views/components/dialog/fields.vue';
  86. import projectListDialog from "./components/projectListDialog.vue";
  87. import search from '@/utils/model/search/search.vue'
  88. export default {
  89. components: {
  90. PatentTableListView,
  91. PatentAbstractListView,
  92. PatentPictureListView,
  93. field,
  94. projectListDialog,
  95. search,
  96. },
  97. props: {
  98. searchData: {}
  99. },
  100. data() {
  101. return {
  102. columnList: [],
  103. pageSizes: [10, 20, 30, 40, 50],
  104. viewSelected: "patent-table-list-view",
  105. viewList: [
  106. {
  107. value: "patent-table-list-view",
  108. title: "表格视图",
  109. btn: "el-icon-tickets",
  110. },
  111. {
  112. value: "patent-abstract-list-view",
  113. title: "摘要视图",
  114. btn: "el-icon-news",
  115. },
  116. {
  117. value: "patent-picture-list-view",
  118. title: "图片视图",
  119. btn: "el-icon-picture-outline",
  120. },
  121. ],
  122. patentNoList: [],
  123. queryParams: {
  124. selected: [],
  125. current: 1,
  126. size: 10,
  127. isAdd: [],
  128. isDelete: [],
  129. OrderBy: "AD",
  130. OrderByType: "DESC",
  131. retrieveRecordId: this.retrieveRecordId,
  132. asCompare: this.asCompare
  133. },
  134. patentViewField: [],
  135. tableData: [],
  136. total: 0,
  137. selectNumberLoading: false,
  138. loading: false,
  139. selectedTotal: 0,
  140. startNumber: 1,
  141. endNumber: 0,
  142. quickSelect: false,
  143. quickSelectArr: [],
  144. /**检索式 */
  145. // 公用数据
  146. field: JSON.parse(JSON.stringify(this.$constants.searchField)),
  147. // 打开弹窗
  148. visible: false,
  149. // 检索式及其他信息
  150. condition: this.searchData,
  151. };
  152. },
  153. watch: {},
  154. computed: {
  155. records() {
  156. return this.$store.state.patent.records;
  157. },
  158. },
  159. created() { },
  160. async mounted() {
  161. this.columnList = await this.$commonJS.getCustomField('patent')
  162. if (this.$s.getSession('queryParams') && this.$s.getSession('queryParams').params.retrieveRecordId) {
  163. this.queryParams.retrieveRecordId = this.$s.getSession('queryParams').params.retrieveRecordId
  164. }
  165. await this.getList();
  166. },
  167. methods: {
  168. //子组件返回检索式
  169. async search(val) {
  170. if (val.searchStr == '') {
  171. this.$message.error('检索信息不能为空')
  172. return false
  173. }
  174. if (val.isRepeat) {
  175. this.condition.searchCondition = `${this.condition.searchCondition} AND ${val.searchStr}`
  176. } else {
  177. this.condition.searchCondition = val.searchStr
  178. }
  179. await this.searchBth()
  180. },
  181. searchBth() {
  182. this.queryParams.retrieveRecordId = null
  183. this.$router.push({
  184. path: '/searchResult',
  185. query: {
  186. data: JSON.stringify(this.condition),
  187. }
  188. })
  189. // this.getList()
  190. },
  191. // 打开检索式弹窗
  192. searches() {
  193. this.visible = true
  194. },
  195. // 编辑、查看检索式
  196. async searchFinish() {
  197. await this.searchBth()
  198. this.visible = false
  199. },
  200. //导入到专题库
  201. importToProject() {
  202. var form = {
  203. // ...this.searchData,
  204. ...this.condition,
  205. orderBy: this.queryParams.OrderBy,
  206. orderByType: this.queryParams.OrderByType,
  207. startNumber: this.selectedTotal > 0 ? this.startNumber : 1,
  208. endNumber: this.selectedTotal > 0 ? this.endNumber : this.total,
  209. isAddPatentNos: this.queryParams.isAdd,
  210. isDeletePatentNos: this.queryParams.isDelete,
  211. }
  212. this.$refs.projectListDialog.open(form);
  213. },
  214. //切换页数
  215. async handleCurrentChange(val) {
  216. this.queryParams.current = val;
  217. this.patentNoList = []
  218. await this.getList();
  219. this.$nextTick(() => {
  220. if (this.quickSelect) {
  221. this.commonSwitch()
  222. } else {
  223. if (this.queryParams.isAdd.length > 0) {
  224. this.getHaveChoose([])
  225. }
  226. }
  227. })
  228. },
  229. //获取最大页数
  230. getPageCount() {
  231. var a = Math.ceil(Number(this.total) / Number(this.queryParams.size))
  232. return a > 200 ? 200 : a
  233. },
  234. //开始条数校验
  235. change1(val) {
  236. if (!isNaN(val)) {
  237. if (!val || val <= 0) {
  238. this.queryParams.startNumber = 1
  239. } else {
  240. if (this.queryParams.startNumber > this.total) {
  241. this.queryParams.startNumber = this.total
  242. }
  243. }
  244. } else {
  245. this.queryParams.startNumber = 1
  246. }
  247. },
  248. //结束条数校验
  249. change2(val) {
  250. if (!isNaN(val)) {
  251. if (!val || val <= 0) {
  252. this.queryParams.endNumber = this.total
  253. } else {
  254. if (this.queryParams.endNumber > this.total) {
  255. this.queryParams.endNumber = this.total
  256. }
  257. }
  258. } else {
  259. this.queryParams.endNumber = this.total
  260. }
  261. },
  262. //查询专利
  263. async getList() {
  264. let queryParams = JSON.parse(JSON.stringify(this.queryParams));
  265. var params = {
  266. // CurrentQuery: this.searchData.searchCondition, //检索式
  267. // DBType: this.searchData.DBType, //”CN”或”WD”,表示检索中文库或世界库
  268. CurrentQuery: this.condition.searchCondition, //检索式
  269. DBType: this.condition.DBType, //”CN”或”WD”,表示检索中文库或世界库
  270. PageNum: this.queryParams.current, //页码(最多 200 页)
  271. RowCount: this.queryParams.size, //每页返回条数(最多 50 条)
  272. OrderBy: this.queryParams.OrderBy, //排序字段:“AD”,“PD”,“GD”, “ID”(检索引擎自生成字段,排序顺序固定)
  273. OrderByType: this.queryParams.OrderByType, //排序方式:“ASC”,“DESC” 即正序倒序
  274. retrieveRecordId: this.queryParams.retrieveRecordId
  275. };
  276. // console.log(this.$s.getSession('retrieveRecordId'),)
  277. queryParams.params = params;
  278. this.$store.commit("SET_PATENT_PARAMS", queryParams);
  279. this.$store.commit("SET_PATENT_RECORDS", []);
  280. this.loading = true;
  281. await this.$api.patentSelect(params).then((response) => {
  282. if (response.code == 200) {
  283. this.total = response.data.total;
  284. this.$set(this.queryParams, 'startNumber', this.endNumber > 0 ? this.startNumber : 1)
  285. this.$set(this.queryParams, 'endNumber', this.endNumber > 0 ? this.endNumber : this.total)
  286. let records = response.data.data
  287. this.tableData = records
  288. params.retrieveRecordId = response.data.retrieveRecordId
  289. this.queryParams.retrieveRecordId = response.data.retrieveRecordId
  290. this.$store.commit("SET_PATENT_PARAMS", queryParams);
  291. this.$s.setSession('queryParams', queryParams)
  292. this.$store.commit("SET_PATENT_RECORDS", records);
  293. this.loading = false;
  294. }
  295. })
  296. .catch((error) => {
  297. this.loading = false;
  298. });
  299. },
  300. handleSelect(data) {
  301. // this.queryParams.selected = data
  302. },
  303. async handleChangeView(item) {
  304. // console.log(item)
  305. if (this.viewSelected == item.value) {
  306. return false
  307. }
  308. if (this.viewSelected != "patent-picture-list-view" && item.value != "patent-picture-list-view") {
  309. this.queryParams.size = 10;
  310. this.viewSelected = item.value;
  311. } else if (this.viewSelected == "patent-picture-list-view" || item.value == "patent-picture-list-view") {
  312. if (item.value === "patent-picture-list-view") {
  313. this.$set(this.queryParams, "size", 20);
  314. } else {
  315. this.queryParams.size = 10;
  316. }
  317. this.viewSelected = item.value;
  318. this.getList();
  319. }
  320. },
  321. async handleFieldManage() {
  322. this.$refs.field.open(this.columnList)
  323. },
  324. //获取自定义栏位
  325. getFieldList(data) {
  326. this.fieldList = data
  327. },
  328. //快速选择
  329. handleSelectNumber(type) {
  330. switch (type) {
  331. case 0: //本页选择
  332. this.patentNoList = [...new Set(this.patentNoList.concat(this.$store.state.patent.records.map((item) => item.applicationNo))),];
  333. this.queryParams.isAdd = [...new Set(this.queryParams.isAdd.concat(this.$store.state.patent.records.map((item) => item.applicationNo))),];
  334. break;
  335. case 1: //全部选择
  336. this.startNumber = 1;
  337. this.endNumber = this.total;
  338. this.$set(this.queryParams, 'startNumber', 1)
  339. this.$set(this.queryParams, 'endNumber', this.total)
  340. case 2: //范围选择
  341. this.queryParams.isDelete = [];
  342. this.queryParams.isAdd = [];
  343. this.patentNoList = [];
  344. this.quickSelect = true;
  345. if (type == 2) {
  346. if (!Number(this.queryParams.startNumber) || !Number(this.queryParams.endNumber)) {
  347. this.$set(this.queryParams, 'startNumber', this.endNumber > 0 ? this.startNumber : 1)
  348. this.$set(this.queryParams, 'endNumber', this.endNumber > 0 ? this.endNumber : this.total)
  349. break;
  350. }
  351. this.startNumber = this.queryParams.startNumber;
  352. this.endNumber = this.queryParams.endNumber;
  353. }
  354. this.commonSwitch();
  355. break;
  356. }
  357. this.getSelectedTotal()
  358. },
  359. //每页全部选择或范围选择的专利
  360. commonSwitch() {
  361. var arr = []
  362. if (this.queryParams.size * this.queryParams.current >= this.startNumber) {
  363. if (this.queryParams.size * this.queryParams.current >= this.endNumber) {
  364. if (this.queryParams.size * (this.queryParams.current - 1) + 1 <= this.startNumber) {
  365. var a = this.startNumber - (this.queryParams.size * (this.queryParams.current - 1) + 1);
  366. var b = this.endNumber - (this.queryParams.size * (this.queryParams.current - 1) + 1);
  367. for (var y = a; y <= b; y++) {
  368. arr.push(this.tableData[y].applicationNo)
  369. }
  370. } else {
  371. var a = this.queryParams.size * (this.queryParams.current - 1) + 1 - (this.queryParams.size * (this.queryParams.current - 1) + 1);
  372. var b = this.endNumber - (this.queryParams.size * (this.queryParams.current - 1) + 1);
  373. for (var y = a; y <= b; y++) {
  374. arr.push(this.tableData[y].applicationNo)
  375. }
  376. }
  377. } else {
  378. if (this.queryParams.size * (this.queryParams.current - 1) + 1 <= this.startNumber) {
  379. var a = this.startNumber - (this.queryParams.size * (this.queryParams.current - 1) + 1);
  380. var b = this.queryParams.size * this.queryParams.current - (this.queryParams.size * (this.queryParams.current - 1) + 1);
  381. for (var y = a; y <= b; y++) {
  382. arr.push(this.tableData[y].applicationNo)
  383. }
  384. } else {
  385. var a = this.queryParams.size * (this.queryParams.current - 1) + 1 - (this.queryParams.size * (this.queryParams.current - 1) + 1);
  386. var b = this.queryParams.size * this.queryParams.current - (this.queryParams.size * (this.queryParams.current - 1) + 1);
  387. for (var y = a; y <= b; y++) {
  388. arr.push(this.tableData[y].applicationNo)
  389. }
  390. }
  391. }
  392. }
  393. // this.patentNoList = JSON.parse(JSON.stringify(arr))
  394. this.quickSelectArr = JSON.parse(JSON.stringify(arr))
  395. this.getHaveChoose(arr)
  396. },
  397. //获取已选择的专利
  398. getHaveChoose(arr) {
  399. var arr1 = [...new Set(arr.concat(this.queryParams.isAdd))]
  400. this.patentNoList = arr1.filter((x) => this.queryParams.isDelete.indexOf(x) == -1)
  401. },
  402. //获取已选择的总条数
  403. getSelectedTotal() {
  404. this.selectedTotal = Number(this.endNumber) - Number(this.startNumber) + 1 + Number(this.queryParams.isAdd.length) - Number(this.queryParams.isDelete.length)
  405. },
  406. //获取手动选择的专利
  407. getChoosePatentNo(patentNo) {
  408. if (this.quickSelect) {
  409. var index = this.queryParams.isDelete.findIndex(item => {
  410. return item == patentNo
  411. })
  412. if (index == -1) {
  413. var index2 = this.quickSelectArr.findIndex(item => {
  414. return item == patentNo
  415. })
  416. if (index2 == -1) {
  417. this.setIsAdd(patentNo)
  418. } else {
  419. this.queryParams.isDelete.push(patentNo)
  420. }
  421. } else {
  422. this.queryParams.isDelete.splice(index, 1)
  423. }
  424. } else {
  425. this.setIsAdd(patentNo)
  426. }
  427. this.getSelectedTotal()
  428. },
  429. //是否加入isAdd里面
  430. setIsAdd(patentNo) {
  431. var index = this.queryParams.isAdd.findIndex(item => {
  432. return item == patentNo
  433. })
  434. if (index != -1) {
  435. this.queryParams.isAdd.splice(index, 1)
  436. } else {
  437. this.queryParams.isAdd.push(patentNo)
  438. }
  439. },
  440. //取消选择
  441. handleCancelSelectNumber() {
  442. this.patentNoList = [];
  443. this.queryParams.isAdd = []
  444. this.queryParams.isDelete = []
  445. this.startNumber = 1
  446. this.queryParams.startNumber = 1
  447. this.queryParams.endNumber = this.total
  448. this.endNumber = 0
  449. this.quickSelect = false
  450. this.selectedTotal = 0
  451. // this.getList()
  452. },
  453. //排序
  454. handleSort(data) {
  455. console.log(data);
  456. const o = {
  457. publicAccreditDate: "GD",
  458. publicDate: "PD",
  459. applicationDate: "AD",
  460. };
  461. this.queryParams.OrderBy = o[data.prop];
  462. this.queryParams.OrderByType = data.order.toUpperCase();
  463. this.getList();
  464. },
  465. },
  466. };
  467. </script>
  468. <style lang="scss" scoped>
  469. .total {
  470. margin-right: 10px;
  471. font-weight: 400;
  472. color: #606266;
  473. display: inline-block;
  474. font-size: 13px;
  475. min-width: 35.5px;
  476. height: 28px;
  477. line-height: 28px;
  478. vertical-align: top;
  479. box-sizing: border-box;
  480. }
  481. .foot-total {
  482. display: flex;
  483. justify-content: space-between;
  484. align-items: center;
  485. }
  486. .patent-fast-edit-popover {
  487. padding: 0 !important;
  488. .btn {
  489. color: #000;
  490. line-height: 30px;
  491. border-radius: 5px;
  492. padding-left: 10px;
  493. text-align: left;
  494. font-size: 14px;
  495. cursor: pointer;
  496. &:hover {
  497. background: #adadad;
  498. color: #fff;
  499. }
  500. }
  501. .disabled {
  502. cursor: not-allowed !important;
  503. }
  504. .bottom {
  505. text-align: right;
  506. color: #1e9fff;
  507. line-height: 40px;
  508. padding-left: 10px;
  509. font-size: 18px;
  510. }
  511. .el-divider--horizontal {
  512. margin: 10px 0 !important;
  513. }
  514. .select-number {
  515. .el-input {
  516. width: 70px;
  517. }
  518. span {
  519. padding: 0 3px;
  520. }
  521. }
  522. }
  523. </style>