addAndEditReport.vue 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273
  1. <template>
  2. <div>
  3. <el-dialog :title="title" :visible.sync="showDialog" width="1000px" :close-on-click-modal="false"
  4. @close="handleClose(false)" :append-to-body="true">
  5. <el-form :model="form" :rules="rules" ref="reportForm" label-width="120px" v-loading="loading"
  6. :element-loading-text="load_text" element-loading-spinner="el-icon-loading"
  7. element-loading-background-color="rgba(0, 0, 0, 0.8)">
  8. <el-row>
  9. <el-col :span="12">
  10. <template>
  11. <div>
  12. <el-form-item v-if="form.reportType == 3" label="标的产品" prop="signProjectIds">
  13. <el-autocomplete v-model="form.signProjectIds" value-key="name" v-SelectLazyLoading="productLoad"
  14. :fetch-suggestions="querySearchProduct" placeholder="请输入标的产品" :trigger-on-focus="false"
  15. @select="handleSelectProduct" @change="handleChangeProduct"
  16. style="width: 100%;"></el-autocomplete>
  17. </el-form-item>
  18. <el-form-item v-else label="标的专利" prop="signPatentNo">
  19. <div style="display:flex;align-items:center">
  20. <el-input v-model="form.signPatentNo" autocomplete="off" placeholder="请输入标的专利" @change="getPatentNo(1)"></el-input>
  21. <span v-if="patentLoading">
  22. <i class="el-icon-loading"></i>
  23. </span>
  24. </div>
  25. </el-form-item>
  26. </div>
  27. </template>
  28. </el-col>
  29. <el-col :span="12">
  30. <el-form-item label="报告名称" prop="name">
  31. <el-input v-model="form.name" autocomplete="off" placeholder="请输入报告名称"></el-input>
  32. </el-form-item>
  33. </el-col>
  34. </el-row>
  35. <template v-if="form.reportType == 7">
  36. <div>
  37. <el-row>
  38. <el-col :span="12">
  39. <el-form-item label="案件编号" prop="caseNumber">
  40. <el-input v-model="form.caseNumber" @change="getPatentNo" autocomplete="off" placeholder="请输入案件编号"></el-input>
  41. </el-form-item>
  42. </el-col>
  43. <el-col :span="12">
  44. <el-form-item label="无效宣告请求人" prop="invalidApplication">
  45. <el-input v-model="form.invalidApplication" autocomplete="off" placeholder="请输入无效宣告请求人"></el-input>
  46. </el-form-item>
  47. </el-col>
  48. </el-row>
  49. <el-row>
  50. <el-col :span="12">
  51. <el-form-item label="发文序号" prop="issueNumber">
  52. <el-input v-model="form.issueNumber" autocomplete="off" placeholder="请输入发文序号"></el-input>
  53. </el-form-item>
  54. </el-col>
  55. <el-col :span="12">
  56. <el-form-item label="发明创造名称" prop="inventionName">
  57. <el-input v-model="form.inventionName" autocomplete="off" placeholder="请输入发明创造名称"></el-input>
  58. </el-form-item>
  59. </el-col>
  60. </el-row>
  61. </div>
  62. </template>
  63. <el-row>
  64. <el-col :span="12" v-if="form.reportType == 7">
  65. <el-form-item label="主被动类型" prop="actType">
  66. <el-select v-model="form.actType" placeholder="请选择" style="width:100%">
  67. <el-option
  68. v-for="item in actTypes "
  69. :key="item.value"
  70. :label="item.label"
  71. :value="item.value">
  72. </el-option>
  73. </el-select>
  74. </el-form-item>
  75. </el-col>
  76. <el-col :span="12">
  77. <el-form-item label="是否完成" v-if="!form.id" prop="status">
  78. <el-switch v-model="form.status" active-color="#13ce66" @change="changeStatus"
  79. :active-value="3" :inactive-value="2">
  80. </el-switch>
  81. </el-form-item>
  82. </el-col>
  83. </el-row>
  84. <template v-if="!form.id && form.status == 3">
  85. <div>
  86. <el-form-item label="核心结论" prop="cronIds">
  87. <el-checkbox-group v-model="form.cronIds">
  88. <el-checkbox v-for="item in conclusion" :key="item.value" :label="item.value">{{
  89. item.label }}</el-checkbox>
  90. </el-checkbox-group>
  91. </el-form-item>
  92. <el-form-item label="结论论述" prop="cronDescription">
  93. <el-input v-model="form.cronDescription" type="textarea" placeholder="请输入结论论述"></el-input>
  94. </el-form-item>
  95. <el-form-item label="后续跟进事项" prop="followUps">
  96. <span v-if="form.followUps"><span v-for="item in form.followUps" :key="item.name"
  97. style="margin-right:10px">{{ item.name }}</span></span>
  98. <span>
  99. <el-popover ref="popover" placement="bottom" @hide="hidePopover" trigger="click">
  100. <div>
  101. <addMatter :type="matterType" ref="addMatter"></addMatter>
  102. </div>
  103. <el-button slot="reference">添加后续事项</el-button>
  104. </el-popover>
  105. </span>
  106. </el-form-item>
  107. </div>
  108. </template>
  109. <el-row>
  110. <el-col :span="12">
  111. <el-form-item label="承担部门" prop="departmentId">
  112. <mySelectTree style="width:100%" v-model="form.departmentId" :options="departmentList"></mySelectTree>
  113. </el-form-item>
  114. </el-col>
  115. <el-col :span="12">
  116. <el-form-item label="负责人" prop="headId">
  117. <el-select style="width:100%" v-model="form.headId" placeholder="请选择负责人" filterable remote
  118. :popper-append-to-body="false" :remote-method="remoteMethodPerson" v-SelectLazyLoading="lazyLoadingPerson"
  119. :loading="personnelList.loading">
  120. <el-option v-for="item in personnelList.data" :key="Number(item.id)" :label="item.name"
  121. :value="Number(item.id)"></el-option>
  122. </el-select>
  123. </el-form-item>
  124. </el-col>
  125. </el-row>
  126. <el-row>
  127. <el-col :span="12">
  128. <template>
  129. <div>
  130. <el-form-item label="委托方" prop="entrustId" v-if="userinfo.tenantType == 1">
  131. <mySelectButton size='large' style="width:100%" @click="handleSelect">
  132. <div style="width:100%">
  133. <el-autocomplete style="width:100%" v-model="form.entrustName" ref="client" value-key="name"
  134. :fetch-suggestions="querySearch" v-SelectLazyLoading="loadClient" @input="input"
  135. placeholder="请输入内容" :trigger-on-focus="false" @select="handleChange">
  136. </el-autocomplete>
  137. </div>
  138. </mySelectButton>
  139. </el-form-item>
  140. <el-form-item label="委托部门" prop="departmentId" v-else>
  141. <mySelectTree style="width:100%" v-model="form.departmentId" :options="departmentList"></mySelectTree>
  142. </el-form-item>
  143. </div>
  144. </template>
  145. </el-col>
  146. <el-col :span="12">
  147. <el-form-item label="卷号" prop="volumeNumber">
  148. <el-input v-model="form.volumeNumber" autocomplete="off" placeholder="请输入卷号"></el-input>
  149. </el-form-item>
  150. </el-col>
  151. </el-row>
  152. <el-row>
  153. <el-col :span="24">
  154. <el-form-item label="产品/技术" prop="productOrTech">
  155. <el-input v-model="form.productOrTech" autocomplete="off" placeholder="请输入产品/技术"></el-input>
  156. </el-form-item>
  157. </el-col>
  158. </el-row>
  159. <el-row>
  160. <el-col :span="form.track ? 12 : 24">
  161. <el-form-item label="关联报告" prop="associateReportName">
  162. <el-input v-model="form.associateReportName" autocomplete="off" placeholder="请输入关联报告"></el-input>
  163. </el-form-item>
  164. </el-col>
  165. <el-col :span="12">
  166. <el-form-item label="需要复制的选项" v-show="form.track" prop="copyIds">
  167. <el-select v-model="form.copyIds" multiple clearable placeholder="请选择需要复制的选项" :popper-append-to-body="false"
  168. @change="changeCopyIds">
  169. <el-option v-for="item in copyList" :key="item.value" :label="item.label" :value="item.value"></el-option>
  170. </el-select>
  171. </el-form-item>
  172. </el-col>
  173. </el-row>
  174. <template >
  175. <div>
  176. <el-row>
  177. <el-col :span="24">
  178. <el-form-item label="事件:" prop="eventId">
  179. <mySelectButton size='large' style="width:100%" @click="addEvent">
  180. <div style="width:100%">
  181. <el-select style="width:100%" v-model="form.eventId" @change="changeEvent" filterable remote
  182. :disabled="eventList.disabled" clearable placeholder="请选择" :loading="eventList.loading"
  183. v-SelectLazyLoading="loadEvent" :remote-method="remoteEvent">
  184. <el-option v-for="item in eventList.data" :key="item.id" :label="item.name" :value="item.id">
  185. </el-option>
  186. </el-select>
  187. </div>
  188. <span slot="button">
  189. <i class="el-icon-plus"></i>
  190. </span>
  191. </mySelectButton>
  192. </el-form-item>
  193. </el-col>
  194. </el-row>
  195. <el-row v-if="show == true">
  196. <el-col :span="24">
  197. <el-form-item label="调查类型:" prop="matterIds" >
  198. <el-checkbox-group v-model="form.matterIds">
  199. <template>
  200. <el-checkbox v-for="item in dictAssociates" :key="item.id" :label="parseInt(item.id)">
  201. {{ item.name }}
  202. </el-checkbox>
  203. </template>
  204. </el-checkbox-group>
  205. </el-form-item>
  206. </el-col>
  207. </el-row>
  208. </div>
  209. </template>
  210. <template v-if="form.reportType == 7 && !form.id">
  211. <div>
  212. <el-form-item label="无效请求书" prop="flowPath">
  213. <div v-if="form.flowPath">
  214. <div v-if="form.flowPath.systemFileList && form.flowPath.systemFileList.length>0">
  215. <div v-for="item in form.flowPath.systemFileList" :key="item.guid">
  216. {{ item.name }}
  217. </div>
  218. </div>
  219. </div>
  220. <div v-else>
  221. <el-button type="text" size="small" @click="addFlowPath">添加无效请求书</el-button>
  222. </div>
  223. </el-form-item>
  224. </div>
  225. </template>
  226. <el-form-item :label="(!form.id && form.status == 3) ? '上传报告文档' : '上传附件'" prop="systemFileList">
  227. <myUpload :file-list="form.systemFileList" @on-change="onchangeFile" @on-remove="onRemove" style="height: 180px;" :autoUpload="true"></myUpload>
  228. </el-form-item>
  229. <el-form-item label="备注" prop="description">
  230. <el-input type='textarea' v-model="form.description" autocomplete="off" placeholder="请输入备注"></el-input>
  231. </el-form-item>
  232. </el-form>
  233. <div slot="footer">
  234. <div v-if="havePatent.show" style="padding:0 15px">
  235. <el-checkbox v-model="havePatent.checked">将选择的专利作为该报告的相关专利</el-checkbox>
  236. </div>
  237. <el-button @click="handleClose(false)">取 消</el-button>
  238. <!-- <el-button type="primary" @click="ifNext" v-if="form.reportType == 7 && !form.id">下一步</el-button> -->
  239. <el-button type="primary" :loading="patentLoading" @click="submit">确 定</el-button>
  240. </div>
  241. </el-dialog>
  242. <!-- 审核弹窗,做公用组件 -->
  243. <el-dialog title="添加审核任务" :visible.sync="showTask" width="500px" @close="handleCloseTask" :append-to-body="true"
  244. :close-on-click-modal="false">
  245. <el-form :model="taskForm" :rules="TaskRules" ref="TaskForm" label-width="120px" v-loading="loading">
  246. <el-form-item label="任务名称:" prop="name">
  247. <el-input v-model="taskForm.name" type="text" placeholder="输入任务名称" />
  248. </el-form-item>
  249. <el-form-item label="审核人:" prop="handler">
  250. <el-select style="width:100%;" ref="select1" v-model="taskForm.handler" clearable filterable remote
  251. :remote-method="remoteMethodPerson" v-SelectLazyLoading="lazyLoadingPerson">
  252. <el-option v-for="item in personnelList.data" :key="item.id" :label="item.name" :value="item.id"
  253. placeholder="请选择审核人"></el-option>
  254. </el-select>
  255. </el-form-item>
  256. <el-form-item label="完成日期:" prop="deadLineTime">
  257. <el-date-picker style="width:100%" v-model="taskForm.deadLineTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime"
  258. placeholder="选择日期">
  259. </el-date-picker>
  260. </el-form-item>
  261. <el-form-item label="审核备注:" prop="description">
  262. <el-input v-model="taskForm.description" type="textarea" placeholder="输入备注" />
  263. </el-form-item>
  264. </el-form>
  265. <span slot="footer" class="dialog-footer">
  266. <el-button @click="handleCloseTask">取 消</el-button>
  267. <el-button type="primary" @click="submitTask">确 定</el-button>
  268. </span>
  269. </el-dialog>
  270. <!-- 委托方弹窗 -->
  271. <el-dialog title="选择委托方" :visible.sync="visible" width="800px" :append-to-body="true" :close-on-click-modal="false"
  272. destroy-on-close :before-close="close2" top="10vh">
  273. <ClientTable :choseClient="true" @getClient="getClient"></ClientTable>
  274. </el-dialog>
  275. <!-- 添加无效请求书 -->
  276. <addFlowPath ref="addFlowPath" @save="getFlowPath"></addFlowPath>
  277. <addEvent ref="addEvent" @isSuccess="handleSuccess"></addEvent>
  278. </div>
  279. </template>
  280. <script>
  281. import { mapGetters } from 'vuex'
  282. import addMatter from '../matter/addMatters.vue'
  283. import ClientTable from '@/views/client'
  284. import addFlowPath from '@/views/report/InvalidResponse/components/dialog/editFlowPath.vue'
  285. import addEvent from '@/views/event/components/dialog/addEvent.vue';
  286. export default {
  287. components: {
  288. addMatter,
  289. ClientTable,
  290. addFlowPath,
  291. addEvent
  292. },
  293. props: {},
  294. data() {
  295. const isExist = (rule, value, callback) => {
  296. if (!this.form.signPatentNo && !this.form.signProjectIds) {//没有专利号进入报错提示
  297. if ([3].includes(Number(this.form.reportType))) {
  298. var text = '请输入标的产品'
  299. } else {
  300. var text = '请输入标的专利号'
  301. }
  302. callback(new Error(text))
  303. } else {
  304. callback()
  305. }
  306. }
  307. const isTime = (rule, value, callback) => {
  308. if (this.isEndTime) {
  309. this.isEndTimes = Date.parse(new Date)
  310. }
  311. let b = Date.parse(value)
  312. if (value) {
  313. if (b < this.isEndTimes) {
  314. callback(new Error('禁止选择现在及以前时间,请重新选择'))
  315. } else {
  316. callback()
  317. }
  318. } else {
  319. callback(new Error('请选择时间'))
  320. }
  321. }
  322. return {
  323. //弹窗标题
  324. title: '',
  325. //控制弹窗是否打开
  326. showDialog: false,
  327. //表单数据
  328. form: {
  329. matterIds: [],
  330. systemFileList: [],
  331. fileGuids: [],
  332. },
  333. //表单规则
  334. rules: {
  335. name: [{ required: true, message: '请输入报告名称', trigger: 'blur' },],
  336. signProjectIds: [{ required: true, validator: isExist, trigger: 'blur' },],//产品
  337. signPatentNo: [{ required: true, validator: isExist, trigger: 'blur' },],//专利
  338. headId: [{ required: true, message: '请选择负责人', trigger: 'change' },],
  339. entrustId: [{ required: true, message: '请选择委托方', trigger: 'change' },],
  340. },
  341. patentLoading:false,
  342. taskId:null,
  343. //加载
  344. loading: false,
  345. //加载时显示的文字
  346. load_text: '加载中',
  347. //应用场景
  348. commonData: {},
  349. //核心结论
  350. conclusion: [],
  351. //部门数据
  352. departmentList: [],
  353. //需要复制的选项集合
  354. copyList: [],
  355. //上传文件列表
  356. files: [],
  357. //核心结论类型字典
  358. reportAsDicItem: {
  359. "0": "INVALID_ASSESS",
  360. "1": "THIRD_ASSESS",
  361. "2": "STABILITY_ASSESS",
  362. "3": "FTO_ASSESS",
  363. "4": "TORT_ASSESS",
  364. "5": "AVOID_ASSESS",
  365. "7": "REINVALID_ASSESS",
  366. },
  367. //需要复制的内容字典
  368. reportAsDicItemCopy: {
  369. "0": "INVALID_COPY",
  370. "1": "THIRD_COPY",
  371. "2": "STABILITY_COPY",
  372. "3": "FTO_COPY",
  373. "4": "TORT_COPY",
  374. "5": "AVOID_COPY",
  375. "7":"INVALID_COPY"
  376. },
  377. /**
  378. * 委托方
  379. */
  380. clientList: {
  381. queryParams: {
  382. current: 1,
  383. size: 10
  384. },
  385. data: [],
  386. cb: null
  387. },
  388. visible: false,
  389. //人员列表懒加载
  390. personnelList: {
  391. queryParams: {
  392. current: 1,
  393. size: 10
  394. },
  395. data: []
  396. },
  397. //产品列表懒加载
  398. productList: {
  399. queryParams: {
  400. current: 1,
  401. size: 10
  402. },
  403. loading: false,
  404. name: '',
  405. data: [],
  406. },
  407. matterType: null,
  408. //事件列表
  409. eventList: {
  410. queryParams: {
  411. current: 1,
  412. size: 10
  413. },
  414. data: []
  415. },
  416. // 控制调查类型是否显示
  417. show: false,
  418. //调查类型列表
  419. dictAssociates: [],
  420. /*审核弹窗所需变量start*/
  421. showTask: false,
  422. // 任务表单
  423. taskForm: {},
  424. isEndTime: true,
  425. isEndTimes: null,
  426. // 任务表单校验
  427. TaskRules: {
  428. name: [{ required: true, message: '请输入任务名称', trigger: 'blur' },],
  429. handler: [{ required: true, message: '请选择审核人', trigger: 'change' },],
  430. deadLineTime: [{ required: true, validator: isTime, trigger: 'change' }],
  431. },
  432. /*审核弹窗所需变量end*/
  433. actTypes:[
  434. {
  435. label:'主动',
  436. value:1
  437. },
  438. {
  439. label:'被动',
  440. value:0
  441. },
  442. ],
  443. isExist:true,
  444. havePatent:{
  445. show:false,
  446. checked:false
  447. },
  448. };
  449. },
  450. watch: {},
  451. computed: {
  452. ...mapGetters(['webSocket', 'userinfo']),
  453. dictMessage() {
  454. return this.$store.state.dictMessage.dictMessage
  455. },
  456. scenario() {
  457. return this.$store.state.dictMessage.scenario || []
  458. }
  459. },
  460. created() { },
  461. mounted() {
  462. //获取所有部门列表
  463. this.getDepartment()
  464. this.initTask()
  465. },
  466. methods: {
  467. initTask() {
  468. this.webSocket.onmessage = (e) => {
  469. if(e.data.indexOf('{') == -1){
  470. return false
  471. }
  472. const { code, data, message } = JSON.parse(e.data)
  473. if (code === 903) {
  474. if (data.complete && data.taskId == this.taskId) {
  475. this.patentLoading = false
  476. }
  477. }
  478. }
  479. },
  480. /**
  481. * 人员
  482. */
  483. // 人员列表远程搜索
  484. remoteMethodPerson(query) {
  485. this.personnelList.data = []
  486. this.personnelList.queryParams.current = 1
  487. this.personnelList.queryParams.name = query
  488. this.getPermissionPersonnel(1)
  489. },
  490. // 获取所有人员列表懒加载
  491. lazyLoadingPerson() {
  492. if (this.personnelList.queryParams.current * this.personnelList.queryParams.size >= this.personnelList.queryParams.total) {
  493. return false
  494. }
  495. this.personnelList.queryParams.current += 1
  496. this.getPermissionPersonnel()
  497. },
  498. //获取所有人员列表(修改不要一次性获取,可以使用懒加载加远程搜索 )
  499. async getPermissionPersonnel(type) {
  500. this.personnelList.loading = true;
  501. await this.$api.getPermissionPersonnel(this.personnelList.queryParams).then((response) => {
  502. if (response.code == 200) {
  503. this.personnelList.loading = false;
  504. if(!type){
  505. var index = response.data.findIndex(item=>{
  506. return item.id == this.form.headId
  507. })
  508. if(index!=-1){
  509. response.data.splice(index,1)
  510. }
  511. this.personnelList.queryParams.total=response.pageColumn.total
  512. }
  513. this.personnelList.data.push(...response.data)
  514. // this.personnelList.queryParams.total = response.pageColumn.total
  515. }
  516. })
  517. },
  518. /**
  519. * 客户/委托方
  520. */
  521. //远程搜索委托方(建议调取接口获取)
  522. async querySearch(queryString, cb) {
  523. this.clientList.queryParams.current = 1
  524. this.clientList.queryParams.name = queryString
  525. this.clientList.data = []
  526. this.clientList.cb = cb
  527. await this.getClientList()
  528. // 调用 callback 返回建议列表的数据
  529. // cb(this.clientList.data);
  530. },
  531. loadClient() {
  532. if (this.clientList.queryParams.current * this.clientList.queryParams.size >= this.clientList.queryParams.total) {
  533. return false
  534. }
  535. this.clientList.queryParams.current += 1
  536. this.getClientList()
  537. },
  538. //获取委托方
  539. async getClientList() {
  540. await this.$api.getAdminClientList(this.clientList.queryParams).then(res => {
  541. if (res.code == 200) {
  542. this.clientList.data.push(...res.data.records)
  543. this.clientList.queryParams.total = res.data.total
  544. this.clientList.cb(this.clientList.data);
  545. }
  546. })
  547. },
  548. //输入框输入事件(委托方)
  549. input() {
  550. this.$set(this.form, 'entrustId', -1)
  551. },
  552. //切换选择委托方
  553. handleChange(row) {
  554. this.$set(this.form, 'entrustId', row.id)
  555. this.$set(this.form, 'entrustName', row.name)
  556. this.close2()
  557. },
  558. //打开选择委托方弹窗
  559. handleSelect() {
  560. this.visible = true
  561. },
  562. //获取委托方信息
  563. getClient(row) {
  564. this.$set(this.form, 'entrustId', row.id)
  565. this.$set(this.form, 'entrustName', row.name)
  566. this.close2()
  567. },
  568. //关闭委托方弹窗
  569. close2() {
  570. this.visible = false
  571. },
  572. /**
  573. * 事件处理
  574. */
  575. //打开事件弹窗
  576. addEvent() {
  577. var form = {
  578. }
  579. this.$refs.addEvent.open(form, 1)
  580. },
  581. //事件新增成功
  582. handleSuccess(){
  583. this.eventList.data=[]
  584. this.eventList.queryParams.current = 1
  585. this.eventList.name = ''
  586. this.getEventList()
  587. },
  588. /**
  589. * 事件
  590. */
  591. //懒加载事件
  592. loadEvent() {
  593. if (this.eventList.queryParams.current * this.eventList.queryParams.size >= this.eventList.queryParams.total) {
  594. return false
  595. }
  596. this.eventList.queryParams.current += 1
  597. this.getEventList()
  598. },
  599. //远程搜索
  600. remoteEvent(query) {
  601. this.eventList.data = []
  602. this.eventList.queryParams.current = 1
  603. this.eventList.name = query.trim()
  604. this.getEventList(1)
  605. },
  606. //获取事件列表
  607. async getEventList(type) {
  608. this.eventList.loading = true;
  609. let params = {
  610. ...this.eventList.queryParams,//分页信息
  611. searchQuery: this.eventList.name ? `name=${this.eventList.name}` : '',//检索条件
  612. orderDTOList: [{ orderBy: "createTime", orderType: 1 },]//排序
  613. }
  614. await this.$api.queryEvent(params).then(response => {
  615. if (response.code == 200) {
  616. this.eventList.loading = false;
  617. if (!type) {
  618. if (this.form.eventId) {
  619. var index = response.data.data.findIndex(item => {
  620. return item.id == this.form.eventId
  621. })
  622. if (index != -1) {
  623. response.data.data.splice(index, 1)
  624. }
  625. }
  626. this.eventList.queryParams.total = response.data.total
  627. }
  628. this.eventList.data.push(...response.data.data)
  629. // this.eventList.queryParams.total = response.data.total
  630. }
  631. })
  632. },
  633. //切换事件
  634. async changeEvent(val) {
  635. if (!val) {
  636. this.form.scenarioIds = []
  637. this.show = false
  638. this.$set(this.form,'matterIds',[])
  639. this.remoteEvent('')
  640. return
  641. }
  642. if(!this.form.matterIds){
  643. this.$set(this.form,'matterIds',[])
  644. }
  645. var obj = this.eventList.data.find(item => {
  646. return item.id == val
  647. })
  648. if (obj) {
  649. this.form.scenarioIds = [obj.scenarioId]
  650. this.show = true
  651. await this.onChange()
  652. }
  653. },
  654. //调查类型选择切换
  655. async onChange() {
  656. if (this.form.scenarioIds.length != 0) {
  657. // this.$set(this.form,'matterIds',[])
  658. await this.$api.getMatter(this.form.scenarioIds).then(response => {
  659. this.show = true
  660. this.dictAssociates = response.data.data
  661. })
  662. } else {
  663. this.show = false
  664. }
  665. },
  666. //打开弹窗
  667. async open(form,havePatent) {
  668. this.patentLoading = false
  669. this.havePatent={
  670. show:havePatent,
  671. checked:havePatent
  672. }
  673. var a = '编辑'
  674. this.form = JSON.parse(JSON.stringify(form))
  675. this.eventList.data = []
  676. this.eventList.name = ''
  677. this.$set(this.form,'signProjectIds',this.form.signPatentNo || this.form.signProjectId)
  678. if (this.form.id) {
  679. if (this.form.eventIds && this.form.eventIds.length>0) {
  680. this.form.eventId = this.form.eventIds[0]
  681. this.show = true
  682. this.eventList.disabled = false
  683. let params = {
  684. current:1,
  685. size:1,
  686. searchQuery:`id=${this.form.eventId}`,//检索条件
  687. orderDTOList: []//排序
  688. }
  689. await this.$api.queryEvent(params).then(response => {
  690. if(response.code == 200){
  691. this.eventList.data.push(...response.data.data)
  692. this.eventList.queryParams.total = response.data.total
  693. }
  694. })
  695. this.changeEvent(this.form.eventId)
  696. }else{
  697. this.getEventList()
  698. }
  699. } else {
  700. this.$set(this.form, 'matterIds', form.matterId)
  701. this.form.scenarioIds = form.scenarioId
  702. this.$set(this.form, 'systemFileList', [])
  703. this.$set(this.form, 'fileGuids', [])
  704. this.eventList.disabled = false
  705. if (this.form.eventId) {
  706. this.eventList.disabled = true
  707. let params = {
  708. current:1,
  709. size:1,
  710. searchQuery:`id=${this.form.eventId}`,//检索条件
  711. orderDTOList: []//排序
  712. }
  713. await this.$api.queryEvent(params).then(response => {
  714. if(response.code == 200){
  715. this.eventList.data.push(...response.data.data)
  716. this.eventList.queryParams.total = response.data.total
  717. }
  718. })
  719. this.changeEvent(this.form.eventId)
  720. }else{
  721. this.getEventList()
  722. }
  723. a = '创建'
  724. }
  725. var reportType = this.dictMessage.REPORT_TYPE.filter(item => { return item.value == this.form.reportType })[0].label
  726. this.title = a + reportType + '报告'
  727. // 负责人
  728. if(!this.form.headId){
  729. this.$set(this.form,'headId',Number(this.userinfo.id))
  730. }else{
  731. this.$set(this.form,'headId',Number(this.form.headId))
  732. }
  733. this.personnelList.data = []
  734. if (this.form.headId) {
  735. this.personnelList.queryParams.id = this.form.headId
  736. await this.getPermissionPersonnel(1)
  737. this.personnelList.queryParams.id = null
  738. }
  739. this.getPermissionPersonnel()
  740. if(form.track){
  741. this.title = '添加追踪报告'
  742. this.copyList = this.dictMessage[this.reportAsDicItemCopy[this.form.reportType]]
  743. if(this.copyList){
  744. var index = this.copyList.findIndex(item=>{
  745. return item.label == '标引信息'
  746. })
  747. if(index!=-1){
  748. this.copyIndex = this.copyList[index]
  749. }
  750. }
  751. var arr = this.copyList?this.copyList.map(item=>{return item.value}):[]
  752. this.$set(this.form,'copyIds',arr)
  753. }
  754. if(!this.form.id){
  755. if(this.form.signPatentNo && !form.track){
  756. this.getPatentNo()
  757. }
  758. }
  759. // this.getEventList()
  760. this.showDialog = true
  761. },
  762. /**
  763. * 产品
  764. * @param {*} query
  765. */
  766. // 懒加载产品方法
  767. productLoad() {
  768. if (this.productList.queryParams.current * this.productList.queryParams.size >= this.productList.queryParams.total) {
  769. return false
  770. }
  771. this.productList.queryParams.current++
  772. this.queryProduct()
  773. },
  774. // 查询产品
  775. async queryProduct() {
  776. let params = {
  777. ...this.productList.queryParams,
  778. searchQuery:`product_name=${this.productList.name}`,
  779. }
  780. await this.$api.queryProduct(params).then(res => {
  781. if (res.code == 200) {
  782. this.productList.data.push(...res.data.data)
  783. this.productList.queryParams.total = res.data.total
  784. this.productList.cb(this.productList.data);
  785. }
  786. })
  787. },
  788. //获取下拉建议产品数据
  789. async querySearchProduct(queryString, cb) {
  790. this.productList.queryParams.current = 1
  791. this.productList.name = queryString
  792. this.productList.data = []
  793. this.productList.cb = cb
  794. await this.queryProduct()
  795. },
  796. // 产品输入框输入
  797. handleChangeProduct(val) {
  798. this.$set(this.form, 'signPatentNo', val)
  799. if (this.form.signProjectId) {
  800. this.form.signProjectId=''
  801. }
  802. this.$set(this.form, 'name', val + 'FTO调查')
  803. },
  804. // 产品输入框选择
  805. handleSelectProduct(val) {
  806. this.$set(this.form, 'signProjectId', val.id)
  807. if (this.form.signProjectId) {
  808. this.form.signPatentNo=val.name
  809. }
  810. this.$set(this.form, 'name', val.name + 'FTO调查')
  811. },
  812. //获取所有部门列表
  813. getDepartment() {
  814. this.$api.getPermissionDepartmentList().then((response) => {
  815. this.departmentList = response.data;
  816. });
  817. },
  818. //切换是否完成状态
  819. async changeStatus(val) {
  820. if (val == 3) {
  821. this.rules.headId[0].required = false
  822. this.rules.entrustId[0].required = false
  823. if (!this.form.id) {
  824. this.$set(this.form, 'cronIds', [])
  825. }
  826. let params = {
  827. reportType: this.form.reportType
  828. }
  829. // await this.$api.queryCrons(params).then(res => {
  830. // if (res.code == 200) {
  831. // this.conclusion = res.data.data
  832. // }
  833. // }).catch(error => {
  834. // this.conclusion = []
  835. // this.$message.error(error.message)
  836. // })
  837. this.conclusion = this.dictMessage[this.reportAsDicItem[this.form.reportType]]
  838. this.matterType = 2
  839. } else {
  840. this.rules.headId[0].required = true
  841. this.rules.entrustId[0].required = true
  842. this.matterType = null
  843. }
  844. },
  845. //获取专利号且填入报告名称
  846. getPatentNo(sign) {
  847. // if (!this.form.name) {
  848. var a = this.dictMessage.REPORT_TYPE.filter(item => { return item.value == this.form.reportType })[0].label
  849. if (this.form.signProjectId) {
  850. var product = this.productList.data.filter(item => {
  851. return item.id == this.form.signProjectId
  852. })
  853. var name = ''
  854. if(product.length>0){
  855. name +=`${product[0].name}-`
  856. }
  857. name+=a
  858. this.$set(this.form, 'name', name)
  859. } else {
  860. var name = ''
  861. if(this.form.caseNumber){
  862. name += `${this.form.caseNumber}-`
  863. }
  864. if(this.form.signPatentNo){
  865. name+=`${this.form.signPatentNo}-`
  866. }
  867. name+=a
  868. this.$set(this.form, 'name', name)
  869. }
  870. if(sign){
  871. this.checkPatent()
  872. }
  873. // }
  874. },
  875. //校验专利是否存在
  876. checkPatent(){
  877. if(!this.form.signPatentNo){
  878. return
  879. }
  880. var params = {
  881. patentNo:this.form.signPatentNo.trim()
  882. }
  883. this.$api.queryPatentByNo(params).then(response=>{
  884. if(response.code == 200){
  885. if(response.data){
  886. this.isExist = true
  887. this.patentLoading = false
  888. this.$set(this.form,'inventionName',response.data.title[0].text_content)
  889. }else{
  890. this.checkPatent2()
  891. }
  892. }
  893. })
  894. },
  895. //外部检索专利是否存在
  896. checkPatent2(){
  897. var params = {
  898. patentNo:this.form.signPatentNo.trim()
  899. }
  900. this.$api.queryPatentByNoFromWeb(params).then(response=>{
  901. if(response.code == 200){
  902. if(response.data){
  903. this.isExist = true
  904. this.patentImport()
  905. }else{
  906. this.isExist = false
  907. this.patentLoading = false
  908. this.$message.warning('该专利不存在')
  909. }
  910. }
  911. }).catch(error=>{
  912. this.isExist = false
  913. this.patentLoading = false
  914. this.$message.warning('该专利不存在')
  915. })
  916. },
  917. //导入专利
  918. patentImport(){
  919. var params = {
  920. "type": "2",
  921. "searchCondition": this.form.signPatentNo.trim(),
  922. "importContent": 1111,
  923. }
  924. this.$api.addImportTask(params).then(response=>{
  925. if(response.code == 200){
  926. this.taskId = response.data
  927. this.patentLoading = true
  928. }
  929. })
  930. },
  931. //修改需要复制的选项
  932. changeCopyIds(val) {
  933. if (Object.keys(this.copyIndex).length > 0) {
  934. var index = this.copyList.findIndex(item => {
  935. return item.label == '对比文件'
  936. })
  937. if (index != -1) {
  938. var id = this.copyList[index].value
  939. var index2 = this.copyList.findIndex(item => {
  940. return item.label == '标引信息'
  941. })
  942. if (val.indexOf(id) != -1) {
  943. if (index2 == -1) {
  944. this.copyList.splice(index + 1, 0, this.copyIndex)
  945. }
  946. } else {
  947. if (index2 != -1) {
  948. this.copyList.splice(index2, 1)
  949. this.form.copyIds.splice(this.form.copyIds.indexOf(this.copyIndex.value), 1)
  950. }
  951. }
  952. } else {
  953. }
  954. }
  955. },
  956. // 上传的文件监听
  957. onchangeFile(file, fileList) {
  958. if(!this.form.systemFileList){
  959. this.$set(this.form,'systemFileList',[])
  960. }
  961. if (file.guid) {
  962. let index = this.form.systemFileList.findIndex(item => {
  963. return item.uid == file.uid
  964. })
  965. if (index != -1) {
  966. this.form.systemFileList.splice(index, 1, file)
  967. }
  968. } else {
  969. this.form.systemFileList.push(file.raw)
  970. }
  971. },
  972. // 删除上传的文件
  973. onRemove(file, fileList) {
  974. let index = this.form.systemFileList.findIndex(item => {
  975. return item.uid == file.uid
  976. })
  977. if (index != -1) {
  978. this.form.systemFileList.splice(index, 1)
  979. }
  980. },
  981. hidePopover(){
  982. var a = this.$refs.addMatter.emitData()
  983. if(a){
  984. this.$set(this.form,'followUps',a)
  985. }else{
  986. return false
  987. }
  988. },
  989. validMatter(){
  990. return this.$refs.addMatter.emitData()
  991. },
  992. //提交填写的信息
  993. submit() {
  994. this.$refs.reportForm.validate((valid) => {
  995. if (valid) {
  996. if(!this.isExist){
  997. this.$message.warning('标的专利不存在')
  998. return false
  999. }
  1000. this.form.type = 2//项目类型(1专利数据库 2报告 3专利挖掘项目)
  1001. // 判断文件是否都上传完毕
  1002. var guids = this.$commonJS.checkUploadFile(this.form.systemFileList)
  1003. if(!guids){
  1004. return false
  1005. }
  1006. this.form.fileGuids = guids
  1007. // this.$commonJS.allUploadFile(this.form)
  1008. //判断报告是否是已完成的
  1009. if(this.form.status == 3 && !this.form.id){
  1010. var validMatters = this.validMatter()
  1011. if(validMatters){
  1012. this.form.followUps = validMatters
  1013. }else{
  1014. return false
  1015. }
  1016. }else if(this.form.status != 3 && !this.form.id){
  1017. this.form.cronIds = []
  1018. this.form.cronDescription=''
  1019. this.followUps = []
  1020. }
  1021. if(this.form.status == 3){
  1022. this.form.ifFinish = true
  1023. }else{
  1024. this.form.ifFinish = false
  1025. }
  1026. // 事件及调查类型处理
  1027. if (this.form.scenarioIds && this.form.scenarioIds.length > 0) {
  1028. var scenarioIds = JSON.parse(JSON.stringify(this.form.scenarioIds))
  1029. }
  1030. if (this.form.eventId) {
  1031. this.form.events = []
  1032. this.form.scenarioIds = []
  1033. if(this.form.matterIds.length>0){
  1034. this.form.matterIds.forEach(item => {
  1035. this.form.events.push(
  1036. {
  1037. matterId: item,
  1038. scenarioId: scenarioIds[0],
  1039. eventId: this.form.eventId
  1040. }
  1041. )
  1042. })
  1043. }else{
  1044. this.form.events.push(
  1045. {
  1046. matterId: null,
  1047. scenarioId: scenarioIds[0],
  1048. eventId: this.form.eventId
  1049. }
  1050. )
  1051. }
  1052. }
  1053. let formData = this.form
  1054. if (!this.form.id) {//新增报告
  1055. this.$confirm('是否需要进行审核?', '提示', {
  1056. confirmButtonText: '是',
  1057. cancelButtonText: '否',
  1058. closeOnClickModal: false,
  1059. distinguishCancelAndClose: true,
  1060. }).then(() => {//审核打开审核弹窗
  1061. this.showTask = true
  1062. this.$set(this.taskForm, 'name', this.form.name + '审核')
  1063. }).catch(action => {//不审核直接创建报告
  1064. // 直接完成传true
  1065. // formData.ifFinish = true
  1066. // 调用创建报告公用,接口
  1067. this.addReport(formData, scenarioIds)
  1068. });
  1069. } else {//编辑报告
  1070. this.$api.updateReportProject(formData).then(response => {
  1071. if (response.code == 200) {
  1072. this.files = []
  1073. this.$message.success('报告更新成功')
  1074. this.$emit('getList', '更新成功')
  1075. this.handleClose()
  1076. }
  1077. })
  1078. }
  1079. }
  1080. })
  1081. },
  1082. //关闭弹窗
  1083. handleClose(val) {
  1084. if (this.form.reportType == 7 && val) {
  1085. this.reportId = val
  1086. }
  1087. this.personnelList.queryParams.name = ''
  1088. this.$refs.reportForm.resetFields()
  1089. this.form = {
  1090. matterIds: [],
  1091. systemFileList: [],
  1092. fileGuids: [],
  1093. }
  1094. this.show = false
  1095. this.showDialog = false
  1096. this.clear()
  1097. },
  1098. //添加专利到报告中
  1099. addPatentToReport(reportId){
  1100. if(this.havePatent.checked){
  1101. this.$emit('addPatentToReport',reportId)
  1102. }
  1103. },
  1104. //清空组件缓存数据
  1105. clear() {
  1106. // 清空事件相关
  1107. this.form.eventId = []
  1108. this.eventList.queryParams.current = 1
  1109. this.eventList.name = ''
  1110. this.eventList.data = []
  1111. // 清空负责人相关
  1112. this.personnelList.data = []
  1113. this.personnelList.queryParams.current = 1
  1114. this.personnelList.queryParams.name = null
  1115. },
  1116. // 创建报告创建接口公用
  1117. addReport(formData, scenarioIds) {
  1118. this.$api.addReportProject(formData).then(response => {
  1119. if (response.code == 200) {
  1120. this.files = []
  1121. this.$message.success('报告创建成功')
  1122. this.$emit('getList', '新增成功')
  1123. // response.data是创建成功后返回的报告id
  1124. this.splitClaim(response.data)
  1125. this.saveFlowPath(response.data)
  1126. this.handleClose(response.data)
  1127. }
  1128. }).catch(error => {
  1129. // 如果报告未创建成功,则赋值
  1130. if (scenarioIds && scenarioIds.length>0) {
  1131. this.form.scenarioIds = JSON.parse(JSON.stringify(scenarioIds))
  1132. }
  1133. this.show = true
  1134. })
  1135. },
  1136. //提交审核任务
  1137. submitTask() {
  1138. this.isEndTime = false
  1139. this.$refs.TaskForm.validate((valid) => {
  1140. if (valid) {
  1141. this.taskForm.handlerType = 0//内部人员0,外部人员1
  1142. this.taskForm.type = 1//任务类型,5为审核
  1143. let params = {
  1144. reportProjectDTO: this.form,
  1145. projectTaskDTO:this.taskForm,
  1146. }
  1147. this.$api.addReportOpenAuditTask(params).then(response => {
  1148. if (response.code == 200) {
  1149. this.files = []
  1150. this.$message.success('报告创建成功并发送审核')
  1151. this.$emit('getList', true)
  1152. this.handleCloseTask()
  1153. this.saveFlowPath2(response.data)
  1154. this.handleClose()
  1155. }
  1156. }).catch(error => {
  1157. // this.$message.error('报告创建失败')
  1158. this.handleCloseTask()
  1159. })
  1160. }
  1161. })
  1162. },
  1163. //关闭审核弹窗
  1164. handleCloseTask() {
  1165. this.matterType = null
  1166. this.$refs.TaskForm.resetFields()
  1167. this.taskForm = {}
  1168. this.showTask = false
  1169. this.isEndTime = true
  1170. },
  1171. //拆分权利要求并拆分
  1172. splitClaim(id){
  1173. if(this.form.reportType != 7){
  1174. return false
  1175. }
  1176. var params = {
  1177. projectId : id
  1178. }
  1179. this.$api.splitClaim(params).then(response=>{
  1180. if(response.code == 200){
  1181. }
  1182. })
  1183. },
  1184. //获取无效请求书信息
  1185. getFlowPath(val){
  1186. this.$set(this.form,'flowPath',val)
  1187. },
  1188. addFlowPath(){
  1189. this.$refs.addFlowPath.open(1,
  1190. {
  1191. systemFileList:[]
  1192. }
  1193. )
  1194. },
  1195. saveFlowPath2(taskId){
  1196. let params = {
  1197. current:1,
  1198. size:10,
  1199. searchQuery: `id=${taskId}`,//检索条件
  1200. orderDTOList:[],//排序信息
  1201. }
  1202. this.$api.queryProjectTask(params).then(response => {
  1203. if (response.code == 200) {
  1204. var data = response.data.data
  1205. var projectId = data[0].projectId
  1206. this.saveFlowPath(projectId)
  1207. }
  1208. }).catch(error => {
  1209. })
  1210. },
  1211. saveFlowPath(projectId){
  1212. this.addPatentToReport(projectId)
  1213. if(!this.form.flowPath || this.form.id){
  1214. return false
  1215. }
  1216. var form = JSON.parse(JSON.stringify(this.form.flowPath))
  1217. form.projectId = projectId
  1218. this.$api.addInvalidRequestFile(form).then(response=>{
  1219. if(response.code == 200){
  1220. }
  1221. })
  1222. }
  1223. },
  1224. };
  1225. </script>
  1226. <style lang="scss">
  1227. // .el-input__inner{
  1228. // pointer-events: none;
  1229. // }
  1230. // .el-input__inner:empty{
  1231. // content:'--'
  1232. // }
  1233. </style>