electronicSignature.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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)">删除</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. :disabled="isCansave"
  112. @click="saveSingInfo()">保存入库</el-button> &nbsp;&nbsp;
  113. </div>
  114. </div>
  115. </template>
  116. <script>
  117. import {getRoleInfoByParentId, getRoleType, getSigList, saveSig} from "@/api/manager/AdjustForm";
  118. import {findPfxType} from "@/api/certificate/list";
  119. export default {
  120. props: ['pkeyId1', 'htmlData1'],
  121. data () {
  122. return {
  123. radio: '',
  124. roleType:[],
  125. options: [],
  126. roleInfo: '',
  127. signInfo: '',
  128. signInfoarr:[],
  129. signType: '1', // 证书类型
  130. pyzbx: 0.0,
  131. pyzby: 0.0 ,
  132. setsignaTable:[],
  133. seloptions : [
  134. {
  135. value: '1',
  136. label: '个人证书',
  137. },
  138. {
  139. value: '2',
  140. label: '企业证书',
  141. }
  142. ],
  143. isCansave:false,
  144. }
  145. },
  146. methods: {
  147. async getRoleType () {//获取角色类型
  148. const { data: res } = await getRoleType()
  149. if (res.code === 200) {
  150. this.roleType = res.data
  151. }
  152. },
  153. // 签证类型
  154. async signTypeChang(){
  155. setTimeout(async () => {
  156. if(this.signType==2){
  157. const {data: res} = await findPfxType({ typeOrStatus: 'pfx_type'})
  158. if (res.code === 200) {
  159. this.options = res.data
  160. }
  161. }
  162. }, 200);
  163. },
  164. // 单选按钮改变事件
  165. async roleTypeChang(){
  166. setTimeout(async () => {
  167. const {data: res} = await getRoleInfoByParentId({ParentId: this.radio})
  168. if (res.code === 200) {
  169. this.options = res.data
  170. }
  171. }, 200);
  172. },
  173. //签章类型改变e
  174. signInfoChang(e){
  175. this.signInfoarr= this.options.filter(item=>{
  176. if(item.dictKey===e){
  177. return item
  178. }
  179. })
  180. },
  181. async addRoleInfo(){
  182. var isadd = true;
  183. // 集合中添加数据
  184. var data = {};
  185. // 坐标位置
  186. if(this.htmlData1.name ===''){
  187. this.$message({
  188. type: "error",
  189. message: "请选坐标位置"
  190. });
  191. return;
  192. }
  193. // 签字岗位
  194. if (this.signType==1){
  195. if(this.roleInfo ==='') {
  196. this.$message({
  197. type: "error",
  198. message: "请选择签字岗位"
  199. });
  200. return;
  201. }
  202. data.sigRoleId = this.roleInfo.value;
  203. data.sigRoleName = this.roleInfo.label;
  204. data.type=2;
  205. }else if(this.signType==2){
  206. if(this.signInfo ===''){
  207. this.$message({
  208. type: "error",
  209. message: "请选择签章类型"
  210. });
  211. return;
  212. }
  213. // data.sigRoleId = this.signInfo.dictKey;
  214. // data.sigRoleName = this.signInfo.dictValue;
  215. data.sigRoleId = this.signInfoarr[0].dictKey;
  216. data.sigRoleName = this.signInfoarr[0].dictValue;
  217. data.type=6;
  218. }
  219. data.colKey="__"+this.htmlData1.tr+"_"+this.htmlData1.td;
  220. data.tabId = this.pkeyId1;
  221. data.colName= this.htmlData1.name;
  222. data.pyzbx = this.pyzbx;
  223. data.pyzby = this.pyzby;
  224. try {
  225. this.setsignaTable.forEach(val => {
  226. if(val.colName == this.htmlData1.name){ // 位置只能添加一个
  227. this.$message({
  228. type: "error",
  229. message: "位置只能配置一个电签"
  230. });
  231. isadd = false;
  232. throw new Error('位置只能配置一个电签')
  233. }
  234. if(val.colName === this.htmlData1.name && val.sigRoleId === this.roleInfo.value){
  235. this.$message({
  236. type: "error",
  237. message: "数据已添加列表中"
  238. });
  239. isadd = false;
  240. throw new Error('位置只能配置一个电签');
  241. }
  242. })
  243. if(isadd){
  244. this.setsignaTable.push(data);
  245. }
  246. }catch (e){
  247. throw e;
  248. }
  249. },
  250. async deleteTableSig (key) {//删除数据
  251. this.setsignaTable.splice(key,1);
  252. this.isCansave=true
  253. // this.saveSingInfo();
  254. const {data: res} = await saveSig({dataInfo: this.setsignaTable,tabId:this.pkeyId1})
  255. if (res.code === 200) {
  256. //console.log(this.$parent)
  257. this.isCansave=false
  258. this.$parent.getExcelHtml(this.pkeyId1);
  259. this.$message({
  260. type: "success",
  261. message: "操作成功"
  262. });
  263. }
  264. },
  265. async saveSingInfo() {
  266. const {data: res} = await saveSig({dataInfo: this.setsignaTable,tabId:this.pkeyId1})
  267. if (res.code === 200) {
  268. //console.log(this.$parent)
  269. this.$parent.getExcelHtml(this.pkeyId1);
  270. this.$message({
  271. type: "success",
  272. message: "操作成功"
  273. });
  274. }
  275. },
  276. async getSingInfo() {
  277. const {data: res} = await getSigList(
  278. {
  279. current: 0,
  280. size: 100,
  281. tabId: this.pkeyId1,
  282. type:2
  283. }
  284. )
  285. if (res.code === 200) {
  286. this.setsignaTable = res.data.records;
  287. }
  288. }
  289. },
  290. created () {
  291. this.getRoleType(); //获取文本类型接口
  292. this.getSingInfo();
  293. this.setsignaTable=[];
  294. },
  295. }
  296. </script>
  297. <style lang="scss" scoped>
  298. .table {
  299. margin-top: 20px;
  300. border-radius: 5px;
  301. color: #101010;
  302. font-size: 14px;
  303. }
  304. .dianqian{
  305. width: 90%;
  306. height: 100%;
  307. }
  308. </style>