electronicSignature.vue 9.9 KB

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