detailContract.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :inline="true"
  5. ref="form"
  6. :model="form"
  7. :rules="rules"
  8. label-width="auto"
  9. style="margin-top: 20px"
  10. disabled
  11. >
  12. <el-divider content-position="left">基本信息</el-divider>
  13. <!-- <el-form-item label="融资产品编号" prop="zfpNumber">
  14. <el-input v-model="form.zfpNumber" placeholder="请输入融资产品编号" />
  15. </el-form-item> -->
  16. <el-row>
  17. <el-col :span="8">
  18. <el-form-item
  19. label="合同模板名称:"
  20. prop="zfcName"
  21. >
  22. <el-input
  23. v-model="form.zfcName"
  24. placeholder="请输入合同模板名称"
  25. /> </el-form-item
  26. ></el-col>
  27. <el-col :span="8"
  28. ><el-form-item
  29. label="合同类型:"
  30. prop="zfcType"
  31. >
  32. <el-select
  33. v-model="form.zfcType"
  34. placeholder="请选择合同类型"
  35. clearable
  36. size="small"
  37. >
  38. <el-option
  39. v-for="dict in typeOptions"
  40. :key="dict.dictValue"
  41. :label="dict.dictLabel"
  42. :value="dict.dictValue"
  43. />
  44. </el-select> </el-form-item
  45. ></el-col>
  46. <el-col :span="8">
  47. <el-form-item
  48. label="资金方:"
  49. prop="zfcManagementId"
  50. >
  51. <el-select
  52. style="width: 95%"
  53. v-model="form.zfcManagementId"
  54. placeholder="请选择资金方"
  55. clearable
  56. size="small"
  57. >
  58. <el-option
  59. v-for="(item, index) in companyList"
  60. :key="index"
  61. :label="item.scyName"
  62. :value="item.scyId"
  63. />
  64. </el-select> </el-form-item
  65. ></el-col>
  66. </el-row>
  67. <el-row>
  68. <el-form-item style="margin-left: 100px" >
  69. <el-table ref="tableContract" :data="nodeList" @selection-change="handleSelectionChange" style="width: 500px" >
  70. <el-table-column
  71. type="selection"
  72. width="50"
  73. align="center"/>
  74. <el-table-column label="签署节点" align="center" prop="zfcNode" :show-overflow-tooltip="true" >
  75. </el-table-column>
  76. <el-table-column label="盖章关键字" align="center" prop="zfcSignKeyword" :show-overflow-tooltip="true">
  77. <template slot-scope="scope">
  78. <el-input
  79. v-model="scope.row.zfcSignKeyword"
  80. size="small"
  81. maxlength="200"
  82. ></el-input>
  83. </template>
  84. </el-table-column>
  85. </el-table>
  86. </el-form-item
  87. >
  88. <!-- <el-col :span="8">
  89. <el-form-item
  90. label="签署主体:"
  91. prop="zfcSubject"
  92. >
  93. <el-select
  94. v-model="form.zfcSubject"
  95. placeholder="请选择签署主体"
  96. clearable
  97. size="small"
  98. >
  99. <el-option
  100. v-for="dict in subjectOptions"
  101. :key="dict.dictValue"
  102. :label="dict.dictLabel"
  103. :value="dict.dictValue"
  104. />
  105. </el-select> </el-form-item
  106. ></el-col>
  107. <el-col :span="8">
  108. <el-form-item
  109. label="签署节点:"
  110. prop="zfcNode"
  111. >
  112. <el-select
  113. v-model="form.zfcNode"
  114. placeholder="请选择签署节点"
  115. clearable
  116. size="small"
  117. >
  118. <el-option
  119. v-for="dict in nodeOptions"
  120. :key="dict.dictValue"
  121. :label="dict.dictLabel"
  122. :value="dict.dictValue"
  123. />
  124. </el-select> </el-form-item
  125. ></el-col> -->
  126. </el-row>
  127. <el-row>
  128. <el-col :span="16">
  129. <el-form-item
  130. label="合同描述:"
  131. prop="zfcDesc"
  132. >
  133. <el-input
  134. type="textarea"
  135. maxlength="100"
  136. style="width:250%"
  137. show-word-limit
  138. v-model="form.zfcDesc"
  139. placeholder="请输入合同描述"
  140. /> </el-form-item
  141. ></el-col>
  142. </el-row>
  143. <!-- 合同模板文件 -->
  144. <el-divider content-position="left">合同模板文件</el-divider>
  145. <el-form-item label="合同模板文件" style="margin-left: 100px">
  146. <el-upload
  147. ref="upload"
  148. class="upload-demo"
  149. action=""
  150. :http-request="httpRequest"
  151. :before-remove="beforeRemove"
  152. :on-preview="handleFileDownload"
  153. accept=".doc,.docx"
  154. multiple
  155. :limit="1"
  156. :on-exceed="handleExceed"
  157. :file-list="fileList"
  158. :auto-upload="false"
  159. style="width:800px"
  160. >
  161. <!-- <el-button slot="trigger" size="small" type="primary"
  162. >点击选择</el-button
  163. >
  164. <el-button
  165. style="margin-left: 10px"
  166. size="small"
  167. type="success"
  168. @click="submitUpload"
  169. >上传到服务器</el-button
  170. > -->
  171. </el-upload>
  172. </el-form-item>
  173. </el-form>
  174. <!-- 保存 -->
  175. <div class="footer" style="margin-top: 100px; float: right">
  176. <el-button type="info" @click="cancel">取消</el-button>
  177. <!-- <el-button type="success" @click="submitForm">提交</el-button> -->
  178. </div>
  179. </div>
  180. </template>
  181. <script>
  182. import { getContract,updateContract } from "@/api/service/contract/contract";
  183. import { listCompany } from "@/api/common/company";
  184. import { uploadFileNew } from "@/api/common/file";
  185. import { getToken } from "@/utils/auth";
  186. export default {
  187. name: "detailContract",
  188. components: {},
  189. data() {
  190. return {
  191. disabled: false,
  192. // 日期范围
  193. dateRange: [],
  194. //选中数据
  195. chooseList: [],
  196. // 选中数组
  197. ids: [],
  198. // 弹出层标题
  199. title: "",
  200. // 总条数
  201. total: 0,
  202. // 是否显示弹出层
  203. open: false,
  204. // 资方列表
  205. companyList: [],
  206. //附件地址
  207. fileList:[],
  208. //数据字典
  209. typeOptions: [],
  210. subjectOptions: [],
  211. nodeOptions: [],
  212. nodeList:[],
  213. // 表单参数
  214. form: {},
  215. queryParams: {
  216. pageNum: 1,
  217. pageSize: 10,
  218. },
  219. options: [],
  220. value: [],
  221. loading: false,
  222. // 表单校验
  223. rules: {
  224. zfcName: [
  225. {
  226. required: true,
  227. message: "合同模板名称",
  228. trigger: ["blur", "change"],
  229. },
  230. ],
  231. zfcManagementId: [
  232. {
  233. required: true,
  234. message: "资金方不能为空",
  235. trigger: ["blur", "change"],
  236. },
  237. ],
  238. zfcType: [
  239. {
  240. required: true,
  241. message: "合同类型",
  242. trigger: ["blur", "change"],
  243. },
  244. ],
  245. zfcSubject: [
  246. {
  247. required: true,
  248. message: "签署主体",
  249. trigger: ["blur", "change"],
  250. },
  251. ],
  252. },
  253. };
  254. },
  255. created() {
  256. const zfcId = this.$route.params && this.$route.params.zfcId;
  257. this.reset();
  258. this.getCompanyList();
  259. //this.getList();
  260. this.getDicts("zc_zfc_type").then((response) => {
  261. this.typeOptions = response.data;
  262. });
  263. this.getDicts("zc_zfc_subject").then((response) => {
  264. this.subjectOptions = response.data;
  265. });
  266. getContract(zfcId).then((response) =>{
  267. this.form = response.data.zcFinanceContract;
  268. this.form.createTime = this.parseTime(new Date(response.data.zcFinanceContract.createTime),'{y}-{m}-{d} {h}:{m}:{s}');
  269. var zfcCode = this.form.zfcNode.split(",")
  270. var signKeyword = this.form.zfcSignKeyword.split(",")
  271. for(var i=0;i<zfcCode.length;i++){
  272. this.chooseList.push({zfcCode:zfcCode[i],zfcSignKeyword:signKeyword[i]});
  273. }
  274. this.getDicts("zc_zfc_node").then((response) => {
  275. this.nodeOptions = response.data;
  276. for(let i=0;i<this.nodeOptions.length;i++){
  277. var k = 0;
  278. for(let j=0;j<this.chooseList.length;j++){
  279. if(this.nodeOptions[i].dictValue == this.chooseList[j].zfcCode){
  280. this.nodeList.push({zfcNode:this.nodeOptions[i].dictLabel,zfcCode:this.nodeOptions[i].dictValue,zfcSignKeyword:this.chooseList[j].zfcSignKeyword})
  281. k =1;
  282. }
  283. }
  284. if(k != 1){
  285. this.nodeList.push({zfcNode:this.nodeOptions[i].dictLabel,zfcCode:this.nodeOptions[i].dictValue,zfcSignKeyword:''})
  286. }
  287. }
  288. }).then(()=>{
  289. console.log(this.nodeList,"<=========")
  290. this.chooseList.forEach((item) => {
  291. this.nodeList.forEach((row) => {
  292. if (row.zfcCode == item.zfcCode) {
  293. this.$nextTick(() => {
  294. this.$refs.tableContract &&
  295. this.$refs.tableContract.toggleRowSelection(row, true);
  296. });
  297. }
  298. });
  299. });
  300. });
  301. this.userName = response.data.nickName;
  302. const pfiFileName = response.data.fileName;
  303. const fileUrl = response.data.fileUrl;
  304. const fileId = response.data.fileId;
  305. if (fileUrl && fileId && pfiFileName != null){
  306. this.fileList.push({name:pfiFileName, url: fileUrl, uid: fileId });
  307. }
  308. var state = this.form.zfpStatus;
  309. if(state == '01'){
  310. this.disabled = true ;
  311. }
  312. const type = "03";
  313. const zfcManagementId = this.form.zfcManagementId;
  314. listCompany(type,zfcManagementId).then(response =>{
  315. this.companyList = response.data;
  316. })
  317. });
  318. },
  319. activated() {
  320. this.reset();
  321. //this.getList();
  322. },
  323. methods: {
  324. /** 查询资方 */
  325. getCompanyList(){
  326. const type = "03";
  327. listCompany(type).then(response =>{
  328. this.companyList = response.data;
  329. })
  330. },
  331. reset(){
  332. this.form = {
  333. };
  334. this.resetForm("form");
  335. },
  336. // 取消按钮
  337. cancel() {
  338. this.reset();
  339. this.$store.dispatch("tagsView/delView", this.$route);
  340. this.$router.go(-1);
  341. this.open = false;
  342. },
  343. // 多选框选中数据
  344. handleSelectionChange(val) {
  345. this.chooseList = val;
  346. },
  347. /** 上传图片 */
  348. submitUpload() {
  349. this.$refs.upload.submit();
  350. },
  351. //文件移除提示
  352. beforeRemove(file, fileList) {
  353. // return this.$confirm(`确定移除 ${file.name}?`);
  354. for(let i = 0;i< this.fileList.length;i++){
  355. if(file.uid == this.fileList[i].uid){
  356. this.fileList.splice(i, 1);
  357. break;
  358. }
  359. }
  360. },
  361. handleExceed(files, fileList) {
  362. this.$message.warning(`当前限制选择 1 个文件`);
  363. },
  364. //手动上传文件触发
  365. httpRequest(param) {
  366. let fileObj = param.file; // 相当于input里取得的files
  367. let fd = new FormData(); // FormData 对象
  368. fd.append("file", fileObj); // 文件对象
  369. fd.append("fileType", "04"); // 类型:文件
  370. const loading = this.$loading({
  371. lock: true,
  372. text: "Loading",
  373. spinner: "el-icon-loading",
  374. background: "rgba(0, 0, 0, 0.7)",
  375. });
  376. uploadFileNew(fd).then((response) => {
  377. if (response) {
  378. this.fileList.push({name:response.fileName,uid : response.fileId,url:response.url+'/'+getToken()})
  379. this.msgSuccess("上传成功");
  380. loading.close();
  381. }
  382. }).catch((response) =>{
  383. if(!response){
  384. this.$message.warning(`上传失败`);
  385. }
  386. loading.close();
  387. });
  388. },
  389. /* 下载 */
  390. handleFileDownload(sfcFile){
  391. this.$confirm('是否确认下载'+sfcFile.name+'附件?', "警告", {
  392. confirmButtonText: '确定',
  393. cancelButtonText: '取消',
  394. type: "warning"
  395. }).then(function() {
  396. if(sfcFile.name.substr(-3) == "pdf"){
  397. if(sfcFile.url.indexOf("getPdf") != -1){
  398. sfcFile.url = sfcFile.url.replace("getPdf","getBytes");
  399. }
  400. window.open(sfcFile.url+'/'+getToken());
  401. }else{
  402. var a = document.createElement('a');
  403. var event = new MouseEvent('click');
  404. a.download = sfcFile.name;
  405. a.href = sfcFile.url+'/'+getToken();
  406. a.dispatchEvent(event);
  407. }
  408. })
  409. },
  410. /** 保存按钮 */
  411. submitForm() {
  412. this.$refs["form"].validate((valid) => {
  413. this.form.nodeList = this.chooseList;
  414. if(!this.fileList.length){
  415. this.$message({
  416. message: '请上传附件!',
  417. type: 'warning'
  418. });
  419. return;
  420. };
  421. console.log(this.form)
  422. this.form.zfcFile = this.fileList;
  423. if (valid) {
  424. const loading = this.$loading({
  425. lock: true,
  426. text: "Loading",
  427. spinner: "el-icon-loading",
  428. background: "rgba(0, 0, 0, 0.7)",
  429. });
  430. updateContract(this.form)
  431. .then((response) => {
  432. loading.close();
  433. this.msgSuccess("修改成功");
  434. this.$store.dispatch("tagsView/delView", this.$route);
  435. this.$router.go(-1);
  436. })
  437. .catch((response) => {
  438. loading.close();
  439. });
  440. }
  441. });
  442. },
  443. // submitData() {
  444. // this.open = false;
  445. // },
  446. /* // 将数字金额转换为大写金额 */
  447. },
  448. };
  449. </script>
  450. <style>
  451. .single-select-table thead .el-table-column--selection .cell {
  452. display: none;
  453. }
  454. </style>