addContract.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  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. >
  11. <el-divider content-position="left">基本信息</el-divider>
  12. <!-- <el-form-item label="融资产品编号" prop="zfpNumber">
  13. <el-input v-model="form.zfpNumber" placeholder="请输入融资产品编号" />
  14. </el-form-item> -->
  15. <el-row>
  16. <el-col :span="8">
  17. <el-form-item
  18. label="合同模板名称:"
  19. prop="zfcName"
  20. >
  21. <el-input
  22. v-model="form.zfcName"
  23. placeholder="请输入合同模板名称"
  24. maxlength="20"
  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 :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. accept=".doc,.docx"
  153. multiple
  154. :limit="1"
  155. :on-exceed="handleExceed"
  156. :file-list="fileList"
  157. :auto-upload="true"
  158. style="width:800px"
  159. >
  160. <el-button slot="trigger" size="small" type="primary"
  161. >点击选择</el-button
  162. >
  163. <!-- <el-button
  164. style="margin-left: 10px"
  165. size="small"
  166. type="success"
  167. @click="submitUpload"
  168. >上传到服务器</el-button
  169. >-->
  170. </el-upload>
  171. </el-form-item>
  172. </el-form>
  173. <!-- 保存 -->
  174. <div class="footer" style="margin-top: 260px; float: right">
  175. <el-button type="info" @click="cancel">取消</el-button>
  176. <el-button type="success" @click="submitForm">提交</el-button>
  177. </div>
  178. </div>
  179. </template>
  180. <script>
  181. import { addContract } from "@/api/service/contract/contract";
  182. import { listCompany } from "@/api/common/company";
  183. import { uploadFileNew } from "@/api/common/file";
  184. import { getToken } from "@/utils/auth";
  185. export default {
  186. name: "addContract",
  187. components: {},
  188. data() {
  189. return {
  190. nodeList:[],
  191. disabled: true,
  192. //选中数据
  193. chooseList: [],
  194. // 选中数组
  195. ids: [],
  196. //附件地址
  197. fileList:[],
  198. // 弹出层标题
  199. title: "",
  200. invoiceTitle: "",
  201. // 总条数
  202. total: 0,
  203. totalCustomer: 0,
  204. totalContract: 0,
  205. totalProject: 0,
  206. // 是否显示弹出层
  207. open: false,
  208. // 资方列表
  209. companyList: [],
  210. //合同列表
  211. contractList: [],
  212. content: [],
  213. //发票列表
  214. typeOptions: [],
  215. subjectOptions: [],
  216. nodeOptions: [],
  217. // 表单参数
  218. form: {},
  219. queryParams: {
  220. pageNum: 1,
  221. pageSize: 10,
  222. pifName: null,
  223. pifId: null,
  224. pifContractId: null,
  225. },
  226. queryParamsInvoice: {
  227. pageNum: 1,
  228. pageSize: 10,
  229. dateTime: [],
  230. pvfProjectId: null,
  231. pvfContractId: null,
  232. pidCode: null,
  233. pvfTYPE: null,
  234. pvfInvoiceTitle: null,
  235. },
  236. options: [],
  237. value: [],
  238. loading: false,
  239. // 表单校验
  240. rules: {
  241. zfcName: [
  242. {
  243. required: true,
  244. message: "合同模板名称",
  245. trigger: ["blur", "change"],
  246. },
  247. ],
  248. zfcManagementId: [
  249. {
  250. required: true,
  251. message: "资金方不能为空",
  252. trigger: ["blur", "change"],
  253. },
  254. ],
  255. zfcType: [
  256. {
  257. required: true,
  258. message: "合同类型",
  259. trigger: ["blur", "change"],
  260. },
  261. ],
  262. zfcSubject: [
  263. {
  264. required: true,
  265. message: "签署主体",
  266. trigger: ["blur", "change"],
  267. },
  268. ],
  269. },
  270. };
  271. },
  272. created() {
  273. this.reset();
  274. this.getCompanyList();
  275. this.getDicts("zc_zfc_type").then((response) => {
  276. this.typeOptions = response.data;
  277. });
  278. this.getDicts("zc_zfc_node").then((response) => {
  279. this.nodeOptions = response.data;
  280. for(let i=0;i<this.nodeOptions.length;i++){
  281. this.nodeList.push({zfcNode:this.nodeOptions[i].dictLabel,zfcCode:this.nodeOptions[i].dictValue})
  282. }
  283. console.log(this.nodeList);
  284. });
  285. this.getDicts("zc_zfc_subject").then((response) => {
  286. this.subjectOptions = response.data;
  287. });
  288. },
  289. activated() {
  290. this.reset();
  291. },
  292. methods: {
  293. // 上传
  294. /** 查询资方 */
  295. getCompanyList() {
  296. const type = "03";
  297. listCompany(type).then((response) => {
  298. this.companyList = response.data;
  299. });
  300. },
  301. change(val) {
  302. if (val <= 14) {
  303. this.$set(this.form, "zfpShortestPeriod", "14");
  304. }
  305. return;
  306. },
  307. // 多选框选中数据
  308. handleSelectionChange(val) {
  309. this.chooseList = val;
  310. },
  311. /** 上传图片 */
  312. submitUpload() {
  313. this.$refs.upload.submit();
  314. },
  315. //文件移除提示
  316. beforeRemove(file, fileList) {
  317. // return this.$confirm(`确定移除 ${file.name}?`);
  318. for(let i = 0;i< this.fileList.length;i++){
  319. if(file.uid == this.fileList[i].uid){
  320. this.fileList.splice(i, 1);
  321. break;
  322. }
  323. }
  324. },
  325. handleExceed(files, fileList) {
  326. this.$message.warning(`当前限制选择 1 个文件`);
  327. },
  328. //手动上传文件触发
  329. httpRequest(param) {
  330. let fileObj = param.file; // 相当于input里取得的files
  331. let fd = new FormData(); // FormData 对象
  332. fd.append("file", fileObj); // 文件对象
  333. fd.append("fileType", "04"); // 类型:文件
  334. const loading = this.$loading({
  335. lock: true,
  336. text: "Loading",
  337. spinner: "el-icon-loading",
  338. background: "rgba(0, 0, 0, 0.7)",
  339. });
  340. uploadFileNew(fd).then((response) => {
  341. if (response) {
  342. this.fileList.push({name:response.fileName,uid : response.fileId,url:response.url+'/'+getToken()})
  343. this.msgSuccess("上传成功");
  344. loading.close();
  345. }
  346. }).catch((response) =>{
  347. if(!response){
  348. this.$message.warning(`上传失败`);
  349. }
  350. loading.close();
  351. });
  352. },
  353. // 多选框选中数据
  354. handleCurrentChange(val) {
  355. // this.currentRow = val;
  356. // this.open = false;
  357. },
  358. reset() {
  359. this.form = {
  360. };
  361. this.resetForm("form");
  362. },
  363. /* ---------------------------------------------------------------------- */
  364. // 取消按钮
  365. cancel() {
  366. this.reset();
  367. this.$store.dispatch("tagsView/delView", this.$route);
  368. this.$router.go(-1);
  369. this.open = false;
  370. },
  371. /** 保存按钮 */
  372. submitForm() {
  373. this.$refs["form"].validate((valid) => {
  374. this.form.nodeList = this.chooseList;
  375. if(!this.fileList.length){
  376. this.$message({
  377. message: '请上传附件!',
  378. type: 'warning'
  379. });
  380. return;
  381. };
  382. this.form.zfcFile = this.fileList;
  383. console.log(this.form);
  384. if (valid) {
  385. const loading = this.$loading({
  386. lock: true,
  387. text: "Loading",
  388. spinner: "el-icon-loading",
  389. background: "rgba(0, 0, 0, 0.7)",
  390. });
  391. addContract(this.form)
  392. .then((response) => {
  393. loading.close();
  394. this.msgSuccess("新增成功");
  395. this.$store.dispatch("tagsView/delView", this.$route);
  396. this.$router.go(-1);
  397. })
  398. .catch((response) => {
  399. loading.close();
  400. });
  401. }
  402. });
  403. },
  404. // submitData() {
  405. // this.open = false;
  406. // },
  407. /* // 将数字金额转换为大写金额 */
  408. },
  409. };
  410. </script>
  411. <style>
  412. .single-select-table thead .el-table-column--selection .cell {
  413. display: none;
  414. }
  415. </style>