Commit c772a0cb by 朱哲铨

Merge remote-tracking branch 'remotes/origin/dev'

parents 7847f9d8 7ca96b84
...@@ -7,34 +7,29 @@ ...@@ -7,34 +7,29 @@
<span <span
class="my-flex-1" class="my-flex-1"
:class="{ active: is_tab == '1' }" :class="{ active: is_tab == '1' }"
@click="handleClick('1')" @click="handleClick('1')">
>
类别 类别
</span> </span>
<span <span
class="my-flex-1" class="my-flex-1"
:class="{ active: is_tab == '2' }" :class="{ active: is_tab == '2' }"
@click="handleClick('2')" @click="handleClick('2')">
>
风格 风格
</span> </span>
</li> </li>
</ul> </ul>
</el-form-item> </el-form-item>
<el-form-item style="margin-bottom: 0px"> <el-form-item style="margin-bottom: 0px">
<el-button type="success" @click="addDialog(1)" <el-button type="success" @click="addDialog(1)">新增</el-button>
>新增</el-button
>
</el-form-item> </el-form-item>
<el-form-item style="margin-bottom: 0px"> <el-form-item style="margin-bottom: 0px">
<el-button type="danger" @click="deleteSection()" <el-button type="danger" @click="deleteSection()">删除</el-button>
>删除</el-button
>
</el-form-item> </el-form-item>
<el-form-item style="margin-bottom: 0px"> <el-form-item style="margin-bottom: 0px">
<el-button type="warning" @click="getList(1)" <el-button type="warning" @click="getList(1)">刷新</el-button>
>刷新</el-button </el-form-item>
> <el-form-item style="margin-bottom: 0px">
<el-button type="primary" @click="importExcel">导入</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="my-table-cont my-flex-1"> <div class="my-table-cont my-flex-1">
...@@ -44,8 +39,7 @@ ...@@ -44,8 +39,7 @@
:treeConfig="{ children: 'children' }" :treeConfig="{ children: 'children' }"
:selection="true" :selection="true"
@selectionChange="(v) => (selections = v)" @selectionChange="(v) => (selections = v)"
:tableColumns="tableColumns" :tableColumns="tableColumns"></table-view>
></table-view>
</div> </div>
<div class="pagination" v-if="is_tab == 2"> <div class="pagination" v-if="is_tab == 2">
<el-pagination <el-pagination
...@@ -55,8 +49,7 @@ ...@@ -55,8 +49,7 @@
:page-size="paginationOptions.pageSize" :page-size="paginationOptions.pageSize"
:current-page="paginationOptions.currentPage" :current-page="paginationOptions.currentPage"
@size-change="sizeChange" @size-change="sizeChange"
@current-change="onCurrentChange" @current-change="onCurrentChange" />
/>
</div> </div>
<!-- 弹出层 --> <!-- 弹出层 -->
...@@ -64,8 +57,7 @@ ...@@ -64,8 +57,7 @@
:close-on-click-modal="false" :close-on-click-modal="false"
:title="is_title == 1 ? '新增' : '编辑'" :title="is_title == 1 ? '新增' : '编辑'"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="640px" width="640px">
>
<el-form <el-form
label-position="right" label-position="right"
label-width="100px" label-width="100px"
...@@ -73,13 +65,8 @@ ...@@ -73,13 +65,8 @@
:inline="true" :inline="true"
:model="addcurrencyform" :model="addcurrencyform"
:rules="addrules" :rules="addrules"
ref="addcurrencyform" ref="addcurrencyform">
> <el-form-item label="上级分类" v-if="is_tab == '1'" prop="pid">
<el-form-item
label="上级分类"
v-if="is_tab == '1'"
prop="pid"
>
<!-- <el-select v-model="addcurrencyform.pid" placeholder="请选择上级分类"> <!-- <el-select v-model="addcurrencyform.pid" placeholder="请选择上级分类">
<el-option v-for="item in all_list" :key="item.id" :label="item.name" :value="item.id"></el-option> <el-option v-for="item in all_list" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>--> </el-select>-->
...@@ -89,85 +76,68 @@ ...@@ -89,85 +76,68 @@
v-model="addcurrencyform.pid" v-model="addcurrencyform.pid"
:options="all_list" :options="all_list"
:props="pidoptions" :props="pidoptions"
:show-all-levels="false" :show-all-levels="false"></el-cascader>
></el-cascader>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="类别中文名" label="类别中文名"
prop="name" prop="name"
v-if="is_tab == '1'" v-if="is_tab == '1'"
required required>
>
<el-input <el-input
v-model="addcurrencyform.name" v-model="addcurrencyform.name"
placeholder="请输入类别中文名称" placeholder="请输入类别中文名称"></el-input>
></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="类别英文名" label="类别英文名"
prop="enname" prop="enname"
v-if="is_tab == '1'" v-if="is_tab == '1'"
required required>
>
<el-input <el-input
v-model="addcurrencyform.enname" v-model="addcurrencyform.enname"
placeholder="请输入类别英文名称" placeholder="请输入类别英文名称"></el-input>
></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="风格名称" label="风格名称"
prop="name" prop="name"
v-if="is_tab == '2'" v-if="is_tab == '2'"
required required>
>
<el-input <el-input
v-model="addcurrencyform.name" v-model="addcurrencyform.name"
placeholder="请输入类别名称" placeholder="请输入类别名称"></el-input>
></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="风格编码" label="风格编码"
prop="code" prop="code"
v-if="is_tab == '2'" v-if="is_tab == '2'"
required required>
>
<el-input <el-input
v-model="addcurrencyform.code" v-model="addcurrencyform.code"
placeholder="请输入类别名称" placeholder="请输入类别名称"></el-input>
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="排序" prop="remark"> <el-form-item label="排序" prop="remark">
<el-input <el-input
style="width: 164px" style="width: 164px"
v-model="addcurrencyform.sort" v-model="addcurrencyform.sort"
placeholder="排序" placeholder="排序"></el-input>
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="备注信息" prop="remark"> <el-form-item label="备注信息" prop="remark">
<el-input <el-input
style="width: 438px" style="width: 438px"
v-model="addcurrencyform.remark" v-model="addcurrencyform.remark"
placeholder="请输入备注信息" placeholder="请输入备注信息"></el-input>
></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="相关风格" prop="styleIds" v-if="is_tab == '1'">
label="相关风格"
prop="styleIds"
v-if="is_tab == '1'"
>
<el-select <el-select
v-model="addcurrencyform.styleIds" v-model="addcurrencyform.styleIds"
multiple multiple
placeholder="请选择相关风格" placeholder="请选择相关风格"
style="width: 438px" style="width: 438px"
filterable filterable>
>
<el-option <el-option
v-for="(item, index) in all_list2" v-for="(item, index) in all_list2"
:key="index" :key="index"
:label="item.name" :label="item.name"
:value="item.id" :value="item.id"></el-option>
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
...@@ -175,48 +145,38 @@ ...@@ -175,48 +145,38 @@
prop="skuPropertyIds" prop="skuPropertyIds"
required required
v-if=" v-if="
is_tab == '1' && is_tab == '1' && (addcurrencyform.pid === 0 || !addcurrencyform.pid)
(addcurrencyform.pid === 0 || ">
!addcurrencyform.pid)
"
>
<el-select <el-select
v-model="addcurrencyform.skuPropertyIds" v-model="addcurrencyform.skuPropertyIds"
multiple multiple
filterable filterable
placeholder="请选择相关属性" placeholder="请选择相关属性"
style="width: 438px" style="width: 438px">
>
<el-option <el-option
v-for="item in skuCategory" v-for="item in skuCategory"
:key="item.id" :key="item.id"
:value="item.id" :value="item.id"
:label="item.cnname + '(' + item.enname + ')'" :label="item.cnname + '(' + item.enname + ')'"></el-option>
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="一般属性" label="一般属性"
prop="generalPropertyIds" prop="generalPropertyIds"
v-if=" v-if="
is_tab == '1' && is_tab == '1' && (addcurrencyform.pid === 0 || !addcurrencyform.pid)
(addcurrencyform.pid === 0 || ">
!addcurrencyform.pid)
"
>
<el-select <el-select
v-model="addcurrencyform.generalPropertyIds" v-model="addcurrencyform.generalPropertyIds"
multiple multiple
filterable filterable
placeholder="请选择相关属性" placeholder="请选择相关属性"
style="width: 438px" style="width: 438px">
>
<el-option <el-option
v-for="item in generalCategory" v-for="item in generalCategory"
:key="item.id" :key="item.id"
:value="item.id" :value="item.id"
:label="item.cnname + '(' + item.enname + ')'" :label="item.cnname + '(' + item.enname + ')'"></el-option>
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -224,16 +184,14 @@ ...@@ -224,16 +184,14 @@
<el-button <el-button
@click="dialogVisible = false" @click="dialogVisible = false"
size="mini" size="mini"
style="width: 130px" style="width: 130px">
>
取消 取消
</el-button> </el-button>
<el-button <el-button
type="primary" type="primary"
@click="addCurrency()" @click="addCurrency()"
size="mini" size="mini"
style="width: 130px" style="width: 130px">
>
确认 确认
</el-button> </el-button>
</span> </span>
...@@ -243,43 +201,26 @@ ...@@ -243,43 +201,26 @@
:title="`设置默认供应商(${currentCateName})`" :title="`设置默认供应商(${currentCateName})`"
:visible.sync="setDefVisivle" :visible.sync="setDefVisivle"
width="790px" width="790px"
:close-on-click-modal="false" :close-on-click-modal="false">
>
<el-input <el-input
v-model="supplierName" v-model="supplierName"
placeholder="" placeholder=""
style="width: 200px; margin-bottom: 10px" style="width: 200px; margin-bottom: 10px"
clearable clearable></el-input>
></el-input>
<div style="min-height: 100px; max-height: 500px"> <div style="min-height: 100px; max-height: 500px">
<el-radio-group <el-radio-group v-model="supplierId" style="width: 100%">
v-model="supplierId"
style="width: 100%"
>
<div <div
style=" style="display: inline-block; width: 33.33%; margin-bottom: 10px"
display: inline-block;
width: 33.33%;
margin-bottom: 10px;
"
v-for="(item, index) in supplierlist" v-for="(item, index) in supplierlist"
:key="index" :key="index">
> <el-radio :label="item.id">{{ item.name }}</el-radio>
<el-radio :label="item.id">{{
item.name
}}</el-radio>
</div> </div>
</el-radio-group> </el-radio-group>
</div> </div>
<span slot="footer"> <span slot="footer">
<el-button @click="setDefVisivle = false" <el-button @click="setDefVisivle = false">取消</el-button>
>取消</el-button <el-button type="primary" @click="submitDefaultSupplier">
>
<el-button
type="primary"
@click="submitDefaultSupplier"
>
保存 保存
</el-button> </el-button>
</span> </span>
...@@ -289,10 +230,11 @@ ...@@ -289,10 +230,11 @@
<script> <script>
import axios from '../../common/api/axios' import axios from '../../common/api/axios'
import TableView from '@/common/components/base/tableView.vue' import TableView from '@/common/components/base/tableView.vue'
export default { export default {
name: 'supply_category', name: 'supply_category',
components: { components: {
TableView, TableView
}, },
data() { data() {
return { return {
...@@ -313,7 +255,7 @@ export default { ...@@ -313,7 +255,7 @@ export default {
styleIds: [], styleIds: [],
styleNames: '', styleNames: '',
pid: 0, pid: 0,
propertyIds: [], propertyIds: []
}, },
addcurrencyform2: null, addcurrencyform2: null,
formId: null, formId: null,
...@@ -325,12 +267,12 @@ export default { ...@@ -325,12 +267,12 @@ export default {
label: 'name', label: 'name',
value: 'id', value: 'id',
checkStrictly: true, checkStrictly: true,
emitPath: false, emitPath: false
}, },
paginationOptions: { paginationOptions: {
pageSize: 100, pageSize: 100,
currentPage: 1, currentPage: 1,
total: 0, total: 0
}, },
category: [], category: [],
supplierList: [], supplierList: [],
...@@ -340,22 +282,18 @@ export default { ...@@ -340,22 +282,18 @@ export default {
supplierName: '', supplierName: '',
selections: [], selections: [],
skuCategory: [], skuCategory: [],
generalCategory: [], generalCategory: []
} }
}, },
created() { created() {
// this.alllist("baseStyleInfo/all_list", "all_list2"); // this.alllist("baseStyleInfo/all_list", "all_list2");
this.getList(1) this.getList(1)
this.addcurrencyform2 = JSON.parse( this.addcurrencyform2 = JSON.parse(JSON.stringify(this.addcurrencyform))
JSON.stringify(this.addcurrencyform),
)
}, },
computed: { computed: {
supplierlist() { supplierlist() {
return this.supplierList.filter( return this.supplierList.filter(
(item) => (item) => item.name && item.name.indexOf(this.supplierName) !== -1
item.name &&
item.name.indexOf(this.supplierName) !== -1,
) )
}, },
tableColumns() { tableColumns() {
...@@ -384,49 +322,48 @@ export default { ...@@ -384,49 +322,48 @@ export default {
? '#4168FF' ? '#4168FF'
: item.deep === 2 : item.deep === 2
? '#67c23a' ? '#67c23a'
: '', : ''
}} }}></span>
></span>
<span>{item.name}</span> <span>{item.name}</span>
</div> </div>
), )
}, },
{ {
label: '类别英文名', label: '类别英文名',
key: 'enname', key: 'enname',
align: 'left', align: 'left',
width: 130, width: 130
}, },
{ {
label: '相关风格', label: '相关风格',
key: 'styleNames', key: 'styleNames',
align: 'left', align: 'left',
width: 200, width: 200
}, },
{ {
label: 'SKU属性', label: 'SKU属性',
key: 'skuPropertyNames', key: 'skuPropertyNames',
align: 'left', align: 'left',
width: 200, width: 200
}, },
{ {
label: '一般属性', label: '一般属性',
key: 'propertyNames', key: 'propertyNames',
align: 'left', align: 'left'
}, }
] ]
} else { } else {
arr = [ arr = [
{ {
label: '风格名称', label: '风格名称',
key: 'name', key: 'name',
align: 'left', align: 'left'
}, },
{ {
label: '风格编码', label: '风格编码',
key: 'code', key: 'code',
align: 'left', align: 'left'
}, }
] ]
} }
return [ return [
...@@ -435,12 +372,12 @@ export default { ...@@ -435,12 +372,12 @@ export default {
label: '排序', label: '排序',
key: 'sort', key: 'sort',
align: 'right', align: 'right',
width: 100, width: 100
}, },
{ {
label: '备注信息', label: '备注信息',
key: 'remark', key: 'remark',
align: 'center', align: 'center'
}, },
{ {
label: '相关操作', label: '相关操作',
...@@ -450,29 +387,21 @@ export default { ...@@ -450,29 +387,21 @@ export default {
width: 100, width: 100,
render: (item) => ( render: (item) => (
<div> <div>
<span <span class="icon-view icon-edit-view" title="编辑">
class="icon-view icon-edit-view"
title="编辑"
>
<i <i
class="el-icon-edit" class="el-icon-edit"
onClick={() => this.addDialog(2, item)} onClick={() => this.addDialog(2, item)}></i>
></i>
</span> </span>
<span <span class="icon-view icon-del-view" title="删除">
class="icon-view icon-del-view"
title="删除"
>
<i <i
class="el-icon-delete-solid" class="el-icon-delete-solid"
onClick={() => this.deleteSection(item)} onClick={() => this.deleteSection(item)}></i>
></i>
</span> </span>
</div> </div>
), )
}, }
] ]
}, }
}, },
// watch: { // watch: {
// select_tab(val) { // select_tab(val) {
...@@ -486,10 +415,31 @@ export default { ...@@ -486,10 +415,31 @@ export default {
text_join(value) { text_join(value) {
if (!value) return '' if (!value) return ''
return value.join(',') return value.join(',')
}, }
}, },
methods: { methods: {
importExcel() {
const input = document.createElement('input')
input.style.display = 'none'
input.type = 'file'
input.click()
input.onchange = async () => {
const form = new FormData()
form.append('importExcel', input.files.length > 0 ? input.files[0] : [])
const res = await axios.post(
this.is_tab === '1'
? 'baseCategoryInfo/importBaseCategoryInfo'
: 'baseStyleInfo/importBaseStyleInfo',
form
)
console.log(res)
if (res.code === 200) {
this.$message.success('导入成功')
this.getList()
}
}
},
onCurrentChange(currentPage) { onCurrentChange(currentPage) {
this.paginationOptions.currentPage = currentPage this.paginationOptions.currentPage = currentPage
this.getList() this.getList()
...@@ -502,7 +452,7 @@ export default { ...@@ -502,7 +452,7 @@ export default {
axios axios
.post('baseCategoryInfo/setDefaultSupplier', { .post('baseCategoryInfo/setDefaultSupplier', {
id: this.currentCateId, id: this.currentCateId,
defaultSupplierId: this.supplierId, defaultSupplierId: this.supplierId
}) })
.then((res) => { .then((res) => {
this.$message.success(res.message) this.$message.success(res.message)
...@@ -517,14 +467,12 @@ export default { ...@@ -517,14 +467,12 @@ export default {
this.supplierId = '' this.supplierId = ''
axios axios
.get('supplySupplier/getSupplyByCategory', { .get('supplySupplier/getSupplyByCategory', {
params: { categoryId: item.id }, params: { categoryId: item.id }
}) })
.then((res) => { .then((res) => {
const supplierList = res.data || [] const supplierList = res.data || []
if (supplierList.length === 0) { if (supplierList.length === 0) {
return this.$message.warning( return this.$message.warning('该分类下暂无供应商')
'该分类下暂无供应商',
)
} else { } else {
this.setDefVisivle = true this.setDefVisivle = true
this.supplierList = supplierList this.supplierList = supplierList
...@@ -535,15 +483,9 @@ export default { ...@@ -535,15 +483,9 @@ export default {
if (this.all_list2.length > 0) return if (this.all_list2.length > 0) return
this.alllist('baseStyleInfo/all_list', 'all_list2') this.alllist('baseStyleInfo/all_list', 'all_list2')
if (this.skuCategory.length > 0) return if (this.skuCategory.length > 0) return
this.alllist( this.alllist('baseProperty/all_list_sku', 'skuCategory')
'baseProperty/all_list_sku',
'skuCategory',
)
if (this.generalCategory.length > 0) return if (this.generalCategory.length > 0) return
this.alllist( this.alllist('baseProperty/all_list_general', 'generalCategory')
'baseProperty/all_list_general',
'generalCategory',
)
}, },
search() { search() {
this.currentPage = 1 this.currentPage = 1
...@@ -561,10 +503,7 @@ export default { ...@@ -561,10 +503,7 @@ export default {
addDialog(i, v = null) { addDialog(i, v = null) {
this.getStyle() this.getStyle()
if (this.is_tab === '1') { if (this.is_tab === '1') {
this.alllist( this.alllist('baseCategoryInfo/tree_list', 'all_list')
'baseCategoryInfo/tree_list',
'all_list',
)
} }
if (i === 2) { if (i === 2) {
if (v) this.formId = v.id if (v) this.formId = v.id
...@@ -575,7 +514,7 @@ export default { ...@@ -575,7 +514,7 @@ export default {
} else { } else {
this.$nextTick(() => { this.$nextTick(() => {
this.addcurrencyform = JSON.parse( this.addcurrencyform = JSON.parse(
JSON.stringify(this.addcurrencyform2), JSON.stringify(this.addcurrencyform2)
) )
}) })
this.is_title = i this.is_title = i
...@@ -604,15 +543,14 @@ export default { ...@@ -604,15 +543,14 @@ export default {
}, },
getList() { getList() {
if (this.is_tab === '2') { if (this.is_tab === '2') {
const { pageSize, currentPage } = const { pageSize, currentPage } = this.paginationOptions
this.paginationOptions
axios axios
.get('baseStyleInfo/list_page', { .get('baseStyleInfo/list_page', {
params: { params: {
pageSize: pageSize, pageSize: pageSize,
currentPage: currentPage, currentPage: currentPage
}, },
baseURL: '/api/manage/rest', baseURL: '/api/manage/rest'
}) })
.then((res) => { .then((res) => {
if (res.code === 200) { if (res.code === 200) {
...@@ -622,76 +560,66 @@ export default { ...@@ -622,76 +560,66 @@ export default {
this.paginationOptions.total = res.data.total this.paginationOptions.total = res.data.total
} else { } else {
this.$alert(res.message, '错误提示', { this.$alert(res.message, '错误提示', {
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true
}) })
} }
}) })
} else { } else {
this.alllist( this.alllist('baseCategoryInfo/tree_list', 'sourceData')
'baseCategoryInfo/tree_list',
'sourceData',
)
} }
}, },
selectSection() { selectSection() {
const text = const text = this.is_tab === '1' ? 'baseCategoryInfo' : 'baseStyleInfo'
this.is_tab === '1'
? 'baseCategoryInfo'
: 'baseStyleInfo'
const url = `${text}/get?id=${this.formId}` const url = `${text}/get?id=${this.formId}`
axios.get(url, { axios
baseURL: '/api/manage/rest', .get(url, {
}).then((res) => { baseURL: '/api/manage/rest'
if (res.code === 200) { })
const data = res.data .then((res) => {
this.addcurrencyform = Object.assign({}, data) if (res.code === 200) {
this.is_title = 2 const data = res.data
this.dialogVisible = true this.addcurrencyform = Object.assign({}, data)
} else { this.is_title = 2
this.$alert(res.message, '错误提示', { this.dialogVisible = true
dangerouslyUseHTMLString: true, } else {
}) this.$alert(res.message, '错误提示', {
} dangerouslyUseHTMLString: true
}) })
}
})
}, },
upSection() { upSection() {
const text = const text = this.is_tab === '1' ? 'baseCategoryInfo' : 'baseStyleInfo'
this.is_tab === '1'
? 'baseCategoryInfo'
: 'baseStyleInfo'
const url = `${text}/update` const url = `${text}/update`
axios.post(url, this.addcurrencyform).then((res) => { axios.post(url, this.addcurrencyform).then((res) => {
if (res.code === 200) { if (res.code === 200) {
this.dialogVisible = false this.dialogVisible = false
this.$message({ this.$message({
message: '修改成功', message: '修改成功',
type: 'success', type: 'success'
}) })
this.getList(this.currentPage) this.getList(this.currentPage)
} else { } else {
this.$alert(res.message, '错误提示', { this.$alert(res.message, '错误提示', {
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true
}) })
} }
}) })
}, },
addSection() { addSection() {
const text = const text = this.is_tab === '1' ? 'baseCategoryInfo' : 'baseStyleInfo'
this.is_tab === '1'
? 'baseCategoryInfo'
: 'baseStyleInfo'
const url = `${text}/add` const url = `${text}/add`
axios.post(url, this.addcurrencyform).then((res) => { axios.post(url, this.addcurrencyform).then((res) => {
if (res.code === 200) { if (res.code === 200) {
this.dialogVisible = false this.dialogVisible = false
this.$message({ this.$message({
message: '添加成功', message: '添加成功',
type: 'success', type: 'success'
}) })
this.getList(this.currentPage) this.getList(this.currentPage)
} else { } else {
this.$alert(res.message, '错误提示', { this.$alert(res.message, '错误提示', {
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true
}) })
} }
}) })
...@@ -712,19 +640,17 @@ export default { ...@@ -712,19 +640,17 @@ export default {
this.$confirm('确定删除选中的信息?', '提示', { this.$confirm('确定删除选中的信息?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning'
}) })
.then(() => { .then(() => {
const text = const text =
this.is_tab === '1' this.is_tab === '1' ? 'baseCategoryInfo' : 'baseStyleInfo'
? 'baseCategoryInfo'
: 'baseStyleInfo'
const url = `${text}/delete?ids=${ids}` const url = `${text}/delete?ids=${ids}`
axios.get(url).then((res) => { axios.get(url).then((res) => {
if (res.code === 200) { if (res.code === 200) {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '删除成功!', message: '删除成功!'
}) })
this.getList(this.currentPage) this.getList(this.currentPage)
} }
...@@ -733,24 +659,22 @@ export default { ...@@ -733,24 +659,22 @@ export default {
.catch(() => {}) .catch(() => {})
}, },
alllist(url, arr) { alllist(url, arr) {
axios axios.get(url, { baseURL: '/api/manage/rest' }).then((res) => {
.get(url, { baseURL: '/api/manage/rest' }) if (res.code === 200) {
.then((res) => { this[arr] = res.data
if (res.code === 200) { this.$nextTick(() => {
this[arr] = res.data if (this.$refs.addcurrencyform) {
this.$nextTick(() => { this.$refs.addcurrencyform.clearValidate()
if (this.$refs.addcurrencyform) { }
this.$refs.addcurrencyform.clearValidate() })
} } else {
}) this.$alert(res.message, '错误提示', {
} else { dangerouslyUseHTMLString: true
this.$alert(res.message, '错误提示', { })
dangerouslyUseHTMLString: true, }
}) })
} }
}) }
},
},
} }
</script> </script>
<style> <style>
......
...@@ -24,37 +24,27 @@ ...@@ -24,37 +24,27 @@
size="mini" size="mini"
@submit.native.prevent @submit.native.prevent
v-enter-submit="search" v-enter-submit="search"
class="search_form" class="search_form">
>
<template> <template>
<el-form-item label="名称"> <el-form-item label="名称">
<el-input <el-input
v-model="searchForm.name" v-model="searchForm.name"
placeholder="中文或英文" placeholder="中文或英文"
clearable clearable></el-input>
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="编码"> <el-form-item label="编码">
<el-input <el-input
v-model="searchForm.code" v-model="searchForm.code"
placeholder="中文或英文" placeholder="中文或英文"
clearable clearable></el-input>
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="类别" prop="employeeName"> <el-form-item label="类别" prop="employeeName">
<el-select <el-select
v-model="searchForm.cateCode" v-model="searchForm.cateCode"
clearable clearable
placeholder="请选择" placeholder="请选择">
> <el-option label="颜色" value="Color"></el-option>
<el-option <el-option label="尺寸" value="Size"></el-option>
label="颜色"
value="Color"
></el-option>
<el-option
label="尺寸"
value="Size"
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -74,21 +64,19 @@ ...@@ -74,21 +64,19 @@
type="primary" type="primary"
@click="search()" @click="search()"
icon="el-icon-search" icon="el-icon-search"
native-type="submit" native-type="submit">
>
查询 查询
</el-button> </el-button>
</el-form-item> </el-form-item>
</template> </template>
<el-form-item> <el-form-item>
<el-button type="success" @click="addDialog(1)" <el-button type="success" @click="addDialog(1)">新增</el-button>
>新增</el-button
>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="danger" @click="deleteSection()" <el-button type="danger" @click="deleteSection()">删除</el-button>
>删除</el-button </el-form-item>
> <el-form-item style="margin-bottom: 0px">
<el-button type="primary" @click="importExcel">导入</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="table-wrap" v-loading="loading"> <div class="table-wrap" v-loading="loading">
...@@ -98,14 +86,12 @@ ...@@ -98,14 +86,12 @@
:selection="true" :selection="true"
:tableColumns="tableColumns" :tableColumns="tableColumns"
@selectionChange="selectionChange" @selectionChange="selectionChange"
@currentChange="currentTabFn" @currentChange="currentTabFn"></my-table>
></my-table>
</div> </div>
<div class="pagination"> <div class="pagination">
<pagination <pagination
:setValue="setpaginationOptions" :setValue="setpaginationOptions"
:options="paginationOptions" :options="paginationOptions" />
/>
</div> </div>
</div> </div>
...@@ -114,8 +100,7 @@ ...@@ -114,8 +100,7 @@
:close-on-click-modal="false" :close-on-click-modal="false"
:title="is_title == 1 ? '新增' : '编辑'" :title="is_title == 1 ? '新增' : '编辑'"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="700px" width="700px">
>
<el-form <el-form
label-position="right" label-position="right"
label-width="100px" label-width="100px"
...@@ -123,58 +108,42 @@ ...@@ -123,58 +108,42 @@
:inline="true" :inline="true"
:model="addcurrencyform" :model="addcurrencyform"
:rules="addrules" :rules="addrules"
ref="addcurrencyform" ref="addcurrencyform">
>
<el-form-item label="中文名" prop="cnname" required> <el-form-item label="中文名" prop="cnname" required>
<el-input <el-input
style="width: 164px" style="width: 164px"
v-model="addcurrencyform.cnname" v-model="addcurrencyform.cnname"
placeholder="请输入中文名" placeholder="请输入中文名"></el-input>
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="英文名" prop="enname" required> <el-form-item label="英文名" prop="enname" required>
<el-input <el-input
style="width: 164px" style="width: 164px"
v-model="addcurrencyform.enname" v-model="addcurrencyform.enname"
placeholder="请输入英文名" placeholder="请输入英文名"></el-input>
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="编码" prop="code" required> <el-form-item label="编码" prop="code" required>
<el-input <el-input
style="width: 164px" style="width: 164px"
v-model="addcurrencyform.code" v-model="addcurrencyform.code"
maxlength="7" maxlength="7"
placeholder="请输入编码" placeholder="请输入编码"></el-input>
></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="类别" prop="cateCode" required>
label="类别"
prop="cateCode"
required
>
<el-select <el-select
v-model="addcurrencyform.cateCode" v-model="addcurrencyform.cateCode"
style="width: 164px" style="width: 164px"
clearable clearable
placeholder="请选择" placeholder="请选择">
> <el-option label="颜色" value="Color"></el-option>
<el-option <el-option label="尺寸" value="Size"></el-option>
label="颜色"
value="Color"
></el-option>
<el-option
label="尺寸"
value="Size"
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="排序序号" prop="sort"> <el-form-item label="排序序号" prop="sort">
<el-input <el-input
style="width: 164px" style="width: 164px"
v-model.number="addcurrencyform.sort" v-model.number="addcurrencyform.sort"
placeholder="请输入数字" placeholder="请输入数字"></el-input>
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="是否带电池"> <el-form-item label="是否带电池">
<el-select <el-select
...@@ -182,13 +151,9 @@ ...@@ -182,13 +151,9 @@
v-model="addcurrencyform.battery" v-model="addcurrencyform.battery"
clearable clearable
value-key="" value-key=""
placeholder="请选择" placeholder="请选择">
>
<el-option label="是" :value="true"></el-option> <el-option label="是" :value="true"></el-option>
<el-option <el-option label="否" :value="false"></el-option>
label="否"
:value="false"
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="是否液体"> <el-form-item label="是否液体">
...@@ -197,13 +162,9 @@ ...@@ -197,13 +162,9 @@
v-model="addcurrencyform.liquid" v-model="addcurrencyform.liquid"
clearable clearable
value-key="" value-key=""
placeholder="请选择" placeholder="请选择">
>
<el-option label="是" :value="true"></el-option> <el-option label="是" :value="true"></el-option>
<el-option <el-option label="否" :value="false"></el-option>
label="否"
:value="false"
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="是否刀具"> <el-form-item label="是否刀具">
...@@ -212,44 +173,36 @@ ...@@ -212,44 +173,36 @@
v-model="addcurrencyform.knife" v-model="addcurrencyform.knife"
clearable clearable
value-key="" value-key=""
placeholder="请选择" placeholder="请选择">
>
<el-option label="是" :value="true"></el-option> <el-option label="是" :value="true"></el-option>
<el-option <el-option label="否" :value="false"></el-option>
label="否"
:value="false"
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="文字色"> <el-form-item label="文字色">
<el-color-picker <el-color-picker
style="width: 164px" style="width: 164px"
v-model="addcurrencyform.fontColor" v-model="addcurrencyform.fontColor"
size="small" size="small"></el-color-picker>
></el-color-picker>
</el-form-item> </el-form-item>
<el-form-item label="背景色" prop="remark"> <el-form-item label="背景色" prop="remark">
<el-color-picker <el-color-picker
style="width: 164px" style="width: 164px"
v-model="addcurrencyform.bgColor" v-model="addcurrencyform.bgColor"
size="small" size="small"></el-color-picker>
></el-color-picker>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button <el-button
@click="dialogVisible = false" @click="dialogVisible = false"
size="mini" size="mini"
style="width: 100px" style="width: 100px">
>
取消 取消
</el-button> </el-button>
<el-button <el-button
type="primary" type="primary"
@click="addCurrency()" @click="addCurrency()"
size="mini" size="mini"
style="width: 100px" style="width: 100px">
>
确认 确认
</el-button> </el-button>
</span> </span>
...@@ -262,7 +215,7 @@ import MyTable from '@/common/components/base/tableView.vue' ...@@ -262,7 +215,7 @@ import MyTable from '@/common/components/base/tableView.vue'
export default { export default {
name: 'system_sku-manage', name: 'system_sku-manage',
components: { components: {
MyTable, MyTable
}, },
data() { data() {
return { return {
...@@ -275,7 +228,7 @@ export default { ...@@ -275,7 +228,7 @@ export default {
searchForm: { searchForm: {
cateId: '', cateId: '',
code: '', code: '',
name: '', name: ''
}, },
addcurrencyform: { addcurrencyform: {
sort: '', sort: '',
...@@ -284,7 +237,7 @@ export default { ...@@ -284,7 +237,7 @@ export default {
cnname: '', cnname: '',
enname: '', enname: '',
fontColor: '', fontColor: '',
bgColor: '', bgColor: ''
}, },
all_list: [], all_list: [],
addcurrencyform2: null, addcurrencyform2: null,
...@@ -293,11 +246,11 @@ export default { ...@@ -293,11 +246,11 @@ export default {
paginationOptions: { paginationOptions: {
pageSize: 100, pageSize: 100,
currentPage: 1, currentPage: 1,
total: 0, total: 0
}, },
defaultProps: { defaultProps: {
label: 'name', label: 'name'
}, }
} }
}, },
computed: { computed: {
...@@ -308,7 +261,7 @@ export default { ...@@ -308,7 +261,7 @@ export default {
{ label: '编码', key: 'code' }, { label: '编码', key: 'code' },
{ {
label: '类别', label: '类别',
key: 'cateName', key: 'cateName'
}, },
{ label: '排列序号', key: 'sort', width: 80 }, { label: '排列序号', key: 'sort', width: 80 },
...@@ -322,10 +275,9 @@ export default { ...@@ -322,10 +275,9 @@ export default {
width: '20px', width: '20px',
height: '20px', height: '20px',
display: 'inline-block', display: 'inline-block',
backgroundColor: item.fontColor, backgroundColor: item.fontColor
}} }}></span>
></span> )
),
}, },
{ {
label: '背景色', label: '背景色',
...@@ -337,39 +289,30 @@ export default { ...@@ -337,39 +289,30 @@ export default {
width: '20px', width: '20px',
height: '20px', height: '20px',
display: 'inline-block', display: 'inline-block',
backgroundColor: item.bgColor, backgroundColor: item.bgColor
}} }}></span>
></span> )
),
}, },
{ {
label: '相关操作', label: '相关操作',
width: 80, width: 80,
render: (item) => ( render: (item) => (
<div> <div>
<span <span class="icon-view icon-edit-view" title="编辑">
class="icon-view icon-edit-view"
title="编辑"
>
<i <i
class="el-icon-edit" class="el-icon-edit"
onClick={() => this.addDialog(2, item)} onClick={() => this.addDialog(2, item)}></i>
></i>
</span> </span>
<span <span class="icon-view icon-del-view" title="删除">
class="icon-view icon-del-view"
title="删除"
>
<i <i
class="el-icon-delete-solid" class="el-icon-delete-solid"
onClick={() => this.deleteSection(item)} onClick={() => this.deleteSection(item)}></i>
></i>
</span> </span>
</div> </div>
), )
}, }
] ]
}, }
// categoryList() { // categoryList() {
// const list = [ // const list = [
// { // {
...@@ -395,9 +338,7 @@ export default { ...@@ -395,9 +338,7 @@ export default {
created() { created() {
this.alllist('baseProperty/all_list') this.alllist('baseProperty/all_list')
this.getList(1) this.getList(1)
this.addcurrencyform2 = JSON.parse( this.addcurrencyform2 = JSON.parse(JSON.stringify(this.addcurrencyform))
JSON.stringify(this.addcurrencyform),
)
}, },
methods: { methods: {
...@@ -432,7 +373,7 @@ export default { ...@@ -432,7 +373,7 @@ export default {
} else { } else {
this.$nextTick(() => { this.$nextTick(() => {
this.addcurrencyform = JSON.parse( this.addcurrencyform = JSON.parse(
JSON.stringify(this.addcurrencyform2), JSON.stringify(this.addcurrencyform2)
) )
}) })
} }
...@@ -450,6 +391,25 @@ export default { ...@@ -450,6 +391,25 @@ export default {
this.upSection() this.upSection()
} }
}, },
importExcel() {
const input = document.createElement('input')
input.style.display = 'none'
input.type = 'file'
input.click()
input.onchange = async () => {
const form = new FormData()
form.append('importExcel', input.files.length > 0 ? input.files[0] : [])
const res = await axios.post(
'base/propertyValue/importBasePropertyValue',
form
)
console.log(res)
if (res.code === 200) {
this.$message.success('导入成功')
this.getList()
}
}
},
setpaginationOptions(opt) { setpaginationOptions(opt) {
for (const key in opt) { for (const key in opt) {
this.paginationOptions[key] = opt[key] this.paginationOptions[key] = opt[key]
...@@ -458,8 +418,7 @@ export default { ...@@ -458,8 +418,7 @@ export default {
}, },
// 查询 // 查询
getList() { getList() {
const { pageSize, currentPage } = const { pageSize, currentPage } = this.paginationOptions
this.paginationOptions
this.loading = true this.loading = true
axios axios
.get('base/propertyValue/list_page', { .get('base/propertyValue/list_page', {
...@@ -467,9 +426,9 @@ export default { ...@@ -467,9 +426,9 @@ export default {
pageSize, pageSize,
currentPage, currentPage,
skuProperty: this.skuProperty, skuProperty: this.skuProperty,
...this.searchForm, ...this.searchForm
}, },
baseURL: '/api/manage/rest', baseURL: '/api/manage/rest'
}) })
.then((res) => { .then((res) => {
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
...@@ -478,7 +437,7 @@ export default { ...@@ -478,7 +437,7 @@ export default {
this.paginationOptions.total = res.data.total this.paginationOptions.total = res.data.total
} else { } else {
this.$alert(res.message, '错误提示', { this.$alert(res.message, '错误提示', {
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true
}) })
} }
}) })
...@@ -504,7 +463,7 @@ export default { ...@@ -504,7 +463,7 @@ export default {
this.dialogVisible = true this.dialogVisible = true
} else { } else {
this.$alert(res.message, '错误提示', { this.$alert(res.message, '错误提示', {
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true
}) })
} }
}) })
...@@ -514,23 +473,21 @@ export default { ...@@ -514,23 +473,21 @@ export default {
const url = 'base/propertyValue/update' const url = 'base/propertyValue/update'
this.$refs.addcurrencyform.validate((valid) => { this.$refs.addcurrencyform.validate((valid) => {
if (valid) { if (valid) {
axios axios.post(url, this.addcurrencyform).then((res) => {
.post(url, this.addcurrencyform) // eslint-disable-next-line eqeqeq
.then((res) => { if (res.code == 200) {
// eslint-disable-next-line eqeqeq this.dialogVisible = false
if (res.code == 200) { this.$message({
this.dialogVisible = false message: '修改成功',
this.$message({ type: 'success'
message: '修改成功', })
type: 'success', this.getList(this.currentPage)
}) } else {
this.getList(this.currentPage) this.$alert(res.message, '错误提示', {
} else { dangerouslyUseHTMLString: true
this.$alert(res.message, '错误提示', { })
dangerouslyUseHTMLString: true, }
}) })
}
})
} }
}) })
}, },
...@@ -539,23 +496,21 @@ export default { ...@@ -539,23 +496,21 @@ export default {
const url = 'base/propertyValue/add' const url = 'base/propertyValue/add'
this.$refs.addcurrencyform.validate((valid) => { this.$refs.addcurrencyform.validate((valid) => {
if (valid) { if (valid) {
axios axios.post(url, this.addcurrencyform).then((res) => {
.post(url, this.addcurrencyform) // eslint-disable-next-line eqeqeq
.then((res) => { if (res.code == 200) {
// eslint-disable-next-line eqeqeq this.dialogVisible = false
if (res.code == 200) { this.$message({
this.dialogVisible = false message: '添加成功',
this.$message({ type: 'success'
message: '添加成功', })
type: 'success', this.getList(this.currentPage)
}) } else {
this.getList(this.currentPage) this.$alert(res.message, '错误提示', {
} else { dangerouslyUseHTMLString: true
this.$alert(res.message, '错误提示', { })
dangerouslyUseHTMLString: true, }
}) })
}
})
} }
}) })
}, },
...@@ -577,7 +532,7 @@ export default { ...@@ -577,7 +532,7 @@ export default {
this.$confirm('确定删除选中的信息?', '提示', { this.$confirm('确定删除选中的信息?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning'
}) })
.then(() => { .then(() => {
const url = `base/propertyValue/delete?ids=${ids}` const url = `base/propertyValue/delete?ids=${ids}`
...@@ -586,7 +541,7 @@ export default { ...@@ -586,7 +541,7 @@ export default {
if (res.code == 200) { if (res.code == 200) {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '删除成功!', message: '删除成功!'
}) })
this.getList(this.currentPage) this.getList(this.currentPage)
} }
...@@ -598,7 +553,7 @@ export default { ...@@ -598,7 +553,7 @@ export default {
alllist(url) { alllist(url) {
axios axios
.get(url, { .get(url, {
baseURL: '/api/manage/rest', baseURL: '/api/manage/rest'
}) })
.then((res) => { .then((res) => {
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
...@@ -606,12 +561,12 @@ export default { ...@@ -606,12 +561,12 @@ export default {
this.all_list = res.data this.all_list = res.data
} else { } else {
this.$alert(res.message, '错误提示', { this.$alert(res.message, '错误提示', {
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true
}) })
} }
}) })
}, }
}, }
} }
</script> </script>
<style scoped> <style scoped>
......
...@@ -38,6 +38,9 @@ ...@@ -38,6 +38,9 @@
<el-form-item> <el-form-item>
<el-button type="danger" @click="deleteSection()">删除</el-button> <el-button type="danger" @click="deleteSection()">删除</el-button>
</el-form-item> </el-form-item>
<el-form-item style="margin-bottom: 0px">
<el-button type="primary" @click="importExcel">导入</el-button>
</el-form-item>
</el-form> </el-form>
<div class="table_wrap"> <div class="table_wrap">
<my-table <my-table
...@@ -368,6 +371,22 @@ export default { ...@@ -368,6 +371,22 @@ export default {
}, },
methods: { methods: {
importExcel() {
const input = document.createElement('input')
input.style.display = 'none'
input.type = 'file'
input.click()
input.onchange = async () => {
const form = new FormData()
form.append('importExcel', input.files.length > 0 ? input.files[0] : [])
const res = await axios.post('baseProperty/importBaseProperty', form)
console.log(res)
if (res.code === 200) {
this.$message.success('导入成功')
this.getList()
}
}
},
async changeDisableStatus(v, item) { async changeDisableStatus(v, item) {
try { try {
await this.$confirm( await this.$confirm(
......
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