addList.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. <template>
  2. <basic-container class="addList">
  3. <el-form
  4. ref="form"
  5. :model="form"
  6. :rules="rules"
  7. label-width="170px"
  8. :inline="true"
  9. >
  10. <el-form-item
  11. label="证书类型"
  12. prop="certificateType"
  13. style="width:45%;"
  14. >
  15. <el-radio-group v-model="form.certificateType" @change="changeCertificateType">
  16. <el-radio :label="1">个人证书</el-radio>
  17. <el-radio :label="2">企业证书</el-radio>
  18. </el-radio-group>
  19. </el-form-item>
  20. <el-form-item
  21. label="签字公司"
  22. prop="company"
  23. style="width:45%;"
  24. v-if="form.certificateType===2"
  25. >
  26. <el-select
  27. v-model="form.company"
  28. placeholder="请选择"
  29. style="width: 400px;"
  30. clearable
  31. @visible-change="changeCompany"
  32. >
  33. <el-option
  34. v-for="item in options"
  35. :key="item.id"
  36. :label="item.dictValue"
  37. :value="item.dictKey"
  38. ></el-option>
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item
  42. label="证书所有者"
  43. prop="certificateUserName"
  44. style="width:45%;"
  45. >
  46. <el-input
  47. v-model="form.certificateUserName"
  48. style="width:400px;"
  49. placeholder="请输入内容"
  50. ></el-input>
  51. </el-form-item>
  52. <el-form-item
  53. label="所持证书者身份证ID"
  54. prop="certificateId"
  55. v-if="form.certificateType==1&&form.company!=3"
  56. style="width:45%;"
  57. >
  58. <el-input
  59. v-model="form.certificateId"
  60. style="width:400px;"
  61. placeholder="请输入内容"
  62. ></el-input>
  63. </el-form-item>
  64. <el-form-item
  65. label="企业统一社会信用代码"
  66. style="width:45%;"
  67. prop="enterpriseUnifiedCode"
  68. v-if="form.certificateType!==1&&form.company!=3"
  69. >
  70. <el-input
  71. v-model="form.enterpriseUnifiedCode"
  72. style="width:400px;"
  73. placeholder="请输入内容"
  74. ></el-input>
  75. </el-form-item>
  76. <el-form-item
  77. label="证书编号"
  78. prop="certificateNumber"
  79. style="width:45%;"
  80. >
  81. <el-input
  82. v-model="form.certificateNumber"
  83. style="width:400px;"
  84. placeholder="请输入内容"
  85. ></el-input>
  86. </el-form-item>
  87. <el-form-item
  88. label="证书密码"
  89. prop="certificatePassword"
  90. style="width:45%;"
  91. v-if="form.company!=3"
  92. >
  93. <el-input
  94. v-model="form.certificatePassword"
  95. style="width:400px;"
  96. placeholder="请输入内容"
  97. ></el-input>
  98. </el-form-item>
  99. <el-form-item
  100. label="签章类型"
  101. style="width:45%;"
  102. prop="pfxType"
  103. >
  104. <el-select
  105. v-model="form.pfxType"
  106. style="width:400px;"
  107. placeholder="请选择"
  108. >
  109. <el-option
  110. v-for="item in pfxType"
  111. :key="item.dictKey"
  112. :label="item.dictValue"
  113. :value="item.dictKey"
  114. >
  115. </el-option>
  116. </el-select>
  117. </el-form-item>
  118. <el-form-item
  119. label="关联用户"
  120. style="width:45%;"
  121. prop="certificateUserId"
  122. v-if="form.certificateType==1"
  123. >
  124. <el-select
  125. filterable
  126. v-model="form.certificateUserId"
  127. style="width:400px;"
  128. placeholder="请选择"
  129. @change="selectUser"
  130. >
  131. <el-option
  132. v-for="item in userData"
  133. :key="item.id"
  134. :label="item.name"
  135. :value="item.id"
  136. >
  137. </el-option>
  138. </el-select>
  139. </el-form-item>
  140. <el-form-item
  141. label="证书文件"
  142. style="width:100%;"
  143. prop="certificateFileUrl"
  144. v-if="form.company!=3"
  145. >
  146. <el-upload
  147. class="upload-demo" action="#" multiple :limit="1" :auto-upload="false" accept='.pfx'
  148. :file-list="form.certificateFileUrl" :before-remove="beforeRemove" :on-change="changecertificateFileUrl"
  149. >
  150. <el-button size="small" type="primary">上传文件</el-button>
  151. <div slot="tip" class="el-upload__tip">支持上传文件格式为pfx文件</div>
  152. </el-upload>
  153. </el-form-item>
  154. <el-form-item label="签名体图片" style="width:100%;" prop="signatureFileUrl" v-if="form.company!=3">
  155. <el-upload
  156. class="upload-demo" action="#" multiple :limit="1" :auto-upload="false" accept='.jpg,.png'
  157. :file-list="form.signatureFileUrl" :before-remove="beforeRemove2" :on-change="changecertificateFileUrl2"
  158. >
  159. <div style="position: relative; display: flex; align-items: center;">
  160. <el-button size="small" type="primary">上传文件</el-button>
  161. <div style="position: relative; display: flex;align-items: center; color: #1A1A1A; cursor: default;" @click.stop="stopClick">
  162. <el-input v-model="form.wide" style="width:60px; margin-left: 24px;" placeholder="宽度" size="small" :disabled="form.signatureFileUrl.length<=0"></el-input>
  163. <div style="display: inline-block; margin-left: 8px;">x</div>
  164. <el-input v-model="form.high" style="width:60px; margin-left: 8px;" placeholder="高度" size="small" :disabled="form.signatureFileUrl.length<=0"></el-input>
  165. <el-button size="small" type="warning" style="margin-left: 12px" :disabled="form.signatureFileUrl.length <= 0 " @click.stop="signaturePreview">预览</el-button>
  166. </div>
  167. </div>
  168. <div
  169. slot="tip"
  170. class="el-upload__tip"
  171. >支持上传文件格式为JPG/PNG</div>
  172. </el-upload>
  173. </el-form-item>
  174. <el-form-item
  175. label="关联项目"
  176. tyle="width:100%;"
  177. prop="signPfxDeputieList"
  178. v-if="form.certificateType==2"
  179. >
  180. <i
  181. class="el-icon-circle-plus"
  182. style="color:red;font-size:24px;line-height:40px;cursor: pointer;"
  183. @click="pushSignPfxDeputieList"
  184. ></i>
  185. <div
  186. v-for="(item,key) in form.signPfxDeputieList"
  187. :key='key'
  188. >
  189. <!-- 项目 -->
  190. <el-select
  191. style="width:300px;"
  192. class="martop20"
  193. v-model="form.signPfxDeputieList[key].projectId"
  194. placeholder="请选择"
  195. @change="changeProjectId(key)"
  196. >
  197. <el-option
  198. v-for="item in projectMeiju"
  199. :key="item.id"
  200. :label="item.name"
  201. :value="item.id"
  202. >
  203. </el-option>
  204. </el-select>
  205. <!-- 合同段 -->
  206. <el-select
  207. style="width:300px;"
  208. class="marleft20 martop20"
  209. @focus="focusContractSection(form.signPfxDeputieList[key].projectId,key)"
  210. :disabled='!form.signPfxDeputieList[key].projectId'
  211. v-model="form.signPfxDeputieList[key].contractId"
  212. placeholder="请选择"
  213. @change="checkRoleRepeat(key)"
  214. >
  215. <el-option
  216. v-for="item in form.signPfxDeputieList[key].contractList"
  217. :key="item.id"
  218. :label="item.name"
  219. :value="item.id"
  220. >
  221. </el-option>
  222. </el-select>
  223. <el-select
  224. class="marleft20 martop20"
  225. style="width:300px;"
  226. v-model="form.signPfxDeputieList[key].roleId"
  227. placeholder="请选择参建方"
  228. @change="checkRoleRepeat(key)"
  229. >
  230. <el-option
  231. v-for="item in ParticipationConstruction"
  232. :key="item.id"
  233. :label="item.roleName"
  234. :value="item.id"
  235. >
  236. </el-option>
  237. </el-select>
  238. <i
  239. class="el-icon-error marleft10"
  240. @click="deleteSignPfxDeputie(key)"
  241. style="fontSize:20px;color:#F0630A;cursor: pointer;"
  242. ></i>
  243. </div>
  244. <!-- signPfxDeputieList -->
  245. </el-form-item>
  246. </el-form>
  247. <div class="flexCenter">
  248. <el-button @click="cancel">取消</el-button>
  249. <el-button
  250. class="marleft30"
  251. type="primary"
  252. v-throttle='2000'
  253. @click="savess()"
  254. >保存</el-button>
  255. </div>
  256. </basic-container>
  257. </template>
  258. <script>
  259. import { save, getById, findUserByName, queryRole, queryProjectAndContract, addFileInfo, update, findPfxType, picPresave, prePicture, compressAndUpload } from "@/api/certificate/list";
  260. import {getDictionary as getDictbiz} from "@/api/system/dictbiz";
  261. export default {
  262. data () {
  263. return {
  264. form: {
  265. certificateType: 1,
  266. certificateUserName: '',
  267. certificateId: '',//所持证书者身份证ID
  268. enterpriseUnifiedCode: '',//企业统一社会信用代码
  269. certificateNumber: '',
  270. certificatePassword: '123456',
  271. certificateUserId: '',
  272. pfxType: '',
  273. certificateFileUrl: [],//证书文件
  274. certificateFileName: '',//证书文件名称
  275. signatureFileUrl: [],//签名体图片
  276. signatureFileName: '',//签名体图片文件名称
  277. signPfxDeputieList: [],
  278. company:2,
  279. wide: '',
  280. high: ''
  281. },
  282. rules: {
  283. company:[{ required: false, message: '请选择', trigger: 'change' }],
  284. certificateType: [{ required: true, message: '请选择', trigger: 'change' }],
  285. certificateUserName: [{ required: true, message: '请输入证书所有者', trigger: 'blur' }],
  286. certificateId: [{ required: true, message: '请输入所持证书者身份ID', trigger: 'blur' }],
  287. enterpriseUnifiedCode: [{ required: true, message: '请输入企业统一社会信用代码', trigger: 'blur' }],
  288. // certificateNumber: [{ required: true, message: '请输入证书编号', trigger: 'blur' }],
  289. certificateNumber:[],
  290. certificatePassword: [{ required: true, message: '请输入证书密码', trigger: 'blur' }],
  291. certificateUserId: [{ required: true, message: '请选择关联用户', trigger: 'change' }],
  292. certificateFileUrl: [{ required: true, message: '请选择证书文件', trigger: 'change' }],
  293. signatureFileUrl: [{ required: true, message: '请选择签名体图片', trigger: 'change', }],
  294. signPfxDeputieList: [{ required: true, message: '请设置关联项目', trigger: 'change', }],
  295. pfxType: [{ required: true, message: '请选择签章类型', trigger: 'change', }],
  296. },
  297. ParticipationConstruction: [],//参见项目方
  298. projectMeiju: [],//项目
  299. ContractSection: [],//合同段
  300. userData: [],//关联用户
  301. pfxType: [],//
  302. options:[],
  303. signatureId: '',
  304. }
  305. },
  306. methods: {
  307. // 根据条件动态设置 dependentField 的验证规则
  308. updateDependentFieldValidation() {
  309. const conditionFieldValue = this.form.company;
  310. console.log(conditionFieldValue,'conditionFieldValue');
  311. // 清空 dependentField 的验证规则
  312. this.rules.certificateNumber = [];
  313. // 根据条件字段的值来决定是否必填
  314. if (conditionFieldValue === 3) {
  315. // 设置为必填项
  316. this.rules.certificateNumber.push({ required: true, message: 'Dependent Field 是必填项', trigger: 'change' });
  317. }else{
  318. this.rules.certificateNumber = [];
  319. }
  320. },
  321. //获取签字公司
  322. getOptions() {
  323. getDictbiz({
  324. code: 'es_type_name'
  325. }).then((res) => {
  326. this.options = res.data.data;
  327. this.options.forEach((ele)=>{
  328. ele.dictKey=Number(ele.dictKey)
  329. })
  330. })
  331. console.log( this.options,' this.options');
  332. },
  333. selectUser(){
  334. let _this = this;
  335. this.userData.forEach(vo => {
  336. if(_this.form.certificateUserId == vo.id){
  337. _this.form.certificateId = vo.idNumber;
  338. console.log(vo,'vo');
  339. _this.form.certificateUserName=vo.realName
  340. }
  341. });
  342. },
  343. changeCompany(){
  344. this.$forceUpdate()
  345. this.updateDependentFieldValidation()
  346. },
  347. async init () {
  348. if (this.$route.query.id != 0) {
  349. await this.getById()
  350. }
  351. this.queryProjectAndContract()//获取项目和合同段
  352. },
  353. //#region
  354. cancel() {
  355. const { value, certificateTypeValue, searchinput, pageindex, pagesize } = this.$route.query;
  356. this.$router.push({
  357. path: '/certificate/list',
  358. query: {
  359. value,
  360. certificateTypeValue,
  361. searchinput,
  362. pageindex,
  363. pagesize
  364. }
  365. });
  366. },
  367. savess () {//保存按钮
  368. this.$refs.form.validate(async valid => {
  369. if (valid) {
  370. let fromData = {
  371. certificateType: this.form.certificateType,
  372. certificateUserName: this.form.certificateUserName,
  373. certificateNumber: this.form.certificateNumber,
  374. certificatePassword: this.form.certificatePassword,
  375. certificateId: this.form.certificateId,
  376. pfxType: this.form.pfxType,
  377. wide: this.form.wide,
  378. high: this.form.high,
  379. }
  380. if (this.form.certificateFileUrl[0]&&this.form.certificateFileUrl[0].name&&this.form.certificateFileUrl[0].raw && this.form.certificateFileUrl[0].status === "ready") {
  381. let fileData = await this.addFileInfo(this.form.certificateFileUrl[0].raw);
  382. fromData.certificateFileUrl = fileData.link;
  383. fromData.certificateFileName = fileData.originalName;
  384. } else {
  385. // fromData.certificateFileUrl = this.form.certificateFileUrl[0].raw
  386. if(this.form.certificateFileUrl&&this.form.certificateFileUrl[0]&&this.form.certificateFileUrl[0].raw){
  387. fromData.certificateFileUrl = this.form.certificateFileUrl[0].raw
  388. }
  389. console.log(this.form.certificateFileUrl,'this.form.certificateFileUrl');
  390. }
  391. if (this.form.signatureFileUrl[0]&&this.form.signatureFileUrl[0].name && this.form.signatureFileUrl[0].status === "ready") {
  392. const url = await this.prePictureApi()
  393. if (url) {
  394. fromData.wide = this.form.wide
  395. fromData.high = this.form.high
  396. }
  397. let fileData = await this.compressAndUploadApi(this.form.signatureFileUrl[0].raw, fromData.wide, fromData.high);
  398. fromData.signatureFileUrl = fileData.link;
  399. fromData.signatureFileName = fileData.originalName;
  400. } else {
  401. if(this.form.signatureFileUrl&&this.form.signatureFileUrl[0]&&this.form.signatureFileUrl[0].raw){
  402. const url = await this.prePictureApi()
  403. if (url) {
  404. fromData.wide = this.form.wide
  405. fromData.high = this.form.high
  406. }
  407. fromData.signatureFileUrl = this.form.signatureFileUrl[0].raw
  408. }
  409. }
  410. let tag = true
  411. let enterpriseUnifiedCode = ''
  412. if (this.form.certificateType == 1) {
  413. fromData.certificateUserId = this.form.certificateUserId//关联用户
  414. } else {
  415. this.form.signPfxDeputieList.forEach(val => {
  416. if (!val.projectId || !val.contractId || !val.roleId) {
  417. tag = false
  418. return
  419. } else {
  420. if (enterpriseUnifiedCode) {
  421. enterpriseUnifiedCode += ','
  422. }
  423. enterpriseUnifiedCode += `${val.projectId}-${val.contractId}-${val.roleId}`
  424. }
  425. })
  426. fromData.projectContractRole = enterpriseUnifiedCode //关联项目
  427. fromData.enterpriseUnifiedCode = this.form.enterpriseUnifiedCode
  428. }
  429. console.log(fromData,'fromData');
  430. console.log(this.form,'fromData');
  431. if(this.form.company=='3'){
  432. fromData.certificateType=3
  433. }
  434. if (tag) {
  435. if (this.$route.query.id == 0) {
  436. this.save(fromData)//新增接口
  437. } else {
  438. fromData.id = this.form.id
  439. this.update(fromData)//编辑接口
  440. }
  441. } else {
  442. this.$message({
  443. type: 'error',
  444. message: "请填写完整关联项目!"
  445. })
  446. }
  447. }
  448. })
  449. },
  450. async compressAndUploadApi(file, wide, high) {
  451. let fromData = new FormData();
  452. fromData.append('file', file);
  453. fromData.append('wide', wide);
  454. fromData.append('high', high);
  455. const { data: res } = await compressAndUpload(fromData)
  456. if (res.code == 200) {
  457. return res.data;
  458. }
  459. },
  460. deleteSignPfxDeputie (key) {//删除关联项目
  461. this.form.signPfxDeputieList.splice(key, 1)
  462. },
  463. //#endregion
  464. //#region 上传文件得方法
  465. beforeRemove (file, fileList) {//证书文件删除回调
  466. this.form.certificateFileUrl = []
  467. },
  468. changecertificateFileUrl (file) {//证书文件变化回调
  469. this.form.certificateFileUrl = [file]
  470. },
  471. beforeRemove2 (file, fileList) {//签名体图片删除回调
  472. this.form.signatureFileUrl = []
  473. },
  474. changecertificateFileUrl2 (file) {//签名体图片变化回调
  475. this.form.signatureFileUrl = [file]
  476. this.form.wide = ''
  477. this.form.high = ''
  478. },
  479. pushSignPfxDeputieList () {//添加关联项目
  480. // this.form.signPfxDeputieList.unshift({
  481. // projectId: '',
  482. // contractId: '',
  483. // roleId: '',
  484. // })
  485. this.form.signPfxDeputieList.push({
  486. projectId: '',
  487. contractId: '',
  488. roleId: '',
  489. contractList: []
  490. })
  491. },
  492. focusContractSection (projectId, key) {//获取合同段数据
  493. this.projectMeiju.forEach(val => {
  494. if (val.id == projectId) {
  495. // this.ContractSection[key] = val.contractInfoList
  496. this.form.signPfxDeputieList[key].contractList = val.contractInfoList
  497. }
  498. })
  499. },
  500. changeProjectId (key) {//项目id发生改变
  501. this.form.signPfxDeputieList[key].contractId = ''
  502. },
  503. //#endregion
  504. //#region //接口
  505. async getById () {//获取详细信息
  506. const { data: res } = await getById({ id: this.$route.query.id })
  507. console.log(res);
  508. if (res.code == 200) {
  509. this.form = res.data
  510. if(res.data.certificateType!==1){
  511. this.form.company=res.data.certificateType
  512. this.form.certificateType=2
  513. }
  514. if(res.data.certificateFileUrl&&this.form.certificateFileName){
  515. this.form.certificateFileUrl = [{ raw: res.data.certificateFileUrl, name: this.form.certificateFileName }]
  516. }else{
  517. this.form.certificateFileUrl=[]
  518. }
  519. if(res.data.signatureFileUrl&&this.form.signatureFileName){
  520. this.form.signatureFileUrl = [{ raw: res.data.signatureFileUrl, name: this.form.signatureFileName }]
  521. }else{
  522. this.form.signatureFileUrl = []
  523. }
  524. //宽度
  525. this.form.wide = res.data.wide ? res.data.wide : ''
  526. //高度
  527. this.form.high = res.data.high ? res.data.high : ''
  528. }
  529. },
  530. async save (da) {//新增
  531. const { data: res } = await save(da)
  532. if (res.code == 200) {
  533. this.$message({
  534. type: 'success',
  535. message: '新增电签成功!'
  536. })
  537. // this.$router.push('/certificate/list')
  538. this.$router.push({
  539. path: '/certificate/list',
  540. query: {
  541. value: this.$route.query.value,
  542. certificateTypeValue: this.$route.query.certificateTypeValue,
  543. searchinput: this.$route.query.searchinput,
  544. pageindex: this.$route.query.pageindex,
  545. pagesize: this.$route.query.pagesize
  546. }
  547. });
  548. }
  549. },
  550. async findUserByName () { //关联用户
  551. const { data: res } = await findUserByName()
  552. if (res.code == 200) {
  553. this.userData = res.data
  554. }
  555. },
  556. async queryRole () { //获取角色方
  557. const { data: res } = await queryRole()
  558. if (res.code == 200) {
  559. this.ParticipationConstruction = res.data
  560. }
  561. },
  562. async queryProjectAndContract () {//获取项目和合同段
  563. const { data: res } = await queryProjectAndContract()
  564. console.log(res);
  565. if (res.code == 200) {
  566. this.projectMeiju = res.data
  567. // this.form.signPfxDeputieList.forEach((val, key) => {
  568. // this.ContractSection.push(res.data[key].contractInfoList)
  569. // })
  570. if(this.form.signPfxDeputieList.length > 0){
  571. this.form.signPfxDeputieList.forEach((val, key) => {
  572. this.projectMeiju.forEach((project, key) => {
  573. if(val.projectId == project.id){
  574. val.contractList = project.contractInfoList;
  575. }
  576. })
  577. })
  578. }
  579. console.log(this.form.signPfxDeputieList);
  580. }
  581. },
  582. async findPfxType () {
  583. const { data: res } = await findPfxType({ typeOrStatus: 'pfx_type' })
  584. if (res.code == 200) {
  585. this.pfxType = res.data;
  586. }
  587. },
  588. async addFileInfo (file) {//上传图片
  589. let fromData = new FormData();
  590. fromData.append('file', file);
  591. const { data: res } = await addFileInfo(fromData)
  592. if (res.code == 200) {
  593. return res.data;
  594. }
  595. },
  596. async update (da) {//编辑保存接口
  597. const { data: res } = await update(da)
  598. if (res.code == 200) {
  599. this.$message({
  600. type: 'success',
  601. message: '修改电签成功!'
  602. })
  603. // this.$router.push('/certificate/list')
  604. this.$router.push({
  605. path: '/certificate/list',
  606. query: {
  607. value: this.$route.query.value,
  608. certificateTypeValue: this.$route.query.certificateTypeValue,
  609. searchinput: this.$route.query.searchinput,
  610. pageindex: this.$route.query.pageindex,
  611. pagesize: this.$route.query.pagesize
  612. }
  613. });
  614. }
  615. },
  616. //#endregion
  617. //检测参建方是否重复
  618. checkRoleRepeat(index){
  619. let cur = this.form.signPfxDeputieList[index];
  620. if(!cur.roleId){
  621. return;
  622. }
  623. this.form.signPfxDeputieList.forEach((info,i)=>{
  624. if(i === index){
  625. return;
  626. }
  627. if(info.contractId == cur.contractId && info.roleId == cur.roleId){
  628. this.$message({
  629. message: "关联的项目参见方不可重复",
  630. type: 'error'
  631. });
  632. this.form.signPfxDeputieList[index].roleId = '';
  633. }
  634. })
  635. },
  636. //改变证书类型
  637. changeCertificateType(val){
  638. if(val==1){
  639. console.log(this.form.company,'公司');
  640. this.form.company=2
  641. this.$forceUpdate();//强制刷新视图
  642. this.updateDependentFieldValidation()
  643. }
  644. },
  645. //预览
  646. async signaturePreview() {
  647. const form = this.form
  648. const isImg = form.signatureFileUrl.length <= 0
  649. if (isImg) {
  650. this.$message({
  651. message: '请先上传签名图片',
  652. type: 'error'
  653. })
  654. return false
  655. }
  656. const file = form.signatureFileUrl[0].raw
  657. if (!file) {
  658. this.$message({
  659. message: '请重新上传签名文件',
  660. type: 'error'
  661. })
  662. return false
  663. }
  664. const url = await this.prePictureApi()
  665. if (!url) return
  666. window.open(url, '_blank')
  667. },
  668. async prePictureApi() {
  669. const form = this.form
  670. const file = form.signatureFileUrl[0].raw
  671. if (!file) return false
  672. let fromData = new FormData();
  673. if (typeof file === 'object') {
  674. fromData.append('file', file);
  675. fromData.append('fileStr', '');
  676. } else {
  677. fromData.append('file', '');
  678. fromData.append('fileStr', file);
  679. }
  680. fromData.append('wide', form.wide);
  681. fromData.append('high', form.high);
  682. const { data: res } = await prePicture(fromData)
  683. const data = res.data;
  684. if (!data.preUrl) return false
  685. this.form.wide = data.wide //宽度
  686. this.form.high = data.high //高度
  687. return data.preUrl
  688. },
  689. stopClick() {},
  690. },
  691. created () {
  692. this.getOptions()
  693. this.init()
  694. this.queryRole()//获取角色方
  695. this.findUserByName()//关联用户
  696. this.findPfxType();//查询企业签章类型
  697. },
  698. mounted () {
  699. this.updateDependentFieldValidation();
  700. }
  701. }
  702. </script>
  703. <style lang="scss" scoped>
  704. </style>