check_detail.html 68 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>标注中心</title>
  6. <script src="/bower_components/jquery/dist/jquery.min.js"></script>
  7. <link href="/dist/css/normalize.min.css" rel="stylesheet">
  8. <link href="/dist/css/animate.min.css" rel="stylesheet">
  9. <link rel="stylesheet" href="/dist/css/zz.css">
  10. <link rel="stylesheet" href="/dist/css/index.css">
  11. <script src="/dist/js/vue.min.js"></script>
  12. <script src="/dist/js/index.js"></script>
  13. <style>
  14. .add-tip {
  15. width: 24px;
  16. height: 22px;
  17. line-height: 22px;
  18. text-align: center;
  19. color: #fff;
  20. margin: 0;
  21. padding: 0;
  22. border: 1px solid #ccc;
  23. background-color: #fdfdfd;
  24. }
  25. .info-box > * {
  26. cursor: pointer;
  27. }
  28. .button-group {
  29. display: flex;
  30. flex-direction: row;
  31. align-items: center;
  32. justify-content: space-between;
  33. }
  34. .button-group .info-box {
  35. margin-left: -60px;
  36. }
  37. .edit-box .edit.two .edit-title {
  38. padding-right: 4px;
  39. }
  40. .edit-box .edit .edit-input .label > span {
  41. max-width: unset;
  42. text-align: left;
  43. padding: 0 1em;
  44. }
  45. .a-button {
  46. color: #4169e3;
  47. margin: 8px 15px;
  48. padding: 4px 10px;
  49. }
  50. .button-box.delete-box {
  51. margin-right: 22px !important;
  52. margin-left: -419px !important;
  53. }
  54. .button-box.delete-box .pass {
  55. background-color: #f56c6c !important;
  56. }
  57. .pass.success {
  58. background-color: #09bb07 !important;
  59. }
  60. .pass.default {
  61. background-color: #adadad !important;
  62. }
  63. .el-table td, .el-table th {
  64. padding: 4px 0;
  65. }
  66. .top-button-group {
  67. margin-top: 20px;
  68. }
  69. .top-button-group button {
  70. margin-bottom: 12px;
  71. }
  72. .el-radio-button--mini.info .el-radio-button__inner {
  73. color: #909399 !important;
  74. background: #f4f4f5 !important;
  75. border-color: #d3d4d6 !important;
  76. }
  77. .default .el-radio-button__orig-radio + .el-radio-button__inner {
  78. color: #409eff;
  79. background: #ecf5ff;
  80. border-color: #b3d8ff;
  81. }
  82. .success .el-radio-button__orig-radio + .el-radio-button__inner {
  83. color: #67c23a;
  84. background: #f0f9eb;
  85. border-color: #c2e7b0;
  86. }
  87. .success .el-radio-button__orig-radio:checked + .el-radio-button__inner,
  88. .default .el-radio-button__orig-radio:checked + .el-radio-button__inner {
  89. color: #FFF;
  90. background-color: #409EFF;
  91. border-color: #409EFF;
  92. -webkit-box-shadow: -1px 0 0 0 #409EFF;
  93. box-shadow: -1px 0 0 0 #409EFF
  94. }
  95. </style>
  96. <script>
  97. function prettyPrint(obj) {
  98. var ENDLINE = "\n";
  99. var COMMA_ENDLINE = ",\n";
  100. var OBJ_BEGIN = "{";
  101. var OBJ_END = "}";
  102. var ARR_BEGIN = "[";
  103. var ARR_END = "]";
  104. var INDNET_SPACES = 4;
  105. return (function innerPrettyPrint(obj, spaces) {
  106. var type = typeof obj;
  107. if (type == "number" || type == "boolean") {
  108. return obj.toString();
  109. } else if (type == "string") {
  110. if (obj != "" && !isNaN(Number(obj))) {
  111. return Number(obj)
  112. }
  113. return '"' + obj + '"';
  114. } else {
  115. var entries = [];
  116. var thisIndent = ' '.repeat(spaces);
  117. var subIndent = thisIndent + ' '.repeat(INDNET_SPACES);
  118. var subSpaces = spaces + INDNET_SPACES;
  119. if (Object.prototype.toString.call(obj) == '[object Object]') {
  120. for (var k in obj) {
  121. entries.push('"' + k + '": ' + innerPrettyPrint(obj[k], subSpaces));
  122. }
  123. return OBJ_BEGIN + ENDLINE + subIndent + entries.join(COMMA_ENDLINE + subIndent) + ENDLINE + thisIndent + OBJ_END;
  124. } else if (Object.prototype.toString.call(obj) == '[object Array]') {
  125. obj.forEach(function (a) {
  126. entries.push(innerPrettyPrint(a, subSpaces));
  127. });
  128. return ARR_BEGIN + ENDLINE + subIndent + entries.join(COMMA_ENDLINE + subIndent) + ENDLINE + thisIndent + ARR_END;
  129. } else if (obj === null) {
  130. return "null";
  131. } else {
  132. return obj.toString();
  133. }
  134. }
  135. })(obj, 0);
  136. }
  137. </script>
  138. </head>
  139. <body>
  140. <main id="app">
  141. <div class="content" :class="{mm:showPop}">
  142. <!--文章区-->
  143. <div class="article">
  144. <div class="top-button-group">
  145. <el-radio-group v-model="activeLabel" size="mini">
  146. <el-radio-button class="default" label="原文"></el-radio-button>
  147. {{if .T.info.filetext}}
  148. <el-radio-button class="default" label="附件"></el-radio-button>
  149. {{end}}
  150. </el-radio-group>
  151. <el-radio-group v-model="activeLabel" v-for="(item, index) in otherInfo" size="mini">
  152. <el-radio-button class="success" :label="item.id">[[item.subtype]]</el-radio-button>
  153. <el-radio-button class="success" :label="item.id + '-附件'">附件</el-radio-button>
  154. </el-radio-group>
  155. <el-radio-group v-if="moreInfo&&moreInfo.length > 0" size="mini">
  156. <el-popover
  157. placement="right-end"
  158. trigger="hover">
  159. <el-table :data="moreInfo" max-height="300">
  160. <el-table-column width="50" property="subtype" label="类型"></el-table-column>
  161. <el-table-column width="180" property="publishtime" label="发布日期"></el-table-column>
  162. <el-table-column width="220" property="title" label="标题">
  163. <template slot-scope="scope">
  164. <a href="#" @click="openLink(scope.row.href)">[[scope.row.title]]</a>
  165. </template>
  166. </el-table-column>
  167. </el-table>
  168. <el-radio-button class="info" slot="reference" style="border-color: #d3d4d6;">更多
  169. </el-radio-button>
  170. </el-popover>
  171. </el-radio-group>
  172. </div>
  173. <hr style="border: 1px;" width="100%">
  174. <br><a v-if="getPageInfo.href.length > 0" :href="getPageInfo.href" target="_blank">查看原文</a>
  175. <!--<a href="{{.T.jyhref}}" target="_blank">剑鱼链接</a>-->
  176. <h3>[[getPageInfo.title]]</h3><br>
  177. <div v-html="pageHtml"></div>
  178. </div>
  179. <!--操作区-->
  180. <div class="operation">
  181. <!--edit-box-->
  182. <div class="edit-box">
  183. <!--edit-->
  184. <div class="edit one" v-for="(one,oindex) in editData" :key="oindex">
  185. <!--one-->
  186. <div class="edit-title" @click="one.show = !one.show">
  187. <span>[[one.title]]</span>
  188. <div class="button-group">
  189. <div v-if="one.showCheck">
  190. <input :id="one.title" v-show="one.title == '标的信息'" @click.stop type="checkbox"
  191. v-model="one.checkAllTag">
  192. <label @click.stop v-show="one.title == '标的信息'" :for="one.title">全部标注</label>
  193. </div>
  194. <!-- &nbsp;
  195. <div v-if="one.showCheck">
  196. <input :id="one.title" @click.stop type="checkbox" v-model="one.checkType">
  197. <label @click.stop :for="one.title">是否抽取</label>
  198. </div>-->
  199. <div class="button-box">
  200. <!--v-show="one.title == '基本字段'"-->
  201. <button class="pass success" @click.stop="saveDataOne(one,'1')"
  202. style="font-size: 14px;width: auto;float:left;">通过
  203. </button>
  204. <button class="pass default" @click.stop="saveDataOne(one,'-1')"
  205. style="font-size: 14px;width: auto;float:left">取消
  206. </button>
  207. <!-- <button class="pass" @click.stop="open(one, true)" style="font-size: 14px;width: auto;float:left">保存</button>-->
  208. </div>
  209. <!--<button class="add" v-show="one.title != '基本'" @click.stop="one.content.push(getTemp(2));goMark2(500)">+</button>-->
  210. <!--<button class="add" v-show="one.title == '基本'" @click.stop="one.content[0].content.push(getTemp(3));goMark2(60)">+</button>-->
  211. <div class="info-box" @click.stop v-show="one.showCheck">
  212. <div :class="{default: one.status == '-1'}" @click="setStatus(one,'-1')"></div>
  213. <!--<div :class="{ok: one.status == '1'}" @click="one.status = '1'"></div>-->
  214. <div :class="{ok: one.status == '1'}" @click="setStatus(one,'1')"></div>
  215. <!--<div :class="{err: one.status == '0'}" @click="one.status = '0'"></div>-->
  216. <div class="add-tip" :class="{err: (one.status != '1' && one.status != '-1')}"
  217. @click="setStatus(one,'2')"></div>
  218. </div>
  219. </div>
  220. </div>
  221. <transition tag="div">
  222. <div>
  223. <div class="button-box" v-if="one.showCheck&&one.show">
  224. <button class="pass a-button" @click.stop="addChild(one, oindex)"
  225. style="font-size: 14px;width: auto;float:left;">新增[[one.title]]
  226. </button>
  227. </div>
  228. <div class="edit-content" :class="{t:one.title == '基本字段'}" v-show="one.show">
  229. <!--two-->
  230. <span v-show="one.content.length === 0">当前您还没有添加子包</span>
  231. <div class="edit two" v-for="(two,index) in one.content" :key="index">
  232. <div class="edit-title" v-if="two.title" @click="two.show = !two.show">
  233. <span>[[two.title]]</span>
  234. <div class="button-box"
  235. :style="one.title == '多包信息' ? 'margin-right: 193px' : ''">
  236. <button v-if="one.title == '多包信息'" class="pass a-button"
  237. @click.stop="addThreeChild(two,'2',one)"
  238. style="font-size: 14px;margin: 0;width: auto;float:left;">新增子包中标信息
  239. </button>
  240. <button class="pass success" @click.stop="saveDataTwo(two,'1',one)"
  241. style="font-size: 14px;width: auto;float:left;">通过
  242. </button>
  243. <button class="pass default" @click.stop="saveDataTwo(two,'-1',one)"
  244. style="font-size: 14px;width: auto;float:left">取消
  245. </button>
  246. </div>
  247. <div class="button-box delete-box">
  248. <button class="pass" @click.stop="delNewTwo(one, index, two)">删除</button>
  249. </div>
  250. </div>
  251. <transition tag="div">
  252. <div class="edit-content" v-show="two.show">
  253. <!--input-->
  254. <div class="edit-input">
  255. <div v-for="(uin, uindex) of two.uInput" class="input-box"
  256. :key="uin.title">
  257. <div class="label" v-if="uin.selectArr">
  258. <span>[[uin.title]]&nbsp;:&nbsp;</span>
  259. <select v-model="uin.select"
  260. @change="focusFn(uin, oindex,index,uindex, two, one)">
  261. <option disabled value="">请选择</option>
  262. <option v-for="o in uin.selectArr">[[o]]</option>
  263. </select>
  264. <div class="info-box">
  265. <div :class="{default: uin.status == '-1'}"
  266. @click="setStatus(uin,'-1', two, one)"></div>
  267. <div :class="{ok: uin.status == '1'}"
  268. @click="setStatus(uin,'1', two, one)"></div>
  269. <!--<div :class="{err: uin.status == '0'}" @click="uin.status = '0'"></div>-->
  270. <div class="add-tip" @click="setStatus(uin,'2', two, one)"
  271. :class="{err: (uin.status != '1' && uin.status != '-1')}"></div>
  272. </div>
  273. </div>
  274. <div class="label" v-else :title="uin.input">
  275. <span @click="goText(uin.title)">[[uin.title]]&nbsp;:&nbsp;</span>
  276. <input type="text" v-model="uin.input"
  277. @focus="goText(uin.input)" @click="goText(uin.input)"
  278. @blur="focusFn(uin, oindex, index, uindex,two,one)">
  279. <div class="info-box">
  280. <div :class="{default: uin.status == '-1'}"
  281. @click="setStatus(uin,'-1', two, one)"></div>
  282. <div :class="{ok: uin.status == '1'}"
  283. @click="setStatus(uin,'1', two, one)"></div>
  284. <!--<div :class="{err: uin.status == '0'}" @click="uin.status = '0'"></div>-->
  285. <div class="add-tip" @click="setStatus(uin,'2', two, one)"
  286. :class="{err: (uin.status != '1' && uin.status != '-1')}"></div>
  287. </div>
  288. </div>
  289. </div>
  290. </div>
  291. <!--three-->
  292. <!--<div>
  293. <div class="edit-title" v-show="one.title == '基本字段'">
  294. <span>候选人</span>
  295. <div class="info-box" >
  296. <div :class="{default: two.wstatus == '-1'}" @click="two.wstatus = '-1'"></div>
  297. <div :class="{ok: two.wstatus == '1'}" @click="two.wstatus = '1'"></div>
  298. <el-popover trigger="click" >
  299. <div style="text-align: right; margin: 0">
  300. <el-button type="success" size="mini" @click="two.wstatus = '2'">新增</el-button>
  301. <el-button type="warning" size="mini" @click="two.wstatus = '3'">修改</el-button>
  302. <el-button type="danger" size="mini" @click="two.wstatus = '4'">删除</el-button>
  303. </div>
  304. <div class="add-tip" slot="reference" :class="{err: (two.wstatus != '1' && two.wstatus != '-1')}">[[textMap[two.wstatus] || '']]</div>
  305. </el-popover>
  306. </div>
  307. </div>
  308. <div class="edit three" v-for="(three,index) in two.content" :key="index">
  309. <div class="edit-title" @click="three.show = !three.show">
  310. <span>[[three.title]]</span>
  311. </div>
  312. <div class="edit-content" v-show="three.show">
  313. <div class="edit-input">
  314. <div class="input-box" v-for="(threeUin,index) in three.uInput" :key="threeUin.title">
  315. <div class="label">
  316. <span @click="goText(threeUin.title)">[[threeUin.title]]&nbsp;:&nbsp;</span>
  317. <input type="text" v-model="threeUin.input" @focus="goText(threeUin.input)" @click="goText(threeUin.input)">
  318. <div class="info-box">
  319. <div :class="{default: threeUin.status == '-1'}" @click="threeUin.status = '-1'"></div>
  320. <div :class="{ok: threeUin.status == '1'}" @click="threeUin.status = '1'"></div>
  321. <el-popover trigger="click" >
  322. <div style="text-align: right; margin: 0">
  323. <el-button type="success" size="mini" @click="threeUin.status = '2'">新增</el-button>
  324. <el-button type="warning" size="mini" @click="threeUin.status = '3'">修改</el-button>
  325. <el-button type="danger" size="mini" @click="threeUin.status = '4'">删除</el-button>
  326. </div>
  327. <div class="add-tip" slot="reference" :class="{err: (threeUin.status != '1' && threeUin.status != '-1')}">[[textMap[threeUin.status] || '']]</div>
  328. </el-popover>
  329. </div>
  330. </div>
  331. </div>
  332. </div>
  333. </div>
  334. </div>
  335. </div>-->
  336. </div>
  337. </transition>
  338. </div>
  339. </div>
  340. </div>
  341. </transition>
  342. </div>
  343. </div>
  344. <div class="save-box">
  345. <!-- <button class="code" @click.stop="showPop = true" style="width:100px">源码</button>&nbsp;&nbsp;-->
  346. <!-- <button class="code" @click.stop="open(1)" style="width:100px">全部验证</button> -->
  347. <!-- <button class="code" @click.stop="open(2)" style="width:100px">字段验证</button>-->
  348. <button class="code" @click.stop="open(2)" style="width:100px">保存</button>&nbsp;&nbsp;
  349. <button class="code" @click.stop="openHref" style="width:100px">下一条</button>
  350. <!--<button class="code" @click.stop="window.location.href='/'" style="width:100px">下一条</button>-->
  351. </div>
  352. </div>
  353. </div>
  354. <!--弹出层-->
  355. <dialog class="dialog" v-if="showPop">
  356. <span class="close" @click="showPop = false;changeText()">x</span>
  357. <div class="pop">
  358. <div class="title">源码</div>
  359. <div class="con" ref="text" contentEditable="true">
  360. <pre v-html="addStyle(editData)"></pre>
  361. </div>
  362. <button @click="showPop = false;changeText();upChange()">保&nbsp;存</button>
  363. </div>
  364. </dialog>
  365. <dialog id="com-alert" class="dialog" style="background: rgba(124, 124, 125, 0.1);z-index:9999;display: none;">
  366. <div class="pop" style="background: rgba(124, 124, 125, 0.1);">
  367. <div id="com-alert-val" class="title" style="color:red">保存成功</div>
  368. </div>
  369. </dialog>
  370. </main>
  371. </body>
  372. <script>
  373. let did = {{ .T.did }} // 数据id
  374. let pid = {{ .T.pid }} // 项目id
  375. let coll = {{ .T.coll }} // 表名
  376. var allCheckFields = {{ .T.fields }} //本次需标注的所有字段
  377. console.log(allCheckFields)
  378. var moreInfo = {{ .T.moreInfo }} // 更多关联信息
  379. var otherInfo = {{ .T.otherInfo }} //公告关联信息
  380. let purchasing_status = {{ .T.ck_purchasinglist }} //标的物标记
  381. let purchasing_all_tag = {{ .T.ck_pclistag }} // 标的物是否全部标记
  382. let package_status = {{ .T.ck_package }} //包标记
  383. let winneroder_status = {{ .T.ck_winnerorder }} //中标候选人标记
  384. // 页面数据
  385. var pageDataMap = {
  386. '原文': {
  387. title: '{{.T.info.title}}',
  388. href: '{{.T.info.href}}',
  389. // html: '{{Html (Regexp (Regexp .T.info.detail "(\\n|\\\\n)\\s+" "\n") "(`|\\n|\\\\n)+" "<br/>")}}',
  390. html: '{{ .T.info.detail }}',
  391. },
  392. '附件': {
  393. title: '附件内容',
  394. href: '',
  395. // html:{{if .T.info.filetext}}{{.T.info.filetext}}.replace(/(\\n|\\\\n)\\s+/, '\n').replace(/(`|\\n|\\\\n)+/, '<br>'){{else}}``{{end}} }
  396. html: '{{ .T.info.filetext }}',
  397. },
  398. }
  399. //快捷键
  400. $(document).keydown(function (event) {
  401. if (!event.shiftKey) {
  402. var text = getSelectedContents();//获取选中文本
  403. if (!text.trim().length) {
  404. return
  405. }
  406. }
  407. if (event.keyCode === 82) {//项目名称快捷键r
  408. if (event.shiftKey) {
  409. app.changeBaseValue(0, '', 2) //删除对应文本
  410. } else {
  411. app.changeBaseValue(0, text, 2)//填充
  412. }
  413. } else if (event.keyCode === 81) {//省份快捷键q
  414. if (event.shiftKey) {
  415. app.changeBaseValue(1, '', 2) //删除对应文本
  416. } else {
  417. app.changeBaseValue(1, text, 2)//填充
  418. }
  419. } else if (event.keyCode === 84) {//项目编号快捷键t
  420. if (event.shiftKey) {
  421. app.changeBaseValue(2, '', 2) //删除对应文本
  422. } else {
  423. app.changeBaseValue(2, text, 2)//填充
  424. }
  425. } else if (event.keyCode === 87) {//城市快捷键w
  426. if (event.shiftKey) {
  427. app.changeBaseValue(3, '', 2) //删除对应文本
  428. } else {
  429. app.changeBaseValue(3, text, 2)//填充
  430. }
  431. } else if (event.keyCode === 69) {//区县快捷键e
  432. if (event.shiftKey) {
  433. app.changeBaseValue(5, '', 2) //删除对应文本
  434. } else {
  435. app.changeBaseValue(5, text, 2)//填充
  436. }
  437. } else if (event.keyCode === 65) {//预算快捷键a
  438. if (event.shiftKey) {
  439. app.changeBaseValue(6, '', 2) //删除对应文本
  440. } else {
  441. app.changeBaseValue(6, text, 2)//填充
  442. }
  443. } else if (event.keyCode === 90) {//中标金额快捷键z
  444. if (event.shiftKey) {
  445. app.changeBaseValue(7, '', 2) //删除对应文本
  446. } else {
  447. app.changeBaseValue(7, text, 2)//填充
  448. }
  449. } else if (event.keyCode === 83) {//采购单位快捷键s
  450. if (event.shiftKey) {
  451. app.changeBaseValue(8, '', 2) //删除对应文本
  452. } else {
  453. app.changeBaseValue(8, text, 2)//填充
  454. }
  455. } else if (event.keyCode === 88) {//代理机构快捷键x
  456. if (event.shiftKey) {
  457. app.changeBaseValue(9, '', 2) //删除对应文本
  458. } else {
  459. app.changeBaseValue(9, text, 2)//填充
  460. }
  461. } else if (event.keyCode === 68) {//中标单位快捷键d
  462. if (event.shiftKey) {
  463. app.changeBaseValue(10, '', 2) //删除对应文本
  464. } else {
  465. app.changeBaseValue(10, text, 2)//填充
  466. }
  467. }
  468. });
  469. //获取鼠标选中的文本
  470. function getSelectedContents() {
  471. var text = "";
  472. if (window.getSelection) { //chrome,firefox,opera
  473. var range = window.getSelection().getRangeAt(0);
  474. var container = document.createElement('div');
  475. container.appendChild(range.cloneContents());
  476. text = container.innerHTML;
  477. //return container.innerHTML;
  478. //return window.getSelection(); //只复制文本
  479. } else if (document.getSelection) { //其他
  480. var range = document.getSelection().getRangeAt(0);
  481. var container = document.createElement('div');
  482. container.appendChild(range.cloneContents());
  483. text = container.innerHTML;
  484. //return container.innerHTML;
  485. //return document.getSelection(); //只复制文本
  486. } else if (document.selection) { //IE特有的
  487. text = document.selection.createRange().htmlText;
  488. //return document.selection.createRange().htmlText;
  489. //return document.selection.createRange().text; //只复制文本
  490. }
  491. text = text.replace(/(\r|\n|\s+|&nbsp;|<[^>]*>|<\/[^>]*)/g, "")
  492. return text;
  493. }
  494. //记录是否点击保存
  495. var issave = false;
  496. var nextid = {{ .T.nextid }}
  497. //基本信息
  498. var common = {{ .T.common }}
  499. var uInput = [];
  500. for (k in common) {
  501. var tmp = {}
  502. tmp.title = common[k].descript
  503. tmp.input = common[k].value
  504. tmp.key = common[k].key
  505. if (common[k].key === "subtype") {
  506. tmp.select = common[k].value
  507. tmp.selectArr = {{ .T.topsubtype }}
  508. }
  509. if (common[k].key === "attach_discern") {
  510. tmp.select = common[k].value
  511. tmp.selectArr = ['识别有效', '识别无效']
  512. }
  513. if (common[k].key === "attach_ext") {
  514. tmp.select = common[k].value
  515. tmp.selectArr = ['抽取正确', '抽取错误']
  516. }
  517. if (common[k].key === "isrepeat") {
  518. tmp.select = common[k].value
  519. tmp.selectArr = ['是', '否']
  520. }
  521. tmp.status = common[k].status
  522. if (common[k].key === "bidamounttype") {
  523. tmp.select = common[k].value ? common[k].value : '金额'
  524. tmp.selectArr = ['金额', '折扣率', '单价']
  525. tmp.status = 1
  526. }
  527. uInput[k] = tmp
  528. }
  529. //时间地点
  530. var timeplace = {{ .T.timeplace }}
  531. var tpInput = [];
  532. for (k in timeplace) {
  533. var tmp = {}
  534. tmp.title = timeplace[k].descript
  535. tmp.input = timeplace[k].value
  536. tmp.key = timeplace[k].key
  537. tmp.status = timeplace[k].status
  538. tpInput[k] = tmp
  539. }
  540. //其他信息
  541. var other = {{ .T.other }}
  542. var otherInput = [];
  543. for (k in other) {
  544. var tmp = {}
  545. tmp.title = other[k].descript
  546. tmp.input = other[k].value
  547. tmp.key = other[k].key
  548. tmp.status = other[k].status
  549. if (other[k].key === "isppp" || other[k].key === "contract_guarantee" || other[k].key === "bid_guarantee") {
  550. tmp.select = other[k].value
  551. tmp.selectArr = ['是', '否']
  552. }
  553. otherInput[k] = tmp
  554. }
  555. //中标候选人
  556. var c_worder = {{ .T.worder }}
  557. var worder_new = {{ .T.worder_new }}
  558. var c_content = [];
  559. for (k in c_worder) {
  560. var c_uInput = [];
  561. for (i in c_worder[k]) {
  562. var tmp = {}
  563. tmp.title = c_worder[k][i].descript
  564. tmp.input = c_worder[k][i].value || ''
  565. tmp.key = c_worder[k][i].key
  566. tmp.status = c_worder[k][i].status
  567. c_uInput[i] = tmp
  568. }
  569. var content = {};
  570. content.title = "候选人"
  571. content.show = true
  572. content.status = worder_new[k]["status"]
  573. content.uInput = c_uInput
  574. content.isnew = worder_new[k]["isnew"] || false
  575. content.content = []
  576. c_content[k] = content
  577. }
  578. //标的信息
  579. var purchasinglist = {{ .T.purchasinglist }}
  580. var pcl_new = {{ .T.pcl_new }}
  581. var pcl_content = [];
  582. for (k in purchasinglist) {
  583. var c_uInput = [];
  584. for (i in purchasinglist[k]) {
  585. var tmp = {}
  586. tmp.title = purchasinglist[k][i].descript
  587. tmp.input = purchasinglist[k][i].value
  588. tmp.key = purchasinglist[k][i].key
  589. tmp.status = purchasinglist[k][i].status
  590. //if(purchasinglist[k][i].key== "pclisover"){
  591. // tmp.select = purchasinglist[k][i].value ? purchasinglist[k][i].value : '是'
  592. // //tmp.select=purchasinglist[k][i].value
  593. // tmp.selectArr=['是','否']
  594. //}
  595. c_uInput[i] = tmp
  596. }
  597. var content = {};
  598. content.title = "标的物"
  599. content.show = true
  600. content.status = pcl_new[k]["status"]
  601. content.uInput = c_uInput
  602. content.isnew = pcl_new[k]["isnew"] || false
  603. content.content = []
  604. pcl_content[k] = content
  605. }
  606. //var ispackage='{{.T.ispackage}}'
  607. //子包信息
  608. var packs = {{ .T.packs }}
  609. var packskey = {{ .T.packskey }}
  610. var pkg_new = {{ .T.pkg_new }}
  611. //分包抽查,若果有分包,默认ok
  612. //if(packs.length>0&&ispackage=="1"){
  613. // ck_package="1"
  614. //}
  615. var p_content = [];
  616. for (k in packs) {
  617. //子包基本信息
  618. var uInputs = [];
  619. var pack = packs[k]["pack"]
  620. for (i in pack) {
  621. var tmp = {}
  622. tmp.title = pack[i].descript
  623. tmp.input = pack[i].value
  624. tmp.key = pack[i].key
  625. tmp.status = pack[i].status
  626. if (pack[i].key === "bidamounttype") {
  627. tmp.select = pack[i].value ? pack[i].value : '金额'
  628. tmp.selectArr = ['金额', '折扣率', '单价']
  629. tmp.status = 1
  630. }
  631. uInputs[i] = tmp
  632. }
  633. //中标人信息
  634. var winnerall = packs[k]["winnerall"]
  635. for (i in winnerall) {
  636. var tmp = {}
  637. tmp.title = winnerall[i].descript
  638. tmp.input = winnerall[i].value
  639. tmp.key = winnerall[i].key
  640. tmp.status = winnerall[i].status
  641. uInputs.push(tmp)
  642. }
  643. var content = {};
  644. content.title = "子包";
  645. content.show = true;
  646. content.status = packs[k]["packstatus"];
  647. content.uInput = uInputs;
  648. content.isnew = pkg_new[k] || false
  649. content.num = packskey[k];
  650. p_content[k] = content;
  651. }
  652. var pclf = {{ .T.PurchasinglistField }}
  653. var pclfInput = []
  654. for (i in pclf) {
  655. for (key in pclf[i]) {
  656. var tempNode = {
  657. input: "",
  658. key: key,
  659. status: "2",
  660. title: pclf[i][key]
  661. }
  662. //if(key== "pclisover"){
  663. // tempNode.select= '是'
  664. // tempNode.selectArr=['是','否']
  665. //}
  666. pclfInput.push(tempNode)
  667. }
  668. }
  669. var wodf = {{ .T.WinnerorderField }}
  670. var wodfInput = []
  671. for (i in wodf) {
  672. for (key in wodf[i]) {
  673. wodfInput.push({
  674. input: "",
  675. key: key,
  676. status: "2",
  677. title: wodf[i][key]
  678. })
  679. }
  680. }
  681. var pf = {{ .T.PackageField }}
  682. var pfInput = []
  683. for (i in pf) {
  684. for (key in pf[i]) {
  685. var tempNode = {
  686. input: "",
  687. key: key,
  688. status: "2",
  689. title: pf[i][key]
  690. }
  691. if (key === "bidamounttype") {
  692. tempNode.select = '金额'
  693. tempNode.selectArr = ['金额', '折扣率', '单价']
  694. }
  695. pfInput.push(tempNode)
  696. }
  697. }
  698. var app = new Vue({
  699. el: '#app',
  700. delimiters: ["[[", "]]"],
  701. data: {
  702. activeLabel: '原文',
  703. nowLabel: ['原文'],
  704. otherInfo: otherInfo,
  705. moreInfo: moreInfo,
  706. scrollCache: {
  707. value: '',
  708. index: 0
  709. },
  710. textMap: ['', '', '增', '改', '删'],
  711. // pageHtml: `{{Html (Regexp (Regexp .T.info.detail "(\\n|\\\\n)\\s+" "\n") "(`|\\n|\\\\n)+" "<br/>")}}`,
  712. pageHtml: '{{ .T.info.detail }}',
  713. showPop: false,
  714. editData:[{
  715. title: '基本字段',
  716. show: true,
  717. status: "1",
  718. content: [{
  719. title: '',
  720. show: true,
  721. delete: false,
  722. //wstatus:"-1",
  723. uInput: uInput
  724. //content: c_content
  725. }]
  726. }, {
  727. title: '时间地点',
  728. show: false,
  729. status: "1",
  730. content: [{
  731. title: '',
  732. show: true,
  733. delete: false,
  734. //wstatus:"-1",
  735. uInput: tpInput
  736. }]
  737. }, {
  738. title: '标的信息',
  739. show: false,
  740. showCheck: true,
  741. key: 'purchasinglist',
  742. //checkType: {{.T.ck_pclisext}},
  743. checkAllTag: purchasing_all_tag,
  744. status: purchasing_status,
  745. content: pcl_content
  746. }, {
  747. title: '多包信息',
  748. show:false,
  749. showCheck: true,
  750. key: 'package',
  751. // checkType: {{.T.ck_pkgisext}},
  752. status: package_status,
  753. content: p_content
  754. }, {
  755. title: '中标候选人信息',
  756. show: false,
  757. showCheck: true,
  758. key: 'winnerorder',
  759. // checkType: {{.T.ck_wodrisext}},
  760. status: winneroder_status,
  761. content: c_content
  762. }, {
  763. title: '其余信息',
  764. show:false,
  765. status:"1",
  766. content:[{
  767. title: '',
  768. show: true,
  769. delete: false,
  770. //wstatus:"-1",
  771. uInput: otherInput
  772. }]
  773. }],
  774. originData: []},
  775. watch: {
  776. //切换标签时更改正文内容
  777. 'activeLabel':
  778. function () {
  779. this.pageHtml = this.getPageInfo.html
  780. }},
  781. computed: {
  782. getPageInfo() {
  783. var tempData = {
  784. title: '',
  785. html: this.pageHtml,
  786. href: ''
  787. }
  788. //匹配原文或者原文附件
  789. var originData = pageDataMap[this.activeLabel]
  790. if (originData) {
  791. tempData.title = originData.title
  792. tempData.html = originData.html
  793. tempData.href = originData.href
  794. } else {//匹配原公告关联信息
  795. var tempS = this.activeLabel.split('-')
  796. var isFile = tempS.length === 2
  797. var otherData = this.otherInfo.filter(v => v.id == tempS[0])
  798. if (otherData.length > 0) {
  799. tempData.title = otherData[0].title
  800. tempData.html = otherData[0].detail
  801. tempData.href = otherData[0].href
  802. if (isFile) {
  803. tempData.title = '附件内容'
  804. tempData.html = otherData[0].filetext
  805. tempData.href = ''
  806. }
  807. }
  808. }
  809. return tempData
  810. }
  811. },
  812. mounted() {
  813. // 缓存原始数据
  814. this.originData = JSON.parse(JSON.stringify([].concat(this.editData)))
  815. },
  816. methods: {
  817. // 当前输入框数据与原始数据比较
  818. focusFn(uin, oIndex, tIndex, uIndex, two, one) {
  819. if (uin.key === "bidendtime" || uin.key === "bidopentime" || uin.key === "project_startdate" || uin.key === "project_completedate" ||
  820. uin.key === "publishtime" || uin.key === "signaturedate") {
  821. var val = uin.input
  822. if (val !== "") {
  823. var reg = /^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\s+(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d$/;
  824. var regExp = new RegExp(reg);
  825. if (!regExp.test(val)) {
  826. this.$message({
  827. message: uin.title + ",日期格式错误!正确格式:2006-01-02 15:04:05",
  828. type: 'warning',
  829. duration: 2000,
  830. offset: 300
  831. });
  832. return
  833. }
  834. }
  835. }
  836. var newNode = this.originData[oIndex].content[tIndex]
  837. if (newNode == null) {//新增子模块处理
  838. return
  839. }
  840. var oNode = newNode.uInput[uIndex]
  841. if (oNode == null) {//新增中标人信息处理
  842. return
  843. }
  844. var changeStatus = uin.input === oNode.input//多包中新增的中标信息报错
  845. if (uin.select) {
  846. changeStatus = uin.select === oNode.select
  847. }
  848. uin.status = changeStatus ? "1" : "2"
  849. this.setStatus(uin, uin.status, two, one);
  850. },
  851. openLink(link) {
  852. window.open(link, '_blank')
  853. },
  854. // 改变基本字段属性
  855. changeBaseValue(index, input, status) {
  856. if (this.editData[0].content[0].uInput[index].input !== input) {
  857. this.editData[0].content[0].uInput[index].input = input
  858. this.editData[0].content[0].uInput[index].status = status
  859. }
  860. },
  861. selectChange(uni, status, two, one) {
  862. //状态更新
  863. if (uni.status === '-1' || uni.status === '2') {
  864. status = "2"
  865. }
  866. this.setStatus(uni, status, two, one)
  867. },
  868. openHref() {
  869. if (!issave) {
  870. alert("请先保存数据!")
  871. } else {
  872. if (nextid === "") {
  873. showMsg("数据已经全部标注完")
  874. } else {
  875. window.location.href = "/front/user/remark/list?pid="+pid+"&tid="+tid+"&s_sourceinfo="+coll
  876. }
  877. }
  878. },
  879. // 检查一级是否需要改变状态
  880. checkOneStatus: function (config) {
  881. var tempObj = {
  882. obj: config.type ? config.one : config.two
  883. }
  884. if (config.type) {
  885. tempObj.list = config.one.content
  886. } else {
  887. tempObj.list = config.two.uInput
  888. }
  889. var statusList = [0, 0, 0, 0, 0]
  890. for (var i in tempObj.list) {
  891. var tempList = tempObj.list[i]
  892. var tempIndex = Number(tempList.status)
  893. if (tempIndex === -1) {
  894. tempIndex = 0
  895. }
  896. statusList[tempIndex] = Number(statusList[tempIndex]) + 1
  897. }
  898. if (statusList[1] > 0) {
  899. tempObj.obj.status = "1"
  900. }
  901. if (statusList[4] > 0 || statusList[3] > 0 || statusList[2] > 0) {
  902. tempObj.obj.status = "2"
  903. }
  904. if (statusList[4] === tempObj.list.length) {
  905. tempObj.obj.status = "4"
  906. if (tempObj.obj.title === "标的信息" || tempObj.obj.title === "多包信息" || tempObj.obj.title === "中标候选人信息") {
  907. tempObj.obj.status = "2"
  908. }
  909. }
  910. if (statusList[3] === tempObj.list.length) {
  911. tempObj.obj.status = "2"
  912. }
  913. if (statusList[2] === tempObj.list.length) {
  914. tempObj.obj.status = "2"
  915. }
  916. if (statusList[0] === tempObj.list.length) {
  917. tempObj.obj.status = "-1"
  918. }
  919. if (!config.type) {
  920. this.checkOneStatus({
  921. one: config.one,
  922. two: config.two,
  923. type: true
  924. })
  925. }
  926. },
  927. //切换状态按钮
  928. setStatus:function (witch, s, two, one) {
  929. var key = witch.key
  930. //校验日期格式
  931. if (key === "bidendtime" || key === "bidopentime" || key === "project_startdate" || key === "project_completedate" ||
  932. key === "publishtime" || key === "signaturedate") {
  933. var val = witch.input
  934. if (val !== "") {
  935. var reg = /^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\s+(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d$/;
  936. var regExp = new RegExp(reg);
  937. if (!regExp.test(val)) {
  938. this.$message({
  939. message: witch.title + ",日期格式错误!正确格式:2006-01-02 15:04:05",
  940. type: 'warning',
  941. duration: 2000,
  942. offset: 300
  943. });
  944. //alert(witch.title+",日期格式错误!正确格式:2006-01-02 15:04:05")
  945. return
  946. }
  947. }
  948. }
  949. if (s === '2' && !one && !two && witch.content.length === 0) {
  950. return
  951. }
  952. witch.status = s;
  953. if (two) {
  954. this.checkOneStatus({
  955. one: one,
  956. two: two,
  957. type: false
  958. })
  959. }
  960. },
  961. //二级删除
  962. delNewTwo: function (one, index, two) {
  963. //two.ck_isnew = false //目前点删除按钮页面直接不显示,但是集合索引位置不变,所以加了此代码
  964. //two.show = false
  965. if (two.isnew) {
  966. one.content.splice(index, 1)
  967. } else {
  968. two.show = false
  969. two.status = "4"
  970. this.saveDataTwo(two, "4", one)
  971. }
  972. this.checkOneStatus({
  973. one: one,
  974. two: two,
  975. type: true
  976. })
  977. },
  978. /*add style*/
  979. addStyle: function (data) {
  980. return prettyPrint(data).replace(/(checkAllTag|checkType|showCheck|wstatus|status|key|title|input|content|uInput|selectArr|select|show|true)/g, "<mark>$1</mark>")
  981. },
  982. /*同步修改源码*/
  983. changeText: function (boolean) {
  984. try {
  985. var tempText = JSON.parse(this.$refs.text.innerText.replace(/(\n|\s)/g, ''))
  986. if (boolean) {
  987. this.tagvalues = tempText
  988. } else {
  989. this.editData = tempText
  990. }
  991. } catch (err) {
  992. alert('源码修改失败')
  993. }
  994. },
  995. goText: function (value) {
  996. /*重置Html*/
  997. this.pageHtml = this.getPageInfo.html
  998. if (!value) {
  999. return false
  1000. }
  1001. var rs = new RegExp('(' + value + ')', 'gi')
  1002. //选中input框值文本高亮
  1003. if (rs.test(this.pageHtml)) {
  1004. this.pageHtml = this.pageHtml.replace(rs, '<mark>$1</mark>')
  1005. /*延迟查询dom,防止dom未插入*/
  1006. var $this = this
  1007. setTimeout(function () {
  1008. $this.goMark(value)
  1009. }, 150)
  1010. } else {
  1011. /*重置Html*/
  1012. this.pageHtml = this.getPageInfo.html
  1013. }
  1014. },
  1015. goMark: function (value) {
  1016. var mLength = document.querySelectorAll('mark').length
  1017. if (this.scrollCache.value === value) {
  1018. this.scrollCache.index = (this.scrollCache.index + 1) % mLength
  1019. } else {
  1020. this.scrollCache.index = 0
  1021. }
  1022. this.scrollCache.value = value
  1023. /*滚动到第一个mark*/
  1024. var temp = document.querySelectorAll('mark')[this.scrollCache.index]
  1025. $("mark").removeClass('focus')
  1026. $(temp).addClass('focus')
  1027. document.querySelector('.article').scrollTop = offset(temp).top - window.screen.height / 2
  1028. },
  1029. // markTag:function(n){
  1030. // $.ajax({
  1031. // url:"/markTag",
  1032. // method:"post",
  1033. // data: {tag:n,_id: did},
  1034. // success:function(res){
  1035. // if(res){
  1036. // document.getElementById("com-alert-val").innerHtml="标记成功";
  1037. // var label1 = document.getElementById("com-alert");
  1038. // label1.style.display="block";
  1039. // setTimeout(function(){label1.style.display="none";},1000)
  1040. // }
  1041. // }
  1042. // });
  1043. // },
  1044. addChild: function (one, oindex) {
  1045. var tempNode = {}
  1046. switch (one.title) {
  1047. case "标的信息": {
  1048. tempNode = {
  1049. //content: [],
  1050. show: true,
  1051. isnew: true,
  1052. status: "2",
  1053. title: "标的物",
  1054. uInput: JSON.parse(JSON.stringify(pclfInput))
  1055. }
  1056. break
  1057. }
  1058. case "多包信息": {
  1059. tempNode = {
  1060. //content: [],
  1061. show: true,
  1062. status: "2",
  1063. isnew: true,
  1064. title: "子包",
  1065. uInput: JSON.parse(JSON.stringify(pfInput))
  1066. }
  1067. break
  1068. }
  1069. case "中标候选人信息": {
  1070. tempNode = {
  1071. //content: [],
  1072. show: true,
  1073. status: "2",
  1074. isnew: true,
  1075. title: "候选人",
  1076. uInput: JSON.parse(JSON.stringify(wodfInput))
  1077. }
  1078. break
  1079. }
  1080. }
  1081. // if (one.status >= "2") {
  1082. // one.status = '2'
  1083. // }
  1084. one.content.push(tempNode)
  1085. this.checkOneStatus({
  1086. one: one,
  1087. type: true
  1088. })
  1089. this.$nextTick(() => {
  1090. var tempN = $(".edit.one").eq(oindex).find(".edit-title")
  1091. var goTop = tempN.eq(tempN.length - 1).offset().top
  1092. setTimeout(() => {
  1093. $(".operation").scrollTop($(".operation").scrollTop() + goTop)
  1094. }, 150)
  1095. })
  1096. },
  1097. // 新增子包中标信息字段
  1098. addThreeChild:function (two, n, one) {
  1099. two.uInput.push({
  1100. input: "",
  1101. key: 'winner',
  1102. status: "2",
  1103. title: '标段(包)中标单位'
  1104. })
  1105. two.uInput.push({
  1106. input: "",
  1107. key: 'bidamount',
  1108. status: "2",
  1109. title: '标段(包)中标金额'
  1110. })
  1111. two.status = "2"
  1112. this.checkOneStatus({
  1113. one: one,
  1114. two: two,
  1115. type: false
  1116. })
  1117. },
  1118. //保存
  1119. saveDataTwo:function (two, n, one) {
  1120. two.uInput.forEach(function (v) {
  1121. var key = v.key
  1122. if (key === "bidendtime" || key === "bidopentime" || key === "project_startdate" || key === "project_completedate" ||
  1123. key === "publishtime" || key === "signaturedate") {
  1124. var val = v.input
  1125. if (val !== "") {
  1126. var reg = /^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\s+(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d$/;
  1127. var regExp = new RegExp(reg);
  1128. if (!regExp.test(val)) {
  1129. this.$message({
  1130. message: v.title + ",日期格式错误!正确格式:2006-01-02 15:04:05",
  1131. type: 'warning',
  1132. duration: 2000,
  1133. offset: 300
  1134. });
  1135. //alert(v.title+",日期格式错误!正确格式:2006-01-02 15:04:05")
  1136. return
  1137. }
  1138. }
  1139. }
  1140. if (n === "1" && v.status === "-1") {
  1141. v.status = n
  1142. } else if (n === "-1") {
  1143. v.status = n
  1144. } else if (n === "2") {
  1145. v.status = n
  1146. } else if (n === "4") {
  1147. v.status = n
  1148. }
  1149. });
  1150. two.status = n
  1151. this.checkOneStatus({
  1152. one: one,
  1153. two: two,
  1154. type: false
  1155. })
  1156. /**
  1157. two.content.forEach(function(v) {
  1158. v.uInput.forEach(function(value) {
  1159. if (value.input && value.input != '') {
  1160. value.status = n
  1161. }
  1162. })
  1163. })
  1164. */
  1165. },
  1166. saveDataOne:function (one, n) {
  1167. //保存后的样式
  1168. var _this = this
  1169. one.content.forEach(function (v) {
  1170. v.uInput.forEach(function (value) {
  1171. var key = value.key
  1172. if (n === "1") {
  1173. if (key === "bidendtime" || key === "bidopentime" || key === "project_startdate" || key === "project_completedate" ||
  1174. key === "publishtime" || key === "signaturedate") {
  1175. var val = value.input
  1176. if (val !== "") {
  1177. var reg = /^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\s+(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d$/;
  1178. var regExp = new RegExp(reg);
  1179. if (!regExp.test(val)) {
  1180. this.$message({
  1181. message: value.title + ",日期格式错误!正确格式:2006-01-02 15:04:05",
  1182. type: 'warning',
  1183. duration: 2000,
  1184. offset: 300
  1185. });
  1186. //alert(value.title+",日期格式错误!正确格式:2006-01-02 15:04:05")
  1187. return
  1188. }
  1189. }
  1190. }
  1191. }
  1192. // 取消全部,通过时判断状态是否处于修改新增等
  1193. if (n === "1" && value.status === "-1") {
  1194. value.status = n
  1195. } else if (n === "-1") {
  1196. value.status = n
  1197. }
  1198. })
  1199. _this.checkOneStatus({
  1200. two: v,
  1201. one: one,
  1202. type: false
  1203. })
  1204. });
  1205. },
  1206. //验证保存提示
  1207. open:function (stype) {
  1208. this.$confirm('是否保存?', '提示', {
  1209. confirmButtonText: '确定',
  1210. cancelButtonText: '取消',
  1211. type: 'warning'
  1212. }).then(() => {
  1213. this.upChange(stype)
  1214. }).catch(() => {
  1215. });
  1216. },
  1217. //保存事件
  1218. upChange: function (stype) {
  1219. var noTagKey = [];
  1220. this.editData.filter(function (one) {
  1221. if (one.title === "标的信息" || one.title === "多包信息" || one.title === "中标候选人信息") {
  1222. if (allCheckFields[one.key] && one.status === "-1") {
  1223. noTagKey.push(one.title);
  1224. }
  1225. } else {
  1226. one.content.filter(function (v) {
  1227. v.uInput.filter(function (u) {
  1228. if (allCheckFields[u.key] && u.status === "-1") {
  1229. noTagKey.push(u.title);
  1230. }
  1231. })
  1232. })
  1233. }
  1234. })
  1235. if (noTagKey.length > 0) {
  1236. var fieldText = noTagKey.join(",");
  1237. fieldText = fieldText.replace(/\([^\)]*\)/g, "");
  1238. this.$alert("未标注字段:" + fieldText);
  1239. return
  1240. }
  1241. var resultStatus = false
  1242. if (stype === 1) {//全部字段验证
  1243. var checkAllKey = this.editData.filter(function (one) {
  1244. var otherOne = one.content.filter(function (v) {
  1245. return v.uInput.filter(function (u) {
  1246. return u.status === '-1'
  1247. }).length
  1248. })
  1249. if ((one.title === "标的信息" || one.title === "多包信息" || one.title === "中标候选人信息") && (one.status === "-1")) {
  1250. return true
  1251. } else {
  1252. return otherOne.length
  1253. }
  1254. })
  1255. resultStatus = !Boolean(checkAllKey.length)
  1256. } else {//部分字段验证
  1257. var otherTag = 0 //标注状态 0:没标 1:标注成功 2:标注失败
  1258. var baseTag = 0
  1259. this.editData.filter(function (one) {
  1260. //多包信息、中标候选人信息在为标注失败的前提下检测标注状态,一个失败不能保存
  1261. if (otherTag < 2) {
  1262. if (one.title === "标的信息" || one.title === "多包信息" || one.title === "中标候选人信息") {
  1263. if (one.status === "-1") {//没标
  1264. if (otherTag !== 1) {//前一个标注成功不用记录后一个是否未标
  1265. otherTag = 0
  1266. }
  1267. } else {
  1268. if (one.content.length === 0) {//不含子包
  1269. if (one.status === '2') {
  1270. otherTag = 2 //失败
  1271. } else {
  1272. otherTag = 1 //成功
  1273. }
  1274. } else {//含子包
  1275. if (one.title === "标的信息") {
  1276. var otherOne = one.content.filter(function (v) {
  1277. if (v.status >= 1) {//子信息标注
  1278. var twoLength = v.uInput.filter(function (u) {
  1279. return u.status === '-1'
  1280. })
  1281. if (twoLength.length > 0) {
  1282. otherTag = 2
  1283. }
  1284. return true //返回此条信息被标注
  1285. }
  1286. })
  1287. if (otherTag !== 2) {
  1288. if (otherOne.length > 0) {//
  1289. otherTag = 1
  1290. } else {
  1291. otherTag = 2
  1292. }
  1293. }
  1294. } else {
  1295. var otherOne = one.content.filter(function (v) {
  1296. return v.uInput.filter(function (u) {
  1297. return u.status === '-1'
  1298. }).length
  1299. })
  1300. if (otherOne.length > 0) {//
  1301. otherTag = 2
  1302. } else {
  1303. otherTag = 1
  1304. }
  1305. }
  1306. }
  1307. }
  1308. } else {
  1309. var baseOne = one.content.filter(function (v) {
  1310. return v.uInput.filter(function (u) {
  1311. return u.status !== '-1'
  1312. }).length
  1313. })
  1314. if (baseOne.length > 0) {//基本字段
  1315. baseTag = 1
  1316. }
  1317. }
  1318. }
  1319. })
  1320. if (otherTag === 0 && baseTag === 1) {
  1321. resultStatus = true
  1322. } else if (otherTag === 1) {
  1323. resultStatus = true
  1324. }
  1325. }
  1326. if (!resultStatus) {
  1327. this.$alert("未标注完成");
  1328. return
  1329. }
  1330. var d = JSON.stringify(this.editData);
  1331. var _this = this
  1332. $.ajax({
  1333. url: "/front/user/check/save",
  1334. type: "POST",
  1335. data: {"data": d, "s_infoid": did, "pid": pid, "s_sourceinfo": coll},
  1336. success: function(res) {
  1337. console.log(res)
  1338. if (res) {
  1339. _this.$message({
  1340. message: '保存成功',
  1341. type: 'success',
  1342. duration: 1000,
  1343. offset: 300
  1344. });
  1345. issave = true//保存成功
  1346. }
  1347. },
  1348. error: function(err) {
  1349. console.log(err)
  1350. alert(err);
  1351. }
  1352. });
  1353. }
  1354. //保存提示
  1355. // open:function(one, type) {
  1356. // this.$confirm('是否保存?', '提示', {
  1357. // confirmButtonText: '确定',
  1358. // cancelButtonText: '取消',
  1359. // type: 'warning'
  1360. // }).then(() => {
  1361. // if (type) {
  1362. // this.saveOneData(one)
  1363. // } else {
  1364. // this.upChange()
  1365. // }
  1366. // }).catch(() => {
  1367. // });
  1368. // },
  1369. //一级保存
  1370. // saveOneData: function (one) {
  1371. // if (one.title==="标的信息"||one.title==="多包信息"||one.title==="中标候选人信息"){
  1372. // if(one.status === "-1"){
  1373. // this.$alert(one.title+" 未标注完成")
  1374. // return
  1375. // }else if (one.status !=="-1"){
  1376. // var isAlert = one.content.filter(function(v) {
  1377. // return v.uInput.filter(function (u) {
  1378. // return u.status === '-1'
  1379. // }).length
  1380. // })
  1381. // if (isAlert.length) {
  1382. // this.$alert(one.title+" 未标注完成")
  1383. // return
  1384. // }
  1385. // }
  1386. // }
  1387. // onetext = "["+ JSON.stringify(one) +"]";
  1388. // $.ajax({
  1389. // url:"/center/biaozhu",
  1390. // method:"post",
  1391. // data: {key:onetext,_id:did},
  1392. // success:function(res){
  1393. // if(res){
  1394. // document.getElementById("com-alert-val").innerHtml="保存成功";
  1395. // var label1 = document.getElementById("com-alert");
  1396. // label1.style.display="block";
  1397. // setTimeout(function(){
  1398. // label1.style.display="none";
  1399. // },
  1400. // 1000)
  1401. // }
  1402. // },
  1403. // error:function(err){
  1404. // alert(err);
  1405. // }
  1406. // });
  1407. // },
  1408. }
  1409. })
  1410. function offset(elem) {
  1411. if (!elem) elem = this;
  1412. var x = elem.offsetLeft;
  1413. var y = elem.offsetTop;
  1414. while (elem === elem.offsetParent) {
  1415. x += elem.offsetLeft;
  1416. y += elem.offsetTop;
  1417. }
  1418. return {left: x, top: y};
  1419. }
  1420. </script>
  1421. </html>