Sfoglia il codice sorgente

对接散件入库

chenrui 4 anni fa
parent
commit
b4fc0613c9

+ 0 - 2
src/views/bulkManagement/bulkWarehousingOrder/basicInfoModal.vue

@@ -98,8 +98,6 @@ export default {
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
           const form = JSON.parse(JSON.stringify(_this.form))
-          console.log('-----------id', _this.$route.params.id)
-          // form.id = _this.$route.params.id ? _this.$route.params.id : undefined
           sparePartsPurSave(form).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)

+ 42 - 20
src/views/bulkManagement/bulkWarehousingOrder/detail.vue

@@ -21,11 +21,19 @@
       <a-collapse :activeKey="['1']">
         <a-collapse-panel key="1" header="基础信息">
           <a-descriptions :column="3">
-            <a-descriptions-item label="供应商">{{ (basicInfoData&&basicInfoData.supplierName) || '' }}</a-descriptions-item>
-            <a-descriptions-item label="散件入库类型">{{ (basicInfoData&&basicInfoData.sparePartsTypeName) || '' }}</a-descriptions-item>
-            <a-descriptions-item label="备注">{{ (basicInfoData&&basicInfoData.remarks) || '' }}</a-descriptions-item>
-            <a-descriptions-item label="联系人">{{ (basicInfoData&&basicInfoData.supplierName) || '' }}</a-descriptions-item>
-            <a-descriptions-item label="联系地址">{{ (basicInfoData&&basicInfoData.supplierName) || '' }}</a-descriptions-item>
+            <a-descriptions-item label="供应商">{{ (basicInfoData&&basicInfoData.supplierName) || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="散件入库类型">{{ (basicInfoData&&basicInfoData.sparePartsTypeName) || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="备注">{{ (basicInfoData&&basicInfoData.remarks) || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="联系人">
+              {{ (basicInfoData&&basicInfoData.supplierContactPerson) || '--' }}
+              <span v-if="basicInfoData&&basicInfoData.supplierContactTel">({{ basicInfoData.supplierContactTel }})</span>
+            </a-descriptions-item>
+            <a-descriptions-item label="联系地址">
+              {{ (basicInfoData&&basicInfoData.supplierProvinceName) || '' }}
+              {{ (basicInfoData&&basicInfoData.supplierCityName) || '' }}
+              {{ (basicInfoData&&basicInfoData.supplierCountyName) || '' }}
+              {{ (basicInfoData&&basicInfoData.supplierAddress) || '' }}
+            </a-descriptions-item>
           </a-descriptions>
         </a-collapse-panel>
       </a-collapse>
@@ -36,17 +44,17 @@
         <a-collapse-panel key="1" header="产品详情">
           <!-- 总计 -->
           <a-alert type="info" showIcon style="margin-bottom:15px">
-            <div slot="message">产品款数 <strong>6</strong> ,采购数量合计 <strong>6</strong> ,采购金额合计¥<strong>6.33</strong></div>
+            <div slot="message">总款数 <strong>{{ (productTotal&&productTotal.productTotalCategory) || 0 }}</strong> ,总数量 <strong>{{ (productTotal&&productTotal.productTotalQty) || 0 }}</strong> ,总成本¥<strong>{{ (productTotal&&productTotal.productTotalCost) || 0 }}</strong></div>
           </a-alert>
           <!-- 列表 -->
           <s-table
             class="sTable"
             ref="table"
-            size="default"
+            size="small"
             :rowKey="(record) => record.id"
             :columns="columns"
             :data="loadData"
-            :scroll="{ x: 1080, y: 300 }"
+            :scroll="{ x: 1280 }"
             bordered>
             <!-- 采购数量 -->
             <template slot="purchaseNum" slot-scope="text, record">
@@ -82,7 +90,8 @@
 
 <script>
 import { STable, VSelect } from '@/components'
-import { sparePartsPurDetail, sparePartsPurDetailList } from '@/api/sparePartsPur'
+import { getOperationalPrecision } from '@/libs/tools.js'
+import { sparePartsPurDetail, sparePartsPurDetailList, sparePartsPurDetailCount } from '@/api/sparePartsPur'
 export default {
   components: { STable, VSelect },
   data () {
@@ -90,29 +99,32 @@ export default {
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
-        { title: '产品编码', dataIndex: 'creatDate', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'custName', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '采购单价', dataIndex: 'totalNums', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '采购数量', dataIndex: 'totaslNums', width: 100, align: 'center' },
-        { title: '单位', dataIndex: 'mementPay', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '采购金额', dataIndex: 'shDate', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '仓库', dataIndex: 'shD3ate', width: 100, align: 'center' },
-        { title: '仓位', dataIndex: 'shDaste', width: 100, align: 'center' }
+        { title: '产品编码', dataIndex: 'productCode', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '采购单价', dataIndex: 'putCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '采购数量', dataIndex: 'putQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单位', dataIndex: 'productUnit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '采购金额', dataIndex: 'purchaseAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '仓库', dataIndex: 'warehouseName', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '仓位', dataIndex: 'warehouseLocationName', width: 200, align: 'center', customRender: function (text) { return text || '--' } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
-        return sparePartsPurDetailList(Object.assign(parameter, this.queryParam)).then(res => {
+        return sparePartsPurDetailList(Object.assign(parameter, { sparePartsPurchaseSn: this.$route.params.sn })).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
+            // 采购金额  由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
+            data.list[i].purchaseAmount = getOperationalPrecision(data.list[i].putCost, data.list[i].putQty)
           }
           this.disabled = false
           return data
         })
       },
-      basicInfoData: null //  基本信息
+      basicInfoData: null, //  基本信息
+      productTotal: null //  合计
     }
   },
   methods: {
@@ -129,12 +141,22 @@ export default {
           this.basicInfoData = null
         }
       })
+    },
+    // 合计
+    getDetailCount () {
+      sparePartsPurDetailCount({ sparePartsPurchaseSn: this.$route.params.sn }).then(res => {
+        if (res.status == 200) {
+          this.productTotal = res.data
+        } else {
+          this.productTotal = null
+        }
+      })
     }
   },
   beforeRouteEnter (to, from, next) {
     next(vm => {
-      vm.openModal = false
       vm.getDetail()
+      vm.getDetailCount()
     })
   }
 }

+ 4 - 3
src/views/bulkManagement/bulkWarehousingOrder/edit.vue

@@ -254,7 +254,7 @@ export default {
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '产品编码', dataIndex: 'code', width: 200, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'name', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '原厂编码', dataIndex: 'origCode', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品品牌', dataIndex: 'productBrandName', width: 200, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
         { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
@@ -278,7 +278,7 @@ export default {
       chooseColumns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '产品编码', dataIndex: 'productCode', width: 200, align: 'center', sorter: true },
-        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '原厂编码', dataIndex: 'productOrigCode', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品品牌', dataIndex: 'brandName', width: 200, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
         { title: '单位', dataIndex: 'productUnit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
@@ -606,7 +606,7 @@ export default {
         if (res.status == 200) {
           const data = res.data
           this.choosePaginationProps.total = Number(res.data.count) || 0
-          this.choosePaginationProps.current = this.pageNo
+          this.choosePaginationProps.current = data.pageNo
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
@@ -624,6 +624,7 @@ export default {
     },
     //  产品品牌  列表
     getProductBrand () {
+      // sysFlag传0,表示只查自建产品
       dealerProductBrandQuery({ 'sysFlag': '0' }).then(res => {
         if (res.status == 200) {
           this.productBrandList = res.data

+ 22 - 3
src/views/bulkManagement/bulkWarehousingOrder/list.vue

@@ -6,7 +6,13 @@
         <a-row :gutter="15">
           <a-col :md="6" :sm="24">
             <a-form-item label="创建时间">
-              <a-range-picker v-model="creatDate" id="bulkWarehousingOrderList-creatDate"/>
+              <a-range-picker
+                style="width:100%"
+                id="bulkWarehousingOrderList-createDate"
+                :disabledDate="disabledDate"
+                v-model="createDate"
+                :format="dateFormat"
+                :placeholder="['开始时间', '结束时间']" />
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
@@ -141,7 +147,8 @@ export default {
       exportLoading: false, // 导出loading
       openModal: false, // 基本信息弹框是否显示
       supplierList: [], //  供应商列表数据
-      creatDate: undefined, //  创建时间
+      createDate: [], //  创建时间
+      dateFormat: 'YYYY-MM-DD',
       // 查询参数
       queryParam: {
         sparePartsPurchaseNo: '', //  散件单号
@@ -165,6 +172,14 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
+        // 创建时间
+        if (this.createDate && this.createDate.length > 0) {
+          this.queryParam.beginDate = moment(this.createDate[0]).format(this.dateFormat)
+          this.queryParam.endDate = moment(this.createDate[1]).format(this.dateFormat)
+        } else {
+          this.queryParam.beginDate = undefined
+          this.queryParam.endDate = undefined
+        }
         return sparePartsPurList(Object.assign(parameter, this.queryParam)).then(res => {
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
@@ -186,6 +201,10 @@ export default {
     }
   },
   methods: {
+    // 不可选日期
+    disabledDate (date, dateStrings) {
+      return date && date.valueOf() > Date.now()
+    },
     // 合计
     getTotal (param) {
       sparePartsPurCount(param).then(res => {
@@ -256,7 +275,7 @@ export default {
       this.queryParam.supplierName = undefined
       this.queryParam.state = undefined
       this.queryParam.settleState = undefined
-      this.creatDate = undefined
+      this.createDate = undefined
       this.$refs.table.refresh(true)
     },
     filterOption (input, option) {