|
|
@@ -5,92 +5,71 @@
|
|
|
@load="onLoad"
|
|
|
>
|
|
|
<template #slot-tabs>
|
|
|
- <el-tabs
|
|
|
- class="liu-tabs"
|
|
|
- type="border-card"
|
|
|
- v-model="tabIndex"
|
|
|
- @tab-click="tabClick"
|
|
|
- >
|
|
|
- <el-tab-pane
|
|
|
- v-for="(item, index) in tabsData"
|
|
|
- :key="index"
|
|
|
- :label="item.text"
|
|
|
- :name="item.key"
|
|
|
- >
|
|
|
+ <el-tabs class="liu-tabs" type="border-card" v-model="tabIndex" @tab-click="tabClick">
|
|
|
+ <el-tab-pane v-for="(item, index) in tabsData" :key="index" :label="item.text" :name="item.key">
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
</template>
|
|
|
|
|
|
- <template #table-column-avatarUrl="{scope}">
|
|
|
- <cl-avatar
|
|
|
- shape="square"
|
|
|
- :size="32"
|
|
|
- :src="scope.row.smallImgList[0]"
|
|
|
- :style="{ margin: 'auto' }"
|
|
|
- ></cl-avatar>
|
|
|
- </template>
|
|
|
+ <template #table-column-cover="{ scope }">
|
|
|
+ <cl-avatar
|
|
|
+ shape="square"
|
|
|
+ :size="32"
|
|
|
+ :src="scope.row.cover"
|
|
|
+ :style="{ margin: 'auto' }"
|
|
|
+ ></cl-avatar>
|
|
|
+ </template>
|
|
|
|
|
|
<template #table-column-goodsName="{scope}">
|
|
|
<span>{{ scope.row.goodsName }}</span>
|
|
|
</template>
|
|
|
|
|
|
+ <template #table-column-unit="{scope}">
|
|
|
+ <span>{{ scope.row.bigUnit }} / {{scope.row.smallUnit}}</span>
|
|
|
+ </template>
|
|
|
+
|
|
|
+
|
|
|
<template #table-column-inTurn="{scope}">
|
|
|
<span v-if="!sort.status">{{ scope.row.inTurn }}</span>
|
|
|
- <el-input
|
|
|
- ref="sort-input"
|
|
|
- focus
|
|
|
- size="mini"
|
|
|
- v-else
|
|
|
- v-model="scope.row.inTurn"
|
|
|
- @blur="changeSort(scope.row)"
|
|
|
- ></el-input>
|
|
|
+ <el-input style="width:50%;" ref="sort-input" focus size="mini" v-else v-model="scope.row.inTurn" @blur="changeSort(scope.row)" ></el-input>
|
|
|
</template>
|
|
|
|
|
|
- <!-- 排序 -->
|
|
|
<template #table-header-inTurn>
|
|
|
<div class="set-sort">
|
|
|
<span>排序</span>
|
|
|
- <el-button
|
|
|
- v-if="!sort.status"
|
|
|
- icon="el-icon-edit-outline"
|
|
|
- size="small"
|
|
|
- type="text"
|
|
|
- @click="showSort"
|
|
|
- class="show"
|
|
|
- ></el-button>
|
|
|
+ <el-button v-if="!sort.status" icon="el-icon-edit-outline" size="small" type="text" @click="showSort" class="show"></el-button>
|
|
|
+ <el-button class="hide" v-else size="mini" @click="hideSort" type="primary">完成</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
|
|
|
- <el-button
|
|
|
- class="hide"
|
|
|
- v-else
|
|
|
- size="mini"
|
|
|
- @click="hideSort"
|
|
|
- type="primary"
|
|
|
- >完成</el-button>
|
|
|
+ <template #table-column-addPrice="{scope}">
|
|
|
+ <span v-if="!canAddPrice">{{ scope.row.addPrice }}</span>
|
|
|
+ <el-input style="width:50%;" ref="add-price-input" focus size="mini" v-else v-model="scope.row.inTurn"></el-input>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template #table-header-addPrice>
|
|
|
+ <div class="set-sort">
|
|
|
+ <span>每扎加价</span>
|
|
|
+ <el-button v-if="!canAddPrice" icon="el-icon-edit-outline" size="small" type="text" @click="showAddPrice" class="show"></el-button>
|
|
|
+ <el-button class="hide" v-else size="mini" @click="hideAddPrice" type="primary">完成</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
- <template
|
|
|
- #slot-add-goods-btn
|
|
|
- v-if="showAddBtn"
|
|
|
- >
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- size="mini"
|
|
|
- @click="add()"
|
|
|
- >添加</el-button>
|
|
|
+
|
|
|
+
|
|
|
+ <template #slot-add-goods-btn>
|
|
|
+ <el-button type="primary" size="mini" @click="addFn()">添加</el-button>
|
|
|
</template>
|
|
|
+
|
|
|
</x-crud>
|
|
|
- <item-list-layer
|
|
|
- :show.sync="showItemModal"
|
|
|
- @confirm="selGoodsConfirmFn"
|
|
|
- @cancel="showItemModal = false"
|
|
|
- ></item-list-layer>
|
|
|
+ <item-list-layer :show.sync="showItemModal" :classId.sync="classId" :className.sync="className" @confirm="selectItemFn" @cancel="showItemModal = false">
|
|
|
+ </item-list-layer>
|
|
|
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import { mapGetters } from 'vuex';
|
|
|
import itemListLayer from '@/components/module/item-list-layer';
|
|
|
-
|
|
|
export default {
|
|
|
name: 'item_list',
|
|
|
components: {
|
|
|
@@ -112,20 +91,25 @@ export default {
|
|
|
sort: {
|
|
|
status: false
|
|
|
},
|
|
|
+ canAddPrice:false,
|
|
|
classId: 0,
|
|
|
- showAddBtn: false,
|
|
|
+ className:'',
|
|
|
showItemModal: false,
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
},
|
|
|
methods: {
|
|
|
- selGoodsConfirmFn (item) {
|
|
|
+ selectItemFn (currentItem) {
|
|
|
+
|
|
|
+ let item = currentItem.list
|
|
|
+ let classId = currentItem.classId
|
|
|
+
|
|
|
let param = []
|
|
|
item.forEach(value => {
|
|
|
let newObj = {}
|
|
|
newObj.itemId = value.id
|
|
|
- newObj.classId = this.classId
|
|
|
+ newObj.classId = classId
|
|
|
newObj.cost = value.cost
|
|
|
newObj.addPrice = value.addPrice
|
|
|
newObj.stockWarning = value.stockWarning
|
|
|
@@ -139,27 +123,25 @@ export default {
|
|
|
this.$router.go(0)
|
|
|
}).catch(err => { console.log(err) })
|
|
|
},
|
|
|
- add () {
|
|
|
+ addFn () {
|
|
|
this.showItemModal = true
|
|
|
},
|
|
|
tabClick (tab, e) {
|
|
|
this.app.refresh({ classId: this.classId });
|
|
|
},
|
|
|
onLoad ({ ctx, app }) {
|
|
|
- this.app = app;
|
|
|
+
|
|
|
if (this.$route.query.classId) {
|
|
|
- this.classId = this.$route.query.classId
|
|
|
- if (this.$route.query.name != '') {
|
|
|
- this.tabsData[0].text = this.$route.query.name
|
|
|
- this.$forceUpdate()
|
|
|
- this.showAddBtn = true
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.showAddBtn = false
|
|
|
+ this.classId = Number(this.$route.query.classId)
|
|
|
+ this.className = this.$route.query.className
|
|
|
+ this.tabsData[0].text = this.className
|
|
|
}
|
|
|
+
|
|
|
+ this.app = app
|
|
|
+
|
|
|
let getItem = () => {
|
|
|
return this.$service.item.list({ classId: this.classId })
|
|
|
- };
|
|
|
+ }
|
|
|
ctx.service({
|
|
|
page: getItem
|
|
|
})
|
|
|
@@ -170,6 +152,12 @@ export default {
|
|
|
label: 'ID',
|
|
|
align: 'center'
|
|
|
},
|
|
|
+ {
|
|
|
+ prop: 'cover',
|
|
|
+ label: '图片',
|
|
|
+ align: 'center',
|
|
|
+ 'min-width': 100,
|
|
|
+ },
|
|
|
{
|
|
|
prop: 'itemName',
|
|
|
label: '名称',
|
|
|
@@ -177,28 +165,52 @@ export default {
|
|
|
'min-width': 180
|
|
|
},
|
|
|
{
|
|
|
- prop: 'stockWarning',
|
|
|
- label: '库存预警',
|
|
|
+ prop: 'classId',
|
|
|
+ label: '分类',
|
|
|
align: 'center',
|
|
|
'min-width': 100
|
|
|
},
|
|
|
+ {
|
|
|
+ prop: 'stockWarning',
|
|
|
+ label: '库存预警值',
|
|
|
+ align: 'center',
|
|
|
+ 'min-width': 90
|
|
|
+ },
|
|
|
{
|
|
|
prop: 'cost',
|
|
|
label: '每扎成本价',
|
|
|
align: 'center',
|
|
|
- 'min-width': 100
|
|
|
+ 'min-width': 90
|
|
|
},
|
|
|
{
|
|
|
prop: 'addPrice',
|
|
|
label: '每扎加价',
|
|
|
align: 'center',
|
|
|
+ 'min-width': 120
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'weight',
|
|
|
+ label: '重量',
|
|
|
+ align: 'center',
|
|
|
+ 'min-width': 90
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'unit',
|
|
|
+ label: '单位',
|
|
|
+ align: 'center',
|
|
|
'min-width': 100
|
|
|
},
|
|
|
+ {
|
|
|
+ prop: 'ratio',
|
|
|
+ label: '大小单位比',
|
|
|
+ align: 'center',
|
|
|
+ 'min-width': 80
|
|
|
+ },
|
|
|
{
|
|
|
prop: 'inTurn',
|
|
|
label: '排序',
|
|
|
align: 'center',
|
|
|
- minWidth: 100
|
|
|
+ minWidth: 120
|
|
|
},
|
|
|
{
|
|
|
prop: 'addTime',
|
|
|
@@ -210,7 +222,7 @@ export default {
|
|
|
op: {
|
|
|
visible: true,
|
|
|
props: {
|
|
|
- width: 300,
|
|
|
+ width: 200,
|
|
|
align: 'center',
|
|
|
fixed: 'right',
|
|
|
label: '操作'
|
|
|
@@ -241,7 +253,12 @@ export default {
|
|
|
refresh (params) {
|
|
|
this.app.refresh(params);
|
|
|
},
|
|
|
-
|
|
|
+ showAddPrice(){
|
|
|
+ this.canAddPrice = true
|
|
|
+ },
|
|
|
+ hideAddPrice(){
|
|
|
+ this.canAddPrice = false
|
|
|
+ },
|
|
|
showSort (e) {
|
|
|
this.sort.status = true;
|
|
|
},
|