소스 검색

收购 仓库 记忆上一次选择

mxx 3 년 전
부모
커밋
7323831dde
1개의 변경된 파일262개의 추가작업 그리고 203개의 파일을 삭제
  1. 262 203
      src/views/houseSelfCollect/acquisitionManagement.vue

+ 262 - 203
src/views/houseSelfCollect/acquisitionManagement.vue

@@ -3,14 +3,31 @@
   <div>
     <BaseHeaderLayout :leftSpan="12">
       <template slot="left">
-        <el-button type="primary" @click="newAcquisition('','','新增')"
-          v-hasPermission=" `acquisitionManagement.acquisitionCustomer.add`">新增</el-button>
+        <el-button
+          type="primary"
+          @click="newAcquisition('','','新增')"
+          v-hasPermission=" `acquisitionManagement.acquisitionCustomer.add`"
+        >新增</el-button>
         <div>
-          <el-select v-model="selectVal" placeholder="请选择" @change="warehouseChange" style="margin:0 20px">
-            <el-option v-for="item in warehouseList" :key="item.id" :label="item.warehouseName" :value="item.id">
-            </el-option>
+          <el-select
+            v-model="selectVal"
+            placeholder="请选择"
+            @change="warehouseChange"
+            style="margin:0 20px"
+          >
+            <el-option
+              v-for="item in warehouseList"
+              :key="item.id"
+              :label="item.warehouseName"
+              :value="item.id"
+            ></el-option>
           </el-select>
-          <el-checkbox v-hasPermission=" `acquisitionManagement.acquisition.allow`" v-model="checked" @change="allowEdit" :disabled="warehouseList.length==0">允许手动编辑重量</el-checkbox>
+          <el-checkbox
+            v-hasPermission=" `acquisitionManagement.acquisition.allow`"
+            v-model="checked"
+            @change="allowEdit"
+            :disabled="warehouseList.length==0"
+          >允许手动编辑重量</el-checkbox>
         </div>
       </template>
     </BaseHeaderLayout>
@@ -23,7 +40,7 @@
         <el-checkbox v-model="checked" @change="allowEdit">允许手动编辑重量</el-checkbox>
       </div>
       <el-button type="primary" @click="newAcquisition('','','新增')">新增</el-button>
-    </div> -->
+    </div>-->
     <el-dialog title="新增" :visible.sync="newAcquisitionDialogVisible" width="50%">
       <acquisitionManagementAdd></acquisitionManagementAdd>
     </el-dialog>
@@ -38,9 +55,7 @@
         <el-table-column prop="warehouseName" label="仓库名称"></el-table-column>
         <el-table-column prop="goodsName" label="货名"></el-table-column>
         <el-table-column label="水分范围(%)">
-          <template slot-scope="{ row }">
-            {{row.waterMin}}-{{row.waterMax}}
-          </template>
+          <template slot-scope="{ row }">{{row.waterMin}}-{{row.waterMax}}</template>
         </el-table-column>
         <el-table-column prop="waterBase" label="基准水分(%)"></el-table-column>
         <el-table-column prop="deductWeight" label="扣重比"></el-table-column>
@@ -51,243 +66,287 @@
         <el-table-column label="操作" width="300">
           <template slot-scope="scope">
             <el-button size="mini" @click="newAcquisition(scope.$index, scope.row,'查看')">查看</el-button>
-            <el-button v-if="scope.row.status!='审核中'" size="mini" @click="newAcquisition(scope.$index, scope.row,'编辑')"
-              v-hasPermission=" `acquisitionManagement.acquisitionCustomer.edit`">编辑</el-button>
-            <el-button v-if="scope.row.status=='审核中'" size="mini" :disabled="!scope.row.taskId"
-              @click="newAcquisition(scope.$index, scope.row,'审核中')">审核中</el-button>
-            <el-button size="mini" :disabled="!userJurisdiction" type="danger" @click="delRow(scope.$index, scope.row)"
-              v-hasPermission=" `acquisitionManagement.acquisitionCustomer.delete`">删除</el-button>
+            <el-button
+              v-if="scope.row.status!='审核中'"
+              size="mini"
+              @click="newAcquisition(scope.$index, scope.row,'编辑')"
+              v-hasPermission=" `acquisitionManagement.acquisitionCustomer.edit`"
+            >编辑</el-button>
+            <el-button
+              v-if="scope.row.status=='审核中'"
+              size="mini"
+              :disabled="!scope.row.taskId"
+              @click="newAcquisition(scope.$index, scope.row,'审核中')"
+            >审核中</el-button>
+            <el-button
+              size="mini"
+              :disabled="!userJurisdiction"
+              type="danger"
+              @click="delRow(scope.$index, scope.row)"
+              v-hasPermission=" `acquisitionManagement.acquisitionCustomer.delete`"
+            >删除</el-button>
             <el-button size="mini" @click="print(scope.$index, scope.row)">打印</el-button>
           </template>
         </el-table-column>
       </el-table>
       <div class="paging">
-        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
-          :page-size="deptCircularPage.pageSize" layout="total, sizes, prev, pager, next, jumper"
-          :total="deptBudgetTotal">
-        </el-pagination>
+        <el-pagination
+          @size-change="handleSizeChange"
+          @current-change="handleCurrentChange"
+          :current-page="currentPage"
+          :page-size="deptCircularPage.pageSize"
+          layout="total, sizes, prev, pager, next, jumper"
+          :total="deptBudgetTotal"
+        ></el-pagination>
       </div>
     </div>
   </div>
 </template>
 <script>
-  import {
-    getPurchasePrice,
-    selectWarehouseSelf,
-    purchasePriceAllowEdit,
-    purchasePriceLook,
-    purchasePriceDel
-  } from '@/model/houseSelfCollect/index'
-  import {
-    getHp
-  } from '@/utils/getHasPermission'
-  export default {
-    components: {},
-    watch: {},
-    data() {
-      return {
-        newAcquisitionDialogVisible: false,
-        visible: false,
-        checked: false,
-        currentPage: 1,
-        pageSize: 10,
-        deptBudgetTotal: 0,
-        deptCircularPage: {},
-        compId: '',
-        accountName: '',
-        tableData: [],
-        selectVal: '',
-        goodsNameList: [],
-        warehouseList: [],
-        userJurisdiction: false,
-        userJurisdictionAllow: true,
-        warehouseName:'',
-      }
+import {
+  getPurchasePrice,
+  selectWarehouseSelf,
+  purchasePriceAllowEdit,
+  purchasePriceLook,
+  purchasePriceDel
+} from '@/model/houseSelfCollect/index'
+import { getHp } from '@/utils/getHasPermission'
+export default {
+  components: {},
+  watch: {},
+  data() {
+    return {
+      newAcquisitionDialogVisible: false,
+      visible: false,
+      checked: false,
+      currentPage: 1,
+      pageSize: 10,
+      deptBudgetTotal: 0,
+      deptCircularPage: {},
+      compId: '',
+      accountName: '',
+      tableData: [],
+      selectVal: '',
+      goodsNameList: [],
+      warehouseList: [],
+      userJurisdiction: false,
+      userJurisdictionAllow: true,
+      warehouseName: ''
+    }
+  },
+  activated() {
+    //获取公司id
+    this.compId = sessionStorage.getItem('ws-pf_compId')
+    //用户名
+    this.accountName = sessionStorage.getItem('ws-pf_staffName')
+    this.getWarehouseSelf()
+    //获取用户权限,决策人、统计
+    this.getUserJurisdiction()
+  },
+  computed() {},
+  created() {},
+  methods: {
+    getUserJurisdiction() {
+      this.userJurisdiction = getHp('acquisitionManagement.acquisition.view')
+      this.userJurisdictionAllow = getHp(
+        'acquisitionManagement.acquisition.allow'
+      )
+      this.userJurisdictionAudit = getHp(
+        'acquisitionManagement.acquisition.edit'
+      )
+    },
+    handleSizeChange(val) {
+      console.log(`每页 ${val} 条`)
+      this.pageSize = val
+      this.getList()
     },
-    activated() {
-      //获取公司id
-      this.compId = sessionStorage.getItem('ws-pf_compId')
-      //用户名
-      this.accountName = sessionStorage.getItem('ws-pf_staffName')
-      this.getWarehouseSelf()
-      //获取用户权限,决策人、统计
-      this.getUserJurisdiction()
+    handleCurrentChange(val) {
+      this.currentPage = val
+      console.log(`当前页: ${val}`)
+      this.getList()
     },
-    computed() {},
-    created() {},
-    methods: {
-      getUserJurisdiction() {
-        this.userJurisdiction = getHp('acquisitionManagement.acquisition.view')
-        this.userJurisdictionAllow = getHp('acquisitionManagement.acquisition.allow')
-        this.userJurisdictionAudit = getHp('acquisitionManagement.acquisition.edit')
-      },
-      handleSizeChange(val) {
-        console.log(`每页 ${val} 条`)
-        this.pageSize = val
-        this.getList()
-      },
-      handleCurrentChange(val) {
-        this.currentPage = val
-        console.log(`当前页: ${val}`)
-        this.getList()
-      },
-      warehouseChange(e) {
-           for (let i = 0; i < this.warehouseList.length; i++) {
+    warehouseChange(e) {
+      for (let i = 0; i < this.warehouseList.length; i++) {
         if (this.warehouseList[i].id == this.selectVal) {
+          sessionStorage.setItem(
+            'houseSelfCollect_house',
+            JSON.stringify(this.warehouseList[i])
+          )
           this.warehouseName = this.warehouseList[i].warehouseName
           this.WAREHOUSE[0].payname = this.warehouseList[i].id
         }
       }
-        let _obj = this.warehouseList.find((item) => {
-          return item.id === this.selectVal;
-        });
-        if (_obj.allowEdit == 1) {
-
-          this.checked = true
-        } else {
-          this.checked = false
-        }
-        this.currentPage = 1
-        this.pageSize = 10
-        this.getList()
-      },
-      newAcquisition(index, row, type) {
-        let _obj = {}
-        let _query = {}
-        switch (type) {
-          case '新增':
-            _obj = this.warehouseList.find((item) => {
-              return item.id === this.selectVal;
-            });
-            _query = {
-              warehouseId: _obj.id,
-              warehouseName: _obj.warehouseName,
-              compId: this.compId,
-              type: type,
-              goodsNameList: this.goodsNameList
-            }
-            break
-          default:
-            _query = {
-              data: JSON.stringify(row),
-              type: type,
-              goodsNameList: this.goodsNameList
-            }
-            break
-        }
-        this.$router.push({
-          name: 'acquisitionManagementAdd',
-          query: _query
-        })
-      },
-      //获取仓库
-      getWarehouseSelf() {
-        selectWarehouseSelf({
-          compId: this.compId,
-        }).toPromise().then((response) => {
+      let _obj = this.warehouseList.find(item => {
+        return item.id === this.selectVal
+      })
+      if (_obj.allowEdit == 1) {
+        this.checked = true
+      } else {
+        this.checked = false
+      }
+      this.currentPage = 1
+      this.pageSize = 10
+      this.getList()
+    },
+    newAcquisition(index, row, type) {
+      let _obj = {}
+      let _query = {}
+      switch (type) {
+        case '新增':
+          _obj = this.warehouseList.find(item => {
+            return item.id === this.selectVal
+          })
+          _query = {
+            warehouseId: _obj.id,
+            warehouseName: _obj.warehouseName,
+            compId: this.compId,
+            type: type,
+            goodsNameList: this.goodsNameList
+          }
+          break
+        default:
+          _query = {
+            data: JSON.stringify(row),
+            type: type,
+            goodsNameList: this.goodsNameList
+          }
+          break
+      }
+      this.$router.push({
+        name: 'acquisitionManagementAdd',
+        query: _query
+      })
+    },
+    //获取仓库
+    getWarehouseSelf() {
+      selectWarehouseSelf({
+        compId: this.compId
+      })
+        .toPromise()
+        .then(response => {
           this.warehouseList = response
           // if(this.userJurisdiction){
           //   this.warehouseList.unshift({warehouseName:response[0].flag})
           // }
-                console.log(this.WAREHOUSE[0].payname)
-          this.selectVal = this.warehouseList[0].id
-          if (this.warehouseName) {
-            this.selectVal = this.WAREHOUSE[0].payname
+          debugger
+          let _wareHouse = sessionStorage.getItem('houseSelfCollect_house')
+          if (_wareHouse) {
+            _wareHouse = JSON.parse(_wareHouse)
+            this.selectVal = _wareHouse.id
+            this.warehouseName = _wareHouse.warehouseName
+            if (_wareHouse.allowEdit == 1) {
+              this.checked = true
+            } else {
+              this.checked = false
+            }
           } else {
-            this.WAREHOUSE[0].payname = this.warehouseList[0].id
+            console.log(this.WAREHOUSE[0].payname)
+            this.selectVal = this.warehouseList[0].id
+            if (this.warehouseName) {
+              this.selectVal = this.WAREHOUSE[0].payname
+            } else {
+              this.WAREHOUSE[0].payname = this.warehouseList[0].id
+            }
+            this.warehouseName = this.warehouseList[0].warehouseName
+            if (this.warehouseList[0].allowEdit == 1) {
+              this.checked = true
+            } else {
+              this.checked = false
+            }
           }
-          this.warehouseName = this.warehouseList[0].warehouseName
-          if (this.warehouseList[0].allowEdit == 1) {
 
-            this.checked = true
-          } else {
-            this.checked = false
-          }
           // this.tableData = response.records
           this.getList()
         })
-      },
-      //获取列表数据
-      getList() {
-        this.goodsNameList = []
-        getPurchasePrice({
-          currentPage: this.currentPage,
-          pageSize: this.pageSize,
-          warehouseId: this.selectVal,
-          compId: this.compId,
-
-        }).toPromise().then((response) => {
+    },
+    //获取列表数据
+    getList() {
+      this.goodsNameList = []
+      getPurchasePrice({
+        currentPage: this.currentPage,
+        pageSize: this.pageSize,
+        warehouseId: this.selectVal,
+        compId: this.compId
+      })
+        .toPromise()
+        .then(response => {
           for (let i = 0; i < response.records.length; i++) {
             this.goodsNameList.push(response.records[i].goodsName)
           }
           this.tableData = response.records
           this.deptBudgetTotal = response.total
         })
-      },
-      allowEdit(val) {
-        purchasePriceAllowEdit({
-          warehouseId: this.selectVal
-        }).toPromise().then((response) => {
+    },
+    allowEdit(val) {
+      purchasePriceAllowEdit({
+        warehouseId: this.selectVal
+      })
+        .toPromise()
+        .then(response => {
           // this.tableData = response.records
         })
-      },
-      // 删除
-      delRow(index, row) {
-        //删除
-        this.$confirm('确定删除该条设置?', '提示', {
-            confirmButtonText: '确定',
-            cancelButtonText: '取消',
-            type: 'warning',
+    },
+    // 删除
+    delRow(index, row) {
+      //删除
+      this.$confirm('确定删除该条设置?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      })
+        .then(() => {
+          purchasePriceDel({
+            id: row.id
           })
-          .then(() => {
-            purchasePriceDel({
-                id: row.id,
-              })
-              .toPromise()
-              .then((response) => {
-                this.$notify.success({
-                  title: '成功',
-                  message: '删除成功',
-                })
-                this.getList()
+            .toPromise()
+            .then(response => {
+              this.$notify.success({
+                title: '成功',
+                message: '删除成功'
               })
-              .catch((response) => {
-                // EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
-              })
-          })
-          .catch(() => {
-            return false
-          })
-      },
-      print(index, row) {debugger
-        // 打印价格对照表
-        purchasePriceLook({
-          id: row.id
-        }).toPromise().then((response) => {
+              this.getList()
+            })
+            .catch(response => {
+              // EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
+            })
+        })
+        .catch(() => {
+          return false
+        })
+    },
+    print(index, row) {
+      debugger
+      // 打印价格对照表
+      purchasePriceLook({
+        id: row.id
+      })
+        .toPromise()
+        .then(response => {
           // this.tableData = response.records
           // this.getList()
-          localStorage.setItem('pricePrintList', JSON.stringify(response.detailPrints));
-          window.open( '../../../static/print.html?name=' + row.goodsName)
+          localStorage.setItem(
+            'pricePrintList',
+            JSON.stringify(response.detailPrints)
+          )
+          window.open('../../../static/print.html?name=' + row.goodsName)
         })
-      },
-      validate() {
-
-      }
     },
+    validate() {}
   }
+}
 </script>
 <style lang="scss" scoped>
-  .header {
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
-  }
+.header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
 
-  /deep/.el-table .cell {
-    text-align: center;
-  }
+/deep/.el-table .cell {
+  text-align: center;
+}
 
-  .paging {
-    text-align: center;
-  }
+.paging {
+  text-align: center;
+}
 </style>