contrast.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <template>
  2. <div>
  3. <el-dialog :title="title" v-draggable :visible.sync="visible" width="1000px" custom-class="checkFile" :before-close="close" :modal="false" :close-on-click-modal="false" :modal-append-to-body="false">
  4. <el-form :model="form" ref="form" label-width="100px" label-position="left">
  5. <!-- <el-form-item label="选择颜色" class="item">
  6. <el-input type="color" v-model="form.color" style="user-select:none;width: 100px;" @input="changeColor()"/>
  7. </el-form-item> -->
  8. <el-form-item label="选中文本" class="item">
  9. <el-input v-model="form.evidenceText" placeholder="请输入备注" type="textarea" show-word-limit></el-input>
  10. </el-form-item>
  11. <el-form-item label="位置/附图号" class="item">
  12. <el-input v-model="form.fieldName" placeholder="请输入备注" show-word-limit></el-input>
  13. </el-form-item>
  14. <el-form-item label="解析过程" class="item">
  15. <el-input v-model="form.common" placeholder="请输入解析过程" show-word-limit></el-input>
  16. </el-form-item>
  17. <el-form-item label="代表图" class="item">
  18. <el-upload ref="upload" action="#" :auto-upload="false" :on-change="change" list-type="picture" :show-file-list="false">
  19. <span style="display:flex;flex-direction:row;flex-wrap:wrap;">
  20. <span class="avatar" v-if="form.fileGuid"
  21. style="margin-left:10px">
  22. <span class="deleteImg">
  23. <span>
  24. <i class="el-icon-zoom-in" @click.stop="handlePictureCardPreview()"></i>
  25. <i class="el-icon-delete" @click.stop="handleRemove()"></i>
  26. </span>
  27. </span>
  28. <el-image ref="image" class="img" :src="$commonJS.checkViewer(form.fileGuid)" :preview-src-list="[$commonJS.checkViewer(form.fileGuid)]"></el-image>
  29. </span>
  30. <i class="el-icon-plus avatar-uploader-icon" v-if="!form.fileGuid"></i>
  31. </span>
  32. </el-upload>
  33. </el-form-item>
  34. <el-form-item label="权利特征" class="item" style="margin-bottom:5px">
  35. <span v-for="item in form.features">[{{item.rightName}}]
  36. <el-tooltip class="item" effect="dark" :content="item.content" placement="top">
  37. <span>特征{{item.featuresOrder}}</span>
  38. </el-tooltip>
  39. &nbsp;&nbsp;</span>
  40. </el-form-item>
  41. </el-form>
  42. <!-- 特征 -->
  43. <div style="height:500px" v-if="visible">
  44. <splitPage ref="splitPage" @getCheckList="getCheckList" :isEdit="false" :tableData="features" :isResult="9" :patentNo="patentNo" :columnList="columnList" :checkFeatures="checkFeatures" :checkData="checkData">
  45. <!-- <div slot="handleLeft">
  46. <span>标的专利:</span><el-link type="primary" @click="toPatentDetails(patentNo)">{{ patentNo }}</el-link>
  47. </div>
  48. <div slot="handleRight"></div> -->
  49. </splitPage>
  50. </div>
  51. <div slot="footer" class="dialog-footer">
  52. <el-button @click="close">取 消</el-button>
  53. <el-button type="primary" v-if="form.id" @click="delContrast(form)">删 除</el-button>
  54. <el-button type="primary" :loading="btnLoading" @click="submit">确 定</el-button>
  55. </div>
  56. </el-dialog>
  57. </div>
  58. </template>
  59. <script>
  60. import splitPage from '@/views/report/components/splitPage/splitPage.vue';
  61. import { mapGetters } from "vuex";
  62. export default {
  63. components: {
  64. splitPage
  65. },
  66. props: {},
  67. data() {
  68. return {
  69. form:{},
  70. title:'添加对比',
  71. visible:false,
  72. features:[],
  73. projectId:0,
  74. patentNo:'',
  75. loading:false,
  76. selected:[],
  77. columnList:[
  78. {
  79. name: "结论",
  80. type: "Array",
  81. value: 'conclusion',
  82. disabled:true,
  83. options:[
  84. {
  85. label:'公开',
  86. value:'公开'
  87. },
  88. {
  89. label:'部分公开',
  90. value:'部分公开'
  91. },
  92. ]
  93. },
  94. ],
  95. checkData:[],
  96. checkFeatures:[],
  97. btnLoading:false
  98. };
  99. },
  100. watch: {},
  101. computed: {
  102. ...mapGetters(["contextMenu",'highlight']),
  103. },
  104. created() {},
  105. mounted() {
  106. },
  107. methods: {
  108. open(){
  109. this.getData()
  110. this.visible = true
  111. },
  112. close(){
  113. this.visible = false
  114. },
  115. getFeature(){
  116. let params = {
  117. patentNo:this.patentNo,
  118. projectId: this.projectId,
  119. }
  120. this.$api.getSpiltFeature(params).then(res => {
  121. if (res.code == 200) {
  122. if (res.data.data.length > 0) {
  123. var data = []
  124. res.data.data.forEach(RightVosItem => {
  125. if (RightVosItem.features.length > 0) {
  126. RightVosItem.features.forEach(FeaturesItem => {
  127. FeaturesItem.featureId = FeaturesItem.id
  128. FeaturesItem.pRightName = RightVosItem.rightName
  129. FeaturesItem.pSignPatentNo = RightVosItem.signPatentNo
  130. FeaturesItem.pPatentNo = RightVosItem.patentNo
  131. FeaturesItem.pContentOut = RightVosItem.contentOut
  132. FeaturesItem.pContent = RightVosItem.content
  133. FeaturesItem.pProjectId = RightVosItem.projectId
  134. FeaturesItem.pType = RightVosItem.type
  135. FeaturesItem.pSort = RightVosItem.sort
  136. FeaturesItem.conclusion = ''
  137. this.hasOwn(FeaturesItem)
  138. data.push(FeaturesItem)
  139. })
  140. }
  141. })
  142. this.features = data
  143. }
  144. }
  145. })
  146. },
  147. hasOwn(item) {
  148. if (!item.hasOwnProperty("explainText")) {
  149. item.explainText = ''
  150. }
  151. },
  152. getData(){
  153. var mark = this.contextMenu.mark
  154. this.patentNo = mark.patentNo
  155. if(this.projectId){
  156. if(this.projectId != mark.projectId){
  157. this.projectId = mark.projectId
  158. this.getFeature()
  159. }
  160. }else{
  161. this.projectId = mark.projectId
  162. this.getFeature()
  163. }
  164. this.form = {
  165. literatureId:mark.literatureId,
  166. fieldName:mark.scratchField,
  167. position:mark.position,
  168. markType:mark.scratchType,
  169. markColor:mark.color,
  170. evidenceText:mark.text,
  171. id:mark.id
  172. }
  173. },
  174. submit(){
  175. this.$refs.splitPage.getCheckList()
  176. },
  177. //获取子组件选中的特征
  178. getCheckList(data){
  179. this.form.assoFeatureList = data.map(item=>{
  180. return {
  181. featureId:item.featureId,
  182. conclusion:item.conclusion
  183. }
  184. })
  185. this.btnLoading = true
  186. this.$api.addCompareRecord(this.form).then(response=>{
  187. if(response.code == 200){
  188. this.changeHighlight(response.data.data)
  189. this.btnLoading = false
  190. this.close()
  191. }
  192. }).catch(error=>{
  193. this.btnLoading = false
  194. })
  195. },
  196. changeHighlight(id,type){
  197. var contrastList = this.highlight.contrastList
  198. var message = ''
  199. if(this.form.id){
  200. var index = contrastList.findIndex(item=>{
  201. return item.id == this.form.id
  202. })
  203. if(type){
  204. message = '删除成功'
  205. contrastList.splice(index,1)
  206. }else{
  207. message = '更新成功'
  208. contrastList.splice(index,1,this.form)
  209. }
  210. }else{
  211. message = '新增成功'
  212. this.form.id = id
  213. contrastList.push(this.form)
  214. }
  215. this.$message.success(message)
  216. this.$store.commit("SET_CONTEXT_MENU",contrastList)
  217. },
  218. //文件上传
  219. change(file,fileList){
  220. let formData = new FormData()
  221. formData.append('sourceId',this.$constants.sourceId)
  222. formData.append('files',file.raw)
  223. this.$api.uploadFile(formData).then(response=>{
  224. if(response.code == 200){
  225. this.$set(this.form,'fileGuid',response.data[0])
  226. }
  227. })
  228. },
  229. handleRemove() {
  230. this.$set(this.form,'fileGuid','')
  231. },
  232. handlePictureCardPreview() {
  233. this.$refs.image.showViewer = true
  234. },
  235. delContrast(){
  236. var ids = [this.form.id]
  237. this.$confirm('确认删除该数据吗?', '提示', {
  238. confirmButtonText: '确定',
  239. cancelButtonText: '取消',
  240. type: 'warning'
  241. }).then(() => {
  242. this.$api.removeCompareRecord(ids).then(response => {
  243. this.changeHighlight(this.form.id,'删除')
  244. this.close()
  245. }).catch(error => {
  246. })
  247. })
  248. }
  249. },
  250. };
  251. </script>
  252. <style lang="scss" scoped>
  253. .avatar-uploader-icon {
  254. background-color: #fbfdff;
  255. border: 1px dashed #c0ccda;
  256. font-size: 28px;
  257. color: #8c939d;
  258. width: 148px;
  259. height: 148px;
  260. line-height: 148px;
  261. text-align: center;
  262. }
  263. .avatar {
  264. position: relative;
  265. width: 148px;
  266. height: 148px;
  267. display: block;
  268. }
  269. .avatar:hover .deleteImg {
  270. display: block;
  271. }
  272. .deleteImg {
  273. display: none;
  274. font-size: 30px;
  275. width: 148px;
  276. height: 148px;
  277. background-color: black;
  278. opacity: 0.6;
  279. position: absolute;
  280. top: 0;
  281. right: 0;
  282. left: 0;
  283. bottom: 0;
  284. margin: auto;
  285. z-index: 999;
  286. }
  287. .avatar .img {
  288. width: 148px;
  289. height: 148px;
  290. }
  291. .deleteImg span i {
  292. margin-left: 10px;
  293. color: #fff;
  294. }
  295. .deleteImg span {
  296. display: flex;
  297. align-items: center;
  298. /*垂直居中*/
  299. justify-content: center;
  300. /*水平居中*/
  301. width: 100%;
  302. height: 100%;
  303. }
  304. </style>