Forráskód Böngészése

Merge branch 'deploy' of http://git.chelingzhu.com/jianguan-web/qpls-md-html into deploy

lilei 4 éve
szülő
commit
c26d4fcff2

+ 75 - 61
src/libs/getDate.js

@@ -1,65 +1,79 @@
 // 引入 moment 时间插件
-import moment from "moment";
-//获取今日/昨日/本周/上周/本月/上月 时间
+import moment from 'moment'
+moment.updateLocale('en', { week: {
+  dow: 1, // 星期的第一天是星期一
+  doy: 7 // 年份的第一周必须包含1月1日 (7 + 1 - 1)
+} })
+// 获取今日/昨日/本周/上周/本月/上月 时间
 export default {
-    // 获取今日的开始结束时间
-    getToday() {
-        let obj = {
-            starttime: '',
-            endtime: ''
-        }
-        obj.starttime = moment(moment().startOf("day").valueOf()).format("YYYY-MM-DD HH:mm:ss");
-        obj.endtime = moment(moment().valueOf()).format("YYYY-MM-DD HH:mm:ss");
-        return obj
-    },
-    // 获取昨日的开始结束时间
-    getYesterday() {
-        let obj = {
-            starttime: '',
-            endtime: ''
-        }
-        obj.starttime = moment(moment().add(-1, 'days').startOf("day").valueOf()).format("YYYY-MM-DD");
-        obj.endtime = moment(moment().add(-1, 'days').endOf('day').valueOf()).format('YYYY-MM-DD');
-        return obj
-    },
-    // 获取当前周的开始结束时间
-    getCurrWeekDays() {
-        let obj = {
-            starttime: '',
-            endtime: ''
-        }
-        obj.starttime = moment(moment().week(moment().week()).startOf('week').add(1, 'days').valueOf()).format('YYYY-MM-DD')
-        obj.endtime = moment(moment().week(moment().week()).endOf('week').add(1, 'days').valueOf()).format('YYYY-MM-DD');
-        return obj
-    },
-    // 获取上一周的开始结束时间
-    getLastWeekDays() {
-        let obj = {
-            starttime: '',
-            endtime: ''
-        }
-        obj.starttime = moment(moment().week(moment().week() - 1).startOf('week').add(1, 'days').valueOf()).format('YYYY-MM-DD')
-        obj.endtime = moment(moment().week(moment().week() - 1).endOf('week').add(1, 'days').valueOf()).format('YYYY-MM-DD');
-        return obj
-    },
-    // 获取当前月的开始结束时间
-    getCurrMonthDays() {
-        let obj = {
-            starttime: '',
-            endtime: ''
-        }
-        obj.starttime = moment(moment().month(moment().month()).startOf('month').valueOf()).format('YYYY-MM-DD');
-        obj.endtime = moment(moment().month(moment().month()).endOf('month').valueOf()).format('YYYY-MM-DD');
-        return obj
-    },
-    // 获取上一个月的开始结束时间
-    getLastMonthDays() {
-        let obj = {
-            starttime: '',
-            endtime: ''
-        }
-        obj.starttime = moment(moment().month(moment().month() - 1).startOf('month').valueOf()).format('YYYY-MM-DD');
-        obj.endtime = moment(moment().month(moment().month() - 1).endOf('month').valueOf()).format('YYYY-MM-DD');
-        return obj
+  // 获取今日的开始结束时间
+  getToday () {
+    const obj = {
+      starttime: '',
+      endtime: ''
     }
+    obj.starttime = moment(moment().startOf('day').valueOf()).format('YYYY-MM-DD')
+    obj.endtime = moment(moment().valueOf()).format('YYYY-MM-DD')
+    return obj
+  },
+  //  近7天
+  getRecentday () {
+    const obj = {
+      starttime: '',
+      endtime: ''
+    }
+    obj.starttime = moment().subtract('days', 6).format('YYYY-MM-DD')
+    obj.endtime = moment(moment().valueOf()).format('YYYY-MM-DD')
+    return obj
+  },
+  // 获取昨日的开始结束时间
+  getYesterday () {
+    const obj = {
+      starttime: '',
+      endtime: ''
+    }
+    obj.starttime = moment(moment().add(-1, 'days').startOf('day').valueOf()).format('YYYY-MM-DD')
+    obj.endtime = moment(moment().add(-1, 'days').endOf('day').valueOf()).format('YYYY-MM-DD')
+    return obj
+  },
+  // 获取当前周的开始到当天结束时间
+  getCurrWeekDays () {
+    const obj = {
+      starttime: '',
+      endtime: ''
+    }
+    obj.starttime = moment(moment().week(moment().week()).startOf('week').add('days').valueOf()).format('YYYY-MM-DD')
+    obj.endtime = moment(moment().valueOf()).format('YYYY-MM-DD')
+    return obj
+  },
+  // 获取上一周的开始结束时间
+  getLastWeekDays () {
+    const obj = {
+      starttime: '',
+      endtime: ''
+    }
+    obj.starttime = moment(moment().week(moment().week() - 1).startOf('week').add('days').valueOf()).format('YYYY-MM-DD')
+    obj.endtime = moment(moment().week(moment().week() - 1).endOf('week').add('days').valueOf()).format('YYYY-MM-DD')
+    return obj
+  },
+  // 获取当前月的开始到当天结束时间
+  getCurrMonthDays () {
+    const obj = {
+      starttime: '',
+      endtime: ''
+    }
+    obj.starttime = moment(moment().month(moment().month()).startOf('month').valueOf()).format('YYYY-MM-DD')
+    obj.endtime = moment(moment().valueOf()).format('YYYY-MM-DD')
+    return obj
+  },
+  // 获取上一个月的开始结束时间
+  getLastMonthDays () {
+    const obj = {
+      starttime: '',
+      endtime: ''
+    }
+    obj.starttime = moment(moment().month(moment().month() - 1).startOf('month').valueOf()).format('YYYY-MM-DD')
+    obj.endtime = moment(moment().month(moment().month() - 1).endOf('month').valueOf()).format('YYYY-MM-DD')
+    return obj
+  }
 }

+ 15 - 3
src/views/allocationManagement/chainTransferIn/detail.vue

@@ -4,6 +4,13 @@
       <!-- 自定义的二级文字标题 -->
       <template slot="subTitle">
         <a id="chainTransferInDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+        <a-button
+          v-if="isEdit"
+          type="primary"
+          size="small"
+          style="background-color: #1890ff;margin-left: 20px;border: #1890ff;"
+          id="chainTransferInDetail-edit-btn"
+          @click.stop="handleEdit">编辑</a-button>
       </template>
       <!-- 操作区,位于 title 行的行尾 -->
       <template slot="extra">
@@ -37,7 +44,7 @@
         :rowKey="(record) => record.id"
         :columns="columns"
         :data="loadData"
-        :scroll="{ x: 1275 }"
+        :scroll="{ x: 1335 }"
         bordered>
       </s-table>
     </a-card>
@@ -55,9 +62,9 @@ export default {
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
-        { title: '产品编码', dataIndex: 'productCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
-        { title: '原厂编码', dataIndex: 'productOrigCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '原厂编码', dataIndex: 'productOrigCode', width: 220, 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: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
@@ -84,6 +91,11 @@ export default {
       productTotal: null //  合计
     }
   },
+  computed: {
+    isEdit () {
+      return (this.basicInfoData && this.basicInfoData.state == 'WAIT_AUDIT')
+    }
+  },
   methods: {
     //  返回列表
     handleBack () {

+ 54 - 8
src/views/allocationManagement/chainTransferIn/edit.vue

@@ -71,7 +71,7 @@
         :rowKey="(record) => record.id"
         :columns="columns"
         :dataSource="loadData"
-        :scroll="{ x: 1255 }"
+        :scroll="{ x: 1415 }"
         bordered>
         <!-- 仓库仓位 -->
         <template slot="warehouse" slot-scope="text, record, index">
@@ -94,7 +94,7 @@
           size="large"
           class="button-primary"
           @click="handleSubmit"
-          style="padding: 0 60px;">提交</a-button>
+          style="padding: 0 60px;">提交入库</a-button>
       </div>
     </a-affix>
   </div>
@@ -105,7 +105,7 @@ import { STable, VSelect } from '@/components'
 import { getOperationalPrecision } from '@/libs/tools.js'
 import { dealerProductTypeList } from '@/api/dealerProductType'
 import { warehouseCascadeList } from '@/api/warehouse'
-import { allocLinkagePutDetailSn, allocLinkagePutDetailList, allocLinkagePutDetailCount } from '@/api/allocLinkagePut'
+import { allocLinkagePutDetailSn, allocLinkagePutDetailList, allocLinkagePutDetailCount, allocLinkagePutDetailUpdate, allocLinkagePutAudit } from '@/api/allocLinkagePut'
 export default {
   components: { STable, VSelect },
   data () {
@@ -125,9 +125,9 @@ export default {
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
-        { title: '产品编码', dataIndex: 'productCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
-        { title: '原厂编码', dataIndex: 'productOrigCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '原厂编码', dataIndex: 'productOrigCode', width: 220, 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: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
@@ -172,13 +172,18 @@ export default {
     },
     //  提交
     handleSubmit () {
-      console.log(this.loadData)
+      allocLinkagePutAudit({ sn: this.$route.params.sn }).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.handleBack()
+        }
+      })
     },
     // 产品列表数据
     getProductList (pageNo) {
       this.disabled = true
       this.pageNo = pageNo || this.pageNo
-      const params = Object.assign({ pageNo: this.pageNo, pageSize: this.pageSize }, this.queryParam)
+      const params = Object.assign({ pageNo: this.pageNo, pageSize: this.pageSize }, this.queryParam, { allocationLinkagePutSn: this.$route.params.sn })
       allocLinkagePutDetailList(params).then(res => {
         if (res.status == 200) {
           this.getDetailCount(params)
@@ -188,6 +193,15 @@ export default {
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
+            const warehouseSn = data.list[i].warehouseSn || undefined
+            const warehouseLocationSn = data.list[i].warehouseLocationSn || undefined
+            data.list[i].warehouseSnBackups = warehouseSn
+            data.list[i].warehouseLocationSnBackups = warehouseLocationSn
+            if (warehouseSn || warehouseLocationSn) {
+              data.list[i].warehouseCascade = [warehouseSn, warehouseLocationSn]
+            } else {
+              data.list[i].warehouseCascade = undefined
+            }
             // 成本小计  由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
             data.list[i].costSubtotal = getOperationalPrecision(data.list[i].putCost, data.list[i].putQty)
           }
@@ -221,13 +235,45 @@ export default {
       this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
     },
     changeWarehouseCascade (val, opt, ind) {
-      console.log(val, opt, ind)
       if (val.length < 2) {
         this.$message.warning('当前仓库无仓位,请选择其他仓库')
+        const warehouseSnBackups = this.loadData[ind].warehouseSnBackups || undefined
+        const warehouseLocationSnBackups = this.loadData[ind].warehouseLocationSnBackups || undefined
+        this.loadData[ind].warehouseSn = warehouseSnBackups
+        this.loadData[ind].warehouseLocationSn = warehouseLocationSnBackups
+        if (warehouseSnBackups || warehouseLocationSnBackups) {
+          this.loadData[ind].warehouseCascade = [warehouseSnBackups, warehouseLocationSnBackups]
+        } else {
+          this.loadData[ind].warehouseCascade = undefined
+        }
       } else {
         this.loadData[ind].warehouseSn = val[0] ? val[0] : ''
         this.loadData[ind].warehouseLocationSn = val[1] ? val[1] : ''
+        this.handleAdd(this.loadData[ind])
+      }
+    },
+    //  添加/编辑
+    handleAdd (row) {
+      // 清空成本价或数量时,值应保持未清空前的值,因成本价和数量都不可为空
+      if (!row.warehouseSn) {
+        row.warehouseSn = row.warehouseSnBackups
+        return
+      }
+      if (!row.warehouseLocationSn) {
+        row.warehouseLocationSn = row.warehouseLocationSnBackups
+        return
+      }
+      const params = {
+        id: row.id,
+        warehouseLocationSn: row.warehouseLocationSn,
+        warehouseSn: row.warehouseSn
       }
+      allocLinkagePutDetailUpdate(params).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.getProductList()
+        }
+      })
     },
     //  产品分类  列表
     getProductType () {

+ 40 - 36
src/views/allocationManagement/chainTransferIn/list.vue

@@ -83,7 +83,7 @@
       :rowKey="(record) => record.id"
       :columns="columns"
       :data="loadData"
-      :scroll="{ x: 1870 }"
+      :scroll="{ x: 1650 }"
       bordered>
       <!-- 连锁调入单号 -->
       <template slot="allocationLinkagePutNo" slot-scope="text, record">
@@ -95,9 +95,28 @@
       </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
-        <a-button size="small" type="link" class="button-primary" @click="handleWarehousing(record)" id="chainTransferInList-warehousing-btn">入库</a-button>
-        <a-button size="small" type="link" class="button-warning" @click="handleExamine(record)" id="chainTransferInList-examine-btn">审核</a-button>
-        <a-button size="small" type="link" class="button-info" @click="handleEdit(record)" id="chainTransferInList-edit-btn">编辑</a-button>
+        <a-button
+          size="small"
+          type="link"
+          v-if="record.state == 'WAIT_SUBMIT'"
+          class="button-primary"
+          @click="handleEdit(record)"
+          id="chainTransferInList-warehousing-btn">入库</a-button>
+        <a-button
+          size="small"
+          type="link"
+          v-if="record.state == 'WAIT_AUDIT'"
+          class="button-warning"
+          @click="handleExamine(record)"
+          id="chainTransferInList-examine-btn">审核</a-button>
+        <a-button
+          size="small"
+          type="link"
+          v-if="record.state == 'WAIT_AUDIT'"
+          class="button-info"
+          @click="handleEdit(record)"
+          id="chainTransferInList-edit-btn">编辑</a-button>
+        <span v-if="(record.state != 'WAIT_SUBMIT') && (record.state != 'WAIT_AUDIT')">--</span>
       </template>
     </s-table>
   </a-card>
@@ -105,15 +124,19 @@
 
 <script>
 import moment from 'moment'
+import getDate from '@/libs/getDate.js'
 import { STable, VSelect } from '@/components'
-import { allocLinkagePutList, allocLinkagePutAudit, allocLinkagePutSubmit } from '@/api/allocLinkagePut'
+import { allocLinkagePutList, allocLinkagePutAudit } from '@/api/allocLinkagePut'
 import { getTenantList } from '@/api/allocLinkageOut'
 export default {
   components: { STable, VSelect },
   data () {
     return {
       advanced: false, // 高级搜索 展开/关闭
-      time: undefined, //  入库时间
+      time: [
+        moment(getDate.getCurrMonthDays().starttime, this.dateFormat),
+        moment(getDate.getCurrMonthDays().endtime, this.dateFormat)
+      ], //  入库时间
       queryParam: { //  查询条件
         outTenantSn: undefined, //  调出对象
         allocationType: undefined, //  调拨产品类型
@@ -126,7 +149,6 @@ export default {
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
         { title: '连锁调入单号', scopedSlots: { customRender: 'allocationLinkagePutNo' }, width: 220, align: 'center' },
-        { title: '连锁调出单号', dataIndex: 'allocationLinkageOutNo', width: 220, align: 'center' },
         { title: '调出对象', dataIndex: 'outTenantName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '总款数', dataIndex: 'productTotalCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '总数量', dataIndex: 'productTotalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
@@ -172,25 +194,19 @@ export default {
       this.queryParam.allocationType = undefined
       this.queryParam.state = undefined
       this.queryParam.settleState = undefined
-      this.time = undefined
+      this.time = [
+        moment(getDate.getCurrMonthDays().starttime, this.dateFormat),
+        moment(getDate.getCurrMonthDays().endtime, this.dateFormat)
+      ]
       this.$refs.table.refresh(true)
     },
-    //  入库
-    handleWarehousing (row) {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确认要入库吗?',
-        centered: true,
-        onOk () {
-          allocLinkagePutSubmit({ sn: row.allocationLinkagePutSn }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.$refs.table.refresh()
-            }
-          })
-        }
-      })
+    //  详情
+    handleDetail (row) {
+      this.$router.push({ path: `/allocationManagement/chainTransferIn/detail/${row.allocationLinkagePutSn}` })
+    },
+    //  入库/编辑
+    handleEdit (row) {
+      this.$router.push({ path: `/allocationManagement/chainTransferIn/edit/${row.id}/${row.allocationLinkagePutSn}` })
     },
     //  审核
     handleExamine (row) {
@@ -209,18 +225,6 @@ export default {
         }
       })
     },
-    //  详情
-    handleDetail (row) {
-      this.$router.push({ path: `/allocationManagement/chainTransferIn/detail/${row.allocationLinkagePutSn}` })
-    },
-    //  新增/编辑
-    handleEdit (row) {
-      if (row) { //  编辑
-        this.$router.push({ path: `/allocationManagement/chainTransferIn/edit/${row.id}/${row.allocationLinkagePutSn}` })
-      } else { //  新增
-        this.$router.push({ path: '/allocationManagement/chainTransferIn/add' })
-      }
-    },
     // 调出对象
     getPutTenantList () {
       getTenantList({}).then(res => {

+ 9 - 2
src/views/allocationManagement/chainTransferOut/list.vue

@@ -138,6 +138,7 @@
 
 <script>
 import moment from 'moment'
+import getDate from '@/libs/getDate.js'
 import { STable, VSelect } from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
 import { allocLinkageOutList, allocLinkageAudit, allocLinkageOutDel, allocLinkageOutStock, getTenantList } from '@/api/allocLinkageOut'
@@ -146,7 +147,10 @@ export default {
   data () {
     return {
       advanced: false, // 高级搜索 展开/关闭
-      createDate: undefined, //  创建时间
+      createDate: [
+        moment(getDate.getCurrMonthDays().starttime, this.dateFormat),
+        moment(getDate.getCurrMonthDays().endtime, this.dateFormat)
+      ], //  创建时间
       queryParam: { //  查询条件
         putTenantSn: undefined, //  调往对象
         allocationType: undefined, //  调出产品类型
@@ -207,7 +211,10 @@ export default {
       this.queryParam.allocationType = undefined
       this.queryParam.state = undefined
       this.queryParam.settleState = undefined
-      this.createDate = undefined
+      this.createDate = [
+        moment(getDate.getCurrMonthDays().starttime, this.dateFormat),
+        moment(getDate.getCurrMonthDays().endtime, this.dateFormat)
+      ]
       this.$refs.table.refresh(true)
     },
     //  基本信息  保存