outsourcing-doc.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. <template>
  2. <div v-loading="loading">
  3. <div class="header-btn">
  4. <el-button size="small" type="primary" icon="el-icon-plus" @click="handleAddClick">新增</el-button>
  5. <el-button size="small" type="primary" icon="el-icon-printer" v-print="printConfig" @click="isPrintPage = true">打印</el-button>
  6. </div>
  7. <div id="outsourcingWrap" class="doc-page">
  8. <h3 class="page-title">委外项目管理</h3>
  9. <year-month-select v-show="!isPrintPage" v-model="params.yearAndMonth" :showMonth="false"></year-month-select>
  10. <table class="doc-table">
  11. <tbody>
  12. <tr>
  13. <td class="doc-label">研发项目名称</td>
  14. <td class="doc-input">
  15. <project-select v-show="!isPrintPage" v-model="params.xmId" @change="handleProjectChange"></project-select>
  16. <span v-show="isPrintPage">{{ selProject.xmmc }}</span>
  17. </td>
  18. <td class="doc-label">研发项目编号</td>
  19. <td class="doc-input">{{ selProject.xmbh }}</td>
  20. </tr>
  21. <tr>
  22. <td colspan="4">
  23. <table class="child-table">
  24. <thead>
  25. <tr>
  26. <td width="10%">受托方全称</td>
  27. <td width="10%">受托方类型</td>
  28. <td width="10%">合同名称</td>
  29. <td width="10%">委外费用金额(万元)</td>
  30. <td width="8%">是否完成技术合同登记</td>
  31. <td width="8%">技术合同登记类型</td>
  32. <td width="8%">技术合同登记金额(万元)</td>
  33. <td width="31%">附件上传</td>
  34. <td v-show="!isPrintPage" width="5%" class="operate-col">操作</td>
  35. </tr>
  36. </thead>
  37. <tbody>
  38. <template v-if="list.length">
  39. <tr v-for="(item, index) of list" :key="index">
  40. <td v-for="key of colKey" :key="key" style="padding: 0;">
  41. <template v-if="key == 'fileTypeList'">
  42. <div class="file-list">
  43. <div class="file-list-item" v-for="(typeItem, typeIdx) of item[key]" :key="typeIdx">
  44. <div class="file-name">{{ typeItem.label }}</div>
  45. <div class="file-url" style="text-align: left; line-height: 16px;">
  46. <a
  47. v-for="(file, fileIdx) of typeItem.fileList"
  48. :key="fileIdx"
  49. style="display: block; margin: 0 4px; cursor: pointer; color: #409EFF; text-decoration: underline;"
  50. type="primary"
  51. @click="handleDownloadFile(file)"
  52. >
  53. {{ file.label }}
  54. </a>
  55. </div>
  56. </div>
  57. </div>
  58. </template>
  59. <span v-else>{{ item[key] }}</span>
  60. </td>
  61. <td class="operate-col" width="10%">
  62. <el-button type="text" class="printHide" @click="handleEditClick(item)">编辑</el-button>
  63. <el-button type="text" class="printHide" style="margin-left: 0;" @click="handleDel(item)">删除</el-button>
  64. </td>
  65. </tr>
  66. </template>
  67. <template v-else>
  68. <td colspan="9" style="border: none;"><el-empty description="暂无数据"></el-empty></td>
  69. </template>
  70. </tbody>
  71. </table>
  72. </td>
  73. </tr>
  74. </tbody>
  75. </table>
  76. <p class="tip printHide">注:可一次上传多个相关文件(文档、表格、图片等)。 支持格式:DOC, PDF, Excel, PNG, JPG, PPT 等。 请确保文件内容清晰有效。</p>
  77. <el-drawer
  78. :visible.sync="drawerVisible"
  79. :title="drawerTitle"
  80. modal-append-to-body
  81. append-to-body
  82. size="500px"
  83. destroy-on-close
  84. >
  85. <avue-form v-model="form" :option="option" @submit="handleSubmit" @reset-change="handleResetForm">
  86. </avue-form>
  87. </el-drawer>
  88. </div>
  89. </div>
  90. </template>
  91. <script>
  92. import yearMonthSelect from "@/components/year-month-select";
  93. import projectSelect from "@/components/project-select";
  94. import moment from "moment";
  95. import { getList, submit, remove } from "@/api/projectManage/outsourcingDoc";
  96. import { downloadFileByUrl } from "@/util/util";
  97. export default {
  98. props: {
  99. projectId: [String, Number]
  100. },
  101. components: {
  102. yearMonthSelect,
  103. projectSelect
  104. },
  105. data() {
  106. return {
  107. printBill: {
  108. el: '#printWrap',
  109. preview: true
  110. },
  111. loading: false,
  112. list: [],
  113. colKey: ['stfqc', 'stflx', 'htmc', 'wwfyje', 'sfwcjshtdj', 'jshtdjlx', 'jshtdjje', 'fileTypeList'],
  114. selProject: {},
  115. isPrintPage: false,
  116. printConfig: {
  117. el: '#outsourcingWrap', //被打印部分的id
  118. closeCallback: () => {
  119. this.isPrintPage = false;
  120. }
  121. },
  122. drawerTitle: '',
  123. drawerVisible: false,
  124. option:{
  125. labelWidth: 170,
  126. emptyText: "取消",
  127. column:[
  128. {
  129. label: '受托方全称',
  130. prop: 'stfqc',
  131. span: 24,
  132. rules: [{
  133. required: true,
  134. message: "请输入受托方全称",
  135. trigger: "blur"
  136. }]
  137. },
  138. {
  139. label: '受托方类型',
  140. prop: 'stflx',
  141. span: 24,
  142. type: 'select',
  143. dicUrl: '/api/kd-system/dict/dictionary?code=trustee_type',
  144. props: {
  145. label: 'dictValue',
  146. value: 'dictKey',
  147. },
  148. rules: [{
  149. required: true,
  150. message: "请选择受托方类型",
  151. trigger: "blur"
  152. }]
  153. },
  154. {
  155. label: '合同名称',
  156. prop: 'htmc',
  157. span: 24
  158. },
  159. {
  160. label: '委外费用金额(万元)',
  161. prop: 'wwfyje',
  162. span: 24,
  163. type: 'number',
  164. min: 0,
  165. precision: 2,
  166. },
  167. {
  168. label: '是否完成技术合同登记',
  169. prop: 'sfwcjshtdj',
  170. span: 24,
  171. type: 'select',
  172. dicUrl: '/api/kd-system/dict/dictionary?code=yes_or_no',
  173. props: {
  174. label: 'dictValue',
  175. value: 'dictKey',
  176. },
  177. rules: [{
  178. required: true,
  179. message: "请选择",
  180. trigger: "blur"
  181. }]
  182. },
  183. {
  184. label: '技术合同类型',
  185. prop: 'jshtdjlx',
  186. span: 24,
  187. type: 'select',
  188. dicUrl: '/api/kd-system/dict/dictionary?code=contract_registration_type',
  189. props: {
  190. label: 'dictValue',
  191. value: 'dictKey',
  192. },
  193. },
  194. {
  195. label: '技术合同登记金额(万元)',
  196. prop: 'jshtdjje',
  197. span: 24,
  198. type: 'number',
  199. min: 0,
  200. precision: 2,
  201. },
  202. {
  203. label: "技术合同协议",
  204. prop: "jshtxy",
  205. type: "upload",
  206. multiple: true,
  207. span: 24,
  208. dataType: "object",
  209. propsHttp: {
  210. url: "link",
  211. name: "originalName",
  212. res: "data",
  213. },
  214. action: '/api/kd-resource/oss/endpoint/put-file',
  215. uploadPreview: (file, column, done) => {
  216. downloadFileByUrl(file.url, file.name);
  217. return;
  218. },
  219. },
  220. {
  221. label: "委外费用发票",
  222. prop: "wwfyfp",
  223. type: "upload",
  224. multiple: true,
  225. span: 24,
  226. dataType: "object",
  227. propsHttp: {
  228. url: "link",
  229. name: "originalName",
  230. res: "data",
  231. },
  232. action: '/api/kd-resource/oss/endpoint/put-file',
  233. uploadPreview: (file, column, done) => {
  234. downloadFileByUrl(file.url, file.name);
  235. return;
  236. },
  237. },
  238. {
  239. label: "技术合同登记证明",
  240. prop: "jshtdjzm",
  241. type: "upload",
  242. multiple: true,
  243. span: 24,
  244. dataType: "object",
  245. propsHttp: {
  246. url: "link",
  247. name: "originalName",
  248. res: "data",
  249. },
  250. action: '/api/kd-resource/oss/endpoint/put-file',
  251. uploadPreview: (file, column, done) => {
  252. downloadFileByUrl(file.url, file.name);
  253. return;
  254. },
  255. },
  256. {
  257. label: "受托方交付成果",
  258. prop: "stfjfcg",
  259. type: "upload",
  260. multiple: true,
  261. span: 24,
  262. dataType: "object",
  263. propsHttp: {
  264. url: "link",
  265. name: "originalName",
  266. res: "data",
  267. },
  268. action: '/api/kd-resource/oss/endpoint/put-file',
  269. uploadPreview: (file, column, done) => {
  270. downloadFileByUrl(file.url, file.name);
  271. return;
  272. },
  273. },
  274. {
  275. label: "其他资料",
  276. prop: "qtzl",
  277. type: "upload",
  278. multiple: true,
  279. span: 24,
  280. dataType: "object",
  281. propsHttp: {
  282. url: "link",
  283. name: "originalName",
  284. res: "data",
  285. },
  286. action: '/api/kd-resource/oss/endpoint/put-file',
  287. uploadPreview: (file, column, done) => {
  288. downloadFileByUrl(file.url, file.name);
  289. return;
  290. },
  291. },
  292. ]
  293. },
  294. form: {},
  295. params: {
  296. yearAndMonth: moment(new Date()).format('yyyy'),
  297. xmId: ''
  298. },
  299. };
  300. },
  301. watch: {
  302. "params.xmId"() {
  303. this.getListData();
  304. },
  305. "params.yearAndMonth"() {
  306. this.getListData();
  307. },
  308. },
  309. mounted() {
  310. this.params.xmId = this.projectId;
  311. },
  312. methods: {
  313. handleProjectChange(data) {
  314. this.selProject = data;
  315. },
  316. getListData() {
  317. if (!this.params.xmId || !this.params.yearAndMonth) {
  318. return;
  319. }
  320. this.loading = true;
  321. getList(1, 99999, this.params).then(({ data }) => {
  322. this.loading = false;
  323. if (data.code == 200) {
  324. this.list = data.data.records.map(item => {
  325. item.wwfyje = (item.wwfyje || 0).toFixed(2);
  326. item.jshtdjje = (item.jshtdjje || 0).toFixed(2);
  327. item.jshtxy = item.jshtxy ? JSON.parse(item.jshtxy) : [];
  328. item.wwfyfp = item.wwfyfp ? JSON.parse(item.wwfyfp) : [];
  329. item.jshtdjzm = item.jshtdjzm ? JSON.parse(item.jshtdjzm) : [];
  330. item.stfjfcg = item.stfjfcg ? JSON.parse(item.stfjfcg) : [];
  331. item.qtzl = item.qtzl ? JSON.parse(item.qtzl) : [];
  332. item.fileTypeList = [{
  333. label: '技术合同协议',
  334. fileList: item.jshtxy
  335. }, {
  336. label: '委外费用发票',
  337. fileList: item.wwfyfp
  338. }, {
  339. label: '技术合同登记证明',
  340. fileList: item.jshtdjzm
  341. }, {
  342. label: '受托方交付成果',
  343. fileList: item.stfjfcg
  344. }, {
  345. label: '其他资料',
  346. fileList: item.qtzl
  347. }];
  348. return item;
  349. });
  350. }
  351. }).catch(() => {
  352. this.loading = false;
  353. });
  354. },
  355. handleAddClick() {
  356. if (!this.params.xmId) {
  357. this.$message.error("请选择所属项目!");
  358. return;
  359. }
  360. this.form = {};
  361. this.drawerVisible = true;
  362. this.drawerTitle = '新增委外信息';
  363. },
  364. handleEditClick(data) {
  365. this.drawerVisible = true;
  366. this.form = { ...data };
  367. this.drawerTitle = '编辑委外信息';
  368. },
  369. handleSubmit(form, done) {
  370. const params = { ...form, yearAndMonth: this.params.yearAndMonth, xmId: this.params.xmId };
  371. params.jshtxy = JSON.stringify(params.jshtxy);
  372. params.wwfyfp = JSON.stringify(params.wwfyfp);
  373. params.jshtdjzm = JSON.stringify(params.jshtdjzm);
  374. params.stfjfcg = JSON.stringify(params.stfjfcg);
  375. params.qtzl = JSON.stringify(params.qtzl);
  376. submit(params).then(({ data }) => {
  377. if (data.code == 200) {
  378. this.$message.success("操作成功!");
  379. this.getListData();
  380. this.drawerVisible = false;
  381. }
  382. done();
  383. }).catch(() => {
  384. done();
  385. });
  386. },
  387. handleDownloadFile(file) {
  388. downloadFileByUrl(file.value, file.label);
  389. },
  390. handleResetForm() {
  391. this.drawerVisible = false;
  392. },
  393. handleDel(records) {
  394. this.$confirm('确定将选择数据删除?', '提示', {
  395. confirmButtonText: '确定',
  396. cancelButtonText: '取消',
  397. type: 'warning'
  398. }).then(() => {
  399. remove(records.id).then(({ data }) => {
  400. if (data.code == 200) {
  401. this.$message.success("删除成功!");
  402. this.getListData();
  403. }
  404. });
  405. })
  406. }
  407. },
  408. };
  409. </script>
  410. <style lang="scss" scoped>
  411. .page-title {
  412. text-align: center;
  413. font-size: 24px;
  414. padding: 24px 0 20px;
  415. margin: 0;
  416. }
  417. @media print {
  418. .doc-page {
  419. zoom: 60%;
  420. }
  421. }
  422. .doc-page {
  423. width: 1200px;
  424. height: auto;
  425. margin: 0 auto;
  426. }
  427. .header-btn {
  428. width: 1200px;
  429. margin: 0 auto;
  430. text-align: right;
  431. }
  432. .doc-table {
  433. width: 100%;
  434. border: 1px solid #333;
  435. }
  436. .doc-label {
  437. text-align: center;
  438. padding: 6px;
  439. color: #777;
  440. font-size: 14px;
  441. width: 15%;
  442. }
  443. .doc-input {
  444. text-align: center;
  445. color: #333;
  446. width: 35%;
  447. }
  448. .doc-table {
  449. padding: 0;
  450. }
  451. .doc-table tr td {
  452. border: 1px solid #333;
  453. }
  454. .child-table {
  455. border: none;
  456. }
  457. .child-table tr {
  458. td {
  459. border: none;
  460. border-right: 1px solid #333;
  461. padding: 0 6px;
  462. text-align: center;
  463. color: #666;
  464. font-size: 14px;
  465. &:last-child {
  466. border: none;
  467. }
  468. }
  469. }
  470. .child-table thead tr {
  471. border-bottom: 1px solid #333;
  472. }
  473. .child-table tbody tr {
  474. border-bottom: 1px solid #333;
  475. &:last-child {
  476. border-bottom: 0;
  477. }
  478. }
  479. .file-list {
  480. &-item {
  481. display: flex;
  482. border-bottom: 1px solid #333;
  483. line-height: 32px;
  484. text-align: center;
  485. word-wrap: break-word;
  486. // align-items: center;
  487. .file-name {
  488. width: 40%;
  489. border-right: 1px solid #333;
  490. }
  491. .file-url {
  492. width: 60%;
  493. }
  494. &:last-child {
  495. border-bottom: 0;
  496. }
  497. }
  498. }
  499. .tip {
  500. color: red;
  501. margin-top: 12px;
  502. font-size: 12px;
  503. }
  504. </style>