addAndEditReport.vue 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176
  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">
  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 v-if="!form.id">
  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. </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="无效请求书" prop="flowPath">
  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) ? '上传报告文档' : '上传附件'" prop="systemFileList">
  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">
  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 '../matter/addMatters.vue'
  276. import ClientTable from '@/views/client'
  277. import addFlowPath from '@/views/report/InvalidResponse/components/dialog/editFlowPath.vue'
  278. export default {
  279. components: {
  280. addMatter,
  281. ClientTable,
  282. addFlowPath
  283. },
  284. props: {},
  285. data() {
  286. const isExist = (rule, value, callback) => {
  287. if (!this.form.signPatentNo && !this.form.signProjectIds) {//没有专利号进入报错提示
  288. if ([3].includes(Number(this.form.reportType))) {
  289. var text = '请输入标的产品'
  290. } else {
  291. var text = '请输入标的专利号'
  292. }
  293. callback(new Error(text))
  294. } else {
  295. callback()
  296. }
  297. }
  298. const isTime = (rule, value, callback) => {
  299. if (this.isEndTime) {
  300. this.isEndTimes = Date.parse(new Date)
  301. }
  302. let b = Date.parse(value)
  303. if (value) {
  304. if (b < this.isEndTimes) {
  305. callback(new Error('禁止选择现在及以前时间,请重新选择'))
  306. } else {
  307. callback()
  308. }
  309. } else {
  310. callback(new Error('请选择时间'))
  311. }
  312. }
  313. return {
  314. //弹窗标题
  315. title: '',
  316. //控制弹窗是否打开
  317. showDialog: false,
  318. //表单数据
  319. form: {
  320. matterIds: [],
  321. systemFileList: [],
  322. fileGuids: [],
  323. },
  324. //表单规则
  325. rules: {
  326. name: [{ required: true, message: '请输入报告名称', trigger: 'blur' },],
  327. signProjectIds: [{ required: true, validator: isExist, trigger: 'blur' },],//产品
  328. signPatentNo: [{ required: true, validator: isExist, trigger: 'blur' },],//专利
  329. headId: [{ required: true, message: '请选择负责人', trigger: 'change' },],
  330. entrustId: [{ required: true, message: '请选择委托方', trigger: 'change' },],
  331. },
  332. patentLoading:false,
  333. taskId:null,
  334. //加载
  335. loading: false,
  336. //加载时显示的文字
  337. load_text: '加载中',
  338. //应用场景
  339. commonData: {},
  340. //核心结论
  341. conclusion: [],
  342. //部门数据
  343. departmentList: [],
  344. //需要复制的选项集合
  345. copyList: [],
  346. //上传文件列表
  347. files: [],
  348. //核心结论类型字典
  349. reportAsDicItem: {
  350. "0": "INVALID_ASSESS",
  351. "1": "THIRD_ASSESS",
  352. "2": "STABILITY_ASSESS",
  353. "3": "FTO_ASSESS",
  354. "4": "TORT_ASSESS",
  355. "5": "AVOID_ASSESS",
  356. "7": "REINVALID_ASSESS",
  357. },
  358. //需要复制的内容字典
  359. reportAsDicItemCopy: {
  360. "0": "INVALID_COPY",
  361. "1": "THIRD_COPY",
  362. "2": "STABILITY_COPY",
  363. "3": "FTO_COPY",
  364. "4": "TORT_COPY",
  365. "5": "AVOID_COPY",
  366. "7":"INVALID_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. isExist:true
  435. };
  436. },
  437. watch: {},
  438. computed: {
  439. ...mapGetters(['webSocket', 'userinfo']),
  440. dictMessage() {
  441. return this.$store.state.dictMessage.dictMessage
  442. },
  443. scenario() {
  444. return this.$store.state.dictMessage.scenario || []
  445. }
  446. },
  447. created() { },
  448. mounted() {
  449. //获取所有部门列表
  450. this.getDepartment()
  451. this.initTask()
  452. },
  453. methods: {
  454. initTask() {
  455. this.webSocket.onmessage = (e) => {
  456. if(e.data.indexOf('{') == -1){
  457. return false
  458. }
  459. const { code, data, message } = JSON.parse(e.data)
  460. if (code === 903) {
  461. if (data.complete && data.taskId == this.taskId) {
  462. this.patentLoading = false
  463. }
  464. }
  465. }
  466. },
  467. /**
  468. * 人员
  469. */
  470. // 人员列表远程搜索
  471. remoteMethodPerson(query) {
  472. this.personnelList.data = []
  473. this.personnelList.queryParams.current = 1
  474. this.personnelList.queryParams.name = query
  475. this.getPermissionPersonnel()
  476. },
  477. // 获取所有人员列表懒加载
  478. lazyLoadingPerson() {
  479. if (this.personnelList.queryParams.current * this.personnelList.queryParams.size >= this.personnelList.queryParams.total) {
  480. return false
  481. }
  482. this.personnelList.queryParams.current += 1
  483. this.getPermissionPersonnel()
  484. },
  485. //获取所有人员列表(修改不要一次性获取,可以使用懒加载加远程搜索 )
  486. async getPermissionPersonnel(type) {
  487. this.personnelList.loading = true;
  488. await this.$api.getPermissionPersonnel(this.personnelList.queryParams).then((response) => {
  489. if (response.code == 200) {
  490. this.personnelList.loading = false;
  491. if(!type){
  492. var index = response.data.findIndex(item=>{
  493. return item.id == this.form.headId
  494. })
  495. if(index!=-1){
  496. response.data.splice(index,1)
  497. }
  498. this.personnelList.queryParams.total=response.pageColumn.total
  499. }
  500. this.personnelList.data.push(...response.data)
  501. // this.personnelList.queryParams.total = response.pageColumn.total
  502. }
  503. })
  504. },
  505. /**
  506. * 客户/委托方
  507. */
  508. //远程搜索委托方(建议调取接口获取)
  509. async querySearch(queryString, cb) {
  510. this.clientList.queryParams.current = 1
  511. this.clientList.queryParams.name = queryString
  512. this.clientList.data = []
  513. this.clientList.cb = cb
  514. await this.getClientList()
  515. // 调用 callback 返回建议列表的数据
  516. // cb(this.clientList.data);
  517. },
  518. loadClient() {
  519. if (this.clientList.queryParams.current * this.clientList.queryParams.size >= this.clientList.queryParams.total) {
  520. return false
  521. }
  522. this.clientList.queryParams.current += 1
  523. this.getClientList()
  524. },
  525. //获取委托方
  526. async getClientList() {
  527. await this.$api.getAdminClientList(this.clientList.queryParams).then(res => {
  528. if (res.code == 200) {
  529. this.clientList.data.push(...res.data.records)
  530. this.clientList.queryParams.total = res.data.total
  531. this.clientList.cb(this.clientList.data);
  532. }
  533. })
  534. },
  535. //输入框输入事件(委托方)
  536. input() {
  537. this.$set(this.form, 'entrustId', -1)
  538. },
  539. //切换选择委托方
  540. handleChange(row) {
  541. this.$set(this.form, 'entrustId', row.id)
  542. this.$set(this.form, 'entrustName', row.name)
  543. this.close2()
  544. },
  545. //打开选择委托方弹窗
  546. handleSelect() {
  547. this.visible = true
  548. },
  549. //获取委托方信息
  550. getClient(row) {
  551. this.$set(this.form, 'entrustId', row.id)
  552. this.$set(this.form, 'entrustName', row.name)
  553. this.close2()
  554. },
  555. //关闭委托方弹窗
  556. close2() {
  557. this.visible = false
  558. },
  559. /**
  560. * 事件处理
  561. */
  562. //打开事件弹窗
  563. addEvent() {
  564. },
  565. /**
  566. * 事件
  567. */
  568. //懒加载事件
  569. loadEvent() {
  570. if (this.eventList.queryParams.current * this.eventList.queryParams.size >= this.eventList.queryParams.total) {
  571. return false
  572. }
  573. this.eventList.queryParams.current += 1
  574. this.getEventList()
  575. },
  576. //远程搜索
  577. remoteEvent(query) {
  578. this.eventList.data = []
  579. this.eventList.queryParams.current = 1
  580. this.eventList.name = query
  581. this.getEventList()
  582. },
  583. //获取事件列表
  584. async getEventList(type) {
  585. this.eventList.loading = true;
  586. let params = {
  587. ...this.eventList.queryParams,//分页信息
  588. searchQuery: this.eventList.name ? `name=${this.eventList.name}` : '',//检索条件
  589. orderDTOList: [{ orderBy: "createTime", orderType: 1 },]//排序
  590. }
  591. await this.$api.queryEvent(params).then(response => {
  592. if (response.code == 200) {
  593. this.eventList.loading = false;
  594. if (!type) {
  595. if (this.form.eventId) {
  596. var index = response.data.data.findIndex(item => {
  597. return item.id == this.form.eventId
  598. })
  599. if (index != -1) {
  600. response.data.data.splice(index, 1)
  601. }
  602. }
  603. this.eventList.queryParams.total = response.data.total
  604. }
  605. this.eventList.data.push(...response.data.data)
  606. // this.eventList.queryParams.total = response.data.total
  607. }
  608. })
  609. },
  610. //切换事件
  611. async changeEvent(val) {
  612. if (!val) {
  613. this.form.scenarioIds = []
  614. this.show = false
  615. this.form.matterIds = []
  616. return
  617. }
  618. var obj = this.eventList.data.find(item => {
  619. return item.id == val
  620. })
  621. if (obj) {
  622. this.form.scenarioIds = [obj.scenarioId]
  623. this.show = true
  624. await this.onChange()
  625. }
  626. },
  627. //调查类型选择切换
  628. async onChange() {
  629. if (this.form.scenarioIds.length != 0) {
  630. await this.$api.getMatter(this.form.scenarioIds).then(response => {
  631. this.show = true
  632. this.dictAssociates = response.data.data
  633. })
  634. } else {
  635. this.show = false
  636. }
  637. },
  638. //打开弹窗
  639. async open(form) {
  640. this.patentLoading = false
  641. var a = '编辑'
  642. this.form = JSON.parse(JSON.stringify(form))
  643. if (this.form.id) {
  644. this.$set(this.form,'signProjectIds',this.form.signPatentNo || this.form.signProjectId)
  645. } else {
  646. this.$set(this.form, 'matterIds', form.matterId)
  647. this.form.scenarioIds = form.scenarioId
  648. this.$set(this.form, 'systemFileList', [])
  649. this.$set(this.form, 'fileGuids', [])
  650. this.eventList.disabled = false
  651. if (this.form.eventId) {
  652. this.eventList.disabled = true
  653. this.eventList.data.push(
  654. {
  655. id: form.eventId,
  656. name: form.eventName
  657. }
  658. )
  659. }
  660. a = '创建'
  661. }
  662. var reportType = this.dictMessage.REPORT_TYPE.filter(item => { return item.value == this.form.reportType })[0].label
  663. this.title = a + reportType + '报告'
  664. // 负责人
  665. if(!this.form.headId){
  666. this.$set(this.form,'headId',Number(this.userinfo.id))
  667. }else{
  668. this.$set(this.form,'headId',Number(this.form.headId))
  669. }
  670. if (this.form.headId) {
  671. this.personnelList.queryParams.id = this.form.headId
  672. await this.getPermissionPersonnel(1)
  673. this.personnelList.queryParams.id = null
  674. }
  675. this.getPermissionPersonnel()
  676. if(form.track){
  677. this.title = '添加追踪报告'
  678. this.copyList = this.dictMessage[this.reportAsDicItemCopy[this.form.reportType]]
  679. if(this.copyList){
  680. var index = this.copyList.findIndex(item=>{
  681. return item.label == '标引信息'
  682. })
  683. if(index!=-1){
  684. this.copyIndex = this.copyList[index]
  685. }
  686. }
  687. var arr = this.copyList?this.copyList.map(item=>{return item.value}):[]
  688. this.$set(this.form,'copyIds',arr)
  689. }
  690. if(!this.form.id){
  691. if(this.form.signPatentNo && !form.track){
  692. this.getPatentNo()
  693. }
  694. }
  695. // this.getEventList()
  696. this.showDialog = true
  697. },
  698. /**
  699. * 产品
  700. * @param {*} query
  701. */
  702. // 懒加载产品方法
  703. productLoad() {
  704. if (this.productList.queryParams.current * this.productList.queryParams.size >= this.productList.queryParams.total) {
  705. return false
  706. }
  707. this.productList.queryParams.current++
  708. this.queryProduct()
  709. },
  710. // 查询产品
  711. async queryProduct() {
  712. let params = {
  713. ...this.productList.queryParams,
  714. searchQuery:`name=${this.productList.name}`,
  715. }
  716. await this.$api.queryProduct(params).then(res => {
  717. if (res.code == 200) {
  718. this.productList.data.push(...res.data.data)
  719. this.productList.queryParams.total = res.data.total
  720. this.productList.cb(this.productList.data);
  721. }
  722. })
  723. },
  724. //获取下拉建议产品数据
  725. async querySearchProduct(queryString, cb) {
  726. this.productList.queryParams.current = 1
  727. this.productList.name = queryString
  728. this.productList.data = []
  729. this.productList.cb = cb
  730. await this.queryProduct()
  731. },
  732. // 产品输入框输入
  733. handleChangeProduct(val) {
  734. this.$set(this.form, 'signPatentNo', val)
  735. if (this.form.signProjectId) {
  736. this.form.signProjectId=''
  737. }
  738. this.$set(this.form, 'name', val + 'FTO调查')
  739. },
  740. // 产品输入框选择
  741. handleSelectProduct(val) {
  742. this.$set(this.form, 'signProjectId', val.id)
  743. if (this.form.signProjectId) {
  744. this.form.signPatentNo=''
  745. }
  746. this.$set(this.form, 'name', val.name + 'FTO调查')
  747. },
  748. //获取所有部门列表
  749. getDepartment() {
  750. this.$api.getPermissionDepartmentList().then((response) => {
  751. this.departmentList = response.data;
  752. });
  753. },
  754. //切换是否完成状态
  755. async changeStatus(val) {
  756. if (val == 3) {
  757. this.rules.headId[0].required = false
  758. this.rules.entrustId[0].required = false
  759. if (!this.form.id) {
  760. this.$set(this.form, 'cronIds', [])
  761. }
  762. let params = {
  763. reportType: this.form.reportType
  764. }
  765. // await this.$api.queryCrons(params).then(res => {
  766. // if (res.code == 200) {
  767. // this.conclusion = res.data.data
  768. // }
  769. // }).catch(error => {
  770. // this.conclusion = []
  771. // this.$message.error(error.message)
  772. // })
  773. this.conclusion = this.dictMessage[this.reportAsDicItem[this.form.reportType]]
  774. this.matterType = 2
  775. } else {
  776. this.rules.headId[0].required = true
  777. this.rules.entrustId[0].required = true
  778. this.matterType = null
  779. }
  780. },
  781. //获取专利号且填入报告名称
  782. getPatentNo(sign) {
  783. // if (!this.form.name) {
  784. var a = this.dictMessage.REPORT_TYPE.filter(item => { return item.value == this.form.reportType })[0].label
  785. if (this.form.signProjectId) {
  786. var product = this.productList.data.filter(item => {
  787. return item.id == this.form.signProjectId
  788. })
  789. var name = ''
  790. if(product.length>0){
  791. name +=`${product[0].name}-`
  792. }
  793. name+=a
  794. this.$set(this.form, 'name', name)
  795. } else {
  796. var name = ''
  797. if(this.form.caseNumber){
  798. name += `${this.form.caseNumber}-`
  799. }
  800. if(this.form.signPatentNo){
  801. name+=`${this.form.signPatentNo}-`
  802. }
  803. name+=a
  804. this.$set(this.form, 'name', name)
  805. }
  806. if(sign){
  807. this.checkPatent()
  808. }
  809. // }
  810. },
  811. //校验专利是否存在
  812. checkPatent(){
  813. if(!this.form.signPatentNo){
  814. return
  815. }
  816. var params = {
  817. patentNo:this.form.signPatentNo
  818. }
  819. this.$api.queryPatentByNo(params).then(response=>{
  820. if(response.code == 200){
  821. if(response.data){
  822. this.isExist = true
  823. this.patentLoading = false
  824. this.$set(this.form,'inventionName',response.data.title[0].text_content)
  825. }else{
  826. this.checkPatent2()
  827. }
  828. }
  829. })
  830. },
  831. //外部检索专利是否存在
  832. checkPatent2(){
  833. var params = {
  834. patentNo:this.form.signPatentNo
  835. }
  836. this.$api.queryPatentByNoFromWeb(params).then(response=>{
  837. if(response.code == 200){
  838. if(response.data){
  839. this.isExist = true
  840. this.patentImport()
  841. }else{
  842. this.isExist = false
  843. this.patentLoading = false
  844. this.$message.warning('该专利不存在')
  845. }
  846. }
  847. }).catch(error=>{
  848. this.isExist = false
  849. this.patentLoading = false
  850. this.$message.warning('该专利不存在')
  851. })
  852. },
  853. //导入专利
  854. patentImport(){
  855. var params = {
  856. "type": "2",
  857. "searchCondition": this.form.signPatentNo,
  858. "importContent": 1111,
  859. }
  860. this.$api.addImportTask(params).then(response=>{
  861. if(response.code == 200){
  862. this.taskId = response.data
  863. this.patentLoading = true
  864. }
  865. })
  866. },
  867. //修改需要复制的选项
  868. changeCopyIds(val) {
  869. if (Object.keys(this.copyIndex).length > 0) {
  870. var index = this.copyList.findIndex(item => {
  871. return item.label == '对比文件'
  872. })
  873. if (index != -1) {
  874. var id = this.copyList[index].value
  875. var index2 = this.copyList.findIndex(item => {
  876. return item.label == '标引信息'
  877. })
  878. if (val.indexOf(id) != -1) {
  879. if (index2 == -1) {
  880. this.copyList.splice(index + 1, 0, this.copyIndex)
  881. }
  882. } else {
  883. if (index2 != -1) {
  884. this.copyList.splice(index2, 1)
  885. this.form.copyIds.splice(this.form.copyIds.indexOf(this.copyIndex.value), 1)
  886. }
  887. }
  888. } else {
  889. }
  890. }
  891. },
  892. // 上传的文件监听
  893. onchangeFile(file, fileList) {
  894. if(!this.form.systemFileList){
  895. this.$set(this.form,'systemFileList',[])
  896. }
  897. if (file.guid) {
  898. let index = this.form.systemFileList.findIndex(item => {
  899. return item.uid == file.uid
  900. })
  901. if (index != -1) {
  902. this.form.systemFileList.splice(index, 1, file)
  903. }
  904. } else {
  905. this.form.systemFileList.push(file.raw)
  906. }
  907. },
  908. // 删除上传的文件
  909. onRemove(file, fileList) {
  910. let index = this.form.systemFileList.findIndex(item => {
  911. return item.uid == file.uid
  912. })
  913. if (index != -1) {
  914. this.form.systemFileList.splice(index, 1)
  915. }
  916. },
  917. hidePopover(){
  918. var a = this.$refs.addMatter.emitData()
  919. if(a){
  920. this.$set(this.form,'followUps',a)
  921. }else{
  922. return false
  923. }
  924. },
  925. validMatter(){
  926. return this.$refs.addMatter.emitData()
  927. },
  928. //提交填写的信息
  929. submit() {
  930. this.$refs.reportForm.validate((valid) => {
  931. if (valid) {
  932. if(!this.isExist){
  933. this.$message.warning('标的专利不存在')
  934. return false
  935. }
  936. this.form.type = 2//项目类型(1专利数据库 2报告 3专利挖掘项目)
  937. // 判断文件是否都上传完毕
  938. var guids = this.$commonJS.checkUploadFile(this.form.systemFileList)
  939. if(!guids){
  940. return false
  941. }
  942. this.form.fileGuids = guids
  943. // this.$commonJS.allUploadFile(this.form)
  944. //判断报告是否是已完成的
  945. if(this.form.status == 3){
  946. var validMatters = this.validMatter()
  947. if(validMatters){
  948. this.form.followUps = validMatters
  949. }else{
  950. return false
  951. }
  952. }
  953. // 事件及调查类型处理
  954. if (this.form.scenarioIds && this.form.scenarioIds.length > 0) {
  955. var scenarioIds = JSON.parse(JSON.stringify(this.form.scenarioIds))
  956. }
  957. if (this.form.eventId) {
  958. this.form.events = []
  959. this.form.scenarioIds = []
  960. this.form.matterIds.forEach(item => {
  961. this.form.events.push(
  962. {
  963. matterId: item,
  964. scenarioId: scenarioIds[0],
  965. eventId: this.form.eventId
  966. }
  967. )
  968. })
  969. }
  970. let formData = this.form
  971. if (!this.form.id) {//新增报告
  972. this.$confirm('是否需要进行审核?', '提示', {
  973. confirmButtonText: '是',
  974. cancelButtonText: '否',
  975. closeOnClickModal: false,
  976. distinguishCancelAndClose: true,
  977. }).then(() => {//审核打开审核弹窗
  978. this.showTask = true
  979. this.$set(this.taskForm, 'name', this.form.name + '审核')
  980. }).catch(action => {//不审核直接创建报告
  981. // 直接完成传true
  982. // formData.ifFinish = true
  983. // 调用创建报告公用,接口
  984. this.addReport(formData, scenarioIds)
  985. });
  986. } else {//编辑报告
  987. this.$api.updateReportProject(formData).then(response => {
  988. if (response.code == 200) {
  989. this.files = []
  990. this.$message.success('报告更新成功')
  991. this.$emit('getList', '更新成功')
  992. this.handleClose()
  993. }
  994. })
  995. }
  996. }
  997. })
  998. },
  999. //关闭弹窗
  1000. handleClose(val) {
  1001. if (this.form.reportType == 7 && val) {
  1002. this.reportId = val
  1003. }
  1004. this.personnelList.queryParams.name = ''
  1005. this.$refs.reportForm.resetFields()
  1006. this.form = {
  1007. matterIds: [],
  1008. systemFileList: [],
  1009. fileGuids: [],
  1010. }
  1011. this.showDialog = false
  1012. this.clear()
  1013. },
  1014. //清空组件缓存数据
  1015. clear() {
  1016. // 清空事件相关
  1017. this.form.eventId = []
  1018. this.eventList.queryParams.current = 1
  1019. this.eventList.name = ''
  1020. this.eventList.data = []
  1021. // 清空负责人相关
  1022. this.personnelList.data = []
  1023. this.personnelList.queryParams.current = 1
  1024. this.personnelList.queryParams.name = null
  1025. },
  1026. // 创建报告创建接口公用
  1027. addReport(formData, scenarioIds) {
  1028. this.$api.addReportProject(formData).then(response => {
  1029. if (response.code == 200) {
  1030. this.files = []
  1031. this.$message.success('报告创建成功')
  1032. this.$emit('getList', '新增成功')
  1033. // response.data是创建成功后返回的报告id
  1034. this.splitClaim(response.data)
  1035. this.saveFlowPath(response.data)
  1036. this.handleClose(response.data)
  1037. }
  1038. }).catch(error => {
  1039. // 如果报告未创建成功,则赋值
  1040. if (scenarioIds && scenarioIds.length>0) {
  1041. this.form.scenarioIds = JSON.parse(JSON.stringify(scenarioIds))
  1042. }
  1043. this.show = true
  1044. })
  1045. },
  1046. //提交审核任务
  1047. submitTask() {
  1048. this.isEndTime = false
  1049. this.$refs.TaskForm.validate((valid) => {
  1050. if (valid) {
  1051. this.taskForm.handlerType = 0//内部人员0,外部人员1
  1052. this.taskForm.type = 1//任务类型,5为审核
  1053. let params = {
  1054. reportProjectDTO: this.form,
  1055. projectTaskDTO:this.taskForm,
  1056. }
  1057. this.$api.addReportOpenAuditTask(params).then(response => {
  1058. if (response.code == 200) {
  1059. this.files = []
  1060. this.$message.success('报告创建成功并发送审核')
  1061. this.$emit('getList', true)
  1062. this.handleCloseTask()
  1063. this.saveFlowPath2(response.data)
  1064. this.handleClose()
  1065. }
  1066. }).catch(error => {
  1067. // this.$message.error('报告创建失败')
  1068. this.handleCloseTask()
  1069. })
  1070. }
  1071. })
  1072. },
  1073. //关闭审核弹窗
  1074. handleCloseTask() {
  1075. this.matterType = null
  1076. this.$refs.TaskForm.resetFields()
  1077. this.taskForm = {}
  1078. this.showTask = false
  1079. this.isEndTime = true
  1080. },
  1081. //拆分权利要求并拆分
  1082. splitClaim(id){
  1083. if(this.form.reportType != 7){
  1084. return false
  1085. }
  1086. var params = {
  1087. projectId : id
  1088. }
  1089. this.$api.splitClaim(params).then(response=>{
  1090. if(response.code == 200){
  1091. }
  1092. })
  1093. },
  1094. //获取无效请求书信息
  1095. getFlowPath(val){
  1096. this.$set(this.form,'flowPath',val)
  1097. },
  1098. addFlowPath(){
  1099. this.$refs.addFlowPath.open(1,
  1100. {
  1101. systemFileList:[]
  1102. }
  1103. )
  1104. },
  1105. saveFlowPath2(taskId){
  1106. let params = {
  1107. current:1,
  1108. size:10,
  1109. searchQuery: `id=${taskId}`,//检索条件
  1110. orderDTOList:[],//排序信息
  1111. }
  1112. this.$api.queryProjectTask(params).then(response => {
  1113. if (response.code == 200) {
  1114. var data = response.data.data
  1115. var projectId = data[0].projectId
  1116. this.saveFlowPath(projectId)
  1117. }
  1118. }).catch(error => {
  1119. })
  1120. },
  1121. saveFlowPath(projectId){
  1122. if(!this.form.flowPath || this.form.id){
  1123. return false
  1124. }
  1125. var form = JSON.parse(JSON.stringify(this.form.flowPath))
  1126. form.projectId = projectId
  1127. this.$api.addInvalidRequestFile(form).then(response=>{
  1128. if(response.code == 200){
  1129. }
  1130. })
  1131. }
  1132. },
  1133. };
  1134. </script>
  1135. <style lang="scss">
  1136. // .el-input__inner{
  1137. // pointer-events: none;
  1138. // }
  1139. // .el-input__inner:empty{
  1140. // content:'--'
  1141. // }
  1142. </style>