checkPatent.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. <template>
  2. <!-- 选择专利弹窗 -->
  3. <div>
  4. <el-dialog title="选择专利" :visible.sync="dialogVisible" width="800px" :before-close="handleClose">
  5. <el-container>
  6. <el-header style="display: flex;align-items: center;">
  7. <slot name="head">
  8. <div id="step1">
  9. <!-- <mySearch style="width: 500px" :SearchFields="searchFiled" @search="search" :searchValue="searchOption">
  10. </mySearch> -->
  11. <searchPatent ref="searchPatent" :searchFiled="searchFiled"
  12. @searchValue="search"></searchPatent>
  13. </div>
  14. </slot>
  15. </el-header>
  16. <el-main style="height:calc(100vh - 300px)">
  17. <Table :column="column" :tableData="tableData" :queryParams="queryParams" :refresh="refresh" v-loading="loading"
  18. :patentNoList.sync="patentNoList" :projectId="projectId" @on-sort="handleSort"></Table>
  19. </el-main>
  20. <el-footer>
  21. <div style="display: flex;justify-content: space-between;margin-bottom: 10px;">
  22. <div>
  23. <el-button type="primary" @click="selectPage">本页选择</el-button>
  24. </div>
  25. <div>
  26. <el-pagination background layout="total, sizes, prev, pager, next, jumper"
  27. :current-page.sync="queryParams.current" :page-size.sync="queryParams.size"
  28. @current-change="handleCurrentChange" @size-change="getList" :total="total">
  29. </el-pagination>
  30. </div>
  31. </div>
  32. </el-footer>
  33. </el-container>
  34. <span slot="footer" class="dialog-footer">
  35. <el-button @click="handleClose">取 消</el-button>
  36. <el-button type="primary" @click="handleSure">确 定</el-button>
  37. </span>
  38. </el-dialog>
  39. </div>
  40. </template>
  41. <script>
  42. import Table from '@/views/project/patentCollection/components/views/Table.vue'
  43. import searchPatent from '@/views/report/components/patentList/components/searchPatent.vue';
  44. export default {
  45. components: {
  46. Table,
  47. searchPatent
  48. },
  49. props: {
  50. customFields: {
  51. default: () => {
  52. return []
  53. }
  54. },
  55. oldSearchOption: {
  56. default: () => {
  57. return ''
  58. }
  59. },
  60. sign:'',
  61. compareResult:{
  62. default:''
  63. }
  64. },
  65. data() {
  66. return {
  67. projectId: '',
  68. // 控制弹窗的打开关闭
  69. dialogVisible: false,
  70. //检索字段
  71. searchFiled: [],
  72. //检索条件
  73. searchOption: '',
  74. // 分页信息
  75. queryParams: {
  76. current: 1,
  77. size: 10,
  78. },
  79. total: 0,
  80. // 表格信息
  81. loading: false,
  82. // 表格数据
  83. tableData: [],
  84. checkList: [],
  85. // 表格栏位
  86. column: [
  87. {
  88. createType: 1,
  89. ifHidden: false,
  90. ifSearch: false,
  91. ifShow: true,
  92. name: "专利号",
  93. order: 0,
  94. type: "String",
  95. value: "patentNo",
  96. },
  97. {
  98. createType: 1,
  99. ifHidden: false,
  100. ifSearch: false,
  101. ifShow: true,
  102. name: "标题",
  103. order: 9,
  104. type: "Object",
  105. value: "title",
  106. },
  107. {
  108. createType: 1,
  109. ifHidden: false,
  110. ifSearch: false,
  111. ifShow: true,
  112. name: "专利状态",
  113. order: 19,
  114. type: "String",
  115. value: "SS",
  116. },
  117. ],
  118. // 选中的数据
  119. patentNoList: [],
  120. refresh: true,
  121. //排序
  122. sort: [],
  123. patentNos:[]
  124. }
  125. },
  126. watch:{
  127. compareResult(){
  128. this.getPatentList()
  129. }
  130. },
  131. async mounted() {
  132. await this.getColumn()
  133. },
  134. methods: {
  135. // 获取信息
  136. async getPatentList() {
  137. let params = {
  138. ...this.queryParams,
  139. projectId: this.projectId,
  140. compareResult: this.compareResult
  141. }
  142. await this.$api.getComparedPatent(params).then(response => {
  143. if (response.code == 200) {
  144. this.total = response.data.total
  145. this.tableData = response.data.data
  146. }
  147. }).catch(error => {
  148. this.total = 0
  149. this.tableData = []
  150. })
  151. },
  152. // 本页选择
  153. selectPage() {
  154. this.patentNoList = this.tableData.map(item => item.patentNo)
  155. this.refreshTable()
  156. },
  157. //刷新
  158. refreshTable() {
  159. this.refresh = false
  160. this.$nextTick(() => {
  161. this.refresh = true
  162. })
  163. },
  164. //获取table栏位及分组字段、检索字段
  165. async getColumn() {
  166. let params = [{
  167. tableName: 'patent',
  168. projectId: 0,
  169. }]
  170. this.searchFiled = []
  171. await this.$api.getQueryFields(params).then(res => {
  172. if (res.code == 200) {
  173. let conditionDTOList = JSON.parse(JSON.stringify(res.data.data[0].conditionDTOList))
  174. let field = conditionDTOList.filter(item => {
  175. return item.group == 'nos'
  176. })
  177. let custom = conditionDTOList.filter(item => {
  178. return item.group == 'customField'
  179. })
  180. let customField = custom.filter(item => {
  181. return item.type != 'tree' && item.type != 'Array'
  182. })
  183. let arr = field.concat(customField)
  184. // 搜索字段
  185. this.searchFiled = this.$commonJS.getField(arr, (u) => u.ifSearch == true, {
  186. label: 'name',
  187. value: 'field',
  188. type: 'type',
  189. group: 'group',
  190. fieldType: 'fieldType',
  191. groupBy: 'groupBy',
  192. children:'children'
  193. })
  194. }
  195. })
  196. // let params = ['patent']
  197. // await this.$api.getParamsCommon(params).then(res => {
  198. // if (res.code == 200) {
  199. // // let conditionDTOList = JSON.parse(JSON.stringify(res.data[0].conditionDTOList))
  200. // // // 搜索字段
  201. // // this.searchFiled = this.$commonJS.getField(conditionDTOList, (u) => u.ifSearch == true, {
  202. // // label: 'name',
  203. // // value: 'value',
  204. // // type: 'type',
  205. // // })
  206. // }
  207. // })
  208. },
  209. //检索
  210. // search(val) {
  211. // let params = {}
  212. // val.forEach(item => {
  213. // if (item.type == 3) {
  214. // params[item.value] = item.searchValue.map(itemValue => {
  215. // return itemValue.value
  216. // })
  217. // } else {
  218. // params[item.value] = item.searchValue.label
  219. // }
  220. // })
  221. // // 返回字符串
  222. // this.searchOption = this.$commonJS.ArrayToArray(val)
  223. // // 调用查询接口
  224. // this.queryParams.current = 1
  225. // this.getList()
  226. // },
  227. search({ searchStr, customFields }) {
  228. this.searchOption = searchStr
  229. this.queryParams.current = 1
  230. this.getList()
  231. },
  232. // 打开弹窗
  233. open(projectId,patentNoList) {
  234. this.refresh = true
  235. this.projectId = projectId
  236. if (patentNoList) {
  237. this.patentNos = patentNoList
  238. }
  239. if (this.sign == 'teamwork') {
  240. this.getPatentList()
  241. } else {
  242. this.getList()
  243. }
  244. this.dialogVisible = true
  245. },
  246. // 弹窗确定
  247. handleSure() {
  248. this.$emit('checkPatentList', this.patentNoList)
  249. this.handleClose()
  250. },
  251. // 关闭弹窗
  252. handleClose() {
  253. this.patentNoList = []
  254. this.refresh = false
  255. this.dialogVisible = false
  256. },
  257. // 分页信息
  258. handleCurrentChange(val) {
  259. this.queryParams.current = val
  260. if (this.sign == 'teamwork') {
  261. this.getPatentList()
  262. return
  263. }
  264. this.getList()
  265. },
  266. //排序
  267. handleSort({ column, prop, order }) {
  268. //如需要多个字段排序,则不需要清空
  269. var params = {
  270. sort: this.sort,
  271. column,
  272. prop,
  273. order,
  274. }
  275. this.sort = this.$commonJS.getSortData(params)
  276. this.queryParams.current = 1
  277. this.getList()
  278. },
  279. getList() {
  280. // var searchOption = {
  281. // ...this.oldSearchOption,
  282. // ...this.searchOption
  283. // }
  284. // var searchOption1 = this.searchOption
  285. // if(this.searchOption.constructor == Object){
  286. // searchOption1 = this.$commonJS.objectToArray(this.searchOption)
  287. // }
  288. // if(this.oldSearchOption.constructor == Object){
  289. // oldSearchOption = this.$commonJS.objectToArray(this.oldSearchOption)
  290. // }
  291. // let searchOption = [
  292. // // ...oldSearchOption,//固有检索字段
  293. // ...searchOption1
  294. // ]
  295. // var str = this.$commonJS.objectToString(searchOption)
  296. // var searchStr = (this.oldSearchOption?(' AND ' + (this.oldSearchOption)):'')
  297. var searchStr = this.searchOption + ((this.searchOption && this.oldSearchOption)?' AND ':'') + (this.oldSearchOption || '')
  298. var patentNoStr = ''
  299. this.patentNos.forEach((item, index) =>{
  300. if (index == 0) {
  301. patentNoStr = patentNoStr + `patentNo=${item}`
  302. } else {
  303. patentNoStr = patentNoStr + ` And patentNo=${item}`
  304. }
  305. })
  306. let params = {
  307. ...this.queryParams,//分页信息
  308. projectId: this.projectId,
  309. searchQuery: searchStr + ((patentNoStr)?(' Not '+`(${patentNoStr})`):''),//检索条件
  310. customFields: this.customFields,
  311. orderDTOList: this.sort,//排序信息
  312. }
  313. this.loading = true
  314. this.$api.QueryPatent(params).then(res => {
  315. if (res.code == 200) {
  316. this.tableData = res.data.data
  317. this.total = res.data.total
  318. this.loading = false
  319. }
  320. }).catch(error => {
  321. this.tableData = []
  322. this.total = 0
  323. this.loading = false
  324. })
  325. },
  326. },
  327. }
  328. </script>
  329. <style lang="scss" scoped></style>