addAndEditReport.vue 33 KB

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