Parcourir la source

基础资料-供应商管理

chenrui il y a 4 ans
Parent
commit
51283ac84a

+ 60 - 1
src/config/router.config.js

@@ -120,7 +120,7 @@ export const asyncRouterMap = [{
             }
           },
           {
-            path: '/inventoryManagement/inventoryQuery/warehouseDetail',
+            path: '/inventoryManagement/inventoryQuery/warehouseDetail/:id',
             name: 'inventoryQueryWarehouseDetail',
             component: () => import(/* webpackChunkName: "shop" */ '@/views/inventoryManagement/inventoryQuery/warehouseDetail.vue'),
             meta: {
@@ -148,6 +148,65 @@ export const asyncRouterMap = [{
   // 散件管理
   // 产品管理
   // 基础资料
+  {
+    path: '/basicData',
+    redirect: '/basicData/supplierManagement',
+    component: PageView,
+    meta: {
+      title: '基础资料',
+      icon: 'shop'
+      // permission: 'M_shop'
+    },
+    children: [
+      {
+        path: '/basicData/supplierManagement',
+        redirect: '/basicData/supplierManagement/list',
+        name: 'supplierManagement',
+        component: RouteView,
+        meta: {
+          title: '供应商管理',
+          icon: 'shopping'
+          // permission: 'M_goodsManage_list'
+        },
+        hideChildrenInMenu: true,
+        children: [
+          {
+            path: '/basicData/supplierManagement/list',
+            name: 'supplierManagementList',
+            component: () => import(/* webpackChunkName: "shop" */ '@/views/basicData/supplierManagement/list.vue'),
+            meta: {
+              title: '供应商列表',
+              icon: 'shopping',
+              hidden: true
+              // permission: 'M_goodsManage_list'
+            }
+          },
+          {
+            path: '/basicData/supplierManagement/add',
+            name: 'supplierManagementAdd',
+            component: () => import(/* webpackChunkName: "shop" */ '@/views/basicData/supplierManagement/edit.vue'),
+            meta: {
+              title: '新增供应商',
+              icon: 'shopping',
+              hidden: true
+              // permission: 'B_goodsManage_edit'
+            }
+          },
+          {
+            path: '/basicData/supplierManagement/edit/:id',
+            name: 'supplierManagementEdit',
+            component: () => import(/* webpackChunkName: "shop" */ '@/views/basicData/supplierManagement/edit.vue'),
+            meta: {
+              title: '编辑供应商',
+              icon: 'shopping',
+              hidden: true
+              // permission: 'B_goodsManage_edit'
+            }
+          }
+        ]
+      }
+    ]
+  },
   // 财务管理
   // auth
   {

+ 241 - 0
src/views/basicData/supplierManagement/edit.vue

@@ -0,0 +1,241 @@
+<template>
+  <a-card :bordered="false" class="supplierManagementEdit-table-page-wrapper">
+    <!-- <a-form
+      id="supplierManagementEdit-form"
+      :form="form"
+      ref="form"
+      v-bind="formItemLayout"
+      @submit="handleSubmit"> -->
+    <a-form-model
+      id="supplierManagementEdit-form"
+      ref="ruleForm"
+      :model="form"
+      :layout="formItemLayout"
+      :rules="rules"
+      :label-col="formItemLayout.labelCol"
+      :wrapper-col="formItemLayout.wrapperCol"
+    >
+      <a-form-model-item label="供应商名称" prop="name">
+        <a-input
+          id="supplierManagementEdit-name"
+          :maxLength="30"
+          v-model="form.name"
+          placeholder="请输入供应商名称(最多30个字符)"
+          allowClear />
+      </a-form-model-item>
+      <!-- <a-form-model-item label="商品分类" prop="peopleLimitCount">
+        <a-select
+          id="supplierManagementEdit-goodsTypeNo"
+          allowClear
+          v-decorator="[
+            'form.goodsTypeNo',
+            { initialValue: form.goodsTypeNo,
+              rules: [{ required: true, message: '请选择商品分类' }] },
+          ]"
+          placeholder="请选择商品分类">
+          <a-select-option v-for="(item,index) in goodsTypeList" :key="index" :value="item.goodsTypeNo" :disabled="item.state==0">{{ item.name }}</a-select-option>
+        </a-select>
+      </a-form-model-item>
+      <a-form-model-item label="商品价格" prop="peopleLimitCount">
+        <a-input-number
+          id="supplierManagementEdit-sellGold"
+          class="inpNumber-unit"
+          :min="0"
+          :max="999999"
+          :precision="0"
+          v-decorator="[ 'form.sellGold', { initialValue: form.sellGold, rules: [{ required: true, message: '请输入商品价格(0~999999)' }] } ]"
+          placeholder="请输入商品价格(0~999999)。10个乐豆等值于1元"
+          allowClear />
+        <span class="inp-unit">乐豆</span>
+      </a-form-model-item>
+      <a-form-model-item label="商品状态" prop="peopleLimitCount" v-if="!isEdit">
+        <v-select
+          ref="state"
+          code="GOODS_STATE"
+          allowClear
+          id="supplierManagementEdit-state"
+          placeholder="请选择商品状态"
+          v-decorator="['form.state', { initialValue: form.state, rules: [
+            { required: true, message: '请选择商品状态' },
+            { validator: stateValidator }
+          ] }]"
+        ></v-select>
+      </a-form-model-item>
+      <a-form-model-item label="库存数量" prop="peopleLimitCount">
+        <a-input-number
+          id="supplierManagementEdit-inventoryQty"
+          class="inpNumber"
+          :min="0"
+          :max="999999"
+          :precision="0"
+          v-decorator="['form.inventoryQty', { initialValue: form.inventoryQty, rules: [
+            { required: true, message: '请输入库存数量' },
+            { validator: inventoryQtyValidator }
+          ] }]"
+          placeholder="请输入库存数量(0~999999)。当库存数量为0时显示为已售罄且无法下单"
+          allowClear />
+      </a-form-model-item>
+      <a-form-model-item label="供货商" prop="peopleLimitCount">
+        <a-select
+          id="supplierManagementEdit-officialPartnerNo"
+          allowClear
+          :disabled="isEdit"
+          v-decorator="[
+            'form.officialPartnerNo',
+            { initialValue: form.officialPartnerNo,
+              rules: [{ required: true, message: '请选择供货商' }] },
+          ]"
+          placeholder="请选择供货商">
+          <a-select-option v-for="(item,index) in partnerList" :key="index" :value="item.officialPartnerNo" :disabled="item.state==0">{{ item.name }}</a-select-option>
+        </a-select>
+      </a-form-model-item>
+      <a-form-model-item label="商品详情" prop="peopleLimitCount">
+        <editor id="supplierManagementEdit-editor" ref="editor" class="supplierManagementEdit-editor" @on-change="editorChange" :cache="false"></editor>
+      </a-form-model-item>
+      <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;">
+        <a-button type="primary" html-type="submit" id="supplierManagementEdit-btn-submit" style="margin-right: 15px">保存</a-button>
+        <a-button @click="close" style="margin-left: 15px" id="supplierManagementEdit-btn-close">取消</a-button>
+      </a-form-model-item> -->
+    </a-form-model>
+  </a-card>
+</template>
+
+<script>
+import { STable, VSelect } from '@/components'
+// import { goodsSave, goodsFind } from '@/api/goods'
+export default {
+  name: 'supplierManagementEdit',
+  components: { STable, VSelect },
+  data () {
+    return {
+      formItemLayout: {
+        labelCol: { span: 4 },
+        wrapperCol: { span: 16 }
+      },
+      form: {
+        homeImage: '', //  首页图
+        images: '', //  商品图
+        name: '', // 商品名称
+        goodsTypeNo: undefined, // 商品分类
+        sellGold: '', //  商品价格
+        state: '', //  商品状态
+        inventoryQty: '', // 库存数量
+        officialPartnerNo: undefined, //  供货商
+        desc: null //  商品详情
+      },
+      rules: {
+        name: [
+          { required: true, message: '请输入供应商名称', trigger: 'blur' }
+        ]
+      },
+      goodsTypeList: [], //  商品分类下拉数据
+      partnerList: [] //  供应商下拉数据
+    }
+  },
+  computed: {
+    isEdit () {
+      return this.$route.name === 'supplierManagementEdit'
+    }
+  },
+  methods: {
+    //  商品状态自定义校验
+    stateValidator (rule, value, callback) {
+      if (value == 1 && String(this.form.getFieldValue('form.inventoryQty')) && this.form.getFieldValue('form.inventoryQty') == 0) {
+        callback(new Error('库存为0的商品不能上架'))
+      } else {
+        callback()
+      }
+    },
+    //  输入库存数量调起商品状态校验
+    inventoryQtyValidator (rule, value, callback) {
+      this.form.validateFields(['form.state'], (errors, values) => {
+        if (!errors) {
+          callback()
+        }
+      })
+    },
+    //  获取商品详情
+    getGoodsDetail () {
+      goodsFind({ id: this.$route.params.id }).then(res => {
+        if (res.status == 200) {
+          this.form = Object.assign(this.form, res.data)
+          this.$refs.homeImage.setFileList(res.data.homeImage)
+          this.$refs.goodsImage.setFileList(res.data.images)
+          this.$refs.editor.setHtml(this.form.desc)
+        }
+      })
+    },
+    //  商品分类下拉数据
+    getGoodsType () {
+      goodsTypeQueryList({}).then(res => {
+        if (res.status == 200) {
+          this.goodsTypeList = res.data
+        } else {
+          this.goodsTypeList = []
+        }
+      })
+    },
+    //  供应商下拉数据
+    getPartnerQueryList () {
+      supplierQueryList({}).then(res => {
+        if (res.status == 200) {
+          this.partnerList = res.data
+        } else {
+          this.partnerList = []
+        }
+      })
+    },
+    //  保存
+    handleSubmit (e) {
+      e.preventDefault()
+      const _this = this
+      this.form.validateFields((err, values) => {
+        if (!err) {
+          const form = values.form
+          form.desc = _this.form.desc
+          form.id = this.isEdit ? this.$route.params.id : null
+          goodsSave(form).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              setTimeout(() => {
+                _this.$router.push({ path: '/shop/goods/list' })
+              }, 1000)
+            }
+          })
+        }
+      })
+    },
+    //  取消
+    close () {
+      this.$router.push({ path: '/shop/goods/list' })
+    },
+    //  商品图上传
+    changeImage (file) {
+      this.form.images = file
+    },
+    //  首页图上传
+    changeHomeImage (file) {
+      this.form.homeImage = file
+    },
+    //  商品详情  文本编辑器
+    editorChange (html, text) {
+      this.form.desc = html
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      // vm.getGoodsType()
+      // vm.getPartnerQueryList()
+      if (vm.isEdit) { //  编辑页
+        vm.getGoodsDetail()
+      }
+    })
+  }
+}
+</script>
+
+<style lang="less">
+  .supplierManagementEdit-table-page-wrapper{
+    
+  }
+</style>

+ 195 - 0
src/views/basicData/supplierManagement/list.vue

@@ -0,0 +1,195 @@
+<template>
+  <a-card :bordered="false" class="supplierManagementList-wrap">
+    <!-- 搜索条件 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+        <a-row :gutter="48">
+          <a-col :lg="6" :sm="12">
+            <a-form-item label="供应商名称">
+              <a-input id="supplierManagementList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入供应商名称"/>
+            </a-form-item>
+          </a-col>
+          <a-col :lg="6" :sm="12">
+            <a-form-item label="状态">
+              <a-select id="supplierManagementList-bundleNames" placeholder="请选择" allowClear v-model="queryParam.brand">
+                <a-select-option v-for="item in brandData" :key="item.stationNo" :value="item.stationNo">{{ item.name }}</a-select-option>
+              </a-select>
+            </a-form-item>
+          </a-col>
+          <a-col :lg="6" :sm="12">
+            <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="supplierManagementList-refresh">查询</a-button>
+            <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="supplierManagementList-reset">重置</a-button>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+    <!-- 操作按钮 -->
+    <div class="table-operator">
+      <a-button id="supplierManagementList-add" type="primary" @click="handleAdd" style="margin-top: 18px;">新增供应商</a-button>
+    </div>
+    <!-- 列表 -->
+    <s-table
+      class="sTable"
+      ref="table"
+      size="default"
+      :rowKey="(record) => record.id"
+      :columns="columns"
+      :data="loadData"
+      bordered>
+      <!-- 状态 -->
+      <template slot="state" slot-scope="text, record">
+        <span>{{record.state == 1 ? '已启用' : '已禁用'}}</span>
+      </template>
+      <!-- 操作 -->
+      <template slot="action" slot-scope="text, record">
+        <a-button type="primary" @click="handleEdit(record)" id="supplierManagementList-edit-btn">编辑</a-button>
+      </template>
+    </s-table>
+  </a-card>
+</template>
+
+<script>
+import moment from 'moment'
+// import { customerBundleDelayList, customerBundleExportDelay } from '@/api/FinancialManagement'
+import { STable } from '@/components'
+export default {
+  components: { STable },
+  data () {
+    return {
+      labelCol: { span: 10 },
+      wrapperCol: { span: 14 },
+      queryParam: { //  查询条件
+        orderBundleNo: '', //  订单编号
+        bundleName: '', //  套餐名称
+        itemName: '', //  服务名称
+        brand: undefined,  //  产品品牌
+      },
+      exportLoading: false, // 导出loading
+      disabled: false, //  查询、重置按钮是否可操作
+      brandData: [],  //  产品品牌下拉数据
+      typeData: [],  //  产品类别下拉数据
+      columns: [
+        { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
+        { title: '供应商名称', dataIndex: 'productName', width: 200, align: 'center', ellipsis: true },
+        { title: '地址', dataIndex: 'productOldNum', width: 160, align: 'center', ellipsis: true },
+        { title: '联系人', dataIndex: 'productBrand', width: 200, align: 'center' },
+        { title: '联系电话', dataIndex: 'productType', width: 200, align: 'center' },
+        { title: '主营内容', dataIndex: 'inventoryNum', width: 180, align: 'center', ellipsis: true },
+        { title: '创建时间', dataIndex: 'inventoryMoney', width: 180, align: 'center' },
+        { title: '状态', scopedSlots: { customRender: 'state' }, width: 180, align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 240, align: 'center' }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
+        //   const data = res.data
+        //   const no = (data.pageNo - 1) * data.pageSize
+        //   for (var i = 0; i < data.list.length; i++) {
+        //     data.list[i].no = no + i + 1
+        //   }
+        //   this.disabled = false
+        //   return data
+        // })
+        const _this = this
+        return new Promise(function(resolve, reject){
+          const data = {
+            pageNo: 1,
+            pageSize: 10,
+            list: [
+              { id: '1', productNum: 'jgqp11111111111', productName: '产品1', productOldNum: 'jgqp111123545', productBrand: '箭冠品牌', productType: '产品分类1', inventoryNum: '5', inventoryMoney: '122' }
+            ]
+          }
+          const no = (data.pageNo - 1) * data.pageSize
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+          }
+          _this.disabled = false
+          resolve(data)
+        })
+      },
+      openModal: false,  //  查看库存详情  弹框
+      itemId: ''  //  当前库存记录id
+    }
+  },
+  methods: {
+    //  重置
+    resetSearchForm () {
+      this.queryParam.orderBundleNo = ''
+      this.queryParam.orderBundle.custMobile = ''
+      this.queryParam.bundleName = ''
+      this.queryParam.itemName = ''
+      this.oldTime = undefined
+      this.newTime = undefined
+      this.$refs.table.refresh(true)
+    },
+    //  新增
+    handleAdd(){
+      this.$router.push({ path: '/basicData/supplierManagement/add' })
+    },
+    //  编辑
+    handleEdit(row){
+      this.$router.push({ path: `/basicData/supplierManagement/edit/${row.id}` })
+    },
+    //  库存详情
+    goDetail(row){
+      this.itemId = row.id
+      this.openModal = true
+    },
+    //  关闭弹框
+    closeModal(){
+      this.itemId = ''
+      this.openModal = false
+    },
+    //  出入库明细
+    goWarehouseDetail(row){
+      this.$router.push({ path: '/inventoryManagement/inventoryQuery/warehouseDetail' })
+    },
+    //  导出
+    handleExport () {
+      const params = this.queryParam
+      if (this.oldTime && this.oldTime.length > 0) {
+        params.beginOldExpiryDate = moment(this.oldTime[0]).format('YYYY-MM-DD')
+        params.endOldExpirydDate = moment(this.oldTime[1]).format('YYYY-MM-DD')
+      } else {
+        params.beginOldExpiryDate = ''
+        params.endOldExpirydDate = ''
+      }
+      if (this.newTime && this.newTime.length > 0) {
+        params.beginDate = moment(this.newTime[0]).format('YYYY-MM-DD')
+        params.endDate = moment(this.newTime[1]).format('YYYY-MM-DD')
+      } else {
+        params.beginDate = ''
+        params.endDate = ''
+      }
+      this.exportLoading = true
+      customerBundleExportDelay(params).then(res => {
+        this.exportLoading = false
+        this.download(res)
+      })
+    },
+    download (data) {
+      if (!data) { return }
+      const url = window.URL.createObjectURL(new Blob([data]))
+      const link = document.createElement('a')
+      link.style.display = 'none'
+      link.href = url
+      const a = moment().format('YYYYMMDDHHmmss')
+      const fname = '库存查询' + a
+      link.setAttribute('download', fname + '.xlsx')
+      document.body.appendChild(link)
+      link.click()
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .supplierManagementList-wrap{
+    .sTable{
+      table{
+        width: auto;
+      }
+    }
+  }
+</style>

+ 16 - 8
src/views/inventoryManagement/inventoryQuery/detailModal.vue

@@ -7,7 +7,7 @@
     :title="modalTit"
     v-model="isShow"
     @cancle="isShow=false"
-    :width="1000">
+    width="80%">
     <!-- 库存详情 -->
     <s-table
       class="sTable"
@@ -46,15 +46,15 @@ export default {
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
-        { title: '产品编码', dataIndex: 'productNum', width: 160, align: 'center' },
+        { title: '产品编码', dataIndex: 'productNum', width: 170, align: 'center' },
         { title: '产品名称', dataIndex: 'productName', width: 200, align: 'center', ellipsis: true },
-        { title: '原厂编码', dataIndex: 'productOldNum', width: 160, align: 'center' },
+        { title: '原厂编码', dataIndex: 'productOldNum', width: 170, align: 'center' },
         { title: '入库时间', dataIndex: 'productBrand', width: 200, align: 'center' },
         { title: '仓库', dataIndex: 'productType', width: 200, align: 'center' },
-        { title: '仓位', dataIndex: 'productType', width: 200, align: 'center' },
-        { title: '入库类型', dataIndex: 'productType', width: 200, align: 'center' },
-        { title: '库存数量', dataIndex: 'inventoryNum', width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '成本单价', dataIndex: 'inventoryMoney', width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '仓位', dataIndex: 'productTypes', width: 200, align: 'center' },
+        { title: '入库类型', dataIndex: 'productTypess', width: 200, align: 'center' },
+        { title: '库存数量', dataIndex: 'inventoryNum', width: 150, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '成本单价', dataIndex: 'inventoryMoney', width: 150, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -113,4 +113,12 @@ export default {
 }
 </script>
 
-<style lang="less"></style>
+<style lang="less">
+  .inventoryQueryDetail-modal{
+    .sTable{
+      table{
+        width: auto;
+      }
+    }
+  }
+</style>

+ 14 - 5
src/views/inventoryManagement/inventoryQuery/list.vue

@@ -50,6 +50,7 @@
     </a-alert>
     <!-- 列表 -->
     <s-table
+      class="sTable"
       ref="table"
       size="default"
       :rowKey="(record) => record.id"
@@ -57,10 +58,10 @@
       :data="loadData"
       bordered>
       <!-- 操作 -->
-      <span slot="action" slot-scope="text, record">
+      <template slot="action" slot-scope="text, record">
         <a-button type="primary" @click="goDetail(record)" id="inventoryQueryList-detail-btn">库存详情</a-button>
         <a-button style="margin-left: 8px" @click="goWarehouseDetail(record)" id="inventoryQueryList-warehouseDetail-btn">出入库明细</a-button>
-      </span>
+      </template>
     </s-table>
     <!-- 库存详情 -->
     <inventory-query-detail-modal :openModal="openModal" :itemId="itemId" @close="closeModal" />
@@ -159,7 +160,7 @@ export default {
     },
     //  出入库明细
     goWarehouseDetail(row){
-      this.$router.push({ path: '/inventoryManagement/inventoryQuery/warehouseDetail' })
+      this.$router.push({ path: `/inventoryManagement/inventoryQuery/warehouseDetail/${row.id}` })
     },
     //  导出
     handleExport () {
@@ -191,7 +192,7 @@ export default {
       link.style.display = 'none'
       link.href = url
       const a = moment().format('YYYYMMDDHHmmss')
-      const fname = '服务延期记录' + a
+      const fname = '库存查询' + a
       link.setAttribute('download', fname + '.xlsx')
       document.body.appendChild(link)
       link.click()
@@ -200,4 +201,12 @@ export default {
 }
 </script>
 
-<style lang="less"></style>
+<style lang="less">
+  .inventoryQueryList-wrap{
+    .sTable{
+      table{
+        width: auto;
+      }
+    }
+  }
+</style>

+ 6 - 0
src/views/inventoryManagement/inventoryQuery/warehouseDetail.vue

@@ -55,6 +55,7 @@
     </a-alert>
     <!-- 列表 -->
     <s-table
+      class="sTable"
       ref="table"
       size="default"
       :rowKey="(record) => record.id"
@@ -166,6 +167,11 @@ export default {
 
 <style lang="less">
   .inventoryQueryWarehouseDetail-wrap{
+    .sTable{
+      table{
+        width: auto;
+      }
+    }
     .footer-box{
       margin: 50px auto 20px;
       text-align: center;

+ 126 - 48
src/views/inventoryManagement/inventoryWarning/list.vue

@@ -1,27 +1,27 @@
 <template>
-  <a-card :bordered="false" class="inventoryQueryList-wrap">
+  <a-card :bordered="false" class="inventoryWarningList-wrap">
     <!-- 搜索条件 -->
     <div class="table-page-search-wrapper">
       <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
         <a-row :gutter="48">
           <a-col :lg="6" :sm="12">
             <a-form-item label="产品编码">
-              <a-input id="inventoryQueryList-orderBundleNo" v-model.trim="queryParam.orderBundleNo" allowClear placeholder="请输入产品编码"/>
+              <a-input id="inventoryWarningList-orderBundleNo" v-model.trim="queryParam.orderBundleNo" allowClear placeholder="请输入产品编码"/>
             </a-form-item>
           </a-col>
           <a-col :lg="6" :sm="12">
             <a-form-item label="原厂编码">
-              <a-input id="inventoryQueryList-custMobile" v-model.trim="queryParam.orderBundle.custMobile" allowClear placeholder="请输入原厂编码"/>
+              <a-input id="inventoryWarningList-custMobile" v-model.trim="queryParam.orderBundle.custMobile" allowClear placeholder="请输入原厂编码"/>
             </a-form-item>
           </a-col>
           <a-col :lg="6" :sm="12">
             <a-form-item label="产品名称">
-              <a-input id="inventoryQueryList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入产品名称"/>
+              <a-input id="inventoryWarningList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入产品名称"/>
             </a-form-item>
           </a-col>
           <a-col :lg="6" :sm="12">
             <a-form-item label="产品品牌">
-              <a-select id="inventoryQueryList-bundleNames" placeholder="请选择产品品牌" allowClear v-model="queryParam.brand">
+              <a-select id="inventoryWarningList-bundleNames" placeholder="请选择产品品牌" allowClear v-model="queryParam.brand">
                 <a-select-option v-for="item in brandData" :key="item.stationNo" :value="item.stationNo">{{ item.name }}</a-select-option>
               </a-select>
             </a-form-item>
@@ -32,35 +32,65 @@
             </a-form-item>
           </a-col>
           <a-col :lg="6" :sm="12">
-            <a-form-item label="库存数量是否为0">
-              <a-switch checkedChildren="是" unCheckedChildren="否" id="inventoryQueryList-bundleNamess" v-model="queryParam.inventoryNum" />
+            <a-form-item label="预警提示">
+              <a-select id="inventoryWarningList-bundleNames" placeholder="请选择预警提示" allowClear v-model="queryParam.brand">
+                <a-select-option v-for="item in brandData" :key="item.stationNo" :value="item.stationNo">{{ item.name }}</a-select-option>
+              </a-select>
             </a-form-item>
           </a-col>
           <a-col :lg="6" :sm="12">
-            <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="inventoryQueryList-refresh">查询</a-button>
-            <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="inventoryQueryList-reset">重置</a-button>
-            <a-button style="margin-left: 8px" type="danger" @click="handleExport" :disabled="disabled" :loading="exportLoading" id="inventoryQueryList-export">导出</a-button>
+            <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="inventoryWarningList-refresh">查询</a-button>
+            <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="inventoryWarningList-reset">重置</a-button>
+            <a-button style="margin-left: 8px" type="danger" @click="handleExport" :disabled="disabled" :loading="exportLoading" id="inventoryWarningList-export">导出</a-button>
           </a-col>
         </a-row>
       </a-form>
     </div>
-    <!-- 合计 -->
-    <a-alert type="info" showIcon style="margin-bottom:15px">
-      <div class="ftext" slot="message">现有库存总数量(个):<strong>998</strong>;现有库存总成本(¥):<strong>2009.00</strong>。</div>
-    </a-alert>
+    <!-- 操作按钮 -->
+    <div class="table-operator">
+      <a-button id="inventoryWarningList-update" type="primary" @click="handleupdate" style="margin-top: 18px;">批量更新</a-button>
+    </div>
     <!-- 列表 -->
     <s-table
+      class="sTable"
       ref="table"
       size="default"
       :rowKey="(record) => record.id"
       :columns="columns"
       :data="loadData"
       bordered>
+      <!-- 需要编辑的字段 -->
+      <template
+        v-for="col in ['onWayNum', 'maxInventory', 'minInventory']"
+        :slot="col"
+        slot-scope="text, record, index"
+      >
+        <div :key="col">
+          <a-input
+            v-if="record.editable"
+            style="margin: -5px 0"
+            :value="text"
+            @change="e => handleChange(e.target.value, record.key, col)"
+          />
+          <template v-else>
+            {{ text }}
+          </template>
+        </div>
+      </template>
       <!-- 操作 -->
-      <span slot="action" slot-scope="text, record">
-        <a-button type="primary" @click="goDetail(record)" id="inventoryQueryList-detail-btn">库存详情</a-button>
-        <a-button style="margin-left: 8px" @click="goWarehouseDetail(record)" id="inventoryQueryList-warehouseDetail-btn">出入库明细</a-button>
-      </span>
+      <template slot="action" slot-scope="text, record">
+        <div class="editable-row-operations">
+          <span v-if="record.editable">
+            <a @click="() => save(record.key)">保存</a>
+            <a-popconfirm title="Sure to cancel?" @confirm="() => cancel(record.key)">
+              <a>取消</a>
+            </a-popconfirm>
+          </span>
+          <span v-else>
+            <a :disabled="editingKey !== ''" @click="() => edit(record.key)">编辑</a>
+          </span>
+        </div>
+      </template>
     </s-table>
   </a-card>
 </template>
@@ -93,11 +123,17 @@ export default {
         { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
         { title: '产品编码', dataIndex: 'productNum', width: 160, align: 'center' },
         { title: '产品名称', dataIndex: 'productName', width: 200, align: 'center', ellipsis: true },
+        { title: '级别', dataIndex: 'productNasme', width: 100, align: 'center' },
         { title: '原厂编码', dataIndex: 'productOldNum', width: 160, align: 'center' },
         { title: '产品品牌', dataIndex: 'productBrand', width: 200, align: 'center' },
         { title: '产品分类', dataIndex: 'productType', width: 200, align: 'center' },
-        { title: '现有库存数量(个)', dataIndex: 'inventoryNum', width: 180, align: 'center', sorter: true, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '现有库存成本(¥)', dataIndex: 'inventoryMoney', width: 180, align: 'center', sorter: true, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '实时库存数(个)', dataIndex: 'inventoryNumy', width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '在途数(个)', scopedSlots: { customRender: 'onWayNum' }, width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '总库存数(个)', dataIndex: 'inventoryNumw', width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '最大库存数(个)', scopedSlots: { customRender: 'maxInventory' }, width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '最小库存数(个)', scopedSlots: { customRender: 'minInventory' }, width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '差异数量', dataIndex: 'inventoryNumh', width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '预警提示', dataIndex: 'inventoryNum', width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 240, align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
@@ -130,7 +166,8 @@ export default {
         })
       },
       openModal: false,  //  查看库存详情  弹框
-      itemId: ''  //  当前库存记录id
+      itemId: '',  //  当前库存记录id
+      editingKey: ''
     }
   },
   methods: {
@@ -144,37 +181,70 @@ export default {
       this.newTime = undefined
       this.$refs.table.refresh(true)
     },
-    //  库存详情
-    goDetail(row){
-      this.itemId = row.id
-      this.openModal = true
+    //  批量更新
+    handleupdate(){
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '确定提交批量更新的内容吗?',
+        okText: '确定',
+        cancelText: '取消',
+        onOk () {
+          // delectRolePower({
+          //   id: row.id
+          // }).then(res => {
+          //   console.log(res, 'res1111')
+          //   if (res.status == 200) {
+          //     _this.$message.success(res.message)
+          //     _this.$refs.table.refresh()
+          //   }
+          // })
+        }
+      })
+    },
+    handleChange(value, key, column) {
+      const newData = [...this.data];
+      const target = newData.filter(item => key === item.key)[0];
+      if (target) {
+        target[column] = value;
+        this.data = newData;
+      }
     },
-    //  关闭弹框
-    closeModal(){
-      this.itemId = ''
-      this.openModal = false
+    edit(key) {
+      const newData = [...this.data];
+      const target = newData.filter(item => key === item.key)[0];
+      this.editingKey = key;
+      if (target) {
+        target.editable = true;
+        this.data = newData;
+      }
     },
-    //  出入库明细
-    goWarehouseDetail(row){
-      this.$router.push({ path: '/inventoryManagement/inventoryQuery/warehouseDetail' })
+    save(key) {
+      const newData = [...this.data];
+      const newCacheData = [...this.cacheData];
+      const target = newData.filter(item => key === item.key)[0];
+      const targetCache = newCacheData.filter(item => key === item.key)[0];
+      if (target && targetCache) {
+        delete target.editable;
+        this.data = newData;
+        Object.assign(targetCache, target);
+        this.cacheData = newCacheData;
+      }
+      this.editingKey = '';
+    },
+    cancel(key) {
+      const newData = [...this.data];
+      const target = newData.filter(item => key === item.key)[0];
+      this.editingKey = '';
+      if (target) {
+        Object.assign(target, this.cacheData.filter(item => key === item.key)[0]);
+        delete target.editable;
+        this.data = newData;
+      }
     },
     //  导出
     handleExport () {
       const params = this.queryParam
-      if (this.oldTime && this.oldTime.length > 0) {
-        params.beginOldExpiryDate = moment(this.oldTime[0]).format('YYYY-MM-DD')
-        params.endOldExpirydDate = moment(this.oldTime[1]).format('YYYY-MM-DD')
-      } else {
-        params.beginOldExpiryDate = ''
-        params.endOldExpirydDate = ''
-      }
-      if (this.newTime && this.newTime.length > 0) {
-        params.beginDate = moment(this.newTime[0]).format('YYYY-MM-DD')
-        params.endDate = moment(this.newTime[1]).format('YYYY-MM-DD')
-      } else {
-        params.beginDate = ''
-        params.endDate = ''
-      }
       this.exportLoading = true
       customerBundleExportDelay(params).then(res => {
         this.exportLoading = false
@@ -188,7 +258,7 @@ export default {
       link.style.display = 'none'
       link.href = url
       const a = moment().format('YYYYMMDDHHmmss')
-      const fname = '服务延期记录' + a
+      const fname = '库存预警' + a
       link.setAttribute('download', fname + '.xlsx')
       document.body.appendChild(link)
       link.click()
@@ -197,4 +267,12 @@ export default {
 }
 </script>
 
-<style lang="less"></style>
+<style lang="less">
+  .inventoryWarningList-wrap{
+    .sTable{
+      table{
+        width: auto;
+      }
+    }
+  }
+</style>