detailContract.vue 14 KB

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