addAndEditReport.vue 38 KB

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