Merge branch 'dev' of http://139.186.142.91:10010/r/productDev/preselect into dev
| | |
| | | # å¼åç¯å¢é
ç½® |
| | | NODE_ENV = 'development' |
| | | |
| | | VUE_APP_CONTEXT_PATH = '/' |
| | | VUE_APP_API_PREFIX = '/api' |
| | | |
| | | # 任康 |
| | |
| | | # æµè¯ç¯å¢é
ç½® |
| | | NODE_ENV = 'production' |
| | | |
| | | VUE_APP_CONTEXT_PATH = '/preselect_admin' |
| | | VUE_APP_API_PREFIX = '/preselect_admin_interface' |
| | | |
| | | |
| | | # https://dmtest.ahapp.net/preselect_admin_interface/doc.html |
| | | VUE_APP_API = 'https://dmtest.ahapp.net/preselect_admin_interface' |
| | |
| | | "scripts": { |
| | | "serve": "vue-cli-service serve", |
| | | "build": "vue-cli-service build", |
| | | "build:staging": "vue-cli-service build --mode staging", |
| | | "build:dev": "vue-cli-service build --mode staging", |
| | | "lint": "vue-cli-service lint", |
| | | "fix": "eslint --ext .js,.vue src --fix" |
| | | }, |
| | |
| | | |
| | | // ä¿®æ¹ |
| | | export function updateById (data) { |
| | | return request.post('/business/baseGoods/updateById', data) |
| | | return request.post('/business/baseGoods/update', data) |
| | | } |
| | | |
| | | // å é¤ |
| | |
| | | |
| | | // æ ¹æ®IDæ¥è¯¢ |
| | | export function queryById (id) { |
| | | return request.get(`business/baseGoods/${id}`) |
| | | return request.get(`/business/baseGoods/${id}`) |
| | | } |
| | |
| | | <template> |
| | | <GlobalWindow |
| | | :title="title" |
| | | :visible.sync="visible" |
| | | :confirm-working="isWorking" |
| | | @confirm="confirm" |
| | | width="800px" |
| | | > |
| | | <GlobalWindow :title="title" :visible.sync="visible" :confirm-working="isWorking" @confirm="confirm" width="800px" |
| | | v-loading="isUploading"> |
| | | <el-form :model="form" ref="form" label-width="120px" :rules="rules"> |
| | | <div style="font-size: 18px;font-weight: bold;">åºæ¬ä¿¡æ¯</div> |
| | | <el-form-item label="åååç§°" prop="name"> |
| | | <el-input v-model="form.name" maxlength="50" placeholder="请è¾å
¥åååç§°ï¼ä¸è¶
è¿50个å" v-trim/> |
| | | <el-input v-model="form.name" maxlength="50" placeholder="请è¾å
¥åååç§°ï¼ä¸è¶
è¿50个å" v-trim /> |
| | | </el-form-item> |
| | | <el-form-item label="åååç" prop="brandId"> |
| | | <el-select v-model="form.brandId" placeholder="è¯·éæ©ï¼åé"> |
| | | <el-option |
| | | v-for="item in brandList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id"> |
| | | <el-option v-for="item in brandList()" :key="item.id" :label="item.name" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ååç±»å«" prop="categoryId"> |
| | | <!-- @change="changeCategory(form.categoryId)" --> |
| | | <el-select v-model="form.categoryId" placeholder="è¯·éæ©ï¼åé"> |
| | | <el-option |
| | | v-for="item in categoryList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id"> |
| | | <el-select v-model="form.categoryId" placeholder="è¯·éæ©ï¼åé" @change="categorySelect"> |
| | | <el-option v-for="item in categoryList()" :key="item.id" :label="item.name" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- <el-form-item :label="name1" prop="attrFirstIds" v-if="name1"> |
| | | <el-select v-model="form.attrFirstIds" multiple placeholder="è¯·éæ©ï¼æ¯æå¤é"> |
| | | <el-option |
| | | v-for="item in form.attrFirstList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item :label="name2" prop="attrSecodIds" v-if="name2"> |
| | | <el-select v-model="form.attrSecodIds" multiple placeholder="è¯·éæ©ï¼æ¯æå¤é"> |
| | | <el-option |
| | | v-for="item in form.attrSecodList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> --> |
| | | <el-form-item label="æå¯¼ä»·ï¼å
ï¼" prop="zdPrice"> |
| | | <el-input v-model="form.zdPrice" @input="priceCHANEG(form.zdPrice, 1)" type="number" placeholder="建议å½å
¥æ´æ°ï¼åä½å
" v-trim/> |
| | | <el-input v-model="form.zdPrice" @input="priceCHANEG(form.zdPrice, 1)" type="number" placeholder="建议å½å
¥æ´æ°ï¼åä½å
" |
| | | v-trim /> |
| | | </el-form-item> |
| | | <el-form-item label="å
¥æä»·ï¼å
ï¼" prop="price"> |
| | | <el-input v-model="form.price" @input="priceCHANEG(form.price, 2)" type="number" placeholder="建议å½å
¥æ´æ°ï¼åä½å
" v-trim/> |
| | | <el-input v-model="form.price" @input="priceCHANEG(form.price, 2)" type="number" placeholder="建议å½å
¥æ´æ°ï¼åä½å
" |
| | | v-trim /> |
| | | </el-form-item> |
| | | <el-form-item label="åå主å¾"> |
| | | <el-upload |
| | | :action="action" |
| | | :file-list="form.ztList" |
| | | :data="{ folder: 'goods_img' }" |
| | | list-type="picture-card" |
| | | :limit="1" |
| | | :on-success="fileSuccess" |
| | | :on-exceed="exceed" |
| | | :on-remove="handleRemove"> |
| | | <i class="el-icon-plus"></i> |
| | | <div slot="tip" class="el-upload__tip">åªè½ä¸ä¼ å¾çæ ¼å¼ï¼pngæ ¼å¼ï¼å»ºè®®å°ºå¯¸140*140px</div> |
| | | </el-upload> |
| | | <UploadAvatarImage :file="{ 'imgurlfull': form.imgfullurl, 'imgurl': form.imgurl }" :uploadData="uploadData" |
| | | tipsLabel="" @uploadSuccess="uploadReverseSuccess" @uploadEnd="isUploading = false" |
| | | @uploadBegin="isUploading = true" /> |
| | | åªè½ä¸ä¼ å¾çæ ¼å¼ï¼pngæ ¼å¼ï¼å»ºè®®å°ºå¯¸140px*140px |
| | | </el-form-item> |
| | | <el-form-item label="ååå¾ç"> |
| | | <el-upload |
| | | :action="action" |
| | | :file-list="form.files" |
| | | :multiple="true" |
| | | :data="{ folder: 'goods_img' }" |
| | | list-type="picture-card" |
| | | :on-success="fileSuccess1" |
| | | :on-remove="handleRemove1"> |
| | | <i class="el-icon-plus"></i> |
| | | <div slot="tip" class="el-upload__tip">åªè½ä¸ä¼ å¾çæ ¼å¼ï¼pngæ ¼å¼ï¼å»ºè®®å°ºå¯¸600*600px</div> |
| | | </el-upload> |
| | | <el-form-item label="ååå¾ç"> |
| | | <UploadImage :fileList="form.multifileList" :uploadData="uploadData" @beginUpload="isUploading = true" @endUpload="isUploading = false" /> |
| | | åªè½ä¸ä¼ å¾çæ ¼å¼ï¼pngæ ¼å¼ï¼å»ºè®®å°ºå¯¸600*600px |
| | | </el-form-item> |
| | | <template v-if="form.goodsParamList && form.goodsParamList.length > 0"> |
| | | <div style="font-size: 18px;font-weight: bold;">忰屿§å¼é
ç½® <span style="font-size: 13px; font-weight: 500;">æéé
ç½®å½åååç产ååæ°å¼ï¼åä¸ªåæ°å¼ä¸è¶
è¿30个å</span></div> |
| | | <el-form-item :label="item.name" v-for="(item, index) in form.goodsParamList" :key="index"> |
| | | <el-input v-model="item.val" maxlength="30" type="text" placeholder="请è¾å
¥" v-trim/> |
| | | <template v-if="form.baseGoodsParamList && form.baseGoodsParamList.length > 0"> |
| | | <div style="font-size: 18px;font-weight: bold;">忰屿§å¼é
ç½® <span |
| | | style="font-size: 13px; font-weight: 500;">æéé
ç½®å½åååç产ååæ°å¼ï¼åä¸ªåæ°å¼ä¸è¶
è¿30个å</span></div> |
| | | <el-form-item :label="item.name" v-for="(item, index) in form.baseGoodsParamList" :key="index"> |
| | | <el-input v-model="item.val" maxlength="30" type="text" placeholder="请è¾å
¥" v-trim /> |
| | | </el-form-item> |
| | | </template> |
| | | </el-form> |
| | |
| | | <script> |
| | | import BaseOpera from '@/components/base/BaseOpera' |
| | | import GlobalWindow from '@/components/common/GlobalWindow' |
| | | import { baseCategory,brand } from '@/api/system/common.js' |
| | | import { create, updateById, companyCreate, companyUpdateById } from '@/api/business/goods.js' |
| | | import UploadAvatarImage from '@/components/common/UploadAvatarImage.vue' |
| | | import UploadImage from '@/components/common/UploadImage.vue' |
| | | import { baseCategory, brand } from '@/api/system/common.js' |
| | | import { companyCreate, companyUpdateById } from '@/api/business/goods.js' |
| | | export default { |
| | | name: 'OperaGoodsWindow', |
| | | extends: BaseOpera, |
| | | components: { GlobalWindow }, |
| | | data () { |
| | | components: { GlobalWindow, UploadAvatarImage, UploadImage }, |
| | | data() { |
| | | return { |
| | | action: process.env.VUE_APP_API_PREFIX + '/public/upload', |
| | | name1: '', |
| | | name2: '', |
| | | // è¡¨åæ°æ® |
| | | isUploading: false, |
| | | form: { |
| | | id: null, |
| | | name: '', |
| | |
| | | brandId: '', |
| | | zdPrice: '', |
| | | price: '', |
| | | attrFirstIds: [], |
| | | attrFirstNames: '', |
| | | attrSecodIds: [], |
| | | attrSecodNames: '', |
| | | imgurl: '', |
| | | imgfullurl: '', |
| | | multifileList: [], |
| | | files: [], |
| | | ztList: [], |
| | | goodsParamList: [], |
| | | attrFirstList: [], |
| | | attrSecodList: [] |
| | | baseGoodsParamList: [], |
| | | }, |
| | | uploadData: { |
| | | folder: 'goods_img' |
| | | }, |
| | | // éªè¯è§å |
| | | rules: { |
| | |
| | | { required: true, message: 'ä¸è½ä¸ºç©º', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | options: [], |
| | | categoryList: [], |
| | | brandList: [] |
| | | options: [] |
| | | } |
| | | }, |
| | | created () { |
| | | inject: ['categoryList', 'brandList'], |
| | | created() { |
| | | this.config({ |
| | | api: '/business/goods', |
| | | 'field.id': 'id' |
| | | }) |
| | | this.getbrand() |
| | | this.getcategory() |
| | | }, |
| | | watch: { |
| | | 'form.categoryId': { |
| | | immediate: true, |
| | | handler(news, old) { |
| | | if (news) { |
| | | this.name1 = '' |
| | | this.name2 = '' |
| | | if (old) { |
| | | this.form.attrFirstIds = [] |
| | | this.form.attrSecodIds = [] |
| | | this.form.goodsParamList = [] |
| | | } |
| | | this.categoryList.forEach(item => { |
| | | if (item.id === news) { |
| | | this.name1 = item.attrFirst |
| | | this.name2 = item.attrSecond |
| | | this.form.attrFirstList = item.attrFirstList.length > 0 ? item.attrFirstList : [] |
| | | this.form.attrSecodList = item.attrSecondList.length > 0 ? item.attrSecondList : [] |
| | | this.form.goodsParamList = JSON.parse(JSON.stringify(item.paramList)) |
| | | this.form.goodsParamList.forEach(item => { |
| | | item.pramaId = item.id |
| | | }) |
| | | console.log(this.form.goodsParamList) |
| | | } |
| | | }) |
| | | this.getcategory(1) |
| | | } |
| | | } |
| | | }, |
| | | visible: { |
| | | handler(news, old) { |
| | | if (!news) { |
| | | this.name1 = '' |
| | | this.name2 = '' |
| | | this.form = { |
| | | id: null, |
| | | name: '', |
| | | categoryId: '', |
| | | brandId: '', |
| | | zdPrice: '', |
| | | price: '', |
| | | attrFirstIds: [], |
| | | attrFirstNames: '', |
| | | attrSecodIds: [], |
| | | attrSecodNames: '', |
| | | imgurl: '', |
| | | multifileList: [], |
| | | files: [], |
| | | ztList: [], |
| | | goodsParamList: [], |
| | | attrFirstList: [], |
| | | attrSecodList: [] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // this.getbrand() |
| | | // this.getcategory() |
| | | }, |
| | | methods: { |
| | | open(title, target) { |
| | | this.title = title |
| | | this.visible = true |
| | | // æ°å»º |
| | | if (target == null) { |
| | | this.$nextTick(() => { |
| | | this.$refs.form.resetFields() |
| | | this.form.multifileList = [] |
| | | this.form.baseGoodsParamList = [] |
| | | this.form[this.configData['field.id']] = null |
| | | }) |
| | | return |
| | | } |
| | | // ç¼è¾ |
| | | this.$nextTick(() => { |
| | | for (const key in this.form) { |
| | | this.form[key] = target[key] |
| | | } |
| | | this.form.multifileList.forEach(item => { |
| | | item.url = item.filefullurl |
| | | }) |
| | | }) |
| | | }, |
| | | priceCHANEG(val, type) { |
| | | if (!/^[1-9]+[0-9]*$/.test(val)) { |
| | | this.$message.warning('åªè½è¾å
¥æ£æ´æ°') |
| | |
| | | } |
| | | } |
| | | }, |
| | | confirm() { |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | if (this.form.attrFirstIds.length > 0) { |
| | | let arr = [] |
| | | this.form.attrFirstIds.forEach(element => { |
| | | this.form.attrFirstList.forEach(item => { |
| | | if (element === item.id) { |
| | | arr.push(item.name) |
| | | } |
| | | }) |
| | | }) |
| | | this.form.attrFirstNames = arr.join(',') |
| | | this.form.attrFirstIds = this.form.attrFirstIds.join(',') |
| | | } else { |
| | | this.form.attrFirstNames = '' |
| | | this.form.attrFirstIds = '' |
| | | } |
| | | if (this.form.attrSecodIds.length > 0) { |
| | | let arr = [] |
| | | this.form.attrSecodIds.forEach(element => { |
| | | this.form.attrSecodList.forEach(item => { |
| | | if (element === item.id) { |
| | | arr.push(item.name) |
| | | } |
| | | }) |
| | | }) |
| | | this.form.attrSecodNames = arr.join(',') |
| | | this.form.attrSecodIds = this.form.attrSecodIds.join(',') |
| | | } else { |
| | | this.form.attrSecodNames = '' |
| | | this.form.attrSecodIds = '' |
| | | } |
| | | if (!this.form.id) { |
| | | companyCreate({...this.form, type: 0}) |
| | | .then(() => { |
| | | this.visible = false |
| | | this.$tip.apiSuccess('æ°å»ºæå') |
| | | this.$emit('success') |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | | }) |
| | | .finally(() => { |
| | | this.isWorking = false |
| | | }) |
| | | } else { |
| | | companyUpdateById({...this.form, type: 0}) |
| | | .then(() => { |
| | | this.visible = false |
| | | this.$tip.apiSuccess('ç¼è¾æå') |
| | | this.$emit('success') |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | | }) |
| | | .finally(() => { |
| | | this.isWorking = false |
| | | }) |
| | | } |
| | | } else { |
| | | return false; |
| | | categorySelect(v) { |
| | | this.categoryList().forEach(item => { |
| | | if (item.id === v) { |
| | | this.form.baseGoodsParamList = JSON.parse(JSON.stringify(item.baseCateParamList)) |
| | | this.form.baseGoodsParamList.forEach(item => { |
| | | item.pramaId = item.id |
| | | }) |
| | | } |
| | | }); |
| | | }, |
| | | exceed() { |
| | | this.$message.warning({ |
| | | message: 'åªè½ä¸ä¼ ä¸ä¸ªå¾æ ' |
| | | }) |
| | | }, |
| | | fileSuccess1(response, file, fileList) { |
| | | this.form.files = fileList |
| | | this.form.multifileList.push({ fileurl: response.data.imgaddr, name: response.data.imgname, url: response.data.url }) |
| | | }, |
| | | handleRemove1(file, fileList) { |
| | | this.form.files = fileList |
| | | this.form.multifileList = fileList |
| | | }, |
| | | fileSuccess(response) { |
| | | this.form.ztList.push({ imgaddr: response.data.imgaddr, url: response.data.url }) |
| | | this.form.imgurl = response.data.imgaddr |
| | | }, |
| | | handleRemove() { |
| | | this.form.ztList = [] |
| | | this.form.imgurl = '' |
| | | }, |
| | | getbrand() { |
| | | brand({status:0}) |
| | | .then(res => { |
| | | this.brandList = res |
| | | }) |
| | | }, |
| | | getcategory(type) { |
| | | baseCategory({status:0 , type:1}) |
| | | .then(res => { |
| | | this.categoryList = res |
| | | if (type === 1) { |
| | | this.categoryList.forEach(item => { |
| | | if (item.id === this.form.categoryId) { |
| | | this.form.goodsParamList = JSON.parse(JSON.stringify(item.paramList)) |
| | | this.form.goodsParamList.forEach(item => { |
| | | item.pramaId = item.id |
| | | }) |
| | | console.log(this.form.goodsParamList) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | uploadReverseSuccess(file) { |
| | | this.form.imgurl = file.imgurl; |
| | | this.form.imgfullurl = file.imgurlfull; |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | |
| | | }, |
| | | created() { |
| | | this.config({ |
| | | api: '/business/anchor', |
| | | api: '/business/goods', |
| | | 'field.id': 'id' |
| | | }) |
| | | }, |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template>
|
| | | <div class="import-button">
|
| | | <el-button type="primary" @click="$refs.importWindow.open(text)">{{text}}</el-button>
|
| | | <ImportWindow :action="action" :template-path="templatePath" :template-name="templateName" ref="importWindow" @success="handleSuccess"/>
|
| | | </div>
|
| | | </template>
|
| | |
|
| | | <script>
|
| | | import ImportWindow from './ImportWindow'
|
| | | export default {
|
| | | name: 'ImportButton',
|
| | | components: { ImportWindow },
|
| | | props: {
|
| | | // æé®ææ¡
|
| | | text: {
|
| | | default: '导å
¥'
|
| | | },
|
| | | // 模çå°å
|
| | | templatePath: {
|
| | | required: true
|
| | | },
|
| | | // ä¸è½½åçæ¨¡çæä»¶åç§°
|
| | | templateName: {
|
| | | required: true
|
| | | },
|
| | | // 导å
¥æ¥å£å°å
|
| | | action: {
|
| | | required: true
|
| | | }
|
| | | },
|
| | | methods: {
|
| | | handleSuccess () {
|
| | | this.$emit('success')
|
| | | }
|
| | | }
|
| | | }
|
| | | </script>
|
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template>
|
| | | <el-dialog
|
| | | width="500px"
|
| | | :title="title"
|
| | | :visible.sync="visible"
|
| | | append-to-body
|
| | | custom-class="eva-dialog import-window"
|
| | | :close-on-click-modal="false"
|
| | | :close-on-press-escape="false"
|
| | | :show-close="false"
|
| | | >
|
| | | <el-form>
|
| | | <el-form-item>
|
| | | <el-upload
|
| | | drag
|
| | | :show-file-list="false"
|
| | | action="none"
|
| | | accept=".xlsx, .xls"
|
| | | :before-upload="handleBeforeUpload"
|
| | | >
|
| | | <template v-if="form.file == null">
|
| | | <i class="el-icon-upload"></i>
|
| | | <div class="el-upload__text">å°æä»¶æå°æ¤å¤ï¼æ<em>ç¹å»ä¸ä¼ </em></div>
|
| | | </template>
|
| | | <template v-else>
|
| | | <i class="el-icon-files"></i>
|
| | | <div class="el-upload__text">{{form.file.name}}<em></em></div>
|
| | | </template>
|
| | | </el-upload>
|
| | | </el-form-item>
|
| | | </el-form>
|
| | | |
| | | <div slot="footer" class="import-window__footer">
|
| | | <!-- <div class="sync-exists">
|
| | | <el-checkbox v-model="form.sync"/><span>忥已åå¨çæ°æ®</span>
|
| | | </div> -->
|
| | | <div class="opera">
|
| | | <a href=""></a>
|
| | | <el-button type="text" icon="el-icon-download" @click="downloadTemplate">ä¸è½½æ¨¡ç</el-button>
|
| | | <el-button @click="cancel">{{cancelText}}</el-button>
|
| | | <el-button type="primary" @click="confirm" :loading="isWorking">{{confirmText}}</el-button>
|
| | | </div>
|
| | | </div>
|
| | | </el-dialog>
|
| | | </template>
|
| | |
|
| | | <script>
|
| | | import request from '@/utils/request'
|
| | | export default {
|
| | | name: 'ImportWindow',
|
| | | props: {
|
| | | // 导å
¥æ¥å£å°å
|
| | | action: {
|
| | | required: true
|
| | | },
|
| | | // 确认æé®ææ¡
|
| | | confirmText: {
|
| | | type: String,
|
| | | default: '导å
¥'
|
| | | },
|
| | | |
| | | // åæ¶æé®ææ¡
|
| | | cancelText: {
|
| | | type: String,
|
| | | default: 'åæ¶'
|
| | | },
|
| | | // 模çå°å
|
| | | templatePath: {
|
| | | required: true
|
| | | },
|
| | | // ä¸è½½åçæ¨¡çæä»¶åç§°
|
| | | templateName: {
|
| | | required: true
|
| | | }
|
| | | },
|
| | | data () {
|
| | | return {
|
| | | visible: false,
|
| | | isWorking: false,
|
| | | title: '导å
¥æ°æ®',
|
| | | form: {
|
| | | sync: false,
|
| | | file: false,
|
| | | categoryId: ''
|
| | | }
|
| | | }
|
| | | },
|
| | | methods: {
|
| | | /**
|
| | | * æå¼çªå£
|
| | | *
|
| | | * @param title çªå£æ é¢
|
| | | */
|
| | | open (title) {
|
| | | this.visible = true
|
| | | this.title = title
|
| | | this.form.sync = false
|
| | | this.form.file = null
|
| | | },
|
| | | /**
|
| | | * ç¡®å®å¯¼å
¥
|
| | | */
|
| | | confirm () {
|
| | | if (this.form.file == null) {
|
| | | this.$message.warning('è¯·éæ©æä»¶')
|
| | | return
|
| | | }
|
| | | this.isWorking = true
|
| | | const param = new FormData()
|
| | | param.set('file', this.form.file)
|
| | | request.post(this.action, param, {
|
| | | headers: {
|
| | | 'Content-Type': 'multipart/form-data;charset=UTF-8'
|
| | | }
|
| | | })
|
| | | .then(() => {
|
| | | this.$message.success('导å
¥æå')
|
| | | this.visible = false
|
| | | this.$emit('success')
|
| | | })
|
| | | .catch(e => {
|
| | | this.$message.error(e)
|
| | | })
|
| | | .finally(() => {
|
| | | this.isWorking = false
|
| | | })
|
| | | },
|
| | | /**
|
| | | * åæ¶
|
| | | */
|
| | | cancel () {
|
| | | this.visible = false
|
| | | },
|
| | | /**
|
| | | * ä¸è½½æ¨¡ç
|
| | | */
|
| | | downloadTemplate () {
|
| | | const link = document.createElement('a')
|
| | | link.setAttribute('download', this.templateName) //ä¸è½½çæä»¶å
|
| | | // console.log(`window.location.origin`, window.location.origin);
|
| | | // console.log(`process.env.VUE_APP_CONTEXT_PATH`, process.env.VUE_APP_CONTEXT_PATH);
|
| | | // console.log(`this.templatePath`, this.templatePath);
|
| | | link.href = `${window.location.origin}${process.env.VUE_APP_CONTEXT_PATH}${this.templatePath}` //æä»¶url
|
| | | link.click()
|
| | | },
|
| | | /**
|
| | | * æä»¶ä¸ä¼ ååå¨ä¸ä¼ çæä»¶
|
| | | *
|
| | | * @param file é导å
¥çæä»¶
|
| | | */
|
| | | handleBeforeUpload (file) {
|
| | | this.form.file = file
|
| | | return false
|
| | | }
|
| | | }
|
| | | }
|
| | | </script>
|
| | |
|
| | | <style lang="scss">
|
| | | @import "../../assets/style/variables";
|
| | | .import-window {
|
| | | .el-upload {
|
| | | width: 100%;
|
| | | .el-upload-dragger {
|
| | | width: 100%;
|
| | | .el-icon-upload, .el-icon-files {
|
| | | font-size: 67px;
|
| | | color: #C0C4CC;
|
| | | margin: 40px 0 16px;
|
| | | line-height: 50px;
|
| | | }
|
| | | }
|
| | | }
|
| | | .import-window__footer {
|
| | | display: flex;
|
| | | .sync-exists {
|
| | | width: 200px;
|
| | | flex-shrink: 0;
|
| | | text-align: left;
|
| | | font-size: 13px;
|
| | | display: flex;
|
| | | align-items: center;
|
| | | .el-checkbox {
|
| | | margin-right: 10px;
|
| | | }
|
| | | & > * {
|
| | | vertical-align: middle;
|
| | | }
|
| | | }
|
| | | .opera {
|
| | | flex-grow: 1;
|
| | | a {
|
| | | font-size: 12px;
|
| | | margin-right: 10px;
|
| | | text-decoration: none;
|
| | | .el-icon-download {
|
| | | font-size: 15px;
|
| | | position: relative;
|
| | | top: 2px;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | </style>
|
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/uploadLocal', |
| | | uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/upload', |
| | | |
| | | realList: [], |
| | | srcList: [], |
| | |
| | | |
| | | <template> |
| | | <TableLayout :permissions="['business:goods:query']"> |
| | | <TableLayout :permissions="['business:basegoods:query']"> |
| | | <!-- æç´¢è¡¨å --> |
| | | <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline> |
| | | <el-form-item label="åååç§°" prop="name"> |
| | |
| | | </el-form> |
| | | <!-- è¡¨æ ¼åå页 --> |
| | | <template v-slot:table-wrap> |
| | | <ul class="toolbar" v-permissions="['business:goods:create', 'business:goods:delete']"> |
| | | <li><el-button type="primary" @click="$refs.operaGoodsWindow.open('æ°å»ºåå')" icon="el-icon-plus" |
| | | v-permissions="['business:goods:create']">æ°å»º</el-button></li> |
| | | <ul class="toolbar" v-permissions="['business:basegoods:create', 'business:basegoods:delete']"> |
| | | <li v-permissions="['business:basegoods:create']"> |
| | | <el-button type="primary" @click="$refs.operaGoodsWindow.open('æ°å»ºåå')" icon="el-icon-plus">æ°å»º</el-button> |
| | | </li> |
| | | <!-- <el-button type="primary" :loading="isWorking.export" |
| | | @click="$refs.selectProduct.open('鿩平å°åå')">鿩平å°åå</el-button> --> |
| | | <el-button type="primary" :loading="isWorking.export" v-permissions="['business:goods:exportExcel']" |
| | | @click="importFile">导å
¥</el-button> |
| | | <el-button type="primary" :loading="isWorking.export" @click="downloadFile">ä¸è½½æ¨¡æ¿</el-button> |
| | | |
| | | <li v-permissions="['business:basegoods:exportExcel']"> |
| | | <ImportButton text="导å
¥" template-name="goods_import_modle.xlsx" |
| | | template-path="/template/goods_import_modle.xlsx" action="/business/baseGoods/importExcel" |
| | | @success="search" /> |
| | | </li> |
| | | <el-button type="primary" :loading="isWorking.export" @click="bulkOperation(0)">æ¹é䏿¶</el-button> |
| | | <el-button type="primary" :loading="isWorking.export" @click="bulkOperation(1)">æ¹é䏿¶</el-button> |
| | | <!-- <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:goods:delete']">å é¤</el-button></li> --> |
| | |
| | | </el-switch> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="containPermissions(['business:goods:update', 'business:goods:delete'])" label="æä½" |
| | | <el-table-column v-if="containPermissions(['business:basegoods:update', 'business:basegoods:delete'])" label="æä½" |
| | | min-width="120" fixed="right"> |
| | | <template slot-scope="{row}"> |
| | | <el-button type="text" @click="edit(row.id)" icon="el-icon-edit" |
| | | v-permissions="['business:goods:update']">ç¼è¾</el-button> |
| | | v-permissions="['business:basegoods:update']">ç¼è¾</el-button> |
| | | <el-button type="text" @click="deleteById(row)" icon="el-icon-delete" |
| | | v-permissions="['business:goods:delete']">å é¤</el-button> |
| | | v-permissions="['business:basegoods:delete']">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <input type="file" ref="upload" style="display: none;" @change="uplaodFile" /> |
| | | <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination"> |
| | | </pagination> |
| | | </template> |
| | |
| | | import Pagination from '@/components/common/Pagination' |
| | | import OperaGoodsWindow from '@/components/business/OperaGoodsWindow' |
| | | import selectProduct from '@/components/business/selectProduct' |
| | | import ImportButton from '@/components/common/ImportButton' |
| | | import { brand, baseCategory, importExcel } from '@/api/system/common.js' |
| | | import { updateStatus, queryById, exportDoc } from '@/api/business/goods.js' |
| | | export default { |
| | | name: 'Goods', |
| | | extends: BaseTable, |
| | | components: { TableLayout, Pagination, OperaGoodsWindow, selectProduct }, |
| | | components: { TableLayout, Pagination, OperaGoodsWindow, selectProduct, ImportButton }, |
| | | data() { |
| | | return { |
| | | // æç´¢ |
| | |
| | | ] |
| | | } |
| | | }, |
| | | provide() { |
| | | return { |
| | | brandList: () => this.brandList, |
| | | categoryList: () => this.categoryList |
| | | } |
| | | }, |
| | | created() { |
| | | this.config({ |
| | | module: 'åå', |
| | |
| | | let arr = e.map(item => item.id) |
| | | this.ids = arr.join(',') |
| | | this.idList = arr; |
| | | console.log(this.ids) |
| | | }, |
| | | // æ¹éä¸ä¸æ¶ |
| | | bulkOperation(type) { |
| | |
| | | rowStyle() { |
| | | return "text-align:center"; |
| | | }, |
| | | importFile() { |
| | | this.$refs.upload.click() |
| | | }, |
| | | uplaodFile(e) { |
| | | const FORMDATE = new FormData() |
| | | FORMDATE.append('file', e.target.files[0]) |
| | | // è¯·æ±æ¥å£ |
| | | importExcel(FORMDATE) |
| | | .then(res => { |
| | | console.log(res) |
| | | this.search() |
| | | }) |
| | | .catch((err) => { |
| | | this.$message.error(err.message) |
| | | }) |
| | | this.$refs.upload.value = null |
| | | }, |
| | | edit(id) { |
| | | queryById(id) |
| | | .then(res => { |
| | | let obj = { |
| | | id: res.id, |
| | | name: res.name, |
| | | categoryId: res.categoryId, |
| | | brandId: res.brandId, |
| | | zdPrice: res.zdPrice, |
| | | price: res.price, |
| | | attrFirstIds: res.attrFirstIds ? this.turnNum(res.attrFirstIds.split(',')) : [], |
| | | attrFirstNames: res.attrFirstNames, |
| | | attrSecodIds: res.attrSecodIds ? this.turnNum(res.attrSecodIds.split(',')) : [], |
| | | attrSecodNames: res.attrSecodNames, |
| | | imgurl: res.imgurl, |
| | | multifileList: [], |
| | | files: [], |
| | | ztList: res.imgurl ? [{ url: res.prefixUrl + res.imgurl }] : [], |
| | | pzList: [], |
| | | attrFirstList: [], |
| | | attrSecodList: [] |
| | | } |
| | | if (res.multifileList.length > 0) { |
| | | res.multifileList.forEach(item => { |
| | | obj.multifileList.push({ fileurl: item.fileurl, name: item.name, url: res.prefixUrl + item.fileurl }) |
| | | obj.files.push({ fileurl: item.fileurl, name: item.name, url: res.prefixUrl + item.fileurl }) |
| | | }) |
| | | } |
| | | this.$refs.operaGoodsWindow.open('ç¼è¾åå', obj) |
| | | this.$refs.operaGoodsWindow.open('ç¼è¾åå', res) |
| | | }) |
| | | }, |
| | | changeStatus(item) { |
| | |
| | | // this.search() |
| | | }) |
| | | }, |
| | | turnNum(nums) { |
| | | for (let i = 0; i < nums.length; i++) { |
| | | nums[i] = parseInt(nums[i]) |
| | | } |
| | | return nums; |
| | | }, |
| | | getbrand() { |
| | | brand({type:1}) |
| | | brand({ type: 1 }) |
| | | .then(res => { |
| | | this.brandList = res |
| | | }) |
| | |
| | | // 详ç»é
置请åèhttps://cli.vuejs.org/zh/config/#vue-config-js |
| | | // const outputDir = process.env.VUE_APP_CONTEXT_PATH.substring(1, process.env.VUE_APP_CONTEXT_PATH.length - 1) |
| | | // outputDir === '/' ? 'dist' : outputDir |
| | | |
| | | const outputDir = process.env.VUE_APP_CONTEXT_PATH.substring(1, process.env.VUE_APP_CONTEXT_PATH.length) |
| | | module.exports = { |
| | | publicPath: process.env.VUE_APP_CONTEXT_PATH, |
| | | outputDir: 'dist', |
| | | publicPath: './', |
| | | outputDir: outputDir || 'web', |
| | | assetsDir: 'static', |
| | | lintOnSave: false, |
| | | devServer: { |