outsourcing-doc.vue 14 KB

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