addEvidenceReason.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. <template>
  2. <div>
  3. <el-dialog :title="title" :visible.sync="showDialog" width="1000px" :close-on-click-modal="false" :before-close="handleClose" append-to-body>
  4. <el-form :model="form" ref="form" label-width="120px" label-position="left">
  5. <template v-if="['5','4','8'].indexOf(form.statutesId) ==-1">
  6. <el-form-item label="权利要求" prop="claimSort">
  7. 权要{{ form.claimSort+1 }}
  8. </el-form-item>
  9. <el-form-item label="权利内容" prop="claimText">
  10. <span v-html="form.claimText"></span>
  11. </el-form-item>
  12. </template>
  13. <el-form-item label="无效理由" prop="statutesContent">
  14. <span v-html="form.statutesContent"></span>
  15. </el-form-item>
  16. <el-form-item :label="(ifSecondInvalid?'第二次':'第一次') + '证据组合'" prop="proofGroupDescription">
  17. <div v-if="true">
  18. <div v-if="editProofGroupDescription" style="display:flex;align-items:center;">
  19. <el-input type="textarea" style="width:100%" v-model="descriptions"></el-input>
  20. <el-button type="primary" class="margin-left_10" icon="el-icon-check" circle style="font-size:15px" @click="submitContents()"></el-button>
  21. <el-button type="primary" class="margin-left_10" icon="iconfont icon-fanhui" circle style="font-size:15px" @click="cancelContents()"></el-button>
  22. </div>
  23. <div v-else>
  24. <span v-html="form.proofGroupDescription"></span>
  25. <span @click="editContents()" ><el-link type="primary"><i class="iconfont icon-bianji" style="font-size:28px"></i></el-link></span>
  26. </div>
  27. </div>
  28. <div v-else>
  29. <span v-html="form.proofGroupDescription"></span>
  30. </div>
  31. </el-form-item>
  32. <div>
  33. <div style="display:flex;justify-content:space-between;padding-bottom:10px">
  34. <div>无效证据</div>
  35. <div v-if="!ifSecondInvalid || showFeature">
  36. <el-button type="primary" size="small" @click="featuresHistory" v-if="['4','8'].indexOf(form.statutesId) ==-1">特征拆分历史</el-button>
  37. <el-button type="primary" size="small" @click="splitClaim" v-if="['4','8'].indexOf(form.statutesId) ==-1">自动拆分</el-button>
  38. <el-button type="primary" size="small" @click="addFeature">添加特征</el-button>
  39. </div>
  40. </div>
  41. <div style="width:100%">
  42. <el-table :data="features" border style="width: 100%" :span-method="objectSpanMethod" :header-cell-style="{'text-align':'center'}">
  43. <el-table-column prop="featureOrder" label="特征" width="120" align="center">
  44. <template slot-scope="scope">
  45. <div>
  46. 特征{{scope.row.featureOrder}}
  47. </div>
  48. </template>
  49. </el-table-column>
  50. <el-table-column prop="featureOrder" label="特征内容" >
  51. <template slot-scope="scope">
  52. <div v-if="['4','8'].indexOf(form.statutesId) ==-1">
  53. <div v-if="(!ifSecondInvalid || showFeature) && !getFeatureDel(scope.row)">
  54. <my-RichText v-model="scope.row.featureText" @change="change(scope.row)"></my-RichText>
  55. </div>
  56. <div v-else>
  57. <span :class="getFeatureDel(scope.row)?'del':''" v-html="scope.row.featureText"></span>
  58. </div>
  59. </div>
  60. <div v-else>
  61. <el-button type="text" size="small" @click="addImage(scope)" v-if="!scope.row.featureText">选择附图</el-button>
  62. <div v-else style="display:flex;align-items:center">
  63. <el-image class="img" :src="$commonJS.checkViewer(scope.row.featureText)" :preview-src-list="[$commonJS.checkViewer(scope.row.featureText)]"></el-image>
  64. <el-button type="text" size="small" @click="delImage(scope.row)"><i class="el-icon-delete" style="font-size:20px"></i></el-button>
  65. </div>
  66. </div>
  67. </template>
  68. </el-table-column>
  69. <el-table-column prop="literatureId" label="无效证据" v-if="['2','3','4','8'].indexOf(form.statutesId) !=-1">
  70. <template slot-scope="scope" v-if="!getFeatureDel(scope.row)">
  71. <div style="display:flex;align-items:center">
  72. <el-select v-model="scope.row.literatureId" multiple placeholder="请选择">
  73. <el-option v-for="item in evidenceList" :key="item.id" :label="`D${item.sysOrder}`" :value="item.id"></el-option>
  74. <el-option label="公知常识" :value="0"></el-option>
  75. <el-option label="惯用手段" :value="-1"></el-option>
  76. </el-select>
  77. <el-button type="text" size="small" @click="delEvidence(scope)"><i class="el-icon-delete" style="font-size:20px"></i></el-button>
  78. </div>
  79. </template>
  80. </el-table-column>
  81. <el-table-column prop="evidenceText" label="无效证据详情" >
  82. <template slot-scope="scope" v-if="!getFeatureDel(scope.row)">
  83. <div>
  84. <my-RichText v-model="scope.row.evidenceText" placeholder="请输入"></my-RichText>
  85. </div>
  86. </template>
  87. </el-table-column>
  88. <el-table-column prop="evidenceDescription" label="说明">
  89. <template slot-scope="scope" v-if="!getFeatureDel(scope.row)">
  90. <div>
  91. <el-input type="textarea" :autosize="{maxRows:5}" v-model="scope.row.evidenceDescription" placeholder="请输入"></el-input>
  92. </div>
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="操作" prop="featureOrder" width="150" align="center">
  96. <template slot-scope="scope">
  97. <div v-if="!getFeatureDel(scope.row)">
  98. <el-button type="text" size="small" @click="addEvidence(scope.row)">添加无效证据</el-button>
  99. <el-button type="text" size="small" @click="chooseHistory(scope.row)">选择历史无效证据</el-button>
  100. <el-button type="text" size="small" @click="dele(scope)">删除</el-button>
  101. </div>
  102. </template>
  103. </el-table-column>
  104. </el-table>
  105. </div>
  106. </div>
  107. </el-form>
  108. <span slot="footer" class="dialog-footer">
  109. <el-button @click="handleClose">取 消</el-button>
  110. <el-button type="primary" :loading="btnLoading" @click="submit" >确 定</el-button>
  111. </span>
  112. </el-dialog>
  113. <invalid-History ref="invalidHistory" @invalidHistory="getInvalidHistory"></invalid-History>
  114. <features-History ref="featuresHistory" @feature="getFeature"></features-History>
  115. <pictureManageDialog ref="pictureManageDialog" :projectId="projectId" @check="getPicture"></pictureManageDialog>
  116. </div>
  117. </template>
  118. <script>
  119. import invalidHistory from './invalidHistory.vue';
  120. import featuresHistory from './featuresHistory.vue';
  121. import pictureManageDialog from '../pictureManage/pictureManageDialog.vue';
  122. export default {
  123. components: {
  124. invalidHistory,
  125. featuresHistory,
  126. pictureManageDialog
  127. },
  128. props: {
  129. projectId:{
  130. default:0
  131. },
  132. ifSecondInvalid:{
  133. default:false
  134. }
  135. },
  136. data() {
  137. return {
  138. showDialog:false,
  139. btnLoading:false,
  140. form:{},
  141. title:'添加无效证据',
  142. features:[],
  143. evidenceList:[],
  144. // 计算表格合并行的数量
  145. mergeObj: {},
  146. // 表格合并行的栏位
  147. mergeArr: ['featureOrder',],
  148. row:{},
  149. descriptions:'',
  150. editProofGroupDescription:false,
  151. addFeatures:[],
  152. showFeature:false
  153. };
  154. },
  155. watch: {},
  156. computed: {
  157. provisions(){
  158. return this.$store.state.dictMessage.dictMessage.STATUTE || []
  159. }
  160. },
  161. created() {},
  162. mounted() {
  163. this.getEvidenceList()
  164. },
  165. methods: {
  166. //选择附图
  167. addImage(scope){
  168. var index = scope.$index
  169. var data = {
  170. index : index
  171. }
  172. this.$refs.pictureManageDialog.open(data)
  173. },
  174. //删除图片
  175. delImage(row){
  176. this.$set(row,'featureText','')
  177. },
  178. //获取选择的图片
  179. getPicture(val){
  180. var index = val.index
  181. var data = val.check
  182. var order = this.features[index].featureOrder
  183. var tableData = []
  184. data.forEach(item=>{
  185. tableData.push(
  186. {
  187. featureText:item,
  188. featureOrder:order
  189. }
  190. )
  191. order = Number(order) + 1
  192. })
  193. this.features.splice(index,1,...tableData)
  194. var feature = JSON.parse(JSON.stringify( this.features))
  195. this.features = feature
  196. this.getSpanArr(this.features)
  197. },
  198. //是否有删除特征
  199. getFeatureDel(row){
  200. if(!row.featureHistories){
  201. return false
  202. }
  203. return row.featureHistories.find(item=>{
  204. return item.operateMode == 1
  205. })
  206. },
  207. //编辑证据组合描述
  208. editContents(){
  209. this.$set(this,'editProofGroupDescription',true)
  210. this.$set(this,'descriptions',this.form.proofGroupDescription)
  211. },
  212. //取消编辑证据组合描述
  213. cancelContents(){
  214. this.$set(this,'editProofGroupDescription',false)
  215. },
  216. //提交证据组合描述
  217. submitContents(){
  218. var params = {
  219. projectId:this.projectId,
  220. statutesId:this.form.statutesId,
  221. claimId:this.form.claimId,
  222. descriptions:[],
  223. id:this.form.groupId,
  224. }
  225. if(this.ifSecondInvalid){
  226. params.descriptions = [
  227. {
  228. description2:this.descriptions
  229. }
  230. ]
  231. }else{
  232. params.descriptions = [
  233. {
  234. description1:this.descriptions
  235. }
  236. ]
  237. }
  238. this.$api.addProofGroup(params).then(response=>{
  239. if(response.code == 200){
  240. this.cancelContents()
  241. this.form.groupId = response.data.data[0]
  242. this.$emit('save',true)
  243. this.$set(this.form,'proofGroupDescription',this.descriptions)
  244. }
  245. }).catch(error=>{
  246. })
  247. },
  248. getEvidenceList(){
  249. var params ={
  250. projectId:this.projectId
  251. }
  252. this.$api.queryCompareLiterature(params).then(response=>{
  253. if(response.code == 200){
  254. this.evidenceList = response.data.data.sort((a,b)=>{
  255. return a.sysOrder - b.sysOrder
  256. })
  257. }
  258. }).catch(error=>{
  259. this.evidenceList = []
  260. })
  261. },
  262. //打开弹窗
  263. open(form,feature){
  264. this.form = form
  265. this.features = []
  266. this.addFeatures = []
  267. if(this.ifSecondInvalid){
  268. this.features = feature
  269. }else{
  270. if(feature && feature.length>0){
  271. for(var i = 0; i<feature.length;i++){
  272. var obj = feature[i].featureHistories.find(item=>{return item.featureGen == 0})
  273. if(obj){
  274. this.features.push(feature[i])
  275. }else{
  276. this.addFeatures.push(feature[i])
  277. }
  278. }
  279. }
  280. }
  281. if(this.features.length==0){
  282. this.showFeature = true
  283. }
  284. if(this.form.showFeature){
  285. this.showFeature = true
  286. }
  287. this.getSpanArr(this.features)
  288. this.showDialog = true
  289. },
  290. //关闭弹窗
  291. handleClose(){
  292. this.showDialog = false
  293. },
  294. //提交
  295. submit(){
  296. this.$refs.form.validate((valid) => {
  297. if (valid) {
  298. if(!this.form.groupId){
  299. this.$message.warning('请先添加证据组合!')
  300. return
  301. }
  302. var data = []
  303. if(this.addFeatures.length>0){
  304. var order = 0
  305. if(this.features && this.features.length>0){
  306. order = Number(this.features[this.features.length-1].featureOrder)
  307. }
  308. var order2 = Number(this.addFeatures[0].featureOrder)
  309. if(order + 1 != order2){
  310. for(var i = 0;i<this.addFeatures.length;i++){
  311. order += 1
  312. this.addFeatures[i].featureOrder = order
  313. }
  314. }
  315. data = this.features.concat(this.addFeatures)
  316. }else{
  317. data = this.features
  318. }
  319. this.btnLoading = true
  320. var params = {
  321. groupId:this.form.groupId,
  322. evidenceReasonList:data,
  323. gen:this.ifSecondInvalid?'1':'0'
  324. }
  325. this.$api.addEvidenceReason(params).then(response=>{
  326. if(response.code == 200){
  327. this.$message.success('添加成功')
  328. this.$emit('save',true)
  329. this.btnLoading = false
  330. this.handleClose()
  331. }
  332. }).catch(error=>{
  333. this.$message.error('添加失败')
  334. this.btnLoading = false
  335. })
  336. }
  337. })
  338. },
  339. //修改特征
  340. change(row){
  341. row.featureId = null
  342. },
  343. dele(scope){
  344. var index = scope.$index
  345. var row = scope.row
  346. var num = this.features.filter(item=>{
  347. return item.featureOrder == row.featureOrder
  348. }).length
  349. this.features.splice(index,num)
  350. for(var i = index;i<this.features.length;i++){
  351. var order = this.features[i].featureOrder
  352. this.features[i].featureOrder = Number(order) - 1
  353. this.features[i].featureId = null
  354. }
  355. var feature = JSON.parse(JSON.stringify( this.features))
  356. this.features = feature
  357. this.getSpanArr(this.features)
  358. },
  359. //删除某个特征的证据
  360. delEvidence(scope){
  361. var index = scope.$index
  362. var row = scope.row
  363. var num = this.features.filter(item=>{
  364. return item.featureOrder == row.featureOrder
  365. }).length
  366. if(num == 1){
  367. this.$set(row,'literatureId',[])
  368. }else{
  369. this.features.splice(index,1)
  370. var feature = JSON.parse(JSON.stringify( this.features))
  371. this.features = feature
  372. this.getSpanArr(this.features)
  373. }
  374. },
  375. //自动拆分特征
  376. splitClaim(){
  377. var claim = this.form.claimText
  378. var arr = claim.match(/\S*?([,|,|;|;|。])/g)
  379. var data = []
  380. var str = ''
  381. arr.forEach((item,index)=>{
  382. str += item
  383. var obj = {
  384. featureOrder:index+1,
  385. featureText:item,
  386. literatureId:[]
  387. }
  388. data.push(obj)
  389. })
  390. var str2 = claim.replace(str,'')
  391. if(str2){
  392. var index = 0
  393. if(data.length>0){
  394. index = data[data.length-1].featureOrder
  395. }
  396. var obj = {
  397. featureOrder:index+1,
  398. featureText:str2,
  399. literatureId:[]
  400. }
  401. data.push(obj)
  402. }
  403. this.features = data
  404. this.getSpanArr(this.features)
  405. },
  406. //添加特征
  407. addFeature(){
  408. var order = 0
  409. if(this.features.length>0){
  410. order = this.features[this.features.length - 1].featureOrder
  411. }
  412. var obj = {
  413. featureOrder:Number(order) + 1,
  414. literatureId:[]
  415. }
  416. this.features.push(obj)
  417. this.getSpanArr(this.features)
  418. },
  419. //特征拆分历史
  420. featuresHistory(){
  421. this.$refs.featuresHistory.open(this.form.claimId)
  422. },
  423. //获取特征历史的值
  424. getFeature(val){
  425. console.log(val)
  426. if(val && val.length>0){
  427. var arr = []
  428. val.forEach(item=>{
  429. item.ifFeatureHistory = true
  430. arr.push(item)
  431. })
  432. console.log(arr)
  433. this.features = arr
  434. this.getSpanArr(this.features)
  435. }
  436. // this.features = val.forEach(item=>{
  437. // item.ifFeatureHistory = true
  438. // })
  439. // this.getSpanArr(this.features)
  440. },
  441. //选择历史无效记录
  442. chooseHistory(row){
  443. this.row = row
  444. if(row.featureId){
  445. this.$refs.invalidHistory.open(row.featureId)
  446. }else{
  447. this.$message.warning('该特征无历史无效记录')
  448. }
  449. },
  450. //获取历史无效记录的值
  451. getInvalidHistory(data){
  452. if(data.length == 0){
  453. return false
  454. }
  455. var index = this.features.findLastIndex(item=>{
  456. return item.featureOrder == this.row.featureOrder
  457. })
  458. var obj = {
  459. featureId: this.row.featureId,
  460. featureOrder : this.row.featureOrder,
  461. featureText : this.row.featureText,
  462. }
  463. var features = []
  464. for(var i = 0;i<data.length;i++){
  465. var obj2 = {
  466. ...obj,
  467. ...data[i],
  468. literatureId:data[i].literatures.map(item=>item.id)
  469. }
  470. features.push(obj2)
  471. }
  472. if(this.features[index].literatureId && this.features[index].literatureId.length>0){
  473. this.features.splice(index+1,0,...features)
  474. }else{
  475. this.features.splice(index,1,...features)
  476. }
  477. var feature = JSON.parse(JSON.stringify( this.features))
  478. this.features = feature
  479. this.getSpanArr(this.features)
  480. },
  481. //添加无效证据
  482. addEvidence(row){
  483. var index = this.features.findLastIndex(item=>{
  484. return item.featureOrder == row.featureOrder
  485. })
  486. var obj = {
  487. featureGroupId:row.featureGroupId,
  488. featureId: row.featureId,
  489. featureOrder : row.featureOrder,
  490. featureText : row.featureText,
  491. literatureId:[]
  492. }
  493. this.features.splice(index+1,0,obj)
  494. var feature = JSON.parse(JSON.stringify( this.features))
  495. this.features = feature
  496. this.getSpanArr(this.features)
  497. },
  498. //获取每个元素所需合并的行数
  499. getSpanArr(data) {
  500. this.scopeRow = []
  501. this.mergeArr.forEach((key, index1) => {
  502. let count = 0;
  503. this.mergeObj[key] = [];
  504. data.forEach((item, index) => {
  505. if (index === 0) {
  506. this.mergeObj[key].push(1);
  507. } else {
  508. if (item[key] === data[index - 1][key]) {
  509. this.mergeObj[key][count] += 1;
  510. this.mergeObj[key].push(0);
  511. } else {
  512. count = index;
  513. this.mergeObj[key].push(1);
  514. }
  515. }
  516. })
  517. })
  518. },
  519. // 表格合并行
  520. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  521. if (!row) {
  522. return false
  523. }
  524. if (this.mergeArr.indexOf(column.property) !== -1) {
  525. if (this.mergeObj[column.property][rowIndex]) {
  526. return [this.mergeObj[column.property][rowIndex], 1]
  527. } else {
  528. return [0, 0];
  529. }
  530. }
  531. },
  532. },
  533. };
  534. </script>
  535. <style lang="scss" scoped>
  536. </style>