addAndEditReport.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  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. <el-form-item :label="[3].includes(Number(form.type)) ? '标的产品' : '标的专利'" prop="signPatentNo">
  11. <el-input v-model="form.signPatentNo" autocomplete="off"
  12. :placeholder="[3].includes(Number(form.type)) ? '请输入标的产品' : '请输入标的专利'" @change="getPatentNo"></el-input>
  13. </el-form-item>
  14. </el-col>
  15. <el-col :span="12">
  16. <el-form-item label="报告名称" prop="name">
  17. <el-input v-model="form.name" autocomplete="off" placeholder="请输入报告名称"></el-input>
  18. </el-form-item>
  19. </el-col>
  20. </el-row>
  21. <el-form-item label="是否完成" v-if="!form.id">
  22. <el-switch v-model="form.status" active-color="#13ce66" inactive-color="#ff4949" @change="changeStatus"
  23. :active-value="3" :inactive-value="1">
  24. </el-switch>
  25. </el-form-item>
  26. <template v-if="!form.id && form.status == 3">
  27. <div>
  28. <el-form-item label="核心结论">
  29. <el-checkbox-group v-model="form.conclusionIds">
  30. <el-checkbox v-for="item in conclusion" :key="item.dictChildValue" :label="item.dictChildValue">{{
  31. item.dictChildLabel }}</el-checkbox>
  32. </el-checkbox-group>
  33. </el-form-item>
  34. <el-form-item label="结论论述">
  35. <el-input v-model="form.cronConclusion" type="textarea" placeholder="请输入结论论述"></el-input>
  36. </el-form-item>
  37. <el-form-item label="后续跟进事项" v-if="$permission('/rms/matter')">
  38. <span v-if="form.followUps"><span v-for="item in form.followUps" :key="item.followUpName"
  39. style="margin-right:10px">{{ item.followUpName }}</span></span>
  40. <span>
  41. <el-popover ref="popover" placement="bottom" @hide="hidePopover" @show="showPopover" trigger="click">
  42. <div>
  43. <addMatter :type="matterType" :sign="matterSign" @value="getMatter"></addMatter>
  44. </div>
  45. <el-button slot="reference">添加后续事项</el-button>
  46. </el-popover>
  47. </span>
  48. </el-form-item>
  49. </div>
  50. </template>
  51. <el-row>
  52. <el-col :span="12">
  53. <el-form-item label="承担部门" prop="departmentId">
  54. <mySelectTree style="width:100%" v-model="form.departmentId" :options="departmentList"></mySelectTree>
  55. </el-form-item>
  56. </el-col>
  57. <el-col :span="12">
  58. <el-form-item label="负责人" prop="personId">
  59. <el-select style="width:100%" v-model="form.personId" placeholder="请选择负责人" filterable remote
  60. :popper-append-to-body="false" :remote-method="remoteMethodPerson" v-SelectLazyLoading="lazyLoadingPerson"
  61. :loading="loading">
  62. <el-option v-for="item in personnelList" :key="item.id" :label="item.personnelName"
  63. :value="item.id"></el-option>
  64. </el-select>
  65. </el-form-item>
  66. </el-col>
  67. </el-row>
  68. <el-row>
  69. <el-col :span="12">
  70. <template>
  71. <div>
  72. <el-form-item label="委托方" prop="clientId" v-if="userinfo.tenantType == 1">
  73. <el-select style="width:100%" v-model="form.clientId" placeholder="请选择委托方" filterable remote
  74. :popper-append-to-body="false" :remote-method="remoteMethodClient"
  75. v-SelectLazyLoading="lazyLoadingClient" :loading="loading">
  76. <el-option v-for="item in clientList" :key="item.id" :label="item.name" :value="item.id"></el-option>
  77. </el-select>
  78. </el-form-item>
  79. <el-form-item label="委托部门" prop="departmentId" v-else>
  80. <mySelectTree style="width:100%" v-model="form.departmentId" :options="departmentList"></mySelectTree>
  81. </el-form-item>
  82. </div>
  83. </template>
  84. </el-col>
  85. <el-col :span="12">
  86. <el-form-item label="卷号" prop="volumeNumber">
  87. <el-input v-model="form.volumeNumber" autocomplete="off" placeholder="请输入卷号"></el-input>
  88. </el-form-item>
  89. </el-col>
  90. </el-row>
  91. <el-form-item label="应用场景">
  92. <el-checkbox-group v-model="form.scenarioList">
  93. <el-checkbox v-for="item in commonData.ENTERPRISE_APPLICATION_SCENARIO" :key="item.value"
  94. :label="parseInt(item.value)">{{ item.label }}</el-checkbox>
  95. </el-checkbox-group>
  96. </el-form-item>
  97. <el-row>
  98. <el-col :span="24">
  99. <el-form-item label="产品/技术">
  100. <el-input v-model="form.proTec" autocomplete="off" placeholder="请输入产品/技术"></el-input>
  101. </el-form-item>
  102. </el-col>
  103. </el-row>
  104. <el-row>
  105. <el-col :span="form.track ? 12 : 24">
  106. <el-form-item label="关联报告">
  107. <el-input v-model="form.associateReportName" autocomplete="off" placeholder="请输入关联报告"></el-input>
  108. </el-form-item>
  109. </el-col>
  110. <el-col :span="12">
  111. <el-form-item label="需要复制的选项" v-show="form.track">
  112. <el-select v-model="form.copyIds" multiple clearable placeholder="请选择需要复制的选项" :popper-append-to-body="false"
  113. @change="changeCopyIds">
  114. <el-option v-for="item in copyList" :key="item.dictChildValue" :label="item.dictChildLabel"
  115. :value="item.dictChildValue"></el-option>
  116. </el-select>
  117. </el-form-item>
  118. </el-col>
  119. </el-row>
  120. <template v-if="form.type == 7">
  121. <div>
  122. <el-row>
  123. <el-col :span="12">
  124. <el-form-item label="案件编号">
  125. <el-input v-model="form.caseNumber" autocomplete="off" placeholder="请输入案件编号"></el-input>
  126. </el-form-item>
  127. </el-col>
  128. <el-col :span="12">
  129. <el-form-item label="发文序号">
  130. <el-input v-model="form.issueNumber" autocomplete="off" placeholder="请输入发文序号"></el-input>
  131. </el-form-item>
  132. </el-col>
  133. </el-row>
  134. <el-row>
  135. <el-col :span="12">
  136. <el-form-item label="发明创造名称">
  137. <el-input v-model="form.inventionName" autocomplete="off" placeholder="请输入发明创造名称"></el-input>
  138. </el-form-item>
  139. </el-col>
  140. <el-col :span="12">
  141. <el-form-item label="无效宣告请求人">
  142. <el-input v-model="form.invalidApplication" autocomplete="off" placeholder="请输入无效宣告请求人"></el-input>
  143. </el-form-item>
  144. </el-col>
  145. </el-row>
  146. </div>
  147. </template>
  148. <el-form-item :label="(!form.id && form.status == 3) ? '上传报告文档' : '上传附件'">
  149. <myUpload :file-list="handleConcat(form[0].systemFileList)" @on-change="onChange" @on-remove="onRemove"
  150. @on-preview="onPreview" style="height: 180px;"></myUpload>
  151. </el-form-item>
  152. <el-form-item label="备注" prop="remark">
  153. <el-input type='textarea' v-model="form.remark" autocomplete="off" placeholder="请输入备注"></el-input>
  154. </el-form-item>
  155. </el-form>
  156. <div slot="footer" v-if="$reportPermission(form.id, [0, 1])">
  157. <el-button @click="handleClose(false)">取 消</el-button>
  158. <el-button type="primary" @click="ifNext" v-if="form.type == 7 && !form.id">下一步</el-button>
  159. <el-button type="primary" @click="submit" v-else>确 定</el-button>
  160. </div>
  161. </el-dialog>
  162. </div>
  163. </template>
  164. <script>
  165. import { mapGetters } from 'vuex'
  166. export default {
  167. components: {},
  168. props: {},
  169. data() {
  170. const isExist = (rule, value, callback) => {
  171. if (!this.form.signPatentNo) {//没有专利号进入报错提示
  172. this.show = 0
  173. if ([3].includes(Number(this.form.type))) {
  174. var text = '请输入标的产品'
  175. } else {
  176. var text = '请输入标的专利号'
  177. }
  178. callback(new Error(text))
  179. }
  180. }
  181. return {
  182. //弹窗标题
  183. title: '',
  184. //控制弹窗是否打开
  185. showDialog: false,
  186. //表单数据
  187. form: {},
  188. //表单规则
  189. rules: {
  190. name: [{ required: true, message: '请输入报告名称', trigger: 'blur' },],
  191. signPatentNo: [{ required: true, validator: isExist, trigger: 'blur' },],
  192. personId: [{ required: true, message: '请选择负责人', trigger: 'change' },],
  193. clientId: [{ required: true, message: '请选择委托方', trigger: 'change' },],
  194. },
  195. //加载
  196. loading: false,
  197. //加载时显示的文字
  198. load_text: '加载中',
  199. //应用场景
  200. commonData: {},
  201. //核心结论
  202. conclusion: [],
  203. //部门数据
  204. departmentList: [],
  205. //需要复制的选项集合
  206. copyList: [],
  207. //人员列表
  208. personnelList: [],
  209. //客户列表
  210. clientList: [],
  211. //上传文件列表
  212. files: [],
  213. //核心结论类型字典
  214. reportAsDicItem: {
  215. "0": "INVALID_ASSESS",
  216. "1": "THIRD_ASSESS",
  217. "2": "STABILITY_ASSESS",
  218. "3": "FTO_ASSESS",
  219. "4": "TORT_ASSESS",
  220. "5": "AVOID_ASSESS",
  221. "7": "REINVALID_ASSESS",
  222. },
  223. //需要复制的内容字典
  224. reportAsDicItemCopy: {
  225. "0": "INVALID_COPY",
  226. "1": "THIRD_COPY",
  227. "2": "STABILITY_COPY",
  228. "3": "FTO_COPY",
  229. "4": "TORT_COPY",
  230. "5": "AVOID_COPY",
  231. },
  232. queryParams: {
  233. current: 1,
  234. size: 10,
  235. },
  236. //是否懒加载
  237. isLazy: true,
  238. };
  239. },
  240. watch: {},
  241. computed: {
  242. ...mapGetters(['webSocket', 'userinfo']),
  243. dictMessage() {
  244. return this.$store.state.dictMessage.dictMessage
  245. },
  246. },
  247. created() { },
  248. mounted() {
  249. //获取字典项(接口还是通过字典获取)
  250. this.$api.getCommonData({ keys: 'QUERY_GROUP,ENTERPRISE_APPLICATION_SCENARIO,INVESTIGATION_TYPE' }).then(response => {
  251. this.commonData = response.data
  252. })
  253. // console.log(1)
  254. //获取所有人员列表(修改不要一次性获取,可以使用懒加载加远程搜索 )
  255. this.getAllPersonnelList()
  256. //获取所有客户列表(修改不要一次性获取,可以使用懒加载加远程搜索 )
  257. this.getAllClientList()
  258. //获取所有部门列表
  259. this.getAllDepartmentList()
  260. },
  261. methods: {
  262. //打开弹窗
  263. open(form) {
  264. this.form = JSON.parse(JSON.stringify(form))
  265. var a = ''
  266. if (this.form.id) {
  267. if (this.$reportPermission(this.form.id, [0, 1])) {
  268. a = '编辑'
  269. } else {
  270. a = '查看'
  271. }
  272. } else {
  273. a = '创建'
  274. }
  275. var reportType = this.dictMessage.REPORT_TYPE.filter(item => { return item.dictChildValue == this.form.type })[0].dictChildLabel
  276. this.title = a + reportType + '报告'
  277. this.showDialog = true
  278. },
  279. // 人员列表远程搜索
  280. remoteMethodPerson(query) {
  281. this.isLazy = true
  282. if (query !== '') {
  283. this.loading = true;
  284. let params = {
  285. ...this.queryParams,//分页信息
  286. searchQuery: `name=${query}`,
  287. }
  288. this.$api.AllPersonnelList(params).then(response => {
  289. if (response.code == 200) {
  290. this.loading = false;
  291. this.personnelList = response.data.data
  292. }
  293. }).catch(error => {
  294. this.loading = false;
  295. })
  296. } else {
  297. this.personnelList = [];
  298. this.getProductCategory()
  299. }
  300. },
  301. // 获取所有人员列表懒加载
  302. lazyLoadingPerson() {
  303. if (!this.isLazy) {
  304. return false
  305. }
  306. this.queryParams.current++;
  307. this.getAllPersonnelList();
  308. },
  309. //获取所有人员列表(修改不要一次性获取,可以使用懒加载加远程搜索 )
  310. getAllPersonnelList() {
  311. if (!this.isLazy) {
  312. return false
  313. }
  314. let params = {
  315. ...this.queryParams,//分页信息
  316. }
  317. this.$api.AllPersonnelList(params).then(response => {
  318. if (response.code == 200) {
  319. if (response.data.data && response.data.data.length == 0) {
  320. this.isLazy = false
  321. }
  322. this.personnelList = [...this.personnelList, ...response.data.data];
  323. }
  324. }).catch(error => {
  325. this.personnelList = []
  326. this.$message.error(error.message)
  327. })
  328. },
  329. // 客户列表远程搜索
  330. remoteMethodClient(query) {
  331. this.isLazy = true
  332. if (query !== '') {
  333. this.loading = true;
  334. let params = {
  335. ...this.queryParams,//分页信息
  336. searchQuery: `name=${query}`,
  337. }
  338. this.$api.AllClientList(params).then(response => {
  339. if (response.code == 200) {
  340. this.loading = false;
  341. this.clientList = response.data.data
  342. }
  343. }).catch(error => {
  344. this.loading = false;
  345. })
  346. } else {
  347. this.clientList = [];
  348. this.getAllClientList()
  349. }
  350. },
  351. // 获取所有客户列表懒加载
  352. lazyLoadingClient() {
  353. if (!this.isLazy) {
  354. return false
  355. }
  356. this.queryParams.current++;
  357. this.getAllClientList();
  358. },
  359. //获取所有客户列表(修改不要一次性获取,可以使用懒加载加远程搜索 )
  360. getAllClientList() {
  361. if (!this.isLazy) {
  362. return false
  363. }
  364. let params = {
  365. ...this.queryParams,//分页信息
  366. }
  367. this.$api.AllClientList(params).then(response => {
  368. if (response.code == 200) {
  369. if (response.data.data && response.data.data.length == 0) {
  370. this.isLazy = false
  371. }
  372. this.clientList = [...this.clientList, ...response.data.data];
  373. }
  374. }).catch(error => {
  375. this.clientList = []
  376. this.$message.error(error.message)
  377. })
  378. },
  379. //获取所有部门列表
  380. getAllDepartmentList() {
  381. this.$api.AllDepartmentList(params).then(res => {
  382. if (res.code == 200) {
  383. this.departmentList = res.data
  384. }
  385. }).catch(error => {
  386. this.$message.error(error.message)
  387. })
  388. },
  389. //关闭弹窗
  390. handleClose() {
  391. this.$refs.reportForm.resetFields()
  392. this.form = {}
  393. this.showDialog = false
  394. },
  395. //切换是否完成状态
  396. changeStatus(val) {
  397. this.form.status = val
  398. },
  399. //获取专利号且填入报告名称
  400. getPatentNo() {
  401. if (!this.form.name) {
  402. var a = this.dictMessage.REPORT_TYPE.filter(item => { return item.dictChildValue == this.form.type })[0].dictChildLabel
  403. this.$set(this.form, 'name', this.form.signPatentNo + a)
  404. }
  405. },
  406. //修改需要复制的选项
  407. changeCopyIds(val) {
  408. if (Object.keys(this.copyIndex).length > 0) {
  409. var index = this.copyList.findIndex(item => {
  410. return item.dictChildLabel == '对比文件'
  411. })
  412. if (index != -1) {
  413. var id = this.copyList[index].dictChildValue
  414. var index2 = this.copyList.findIndex(item => {
  415. return item.dictChildLabel == '标引信息'
  416. })
  417. if (val.indexOf(id) != -1) {
  418. if (index2 == -1) {
  419. this.copyList.splice(index + 1, 0, this.copyIndex)
  420. }
  421. } else {
  422. if (index2 != -1) {
  423. this.copyList.splice(index2, 1)
  424. this.form.copyIds.splice(this.form.copyIds.indexOf(this.copyIndex.dictChildValue), 1)
  425. }
  426. }
  427. } else {
  428. }
  429. }
  430. },
  431. // 合并已上传的文件和未上传的文件
  432. handleConcat(arr) {
  433. let files = (arr || []).concat(this.files)
  434. return files
  435. },
  436. //切换上传的文件
  437. onChange(file, fileList) {
  438. if (this.files && this.files.length > 0) {
  439. let a = this.files.findIndex(item => {
  440. return item.size == file.size
  441. })
  442. if (a != -1) {
  443. this.$message.error(`${file.raw.name}文件重复`)
  444. this.files.splice(a, 1, file.raw)
  445. } else {
  446. this.files.push(file.raw)
  447. }
  448. } else {
  449. this.files.push(file.raw)
  450. }
  451. },
  452. //删除未提交的附件
  453. onRemove(file, fileList) {
  454. if (file.guid) {
  455. let a = this.formData[0].systemFileList.findIndex(item => {
  456. return item.guid == file.guid
  457. })
  458. this.formData[0].systemFileList.splice(a, 1)
  459. } else {
  460. let a = this.files.findIndex(item => {
  461. return item.size == file.size
  462. })
  463. this.files.splice(a, 1)
  464. }
  465. },
  466. //上传附件时点击查看附件内容
  467. onPreview(file) {
  468. var item = {
  469. name: file.name,
  470. suffix: '',
  471. downLoad: true
  472. }
  473. var index = file.raw.type.lastIndexOf('/')
  474. var type = file.raw.type.substring(index + 1, file.raw.type.length)
  475. var arr = ['png', 'jpeg', 'bmp', 'jpg']
  476. if (arr.includes(type)) {
  477. var FileUrl = URL.createObjectURL(file.raw)
  478. var isPicture = 1
  479. } else if (type == 'pdf') {
  480. var FileUrl = URL.createObjectURL(file.raw)
  481. var isPicture = 0
  482. } else {
  483. return false
  484. }
  485. const router = this.$router.resolve({
  486. path: '/checkFile',
  487. query: {
  488. row: JSON.stringify(item),
  489. FileUrl: FileUrl,
  490. isPicture: isPicture
  491. }
  492. })
  493. window.open(router.href, '_blank');
  494. },
  495. //创建无效应对报告下一步
  496. ifNext() { },
  497. //提交填写的信息
  498. submit() {
  499. this.$refs.reportForm.validate(valid => {
  500. if (valid) {
  501. let formData = new FormData()
  502. if (this.files && this.files.length > 0) {
  503. for (var i = 0; i < this.files.length; i++) {
  504. formData.append("files", this.files[i]);
  505. }
  506. }
  507. formData.append('report',this.form)
  508. if (!this.form.id) {//新增报告
  509. this.$api.AddReport(formData).then(response => {
  510. if (response.code == 200) {
  511. this.files = []
  512. this.$message.success('报告创建成功')
  513. this.$emit('getList', true)
  514. this.handleClose()
  515. }
  516. })
  517. } else {//编辑报告
  518. }
  519. }
  520. })
  521. },
  522. },
  523. };
  524. </script>
  525. <style lang="scss" scoped></style>