Commit eb3327a5 by 无尘

add store plugin

parent a67051cb
{
"presets": [
["env", { "modules": false }],
"stage-3"
]
}
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
.DS_Store
node_modules/
npm-debug.log
yarn-error.log
# Editor directories and files
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
\ No newline at end of file
# vue 插件—-门店选择
<<<<<<< HEAD
> A Vue.js Store select Plugin
## Install
```shell
npm install @gic-test/vue-gic-store -S
```
## how to use
```
// main.js
import vueGicStore from '@gic-test/vue-gic-store'
Vue.use(vueGicStore)
// 使用页面
<div @click="showStore">点击弹窗</div>
<vue-gic-store :projectName="projectName" :selectId="selectId" :showStoreDialog="showStoreDialog" @selectStore="selectStore"></vue-gic-store>
data() {
return {
// 可传参数
projectName: '', // 当前项目名
showStoreDialog: false,
selectId: '',// 已选的门店
}
}
methods: {
// 显示门店弹窗
showStore() {
var that = this
that.showStoreDialog = true;
},
// 子组件触发方法
selectStore(val) {
// 模拟检查数据
console.log(val)
var that = this
that.showStoreDialog = false;
}
},
```
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("vue-gic-store",[],t):"object"==typeof exports?exports["vue-gic-store"]=t():e["vue-gic-store"]=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,o){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=3)}([function(e,t,r){"use strict";var o=r(11),n=r.n(o);t.a={name:"vue-gic-store",props:["showStoreDialog","projectName","selectId"],data:function(){return{repProjectName:"gic-web",searchText:"",tableStoreData:[],showShopDetail:"",currentRow:null,radioStore:null,dialogStore:!1,storeCurrentPage:1,storePageSize:5,total:1,baseUrl:""}},beforeMount:function(){var e=this,t=window.location.origin;console.log("当前host:",t),"-1"!=t.indexOf("localhost")?e.baseUrl="http://gicdev.demogic.com":e.baseUrl=t},methods:{handleChangeSelectStore:function(e){var t=this;console.log("table: ",e),t.radioStore=e.storeId,t.currentRow=e},storeSizeChange:function(e){console.log("每页 "+e+" 条")},storeCurrentChange:function(e){console.log("当前页: "+e);var t=this;t.storeCurrentPage=e,t.getStoreList()},setNewData:function(e){this.dialogStore=e,console.log("弹框是否显示: ",e)},toSearchInput:function(e){var t=this;console.log("搜索值: ",t.searchStoreValue,e),t.storeCurrentPage=1,t.getStoreList()},clearInput:function(e){var t=this;console.log(e,t.searchStoreValue),t.storeCurrentPage=1,t.getStoreList()},dialogStoreConfirm:function(){var e=this;if(!e.currentRow||!Object.keys(e.currentRow).length||!Object.values(e.currentRow).length)return void e.$message.error({duration:1e3,message:"请选择门店"});e.$emit("selectStore",e.currentRow),e.currentRow={},e.radioStore=null},handleStoreClose:function(){this.dialogStorecancel()},dialogStorecancel:function(){var e=this;console.log("点击确认"),e.dialogStore=!1,e.currentRow={},e.radioStore=null,e.$emit("selectStore",e.currentRow)},getStoreList:function(){var e=this,t={currentPage:e.storeCurrentPage,pageSize:e.storePageSize,searchName:e.searchStoreValue||"",requestProject:e.repProjectName};e.axios.post(e.baseUrl+"/api-admin/store-list-paging",n.a.stringify(t)).then(function(t){console.log(t,t.data,t.data.errorCode);var r=t.data;if(0==r.errorCode)return e.tableStoreData=r.result.list,void(e.total=r.result.page.totalCount);e.$message.error({duration:1e3,message:r.message})}).catch(function(t){console.log(t),e.$message.error({duration:1e3,message:t.message})})}},watch:{showStoreDialog:function(e,t){var r=this;console.log("新数据:",e,t),r.setNewData(e)},projectName:function(e,t){this.repProjectName=e||"gic-web"},selectId:function(e,t){this.radioStore=e}},mounted:function(){console.log("传递的参数对象:",this.showStoreDialog);var e=this;e.repProjectName=e.projectName||"gic-web",e.radioStore=e.selectId,e.getStoreList(),e.setNewData(e.showStoreDialog)}}},function(e,t,r){"use strict";var o=Object.prototype.hasOwnProperty,n=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}();t.arrayToObject=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},o=0;o<e.length;++o)void 0!==e[o]&&(r[o]=e[o]);return r},t.merge=function(e,r,n){if(!r)return e;if("object"!=typeof r){if(Array.isArray(e))e.push(r);else{if("object"!=typeof e)return[e,r];(n.plainObjects||n.allowPrototypes||!o.call(Object.prototype,r))&&(e[r]=!0)}return e}if("object"!=typeof e)return[e].concat(r);var a=e;return Array.isArray(e)&&!Array.isArray(r)&&(a=t.arrayToObject(e,n)),Array.isArray(e)&&Array.isArray(r)?(r.forEach(function(r,a){o.call(e,a)?e[a]&&"object"==typeof e[a]?e[a]=t.merge(e[a],r,n):e.push(r):e[a]=r}),e):Object.keys(r).reduce(function(e,o){var a=r[o];return Object.prototype.hasOwnProperty.call(e,o)?e[o]=t.merge(e[o],a,n):e[o]=a,e},a)},t.decode=function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}},t.encode=function(e){if(0===e.length)return e;for(var t="string"==typeof e?e:String(e),r="",o=0;o<t.length;++o){var a=t.charCodeAt(o);45===a||46===a||95===a||126===a||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?r+=t.charAt(o):a<128?r+=n[a]:a<2048?r+=n[192|a>>6]+n[128|63&a]:a<55296||a>=57344?r+=n[224|a>>12]+n[128|a>>6&63]+n[128|63&a]:(o+=1,a=65536+((1023&a)<<10|1023&t.charCodeAt(o)),r+=n[240|a>>18]+n[128|a>>12&63]+n[128|a>>6&63]+n[128|63&a])}return r},t.compact=function(e,r){if("object"!=typeof e||null===e)return e;var o=r||[],n=o.indexOf(e);if(-1!==n)return o[n];if(o.push(e),Array.isArray(e)){for(var a=[],i=0;i<e.length;++i)e[i]&&"object"==typeof e[i]?a.push(t.compact(e[i],o)):void 0!==e[i]&&a.push(e[i]);return a}return Object.keys(e).forEach(function(r){e[r]=t.compact(e[r],o)}),e},t.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},t.isBuffer=function(e){return null!==e&&void 0!==e&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}},function(e,t,r){"use strict";var o=String.prototype.replace,n=/%20/g;e.exports={default:"RFC3986",formatters:{RFC1738:function(e){return o.call(e,n,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(4),n={install:function(e,t){e.component(o.a.name,o.a)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use(n),t.default=n},function(e,t,r){"use strict";function o(e){r(5)}var n=r(0),a=r(14),i=r(10),s=o,l=i(n.a,a.a,!1,s,"data-v-3514676a",null);t.a=l.exports},function(e,t,r){var o=r(6);"string"==typeof o&&(o=[[e.i,o,""]]),o.locals&&(e.exports=o.locals);r(8)("b0b8ad1a",o,!0,{})},function(e,t,r){t=e.exports=r(7)(!1),t.push([e.i,".choose-wrap .search[data-v-3514676a]{width:260px;margin-bottom:24px}.choose-wrap .text-normal[data-v-3514676a]{margin:0;color:#606266;font-size:14px;font-weight:400}.choose-wrap .choose-list[data-v-3514676a]{max-height:404px;border-top:1px solid #ebeef5}.choose-wrap .choose-list .list-img[data-v-3514676a]{width:80px;height:80px}.choose-wrap .choose-list .list-img img[data-v-3514676a]{width:100%;height:100%}.choose-wrap .pagination[data-v-3514676a]{text-align:right;margin-top:20px;line-height:1}.choose-wrap[data-v-3514676a] .el-dialog{height:677px;top:50%;transform:translateY(-50%)}.choose-wrap[data-v-3514676a] .el-dialog__header{line-height:24px}.choose-wrap[data-v-3514676a] .el-input,.choose-wrap[data-v-3514676a] .el-input .el-input__inner{height:40px;line-height:40px}.choose-shop-list[data-v-3514676a] .el-table__row{cursor:pointer}.choose-shop-list[data-v-3514676a] .el-table .has-gutter{line-height:1}.choose-wrap[data-v-3514676a] .el-dialog__body{padding:10px 20px}",""])},function(e,t){function r(e,t){var r=e[1]||"",n=e[3];if(!n)return r;if(t&&"function"==typeof btoa){var a=o(n);return[r].concat(n.sources.map(function(e){return"/*# sourceURL="+n.sourceRoot+e+" */"})).concat([a]).join("\n")}return[r].join("\n")}function o(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"}e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var o=r(t,e);return t[2]?"@media "+t[2]+"{"+o+"}":o}).join("")},t.i=function(e,r){"string"==typeof e&&(e=[[null,e,""]]);for(var o={},n=0;n<this.length;n++){var a=this[n][0];"number"==typeof a&&(o[a]=!0)}for(n=0;n<e.length;n++){var i=e[n];"number"==typeof i[0]&&o[i[0]]||(r&&!i[2]?i[2]=r:r&&(i[2]="("+i[2]+") and ("+r+")"),t.push(i))}},t}},function(e,t,r){function o(e){for(var t=0;t<e.length;t++){var r=e[t],o=u[r.id];if(o){o.refs++;for(var n=0;n<o.parts.length;n++)o.parts[n](r.parts[n]);for(;n<r.parts.length;n++)o.parts.push(a(r.parts[n]));o.parts.length>r.parts.length&&(o.parts.length=r.parts.length)}else{for(var i=[],n=0;n<r.parts.length;n++)i.push(a(r.parts[n]));u[r.id]={id:r.id,refs:1,parts:i}}}}function n(){var e=document.createElement("style");return e.type="text/css",p.appendChild(e),e}function a(e){var t,r,o=document.querySelector("style["+m+'~="'+e.id+'"]');if(o){if(h)return g;o.parentNode.removeChild(o)}if(y){var a=d++;o=f||(f=n()),t=i.bind(null,o,a,!1),r=i.bind(null,o,a,!0)}else o=n(),t=s.bind(null,o),r=function(){o.parentNode.removeChild(o)};return t(e),function(o){if(o){if(o.css===e.css&&o.media===e.media&&o.sourceMap===e.sourceMap)return;t(e=o)}else r()}}function i(e,t,r,o){var n=r?"":o.css;if(e.styleSheet)e.styleSheet.cssText=b(t,n);else{var a=document.createTextNode(n),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(a,i[t]):e.appendChild(a)}}function s(e,t){var r=t.css,o=t.media,n=t.sourceMap;if(o&&e.setAttribute("media",o),v.ssrId&&e.setAttribute(m,t.id),n&&(r+="\n/*# sourceURL="+n.sources[0]+" */",r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */"),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}var l="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!l)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var c=r(9),u={},p=l&&(document.head||document.getElementsByTagName("head")[0]),f=null,d=0,h=!1,g=function(){},v=null,m="data-vue-ssr-id",y="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());e.exports=function(e,t,r,n){h=r,v=n||{};var a=c(e,t);return o(a),function(t){for(var r=[],n=0;n<a.length;n++){var i=a[n],s=u[i.id];s.refs--,r.push(s)}t?(a=c(e,t),o(a)):a=[];for(var n=0;n<r.length;n++){var s=r[n];if(0===s.refs){for(var l=0;l<s.parts.length;l++)s.parts[l]();delete u[s.id]}}}};var b=function(){var e=[];return function(t,r){return e[t]=r,e.filter(Boolean).join("\n")}}()},function(e,t){e.exports=function(e,t){for(var r=[],o={},n=0;n<t.length;n++){var a=t[n],i=a[0],s=a[1],l=a[2],c=a[3],u={id:e+":"+n,css:s,media:l,sourceMap:c};o[i]?o[i].parts.push(u):r.push(o[i]={id:i,parts:[u]})}return r}},function(e,t){e.exports=function(e,t,r,o,n,a){var i,s=e=e||{},l=typeof e.default;"object"!==l&&"function"!==l||(i=e,s=e.default);var c="function"==typeof s?s.options:s;t&&(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0),r&&(c.functional=!0),n&&(c._scopeId=n);var u;if(a?(u=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},c._ssrRegister=u):o&&(u=o),u){var p=c.functional,f=p?c.render:c.beforeCreate;p?(c._injectStyles=u,c.render=function(e,t){return u.call(t),f(e,t)}):c.beforeCreate=f?[].concat(f,u):[u]}return{esModule:i,exports:s,options:c}}},function(e,t,r){"use strict";var o=r(12),n=r(13),a=r(2);e.exports={formats:a,parse:n,stringify:o}},function(e,t,r){"use strict";var o=r(1),n=r(2),a={brackets:function(e){return e+"[]"},indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},i=Date.prototype.toISOString,s={delimiter:"&",encode:!0,encoder:o.encode,serializeDate:function(e){return i.call(e)},skipNulls:!1,strictNullHandling:!1},l=function e(t,r,n,a,i,s,l,c,u,p,f){var d=t;if("function"==typeof l)d=l(r,d);else if(d instanceof Date)d=p(d);else if(null===d){if(a)return s?s(r):r;d=""}if("string"==typeof d||"number"==typeof d||"boolean"==typeof d||o.isBuffer(d))return s?[f(s(r))+"="+f(s(d))]:[f(r)+"="+f(String(d))];var h=[];if(void 0===d)return h;var g;if(Array.isArray(l))g=l;else{var v=Object.keys(d);g=c?v.sort(c):v}for(var m=0;m<g.length;++m){var y=g[m];i&&null===d[y]||(h=Array.isArray(d)?h.concat(e(d[y],n(r,y),n,a,i,s,l,c,u,p,f)):h.concat(e(d[y],r+(u?"."+y:"["+y+"]"),n,a,i,s,l,c,u,p,f)))}return h};e.exports=function(e,t){var r=e,o=t||{};if(null!==o.encoder&&void 0!==o.encoder&&"function"!=typeof o.encoder)throw new TypeError("Encoder has to be a function.");var i=void 0===o.delimiter?s.delimiter:o.delimiter,c="boolean"==typeof o.strictNullHandling?o.strictNullHandling:s.strictNullHandling,u="boolean"==typeof o.skipNulls?o.skipNulls:s.skipNulls,p="boolean"==typeof o.encode?o.encode:s.encode,f=p?"function"==typeof o.encoder?o.encoder:s.encoder:null,d="function"==typeof o.sort?o.sort:null,h=void 0!==o.allowDots&&o.allowDots,g="function"==typeof o.serializeDate?o.serializeDate:s.serializeDate;if(void 0===o.format)o.format=n.default;else if(!Object.prototype.hasOwnProperty.call(n.formatters,o.format))throw new TypeError("Unknown format option provided.");var v,m,y=n.formatters[o.format];"function"==typeof o.filter?(m=o.filter,r=m("",r)):Array.isArray(o.filter)&&(m=o.filter,v=m);var b=[];if("object"!=typeof r||null===r)return"";var w;w=o.arrayFormat in a?o.arrayFormat:"indices"in o?o.indices?"indices":"repeat":"indices";var S=a[w];v||(v=Object.keys(r)),d&&v.sort(d);for(var x=0;x<v.length;++x){var j=v[x];u&&null===r[j]||(b=b.concat(l(r[j],j,S,c,u,f,m,d,h,g,y)))}return b.join(i)}},function(e,t,r){"use strict";var o=r(1),n=Object.prototype.hasOwnProperty,a={allowDots:!1,allowPrototypes:!1,arrayLimit:20,decoder:o.decode,delimiter:"&",depth:5,parameterLimit:1e3,plainObjects:!1,strictNullHandling:!1},i=function(e,t){for(var r={},o=e.split(t.delimiter,t.parameterLimit===1/0?void 0:t.parameterLimit),a=0;a<o.length;++a){var i,s,l=o[a],c=-1===l.indexOf("]=")?l.indexOf("="):l.indexOf("]=")+1;-1===c?(i=t.decoder(l),s=t.strictNullHandling?null:""):(i=t.decoder(l.slice(0,c)),s=t.decoder(l.slice(c+1))),n.call(r,i)?r[i]=[].concat(r[i]).concat(s):r[i]=s}return r},s=function(e,t,r){if(!e.length)return t;var o,n=e.shift();if("[]"===n)o=[],o=o.concat(s(e,t,r));else{o=r.plainObjects?Object.create(null):{};var a="["===n.charAt(0)&&"]"===n.charAt(n.length-1)?n.slice(1,-1):n,i=parseInt(a,10);!isNaN(i)&&n!==a&&String(i)===a&&i>=0&&r.parseArrays&&i<=r.arrayLimit?(o=[],o[i]=s(e,t,r)):o[a]=s(e,t,r)}return o},l=function(e,t,r){if(e){var o=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/,i=/(\[[^[\]]*])/g,l=a.exec(o),c=l?o.slice(0,l.index):o,u=[];if(c){if(!r.plainObjects&&n.call(Object.prototype,c)&&!r.allowPrototypes)return;u.push(c)}for(var p=0;null!==(l=i.exec(o))&&p<r.depth;){if(p+=1,!r.plainObjects&&n.call(Object.prototype,l[1].slice(1,-1))&&!r.allowPrototypes)return;u.push(l[1])}return l&&u.push("["+o.slice(l.index)+"]"),s(u,t,r)}};e.exports=function(e,t){var r=t||{};if(null!==r.decoder&&void 0!==r.decoder&&"function"!=typeof r.decoder)throw new TypeError("Decoder has to be a function.");if(r.delimiter="string"==typeof r.delimiter||o.isRegExp(r.delimiter)?r.delimiter:a.delimiter,r.depth="number"==typeof r.depth?r.depth:a.depth,r.arrayLimit="number"==typeof r.arrayLimit?r.arrayLimit:a.arrayLimit,r.parseArrays=!1!==r.parseArrays,r.decoder="function"==typeof r.decoder?r.decoder:a.decoder,r.allowDots="boolean"==typeof r.allowDots?r.allowDots:a.allowDots,r.plainObjects="boolean"==typeof r.plainObjects?r.plainObjects:a.plainObjects,r.allowPrototypes="boolean"==typeof r.allowPrototypes?r.allowPrototypes:a.allowPrototypes,r.parameterLimit="number"==typeof r.parameterLimit?r.parameterLimit:a.parameterLimit,r.strictNullHandling="boolean"==typeof r.strictNullHandling?r.strictNullHandling:a.strictNullHandling,""===e||null===e||void 0===e)return r.plainObjects?Object.create(null):{};for(var n="string"==typeof e?i(e,r):e,s=r.plainObjects?Object.create(null):{},c=Object.keys(n),u=0;u<c.length;++u){var p=c[u],f=l(p,n[p],r);s=o.merge(s,f,r)}return o.compact(s)}},function(e,t,r){"use strict";var o=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"choose-wrap"},[r("el-dialog",{attrs:{title:"选择门店",visible:e.dialogStore,"before-close":e.handleStoreClose,width:"600px",top:"0"},on:{"update:visible":function(t){e.dialogStore=t}}},[r("div",{staticClass:"choose-content-wrap"},[r("div",{staticClass:"search"},[r("el-input",{staticClass:"input-search",attrs:{placeholder:"请输门店名称/code","prefix-icon":"el-icon-search",clearable:""},on:{clear:e.clearInput},nativeOn:{keyup:function(t){return function(t){return e.toSearchInput(t)}(t)}},model:{value:e.searchStoreValue,callback:function(t){e.searchStoreValue=t},expression:"searchStoreValue"}})],1),e._v(" "),r("div",{staticClass:"choose-shop-list"},[r("el-table",{ref:"multipleTable",staticStyle:{width:"100%"},attrs:{data:e.tableStoreData,"tooltip-effect":"dark"},on:{"row-click":e.handleChangeSelectStore}},[r("el-table-column",{attrs:{label:"",width:"55"},scopedSlots:e._u([{key:"default",fn:function(t){return[r("el-radio",{staticClass:"radio-style",attrs:{label:t.row.storeId},model:{value:e.radioStore,callback:function(t){e.radioStore=t},expression:"radioStore"}},[e._v("\n  \n ")])]}}])}),e._v(" "),r("el-table-column",{attrs:{label:"门店名称"},scopedSlots:e._u([{key:"default",fn:function(t){return[r("h2",{staticClass:"text-normal",staticStyle:{color:"#606266","font-size":"14px",margin:"0"}},[e._v(e._s(t.row.storeName))]),e._v(" "),r("p",{staticClass:"text-normal",staticStyle:{color:"#909399","font-size":"14px",margin:"0"}},[e._v(e._s(t.row.proName)+"/"+e._s(t.row.cityName)+"/"+e._s(t.row.countyName))])]}}])}),e._v(" "),r("el-table-column",{attrs:{label:"门店代码",width:"200"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v(e._s(t.row.storeCode))]}}])})],1),e._v(" "),e.tableStoreData.length>0?r("div",{staticClass:"pagination"},[r("el-pagination",{attrs:{"current-page":e.storeCurrentPage,small:"","page-size":e.storePageSize,layout:"prev, pager, next",total:e.total},on:{"size-change":e.storeSizeChange,"current-change":e.storeCurrentChange}})],1):e._e()],1)]),e._v(" "),r("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[r("el-button",{on:{click:e.dialogStorecancel}},[e._v("取 消")]),e._v(" "),r("el-button",{attrs:{type:"primary"},on:{click:e.dialogStoreConfirm}},[e._v("确 定")])],1)])],1)},n=[],a={render:o,staticRenderFns:n};t.a=a}])});
//# sourceMappingURL=vue-gic-store.js.map
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>vue-gic-store</title>
</head>
<body>
<div id="app"></div>
<!-- <script src="/dist/build.js"></script> -->
<script src="/dist/vue-gic-store.js"></script>
</body>
</html>
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "@gic-test/vue-gic-store",
"description": "vue-gic-store Plugin",
"version": "1.0.38",
"license": "MIT",
"private": false,
"main": "dist/vue-gic-store.js",
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
},
"dependencies": {
"axios": "^0.18.0",
"vue": "^2.5.11"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
],
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-3": "^6.24.1",
"cross-env": "^5.0.5",
"css-loader": "^0.28.7",
"file-loader": "^1.1.4",
"less-loader": "^4.1.0",
"node-sass": "^4.5.3",
"sass-loader": "^6.0.6",
"vue-loader": "^13.0.5",
"vue-template-compiler": "^2.4.4",
"webpack": "^3.6.0",
"webpack-dev-server": "^2.9.1"
}
}
<template>
<div id="app">
<div @click="showStore">点击弹窗</div>
<vue-gic-store :projectName="projectName" :showStoreDialog="showStoreDialog" @selectStore="selectStore"></vue-gic-store>
</div>
</template>
<script>
import vueGicStore from './lib/vue-gic-store'
export default {
name: 'app',
data () {
return {
projectName: '', // 当前项目名
showCardDialog: false,
}
},
components: {
vueGicStore
},
methods: {
// 显示卡券弹窗
showStore() {
var that = this
that.showStoreDialog = true;
},
// 子组件触发方法
selectStore(val) {
// 模拟检查数据
console.log(val)
var that = this
that.showStoreDialog = false;
}
}
}
</script>
<style lang="scss">
* {
margin: 0;
padding: 0;
}
</style>
import axios from 'axios';
import qs from 'qs';
axios.defaults.timeout = 10000;
let base = "http://192.168.1.164:8282/gic/";
const timeout = 10000;
let token = ''//sessionStorage.getItem('user');
/*
*
* 统一 get 请求方法
* @url: 请求的 url
* @params: 请求带的参数
* @header: 带 token
*
*/
export const getRequest = (url, params) => {
return axios({
method: 'get',
url: `${base}${url}`,
data: {},
params: params,
headers: {'content-type': 'application/x-www-form-urlencoded'},// "token": token
});
}
import vueGicStore from './vue-gic-store.vue' // 导入组件
const GicStore = {
install(Vue, options) {
Vue.component(vueGicStore.name, vueGicStore) // vueGicStore.name 组件的name属性
// 类似通过 this.$xxx 方式调用插件的 其实只是挂载到原型上而已
// Vue.prototype.$xxx // 最终可以在任何地方通过 this.$xxx 调用
// 虽然没有明确规定用$开头 但是大家都默认遵守这个规定
}
}
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(GicStore);
}
export default GicStore
// export {
// vueGicStore
// }
<template>
<!-- 选择门店 -->
<div class="choose-wrap">
<el-dialog
title="选择门店"
:visible.sync="dialogStore"
:before-close="handleStoreClose"
width="600px"
top="0">
<div class="choose-content-wrap">
<div class="search">
<el-input class="input-search" placeholder="请输门店名称/code" prefix-icon="el-icon-search" v-model="searchStoreValue" @keyup.native="(value) => toSearchInput(value)" clearable @clear="clearInput"></el-input>
</div>
<div class="choose-shop-list">
<el-table
ref="multipleTable"
:data="tableStoreData"
tooltip-effect="dark"
style="width: 100%"
@row-click="handleChangeSelectStore">
<el-table-column label="" width="55">
<template slot-scope="scope">
<el-radio class="radio-style" v-model="radioStore" :label="scope.row.storeId">
&nbsp;
</el-radio>
</template>
</el-table-column>
<el-table-column
label="门店名称">
<template slot-scope="scope">
<h2 class="text-normal" style="color: #606266;font-size: 14px;margin: 0;">{{ scope.row.storeName }}</h2>
<p class="text-normal" style="color: #909399;font-size: 14px;margin: 0;">{{ scope.row.proName }}/{{ scope.row.cityName }}/{{ scope.row.countyName }}</p>
</template>
</el-table-column>
<el-table-column
label="门店代码"
width="200">
<template slot-scope="scope">{{ scope.row.storeCode }}</template>
</el-table-column>
</el-table>
<div class="pagination" v-if="tableStoreData.length>0">
<el-pagination
@size-change="storeSizeChange"
@current-change="storeCurrentChange"
:current-page="storeCurrentPage"
small
:page-size="storePageSize"
layout="prev, pager, next"
:total="total">
</el-pagination>
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogStorecancel">取 消</el-button>
<el-button type="primary" @click="dialogStoreConfirm">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
// import { getRequest } from './api';
import qs from 'qs';
export default {
name: 'vue-gic-store',
props: ['showStoreDialog','projectName','selectId'],
data () {
return {
repProjectName: 'gic-web', // 项目名
searchText: '',
/*门店列表*/
tableStoreData: [
],
showShopDetail: '', // 用于显示选中的门店
currentRow: null,
radioStore: null,
dialogStore: false,
storeCurrentPage: 1,
storePageSize: 5,
total: 1,
// 获取 location origin
baseUrl: '',
}
},
beforeMount() {
var that = this
var host = window.location.origin;
console.log("当前host:",host)
if (host.indexOf('localhost') != '-1') {
that.baseUrl = 'http://gicdev.demogic.com';
}else {
that.baseUrl = host
}
},
methods:{
handleChangeSelectStore(val) { // 当前格发生变化时触发
var that = this
console.log("table: ",val);
that.radioStore = val.storeId;
that.currentRow = val;
},
// 页码变化
storeSizeChange(val){ // 选择分页符
console.log(`每页 ${val} 条`);
},
// 当前页变化
storeCurrentChange(val) {
console.log(`当前页: ${val}`);
var that = this
that.storeCurrentPage = val;
that.getStoreList();
},
// 设置接收参数
setNewData(storeFlag) {
var that = this;
that.dialogStore = storeFlag;
console.log("弹框是否显示: ",storeFlag)
},
// 搜索输入
toSearchInput: function(value) {
var that = this;
console.log("搜索值: ",that.searchStoreValue,value)
// 搜索重置当前页 为 1
that.storeCurrentPage = 1;
that.getStoreList();
},
// 清空输入
clearInput: function(e) {
var that = this;
console.log(e,that.searchStoreValue);
// 搜索重置当前页 为 1
that.storeCurrentPage = 1;
that.getStoreList();
},
// 确认
dialogStoreConfirm() {
var that = this;
if (!that.currentRow||!Object.keys(that.currentRow).length||!Object.values(that.currentRow).length) {
that.$message.error({
duration: 1000,
message: "请选择门店"
})
return;
}
that.$emit('selectStore',that.currentRow)
that.currentRow = {};
that.radioStore = null;
},
handleStoreClose() {
var that = this;
that.dialogStorecancel();
},
// 取消
dialogStorecancel() {
var that = this;
// that.$confirm('确认关闭?', '', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: ''
// }).then(() => {
console.log("点击确认")
that.dialogStore = false;
that.currentRow = {};
that.radioStore = null;
that.$emit('selectStore',that.currentRow)
// }).catch(() => {
// console.log("取消 取消关闭")
// });
},
// 获取门店列表
getStoreList() {
var that = this
var para = {
currentPage: that.storeCurrentPage,
pageSize: that.storePageSize,
searchName: that.searchStoreValue || '',
requestProject: that.repProjectName
}
that.axios.post(that.baseUrl+'/api-admin/store-list-paging',qs.stringify(para))
.then((res) => {
console.log(res,res.data,res.data.errorCode)
var resData = res.data
if (resData.errorCode == 0) {
that.tableStoreData = resData.result.list
that.total = resData.result.page.totalCount
return;
}
that.$message.error({
duration: 1000,
message: resData.message
})
})
.catch(function (error) {
console.log(error);
// that.toLogin()
that.$message.error({
duration: 1000,
message: error.message
})
});
}
},
watch: {
showStoreDialog: function(newData,oldData){
var that = this;
console.log("新数据:",newData,oldData)
that.setNewData(newData)
},
projectName: function(newData,oldData){
var that = this;
// console.log("新数据:",newData,oldData)
that.repProjectName = newData || 'gic-web';
},
selectId: function(newData,oldData){
var that = this;
that.radioStore = newData;
}
},
/* 接收数据 */
mounted(){
console.log("传递的参数对象:",this.showStoreDialog)
var that = this;
// 项目名
that.repProjectName = that.projectName || 'gic-web';
that.radioStore = that.selectId;
// 获取门店列表
that.getStoreList();
that.setNewData(that.showStoreDialog)
},
}
</script>
<style lang="scss" scoped>
.choose-wrap{
.search{
width: 260px;
margin-bottom: 24px;
}
.text-normal {
margin: 0;
color: #606266;
font-size: 14px;
font-weight: normal;
}
.choose-list{
max-height: 404px;
border-top: 1px solid #ebeef5;
.list-img{
width: 80px;
height: 80px;
img{
width: 100%;
height: 100%;
}
}
}
.pagination{
text-align: right;
margin-top: 20px;
line-height: 1
}
/deep/ .el-dialog{
height: 677px;
top: 50%;
transform: translate(0,-50%);
}
/deep/ .el-dialog__header{
line-height: 24px;
}
/deep/ .el-input {
height: 40px;
line-height: 40px;
.el-input__inner {
height: 40px;
line-height: 40px;
}
}
}
.choose-shop-list /deep/ .el-table__row{
cursor: pointer;
}
.choose-shop-list /deep/ .el-table .has-gutter{
line-height: 1
}
.choose-wrap /deep/ .el-dialog__body{
padding: 10px 20px;
}
</style>
import Vue from 'vue'
import App from './App.vue'
new Vue({
el: '#app',
render: h => h(App)
})
var path = require('path')
var webpack = require('webpack')
module.exports = {
// entry: './src/main.js',
entry: './src/lib/index.js',
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/dist/',
// filename: 'build.js',
filename: 'vue-gic-store.js',
library: 'vue-gic-store',
libraryTarget: 'umd',
umdNamedDefine: true
},
module: {
rules: [
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader'
],
},
{
test: /\.scss$/,
use: [
'vue-style-loader',
'css-loader',
'sass-loader'
],
},
{
test: /\.sass$/,
use: [
'vue-style-loader',
'css-loader',
'sass-loader?indentedSyntax'
],
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
// Since sass-loader (weirdly) has SCSS as its default parse mode, we map
// the "scss" and "sass" values for the lang attribute to the right configs here.
// other preprocessors should work out of the box, no loader config like this necessary.
'scss': [
'vue-style-loader',
'css-loader',
'sass-loader'
],
'sass': [
'vue-style-loader',
'css-loader',
'sass-loader?indentedSyntax'
]
}
// other vue-loader options go here
}
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js'
},
extensions: ['*', '.js', '.vue', '.json']
},
devServer: {
historyApiFallback: true,
noInfo: true,
overlay: true
},
performance: {
hints: false
},
devtool: '#eval-source-map'
}
if (process.env.NODE_ENV === 'production') {
module.exports.devtool = '#source-map'
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
])
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment