فهرست منبع

Merge branch 'master' of http://git.huaml.com/zhh/front-end

jiangfeng 5 سال پیش
والد
کامیت
f4e1abcf44

+ 168 - 0
ghs/src/components/module/item-list-layer.vue

@@ -0,0 +1,168 @@
+<template>
+	<el-dialog
+		title="选择花材"
+		:visible.sync="selDialog"
+		:close-on-click-modal="false"
+		:append-to-body="true"
+		width="800px"
+	>
+		<div class="recharge-modal-content">
+			<el-checkbox-group v-model="checkList" class="radio-wrap">
+				<x-crud class="liu-crud-wrap" @load="onLoad">
+					<template #table-column-radio="{scope}">
+						<div>
+                            <el-checkbox v-if="scope.row.select == 2" disabled :label="scope.row.index">选择</el-checkbox>
+                            <el-checkbox v-else :label="scope.row.index">选择</el-checkbox>
+                            </div>
+					</template>
+
+                    <template #table-column-select="{scope}">
+				        <i class="el-icon-success" v-if="scope.row.select == 2" style="color: #67c23a; font-size: 19px"></i>
+				        <i class="el-icon-success" v-else style="color: #c0c4cc; font-size: 19px"></i>
+					</template>
+
+					<template #table-column-cover="{scope}">
+						<div>
+							<cl-avatar
+								shape="square"
+								:size="40"
+								:src="scope.row.cover | default_avatar"
+								:style="{ margin: 'auto' }"
+							></cl-avatar>
+						</div>
+					</template>
+				</x-crud>
+			</el-checkbox-group>
+		</div>
+		<div slot="footer" class="dialog-footer">
+			<el-button size="small" @click="resetForm">取 消</el-button>
+			<el-button type="primary" size="small" @click="confirmFn">确定</el-button>
+		</div>
+	</el-dialog>
+</template>
+
+<script>
+export default {
+	name: 'sj-list-layer',
+	props: {
+		show: {
+			type: Boolean,
+			default: false
+		},
+		multi: {
+			type: Boolean,
+			default: false
+		}
+	},
+	data() {
+		return {
+			selDialog: false,
+			ruleForm: {},
+			checkList: [],
+			list: [],
+			selData: {}
+		};
+	},
+	computed: {
+	},
+	watch: {
+		show(val) {
+			this.selDialog = val;
+		}
+	},
+	created() {},
+	methods: {
+		confirmFn() {
+			this.$emit('confirm', this.list[this.checkList]);
+		},
+		resetForm() {
+			this.$emit('cancel');
+		},
+		onLoad({ ctx, app }) {
+			this.app = app;
+
+			let getItemList = () => {
+				return this.$service.ptItem.list();
+			};
+			ctx.service({
+				page: getItemList
+			})
+				.set('table', {
+					columns: [
+						{
+							prop: 'radio',
+							label: '选择',
+							align: 'center',
+							width: 120
+						},
+						{
+							prop: 'cover',
+							label: '图片',
+							align: 'center',
+                            width: 130
+						},
+						{
+							prop: 'name',
+							label: '名称',
+							align: 'center'
+						},
+                        {
+							prop: 'select',
+							label: '已添加',
+							align: 'center'
+						}
+					],
+
+					on: {
+						'row-click': (row, column) => {
+                            console.log(666666666666666)
+							if (column.property && row.children) {
+								app.refs('table').toggleRowExpansion(row);
+							}
+						}
+                    },
+					// 操作列
+					op: {
+						visible: false // 是否显示
+					}
+				})
+				.set('dict', {
+					search: {
+						keyWord: 'name'
+					}
+				})
+				.set('search', {
+					key: {
+						placeholder: '花材名称,支持拼音首字母'
+					}
+				})
+				.set('pagination', {
+					size: 6
+				})
+				.set('layout', [
+					['slot-tabs'],
+					['search-key', 'flex1', 'refresh-btn'],
+					['data-table'],
+					['flex1', 'pagination']
+				])
+				.on('refresh', async (params, { next, render }) => {
+					// 继续执行刷新
+					let { list } = await next(params);
+					list.map((e, index) => {
+						e.index = index;
+					});
+					this.list = list;
+					render(list);
+				})
+				.done();
+			app.refresh({ type: this.tabIndex });
+		}
+	}
+};
+</script>
+<style lang="scss">
+// 列表
+.radio-wrap {
+	display: block;
+}
+</style>

+ 3 - 1
ghs/src/cool/request/index.js

@@ -28,6 +28,7 @@ import shop from '@/service/shop/index';
 import chat from '@/service/chat/index';
 import itemClass from '@/service/item-class/index';
 import item from '@/service/item/index';
+import ptItem from '@/service/pt-item/index';
 
 export function SET_SERVICE({ store }) {
 	// const files = require.context('@/service/', true, /\.js$/);
@@ -61,7 +62,8 @@ export function SET_SERVICE({ store }) {
 		shop,
 		chat,
 		itemClass,
-		item
+		item,
+		ptItem
 	};
 
 	Vue.prototype.$service = modules;

+ 7 - 0
ghs/src/service/pt-item/index.js

@@ -0,0 +1,7 @@
+import { BaseService, Service } from '@/cool';
+
+@Service('pt-item')
+export class PtItemService extends BaseService {
+
+}
+export default new PtItemService();

+ 30 - 4
ghs/src/views/item/list.vue

@@ -1,7 +1,7 @@
 <template>
 	<div class="app-list-content">
 		<x-crud class="liu-crud-wrap" @load="onLoad">
-			<template #slot-tabs="{ scope }">
+			<template #slot-tabs>
 				<el-tabs
 					class="liu-tabs"
 					type="border-card"
@@ -62,17 +62,28 @@
 					>
 				</div>
 			</template>
-			<template #slot-add-goods-btn="{scope}">
+			<template #slot-add-goods-btn v-if="showAddBtn"> 
 				<el-button type="primary" size="mini" @click="add()">添加</el-button>
 			</template>
 		</x-crud>
+
+		<item-list-layer
+			:show.sync="showItemModal"
+			@confirm="selGoodsConfirmFn"
+			@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: {
+		itemListLayer
+	},
 	data() {
 		return {
 			app: null,
@@ -89,12 +100,24 @@ export default {
 			sort: {
 				status: false
 			},
-			classId:0
+			classId:0,
+			showAddBtn:false,
+			showItemModal:false,
 		};
 	},
 	computed: {
 	},
 	methods: {
+		selGoodsConfirmFn(item) {
+			return false
+			GhsService.bindGhs({sjId:this.selectSjId,ghsSjId:item.id}).then(res => {
+				this.$message.success('操作成功!');
+				this.ghsModal = false;
+			});
+		},
+		add(){
+			this.showItemModal = true
+		},
 		tabClick(tab, e) {
 			this.app.refresh({ classId: this.classId });
 		},
@@ -105,7 +128,10 @@ export default {
 					if(this.$route.query.name != ''){
 						this.tabsData[0].text = this.$route.query.name
 						this.$forceUpdate()
+						this.showAddBtn = true
 					}
+				}else{
+					this.showAddBtn = false
 				}
                 let getItem = () => {
                     return this.$service.item.list({classId:this.classId})

+ 1 - 1
pt/src/saas/shop/list.vue

@@ -38,7 +38,7 @@
 			<template #slot-op-btn="{scope}">
 				<el-button size="mini" type="text" @click="selGoods(scope.row.id)">绑供货商</el-button>
 			</template>
-			<template #slot-add-ad-btn="{scope}">
+			<template #slot-add-ad-btn>
 				<el-button type="primary" size="mini" class="sj_add_button" @click="addBtnFn">添加</el-button>
 			</template>
 		</x-crud>