outsourcing-doc.vue 15 KB

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