Ver Fonte

库存管理

YY há 3 anos atrás
pai
commit
7de9da868c

+ 23 - 14
src/views/menu/stock/index.vue

@@ -3,10 +3,10 @@
     <el-row>
       <el-col :span="24" class="main animate__animated animate__backInRight">
         <el-col class="one">
-          <el-button type="primary" size="mini" @click="toAdd()">添加库存商品</el-button>
-        </el-col>
-        <el-col class="two">
-          <data-table :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @view="toView" @edit="toEdit" @reset="toReset" @del="toDel">
+          <data-table :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @view="toView" @edit="toEdit">
+            <template #selfbtn>
+              <el-button type="primary" size="mini" @click="toAdd()">添加库存商品</el-button>
+            </template>
           </data-table>
         </el-col>
       </el-col>
@@ -14,7 +14,7 @@
     <e-dialog :dialog="dialog" @toClose="toClose">
       <template slot="info">
         <detail-1 v-if="dialog.type == '1'" :form="form" @onSubmit="onSubmit"></detail-1>
-        <info-1 :form="info" v-else></info-1>
+        <info-1 :form="form" v-if="dialog.type == '2'"></info-1>
       </template>
     </e-dialog>
   </div>
@@ -33,27 +33,34 @@ export default {
     return {
       // 数据项
       fields: [
-        { label: '名称', prop: 'name' },
-        { label: '商品类型', prop: 'type_name' },
+        { label: '名称', prop: 'name', filter: true },
+        { label: '商品类型', prop: 'type_name', filter: true },
         { label: '库存数量', prop: 'num' },
         { label: '商品单价', prop: 'money' },
       ],
       total: 0,
       opera: [
-        { label: '详细信息', method: 'view' },
-        { label: '信息变更', method: 'edit' },
+        { label: '详', method: 'view' },
+        { label: '修改', method: 'edit' },
       ],
       // 列表
       list: [
-        { id: '1111', name: '手抓饼', type_name: '食品', num: '11111', money: '6', stock_type: '固定资产', brief: '十块钱俩' },
+        {
+          id: '1111',
+          name: '手抓饼',
+          type_name: '食品',
+          num: '11111',
+          money: '6',
+          stock_type: '固定资产',
+          brief: '十块钱俩',
+          img_url: [{ url: require('@a/logo.png') }, { url: require('@a/login-1.jpg') }, { url: require('@a/logo.png') }, { url: require('@a/login-1.jpg') }],
+        },
         { id: '1112', name: '烤冷面', type_name: '食品', num: '11111', money: '5', stock_type: '商品', brief: '十块钱也俩' },
       ],
       // 弹框
       dialog: { title: '信息管理', show: false, type: '1' },
       // 添加表单
-      form: {},
-      //详情
-      info: {},
+      form: { img_url: [] },
     };
   },
   created() {},
@@ -69,7 +76,7 @@ export default {
     },
     // 详细信息
     toView({ data }) {
-      this.$set(this, `info`, data);
+      this.$set(this, `form`, data);
       this.dialog = { title: '详细信息', show: true, type: '2', widths: '40%' };
     },
     // 信息变更
@@ -83,7 +90,9 @@ export default {
     toDel() {},
     // 关闭弹框
     toClose() {
+      this.form = { img_url: [] };
       this.dialog = { show: false };
+      this.search();
     },
   },
   computed: {

+ 1 - 1
src/views/menu/stock/parts/detail-1.vue

@@ -5,7 +5,7 @@
         <data-form :fields="fields" :data="form" :rules="rules" @save="toSave">
           <template #custom="{ item }">
             <template v-if="item.model === 'img_url'">
-              <s-upload :limit="1" :data="form.img_url" type="img_url" listType="picture" url="/files/live/upload" @upload="uplSuc" @delete="uplDel"></s-upload>
+              <s-upload :limit="1" :data="form.img_url" type="img_url" url="/files/live/upload" @upload="uplSuc" @delete="uplDel"></s-upload>
             </template>
           </template>
         </data-form>

+ 16 - 4
src/views/menu/stock/parts/info-1.vue

@@ -2,7 +2,13 @@
   <div id="info-1">
     <el-row>
       <el-col :span="24" class="main">
-        <data-form :fields="fields" :data="form" :rules="rules" :needSave="false"> </data-form>
+        <data-form :fields="fields" :data="form" :rules="{}" :needSave="false">
+          <template #custom="{ item }">
+            <template v-if="item.model === 'img_url'">
+              <el-image class="img" v-for="(item, index) in form.img_url" :key="index" :src="item.url"></el-image>
+            </template>
+          </template>
+        </data-form>
       </el-col>
     </el-row>
   </div>
@@ -19,14 +25,14 @@ export default {
   data: function () {
     return {
       fields: [
+        { label: '商品图片', model: 'img_url', readonly: true, custom: true },
         { label: '商品类型', model: 'stock_type', readonly: true },
         { label: '商品类型', model: 'type_name', readonly: true },
         { label: '商品名称', model: 'name', readonly: true },
         { label: '商品数量', model: 'num', readonly: true },
         { label: '商品单价(元)', model: 'money', readonly: true },
-        { label: '商品简介', model: 'brief', readonly: true },
+        { label: '商品简介', model: 'brief', readonly: true, type: 'textarea' },
       ],
-      rules: {},
     };
   },
   created() {},
@@ -47,4 +53,10 @@ export default {
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+.img {
+  width: 150px;
+  height: 150px;
+  overflow: hidden;
+}
+</style>