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