123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>抽查</title>
- <script src="/js/jquery.js"></script>
- <link href="/css/normalize.min.css" rel="stylesheet">
- <link href="/css/animate.min.css" rel="stylesheet">
- <link rel="stylesheet" href="/css/zz.css">
- <link rel="stylesheet" href="/css/index.css">
- <script src="/js/vue.min.js"></script>
- <script src="/js/index.js"></script>
- <script src="/js/model.js"></script>
- <style>
- .add-tip {
- width: 24px;
- height: 22px;
- line-height: 22px;
- text-align: center;
- color: #fff;
- margin: 0;
- padding: 0;
- border: 1px solid #ccc;
- background-color: #fdfdfd;
- }
- .info-box > * {
- cursor: pointer;
- }
- .button-group {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- }
- .button-group .info-box {
- margin-left: -60px;
- }
- .edit-box .edit.two .edit-title {
- padding-right: 4px;
- }
- .edit-box .edit .edit-input .label > span {
- max-width: unset;
- text-align: left;
- padding: 0 1em;
- }
- .a-button {
- color: #4169e3;
- margin: 8px 15px;
- padding: 4px 10px;
- }
- .button-box.delete-box {
- margin-right: 22px !important;
- margin-left: -419px !important;
- }
- .button-box.delete-box .pass {
- background-color: #f56c6c !important;
- }
- .pass.success {
- background-color: #09bb07 !important;
- }
- .pass.default {
- background-color: #adadad !important;
- }
- </style>
- <script>
- function prettyPrint(obj) {
- console.log(obj)
- var ENDLINE = "\n";
- var COMMA_ENDLINE = ",\n";
- var OBJ_BEGIN = "{";
- var OBJ_END = "}";
- var ARR_BEGIN = "[";
- var ARR_END = "]";
- var INDNET_SPACES = 4;
- return (function innerPrettyPrint(obj, spaces) {
- var type = typeof obj;
- console.log(obj,type)
- if (type == "number" || type == "boolean") {
- return obj.toString();
- } else if (type == "string") {
- if( obj!="" && !isNaN(Number(obj))){
- return Number(obj)
- }
- return '"' + obj + '"';
- } else {
- var entries = [];
- var thisIndent = ' '.repeat(spaces);
- var subIndent = thisIndent + ' '.repeat(INDNET_SPACES);
- var subSpaces = spaces + INDNET_SPACES;
- if (Object.prototype.toString.call(obj) == '[object Object]') {
- for(var k in obj) {
- entries.push('"' + k + '": ' + innerPrettyPrint(obj[k], subSpaces));
- }
- return OBJ_BEGIN + ENDLINE + subIndent + entries.join(COMMA_ENDLINE + subIndent) + ENDLINE + thisIndent + OBJ_END;
- } else if (Object.prototype.toString.call(obj) == '[object Array]') {
- obj.forEach(function(a) {
- entries.push(innerPrettyPrint(a, subSpaces));
- });
- return ARR_BEGIN + ENDLINE + subIndent + entries.join(COMMA_ENDLINE + subIndent) + ENDLINE + thisIndent + ARR_END;
- } else if (obj === null) {
- return "null";
- } else {
- return obj.toString();
- }
- }
- })(obj, 0);
- }
- </script>
- </head>
- <body>
- <main id="app">
- <div class="content" :class="{mm:showPop}">
- <!--文章区-->
- <div class="article" >
- <h4>
- 已验/总数:{{.T.checkednum}}/{{.T.allnum}}
- </h4>
- <hr style="border:1 double;" width="100%">
- <br><a href="{{.T.info.href}}" target="_blank">查看原文</a>
- <a href="{{.T.jyhref}}" target="_blank">剑鱼链接</a>
- <h3>{{.T.info.title}}</h3><br>
- {{if .T.info.detail}}
- <div v-html="dataHtml"></div>
- {{end}}
- {{if .T.info.filetext}}
- <br><h3>附件内容</h3>
- <div v-html="fileHtml"></div>
- {{end}}
- </div>
- <!--操作区-->
- <div class="operation">
- <!--edit-box-->
- <div class="edit-box">
- <!--edit-->
- <div class="edit one" v-for="(one,index) in editData" :key="index">
- <!--one-->
- <div class="edit-title" @click="one.show = !one.show">
- <span>[[one.title]]</span>
- <div class="button-group">
- <div v-if="one.showCheck">
- <input :id="one.title" @click.stop type="checkbox" v-model="one.checkType">
- <label @click.stop :for="one.title">是否抽取</label>
- </div>
- <div class="button-box">
- <!--v-show="one.title == '基本字段'"-->
- <button class="pass success" @click.stop="saveDataOne(one,'1')" style="font-size: 14px;width: auto;float:left;">通过</button>
- <button class="pass default" @click.stop="saveDataOne(one,'-1')" style="font-size: 14px;width: auto;float:left">取消</button>
- <!-- <button class="pass" @click.stop="open(one, true)" style="font-size: 14px;width: auto;float:left">保存</button>-->
- </div>
- <!--<button class="add" v-show="one.title != '基本'" @click.stop="one.content.push(getTemp(2));goMark2(500)">+</button>-->
- <!--<button class="add" v-show="one.title == '基本'" @click.stop="one.content[0].content.push(getTemp(3));goMark2(60)">+</button>-->
- <div class="info-box" @click.stop v-show="one.showCheck">
- <div :class="{default: one.status == '-1'}" @click="setStatus(one,'-1')"></div>
- <!--<div :class="{ok: one.status == '1'}" @click="one.status = '1'"></div>-->
- <div :class="{ok: one.status == '1'}" @click="setStatus(one,'1')"></div>
- <!--<div :class="{err: one.status == '0'}" @click="one.status = '0'"></div>-->
- <el-popover trigger="click" >
- <div style="text-align: right; margin: 0">
- <el-button type="success" size="mini" @click="setStatus(one,'2')">新增</el-button>
- <el-button type="warning" size="mini" @click="setStatus(one,'3')">修改</el-button>
- <el-button type="danger" size="mini" @click="setStatus(one,'4')">删除</el-button>
- <!-- <el-button type="success" size="mini" @click="one.status = '2'">新增</el-button>
- <el-button type="warning" size="mini" @click="one.status = '3'">修改</el-button>
- <el-button type="danger" size="mini" @click="one.status = '4'">删除</el-button>-->
- </div>
- <div class="add-tip" slot="reference" :class="{err: (one.status != '1' && one.status != '-1')}">[[textMap[one.status] || '']]</div>
- </el-popover>
- </div>
- </div>
- </div>
- <transition tag="div">
- <div>
- <div class="button-box" v-if="one.showCheck&&one.show">
- <button class="pass a-button" @click.stop="addChild(one)" style="font-size: 14px;width: auto;float:left;">新增[[one.title]]</button>
- </div>
- <div class="edit-content" :class="{t:one.title == '基本字段'}" v-show="one.show">
- <!--two-->
- <span v-show="one.content.length === 0">当前您还没有添加子包</span>
- <div class="edit two" v-for="(two,index) in one.content" :key="index">
- <div class="edit-title" v-if="two.title" @click="two.show = !two.show">
- <span>[[two.title]]</span>
- <div class="button-box">
- <button class="pass success" @click.stop="saveDataTwo(two,'1',one)" style="font-size: 14px;width: auto;float:left;">通过</button>
- <button class="pass default" @click.stop="saveDataTwo(two,'-1',one)" style="font-size: 14px;width: auto;float:left">取消</button>
- </div>
- <div class="button-box delete-box">
- <button class="pass" @click.stop="delNewTwo(one, index, two)">删除</button>
- </div>
- </div>
- <transition tag="div">
- <div class="edit-content" v-show="two.show">
- <!--input-->
- <div class="edit-input">
- <div v-for="uin of two.uInput" class="input-box" :key="uin.title">
- <div class="label" v-if="uin.selectArr">
- <span>[[uin.title]] : </span>
- <select v-model="uin.select" @change="selectchange(uin,'3', two, one)">
- <option disabled value="">请选择</option>
- <option v-for="o in uin.selectArr">[[o]]</option>
- </select>
- <div class="info-box">
- <div :class="{default: uin.status == '-1'}" @click="setStatus(uin,'-1', two, one)"></div>
- <div :class="{ok: uin.status == '1'}" @click="setStatus(uin,'1', two, one)"></div>
- <!--<div :class="{err: uin.status == '0'}" @click="uin.status = '0'"></div>-->
- <el-popover trigger="click" >
- <div style="text-align: right; margin: 0">
- <el-button type="success" size="mini" @click="setStatus(uin,'2', two, one)">新增</el-button>
- <el-button type="warning" size="mini" @click="setStatus(uin,'3', two, one)">修改</el-button>
- <el-button type="danger" size="mini" @click="setStatus(uin,'4', two, one)">删除</el-button>
- </div>
- <div class="add-tip" slot="reference" :class="{err: (uin.status != '1' && uin.status != '-1')}">[[textMap[uin.status] || '']]</div>
- </el-popover>
- </div>
- </div>
- <div class="label" v-else :title="uin.input">
- <span @click="goText(uin.title)">[[uin.title]] : </span>
- <input type="text" v-model="uin.input" @click="goText(uin.input)">
- <div class="info-box">
- <div :class="{default: uin.status == '-1'}" @click="setStatus(uin,'-1', two, one)"></div>
- <div :class="{ok: uin.status == '1'}" @click="setStatus(uin,'1', two, one)"></div>
- <!--<div :class="{err: uin.status == '0'}" @click="uin.status = '0'"></div>-->
- <el-popover trigger="click" >
- <div style="text-align: right; margin: 0">
- <el-button type="success" size="mini" @click="setStatus(uin,'2', two, one)">新增</el-button>
- <el-button type="warning" size="mini" @click="setStatus(uin,'3', two, one)">修改</el-button>
- <el-button type="danger" size="mini" @click="setStatus(uin,'4', two, one)">删除</el-button>
- </div>
- <div class="add-tip" slot="reference" :class="{err: (uin.status != '1' && uin.status != '-1')}">[[textMap[uin.status] || '']]</div>
- </el-popover>
- </div>
- </div>
- </div>
- </div>
- <!--three-->
- <!--<div>
- <div class="edit-title" v-show="one.title == '基本字段'">
- <span>候选人</span>
- <div class="info-box" >
- <div :class="{default: two.wstatus == '-1'}" @click="two.wstatus = '-1'"></div>
- <div :class="{ok: two.wstatus == '1'}" @click="two.wstatus = '1'"></div>
- <el-popover trigger="click" >
- <div style="text-align: right; margin: 0">
- <el-button type="success" size="mini" @click="two.wstatus = '2'">新增</el-button>
- <el-button type="warning" size="mini" @click="two.wstatus = '3'">修改</el-button>
- <el-button type="danger" size="mini" @click="two.wstatus = '4'">删除</el-button>
- </div>
- <div class="add-tip" slot="reference" :class="{err: (two.wstatus != '1' && two.wstatus != '-1')}">[[textMap[two.wstatus] || '']]</div>
- </el-popover>
- </div>
- </div>
- <div class="edit three" v-for="(three,index) in two.content" :key="index">
- <div class="edit-title" @click="three.show = !three.show">
- <span>[[three.title]]</span>
- </div>
- <div class="edit-content" v-show="three.show">
- <div class="edit-input">
- <div class="input-box" v-for="(threeUin,index) in three.uInput" :key="threeUin.title">
- <div class="label">
- <span @click="goText(threeUin.title)">[[threeUin.title]] : </span>
- <input type="text" v-model="threeUin.input" @click="goText(threeUin.input)">
- <div class="info-box">
- <div :class="{default: threeUin.status == '-1'}" @click="threeUin.status = '-1'"></div>
- <div :class="{ok: threeUin.status == '1'}" @click="threeUin.status = '1'"></div>
- <el-popover trigger="click" >
- <div style="text-align: right; margin: 0">
- <el-button type="success" size="mini" @click="threeUin.status = '2'">新增</el-button>
- <el-button type="warning" size="mini" @click="threeUin.status = '3'">修改</el-button>
- <el-button type="danger" size="mini" @click="threeUin.status = '4'">删除</el-button>
- </div>
- <div class="add-tip" slot="reference" :class="{err: (threeUin.status != '1' && threeUin.status != '-1')}">[[textMap[threeUin.status] || '']]</div>
- </el-popover>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>-->
- </div>
- </transition>
- </div>
- </div>
- </div>
- </transition>
- </div>
- </div>
- <div class="save-box">
- <!-- <button class="code" @click.stop="showPop = true" style="width:100px">源码</button> -->
- <button class="code" @click.stop="open(1)" style="width:100px">全部验证</button>
- <button class="code" @click.stop="open(2)" style="width:100px">字段验证</button>
- <!-- <button class="code" @click.stop="open('', false)" style="width:100px">保存</button> -->
- <button class="code" @click.stop="openHref" style="width:100px">下一条</button>
- <!--<button class="code" @click.stop="window.location.href='/'" style="width:100px">下一条</button>-->
- </div>
- </div>
- </div>
- <!--弹出层-->
- <dialog class="dialog" v-if="showPop">
- <span class="close" @click="showPop = false;changeText()">x</span>
- <div class="pop">
- <div class="title">源码</div>
- <div class="con" ref="text" contentEditable="true">
- <pre v-html="addStyle(editData)"></pre>
- </div>
- <button @click="showPop = false;changeText();upChange()">保 存</button>
- </div>
- </dialog>
- <dialog id="com-alert" class="dialog" style="background: rgba(124, 124, 125, 0.1);z-index:9999;display: none;">
- <div class="pop" style="background: rgba(124, 124, 125, 0.1);">
- <div id="com-alert-val" class="title" style="color:red">保存成功</div>
- </div>
- </dialog>
- </main>
- </body>
- <script>
- //记录是否点击保存
- var issave = false;
- var _id = {{.T.info._id}};
- var nextid = {{.T.nextid}};
- console.log(nextid)
- //基本信息
- var common={{.T.common}};
- var uInput=[];
- for(k in common){
- var tmp={}
- tmp.title=common[k].descript
- tmp.input=common[k].value
- tmp.key=common[k].key
- if(common[k].key=="subtype"){
- tmp.select=common[k].value
- tmp.selectArr={{.T.topsubtype}}
- }
- if(common[k].key=="attach_discern"){
- tmp.select=common[k].value
- tmp.selectArr=['识别有效','识别无效']
- }
- if(common[k].key=="attach_ext"){
- tmp.select=common[k].value
- tmp.selectArr=['抽取正确','抽取错误']
- }
- if(common[k].key=="isrepeat"){
- tmp.select=common[k].value
- tmp.selectArr=['是','否']
- }
- tmp.status=common[k].status
- uInput[k]=tmp
- }
- //时间地点
- var timeplace={{.T.timeplace}}
- var tpInput=[];
- for(k in timeplace){
- var tmp={}
- tmp.title=timeplace[k].descript
- tmp.input=timeplace[k].value
- tmp.key=timeplace[k].key
- tmp.status=timeplace[k].status
- tpInput[k]=tmp
- }
- //其他信息
- var other={{.T.other}}
- var otherInput=[];
- for(k in other){
- var tmp={}
- tmp.title=other[k].descript
- tmp.input=other[k].value
- tmp.key=other[k].key
- tmp.status=other[k].status
- if(other[k].key=="isppp"||other[k].key=="contract_guarantee"||other[k].key=="bid_guarantee"){
- tmp.select=other[k].value
- tmp.selectArr=['是','否']
- }
- otherInput[k]=tmp
- }
- //中标候选人
- var c_worder={{.T.worder}}
- var worder_new={{.T.worder_new}}
- var c_content=[];
- for(k in c_worder){
- var c_uInput=[];
- for(i in c_worder[k]){
- var tmp={}
- tmp.title=c_worder[k][i].descript
- tmp.input=c_worder[k][i].value||''
- tmp.key=c_worder[k][i].key
- tmp.status=c_worder[k][i].status
- c_uInput[i]=tmp
- }
- var content={};
- content.title="候选人"
- content.show=true
- content.status=-1
- content.uInput=c_uInput
- content.ck_isnew=worder_new[k] || false
- content.content=[]
- c_content[k]=content
- }
- //标的信息
- var purchasinglist={{.T.purchasinglist}}
- var pcl_new={{.T.pcl_new}}
- var pcl_content=[];
- for(k in purchasinglist){
- var c_uInput=[];
- for(i in purchasinglist[k]){
- var tmp={}
- tmp.title=purchasinglist[k][i].descript
- tmp.input=purchasinglist[k][i].value
- tmp.key=purchasinglist[k][i].key
- tmp.status=purchasinglist[k][i].status
- c_uInput[i]=tmp
- }
- var content={};
- content.title="标的物"
- content.show=true
- content.status=-1
- content.uInput=c_uInput
- content.ck_isnew=pcl_new[k] || false
- content.content=[]
- pcl_content[k]=content
- }
- //var ispackage='{{.T.ispackage}}'
- //子包信息
- var packs={{.T.packs}}
- var packskey={{.T.packskey}}
- var pkg_new={{.T.pkg_new}}
- //var ck_package='{{.T.ck_package}}'
- //分包抽查,若果有分包,默认ok
- //if(packs.length>0&&ispackage=="1"){
- // ck_package="1"
- //}
- var p_content=[];
- for(k in packs){
- //子包基本信息
- var uInputs=[];
- var pack=packs[k]["pack"]
- for(i in pack){
- var tmp={}
- tmp.title=pack[i].descript
- tmp.input=pack[i].value
- tmp.key=pack[i].key
- //if(pack[i].key=="bidstatus"){
- // tmp.select=pack[i].value
- // tmp.selectArr=['预告','招标','成交', '中标', '废标','流标']
- //}
- tmp.status=pack[i].status
- uInputs[i]=tmp
- }
- var content={};
- content.title="子包";
- content.show=true;
- content.status=-1
- content.uInput=uInputs;
- content.ck_isnew=pkg_new[k] || false
- content.num = packskey[k];
- p_content[k]=content;
- /**
- //子包候选人
- var pworder=packs[k]["pack_worder"]
- var p_in_content=[];
- for(i in pworder){
- var in_uInputs=[];
- for(n in pworder[i]){
- var tmp={}
- tmp.title=pworder[i][n].descript
- tmp.input=pworder[i][n].value
- tmp.key=pworder[i][n].key
- tmp.status=pworder[i][n].status
- in_uInputs[n]=tmp
- }
- var in_content={}
- in_content.title="候选人";
- if(i==0){
- in_content.show=true;
- }else{
- in_content.show=false;
- }
- in_content.uInput=in_uInputs;
- p_in_content[i]=in_content
- }
- content.content=p_in_content;
- p_content[k]=content;
- */
- }
- var pclf = {{.T.PurchasinglistField}};
- var pclfInput = []
- for(i in pclf){
- for(key in pclf[i]){
- pclfInput.push({
- input:"",
- key:key,
- status:"2",
- title:pclf[i][key]
- })
- }
- }
- var wodf = {{.T.WinnerorderField}};
- var wodfInput = []
- for(i in wodf){
- for(key in wodf[i]){
- wodfInput.push({
- input:"",
- key:key,
- status:"2",
- title:wodf[i][key]
- })
- }
- }
- var pf = {{.T.PackageField}};
- var pfInput = []
- for(i in pf){
- for(key in pf[i]){
- pfInput.push({
- input:"",
- key:key,
- status:"2",
- title:pf[i][key]
- })
- }
- }
- var app = new Vue({
- el: '#app',
- delimiters:["[[","]]"],
- data: {
- textMap: ['','','增', '改', '删'],
- tempHtml: `{{Html (Regexp (Regexp .T.info.detail "(\\n|\\\\n)\\s+" "\n") "(`|\\n|\\\\n)+" "<br/>")}}`,
- dataHtml: `{{Html (Regexp (Regexp .T.info.detail "(\\n|\\\\n)\\s+" "\n") "(`|\\n|\\\\n)+" "<br/>")}}`,
- fileHtml: `{{Html (Regexp (Regexp .T.info.filetext "(\\n|\\\\n)\\s+" "\n") "(`|\\n|\\\\n)+" "<br/>")}}`,
- showPop: false,
- editData: [
- {
- title: '基本字段',
- show:true,
- status:"1",
- content: [
- {
- title: '',
- show: true,
- delete: false,
- //wstatus:"-1",
- uInput: uInput
- //content: c_content
- }
- ]
- },
- {
- title: '时间地点',
- show:false,
- status:"1",
- content: [
- {
- title: '',
- show: true,
- delete: false,
- //wstatus:"-1",
- uInput: tpInput
- }
- ]
- },
- {
- title: '标的信息',
- show: false,
- showCheck: true,
- checkType: {{.T.ck_pclisext}},
- status: {{.T.ck_purchasinglist}},
- content: pcl_content
- },
- {
- title: '多包信息',
- show: false,
- showCheck: true,
- checkType: {{.T.ck_pkgisext}},
- status: {{.T.ck_package}},
- content: p_content
- },
- {
- title: '中标候选人信息',
- show: false,
- showCheck: true,
- checkType: {{.T.ck_wodrisext}},
- status: {{.T.ck_winnerorder}},
- content: c_content
- },
- {
- title: '其余信息',
- show:false,
- status:"1",
- content: [
- {
- title: '',
- show: true,
- delete: false,
- //wstatus:"-1",
- uInput: otherInput
- }
- ]
- }
- ]
- },
- methods: {
- selectchange(uni,status,two,one){
- this.setStatus(uni,status,two,one);
- },
- openHref () {
- if(!issave){
- alert("请先保存数据!")
- return
- }else{
- if(nextid==""){
- window.location.href = '/center/finishcheck';
- }else{
- $.ajax({
- url: "/center/checkid",
- type: "post",
- data: {"id":nextid},
- async: false,
- success: function (r) {
- if(r && r.msg == ""){
- if(r.exists){//标注完成
- window.location.href = "/center/finishcheck";
- }else if (!r.exists){
- window.location.href = "/center/detail/"+r.id+".html"
- }
- }else{
- alert("标注出错!"+r.msg)
- }
- }
- })
- }
- }
- },
- checkOneStatus: function (config) {
- var tempObj = {
- obj: config.type ? config.one : config.two
- }
- if (config.type) {
- tempObj.list = config.one.content
- } else {
- tempObj.list = config.two.uInput
- }
- var statusList = [0,0,0,0,0]
- for(var i in tempObj.list) {
- var tempList = tempObj.list[i]
- var tempIndex = Number(tempList.status)
- if (tempIndex == -1) {
- tempIndex = 0
- }
- statusList[tempIndex] = Number(statusList[tempIndex]) + 1
- }
- if (statusList[1] > 0) {
- tempObj.obj.status = 1
- }
- if (statusList[4] > 0 || statusList[3] > 0 || statusList[2] > 0) {
- tempObj.obj.status = 3
- }
- if (statusList[4] === tempObj.list.length) {
- tempObj.obj.status = 4
- }
- if (statusList[3] === tempObj.list.length) {
- tempObj.obj.status = 3
- }
- if (statusList[2] === tempObj.list.length) {
- tempObj.obj.status = 2
- }
- if (statusList[0] === tempObj.list.length) {
- tempObj.obj.status = -1
- }
- if (!config.type) {
- this.checkOneStatus({
- one: config.one,
- two: config.two,
- type: true
- })
- }
- },
- //切换状态按钮
- setStatus:function(witch,s, two, one){
- var key = witch.key
- //校验日期格式
- if(key=="bidendtime"||key=="bidopentime"||key=="project_startdate"||key=="project_completedate"||key=="publishtime"||key=="signaturedate"){
- var val = witch.input
- if(val!=""){
- 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$/;
- var regExp = new RegExp(reg);
- if(!regExp.test(val)){
- alert(witch.title+",日期格式错误!正确格式:2006-01-02 15:04:05")
- return
- }
- }
- }
- witch.status = s;
- if (two) {
- this.checkOneStatus({
- one: one,
- two: two,
- type: false
- })
- }
- },
- //二级删除
- delNewTwo: function (one, index, two) {
- if (two.ck_isnew) {
- one.content.splice(index, 1)
- } else {
- two.status = 4
- this.saveDataTwo(two, 4, one)
- }
- this.checkOneStatus({
- one: one,
- two: two,
- type: true
- })
- },
- /*add style*/
- addStyle: function (data) {
- //console.dir(data)
- return prettyPrint(data).replace(/(checkType|showCheck|wstatus|status|key|title|input|content|uInput|selectArr|select|show|true)/g, "<mark>$1</mark>")
- },
- /*同步修改源码*/
- changeText: function (boolean) {
- try {
- var tempText = JSON.parse(this.$refs.text.innerText.replace(/(\n|\s)/g, ''))
- if(boolean){
- this.tagvalues = tempText
- }else{
- this.editData = tempText
- }
- } catch (err) {
- alert('源码修改失败')
- }
- },
- goText: function (value) {
- /*重置Html*/
- this.dataHtml = this.tempHtml
- if (!value) {return false}
- var rs = new RegExp('(' + value + ')', 'gi')
- if (rs.test(this.dataHtml)) {
- this.dataHtml = this.dataHtml.replace(rs, '<mark>$1</mark>')
- /*延迟查询dom,防止dom未插入*/
- var $this = this
- setTimeout(function () {
- $this.goMark()
- }, 150)
- } else {
- /*重置Html*/
- this.dataHtml = this.tempHtml
- }
- },
- goMark: function () {
- /*滚动到第一个mark*/
- var temp = document.querySelectorAll('mark')[0]
- document.querySelector('.article').scrollTop = offset(temp).top - window.screen.height / 2
- },
- //markTag:function(n){
- // $.ajax({
- // url:"/markTag",
- // method:"post",
- // data: {tag:n,_id:_id},
- // success:function(res){
- // if(res){
- // document.getElementById("com-alert-val").innerHtml="标记成功";
- // var label1 = document.getElementById("com-alert");
- // label1.style.display="block";
- // setTimeout(function(){label1.style.display="none";},1000)
- // }
- // }
- // });
- //},
- addChild: function (one) {
- var tempNode = {}
- switch (one.title) {
- case "标的信息": {
- tempNode = {
- content: [],
- show:true,
- ck_isnew: true,
- status: 2,
- title:"标的物",
- uInput: JSON.parse(JSON.stringify(pclfInput))
- }
- break
- }
- case "多包信息": {pfInput
- tempNode = {
- content: [],
- show:true,
- status: 2,
- ck_isnew: true,
- title:"子包",
- uInput: JSON.parse(JSON.stringify(pfInput))
- }
- break
- }
- case "中标候选人信息": {
- tempNode = {
- content: [],
- show:true,
- status: 2,
- ck_isnew: true,
- title:"候选人",
- uInput: JSON.parse(JSON.stringify(wodfInput))
- }
- break
- }
- }
- // if (one.status >= 2) {
- // one.status = '2'
- // }
- one.content.push(tempNode)
- this.checkOneStatus({
- one: one,
- type: true
- })
- },
- //保存
- saveDataTwo:function(two,n, one){
- two.uInput.forEach(function(v) {
- var key = v.key
- if(key=="bidendtime"||key=="bidopentime"||key=="project_startdate"||key=="project_completedate"||key=="publishtime"||key=="signaturedate"){
- var val = v.input
- if(val!=""){
- 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$/;
- var regExp = new RegExp(reg);
- if(!regExp.test(val)){
- alert(v.title+",日期格式错误!正确格式:2006-01-02 15:04:05")
- return
- }
- }
- }
- if(n =="1" && v.status == "-1"){
- v.status = n
- } else if (n=="-1"){
- v.status = n
- } else if (n=="4"){
- v.status = n
- }
- });
- two.status = n
- this.checkOneStatus({
- one: one,
- two: two,
- type: false
- })
- /**
- two.content.forEach(function(v) {
- v.uInput.forEach(function(value) {
- if (value.input && value.input != '') {
- value.status = n
- }
- })
- })
- */
- },
- saveDataOne:function(one,n){
- //保存后的样式
- var _this = this
- one.content.forEach(function(v) {
- v.uInput.forEach(function(value) {
- var key = value.key
- if(n==1){
- if(key=="bidendtime"||key=="bidopentime"||key=="project_startdate"||key=="project_completedate"||key=="publishtime"||key=="signaturedate"){
- var val = value.input
- if(val != ""){
- 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$/;
- var regExp = new RegExp(reg);
- if(!regExp.test(val)){
- alert(value.title+",日期格式错误!正确格式:2006-01-02 15:04:05")
- return
- }
- }
- }
- }
- // 取消全部,通过时判断状态是否处于修改新增等
- if (n =="1" && value.status == "-1"){
- value.status = n
- }else if (n=="-1"){
- value.status = n
- }
- })
- _this.checkOneStatus({
- two: v,
- one: one,
- type: false
- })
- });
- // one.content.forEach(function(v) {
- // if (v.content) {
- // v.content.forEach(function(i) {
- // i.uInput.forEach(function(value) {
- // if (value.input && value.input != '') {
- // value.status = n
- // }
- // })
- // })
- // }
- // });
- //保存当前标记
- },
- //验证保存提示
- open:function(stype) {
- this.$confirm('是否保存?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.upChange(stype)
- }).catch(() => {
- });
- },
- //保存事件
- upChange: function (stype) {
- var resultStatus = false
- if (stype == 1) {
- var checkAllKey = this.editData.filter(function (one) {
- var otherOne = one.content.filter(function(v) {
- return v.uInput.filter(function (u) {
- return u.status == '-1'
- }).length
- })
- if ((one.title=="标的信息"||one.title=="多包信息"||one.title=="中标候选人信息") && (one.status == "-1")) {
- return true
- } else {
- return otherOne.length
- }
- })
- resultStatus = !Boolean(checkAllKey.length)
- } else {
- var checkOnlyKey = this.editData.filter(function (one) {
- if (one.title=="标的信息"||one.title=="多包信息"||one.title=="中标候选人信息") {
- if (one.status == "-1") {
- return false
- } else {
- if (one.content.length === 0) {
- return true
- }
- var otherOne = one.content.filter(function(v) {
- return v.uInput.filter(function (u) {
- return u.status == '-1'
- }).length
- })
- return !(otherOne.length > 0)
- }
- } else {
- var otherOne = one.content.filter(function(v) {
- return v.uInput.filter(function (u) {
- return u.status != '-1'
- }).length
- })
- return otherOne.length
- }
- })
- resultStatus = Boolean(checkOnlyKey.length)
- }
- if (!resultStatus) {
- this.$alert("未标注完成");
- return
- }
- var d= JSON.stringify(this.editData);
- console.log(d)
- var _this = this
- $.ajax({
- url:"/center/biaozhu",
- method:"post",
- data: {key:d,_id:_id,stype:stype},
- success:function(res){
- if(res){
- _this.$message({
- message: '保存成功',
- type: 'success',
- duration: 1000,
- offset: 300
- });
- // document.getElementById("com-alert-val").innerHtml="保存成功";
- // var label1 = document.getElementById("com-alert");
- // label1.style.display="block";
- // setTimeout(function(){
- // label1.style.display="none";
- // },1000)
- issave = true//保存成功
- }
- },
- error:function(err){
- alert(err);
- }
- });
- }
- /**
- //保存提示
- open:function(one, type) {
- this.$confirm('是否保存?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- if (type) {
- this.saveOneData(one)
- } else {
- this.upChange()
- }
- }).catch(() => {
- });
- },
- //一级保存
- saveOneData: function (one) {
- console.log(one.status)
- if (one.title=="标的信息"||one.title=="多包信息"||one.title=="中标候选人信息"){
- if(one.status == "-1"){
- this.$alert(one.title+" 未标注完成")
- return
- }else if (one.status !="-1"){
- var isAlert = one.content.filter(function(v) {
- return v.uInput.filter(function (u) {
- return u.status == '-1'
- }).length
- })
- if (isAlert.length) {
- this.$alert(one.title+" 未标注完成")
- return
- }
- }
- }
- onetext = "["+ JSON.stringify(one) +"]";
- console.log(onetext)
- $.ajax({
- url:"/center/biaozhu",
- method:"post",
- data: {key:onetext,_id:_id},
- success:function(res){
- if(res){
- document.getElementById("com-alert-val").innerHtml="保存成功";
- var label1 = document.getElementById("com-alert");
- label1.style.display="block";
- setTimeout(function(){
- label1.style.display="none";
- },
- 1000)
- }
- },
- error:function(err){
- alert(err);
- }
- });
- },
- */
- }
- })
- function offset(elem) {
- if(!elem) elem = this;
- var x = elem.offsetLeft;
- var y = elem.offsetTop;
- while (elem = elem.offsetParent) {
- x += elem.offsetLeft;
- y += elem.offsetTop;
- }
- return { left: x, top: y };
- }
- </script>
- </html>
|