addEvidenceReason.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  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. description1:this.form.proofGroupDescription1,
  230. }
  231. ]
  232. }else{
  233. params.descriptions = [
  234. {
  235. description1:this.descriptions,
  236. description2:this.form.proofGroupDescription1,
  237. }
  238. ]
  239. }
  240. this.$api.addProofGroup(params).then(response=>{
  241. if(response.code == 200){
  242. this.cancelContents()
  243. this.form.groupId = response.data.data[0]
  244. this.$emit('save',true)
  245. this.$set(this.form,'proofGroupDescription',this.descriptions)
  246. }
  247. }).catch(error=>{
  248. })
  249. },
  250. getEvidenceList(){
  251. var params ={
  252. projectId:this.projectId
  253. }
  254. this.$api.queryCompareLiterature(params).then(response=>{
  255. if(response.code == 200){
  256. this.evidenceList = response.data.data.sort((a,b)=>{
  257. return a.sysOrder - b.sysOrder
  258. })
  259. }
  260. }).catch(error=>{
  261. this.evidenceList = []
  262. })
  263. },
  264. //打开弹窗
  265. open(form,feature){
  266. this.form = form
  267. this.features = []
  268. this.addFeatures = []
  269. if(this.ifSecondInvalid){
  270. this.features = feature
  271. }else{
  272. if(feature && feature.length>0){
  273. for(var i = 0; i<feature.length;i++){
  274. var obj = feature[i].featureHistories.find(item=>{return item.featureGen == 0})
  275. if(obj){
  276. this.features.push(feature[i])
  277. }else{
  278. this.addFeatures.push(feature[i])
  279. }
  280. }
  281. }
  282. }
  283. if(this.features.length==0){
  284. this.showFeature = true
  285. }
  286. if(this.form.showFeature){
  287. this.showFeature = true
  288. }
  289. this.getSpanArr(this.features)
  290. this.showDialog = true
  291. },
  292. //关闭弹窗
  293. handleClose(){
  294. this.showDialog = false
  295. },
  296. //提交
  297. submit(){
  298. this.$refs.form.validate((valid) => {
  299. if (valid) {
  300. if(!this.form.groupId){
  301. this.$message.warning('请先添加证据组合!')
  302. return
  303. }
  304. var data = []
  305. if(this.addFeatures.length>0){
  306. var order = 0
  307. if(this.features && this.features.length>0){
  308. order = Number(this.features[this.features.length-1].featureOrder)
  309. }
  310. var order2 = Number(this.addFeatures[0].featureOrder)
  311. if(order + 1 != order2){
  312. for(var i = 0;i<this.addFeatures.length;i++){
  313. order += 1
  314. this.addFeatures[i].featureOrder = order
  315. }
  316. }
  317. data = this.features.concat(this.addFeatures)
  318. }else{
  319. data = this.features
  320. }
  321. this.btnLoading = true
  322. var params = {
  323. groupId:this.form.groupId,
  324. evidenceReasonList:data,
  325. gen:this.ifSecondInvalid?'1':'0'
  326. }
  327. this.$api.addEvidenceReason(params).then(response=>{
  328. if(response.code == 200){
  329. this.$message.success('添加成功')
  330. this.$emit('save',true)
  331. this.btnLoading = false
  332. this.handleClose()
  333. }
  334. }).catch(error=>{
  335. this.$message.error('添加失败')
  336. this.btnLoading = false
  337. })
  338. }
  339. })
  340. },
  341. //修改特征
  342. change(row){
  343. row.featureId = null
  344. },
  345. dele(scope){
  346. var index = scope.$index
  347. var row = scope.row
  348. var num = this.features.filter(item=>{
  349. return item.featureOrder == row.featureOrder
  350. }).length
  351. this.features.splice(index,num)
  352. for(var i = index;i<this.features.length;i++){
  353. var order = this.features[i].featureOrder
  354. this.features[i].featureOrder = Number(order) - 1
  355. this.features[i].featureId = null
  356. }
  357. var feature = JSON.parse(JSON.stringify( this.features))
  358. this.features = feature
  359. this.getSpanArr(this.features)
  360. },
  361. //删除某个特征的证据
  362. delEvidence(scope){
  363. var index = scope.$index
  364. var row = scope.row
  365. var num = this.features.filter(item=>{
  366. return item.featureOrder == row.featureOrder
  367. }).length
  368. if(num == 1){
  369. this.$set(row,'literatureId',[])
  370. }else{
  371. this.features.splice(index,1)
  372. var feature = JSON.parse(JSON.stringify( this.features))
  373. this.features = feature
  374. this.getSpanArr(this.features)
  375. }
  376. },
  377. //自动拆分特征
  378. splitClaim(){
  379. var claim = this.form.claimText
  380. var arr = claim.match(/\S*?([,|,|;|;|。])/g)
  381. var data = []
  382. var str = ''
  383. arr.forEach((item,index)=>{
  384. str += item
  385. var obj = {
  386. featureOrder:index+1,
  387. featureText:item,
  388. literatureId:[]
  389. }
  390. data.push(obj)
  391. })
  392. var str2 = claim.replace(str,'')
  393. if(str2){
  394. var index = 0
  395. if(data.length>0){
  396. index = data[data.length-1].featureOrder
  397. }
  398. var obj = {
  399. featureOrder:index+1,
  400. featureText:str2,
  401. literatureId:[]
  402. }
  403. data.push(obj)
  404. }
  405. this.features = data
  406. this.getSpanArr(this.features)
  407. },
  408. //添加特征
  409. addFeature(){
  410. var order = 0
  411. if(this.features.length>0){
  412. order = this.features[this.features.length - 1].featureOrder
  413. }
  414. var obj = {
  415. featureOrder:Number(order) + 1,
  416. literatureId:[]
  417. }
  418. this.features.push(obj)
  419. this.getSpanArr(this.features)
  420. },
  421. //特征拆分历史
  422. featuresHistory(){
  423. this.$refs.featuresHistory.open(this.form.claimId)
  424. },
  425. //获取特征历史的值
  426. getFeature(val){
  427. if(val && val.length>0){
  428. var arr = []
  429. val.forEach(item=>{
  430. item.ifFeatureHistory = true
  431. arr.push(item)
  432. })
  433. console.log(arr)
  434. this.features = arr
  435. this.getSpanArr(this.features)
  436. }
  437. },
  438. //选择历史无效记录
  439. chooseHistory(row){
  440. this.row = row
  441. if(row.featureId){
  442. this.$refs.invalidHistory.open(row.featureId)
  443. }else{
  444. this.$message.warning('该特征无历史无效记录')
  445. }
  446. },
  447. //获取历史无效记录的值
  448. getInvalidHistory(data){
  449. if(data.length == 0){
  450. return false
  451. }
  452. var index = this.features.findLastIndex(item=>{
  453. return item.featureOrder == this.row.featureOrder
  454. })
  455. var obj = {
  456. featureId: this.row.featureId,
  457. featureOrder : this.row.featureOrder,
  458. featureText : this.row.featureText,
  459. }
  460. var features = []
  461. for(var i = 0;i<data.length;i++){
  462. var obj2 = {
  463. ...obj,
  464. ...data[i],
  465. literatureId:data[i].literatures.map(item=>item.id)
  466. }
  467. features.push(obj2)
  468. }
  469. if(this.features[index].literatureId && this.features[index].literatureId.length>0){
  470. this.features.splice(index+1,0,...features)
  471. }else{
  472. this.features.splice(index,1,...features)
  473. }
  474. var feature = JSON.parse(JSON.stringify( this.features))
  475. this.features = feature
  476. this.getSpanArr(this.features)
  477. },
  478. //添加无效证据
  479. addEvidence(row){
  480. var index = this.features.findLastIndex(item=>{
  481. return item.featureOrder == row.featureOrder
  482. })
  483. var obj = {
  484. featureGroupId:row.featureGroupId,
  485. featureId: row.featureId,
  486. featureOrder : row.featureOrder,
  487. featureText : row.featureText,
  488. literatureId:[]
  489. }
  490. this.features.splice(index+1,0,obj)
  491. var feature = JSON.parse(JSON.stringify( this.features))
  492. this.features = feature
  493. this.getSpanArr(this.features)
  494. },
  495. //获取每个元素所需合并的行数
  496. getSpanArr(data) {
  497. this.scopeRow = []
  498. this.mergeArr.forEach((key, index1) => {
  499. let count = 0;
  500. this.mergeObj[key] = [];
  501. data.forEach((item, index) => {
  502. if (index === 0) {
  503. this.mergeObj[key].push(1);
  504. } else {
  505. if (item[key] === data[index - 1][key]) {
  506. this.mergeObj[key][count] += 1;
  507. this.mergeObj[key].push(0);
  508. } else {
  509. count = index;
  510. this.mergeObj[key].push(1);
  511. }
  512. }
  513. })
  514. })
  515. },
  516. // 表格合并行
  517. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  518. if (!row) {
  519. return false
  520. }
  521. if (this.mergeArr.indexOf(column.property) !== -1) {
  522. if (this.mergeObj[column.property][rowIndex]) {
  523. return [this.mergeObj[column.property][rowIndex], 1]
  524. } else {
  525. return [0, 0];
  526. }
  527. }
  528. },
  529. },
  530. };
  531. </script>
  532. <style lang="scss" scoped>
  533. </style>