addAndEditReport.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002
  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="signProjectId">
  13. <el-autocomplete v-model="form.signProjectId" 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. <el-input v-model="form.signPatentNo" autocomplete="off" placeholder="请输入标的专利"
  20. @change="getPatentNo"></el-input>
  21. </el-form-item>
  22. </div>
  23. </template>
  24. </el-col>
  25. <el-col :span="12">
  26. <el-form-item label="报告名称" prop="name">
  27. <el-input v-model="form.name" autocomplete="off" placeholder="请输入报告名称"></el-input>
  28. </el-form-item>
  29. </el-col>
  30. </el-row>
  31. <template v-if="form.reportType == 7">
  32. <div>
  33. <el-row>
  34. <el-col :span="12">
  35. <el-form-item label="案件编号">
  36. <el-input v-model="form.caseNumber" @change="getPatentNo" autocomplete="off" placeholder="请输入案件编号"></el-input>
  37. </el-form-item>
  38. </el-col>
  39. <el-col :span="12">
  40. <el-form-item label="无效宣告请求人">
  41. <el-input v-model="form.invalidApplication" autocomplete="off" placeholder="请输入无效宣告请求人"></el-input>
  42. </el-form-item>
  43. </el-col>
  44. </el-row>
  45. <el-row>
  46. <el-col :span="12">
  47. <el-form-item label="发文序号">
  48. <el-input v-model="form.issueNumber" autocomplete="off" placeholder="请输入发文序号"></el-input>
  49. </el-form-item>
  50. </el-col>
  51. <el-col :span="12">
  52. <el-form-item label="发明创造名称">
  53. <el-input v-model="form.inventionName" autocomplete="off" placeholder="请输入发明创造名称"></el-input>
  54. </el-form-item>
  55. </el-col>
  56. </el-row>
  57. </div>
  58. </template>
  59. <el-form-item label="是否完成" v-if="!form.id">
  60. <el-switch v-model="form.status" active-color="#13ce66" inactive-color="#ff4949" @change="changeStatus"
  61. :active-value="3" :inactive-value="1">
  62. </el-switch>
  63. </el-form-item>
  64. <template v-if="!form.id && form.status == 3">
  65. <div>
  66. <el-form-item label="核心结论">
  67. <el-checkbox-group v-model="form.cronIds">
  68. <el-checkbox v-for="item in conclusion" :key="item.value" :label="item.value">{{
  69. item.label }}</el-checkbox>
  70. </el-checkbox-group>
  71. </el-form-item>
  72. <el-form-item label="结论论述">
  73. <el-input v-model="form.cronDescription" type="textarea" placeholder="请输入结论论述"></el-input>
  74. </el-form-item>
  75. <el-form-item label="后续跟进事项" v-if="$permission('/rms/matter')">
  76. <span v-if="form.followUps"><span v-for="item in form.followUps" :key="item.followUpName"
  77. style="margin-right:10px">{{ item.followUpName }}</span></span>
  78. <span>
  79. <el-popover ref="popover" placement="bottom" @hide="hidePopover" @show="showPopover" trigger="click">
  80. <div>
  81. <addMatter :type="matterType" :sign="matterSign" @value="getMatter"></addMatter>
  82. </div>
  83. <el-button slot="reference">添加后续事项</el-button>
  84. </el-popover>
  85. </span>
  86. </el-form-item>
  87. </div>
  88. </template>
  89. <el-row>
  90. <el-col :span="12">
  91. <el-form-item label="承担部门" prop="departmentId">
  92. <mySelectTree style="width:100%" v-model="form.departmentId" :options="departmentList"></mySelectTree>
  93. </el-form-item>
  94. </el-col>
  95. <el-col :span="12">
  96. <el-form-item label="负责人" prop="headId">
  97. <el-select style="width:100%" v-model="form.headId" placeholder="请选择负责人" filterable remote
  98. :popper-append-to-body="false" :remote-method="remoteMethodPerson" v-SelectLazyLoading="lazyLoadingPerson"
  99. :loading="personnelList.loading">
  100. <el-option v-for="item in personnelList.data" :key="Number(item.id)" :label="item.name"
  101. :value="Number(item.id)"></el-option>
  102. </el-select>
  103. </el-form-item>
  104. </el-col>
  105. </el-row>
  106. <el-row>
  107. <el-col :span="12">
  108. <template>
  109. <div>
  110. <el-form-item label="委托方" prop="entrustId" v-if="userinfo.tenantType == 1">
  111. <mySelectButton size='large' style="width:100%" @click="handleSelect">
  112. <div style="width:100%">
  113. <el-autocomplete style="width:100%" v-model="form.entrustName" ref="client" value-key="name"
  114. :fetch-suggestions="querySearch" v-SelectLazyLoading="loadClient" @input="input"
  115. placeholder="请输入内容" :trigger-on-focus="false" @select="handleChange">
  116. </el-autocomplete>
  117. </div>
  118. </mySelectButton>
  119. </el-form-item>
  120. <el-form-item label="委托部门" prop="departmentId" v-else>
  121. <mySelectTree style="width:100%" v-model="form.departmentId" :options="departmentList"></mySelectTree>
  122. </el-form-item>
  123. </div>
  124. </template>
  125. </el-col>
  126. <el-col :span="12">
  127. <el-form-item label="卷号" prop="volumeNumber">
  128. <el-input v-model="form.volumeNumber" autocomplete="off" placeholder="请输入卷号"></el-input>
  129. </el-form-item>
  130. </el-col>
  131. </el-row>
  132. <el-row>
  133. <el-col :span="24">
  134. <el-form-item label="产品/技术">
  135. <el-input v-model="form.productOrTech" autocomplete="off" placeholder="请输入产品/技术"></el-input>
  136. </el-form-item>
  137. </el-col>
  138. </el-row>
  139. <el-row>
  140. <el-col :span="form.track ? 12 : 24">
  141. <el-form-item label="关联报告">
  142. <el-input v-model="form.associateReportName" autocomplete="off" placeholder="请输入关联报告"></el-input>
  143. </el-form-item>
  144. </el-col>
  145. <el-col :span="12">
  146. <el-form-item label="需要复制的选项" v-show="form.track">
  147. <el-select v-model="form.copyIds" multiple clearable placeholder="请选择需要复制的选项" :popper-append-to-body="false"
  148. @change="changeCopyIds">
  149. <el-option v-for="item in copyList" :key="item.value" :label="item.label" :value="item.value"></el-option>
  150. </el-select>
  151. </el-form-item>
  152. </el-col>
  153. </el-row>
  154. <template v-if="!form.id">
  155. <div>
  156. <el-row>
  157. <el-col :span="24">
  158. <el-form-item label="事件:">
  159. <mySelectButton size='large' style="width:100%" @click="addEvent">
  160. <div style="width:100%">
  161. <el-select style="width:100%" v-model="form.eventId" @change="changeEvent" filterable remote
  162. :disabled="eventList.disabled" clearable placeholder="请选择" :loading="eventList.loading"
  163. v-SelectLazyLoading="loadEvent" :remote-method="remoteEvent">
  164. <el-option v-for="item in eventList.data" :key="item.id" :label="item.name" :value="item.id">
  165. </el-option>
  166. </el-select>
  167. </div>
  168. </mySelectButton>
  169. </el-form-item>
  170. </el-col>
  171. </el-row>
  172. <el-row v-if="show == true">
  173. <el-col :span="24">
  174. <el-form-item label="调查类型:" prop="matterIds">
  175. <el-checkbox-group v-model="form.matterIds">
  176. <template>
  177. <el-checkbox v-for="item in dictAssociates" :key="item.id" :label="parseInt(item.id)">
  178. {{ item.name }}
  179. </el-checkbox>
  180. </template>
  181. </el-checkbox-group>
  182. </el-form-item>
  183. </el-col>
  184. </el-row>
  185. </div>
  186. </template>
  187. <el-form-item :label="(!form.id && form.status == 3) ? '上传报告文档' : '上传附件'">
  188. <myUpload :file-list="form.systemFileList" @on-change="onchangeFile" @on-remove="onRemove"
  189. @on-preview="onPreview" style="height: 180px;" :autoUpload="true"></myUpload>
  190. </el-form-item>
  191. <el-form-item label="备注" prop="description">
  192. <el-input type='textarea' v-model="form.description" autocomplete="off" placeholder="请输入备注"></el-input>
  193. </el-form-item>
  194. </el-form>
  195. <div slot="footer" v-if="$reportPermission(form.id, [0, 1])">
  196. <el-button @click="handleClose(false)">取 消</el-button>
  197. <el-button type="primary" @click="ifNext" v-if="form.reportType == 7 && !form.id">下一步</el-button>
  198. <el-button type="primary" @click="submit" v-else>确 定</el-button>
  199. </div>
  200. </el-dialog>
  201. <!-- 审核弹窗,做公用组件 -->
  202. <el-dialog title="添加审核任务" :visible.sync="showTask" width="500px" @close="handleCloseTask" :append-to-body="true"
  203. :close-on-click-modal="false">
  204. <el-form :model="taskForm" :rules="TaskRules" ref="TaskForm" label-width="120px" v-loading="loading">
  205. <el-form-item label="任务名称:" prop="name">
  206. <el-input v-model="taskForm.name" type="text" placeholder="输入任务名称" />
  207. </el-form-item>
  208. <el-form-item label="审核人:" prop="handler">
  209. <el-select style="width:100%;" ref="select1" v-model="taskForm.handler" clearable filterable remote
  210. :remote-method="remoteMethodPerson" v-SelectLazyLoading="lazyLoadingPerson">
  211. <el-option v-for="item in personnelList.data" :key="item.id" :label="item.name" :value="item.id"
  212. placeholder="请选择审核人"></el-option>
  213. </el-select>
  214. </el-form-item>
  215. <el-form-item label="完成日期:" prop="deadLineTime">
  216. <el-date-picker style="width:100%" v-model="taskForm.deadLineTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime"
  217. placeholder="选择日期">
  218. </el-date-picker>
  219. </el-form-item>
  220. <el-form-item label="审核备注:" prop="description">
  221. <el-input v-model="taskForm.description" type="textarea" placeholder="输入备注" />
  222. </el-form-item>
  223. </el-form>
  224. <span slot="footer" class="dialog-footer">
  225. <el-button @click="handleCloseTask">取 消</el-button>
  226. <el-button type="primary" @click="submitTask">确 定</el-button>
  227. </span>
  228. </el-dialog>
  229. <!-- 无效应对报告下一步所打开弹窗 -->
  230. <el-dialog :visible.sync="showEvidenceAndRequest" width="1000px" :append-to-body="true" :close-on-click-modal="false">
  231. <evidenceAndRequest ref="evidence" :examine="true" :reportId="reportId" @show="showEvidenceAndRequest = false">
  232. </evidenceAndRequest>
  233. </el-dialog>
  234. <!-- 委托方弹窗 -->
  235. <el-dialog title="选择委托方" :visible.sync="visible" width="800px" :append-to-body="true" :close-on-click-modal="false"
  236. destroy-on-close :before-close="close2" top="10vh">
  237. <ClientTable :choseClient="true" @getClient="getClient"></ClientTable>
  238. </el-dialog>
  239. </div>
  240. </template>
  241. <script>
  242. import { mapGetters } from 'vuex'
  243. import evidenceAndRequest from './evidenceAndRequest.vue'
  244. import addMatter from './addMatter.vue'
  245. import ClientTable from '@/views/client'
  246. export default {
  247. components: {
  248. evidenceAndRequest,
  249. addMatter,
  250. ClientTable,
  251. },
  252. props: {},
  253. data() {
  254. const isExist = (rule, value, callback) => {
  255. if (!this.form.signPatentNo && !this.form.signProjectId) {//没有专利号进入报错提示
  256. if ([3].includes(Number(this.form.reportType))) {
  257. var text = '请输入标的产品'
  258. } else {
  259. console.log(this.form.signProjectId);
  260. var text = '请输入标的专利号'
  261. }
  262. callback(new Error(text))
  263. } else {
  264. callback()
  265. }
  266. }
  267. const isTime = (rule, value, callback) => {
  268. if (this.isEndTime) {
  269. this.isEndTimes = Date.parse(new Date)
  270. }
  271. let b = Date.parse(value)
  272. if (value) {
  273. if (b < this.isEndTimes) {
  274. callback(new Error('禁止选择现在及以前时间,请重新选择'))
  275. } else {
  276. callback()
  277. }
  278. } else {
  279. callback(new Error('请选择时间'))
  280. }
  281. }
  282. return {
  283. //弹窗标题
  284. title: '',
  285. //控制弹窗是否打开
  286. showDialog: false,
  287. //表单数据
  288. form: {
  289. matterIds: [],
  290. systemFileList: [],
  291. fileGuids: [],
  292. },
  293. //表单规则
  294. rules: {
  295. name: [{ required: true, message: '请输入报告名称', trigger: 'blur' },],
  296. signProjectId: [{ required: true, validator: isExist, trigger: 'blur' },],//产品
  297. signPatentNo: [{ required: true, validator: isExist, trigger: 'blur' },],//专利
  298. headId: [{ required: true, message: '请选择负责人', trigger: 'change' },],
  299. entrustId: [{ required: true, message: '请选择委托方', trigger: 'change' },],
  300. },
  301. //加载
  302. loading: false,
  303. //加载时显示的文字
  304. load_text: '加载中',
  305. //应用场景
  306. commonData: {},
  307. //核心结论
  308. conclusion: [],
  309. //部门数据
  310. departmentList: [],
  311. //需要复制的选项集合
  312. copyList: [],
  313. //上传文件列表
  314. files: [],
  315. //核心结论类型字典
  316. reportAsDicItem: {
  317. "0": "INVALID_ASSESS",
  318. "1": "THIRD_ASSESS",
  319. "2": "STABILITY_ASSESS",
  320. "3": "FTO_ASSESS",
  321. "4": "TORT_ASSESS",
  322. "5": "AVOID_ASSESS",
  323. "7": "REINVALID_ASSESS",
  324. },
  325. //需要复制的内容字典
  326. reportAsDicItemCopy: {
  327. "0": "INVALID_COPY",
  328. "1": "THIRD_COPY",
  329. "2": "STABILITY_COPY",
  330. "3": "FTO_COPY",
  331. "4": "TORT_COPY",
  332. "5": "AVOID_COPY",
  333. },
  334. /**
  335. * 委托方
  336. */
  337. clientList: {
  338. queryParams: {
  339. current: 1,
  340. size: 10
  341. },
  342. data: [],
  343. cb: null
  344. },
  345. visible: false,
  346. //人员列表懒加载
  347. personnelList: {
  348. queryParams: {
  349. current: 1,
  350. size: 10
  351. },
  352. data: []
  353. },
  354. //产品列表懒加载
  355. productList: {
  356. queryParams: {
  357. current: 1,
  358. size: 10
  359. },
  360. loading: false,
  361. name: '',
  362. data: [],
  363. },
  364. matterType: null,
  365. //事件列表
  366. eventList: {
  367. queryParams: {
  368. current: 1,
  369. size: 10
  370. },
  371. data: []
  372. },
  373. // 控制调查类型是否显示
  374. show: false,
  375. //调查类型列表
  376. dictAssociates: [],
  377. /*审核弹窗所需变量start*/
  378. showTask: false,
  379. // 任务表单
  380. taskForm: {},
  381. isEndTime: true,
  382. isEndTimes: null,
  383. // 任务表单校验
  384. TaskRules: {
  385. name: [{ required: true, message: '请输入任务名称', trigger: 'blur' },],
  386. handler: [{ required: true, message: '请选择审核人', trigger: 'change' },],
  387. deadLineTime: [{ required: true, validator: isTime, trigger: 'change' }],
  388. },
  389. /*审核弹窗所需变量end*/
  390. /*无效应对报告下一步弹窗所需变量start*/
  391. // 报告id
  392. reportId: null,
  393. // 控制弹窗的关闭
  394. showEvidenceAndRequest: false,
  395. /*无效应对报告下一步弹窗所需变量end*/
  396. };
  397. },
  398. watch: {},
  399. computed: {
  400. ...mapGetters(['webSocket', 'userinfo']),
  401. dictMessage() {
  402. return this.$store.state.dictMessage.dictMessage
  403. },
  404. scenario() {
  405. return this.$store.state.dictMessage.scenario || []
  406. }
  407. },
  408. created() { },
  409. mounted() {
  410. //获取所有部门列表
  411. this.getDepartment()
  412. },
  413. methods: {
  414. /**
  415. * 人员
  416. */
  417. // 人员列表远程搜索
  418. remoteMethodPerson(query) {
  419. this.personnelList.data = []
  420. this.personnelList.queryParams.current = 1
  421. this.personnelList.queryParams.name = query
  422. this.getPermissionPersonnel()
  423. },
  424. // 获取所有人员列表懒加载
  425. lazyLoadingPerson() {
  426. if (this.personnelList.queryParams.current * this.personnelList.queryParams.size >= this.personnelList.queryParams.total) {
  427. return false
  428. }
  429. this.personnelList.queryParams.current += 1
  430. this.getPermissionPersonnel()
  431. },
  432. //获取所有人员列表(修改不要一次性获取,可以使用懒加载加远程搜索 )
  433. async getPermissionPersonnel(type) {
  434. this.personnelList.loading = true;
  435. await this.$api.getPermissionPersonnel(this.personnelList.queryParams).then((response) => {
  436. if (response.code == 200) {
  437. this.personnelList.loading = false;
  438. this.personnelList.data.push(...response.data)
  439. this.personnelList.queryParams.total = response.pageColumn.total
  440. }
  441. })
  442. },
  443. /**
  444. * 客户/委托方
  445. */
  446. //远程搜索委托方(建议调取接口获取)
  447. async querySearch(queryString, cb) {
  448. this.clientList.queryParams.current = 1
  449. this.clientList.queryParams.name = queryString
  450. this.clientList.data = []
  451. this.clientList.cb = cb
  452. await this.getClientList()
  453. // 调用 callback 返回建议列表的数据
  454. // cb(this.clientList.data);
  455. },
  456. loadClient() {
  457. if (this.clientList.queryParams.current * this.clientList.queryParams.size >= this.clientList.queryParams.total) {
  458. return false
  459. }
  460. this.clientList.queryParams.current += 1
  461. this.getClientList()
  462. },
  463. //获取委托方
  464. async getClientList() {
  465. await this.$api.getAdminClientList(this.clientList.queryParams).then(res => {
  466. if (res.code == 200) {
  467. this.clientList.data.push(...res.data.records)
  468. this.clientList.queryParams.total = res.data.total
  469. this.clientList.cb(this.clientList.data);
  470. }
  471. })
  472. },
  473. //输入框输入事件(委托方)
  474. input() {
  475. this.$set(this.form, 'entrustId', -1)
  476. },
  477. //切换选择委托方
  478. handleChange(row) {
  479. this.$set(this.form, 'entrustId', row.id)
  480. this.$set(this.form, 'entrustName', row.name)
  481. this.close2()
  482. },
  483. //打开选择委托方弹窗
  484. handleSelect() {
  485. this.visible = true
  486. },
  487. //获取委托方信息
  488. getClient(row) {
  489. this.$set(this.form, 'entrustId', row.id)
  490. this.$set(this.form, 'entrustName', row.name)
  491. this.close2()
  492. },
  493. //关闭委托方弹窗
  494. close2() {
  495. this.visible = false
  496. },
  497. /**
  498. * 事件处理
  499. */
  500. //打开事件弹窗
  501. addEvent() {
  502. },
  503. /**
  504. * 事件
  505. */
  506. //懒加载事件
  507. loadEvent() {
  508. if (this.eventList.queryParams.current * this.eventList.queryParams.size >= this.eventList.queryParams.total) {
  509. return false
  510. }
  511. this.eventList.queryParams.current += 1
  512. this.getEventList()
  513. },
  514. //远程搜索
  515. remoteEvent(query) {
  516. this.eventList.data = []
  517. this.eventList.queryParams.current = 1
  518. this.eventList.name = query
  519. this.getEventList()
  520. },
  521. //获取事件列表
  522. async getEventList(type) {
  523. this.eventList.loading = true;
  524. let params = {
  525. ...this.eventList.queryParams,//分页信息
  526. searchQuery: this.eventList.name ? `name=${this.eventList.name}` : '',//检索条件
  527. orderDTOList: [{ orderBy: "createTime", orderType: 1 },]//排序
  528. }
  529. await this.$api.queryEvent(params).then(response => {
  530. if (response.code == 200) {
  531. this.eventList.loading = false;
  532. if (!type) {
  533. if (this.form.eventId) {
  534. var index = response.data.data.findIndex(item => {
  535. return item.id == this.form.eventId
  536. })
  537. if (index != -1) {
  538. response.data.data.splice(index, 1)
  539. }
  540. }
  541. this.eventList.queryParams.total = response.data.total
  542. }
  543. this.eventList.data.push(...response.data.data)
  544. // this.eventList.queryParams.total = response.data.total
  545. }
  546. })
  547. },
  548. //切换事件
  549. async changeEvent(val) {
  550. if (!val) {
  551. this.form.scenarioIds = []
  552. this.show = false
  553. this.form.matterIds = []
  554. return
  555. }
  556. var obj = this.eventList.data.find(item => {
  557. return item.id == val
  558. })
  559. if (obj) {
  560. this.form.scenarioIds = [obj.scenarioId]
  561. this.show = true
  562. await this.onChange()
  563. }
  564. },
  565. //调查类型选择切换
  566. async onChange() {
  567. if (this.form.scenarioIds.length != 0) {
  568. await this.$api.getMatter(this.form.scenarioIds).then(response => {
  569. this.show = true
  570. this.dictAssociates = response.data.data
  571. })
  572. } else {
  573. this.show = false
  574. }
  575. },
  576. //打开弹窗
  577. async open(form) {
  578. var a = ''
  579. this.form = JSON.parse(JSON.stringify(form))
  580. if (this.form.id) {
  581. if (this.$reportPermission(this.form.id, [0, 1])) {
  582. a = '编辑'
  583. } else {
  584. a = '查看'
  585. }
  586. } else {
  587. this.$set(this.form, 'matterIds', form.matterId)
  588. this.form.scenarioIds = form.scenarioId
  589. this.$set(this.form, 'systemFileList', [])
  590. this.$set(this.form, 'fileGuids', [])
  591. this.eventList.disabled = false
  592. if (this.form.eventId) {
  593. this.eventList.disabled = true
  594. this.eventList.data.push(
  595. {
  596. id: form.eventId,
  597. name: form.eventName
  598. }
  599. )
  600. }
  601. a = '创建'
  602. }
  603. var reportType = this.dictMessage.REPORT_TYPE.filter(item => { return item.value == this.form.reportType })[0].label
  604. this.title = a + reportType + '报告'
  605. // 负责人
  606. if (this.form.headId) {
  607. this.personnelList.queryParams.id = this.form.headId
  608. await this.getPermissionPersonnel(1)
  609. this.personnelList.queryParams.id = null
  610. }
  611. this.getPermissionPersonnel()
  612. // this.getEventList()
  613. this.showDialog = true
  614. },
  615. /**
  616. * 产品
  617. * @param {*} query
  618. */
  619. // 懒加载产品方法
  620. productLoad() {
  621. if (this.productList.queryParams.current * this.productList.queryParams.size >= this.productList.queryParams.total) {
  622. return false
  623. }
  624. this.productList.queryParams.current++
  625. this.queryProduct()
  626. },
  627. // 查询产品
  628. async queryProduct() {
  629. let params = {
  630. ...this.productList.queryParams,
  631. name:this.productList.name
  632. }
  633. await this.$api.queryProduct(params).then(res => {
  634. if (res.code == 200) {
  635. this.productList.data.push(...res.data)
  636. this.productList.queryParams.total = res.pageColumn.total
  637. this.productList.cb(this.productList.data);
  638. }
  639. })
  640. },
  641. //获取下拉建议产品数据
  642. async querySearchProduct(queryString, cb) {
  643. this.productList.queryParams.current = 1
  644. this.productList.name = queryString
  645. this.productList.data = []
  646. this.productList.cb = cb
  647. await this.queryProduct()
  648. },
  649. // 产品输入框
  650. handleChangeProduct(val) {
  651. this.$set(this.form,'signProjectId',val)
  652. this.$set(this.form, 'name', val + 'FTO调查')
  653. },
  654. // 产品输入框选择
  655. handleSelectProduct(val) {
  656. this.$set(this.form, 'name', val.name + 'FTO调查')
  657. },
  658. //获取所有部门列表
  659. getDepartment() {
  660. this.$api.getPermissionDepartmentList().then((response) => {
  661. this.departmentList = response.data;
  662. });
  663. },
  664. //切换是否完成状态
  665. async changeStatus(val) {
  666. if (val == 3) {
  667. this.rules.headId[0].required = false
  668. this.rules.entrustId[0].required = false
  669. if (!this.form.id) {
  670. this.$set(this.form, 'cronIds', [])
  671. }
  672. let params = {
  673. reportType: this.form.reportType
  674. }
  675. await this.$api.queryCrons(params).then(res => {
  676. if (res.code == 200) {
  677. this.conclusion = res.data.data
  678. }
  679. }).catch(error => {
  680. this.conclusion = []
  681. this.$message.error(error.message)
  682. })
  683. // this.conclusion = this.dictMessage[this.reportAsDicItem[this.form.reportType]]
  684. this.matterType = 2
  685. } else {
  686. this.rules.headId[0].required = true
  687. this.rules.entrustId[0].required = true
  688. this.matterType = null
  689. }
  690. },
  691. //获取专利号且填入报告名称
  692. getPatentNo() {
  693. // if (!this.form.name) {
  694. var a = this.dictMessage.REPORT_TYPE.filter(item => { return item.value == this.form.reportType })[0].label
  695. if (this.form.signProjectId) {
  696. var product = this.productList.data.filter(item => {
  697. return item.id == this.form.signProjectId
  698. })
  699. var name = ''
  700. if(product.length>0){
  701. name +=`${product[0].name}-`
  702. }
  703. name+=a
  704. this.$set(this.form, 'name', name)
  705. } else {
  706. var name = ''
  707. if(this.form.caseNumber){
  708. name += `${this.form.caseNumber}-`
  709. }
  710. if(this.form.signPatentNo){
  711. name+=`${this.form.signPatentNo}-`
  712. }
  713. name+=a
  714. this.$set(this.form, 'name', name)
  715. }
  716. // }
  717. },
  718. //修改需要复制的选项
  719. changeCopyIds(val) {
  720. if (Object.keys(this.copyIndex).length > 0) {
  721. var index = this.copyList.findIndex(item => {
  722. return item.label == '对比文件'
  723. })
  724. if (index != -1) {
  725. var id = this.copyList[index].value
  726. var index2 = this.copyList.findIndex(item => {
  727. return item.label == '标引信息'
  728. })
  729. if (val.indexOf(id) != -1) {
  730. if (index2 == -1) {
  731. this.copyList.splice(index + 1, 0, this.copyIndex)
  732. }
  733. } else {
  734. if (index2 != -1) {
  735. this.copyList.splice(index2, 1)
  736. this.form.copyIds.splice(this.form.copyIds.indexOf(this.copyIndex.value), 1)
  737. }
  738. }
  739. } else {
  740. }
  741. }
  742. },
  743. // 上传的文件监听
  744. onchangeFile(file, fileList) {
  745. if (file.guid) {
  746. let index = this.form.systemFileList.findIndex(item => {
  747. return item.uid == file.uid
  748. })
  749. if (index != -1) {
  750. this.form.systemFileList.splice(index, 1, file)
  751. }
  752. } else {
  753. this.form.systemFileList.push(file.raw)
  754. }
  755. },
  756. // 删除上传的文件
  757. onRemove(file, fileList) {
  758. let index = this.form.systemFileList.findIndex(item => {
  759. return item.uid == file.uid
  760. })
  761. if (index != -1) {
  762. this.form.systemFileList.splice(index, 1)
  763. }
  764. },
  765. //上传附件时点击查看附件内容
  766. onPreview(file) {
  767. var item = {
  768. name: file.name,
  769. suffix: '',
  770. downLoad: true
  771. }
  772. var index = file.raw.type.lastIndexOf('/')
  773. var type = file.raw.type.substring(index + 1, file.raw.type.length)
  774. var arr = ['png', 'jpeg', 'bmp', 'jpg']
  775. if (arr.includes(type)) {
  776. var FileUrl = URL.createObjectURL(file.raw)
  777. var isPicture = 1
  778. } else if (type == 'pdf') {
  779. var FileUrl = URL.createObjectURL(file.raw)
  780. var isPicture = 0
  781. } else {
  782. return false
  783. }
  784. const router = this.$router.resolve({
  785. path: '/checkFile',
  786. query: {
  787. row: JSON.stringify(item),
  788. FileUrl: FileUrl,
  789. isPicture: isPicture
  790. }
  791. })
  792. window.open(router.href, '_blank');
  793. },
  794. //提交填写的信息
  795. submit() {
  796. console.log();
  797. this.$refs.reportForm.validate((valid) => {
  798. if (valid) {
  799. console.log(2);
  800. this.form.type = 2//项目类型(1专利数据库 2报告 3专利挖掘项目)
  801. // 判断文件是否都上传完毕
  802. this.$commonJS.allUploadFile(this.form)
  803. // // 判断文件是否都上传完毕
  804. // if (this.form.systemFileList && this.form.systemFileList.length > 0) {
  805. // this.form.fileGuids = []
  806. // for (let i = 0; i < this.form.systemFileList.length; i++) {
  807. // if (this.form.systemFileList[i].guid) {
  808. // this.form.fileGuids.push(this.form.systemFileList[i].guid)
  809. // } else {
  810. // this.$message.error('文件未全部上传,请耐心等待')
  811. // return false
  812. // }
  813. // }
  814. // }
  815. // 事件及调查类型处理
  816. if (this.form.scenarioIds && this.form.scenarioIds.length > 0) {
  817. var scenarioIds = JSON.parse(JSON.stringify(this.form.scenarioIds))
  818. }
  819. if (this.form.eventId) {
  820. this.form.events = []
  821. this.form.scenarioIds = []
  822. this.form.matterIds.forEach(item => {
  823. this.form.events.push(
  824. {
  825. matterId: item,
  826. scenarioId: scenarioIds[0],
  827. eventId: this.form.eventId
  828. }
  829. )
  830. })
  831. }
  832. let formData = this.form
  833. if (!this.form.id) {//新增报告
  834. this.$confirm('是否需要进行审核?', '提示', {
  835. confirmButtonText: '是',
  836. cancelButtonText: '否',
  837. closeOnClickModal: false,
  838. distinguishCancelAndClose: true,
  839. }).then(() => {//审核打开审核弹窗
  840. this.showTask = true
  841. this.$set(this.taskForm, 'name', this.form.name + '审核')
  842. }).catch(action => {//不审核直接创建报告
  843. console.log(3);
  844. // 直接完成传true
  845. // formData.ifFinish = true
  846. // 调用创建报告公用,接口
  847. this.addReport(formData, scenarioIds)
  848. });
  849. } else {//编辑报告
  850. this.$api.updateReportProject(formData).then(response => {
  851. if (response.code == 200) {
  852. this.files = []
  853. this.$message.success('报告更新成功')
  854. this.$emit('getList', '更新成功')
  855. this.handleClose()
  856. }
  857. })
  858. }
  859. }
  860. })
  861. },
  862. //关闭弹窗
  863. handleClose(val) {
  864. if (this.form.reportType == 7 && val) {
  865. this.showEvidenceAndRequest = true
  866. // this.$s.setSession('params', {})
  867. this.reportId = val
  868. }
  869. this.personnelList.queryParams.name = ''
  870. this.$refs.reportForm.resetFields()
  871. this.form = {
  872. matterIds: [],
  873. systemFileList: [],
  874. fileGuids: [],
  875. }
  876. this.showDialog = false
  877. this.clear()
  878. },
  879. //清空组件缓存数据
  880. clear() {
  881. // 清空事件相关
  882. this.form.eventId = []
  883. this.eventList.queryParams.current = 1
  884. this.eventList.name = ''
  885. this.eventList.data = []
  886. // 清空负责人相关
  887. this.personnelList.data = []
  888. this.personnelList.queryParams.current = 1
  889. this.personnelList.queryParams.name = null
  890. },
  891. // 创建报告创建接口公用
  892. addReport(formData, scenarioIds) {
  893. this.$api.addReportProject(formData).then(response => {
  894. if (response.code == 200) {
  895. this.files = []
  896. this.$message.success('报告创建成功')
  897. this.$emit('getList', '新增成功')
  898. // response.data是创建成功后返回的报告id
  899. this.handleClose(response.data)
  900. }
  901. }).catch(error => {
  902. // 如果报告未创建成功,则赋值
  903. if (scenarioIds && scenarioIds.length>0) {
  904. this.form.scenarioIds = JSON.parse(JSON.stringify(scenarioIds))
  905. }
  906. this.show = true
  907. })
  908. },
  909. //提交审核任务
  910. submitTask() {
  911. this.isEndTime = false
  912. this.$refs.TaskForm.validate((valid) => {
  913. if (valid) {
  914. this.taskForm.handlerType = 0//内部人员0,外部人员1
  915. this.taskForm.type = 5//任务类型,5为审核
  916. let params = {
  917. reportProjectDTO: this.form,
  918. projectTaskDTO:this.taskForm,
  919. }
  920. this.$api.addReportOpenAuditTask(params).then(response => {
  921. if (response.code == 200) {
  922. this.files = []
  923. this.$message.success('报告创建成功并发送审核')
  924. this.$emit('getList', true)
  925. this.handleCloseTask()
  926. this.handleClose()
  927. }
  928. }).catch(error => {
  929. this.$message.error('报告创建失败')
  930. this.handleCloseTask()
  931. })
  932. }
  933. })
  934. },
  935. //关闭审核弹窗
  936. handleCloseTask() {
  937. this.matterType = null
  938. this.$refs.TaskForm.resetFields()
  939. this.taskForm = {}
  940. this.showTask = false
  941. this.isEndTime = true
  942. },
  943. // 创建无效应对报告下一步
  944. ifNext() {
  945. this.$refs.reportForm.validate((valid) => {
  946. if (valid) {
  947. let formData = new FormData()
  948. if (this.files && this.files.length > 0) {
  949. for (var i = 0; i < this.files.length; i++) {
  950. formData.append("files", this.files[i]);
  951. }
  952. }
  953. formData.append('report', this.form)
  954. this.addReport(formData)
  955. } else {
  956. this.loading = false
  957. this.$alert('校验未通过,请按照要求创建报告', '提示', {
  958. confirmButtonText: '确定',
  959. type: 'warning',
  960. callback: action => {
  961. }
  962. });
  963. return false;
  964. }
  965. })
  966. },
  967. },
  968. };
  969. </script>
  970. <style lang="scss">
  971. // .el-input__inner{
  972. // pointer-events: none;
  973. // }
  974. // .el-input__inner:empty{
  975. // content:'--'
  976. // }
  977. </style>