(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-7e126288"],{"0560":function(t,e,n){"use strict";var o=n("88d4"),r=n("34cd").find,i=n("d421"),a="find",c=!0;a in[]&&Array(1)[a]((function(){c=!1})),o({target:"Array",proto:!0,forced:c},{find:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}}),i(a)},"2bb6":function(t,e,n){"use strict";var o="Material-Storage";e["a"]={get:function(t){var e=window.localStorage.getItem(o+"_"+t);return e?window.JSON.parse(e):""},set:function(t,e){window.localStorage.setItem(o+"_"+t,window.JSON.stringify(e))},del:function(t,e){window.localStorage.removeItem(o+"_"+t)}}},"3ef3":function(t,e,n){"use strict";var o=n("88d4"),r=n("34cd").findIndex,i=n("d421"),a="findIndex",c=!0;a in[]&&Array(1)[a]((function(){c=!1})),o({target:"Array",proto:!0,forced:c},{findIndex:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}}),i(a)},"4ce7":function(t,e,n){"use strict";n.r(e);var o=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("van-nav-bar",{staticClass:"shadow",attrs:{title:"报价核算","left-text":"返回","left-arrow":""},on:{"click-left":function(e){return t.$router.back(-1)}}}),n("div",{staticClass:"mt-2"},[n("div",{staticClass:"w-23/24 mx-auto"},[n("div",{},[n("p",{staticClass:"bg-yellow-600 bg-opacity-80 text-white px-4 py-2"},[n("span",{on:{click:function(e){return t.returnTab(-2)}}},[t._v(t._s(t.calc.name))]),t.now?[n("span",[t._v(" / "),n("span",{on:{click:function(e){return t.returnTab(-1)}}},[t._v("项目")])]),t._l(t.fromItems,(function(e,o){return[n("span",{key:e.id},[t._v(" / "),n("span",{on:{click:function(e){return t.returnTab(o)}}},[t._v(t._s(e.name))])])]}))]:t._e()],2),t.now?[n("div",{staticClass:"mt-4"},[t._l(t.now.items||t.now.childs,(function(e){return[n("div",{key:e.id},[t._l(t.fromNow.items.filter((function(t){return t.id==e.id})),(function(o,r){return[n("div",{key:r,staticClass:"shadow bg-white mb-2"},[n("p",{staticClass:"\n bg-blue-400\n text-white\n p-2\n flex\n justify-between\n items-center\n "},[n("span",[t._v(t._s(e.name)+" "+t._s(t.fromNow.items.filter((function(t){return t.id==e.id})).length>1?r+1:""))]),n("span",[t.edit?[e.max>t.fromNow.items.filter((function(t){return t.id==e.id})).length?n("van-icon",{attrs:{name:"plus"},on:{click:function(n){return t.addItem(e)}}}):t._e(),t.fromNow.items.filter((function(t){return t.id==e.id})).length>e.min?n("van-icon",{attrs:{name:"minus"},on:{click:function(n){return t.delItem(e,r)}}}):t._e()]:t._e(),e.childs.length>0?n("van-icon",{attrs:{name:"arrow"},on:{click:function(e){return t.selectItem(o,r)}}}):t._e()],2)]),e.typeId?[n("div",{on:{click:function(n){t.edit&&t.$router.push({path:"/calc/product",query:{calc_id:t.calc_id,type:e.typeId,index:t.fromNow.items.map((function(t,e){return Object.assign({},t,{i:e})})).filter((function(t){return t.id==o.id}))[r].i,order_id:t.order_id}})}}},[o.product&&o.product.id?n("div",{staticClass:"p-2 text-gray-400"},[n("div",{staticClass:"flex justify-between pb-2"},[n("span",[t._v(t._s(o.product.name))]),n("span",[t._v(t._s(Object.keys(o.product.spec).map((function(t){return o.product.spec[t]})).join(",")))])])]):n("div",{staticClass:"p-2 text-gray-400 text-center"},[t._v(" 请选择产品 ")])])]:t._e(),t._l(e.props,(function(e){return[1!=e.type?n("van-field",{key:e.id,attrs:{value:"array"==e.data_type?t.jsonArray(0==e.type?e.value:o.prop[e.id]).toString():0==e.type?e.value:o.prop[e.id],readonly:!t.edit||2!=e.type,placeholder:(3==e.type?"请选择":"请填写")+e.name,type:"number"==e.data_type?"number":"text",label:e.name},on:{input:function(n){return t.$set(o.prop,e.id,n)},click:function(n){t.edit&&t.$set(e,"select",!0)}},scopedSlots:t._u([{key:"button",fn:function(){return[t._v(t._s(e.unit))]},proxy:!0}],null,!0)}):t._e(),3==e.type?n("van-popup",{key:e.id+"_select",attrs:{round:"",position:"bottom"},model:{value:e.select,callback:function(n){t.$set(e,"select",n)},expression:"prop.select"}},[n("van-picker",{attrs:{"show-toolbar":"",columns:t.jsonArray(e.value)},on:{cancel:function(n){return t.$set(e,"select",!1)},confirm:function(n,r){t.$set(o.prop,e.id,"array"==e.data_type?JSON.stringify(n):n.toString()),t.$set(e,"select",!1)}}})],1):t._e()]})),t.edit?t._e():n("div",{staticStyle:{"border-top":"1px solid #bbb"}},[t._l(e.props,(function(e){return[1==e.type?n("van-field",{key:e.id,attrs:{value:o.results[e.id],readonly:"",type:"number"==e.data_type?"number":"text",label:e.name},scopedSlots:t._u([{key:"button",fn:function(){return[t._v(t._s(e.unit))]},proxy:!0}],null,!0)}):t._e()]}))],2)],2)]})),t.edit&&0==t.fromNow.items.filter((function(t){return t.id==e.id})).length&&e.max>0?[n("p",{staticClass:"\n bg-gray-400\n text-white\n p-2\n flex\n justify-between\n items-center\n mb-2\n "},[n("span",[t._v(t._s(e.name))]),n("van-icon",{attrs:{name:"plus"},on:{click:function(n){return t.addItem(e)}}})],1)]:t._e()],2)]}))],2)]:[t._l(t.calc.props,(function(e){return[1!=e.type?n("van-field",{key:e.id,attrs:{value:"array"==e.data_type?t.jsonArray(0==e.type?e.value:t.from.prop[e.id]).toString():0==e.type?e.value:t.from.prop[e.id],readonly:!t.edit||2!=e.type,placeholder:(3==e.type?"请选择":"请填写")+e.name,type:"number"==e.data_type?"number":"text",label:e.name},on:{input:function(n){return t.$set(t.from.prop,e.id,n)},click:function(n){t.edit&&t.$set(e,"select",!0)}},scopedSlots:t._u([{key:"button",fn:function(){return[t._v(t._s(e.unit))]},proxy:!0}],null,!0)}):t._e(),3==e.type?n("van-popup",{key:e.id+"_select",attrs:{round:"",position:"bottom"},model:{value:e.select,callback:function(n){t.$set(e,"select",n)},expression:"prop.select"}},[n("van-picker",{attrs:{"show-toolbar":"",columns:t.jsonArray(e.value)},on:{cancel:function(n){return t.$set(e,"select",!1)},confirm:function(n,o){t.$set(t.from.prop,e.id,"array"==e.data_type?JSON.stringify(n):n.toString()),t.$set(e,"select",!1)}}})],1):t._e()]})),t.edit?t._e():n("div",{staticStyle:{"border-top":"1px solid #bbb"}},[t._l(t.calc.props,(function(e){return[1==e.type?n("van-field",{key:e.id,attrs:{value:t.from.results[e.id],readonly:"",type:"number"==e.data_type?"number":"text",label:e.name},scopedSlots:t._u([{key:"button",fn:function(){return[t._v(t._s(e.unit))]},proxy:!0}],null,!0)}):t._e()]}))],2)]],2),t.now?t._e():n("van-button",{staticClass:"mt-4",attrs:{block:"",type:"info"},on:{click:function(e){return t.selectItem()}}},[t._v("选择项目")])],1)]),t.order_id?[t.edit?n("div",{staticClass:"fixed bottom-0 left-0 w-full xl:w-800px xl:left-400pxh"},[n("div",{staticClass:"\n inline-block\n w-1/2\n xl:w-800px xl:left-400pxh\n text-white\n bg-blue-500\n text-center\n py-3\n ",on:{click:t.handleCalc}},[t._v(" 核算 ")]),n("div",{staticClass:"\n inline-block\n w-1/2\n xl:w-800px xl:left-400pxh\n text-white\n bg-red-500\n text-center\n py-3\n ",on:{click:function(e){t.from=JSON.parse(JSON.stringify(t.orderFrom)),t.edit=!1}}},[t._v(" 取消 ")])]):n("div",{staticClass:"fixed bottom-0 left-0 w-full xl:w-800px xl:left-400pxh"},[n("div",{staticClass:"\n inline-block\n xl:w-800px xl:left-400pxh\n text-white\n bg-green-500\n text-center\n py-3\n ",class:0==t.files.length?"w-full":"w-1/2",on:{click:function(e){t.edit=!0}}},[t._v(" 编辑 ")]),0!=t.files.length?n("div",{staticClass:"\n inline-block\n w-1/2\n xl:w-800px xl:left-400pxh\n text-white\n bg-blue-500\n text-center\n py-3\n ",on:{click:function(e){t.fileShow=!0}}},[t._v(" 导出 ")]):t._e()])]:n("span",{staticClass:"\n fixed\n bottom-0\n left-0\n w-full\n xl:w-800px xl:left-400pxh\n text-white\n bg-blue-500\n text-center\n py-3\n ",on:{click:t.handleCalc}},[t._v("核算")]),n("van-popup",{staticClass:"flex flex-col overflow-hidden",style:{height:"30%"},attrs:{round:"",position:"bottom"},model:{value:t.fileShow,callback:function(e){t.fileShow=e},expression:"fileShow"}},[n("div",{staticClass:"mt-5 text-center"},[n("span",[t._v("导出")])]),n("van-cell-group",{staticClass:"flex-1 overflow-auto"},t._l(t.files,(function(e,o){return n("van-cell",{key:o,attrs:{title:e.name,"is-link":""},on:{click:function(n){return t.handleExport(e)}}})})),1)],1),n("van-dialog",{attrs:{title:"下载提示","show-confirm-button":!1},model:{value:t.showDialog,callback:function(e){t.showDialog=e},expression:"showDialog"}},[n("div",{staticClass:"p-4 text-sm"},[n("div",[t._v("请复制链接到其它浏览器下载")]),n("div",{staticClass:"text-red-600 py-4"},[t._v(t._s(t.downloadUrl))])]),n("div",{staticClass:"flex text-center"},[n("div",{staticClass:"w-1/2 bg-gray-100 py-2",on:{click:function(e){t.showDialog=!1}}},[t._v(" 关闭 ")]),n("div",{staticClass:"copyDownload w-1/2 bg-blue-400 text-white py-2",attrs:{"data-clipboard-text":t.downloadUrl},on:{click:t.copy}},[t._v(" 一键复制 ")])])])],2)},r=[],i=(n("6c8f"),n("89a8"),n("1a91"),n("3ef3"),n("5a05"),n("8ea3"),n("87d5"),n("0560"),n("993f"),n("4c1e"),n("d1ba"),n("f962")),a=n.n(i),c=n("d8ae"),s=n("2bb6"),u=n("eaf8"),l=n("afd4"),f={data:function(){return{edit:!1,key:"",calc_id:0,order_id:0,calc:{},items:[],now:null,from:{},orderFrom:{},fromItems:[],fromNow:null,files:[],fileShow:!1,showDialog:!1,downloadUrl:"",console:console}},created:function(){this.initPage()},methods:{jsonArray:l["b"],initPage:function(){this.calc_id=this.$route.query&&this.$route.query.calc_id,this.order_id=this.$route.query&&this.$route.query.order_id,this.edit=!(!this.$route.query||!this.$route.query.edit),this.order_id?(this.key="calculate_edit_"+this.order_id,this.loadOrderInfo()):(this.key="calculate_"+this.calc_id,this.loadCalcInfo())},loadCache:function(){var t=this;if(this.edit&&s["a"].get(this.key)){var e=s["a"].get(this.key);this.from=e.from,this.items=[],this.now=0!=e.items.length||e.now?this.calc:null,this.fromItems=[],this.fromNow=0!=e.items.length||e.now?this.from:null,e.items.forEach((function(e){t.selectItem(t.fromNow.items[e.index],t.fromNow.items.map((function(t,e){return Object.assign({},t,{i:e})})).filter((function(t){return t.id==e.id})).findIndex((function(t){return t.i==e.index})))}))}else this.initCalc()},saveCache:function(){var t={from:this.from,items:this.fromItems.map((function(t){return{id:t.id,index:t.index}})),now:!!this.now};s["a"].set(this.key,t)},initItem:function(t){var e=this,n={id:t.id,prop:{},items:[]};return t.props.forEach((function(t){2==t.type&&(n.prop[t.id]=t.value)})),(t.items||t.childs).forEach((function(t){for(var o=0;o1&&(t.name=t.name+" "+(e+1)),this.fromItems.push(t),this.fromNow=t}else this.items=[],this.now=this.calc,this.fromItems=[],this.fromNow=this.from;this.saveCache()},returnTab:function(t){-2==t?(this.items=[],this.now=null,this.fromItems=[],this.fromNow=null):-1==t?(this.items=[],this.now=this.calc,this.fromItems=[],this.fromNow=this.from):(this.items.splice(t+1),this.now=this.items[t],this.fromItems.splice(t+1),this.fromNow=this.fromItems[t]),this.saveCache()},addItem:function(t){this.fromNow.items.filter((function(e){return e.id==t.id})).length>=t.max||(this.fromNow.items.push(this.initItem(t)),this.saveCache())},delItem:function(t,e){var n=this.fromNow.items.map((function(t,e){return Object.assign({},t,{i:e})})).filter((function(e){return e.id==t.id}))[e].i;this.fromNow.items.splice(n,1),this.saveCache()},handleCalc:function(){var t=this;this.$store.commit("loading/showLoading"),Object(c["b"])(this.order_id?"/order/edit/"+this.order_id:"/calc",this.from).then((function(e){console.log(e),t.order_id||(t.order_id=e.data.id),t.$router.replace({path:"/calc/detail",query:{order_id:t.order_id}}),t.initPage()})).catch((function(){t.$store.commit("loading/hideLoading")}))},handleExport:function(t){var e=this;Object(c["a"])("/order/"+this.order_id+"/export/"+t.id).then((function(t){Object(u["b"])()?(e.downloadUrl=e.$env.baseUrl+t.data.path,e.showDialog=!0):e.$axios({url:e.$env.baseUrl+t.data.path,method:"get",responseType:"blob"}).then((function(e){Object(u["a"])(t.data.filename,e.data)}))}))},copy:function(){var t=this,e=new a.a(".copyDownload");e.on("success",(function(e){t.$toast("复制成功"),e.clearSelection()})),e.on("error",(function(e){t.$toast("复制失败")}))}}},d=f,p=n("cba8"),h=Object(p["a"])(d,o,r,!1,null,null,null);e["default"]=h.exports},"5a05":function(t,e,n){"use strict";var o=n("88d4"),r=n("34cd").filter,i=n("3a6d"),a=i("filter");o({target:"Array",proto:!0,forced:!a},{filter:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}})},"87d5":function(t,e,n){var o=n("88d4"),r=n("8735"),i=n("da77"),a=n("e7c5"),c=n("ce5b"),s=n("9ad2"),u=r.Array,l=i("JSON","stringify"),f=c(/./.exec),d=c("".charAt),p=c("".charCodeAt),h=c("".replace),m=c(1..toString),y=/[\uD800-\uDFFF]/g,v=/^[\uD800-\uDBFF]$/,g=/^[\uDC00-\uDFFF]$/,b=function(t,e,n){var o=d(n,e-1),r=d(n,e+1);return f(v,t)&&!f(g,r)||f(g,t)&&!f(v,o)?"\\u"+m(p(t,0),16):t},w=s((function(){return'"\\udf06\\ud834"'!==l("\udf06\ud834")||'"\\udead"'!==l("\udead")}));l&&o({target:"JSON",stat:!0,forced:w},{stringify:function(t,e,n){for(var o=0,r=arguments.length,i=u(r);o1?arguments[1]:void 0)}})},"993f":function(t,e,n){"use strict";var o=n("88d4"),r=n("8735"),i=n("1c34"),a=n("58db"),c=n("126a"),s=n("ac3c"),u=n("492f"),l=n("c40a"),f=n("3a6d"),d=f("splice"),p=r.TypeError,h=Math.max,m=Math.min,y=9007199254740991,v="Maximum allowed length exceeded";o({target:"Array",proto:!0,forced:!d},{splice:function(t,e){var n,o,r,f,d,g,b=s(this),w=c(b),x=i(t,w),_=arguments.length;if(0===_?n=o=0:1===_?(n=0,o=w-x):(n=_-2,o=m(h(a(e),0),w-x)),w+n-o>y)throw p(v);for(r=u(b,o),f=0;fw-o+n;f--)delete b[f-1]}else if(n>o)for(f=w-o;f>x;f--)d=f+o-1,g=f+n-1,d in b?b[g]=b[d]:delete b[g];for(f=0;f1&&void 0!==arguments[1]?arguments[1]:{container:document.body},n="";if("string"===typeof t){var o=d(t);e.container.appendChild(o),n=s()(o),u("copy"),o.remove()}else n=s()(t),u("copy");return n},h=p;function m(t){return m="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},m(t)}var y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.action,n=void 0===e?"copy":e,o=t.container,r=t.target,i=t.text;if("copy"!==n&&"cut"!==n)throw new Error('Invalid "action" value, use either "copy" or "cut"');if(void 0!==r){if(!r||"object"!==m(r)||1!==r.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===n&&r.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===n&&(r.hasAttribute("readonly")||r.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes')}return i?h(i,{container:o}):r?"cut"===n?f(r):h(r,{container:o}):void 0},v=y;function g(t){return g="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},g(t)}function b(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function w(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"===typeof t.action?t.action:this.defaultAction,this.target="function"===typeof t.target?t.target:this.defaultTarget,this.text="function"===typeof t.text?t.text:this.defaultText,this.container="object"===g(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=a()(t,"click",(function(t){return e.onClick(t)}))}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget,n=this.action(e)||"copy",o=v({action:n,container:this.container,target:this.target(e),text:this.text(e)});this.emit(o?"success":"error",{action:n,text:o,trigger:e,clearSelection:function(){e&&e.focus(),document.activeElement.blur(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(t){return j("action",t)}},{key:"defaultTarget",value:function(t){var e=j("target",t);if(e)return document.querySelector(e)}},{key:"defaultText",value:function(t){return j("text",t)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{container:document.body};return h(t,e)}},{key:"cut",value:function(t){return f(t)}},{key:"isSupported",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],e="string"===typeof t?[t]:t,n=!!document.queryCommandSupported;return e.forEach((function(t){n=n&&!!document.queryCommandSupported(t)})),n}}]),n}(r()),A=N},828:function(t){var e=9;if("undefined"!==typeof Element&&!Element.prototype.matches){var n=Element.prototype;n.matches=n.matchesSelector||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector}function o(t,n){while(t&&t.nodeType!==e){if("function"===typeof t.matches&&t.matches(n))return t;t=t.parentNode}}t.exports=o},438:function(t,e,n){var o=n(828);function r(t,e,n,o,r){var i=a.apply(this,arguments);return t.addEventListener(n,i,r),{destroy:function(){t.removeEventListener(n,i,r)}}}function i(t,e,n,o,i){return"function"===typeof t.addEventListener?r.apply(null,arguments):"function"===typeof n?r.bind(null,document).apply(null,arguments):("string"===typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,(function(t){return r(t,e,n,o,i)})))}function a(t,e,n,r){return function(n){n.delegateTarget=o(n.target,e),n.delegateTarget&&r.call(t,n)}}t.exports=i},879:function(t,e){e.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},e.nodeList=function(t){var n=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===n||"[object HTMLCollection]"===n)&&"length"in t&&(0===t.length||e.node(t[0]))},e.string=function(t){return"string"===typeof t||t instanceof String},e.fn=function(t){var e=Object.prototype.toString.call(t);return"[object Function]"===e}},370:function(t,e,n){var o=n(879),r=n(438);function i(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!o.string(e))throw new TypeError("Second argument must be a String");if(!o.fn(n))throw new TypeError("Third argument must be a Function");if(o.node(t))return a(t,e,n);if(o.nodeList(t))return c(t,e,n);if(o.string(t))return s(t,e,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function a(t,e,n){return t.addEventListener(e,n),{destroy:function(){t.removeEventListener(e,n)}}}function c(t,e,n){return Array.prototype.forEach.call(t,(function(t){t.addEventListener(e,n)})),{destroy:function(){Array.prototype.forEach.call(t,(function(t){t.removeEventListener(e,n)}))}}}function s(t,e,n){return r(document.body,t,e,n)}t.exports=i},817:function(t){function e(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var o=window.getSelection(),r=document.createRange();r.selectNodeContents(t),o.removeAllRanges(),o.addRange(r),e=o.toString()}return e}t.exports=e},279:function(t){function e(){}e.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var o=this;function r(){o.off(t,r),e.apply(n,arguments)}return r._=e,this.on(t,r,n)},emit:function(t){var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=n.length;for(o;o