electronicSignature.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <div>
  3. <div class="dianqian">
  4. <el-row :span="24">
  5. <el-col :span="3.3" style="line-height: 40px">
  6. 元素坐标:
  7. </el-col>
  8. <el-col :span="18">
  9. <avue-input v-model="htmlData1.name" placeholder="请点击坐标" :disabled='true' ></avue-input>
  10. </el-col>
  11. </el-row>
  12. <el-row :span="24">
  13. <el-col :span="3.3" style="line-height: 40px">
  14. 证书类型:
  15. </el-col>
  16. <el-col :span="18">
  17. <el-select v-model="signType" placeholder="请选择证书类型" @change="signTypeChang()">
  18. <el-option v-for="item in seloptions" :label="item.label" :value="item.value" :key="item.value"></el-option>
  19. </el-select>
  20. </el-col>
  21. </el-row>
  22. <el-row :span="24" v-if="signType==1">
  23. <el-col :span="3.3">
  24. 所属方:
  25. </el-col>
  26. <el-col :span="18">
  27. <avue-radio v-model="radio" :dic="roleType" v-on:click="roleTypeChang()"></avue-radio>
  28. </el-col>
  29. </el-row>
  30. <el-row :span="24" v-if="signType==1">
  31. <el-col :span="3.3" style="line-height: 40px">
  32. 签字角色:
  33. </el-col>
  34. <el-col :span="18">
  35. <el-select v-model="roleInfo" placeholder="请选择签字岗位" filterable >
  36. <el-option v-for="item in options" :key="item.value" :value="item" :label="item.label" ></el-option>
  37. </el-select>
  38. </el-col>
  39. </el-row>
  40. <el-row :span="24" v-if="signType==2">
  41. <el-col :span="3.3" style="line-height: 40px">
  42. 签章类型:
  43. </el-col>
  44. <el-col :span="18">
  45. <el-select v-model="signInfo" placeholder="请选择签章类型" @change="signInfoChang">
  46. <el-option v-for="item in options" :key="item.dictKey" :value="item.dictKey" :label="item.dictValue"></el-option>
  47. </el-select>
  48. </el-col>
  49. </el-row>
  50. <el-row :span="24">
  51. <el-col :span="3.3" style="line-height: 40px">
  52. 偏移位X:
  53. </el-col>
  54. <el-col :span="18">
  55. <el-tooltip class="item" effect="light" content="横坐标,负代表左移,正代表右移,偏移量50大概等于一厘米" placement="top-start">
  56. <avue-input v-model="pyzbx" placeholder="偏移位x" type="number"></avue-input>
  57. </el-tooltip>
  58. </el-col>
  59. </el-row>
  60. <el-row :span="24">
  61. <el-col :span="3.3" style="line-height: 40px">
  62. 偏移位Y:
  63. </el-col>
  64. <el-col :span="18">
  65. <el-tooltip class="item" effect="light" content="纵坐标,负代表下移,正代表上移,偏移量50大概等于一厘米" placement="top-start">
  66. <avue-input v-model="pyzby" placeholder="偏移位y" type="number"></avue-input>
  67. </el-tooltip>
  68. </el-col>
  69. </el-row>
  70. <el-row :span="24" style="text-align: center">
  71. <el-button type="primary"
  72. size="small"
  73. icon="el-icon-circle-plus-outline"
  74. @click="addRoleInfo()">添加列表</el-button> &nbsp;&nbsp;
  75. </el-row>
  76. </div>
  77. <div
  78. style="border: 1px dotted rgb(187, 187, 187);box-sizing: border-box;padding: 0px 15px;"
  79. class="martop20 marbottom10"
  80. >
  81. <table @click
  82. class="table martop20"
  83. width='100%'
  84. border='1px '
  85. bordercolor="#E5E5E5"
  86. cellpadding='2px'
  87. >
  88. <thead
  89. cellpadding='2px'
  90. height='40px'
  91. >
  92. <tr>
  93. <th width='30%'>元素位置</th>
  94. <th width='30%'>签字岗位</th>
  95. <th width='10%'>偏移x</th>
  96. <th width='10%'>偏移y</th>
  97. <th width='20%'>操作</th>
  98. </tr>
  99. </thead>
  100. <tbody height='36px'>
  101. <tr v-for="(item,key) in setsignaTable" :key="key" v-on:click="">
  102. <td>{{item.colName}}</td>
  103. <td>{{item.sigRoleName}}</td>
  104. <td>{{item.pyzbx}}</td>
  105. <td>{{item.pyzby}}</td>
  106. <td align="center"><span style="color:red;cursor: pointer;" v-on:click="deleteTableSig(key)">删除</span></td>
  107. </tr>
  108. </tbody>
  109. </table>
  110. <el-button type="primary"
  111. size="small"
  112. class="martop25"
  113. style="float:right;"
  114. icon="el-icon-circle-plus-outline"
  115. :disabled="isCansave"
  116. @click="saveSingInfo()">保存入库</el-button> &nbsp;&nbsp;
  117. </div>
  118. </div>
  119. </template>
  120. <script>
  121. import {getRoleInfoByParentId, getRoleType, getSigList, saveSig} from "@/api/manager/AdjustForm";
  122. import {findPfxType} from "@/api/certificate/list";
  123. export default {
  124. props: ['pkeyId1', 'htmlData1'],
  125. data () {
  126. return {
  127. radio: '',
  128. roleType:[],
  129. options: [],
  130. roleInfo: '',
  131. signInfo: '',
  132. signInfoarr:[],
  133. signType: '1', // 证书类型
  134. pyzbx: 0.0,
  135. pyzby: 0.0 ,
  136. setsignaTable:[],
  137. seloptions : [
  138. {
  139. value: '1',
  140. label: '个人证书',
  141. },
  142. {
  143. value: '2',
  144. label: '企业证书',
  145. }
  146. ],
  147. isCansave:false,
  148. }
  149. },
  150. methods: {
  151. async getRoleType () {//获取角色类型
  152. const { data: res } = await getRoleType()
  153. if (res.code === 200) {
  154. this.roleType = res.data
  155. }
  156. },
  157. // 签证类型
  158. async signTypeChang(){
  159. setTimeout(async () => {
  160. if(this.signType==2){
  161. const {data: res} = await findPfxType({ typeOrStatus: 'pfx_type'})
  162. if (res.code === 200) {
  163. this.options = res.data
  164. }
  165. }
  166. }, 200);
  167. },
  168. // 单选按钮改变事件
  169. async roleTypeChang(){
  170. setTimeout(async () => {
  171. const {data: res} = await getRoleInfoByParentId({ParentId: this.radio})
  172. if (res.code === 200) {
  173. this.options = res.data
  174. }
  175. }, 200);
  176. },
  177. //签章类型改变e
  178. signInfoChang(e){
  179. this.signInfoarr= this.options.filter(item=>{
  180. if(item.dictKey===e){
  181. return item
  182. }
  183. })
  184. },
  185. async addRoleInfo(){
  186. var isadd = true;
  187. // 集合中添加数据
  188. var data = {};
  189. // 坐标位置
  190. if(this.htmlData1.name ===''){
  191. this.$message({
  192. type: "error",
  193. message: "请选坐标位置"
  194. });
  195. return;
  196. }
  197. // 签字岗位
  198. if (this.signType==1){
  199. if(this.roleInfo ==='') {
  200. this.$message({
  201. type: "error",
  202. message: "请选择签字岗位"
  203. });
  204. return;
  205. }
  206. data.sigRoleId = this.roleInfo.value;
  207. data.sigRoleName = this.roleInfo.label;
  208. data.type=2;
  209. }else if(this.signType==2){
  210. if(this.signInfo ===''){
  211. this.$message({
  212. type: "error",
  213. message: "请选择签章类型"
  214. });
  215. return;
  216. }
  217. // data.sigRoleId = this.signInfo.dictKey;
  218. // data.sigRoleName = this.signInfo.dictValue;
  219. data.sigRoleId = this.signInfoarr[0].dictKey;
  220. data.sigRoleName = this.signInfoarr[0].dictValue;
  221. data.type=6;
  222. }
  223. data.colKey="__"+this.htmlData1.tr+"_"+this.htmlData1.td;
  224. data.tabId = this.pkeyId1;
  225. data.colName= this.htmlData1.name;
  226. data.pyzbx = this.pyzbx;
  227. data.pyzby = this.pyzby;
  228. try {
  229. this.setsignaTable.forEach(val => {
  230. if(val.colName == this.htmlData1.name){ // 位置只能添加一个
  231. this.$message({
  232. type: "error",
  233. message: "位置只能配置一个电签"
  234. });
  235. isadd = false;
  236. throw new Error('位置只能配置一个电签')
  237. }
  238. if(val.colName === this.htmlData1.name && val.sigRoleId === this.roleInfo.value){
  239. this.$message({
  240. type: "error",
  241. message: "数据已添加列表中"
  242. });
  243. isadd = false;
  244. throw new Error('位置只能配置一个电签');
  245. }
  246. })
  247. if(isadd){
  248. this.setsignaTable.push(data);
  249. }
  250. }catch (e){
  251. throw e;
  252. }
  253. },
  254. async deleteTableSig (key) {//删除数据
  255. this.setsignaTable.splice(key,1);
  256. this.isCansave=true
  257. // this.saveSingInfo();
  258. const {data: res} = await saveSig({dataInfo: this.setsignaTable,tabId:this.pkeyId1})
  259. if (res.code === 200) {
  260. //console.log(this.$parent)
  261. this.isCansave=false
  262. this.$parent.getExcelHtml(this.pkeyId1);
  263. this.$message({
  264. type: "success",
  265. message: "操作成功"
  266. });
  267. }
  268. },
  269. async saveSingInfo() {
  270. const {data: res} = await saveSig({dataInfo: this.setsignaTable,tabId:this.pkeyId1})
  271. if (res.code === 200) {
  272. //console.log(this.$parent)
  273. this.$parent.getExcelHtml(this.pkeyId1);
  274. this.$message({
  275. type: "success",
  276. message: "操作成功"
  277. });
  278. }
  279. },
  280. async getSingInfo() {
  281. const {data: res} = await getSigList(
  282. {
  283. current: 0,
  284. size: 100,
  285. tabId: this.pkeyId1,
  286. type:2
  287. }
  288. )
  289. if (res.code === 200) {
  290. this.setsignaTable = res.data.records;
  291. }
  292. }
  293. },
  294. created () {
  295. this.getRoleType(); //获取文本类型接口
  296. this.getSingInfo();
  297. this.setsignaTable=[];
  298. },
  299. }
  300. </script>
  301. <style lang="scss" scoped>
  302. .table {
  303. margin-top: 20px;
  304. border-radius: 5px;
  305. color: #101010;
  306. font-size: 14px;
  307. }
  308. .dianqian{
  309. width: 90%;
  310. height: 100%;
  311. }
  312. </style>