autoSetUp

自动设置

目前為 2021-07-30 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/430111/955761/autoSetUp.js

  1. // ==UserScript==
  2. // @name autoSetUp
  3. // @namespace coderWyh
  4. // @version 0.1.1
  5. // @description 自动设置
  6. // @author coderWyh
  7. // @match http://www.gczl360.com:8084/Admin/ZLKGL/Template*
  8. // @run-at document-end
  9. // ==/UserScript==
  10. (function() {
  11. 'use strict';
  12. $(".record_box>.slimScrollDiv").append("<div style='top: 5%;left: 2%' class='fixbtn autoSetUp'>自动设置</div>")
  13. $(".autoSetUp").on('click',function () {
  14. attrArray.length =0;
  15. var sheet = spread.getActiveSheet();
  16. var sheetIndex_c = spread.getActiveSheetIndex();
  17. var colCount = sheet.getColumnCount();
  18. const list = [];
  19. const valueMap = [
  20. {name: '编号:', value: 'bh1'},
  21. {name: '编号', value: 'bh1'},
  22. {name: '单位(子单位)工程名称', value: 'p0102'},
  23. {name: '单位(子单位)工程名称', value: 'p0102'},
  24. {name: '单位工程名称', value: 'p0102'},
  25. {name: '施工单位', value: 'p0401'},
  26. {name: '施工单位名称', value: 'p0401'},
  27. {name: '项目负责人', value: 'p0404'},
  28. {name: '项目经理', value: 'p0404'},
  29. {name: '分包单位', value: 'p0411'},
  30. {name: '分包单位负责人', value: 'p0412'},
  31. {name: '分包项目经理', value: 'p0412'},
  32. {name: '分包单位项目负责人', value: 'p0412'},
  33. {name: '检验批容量', value: 'JYPRL'},
  34. {name: '检验批部位', value: 'p0116'},
  35. {name: '验收部位/区段', value: 'p0116'},
  36. {name: '检查记录', value: 's201403'},
  37. {name: '施工单位检查评定结果', value: 's201401'},
  38. {name: '施工单位检查结果', value: 's201401'},
  39. {name: '施工(分包)单位检查结果', value: 's201401'},
  40. {name: '施工(分包)单位检查结果', value: 's201401'},
  41. {name: '监理(建设)单位验收结论', value: 's201402'},
  42. {name: '监理(建设)单位验收结论', value: 's201402'},
  43. {name: '监理单位验收结论', value: 's201402'},
  44. {name: '施工员:', value: 'p0408'},
  45. {name: '专业工长:', value: 'p0408'},
  46. {name: '项目专业质量检查员:', value: 'p0406'},
  47. {name: '质量员:', value: 'p0406'},
  48. {name: '质检员:', value: 'p0406'},
  49. {name: '项目专业质量(技术)负责人:', value: 'p0407'},
  50. {name: '项目专业质量(技术)负责人:', value: 'p0407'},
  51. {name: '专业监理工程师:(建设单位项目技术负责人)', value: 'p0304'},
  52. {name: '专业监理工程师:(建设单位项目技术负责人)', value: 'p0304'},
  53. {name: '监理工程师(建设单位项目技术负责人):', value: 'p0304'},
  54. {name: '监理工程师(建设单位项目技术负责人):', value: 'p0304'},
  55. {name: '专业监理工程师:', value: 'p0304'},
  56. {name: '年月日', value: '日期'},
  57. {name: '工程名称', value: 'p0101'},
  58. ];
  59. const valueList = [];
  60. const length = valueMap.length;
  61. var spanValue;
  62. var oneValue;
  63. var rowCount = sheet.getRowCount();
  64. for (var i = 0; i < rowCount; i++) {
  65. for (var j = 0; j < colCount; j++) {
  66. var span = sheet.getSpans(new GC.Spread.Sheets.Range(i, j, 1, 1));
  67. if (span.length > 0) {
  68. if (list.length === 0) {
  69. spanValue = sheet.getText(i, j).replace(/\ +/g, "").replace(/[\r\n]/g, "");
  70. //TODO 判断内容
  71. if (spanValue !== "") {
  72. valueMap.map((item,index,arr)=>{
  73. if (spanValue===item.name) {
  74. if (spanValue.indexOf(':')>=0&&spanValue.indexOf('编号')<0){
  75. attrArray.push({
  76. sheetIndex: sheetIndex_c,
  77. row: span[0].row,
  78. col: span[0].col + span[0].colCount,
  79. value: item.value,
  80. type: 'sign'
  81. });
  82. }
  83. else {
  84. if (spanValue==='年月日'){
  85. attrArray.push({
  86. sheetIndex: sheetIndex_c,
  87. row: span[0].row,
  88. col: span[0].col,
  89. value: item.value,
  90. type: ''
  91. })
  92. }
  93. else if (spanValue==='检查记录'){
  94. for(let i =1;i<=rowCount;i++) {
  95. attrArray.push({
  96. sheetIndex: sheetIndex_c,
  97. row: span[0].row+i,
  98. col: span[0].col,
  99. value: item.value,
  100. type: ''
  101. })
  102. }
  103. }
  104. else {
  105. attrArray.push({
  106. sheetIndex: sheetIndex_c,
  107. row: span[0].row,
  108. col: span[0].col + span[0].colCount,
  109. value: item.value,
  110. type: ''
  111. })
  112. }
  113. }
  114. }
  115. });
  116. list.push(span[0])
  117. }
  118. } else {
  119. A: for (var c = 0; c < list.length; c++) {
  120. for (var d = 0; d < list.length; d++) {
  121. if (list[d] === span[0]) {
  122. break A;
  123. }
  124. }
  125. spanValue = sheet.getText(i, j).replace(/\ +/g, "").replace(/[\r\n]/g, "");
  126. //TODO 判断内容
  127. if (spanValue !== "") {
  128. valueMap.map((item,index,arr)=>{
  129. if (spanValue===item.name) {
  130. if (spanValue.indexOf(':')>=0&&spanValue.indexOf('编号')<0){
  131. attrArray.push({
  132. sheetIndex: sheetIndex_c,
  133. row: span[0].row,
  134. col: span[0].col + span[0].colCount,
  135. value: item.value,
  136. type: 'sign'
  137. });
  138. }
  139. else {
  140. if (spanValue==='年月日'){
  141. attrArray.push({
  142. sheetIndex: sheetIndex_c,
  143. row: span[0].row,
  144. col: span[0].col,
  145. value: item.value,
  146. type: ''
  147. })
  148. }
  149. else if (spanValue==='检查记录'){
  150. for(let i =1;i<=rowCount;i++) {
  151. attrArray.push({
  152. sheetIndex: sheetIndex_c,
  153. row: span[0].row+i,
  154. col: span[0].col,
  155. value: item.value,
  156. type: ''
  157. })
  158. }
  159. }
  160. else {
  161. attrArray.push({
  162. sheetIndex: sheetIndex_c,
  163. row: span[0].row,
  164. col: span[0].col + span[0].colCount,
  165. value: item.value,
  166. type: ''
  167. })
  168. }
  169. }
  170. }
  171. });
  172. }
  173. list.push(span[0])
  174. }
  175. }
  176. }
  177. else
  178. {
  179. oneValue = sheet.getText(i, j).replace(/\ +/g, "").replace(/[\r\n]/g, "");
  180. //TODO 判断内容
  181. if (oneValue !== "") {
  182. valueMap.map((item,index,arr)=>{
  183. if (spanValue===item.name) {
  184. if (spanValue.indexOf(':')>=0&&spanValue.indexOf('编号')<0){
  185. attrArray.push({
  186. sheetIndex: sheetIndex_c,
  187. row: span[0].row,
  188. col: span[0].col + span[0].colCount,
  189. value: item.value,
  190. type: 'sign'
  191. });
  192. }
  193. else {
  194. if (spanValue==='年月日'){
  195. attrArray.push({
  196. sheetIndex: sheetIndex_c,
  197. row: span[0].row,
  198. col: span[0].col,
  199. value: item.value,
  200. type: ''
  201. })
  202. }
  203. else if (spanValue==='检查记录'){
  204. for(let i =1;i<=rowCount;i++) {
  205. attrArray.push({
  206. sheetIndex: sheetIndex_c,
  207. row: span[0].row+i,
  208. col: span[0].col,
  209. value: item.value,
  210. type: ''
  211. })
  212. }
  213. }
  214. else {
  215. attrArray.push({
  216. sheetIndex: sheetIndex_c,
  217. row: span[0].row,
  218. col: span[0].col + span[0].colCount,
  219. value: item.value,
  220. type: ''
  221. })
  222. }
  223. }
  224. }
  225. });
  226. }
  227. }
  228. }
  229. }
  230. layer.msg("自动设置成功", {
  231. time: 200
  232. });
  233. }
  234. );
  235. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址