inventionPoint.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. <template>
  2. <div class="inventionPointDialog" v-if="show2">
  3. <div class="mini" :style="miniStyle" @click="changeDom('mini')" v-if="!show" v-drag="getPosition" ref="mini">查新</div>
  4. <div class="plus" v-else v-drag2="getPosition" ref="plus" :style="plusStyle">
  5. <div class="head" ondragstart="return false">
  6. <div>{{ text }}</div>
  7. <div style="width: 20px; height: 20px">
  8. <el-image @click="changeDom('plus')" style="width: 100%; height: 100%" :src="require('@/assets/img/收起.png')" fit="contain"></el-image>
  9. </div>
  10. </div>
  11. <div class="main">
  12. <div class="main_head" ondragstart="return false">
  13. <div>
  14. <span style="font-size:12px">发明点:</span>
  15. <el-button v-if="projectId" style="margin-left:10px" type="text" size="mini" @click="intoProject" >进入项目</el-button>
  16. </div>
  17. <div>
  18. <!-- <el-button type="text" size="mini" :loading="loading" v-if="btns.indexOf(1)!=-1" @click="submit(1)">关键词</el-button> -->
  19. <el-button type="text" size="mini" v-if="DBType == 'inner'" @click="search()">检索</el-button>
  20. <el-button type="text" size="mini" :loading="loading" v-if="btns.indexOf(2)!=-1" @click="submit(2)">相似案件</el-button>
  21. <el-button type="text" size="mini" :loading="loading" v-if="btns.indexOf(3)!=-1" @click="submit(3)">保存</el-button>
  22. </div>
  23. </div>
  24. <div class="main_input">
  25. <myRichText type="textarea" v-model="technicalCase.inventionPoint" resize="none" customStyle="height:220px;font-size: 14px;color:#606266" :rows="10" placeholder="请输入发明点"></myRichText>
  26. </div>
  27. <div class="main_result" v-if="showResult">
  28. <div class="description">{{description[clickType]}}</div>
  29. <div class="result" v-loading="loading">
  30. <template v-if="clickType == 1">
  31. <div>
  32. <div class="keyWord">
  33. 中文关键词:
  34. <div class="keyWord_content">
  35. <el-tag
  36. v-for="item in keyWord.CN"
  37. :key="item"
  38. type=""
  39. @click="chooseKeyword(item)"
  40. :effect="checkList.indexOf(item) == -1 ? 'plain' : 'dark'"
  41. >
  42. {{ item }}
  43. </el-tag>
  44. </div>
  45. </div>
  46. <div class="keyWord">
  47. 英文关键词:
  48. <div class="keyWord_content">
  49. <el-tag
  50. v-for="item in keyWord.EN"
  51. :key="item"
  52. @click="chooseKeyword(item)"
  53. type=""
  54. :effect="checkList.indexOf(item) == -1 ? 'plain' : 'dark'"
  55. >
  56. {{ item }}
  57. </el-tag>
  58. </div>
  59. </div>
  60. </div>
  61. </template>
  62. <template v-else>
  63. <div>
  64. <myCard class="box-card" v-for="(item,index) in tableData" :key="item.id">
  65. <div slot="head">
  66. <div style="font-size:14px">
  67. 序号:{{ (index + 1) }}
  68. <!-- <span style="margin-left:10px;color:cadetblue;">相似度:{{ item.same }}</span> -->
  69. </div>
  70. <div>
  71. <el-button type="text" size="mini" @click="clickItem(item,1)" v-if="clickType == 2">复用结果</el-button>
  72. <el-button type="text" size="mini" @click="clickItem(item,2)" v-if="!projectId">进入案件</el-button>
  73. </div>
  74. </div>
  75. <el-form label-width="100px">
  76. <el-form-item label="发明点:">
  77. <div v-html="item.inventionPoint"></div>
  78. </el-form-item>
  79. <!-- <el-form-item label="创建人:">
  80. <div v-html="item.createName"></div>
  81. </el-form-item>
  82. <el-form-item label="创建时间:">
  83. <div v-html="item.createTime"></div>
  84. </el-form-item> -->
  85. </el-form>
  86. </myCard>
  87. </div>
  88. </template>
  89. </div>
  90. <div class="foot" v-if="clickType == 1">
  91. <el-button type="primary" size="mini">检索</el-button>
  92. </div>
  93. <div class="foot" v-if="clickType == 3">
  94. <el-button type="primary" size="mini" @click="saveInventionPoint">保存</el-button>
  95. </div>
  96. </div>
  97. <!-- 对比文件 -->
  98. <div v-if="contrastFileList.length>0" class="main_result" style="border-top:1px solid black;margin-top:20px">
  99. <div class="main_head">
  100. <span style="font-size:12px">对比文件:</span>
  101. <div>
  102. <!-- <el-button v-if="chooseContrastFile.length>0" type="text" size="mini" :loading="loading" @click="exportReport()">生成报告</el-button> -->
  103. </div>
  104. </div>
  105. <div class="result">
  106. <myCard class="box-card" v-for="(item,index) in contrastFileList" :key="index">
  107. <div slot="head">
  108. <div style="font-size:14px">
  109. <!-- <el-checkbox-group v-model="chooseContrastFile">
  110. <el-checkbox :label="item.patentNo">序号:{{ (index + 1) }} </el-checkbox>
  111. </el-checkbox-group> -->
  112. <div>序号:{{ (index + 1) }}</div>
  113. </div>
  114. </div>
  115. <el-form label-width="100px">
  116. <el-form-item label="专利号">
  117. <div v-html="item.literatureNo"></div>
  118. </el-form-item>
  119. <el-form-item label="标注">
  120. <div v-if="item.noveltyCompareRecordVOS && item.noveltyCompareRecordVOS.length>0" v-html="item.noveltyCompareRecordVOS[0].markNoteText"></div>
  121. </el-form-item>
  122. </el-form>
  123. </myCard>
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. <reportTemplateDialog ref="reportTemplateDialog"></reportTemplateDialog>
  129. </div>
  130. </template>
  131. <script>
  132. import { startDrag } from '@/utils/direct/drag'
  133. import reportTemplateDialog from '@/views/noveltySearch/components/dialog/reportTemplate/reportTemplateDialog.vue';
  134. export default {
  135. directives:{
  136. 'drag':{
  137. inserted(el,binding){
  138. startDrag(el, el, binding.value);
  139. }
  140. },
  141. 'drag2':{
  142. inserted(el,binding){
  143. startDrag(el.querySelector('.head'), el, binding.value);
  144. }
  145. }
  146. },
  147. components: {
  148. reportTemplateDialog
  149. },
  150. props: {
  151. type:{
  152. type:String,
  153. default:'mini'
  154. },
  155. btns:{
  156. type:Array,
  157. default:()=>{
  158. return [3]
  159. }
  160. },
  161. contrastFileList:{
  162. type:Array,
  163. default:()=>{
  164. return []
  165. },
  166. },
  167. position:{
  168. type:Object,
  169. default:()=>{
  170. return {
  171. right:'10px',
  172. top:'120px',
  173. }
  174. }
  175. },
  176. title:{
  177. type:String,
  178. default:''
  179. },
  180. projectId:{
  181. },
  182. plusStyle:{
  183. type:String,
  184. default:''
  185. },
  186. miniStyle:{
  187. type:String,
  188. default:''
  189. },
  190. DBType:{
  191. type:String,
  192. default:''
  193. }
  194. },
  195. data() {
  196. return {
  197. domPosition:this.position,
  198. show2:true,
  199. show: this.type == 'mini'?false:true,
  200. text: this.title,
  201. technicalCase:{
  202. inventionPoint:'发明点',
  203. },
  204. tableData:[],
  205. loading: false,
  206. showResult: false,
  207. checkList: [],
  208. keyWord: {
  209. CN: ["关键词1", "关键词2"],
  210. EN: ["keyWord1", "keyWord2"],
  211. },
  212. clickType: null,
  213. description:{
  214. 1:"以下是提炼的关键词:",
  215. 2:'以下是相似案件:',
  216. 3:'以下是根据您输入的发明点找到的可能相同的案件,您确认一下是否是相同案件,如果是请相同案件的点击“进入”按钮,如果没有相同的案件就点击“保存”按钮保存输入的发明点'
  217. },
  218. chooseContrastFile:[],
  219. cWidth:document.body.clientWidth
  220. };
  221. },
  222. watch: {
  223. position(){
  224. this.domPosition = this.position
  225. },
  226. projectId(){
  227. this.getData()
  228. },
  229. },
  230. computed: {},
  231. created() {},
  232. destroyed() {
  233. window.removeEventListener('resize',()=>{
  234. })
  235. },
  236. mounted() {
  237. this.setPosition(this.type)
  238. this.getData()
  239. window.addEventListener('resize',()=>{
  240. this.cWidth = document.body.clientWidth
  241. })
  242. },
  243. methods: {
  244. setPosition(ref){
  245. if(!this.domPosition){
  246. return
  247. }
  248. this.$nextTick(()=>{
  249. var dom = this.$refs[ref]
  250. if(dom){
  251. for(let key in this.domPosition){
  252. if(key == 'left'){
  253. var left = Number(this.domPosition.left.slice(0,-2))
  254. if(ref == 'mini'){
  255. if(this.cWidth - left - 60 < 10){
  256. dom.style.right = '10px'
  257. }else{
  258. dom.style[key] = this.domPosition[key]
  259. }
  260. }
  261. else if(ref == 'plus'){
  262. if(this.cWidth - left - 350 < 10){
  263. dom.style.right = '10px'
  264. }else{
  265. dom.style[key] = this.domPosition[key]
  266. }
  267. }
  268. }else{
  269. dom.style[key] = this.domPosition[key]
  270. }
  271. }
  272. }
  273. })
  274. },
  275. getPosition(left,top){
  276. this.domPosition.left = left + 'px'
  277. this.domPosition.top = top+ 'px'
  278. },
  279. open(){
  280. },
  281. changeDom(ref){
  282. var dom = this.$refs[ref].getAttribute('drag-flag')
  283. if(dom == 'true'){
  284. return
  285. }
  286. this.$set(this,'show',!this.show)
  287. this.resize(ref)
  288. },
  289. resize(ref){
  290. this.show2 = false
  291. this.$nextTick(()=>{
  292. this.show2 = true
  293. var ref2 = ref == 'mini'?'plus':'mini'
  294. this.setPosition(ref2)
  295. })
  296. },
  297. getData(){
  298. if(!this.projectId){
  299. this.technicalCase={
  300. inventionPoint:'',
  301. }
  302. return
  303. }
  304. var params = {
  305. projectId:this.projectId
  306. }
  307. this.$api.queryTechnicalCase(params).then(response=>{
  308. if(response.code == 200){
  309. this.technicalCase = response.data || {}
  310. }
  311. }).catch(error=>{
  312. this.technicalCase={
  313. inventionPoint:'',
  314. }
  315. })
  316. },
  317. //选择关键词
  318. chooseKeyword(item) {
  319. var index = this.checkList.indexOf(item);
  320. if (index == -1) {
  321. this.checkList.push(item);
  322. } else {
  323. this.checkList.splice(index, 1);
  324. }
  325. },
  326. //确定
  327. submit(type,projectId) {
  328. if(type == 3){
  329. this.saveInventionPoint()
  330. return
  331. }
  332. this.clickType = type
  333. if(type == 1){}
  334. else{
  335. var params = {
  336. content:this.technicalCase.inventionPoint,
  337. projectId:projectId || this.projectId
  338. }
  339. this.loading = true
  340. this.$api.querySimilarInventionPoint(params).then(response=>{
  341. if(response.code == 200){
  342. this.tableData = response.data
  343. this.loading = false
  344. }
  345. }).catch(error=>{
  346. this.tableData = []
  347. this.loading = false
  348. })
  349. }
  350. this.showResult = true;
  351. },
  352. clickItem(row,type){
  353. if(type == 2){
  354. //使用
  355. this.$emit('getProjectId',row.projectId)
  356. this.submit(2,row.projectId)
  357. return
  358. }
  359. if(type == 1){
  360. const route = this.$router.resolve(
  361. {
  362. path:'/reuseResults',
  363. query:{
  364. toProjectId:this.projectId,
  365. projectId:row.projectId
  366. }
  367. }
  368. )
  369. window.open(route.href,'_blank')
  370. }
  371. },
  372. // 保存发明点
  373. saveInventionPoint(){
  374. var params = this.technicalCase
  375. if(this.projectId){
  376. params.projectId = this.projectId
  377. }
  378. this.$api.addOrUpdateTechnicalCase(params).then(response=>{
  379. if(response.code == 200){
  380. this.$message.success('保存成功')
  381. if(!this.technicalCase.projectId){
  382. this.$emit('getProjectId',response.data.projectId)
  383. }
  384. this.$emit('updateInventionPoint')
  385. this.technicalCase.technicalCaseId = response.data.technicalCaseId
  386. this.technicalCase.projectId = response.data.projectId
  387. }
  388. }).catch(error=>{
  389. this.$message.error('保存失败')
  390. })
  391. },
  392. //进入项目详情
  393. intoProject(){
  394. const route = this.$router.resolve({
  395. path:'/noveltySearchDetails',
  396. query:{
  397. projectId:this.projectId
  398. }
  399. })
  400. window.open(route.href,'_blank')
  401. },
  402. //生成报告
  403. exportReport(){
  404. this.$refs.reportTemplateDialog.open(this.projectId)
  405. },
  406. //检索
  407. search(){
  408. this.$emit('searchByInventionPoint',this.technicalCase.inventionPoint)
  409. }
  410. },
  411. };
  412. </script>
  413. <style lang="scss">
  414. .inventionPointDialog{
  415. .box-card{
  416. .el-form-item__content{
  417. text-align: left;
  418. }
  419. }
  420. }
  421. </style>
  422. <style lang="scss" scoped>
  423. .inventionPointDialog {
  424. z-index: 99999;
  425. .mini {
  426. position: fixed;
  427. // top: 0;
  428. right: 10px;
  429. text-align: center;
  430. line-height: 60px;
  431. width: 60px;
  432. height: 60px;
  433. border-radius: 50%;
  434. background: red;
  435. color: white;
  436. font-weight: bold;
  437. cursor: pointer;
  438. box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  439. }
  440. .plus {
  441. padding: 10px;
  442. background: white;
  443. box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  444. position: fixed;
  445. right: 10px;
  446. width: 350px;
  447. height: auto;
  448. border-radius: 10px;
  449. .head {
  450. width: 100%;
  451. display: flex;
  452. justify-content: space-between;
  453. -webkit-user-drag: none;
  454. user-select: none;
  455. -moz-user-select: none;
  456. -webkit-user-select: none;
  457. -ms-user-select: none;
  458. -webkit-user-drag: none;
  459. }
  460. .main {
  461. .main_head {
  462. display: flex;
  463. justify-content: space-between;
  464. align-items: center;
  465. line-height: 30px;
  466. }
  467. .main_result {
  468. margin-top: 20px;
  469. background: white;
  470. .description {
  471. border-bottom: 1px solid black;
  472. padding: 5px 0;
  473. font-size: 12px;
  474. }
  475. .result {
  476. margin-top: 10px;
  477. max-height: 300px;
  478. overflow: auto;
  479. display: flex;
  480. flex-direction: column;
  481. .keyWord {
  482. height: 100%;
  483. width: 100%;
  484. flex: 1;
  485. .keyWord_content {
  486. padding: 10px;
  487. border: 1px solid var(--bg);
  488. height: calc(100% - 50px);
  489. }
  490. }
  491. }
  492. .foot {
  493. display: flex;
  494. justify-content: flex-end;
  495. margin-top:10px;
  496. }
  497. }
  498. }
  499. }
  500. }
  501. </style>