detail.html 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>抽查</title>
  6. <script src="/js/jquery.js"></script>
  7. <link href="/css/normalize.min.css" rel="stylesheet">
  8. <link href="/css/animate.min.css" rel="stylesheet">
  9. <link rel="stylesheet" href="/css/zz.css">
  10. <link rel="stylesheet" href="/css/index.css">
  11. <script src="/js/vue.min.js"></script>
  12. <script src="/js/index.js"></script>
  13. <script src="/js/model.js"></script>
  14. <style>
  15. .add-tip {
  16. width: 24px;
  17. height: 22px;
  18. line-height: 22px;
  19. text-align: center;
  20. color: #fff;
  21. margin: 0;
  22. padding: 0;
  23. border: 1px solid #ccc;
  24. background-color: #fdfdfd;
  25. }
  26. .info-box > * {
  27. cursor: pointer;
  28. }
  29. .button-group {
  30. display: flex;
  31. flex-direction: row;
  32. align-items: center;
  33. justify-content: space-between;
  34. }
  35. .button-group .info-box {
  36. margin-left: -60px;
  37. }
  38. .edit-box .edit.two .edit-title {
  39. padding-right: 4px;
  40. }
  41. .edit-box .edit .edit-input .label > span {
  42. max-width: unset;
  43. text-align: left;
  44. padding: 0 1em;
  45. }
  46. .a-button {
  47. color: #4169e3;
  48. margin: 8px 15px;
  49. padding: 4px 10px;
  50. }
  51. .button-box.delete-box {
  52. margin-right: 22px !important;
  53. margin-left: -419px !important;
  54. }
  55. .button-box.delete-box .pass {
  56. background-color: #f56c6c !important;
  57. }
  58. .pass.success {
  59. background-color: #09bb07 !important;
  60. }
  61. .pass.default {
  62. background-color: #adadad !important;
  63. }
  64. </style>
  65. <script>
  66. function prettyPrint(obj) {
  67. console.log(obj)
  68. var ENDLINE = "\n";
  69. var COMMA_ENDLINE = ",\n";
  70. var OBJ_BEGIN = "{";
  71. var OBJ_END = "}";
  72. var ARR_BEGIN = "[";
  73. var ARR_END = "]";
  74. var INDNET_SPACES = 4;
  75. return (function innerPrettyPrint(obj, spaces) {
  76. var type = typeof obj;
  77. console.log(obj,type)
  78. if (type == "number" || type == "boolean") {
  79. return obj.toString();
  80. } else if (type == "string") {
  81. if( obj!="" && !isNaN(Number(obj))){
  82. return Number(obj)
  83. }
  84. return '"' + obj + '"';
  85. } else {
  86. var entries = [];
  87. var thisIndent = ' '.repeat(spaces);
  88. var subIndent = thisIndent + ' '.repeat(INDNET_SPACES);
  89. var subSpaces = spaces + INDNET_SPACES;
  90. if (Object.prototype.toString.call(obj) == '[object Object]') {
  91. for(var k in obj) {
  92. entries.push('"' + k + '": ' + innerPrettyPrint(obj[k], subSpaces));
  93. }
  94. return OBJ_BEGIN + ENDLINE + subIndent + entries.join(COMMA_ENDLINE + subIndent) + ENDLINE + thisIndent + OBJ_END;
  95. } else if (Object.prototype.toString.call(obj) == '[object Array]') {
  96. obj.forEach(function(a) {
  97. entries.push(innerPrettyPrint(a, subSpaces));
  98. });
  99. return ARR_BEGIN + ENDLINE + subIndent + entries.join(COMMA_ENDLINE + subIndent) + ENDLINE + thisIndent + ARR_END;
  100. } else if (obj === null) {
  101. return "null";
  102. } else {
  103. return obj.toString();
  104. }
  105. }
  106. })(obj, 0);
  107. }
  108. </script>
  109. </head>
  110. <body>
  111. <main id="app">
  112. <div class="content" :class="{mm:showPop}">
  113. <!--文章区-->
  114. <div class="article" >
  115. <h4>
  116. 已验/总数:{{.T.checkednum}}/{{.T.allnum}}
  117. </h4>
  118. <hr style="border:1 double;" width="100%">
  119. <br><a href="{{.T.info.href}}" target="_blank">查看原文</a>
  120. <a href="{{.T.jyhref}}" target="_blank">剑鱼链接</a>
  121. <h3>{{.T.info.title}}</h3><br>
  122. {{if .T.info.detail}}
  123. <div v-html="dataHtml"></div>
  124. {{end}}
  125. {{if .T.info.filetext}}
  126. <br><h3>附件内容</h3>
  127. <div v-html="fileHtml"></div>
  128. {{end}}
  129. </div>
  130. <!--操作区-->
  131. <div class="operation">
  132. <!--edit-box-->
  133. <div class="edit-box">
  134. <!--edit-->
  135. <div class="edit one" v-for="(one,index) in editData" :key="index">
  136. <!--one-->
  137. <div class="edit-title" @click="one.show = !one.show">
  138. <span>[[one.title]]</span>
  139. <div class="button-group">
  140. <div v-if="one.showCheck">
  141. <input :id="one.title" @click.stop type="checkbox" v-model="one.checkType">
  142. <label @click.stop :for="one.title">是否抽取</label>
  143. </div>
  144. <div class="button-box">
  145. <!--v-show="one.title == '基本字段'"-->
  146. <button class="pass success" @click.stop="saveDataOne(one,'1')" style="font-size: 14px;width: auto;float:left;">通过</button>
  147. <button class="pass default" @click.stop="saveDataOne(one,'-1')" style="font-size: 14px;width: auto;float:left">取消</button>
  148. <!-- <button class="pass" @click.stop="open(one, true)" style="font-size: 14px;width: auto;float:left">保存</button>-->
  149. </div>
  150. <!--<button class="add" v-show="one.title != '基本'" @click.stop="one.content.push(getTemp(2));goMark2(500)">+</button>-->
  151. <!--<button class="add" v-show="one.title == '基本'" @click.stop="one.content[0].content.push(getTemp(3));goMark2(60)">+</button>-->
  152. <div class="info-box" @click.stop v-show="one.showCheck">
  153. <div :class="{default: one.status == '-1'}" @click="setStatus(one,'-1')"></div>
  154. <!--<div :class="{ok: one.status == '1'}" @click="one.status = '1'"></div>-->
  155. <div :class="{ok: one.status == '1'}" @click="setStatus(one,'1')"></div>
  156. <!--<div :class="{err: one.status == '0'}" @click="one.status = '0'"></div>-->
  157. <el-popover trigger="click" >
  158. <div style="text-align: right; margin: 0">
  159. <el-button type="success" size="mini" @click="setStatus(one,'2')">新增</el-button>
  160. <el-button type="warning" size="mini" @click="setStatus(one,'3')">修改</el-button>
  161. <el-button type="danger" size="mini" @click="setStatus(one,'4')">删除</el-button>
  162. <!-- <el-button type="success" size="mini" @click="one.status = '2'">新增</el-button>
  163. <el-button type="warning" size="mini" @click="one.status = '3'">修改</el-button>
  164. <el-button type="danger" size="mini" @click="one.status = '4'">删除</el-button>-->
  165. </div>
  166. <div class="add-tip" slot="reference" :class="{err: (one.status != '1' && one.status != '-1')}">[[textMap[one.status] || '']]</div>
  167. </el-popover>
  168. </div>
  169. </div>
  170. </div>
  171. <transition tag="div">
  172. <div>
  173. <div class="button-box" v-if="one.showCheck&&one.show">
  174. <button class="pass a-button" @click.stop="addChild(one)" style="font-size: 14px;width: auto;float:left;">新增[[one.title]]</button>
  175. </div>
  176. <div class="edit-content" :class="{t:one.title == '基本字段'}" v-show="one.show">
  177. <!--two-->
  178. <span v-show="one.content.length === 0">当前您还没有添加子包</span>
  179. <div class="edit two" v-for="(two,index) in one.content" :key="index">
  180. <div class="edit-title" v-if="two.title" @click="two.show = !two.show">
  181. <span>[[two.title]]</span>
  182. <div class="button-box">
  183. <button class="pass success" @click.stop="saveDataTwo(two,'1',one)" style="font-size: 14px;width: auto;float:left;">通过</button>
  184. <button class="pass default" @click.stop="saveDataTwo(two,'-1',one)" style="font-size: 14px;width: auto;float:left">取消</button>
  185. </div>
  186. <div class="button-box delete-box">
  187. <button class="pass" @click.stop="delNewTwo(one, index, two)">删除</button>
  188. </div>
  189. </div>
  190. <transition tag="div">
  191. <div class="edit-content" v-show="two.show">
  192. <!--input-->
  193. <div class="edit-input">
  194. <div v-for="uin of two.uInput" class="input-box" :key="uin.title">
  195. <div class="label" v-if="uin.selectArr">
  196. <span>[[uin.title]]&nbsp;:&nbsp;</span>
  197. <select v-model="uin.select" @change="selectchange(uin,'3', two, one)">
  198. <option disabled value="">请选择</option>
  199. <option v-for="o in uin.selectArr">[[o]]</option>
  200. </select>
  201. <div class="info-box">
  202. <div :class="{default: uin.status == '-1'}" @click="setStatus(uin,'-1', two, one)"></div>
  203. <div :class="{ok: uin.status == '1'}" @click="setStatus(uin,'1', two, one)"></div>
  204. <!--<div :class="{err: uin.status == '0'}" @click="uin.status = '0'"></div>-->
  205. <el-popover trigger="click" >
  206. <div style="text-align: right; margin: 0">
  207. <el-button type="success" size="mini" @click="setStatus(uin,'2', two, one)">新增</el-button>
  208. <el-button type="warning" size="mini" @click="setStatus(uin,'3', two, one)">修改</el-button>
  209. <el-button type="danger" size="mini" @click="setStatus(uin,'4', two, one)">删除</el-button>
  210. </div>
  211. <div class="add-tip" slot="reference" :class="{err: (uin.status != '1' && uin.status != '-1')}">[[textMap[uin.status] || '']]</div>
  212. </el-popover>
  213. </div>
  214. </div>
  215. <div class="label" v-else :title="uin.input">
  216. <span @click="goText(uin.title)">[[uin.title]]&nbsp;:&nbsp;</span>
  217. <input type="text" v-model="uin.input" @click="goText(uin.input)">
  218. <div class="info-box">
  219. <div :class="{default: uin.status == '-1'}" @click="setStatus(uin,'-1', two, one)"></div>
  220. <div :class="{ok: uin.status == '1'}" @click="setStatus(uin,'1', two, one)"></div>
  221. <!--<div :class="{err: uin.status == '0'}" @click="uin.status = '0'"></div>-->
  222. <el-popover trigger="click" >
  223. <div style="text-align: right; margin: 0">
  224. <el-button type="success" size="mini" @click="setStatus(uin,'2', two, one)">新增</el-button>
  225. <el-button type="warning" size="mini" @click="setStatus(uin,'3', two, one)">修改</el-button>
  226. <el-button type="danger" size="mini" @click="setStatus(uin,'4', two, one)">删除</el-button>
  227. </div>
  228. <div class="add-tip" slot="reference" :class="{err: (uin.status != '1' && uin.status != '-1')}">[[textMap[uin.status] || '']]</div>
  229. </el-popover>
  230. </div>
  231. </div>
  232. </div>
  233. </div>
  234. <!--three-->
  235. <!--<div>
  236. <div class="edit-title" v-show="one.title == '基本字段'">
  237. <span>候选人</span>
  238. <div class="info-box" >
  239. <div :class="{default: two.wstatus == '-1'}" @click="two.wstatus = '-1'"></div>
  240. <div :class="{ok: two.wstatus == '1'}" @click="two.wstatus = '1'"></div>
  241. <el-popover trigger="click" >
  242. <div style="text-align: right; margin: 0">
  243. <el-button type="success" size="mini" @click="two.wstatus = '2'">新增</el-button>
  244. <el-button type="warning" size="mini" @click="two.wstatus = '3'">修改</el-button>
  245. <el-button type="danger" size="mini" @click="two.wstatus = '4'">删除</el-button>
  246. </div>
  247. <div class="add-tip" slot="reference" :class="{err: (two.wstatus != '1' && two.wstatus != '-1')}">[[textMap[two.wstatus] || '']]</div>
  248. </el-popover>
  249. </div>
  250. </div>
  251. <div class="edit three" v-for="(three,index) in two.content" :key="index">
  252. <div class="edit-title" @click="three.show = !three.show">
  253. <span>[[three.title]]</span>
  254. </div>
  255. <div class="edit-content" v-show="three.show">
  256. <div class="edit-input">
  257. <div class="input-box" v-for="(threeUin,index) in three.uInput" :key="threeUin.title">
  258. <div class="label">
  259. <span @click="goText(threeUin.title)">[[threeUin.title]]&nbsp;:&nbsp;</span>
  260. <input type="text" v-model="threeUin.input" @click="goText(threeUin.input)">
  261. <div class="info-box">
  262. <div :class="{default: threeUin.status == '-1'}" @click="threeUin.status = '-1'"></div>
  263. <div :class="{ok: threeUin.status == '1'}" @click="threeUin.status = '1'"></div>
  264. <el-popover trigger="click" >
  265. <div style="text-align: right; margin: 0">
  266. <el-button type="success" size="mini" @click="threeUin.status = '2'">新增</el-button>
  267. <el-button type="warning" size="mini" @click="threeUin.status = '3'">修改</el-button>
  268. <el-button type="danger" size="mini" @click="threeUin.status = '4'">删除</el-button>
  269. </div>
  270. <div class="add-tip" slot="reference" :class="{err: (threeUin.status != '1' && threeUin.status != '-1')}">[[textMap[threeUin.status] || '']]</div>
  271. </el-popover>
  272. </div>
  273. </div>
  274. </div>
  275. </div>
  276. </div>
  277. </div>
  278. </div>-->
  279. </div>
  280. </transition>
  281. </div>
  282. </div>
  283. </div>
  284. </transition>
  285. </div>
  286. </div>
  287. <div class="save-box">
  288. <!-- <button class="code" @click.stop="showPop = true" style="width:100px">源码</button>&nbsp;&nbsp;-->
  289. <button class="code" @click.stop="open(1)" style="width:100px">全部验证</button>
  290. <button class="code" @click.stop="open(2)" style="width:100px">字段验证</button>
  291. <!-- <button class="code" @click.stop="open('', false)" style="width:100px">保存</button>&nbsp;&nbsp;-->
  292. <button class="code" @click.stop="openHref" style="width:100px">下一条</button>
  293. <!--<button class="code" @click.stop="window.location.href='/'" style="width:100px">下一条</button>-->
  294. </div>
  295. </div>
  296. </div>
  297. <!--弹出层-->
  298. <dialog class="dialog" v-if="showPop">
  299. <span class="close" @click="showPop = false;changeText()">x</span>
  300. <div class="pop">
  301. <div class="title">源码</div>
  302. <div class="con" ref="text" contentEditable="true">
  303. <pre v-html="addStyle(editData)"></pre>
  304. </div>
  305. <button @click="showPop = false;changeText();upChange()">保&nbsp;存</button>
  306. </div>
  307. </dialog>
  308. <dialog id="com-alert" class="dialog" style="background: rgba(124, 124, 125, 0.1);z-index:9999;display: none;">
  309. <div class="pop" style="background: rgba(124, 124, 125, 0.1);">
  310. <div id="com-alert-val" class="title" style="color:red">保存成功</div>
  311. </div>
  312. </dialog>
  313. </main>
  314. </body>
  315. <script>
  316. //记录是否点击保存
  317. var issave = false;
  318. var _id = {{.T.info._id}};
  319. var nextid = {{.T.nextid}};
  320. console.log(nextid)
  321. //基本信息
  322. var common={{.T.common}};
  323. var uInput=[];
  324. for(k in common){
  325. var tmp={}
  326. tmp.title=common[k].descript
  327. tmp.input=common[k].value
  328. tmp.key=common[k].key
  329. if(common[k].key=="subtype"){
  330. tmp.select=common[k].value
  331. tmp.selectArr={{.T.topsubtype}}
  332. }
  333. if(common[k].key=="attach_discern"){
  334. tmp.select=common[k].value
  335. tmp.selectArr=['识别有效','识别无效']
  336. }
  337. if(common[k].key=="attach_ext"){
  338. tmp.select=common[k].value
  339. tmp.selectArr=['抽取正确','抽取错误']
  340. }
  341. if(common[k].key=="isrepeat"){
  342. tmp.select=common[k].value
  343. tmp.selectArr=['是','否']
  344. }
  345. tmp.status=common[k].status
  346. uInput[k]=tmp
  347. }
  348. //时间地点
  349. var timeplace={{.T.timeplace}}
  350. var tpInput=[];
  351. for(k in timeplace){
  352. var tmp={}
  353. tmp.title=timeplace[k].descript
  354. tmp.input=timeplace[k].value
  355. tmp.key=timeplace[k].key
  356. tmp.status=timeplace[k].status
  357. tpInput[k]=tmp
  358. }
  359. //其他信息
  360. var other={{.T.other}}
  361. var otherInput=[];
  362. for(k in other){
  363. var tmp={}
  364. tmp.title=other[k].descript
  365. tmp.input=other[k].value
  366. tmp.key=other[k].key
  367. tmp.status=other[k].status
  368. if(other[k].key=="isppp"||other[k].key=="contract_guarantee"||other[k].key=="bid_guarantee"){
  369. tmp.select=other[k].value
  370. tmp.selectArr=['是','否']
  371. }
  372. otherInput[k]=tmp
  373. }
  374. //中标候选人
  375. var c_worder={{.T.worder}}
  376. var worder_new={{.T.worder_new}}
  377. var c_content=[];
  378. for(k in c_worder){
  379. var c_uInput=[];
  380. for(i in c_worder[k]){
  381. var tmp={}
  382. tmp.title=c_worder[k][i].descript
  383. tmp.input=c_worder[k][i].value||''
  384. tmp.key=c_worder[k][i].key
  385. tmp.status=c_worder[k][i].status
  386. c_uInput[i]=tmp
  387. }
  388. var content={};
  389. content.title="候选人"
  390. content.show=true
  391. content.status=-1
  392. content.uInput=c_uInput
  393. content.ck_isnew=worder_new[k] || false
  394. content.content=[]
  395. c_content[k]=content
  396. }
  397. //标的信息
  398. var purchasinglist={{.T.purchasinglist}}
  399. var pcl_new={{.T.pcl_new}}
  400. var pcl_content=[];
  401. for(k in purchasinglist){
  402. var c_uInput=[];
  403. for(i in purchasinglist[k]){
  404. var tmp={}
  405. tmp.title=purchasinglist[k][i].descript
  406. tmp.input=purchasinglist[k][i].value
  407. tmp.key=purchasinglist[k][i].key
  408. tmp.status=purchasinglist[k][i].status
  409. c_uInput[i]=tmp
  410. }
  411. var content={};
  412. content.title="标的物"
  413. content.show=true
  414. content.status=-1
  415. content.uInput=c_uInput
  416. content.ck_isnew=pcl_new[k] || false
  417. content.content=[]
  418. pcl_content[k]=content
  419. }
  420. //var ispackage='{{.T.ispackage}}'
  421. //子包信息
  422. var packs={{.T.packs}}
  423. var packskey={{.T.packskey}}
  424. var pkg_new={{.T.pkg_new}}
  425. //var ck_package='{{.T.ck_package}}'
  426. //分包抽查,若果有分包,默认ok
  427. //if(packs.length>0&&ispackage=="1"){
  428. // ck_package="1"
  429. //}
  430. var p_content=[];
  431. for(k in packs){
  432. //子包基本信息
  433. var uInputs=[];
  434. var pack=packs[k]["pack"]
  435. for(i in pack){
  436. var tmp={}
  437. tmp.title=pack[i].descript
  438. tmp.input=pack[i].value
  439. tmp.key=pack[i].key
  440. //if(pack[i].key=="bidstatus"){
  441. // tmp.select=pack[i].value
  442. // tmp.selectArr=['预告','招标','成交', '中标', '废标','流标']
  443. //}
  444. tmp.status=pack[i].status
  445. uInputs[i]=tmp
  446. }
  447. var content={};
  448. content.title="子包";
  449. content.show=true;
  450. content.status=-1
  451. content.uInput=uInputs;
  452. content.ck_isnew=pkg_new[k] || false
  453. content.num = packskey[k];
  454. p_content[k]=content;
  455. /**
  456. //子包候选人
  457. var pworder=packs[k]["pack_worder"]
  458. var p_in_content=[];
  459. for(i in pworder){
  460. var in_uInputs=[];
  461. for(n in pworder[i]){
  462. var tmp={}
  463. tmp.title=pworder[i][n].descript
  464. tmp.input=pworder[i][n].value
  465. tmp.key=pworder[i][n].key
  466. tmp.status=pworder[i][n].status
  467. in_uInputs[n]=tmp
  468. }
  469. var in_content={}
  470. in_content.title="候选人";
  471. if(i==0){
  472. in_content.show=true;
  473. }else{
  474. in_content.show=false;
  475. }
  476. in_content.uInput=in_uInputs;
  477. p_in_content[i]=in_content
  478. }
  479. content.content=p_in_content;
  480. p_content[k]=content;
  481. */
  482. }
  483. var pclf = {{.T.PurchasinglistField}};
  484. var pclfInput = []
  485. for(i in pclf){
  486. for(key in pclf[i]){
  487. pclfInput.push({
  488. input:"",
  489. key:key,
  490. status:"2",
  491. title:pclf[i][key]
  492. })
  493. }
  494. }
  495. var wodf = {{.T.WinnerorderField}};
  496. var wodfInput = []
  497. for(i in wodf){
  498. for(key in wodf[i]){
  499. wodfInput.push({
  500. input:"",
  501. key:key,
  502. status:"2",
  503. title:wodf[i][key]
  504. })
  505. }
  506. }
  507. var pf = {{.T.PackageField}};
  508. var pfInput = []
  509. for(i in pf){
  510. for(key in pf[i]){
  511. pfInput.push({
  512. input:"",
  513. key:key,
  514. status:"2",
  515. title:pf[i][key]
  516. })
  517. }
  518. }
  519. var app = new Vue({
  520. el: '#app',
  521. delimiters:["[[","]]"],
  522. data: {
  523. textMap: ['','','增', '改', '删'],
  524. tempHtml: `{{Html (Regexp (Regexp .T.info.detail "(\\n|\\\\n)\\s+" "\n") "(`|\\n|\\\\n)+" "<br/>")}}`,
  525. dataHtml: `{{Html (Regexp (Regexp .T.info.detail "(\\n|\\\\n)\\s+" "\n") "(`|\\n|\\\\n)+" "<br/>")}}`,
  526. fileHtml: `{{Html (Regexp (Regexp .T.info.filetext "(\\n|\\\\n)\\s+" "\n") "(`|\\n|\\\\n)+" "<br/>")}}`,
  527. showPop: false,
  528. editData: [
  529. {
  530. title: '基本字段',
  531. show:true,
  532. status:"1",
  533. content: [
  534. {
  535. title: '',
  536. show: true,
  537. delete: false,
  538. //wstatus:"-1",
  539. uInput: uInput
  540. //content: c_content
  541. }
  542. ]
  543. },
  544. {
  545. title: '时间地点',
  546. show:false,
  547. status:"1",
  548. content: [
  549. {
  550. title: '',
  551. show: true,
  552. delete: false,
  553. //wstatus:"-1",
  554. uInput: tpInput
  555. }
  556. ]
  557. },
  558. {
  559. title: '标的信息',
  560. show: false,
  561. showCheck: true,
  562. checkType: {{.T.ck_pclisext}},
  563. status: {{.T.ck_purchasinglist}},
  564. content: pcl_content
  565. },
  566. {
  567. title: '多包信息',
  568. show: false,
  569. showCheck: true,
  570. checkType: {{.T.ck_pkgisext}},
  571. status: {{.T.ck_package}},
  572. content: p_content
  573. },
  574. {
  575. title: '中标候选人信息',
  576. show: false,
  577. showCheck: true,
  578. checkType: {{.T.ck_wodrisext}},
  579. status: {{.T.ck_winnerorder}},
  580. content: c_content
  581. },
  582. {
  583. title: '其余信息',
  584. show:false,
  585. status:"1",
  586. content: [
  587. {
  588. title: '',
  589. show: true,
  590. delete: false,
  591. //wstatus:"-1",
  592. uInput: otherInput
  593. }
  594. ]
  595. }
  596. ]
  597. },
  598. methods: {
  599. selectchange(uni,status,two,one){
  600. this.setStatus(uni,status,two,one);
  601. },
  602. openHref () {
  603. if(!issave){
  604. alert("请先保存数据!")
  605. return
  606. }else{
  607. if(nextid==""){
  608. window.location.href = '/center/finishcheck';
  609. }else{
  610. $.ajax({
  611. url: "/center/checkid",
  612. type: "post",
  613. data: {"id":nextid},
  614. async: false,
  615. success: function (r) {
  616. if(r && r.msg == ""){
  617. if(r.exists){//标注完成
  618. window.location.href = "/center/finishcheck";
  619. }else if (!r.exists){
  620. window.location.href = "/center/detail/"+r.id+".html"
  621. }
  622. }else{
  623. alert("标注出错!"+r.msg)
  624. }
  625. }
  626. })
  627. }
  628. }
  629. },
  630. checkOneStatus: function (config) {
  631. var tempObj = {
  632. obj: config.type ? config.one : config.two
  633. }
  634. if (config.type) {
  635. tempObj.list = config.one.content
  636. } else {
  637. tempObj.list = config.two.uInput
  638. }
  639. var statusList = [0,0,0,0,0]
  640. for(var i in tempObj.list) {
  641. var tempList = tempObj.list[i]
  642. var tempIndex = Number(tempList.status)
  643. if (tempIndex == -1) {
  644. tempIndex = 0
  645. }
  646. statusList[tempIndex] = Number(statusList[tempIndex]) + 1
  647. }
  648. if (statusList[1] > 0) {
  649. tempObj.obj.status = 1
  650. }
  651. if (statusList[4] > 0 || statusList[3] > 0 || statusList[2] > 0) {
  652. tempObj.obj.status = 3
  653. }
  654. if (statusList[4] === tempObj.list.length) {
  655. tempObj.obj.status = 4
  656. }
  657. if (statusList[3] === tempObj.list.length) {
  658. tempObj.obj.status = 3
  659. }
  660. if (statusList[2] === tempObj.list.length) {
  661. tempObj.obj.status = 2
  662. }
  663. if (statusList[0] === tempObj.list.length) {
  664. tempObj.obj.status = -1
  665. }
  666. if (!config.type) {
  667. this.checkOneStatus({
  668. one: config.one,
  669. two: config.two,
  670. type: true
  671. })
  672. }
  673. },
  674. //切换状态按钮
  675. setStatus:function(witch,s, two, one){
  676. var key = witch.key
  677. //校验日期格式
  678. if(key=="bidendtime"||key=="bidopentime"||key=="project_startdate"||key=="project_completedate"||key=="publishtime"||key=="signaturedate"){
  679. var val = witch.input
  680. if(val!=""){
  681. 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$/;
  682. var regExp = new RegExp(reg);
  683. if(!regExp.test(val)){
  684. alert(witch.title+",日期格式错误!正确格式:2006-01-02 15:04:05")
  685. return
  686. }
  687. }
  688. }
  689. witch.status = s;
  690. if (two) {
  691. this.checkOneStatus({
  692. one: one,
  693. two: two,
  694. type: false
  695. })
  696. }
  697. },
  698. //二级删除
  699. delNewTwo: function (one, index, two) {
  700. if (two.ck_isnew) {
  701. one.content.splice(index, 1)
  702. } else {
  703. two.status = 4
  704. this.saveDataTwo(two, 4, one)
  705. }
  706. this.checkOneStatus({
  707. one: one,
  708. two: two,
  709. type: true
  710. })
  711. },
  712. /*add style*/
  713. addStyle: function (data) {
  714. //console.dir(data)
  715. return prettyPrint(data).replace(/(checkType|showCheck|wstatus|status|key|title|input|content|uInput|selectArr|select|show|true)/g, "<mark>$1</mark>")
  716. },
  717. /*同步修改源码*/
  718. changeText: function (boolean) {
  719. try {
  720. var tempText = JSON.parse(this.$refs.text.innerText.replace(/(\n|\s)/g, ''))
  721. if(boolean){
  722. this.tagvalues = tempText
  723. }else{
  724. this.editData = tempText
  725. }
  726. } catch (err) {
  727. alert('源码修改失败')
  728. }
  729. },
  730. goText: function (value) {
  731. /*重置Html*/
  732. this.dataHtml = this.tempHtml
  733. if (!value) {return false}
  734. var rs = new RegExp('(' + value + ')', 'gi')
  735. if (rs.test(this.dataHtml)) {
  736. this.dataHtml = this.dataHtml.replace(rs, '<mark>$1</mark>')
  737. /*延迟查询dom,防止dom未插入*/
  738. var $this = this
  739. setTimeout(function () {
  740. $this.goMark()
  741. }, 150)
  742. } else {
  743. /*重置Html*/
  744. this.dataHtml = this.tempHtml
  745. }
  746. },
  747. goMark: function () {
  748. /*滚动到第一个mark*/
  749. var temp = document.querySelectorAll('mark')[0]
  750. document.querySelector('.article').scrollTop = offset(temp).top - window.screen.height / 2
  751. },
  752. //markTag:function(n){
  753. // $.ajax({
  754. // url:"/markTag",
  755. // method:"post",
  756. // data: {tag:n,_id:_id},
  757. // success:function(res){
  758. // if(res){
  759. // document.getElementById("com-alert-val").innerHtml="标记成功";
  760. // var label1 = document.getElementById("com-alert");
  761. // label1.style.display="block";
  762. // setTimeout(function(){label1.style.display="none";},1000)
  763. // }
  764. // }
  765. // });
  766. //},
  767. addChild: function (one) {
  768. var tempNode = {}
  769. switch (one.title) {
  770. case "标的信息": {
  771. tempNode = {
  772. content: [],
  773. show:true,
  774. ck_isnew: true,
  775. status: 2,
  776. title:"标的物",
  777. uInput: JSON.parse(JSON.stringify(pclfInput))
  778. }
  779. break
  780. }
  781. case "多包信息": {pfInput
  782. tempNode = {
  783. content: [],
  784. show:true,
  785. status: 2,
  786. ck_isnew: true,
  787. title:"子包",
  788. uInput: JSON.parse(JSON.stringify(pfInput))
  789. }
  790. break
  791. }
  792. case "中标候选人信息": {
  793. tempNode = {
  794. content: [],
  795. show:true,
  796. status: 2,
  797. ck_isnew: true,
  798. title:"候选人",
  799. uInput: JSON.parse(JSON.stringify(wodfInput))
  800. }
  801. break
  802. }
  803. }
  804. // if (one.status >= 2) {
  805. // one.status = '2'
  806. // }
  807. one.content.push(tempNode)
  808. this.checkOneStatus({
  809. one: one,
  810. type: true
  811. })
  812. },
  813. //保存
  814. saveDataTwo:function(two,n, one){
  815. two.uInput.forEach(function(v) {
  816. var key = v.key
  817. if(key=="bidendtime"||key=="bidopentime"||key=="project_startdate"||key=="project_completedate"||key=="publishtime"||key=="signaturedate"){
  818. var val = v.input
  819. if(val!=""){
  820. 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$/;
  821. var regExp = new RegExp(reg);
  822. if(!regExp.test(val)){
  823. alert(v.title+",日期格式错误!正确格式:2006-01-02 15:04:05")
  824. return
  825. }
  826. }
  827. }
  828. if(n =="1" && v.status == "-1"){
  829. v.status = n
  830. } else if (n=="-1"){
  831. v.status = n
  832. } else if (n=="4"){
  833. v.status = n
  834. }
  835. });
  836. two.status = n
  837. this.checkOneStatus({
  838. one: one,
  839. two: two,
  840. type: false
  841. })
  842. /**
  843. two.content.forEach(function(v) {
  844. v.uInput.forEach(function(value) {
  845. if (value.input && value.input != '') {
  846. value.status = n
  847. }
  848. })
  849. })
  850. */
  851. },
  852. saveDataOne:function(one,n){
  853. //保存后的样式
  854. var _this = this
  855. one.content.forEach(function(v) {
  856. v.uInput.forEach(function(value) {
  857. var key = value.key
  858. if(n==1){
  859. if(key=="bidendtime"||key=="bidopentime"||key=="project_startdate"||key=="project_completedate"||key=="publishtime"||key=="signaturedate"){
  860. var val = value.input
  861. if(val != ""){
  862. 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$/;
  863. var regExp = new RegExp(reg);
  864. if(!regExp.test(val)){
  865. alert(value.title+",日期格式错误!正确格式:2006-01-02 15:04:05")
  866. return
  867. }
  868. }
  869. }
  870. }
  871. // 取消全部,通过时判断状态是否处于修改新增等
  872. if (n =="1" && value.status == "-1"){
  873. value.status = n
  874. }else if (n=="-1"){
  875. value.status = n
  876. }
  877. })
  878. _this.checkOneStatus({
  879. two: v,
  880. one: one,
  881. type: false
  882. })
  883. });
  884. // one.content.forEach(function(v) {
  885. // if (v.content) {
  886. // v.content.forEach(function(i) {
  887. // i.uInput.forEach(function(value) {
  888. // if (value.input && value.input != '') {
  889. // value.status = n
  890. // }
  891. // })
  892. // })
  893. // }
  894. // });
  895. //保存当前标记
  896. },
  897. //验证保存提示
  898. open:function(stype) {
  899. this.$confirm('是否保存?', '提示', {
  900. confirmButtonText: '确定',
  901. cancelButtonText: '取消',
  902. type: 'warning'
  903. }).then(() => {
  904. this.upChange(stype)
  905. }).catch(() => {
  906. });
  907. },
  908. //保存事件
  909. upChange: function (stype) {
  910. var resultStatus = false
  911. if (stype == 1) {
  912. var checkAllKey = this.editData.filter(function (one) {
  913. var otherOne = one.content.filter(function(v) {
  914. return v.uInput.filter(function (u) {
  915. return u.status == '-1'
  916. }).length
  917. })
  918. if ((one.title=="标的信息"||one.title=="多包信息"||one.title=="中标候选人信息") && (one.status == "-1")) {
  919. return true
  920. } else {
  921. return otherOne.length
  922. }
  923. })
  924. resultStatus = !Boolean(checkAllKey.length)
  925. } else {
  926. var checkOnlyKey = this.editData.filter(function (one) {
  927. if (one.title=="标的信息"||one.title=="多包信息"||one.title=="中标候选人信息") {
  928. if (one.status == "-1") {
  929. return false
  930. } else {
  931. if (one.content.length === 0) {
  932. return true
  933. }
  934. var otherOne = one.content.filter(function(v) {
  935. return v.uInput.filter(function (u) {
  936. return u.status == '-1'
  937. }).length
  938. })
  939. return !(otherOne.length > 0)
  940. }
  941. } else {
  942. var otherOne = one.content.filter(function(v) {
  943. return v.uInput.filter(function (u) {
  944. return u.status != '-1'
  945. }).length
  946. })
  947. return otherOne.length
  948. }
  949. })
  950. resultStatus = Boolean(checkOnlyKey.length)
  951. }
  952. if (!resultStatus) {
  953. this.$alert("未标注完成");
  954. return
  955. }
  956. var d= JSON.stringify(this.editData);
  957. console.log(d)
  958. var _this = this
  959. $.ajax({
  960. url:"/center/biaozhu",
  961. method:"post",
  962. data: {key:d,_id:_id,stype:stype},
  963. success:function(res){
  964. if(res){
  965. _this.$message({
  966. message: '保存成功',
  967. type: 'success',
  968. duration: 1000,
  969. offset: 300
  970. });
  971. // document.getElementById("com-alert-val").innerHtml="保存成功";
  972. // var label1 = document.getElementById("com-alert");
  973. // label1.style.display="block";
  974. // setTimeout(function(){
  975. // label1.style.display="none";
  976. // },1000)
  977. issave = true//保存成功
  978. }
  979. },
  980. error:function(err){
  981. alert(err);
  982. }
  983. });
  984. }
  985. /**
  986. //保存提示
  987. open:function(one, type) {
  988. this.$confirm('是否保存?', '提示', {
  989. confirmButtonText: '确定',
  990. cancelButtonText: '取消',
  991. type: 'warning'
  992. }).then(() => {
  993. if (type) {
  994. this.saveOneData(one)
  995. } else {
  996. this.upChange()
  997. }
  998. }).catch(() => {
  999. });
  1000. },
  1001. //一级保存
  1002. saveOneData: function (one) {
  1003. console.log(one.status)
  1004. if (one.title=="标的信息"||one.title=="多包信息"||one.title=="中标候选人信息"){
  1005. if(one.status == "-1"){
  1006. this.$alert(one.title+" 未标注完成")
  1007. return
  1008. }else if (one.status !="-1"){
  1009. var isAlert = one.content.filter(function(v) {
  1010. return v.uInput.filter(function (u) {
  1011. return u.status == '-1'
  1012. }).length
  1013. })
  1014. if (isAlert.length) {
  1015. this.$alert(one.title+" 未标注完成")
  1016. return
  1017. }
  1018. }
  1019. }
  1020. onetext = "["+ JSON.stringify(one) +"]";
  1021. console.log(onetext)
  1022. $.ajax({
  1023. url:"/center/biaozhu",
  1024. method:"post",
  1025. data: {key:onetext,_id:_id},
  1026. success:function(res){
  1027. if(res){
  1028. document.getElementById("com-alert-val").innerHtml="保存成功";
  1029. var label1 = document.getElementById("com-alert");
  1030. label1.style.display="block";
  1031. setTimeout(function(){
  1032. label1.style.display="none";
  1033. },
  1034. 1000)
  1035. }
  1036. },
  1037. error:function(err){
  1038. alert(err);
  1039. }
  1040. });
  1041. },
  1042. */
  1043. }
  1044. })
  1045. function offset(elem) {
  1046. if(!elem) elem = this;
  1047. var x = elem.offsetLeft;
  1048. var y = elem.offsetTop;
  1049. while (elem = elem.offsetParent) {
  1050. x += elem.offsetLeft;
  1051. y += elem.offsetTop;
  1052. }
  1053. return { left: x, top: y };
  1054. }
  1055. </script>
  1056. </html>