remark_detail.html 69 KB

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