Просмотр исходного кода

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

shish 5 лет назад
Родитель
Сommit
3fbc57bfd9
3 измененных файлов с 451 добавлено и 415 удалено
  1. 197 174
      ghs/src/components/module/item-list-layer.vue
  2. 253 240
      ghs/src/views/item/list.vue
  3. 1 1
      ghs/src/views/order/add.vue

+ 197 - 174
ghs/src/components/module/item-list-layer.vue

@@ -1,191 +1,214 @@
 <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">{{scope.row.id}}</el-checkbox>
-                            <el-checkbox v-else :label="scope.row.index">{{scope.row.id}}</el-checkbox>
-                            </div>
-					</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"
+              >{{scope.row.id}}</el-checkbox>
+              <el-checkbox
+                v-else
+                :label="scope.row.index"
+              >{{scope.row.id}}</el-checkbox>
+            </div>
+          </template>
 
-                    <template #table-column-select="{scope}">
-						<span v-if="scope.row.select == 2">✔</span>
-						<span v-else></span>
-					</template>
+          <template #table-column-select="{scope}">
+            <span v-if="scope.row.select == 2">✔</span>
+            <span v-else></span>
+          </template>
 
-                    <template #table-column-stockWarning="{scope}">
-						<el-input
-							v-model="scope.row.stockWarning"
-							placeholder="最低库存"
-							size="small"
-						></el-input>
-					</template>
+          <template #table-column-stockWarning="{scope}">
+            <el-input
+              v-model="scope.row.stockWarning"
+              placeholder="最低库存"
+              size="small"
+            ></el-input>
+          </template>
 
-					<template #table-column-cost="{scope}">
-				        <el-input
-							v-model="scope.row.cost"
-							placeholder="成本价"
-							size="small"
-						></el-input>
-					</template>
+          <template #table-column-cost="{scope}">
+            <el-input
+              v-model="scope.row.cost"
+              placeholder="成本价"
+              size="small"
+            ></el-input>
+          </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 #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;
+  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: 'stockWarning',
-							label: '最低库存提醒',
-							align: 'center'
-						},
-						{
-							prop: 'cost',
-							label: '成本价',
-							align: 'center'
-						},
-                        {
-							prop: 'select',
-							label: '已添加',
-							align: 'center'
-						}
-					],
-					on: {
-						'row-click': (row, column) => {
-                            console.log(666666666666666)
-							console.log(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 });
-		}
-	}
+      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: 'stockWarning',
+              label: '最低库存提醒',
+              align: 'center'
+            },
+            {
+              prop: 'cost',
+              label: '成本价',
+              align: 'center'
+            },
+            {
+              prop: 'select',
+              label: '已添加',
+              align: 'center'
+            }
+          ],
+          on: {
+            'row-click': (row, column) => {
+              console.log(666666666666666)
+              console.log(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;
+  display: block;
 }
 </style>

+ 253 - 240
ghs/src/views/item/list.vue

@@ -1,267 +1,280 @@
 <template>
-	<div class="app-list-content">
-		<x-crud class="liu-crud-wrap" @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-tab-pane>
-				</el-tabs>
-			</template>
+  <div class="app-list-content">
+    <x-crud
+      class="liu-crud-wrap"
+      @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-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-avatarUrl="{scope}">
+        <cl-avatar
+          shape="square"
+          :size="32"
+          :src="scope.row.smallImgList[0]"
+          :style="{ margin: 'auto' }"
+        ></cl-avatar>
+      </template>
 
-			<template #table-column-goodsName="{scope}">
-				<span>{{ scope.row.goodsName }}</span>
-			</template>
+      <template #table-column-goodsName="{scope}">
+        <span>{{ scope.row.goodsName }}</span>
+      </template>
 
-			<template #table-column-inTurn="{scope}">
-				<span v-if="!sort.status">{{ scope.row.inTurn }}</span>
+      <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>
+      </template>
 
-				<el-input
-					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>
 
-			<!-- 排序 -->
-			<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 class="hide" v-else size="mini" @click="hideSort" 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>
-		</x-crud>
+          <el-button
+            class="hide"
+            v-else
+            size="mini"
+            @click="hideSort"
+            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>
+    </x-crud>
 
-		<item-list-layer
-			:show.sync="showItemModal"
-			@confirm="selGoodsConfirmFn"
-			@cancel="showItemModal = false"
-		></item-list-layer>
+    <item-list-layer
+      :show.sync="showItemModal"
+      @confirm="selGoodsConfirmFn"
+      @cancel="showItemModal = false"
+    ></item-list-layer>
 
-	</div>
+  </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,
-			sortLink: '',
-			operateData: {},
-			tabIndex: '0',
-			tabsData: [
-				{
-					text: '花材列表',
-					key: '0'
-				}
-			],
-			selects: {},
-			sort: {
-				status: false
-			},
-			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 });
-		},
-		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
-				}
-                let getItem = () => {
-                    return this.$service.item.list({classId:this.classId})
-                };
-                ctx.service({
-                    page: getItem
-                })
-				.set('table', {
-					columns: [
-						{
-							prop: 'id',
-							label: 'ID',
-							align: 'center'
-						},
-						{
-							prop: 'itemName',
-							label: '名称',
-							align: 'center',
-							'min-width': 180
-						},
-						{
-							prop: 'stockWarning',
-							label: '库存预警',
-							align: 'center',
-							'min-width': 100
-						},
-						{
-							prop: 'cost',
-							label: '成本价',
-							align: 'center',
-							'min-width': 100
-						},
-						{
-							prop: 'addPrice',
-							label: '加价',
-							align: 'center',
-							'min-width': 100
-						},
-						{
-							prop: 'inTurn',
-							label: '排序',
-							align: 'center',
-							minWidth: 100
-						},
-						{
-							prop: 'addTime',
-							label: '创建时间',
-							align: 'center',
-							minWidth: 180
-						}
-					],
-					op: {
-						visible: true,
-						props: {
-							width: 300,
-							align: 'center',
-							fixed: 'right',
-							label: '操作'
-						},
-						layout: []
-					}
-				})
-				.set('dict', {
-					search: {
-						keyWord: 'goodsName'
-					}
-				})
-				.set('search', {
-					key: {
-						placeholder: '分类名称'
-					}
-				})
-				.set('layout', [
-					['slot-tabs'],
-					['flex1', 'slot-add-goods-btn', 'refresh-btn'],
-					['data-table'],
-					['flex1', 'pagination']
-				])
-				.done();
-			app.refresh({ classId: this.classId });
-		},
+  name: 'item_list',
+  components: {
+    itemListLayer
+  },
+  data () {
+    return {
+      app: null,
+      sortLink: '',
+      operateData: {},
+      tabIndex: '0',
+      tabsData: [
+        {
+          text: '花材列表',
+          key: '0'
+        }
+      ],
+      selects: {},
+      sort: {
+        status: false
+      },
+      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 });
+    },
+    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
+      }
+      let getItem = () => {
+        return this.$service.item.list({ classId: this.classId })
+      };
+      ctx.service({
+        page: getItem
+      })
+        .set('table', {
+          columns: [
+            {
+              prop: 'id',
+              label: 'ID',
+              align: 'center'
+            },
+            {
+              prop: 'itemName',
+              label: '名称',
+              align: 'center',
+              'min-width': 180
+            },
+            {
+              prop: 'stockWarning',
+              label: '库存预警',
+              align: 'center',
+              'min-width': 100
+            },
+            {
+              prop: 'cost',
+              label: '成本价',
+              align: 'center',
+              'min-width': 100
+            },
+            {
+              prop: 'addPrice',
+              label: '加价',
+              align: 'center',
+              'min-width': 100
+            },
+            {
+              prop: 'inTurn',
+              label: '排序',
+              align: 'center',
+              minWidth: 100
+            },
+            {
+              prop: 'addTime',
+              label: '创建时间',
+              align: 'center',
+              minWidth: 180
+            }
+          ],
+          op: {
+            visible: true,
+            props: {
+              width: 300,
+              align: 'center',
+              fixed: 'right',
+              label: '操作'
+            },
+            layout: []
+          }
+        })
+        .set('dict', {
+          search: {
+            keyWord: 'goodsName'
+          }
+        })
+        .set('search', {
+          key: {
+            placeholder: '分类名称'
+          }
+        })
+        .set('layout', [
+          ['slot-tabs'],
+          ['flex1', 'slot-add-goods-btn', 'refresh-btn'],
+          ['data-table'],
+          ['flex1', 'pagination']
+        ])
+        .done();
+      app.refresh({ classId: this.classId });
+    },
 
-		refresh(params) {
-			this.app.refresh(params);
-		},
+    refresh (params) {
+      this.app.refresh(params);
+    },
 
-		showSort(e) {
-			this.sort.status = true;
-		},
+    showSort (e) {
+      this.sort.status = true;
+    },
 
-		hideSort(e) {
-			this.sort.status = false;
-		},
+    hideSort (e) {
+      this.sort.status = false;
+    },
 
-		changeSort(d) {
-			this.$service.goods
-				.sort({
-					inTurn: d.inTurn,
-					id: d.id
-				})
-				.then(() => {
-					this.$message.success('修改成功');
-					this.refresh();
-				})
-				.catch(err => {
-					this.$message.error(err);
-				});
-		}
-	}
+    changeSort (d) {
+      this.$service.goods
+        .sort({
+          inTurn: d.inTurn,
+          id: d.id
+        })
+        .then(() => {
+          this.$message.success('修改成功');
+          this.refresh();
+        })
+        .catch(err => {
+          this.$message.error(err);
+        });
+    }
+  }
 };
 </script>
 
 <style lang="scss" scoped>
 .short-link {
-	color: $mainColor;
-	margin-left: 10px;
-	cursor: pointer;
+  color: $mainColor;
+  margin-left: 10px;
+  cursor: pointer;
 }
 .set-sort {
-	display: flex;
-	align-items: center;
-	justify-content: center;
-	.el-button {
-		margin-left: 10px;
-	}
-	.show {
-		font-size: 16px;
-	}
-	.hide {
-		padding: 2px 5px;
-	}
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  .el-button {
+    margin-left: 10px;
+  }
+  .show {
+    font-size: 16px;
+  }
+  .hide {
+    padding: 2px 5px;
+  }
 }
 </style>

+ 1 - 1
ghs/src/views/order/add.vue

@@ -317,4 +317,4 @@
 		padding: 30px 30px 60px 30px;
 		color: $fontColor3;
 	}
-</style>
+</style>