Selaa lähdekoodia

添加库位区域,库位对应商品详情

sakura 1 vuosi sitten
vanhempi
sitoutus
e89abc029f

+ 9 - 0
manager-admin/src/api/basicSetting.js

@@ -222,6 +222,15 @@ export function getWarehouseList(params) {
   })
 }
 
+/* 查询仓库 */
+
+export function getWarehouse(id) {
+  return request({
+    url: `/admin/erp/warehouse/${id}`,
+    method: 'get',
+
+  })
+}
 /**
  * 修改仓库
  * @param id

+ 59 - 0
manager-admin/src/api/goodsLend.js

@@ -277,3 +277,62 @@ export function getInfo(parmas) {
     data: parmas
   })
 }
+
+/* 库位区域列表 */
+export function getListAreaType(params) {
+  return request({
+    url: `/admin/erp/warehouse/area/listAreaType`,
+    method: 'get',
+    loaidng: false,
+    params
+  })
+}
+
+/* 库位区域新增 */
+export function addCreateAreaType(parmas) {
+  return request({
+    url: `/admin/erp/warehouse/area/createAreaType`,
+    method: 'post',
+    headers: { 'Content-Type': 'application/json' },
+    data: parmas
+  })
+}
+
+/* 库位区域修改 */
+export function editUpdateAreaType(id, parmas) {
+  return request({
+    url: `/admin/erp/warehouse/area/updateAreaType/${id}`,
+    method: 'put',
+    headers: { 'Content-Type': 'application/json' },
+    data: parmas
+  })
+}
+
+/* 库位区域删除 */
+export function removeAreaType(ids) {
+  return request({
+    url: `/admin/erp/warehouse/area/removeAreaType/${ids}`,
+    method: 'delete'
+  })
+}
+
+/* 根据库位获取当前商品/admin/erp/warehouse/area/goodNotAreaList */
+export function goodNotAreaList(id,params) {
+  return request({
+    url: `/admin/erp/warehouse/area/goodNotAreaList/${id}`,
+    method: 'get',
+    loaidng: false,
+    params
+  })
+}
+
+/* 添加 /admin/erp/warehouse/area/bindAreaStock/{warehouseId}/{warehouseAreaId} */
+
+export function bindAreaStock(warehouseId,warehouseAreaId,parmas) {
+  return request({
+    url: `/admin/erp/warehouse/area/bindAreaStock/${warehouseId}/${warehouseAreaId}`,
+    method: 'post',
+    headers: { 'Content-Type': 'application/json' },
+    data: parmas
+  })
+}

+ 2 - 2
manager-admin/src/components/SkuEditor/src/main.vue

@@ -136,13 +136,13 @@
         <!--  -->
         <el-table-column label="序列号" align="center" v-if="haveSn">
           <template v-slot="{ row }">
-            <el-input
+           <!--  <el-input
               onKeyUp="value=value.replace(/[\W]/g,'')"
               v-model="row.sn_code"
               :controls="false"
               :max="99999999"
               style="width: 95%"
-            />
+            /> -->
           </template>
         </el-table-column>
         <el-table-column

+ 2 - 0
manager-admin/src/lang/zh.js

@@ -62,6 +62,8 @@ export default {
     goodsUnderstockAdd:'调拨列表新增',
     pushRecord: '推送记录',
     warehouseList:'仓库列表',
+    warehouseLocation:'库位区域',
+    inventoryItem:'库位商品',
 
     sales: '销售管理',
     order: '订单列表',

+ 2 - 0
manager-admin/src/router/index.js

@@ -116,6 +116,8 @@ const asyncRouters = [
       { path: 'edit-inventory/:id?', component: () => import('@/views/stock/goodsExchange/addInventory'), name: 'editInventory', meta: { title: 'editInventory', noCache: true }, hidden: true },
       { path: 'audit-inventory/:id?', component: () => import('@/views/stock/goodsExchange/addInventory'), name: 'auditInventory', meta: { title: 'auditInventory', noCache: true }, hidden: true },
       { path: 'check-inventory/:id?', component: () => import('@/views/stock/goodsExchange/checkInventory'), name: 'checkInventory', meta: { title: 'checkInventory', noCache: true }, hidden: true },
+      { path: 'warehouse-location', component: () => import('@/views/stock/warehouseLocation'), name: 'warehouseLocation', meta: { title: 'warehouseLocation', noCache: true } },
+      { path: 'inventory-item/:id?', component: () => import('@/views/stock/inventoryItem'), name: 'inventoryItem', meta: { title: 'inventoryItem', noCache: true },hidden:true },
     ]
   },
   // 库存报表

+ 3 - 3
manager-admin/src/views/basicSetting/goods/editForm/BasicInfo.vue

@@ -55,7 +55,7 @@
           ></el-option>
         </el-select>
       </el-form-item>
-      <el-form-item prop="goods_unit" label="商品单位" :rules="formRules.goods_unit">
+      <!-- <el-form-item prop="goods_unit" label="商品单位" :rules="formRules.goods_unit">
         <el-input
           class="form-item-width"
           v-model="formData.goods_unit"
@@ -64,7 +64,7 @@
           clearable
           placeholder="请输入单位"
         ></el-input>
-      </el-form-item>
+      </el-form-item> -->
       <el-form-item prop="market_enable" label="状态" :rules="formRules.market_enable">
         <el-radio-group v-model="formData.market_enable">
           <el-radio :label="true">上架</el-radio>
@@ -198,7 +198,7 @@ export default {
         market_enable: [this.MixinRequired('请选择是否上架', 'change')],
         allow_sn:[this.MixinRequired('请选择是否启用序列号', 'change')],
         brand_id:[this.MixinRequired('请选择品牌', 'change')],
-        goods_unit:[this.MixinRequired('请输入商品单位', 'blur')]
+       /*  goods_unit:[this.MixinRequired('请输入商品单位', 'blur')] */
       },
       // 分类列表
       categoryList: [],

+ 0 - 1
manager-admin/src/views/stock/goodsExchange/addInventory.vue

@@ -1037,7 +1037,6 @@ export default {
         res.map((el) => {
           item.sn = el.goods_vo.sn;
           item.name = el.goods_vo.name;
-          /* item. */
           return item;
         });
         this.goodsData = res;

+ 408 - 239
manager-admin/src/views/stock/goodsLend.vue

@@ -1,40 +1,97 @@
 <template>
   <div>
-    <en-table-layout :tableData="tableData.data" :loading="loading" @selection-change="handleSelectionChange">
+    <en-table-layout
+      :tableData="tableData.data"
+      :loading="loading"
+      @selection-change="handleSelectionChange"
+    >
       <div slot="toolbar" class="inner-toolbar">
         <div class="toolbar-btns">
-          <el-button size="mini" v-if="checkPermission(['goodsLend:add'])" type="primary"
-            @click="handleAddGoodsLend">新增</el-button>
+          <el-button
+            size="mini"
+            v-if="checkPermission(['goodsLend:add'])"
+            type="primary"
+            @click="handleAddGoodsLend"
+            >新增</el-button
+          >
           <!-- <el-button size="mini" v-if="checkPermission(['goodsLend:del'])" @click="handleDeleteGoodsLend()" type="danger"
             :disabled="multipleSelection.length === 0">删除</el-button> -->
-             <el-button type="success" size="mini" v-if="checkPermission(['goodsLend:confirm'])" @click="handleConfirmGoodsLend"
-            :disabled="multipleSelection.length === 0">打印</el-button>
+          <el-button
+            type="success"
+            size="mini"
+            v-if="checkPermission(['goodsLend:confirm'])"
+            @click="handleConfirmGoodsLend"
+            :disabled="multipleSelection.length === 0"
+            >打印</el-button
+          >
         </div>
         <div class="toolbar-search">
-          <en-table-search @search="searchEvent" @advancedSearch="advancedSearchEvent" placeholder="请输入借出单编号" advanced
-            advancedWidth="465">
+          <en-table-search
+            @search="searchEvent"
+            @advancedSearch="advancedSearchEvent"
+            placeholder="请输入借出单编号"
+            advanced
+            advancedWidth="465"
+          >
             <template slot="advanced-content">
-              <el-form ref="advancedForm" :model="advancedForm" label-width="90px">
+              <el-form
+                ref="advancedForm"
+                :model="advancedForm"
+                label-width="90px"
+              >
                 <el-form-item label="仓库">
-                  <el-cascader v-model="advancedForm.dept_id" :options="warehouseList" :props="{
-                    label: 'name',
-                    value: 'id',
-                    emitPath: false,
-                    checkStrictly: true
-                  }" clearable></el-cascader>
+                  <el-cascader
+                    v-model="advancedForm.dept_id"
+                    :options="warehouseList"
+                    :props="{
+                      label: 'name',
+                      value: 'id',
+                      emitPath: false,
+                      checkStrictly: true,
+                    }"
+                    clearable
+                  ></el-cascader>
                 </el-form-item>
                 <el-form-item label="状态">
                   <el-select v-model="advancedForm.status">
                     <el-option key="NEW" label="新创建" value="NEW" />
-                    <el-option key="CONFIRMED" label="已确认" value="CONFIRMED" />
+                    <el-option
+                      key="CONFIRMED"
+                      label="已确认"
+                      value="CONFIRMED"
+                    />
                     <el-option key="RETURNED" label="已归还" value="RETURNED" />
                   </el-select>
                 </el-form-item>
                 <el-form-item label="时间">
-                  <el-date-picker v-model="advancedForm.goodsLend_time_range" type="daterange" align="center"
-                    :editable="false" unlink-panels :clearable="false" :default-time="['00:00:00', '23:59:59']"
-                    range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" value-format="timestamp"
-                    :picker-options="{ disabledDate(time) { return time.getTime() - 1 >= new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()).getTime() + 86400000 - 1 }, shortcuts: MixinPickerShortcuts }">
+                  <el-date-picker
+                    v-model="advancedForm.goodsLend_time_range"
+                    type="daterange"
+                    align="center"
+                    :editable="false"
+                    unlink-panels
+                    :clearable="false"
+                    :default-time="['00:00:00', '23:59:59']"
+                    range-separator="-"
+                    start-placeholder="开始日期"
+                    end-placeholder="结束日期"
+                    value-format="timestamp"
+                    :picker-options="{
+                      disabledDate(time) {
+                        return (
+                          time.getTime() - 1 >=
+                          new Date(
+                            new Date().getFullYear(),
+                            new Date().getMonth(),
+                            new Date().getDate()
+                          ).getTime() +
+                            86400000 -
+                            1
+                        );
+                      },
+                      shortcuts: MixinPickerShortcuts,
+                    }"
+                  >
                   </el-date-picker>
                 </el-form-item>
               </el-form>
@@ -61,7 +118,9 @@
         </el-table-column>
         <el-table-column prop="code" label="库位号" />
         <el-table-column prop="type" label="库位区域">
-          <template slot-scope="scope">{{ statusFilter(scope.row.type) }}</template>
+          <template slot-scope="scope">{{
+            statusFilter(scope.row.type)
+          }}</template>
         </el-table-column>
         <el-table-column prop="intro" label="库位说明" />
         <!-- <el-table-column prop="lend_person" label="借出人" />
@@ -70,357 +129,467 @@
         </el-table-column> -->
         <el-table-column label="操作" width="250">
           <template slot-scope="scope">
-            <el-button size="mini" v-if="checkPermission(['goodsLend:edit'])"
-              @click="handleEditGoodsLend(scope.row)">编辑</el-button>
-            <el-button type="success" size="mini"
+            <el-button
+              size="mini"
+              v-if="checkPermission(['goodsLend:edit'])"
+              @click="AddGoodsLend(scope.row)"
+              >添加商品</el-button
+            >
+            <el-button
+              size="mini"
+              v-if="checkPermission(['goodsLend:edit'])"
+              @click="handleEditGoodsLend(scope.row)"
+              >编辑</el-button
+            >
+            <el-button
+              type="success"
+              size="mini"
               v-if="checkPermission(['goodsLend:del'])"
-              @click="handleReturnGoodsLend(scope.row)">删除</el-button>
-            <el-button type="primary" v-if="checkPermission(['goodsLend:print'])" size="mini"
-              @click="handlePrintGoodsLendDialog(scope.row)">打印</el-button>
+              @click="handleReturnGoodsLend(scope.row)"
+              >删除</el-button
+            >
+            <el-button
+              type="primary"
+              v-if="checkPermission(['goodsLend:print'])"
+              size="mini"
+              @click="handlePrintGoodsLendDialog(scope.row)"
+              >打印</el-button
+            >
           </template>
         </el-table-column>
       </template>
 
-      <el-pagination v-if="tableData" slot="pagination" @size-change="handlePageSizeChange"
-        @current-change="handlePageCurrentChange" :current-page="tableData.page_no" :page-sizes="[10, 20, 50, 100]"
-        :page-size="tableData.page_size" layout="total, sizes, prev, pager, next, jumper" :total="tableData.data_total">
+      <el-pagination
+        v-if="tableData"
+        slot="pagination"
+        @size-change="handlePageSizeChange"
+        @current-change="handlePageCurrentChange"
+        :current-page="tableData.page_no"
+        :page-sizes="[10, 20, 50, 100]"
+        :page-size="tableData.page_size"
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="tableData.data_total"
+      >
       </el-pagination>
     </en-table-layout>
 
-    <el-dialog title="打印预览" :visible.sync="dialogVisible" width="940px" center @close='handleCancle'>
-      <el-button size="mini" type="primary" @click="handlePrintGoodsLend" class="print">打印</el-button>
-      <div id="deliverySheet" style="width:900px;">
-        <div class="tips-t" v-for="(item,index) in codeList" :key="index">
+    <el-dialog
+      title="打印预览"
+      :visible.sync="dialogVisible"
+      width="940px"
+      center
+      @close="handleCancle"
+    >
+      <el-button
+        size="mini"
+        type="primary"
+        @click="handlePrintGoodsLend"
+        class="print"
+        >打印</el-button
+      >
+      <div id="deliverySheet" style="width: 900px">
+        <div class="tips-t" v-for="(item, index) in codeList" :key="index">
           <div>
             <!-- <div class="qrcode-pic" ref="codeItem" ></div> -->
-            <h1 class="qrcode-title" style="margin-top: 20px;  font-family: sans-serif; color: black;font-weight: 600;">{{ item }}</h1>
+            <h1
+              class="qrcode-title"
+              style="
+                margin-top: 20px;
+                font-family: sans-serif;
+                color: black;
+                font-weight: 600;
+              "
+            >
+              {{ item }}
+            </h1>
           </div>
         </div>
       </div>
     </el-dialog>
-    <el-dialog :title="title" :visible.sync="dialogVisibleForm"  width="940px" center @close='addHandleCancle'>
-        <el-form ref="addLendForm" :model="addLendForm" :rules="rules" label-width="90px">
-          <!-- <el-form-item label="仓库编号" prop="code">
+    <el-dialog
+      :title="title"
+      :visible.sync="dialogVisibleForm"
+      width="940px"
+      center
+      @close="addHandleCancle"
+    >
+      <el-form
+        ref="addLendForm"
+        :model="addLendForm"
+        :rules="rules"
+        label-width="90px"
+      >
+        <!-- <el-form-item label="仓库编号" prop="code">
             <el-input v-model="addLendForm.code" placeholder="请输入仓库编号"></el-input>
           </el-form-item>
           <el-form-item label="仓库名称" prop="name">
             <el-input v-model="addLendForm.name" placeholder="请输入仓库名称"></el-input>
           </el-form-item> -->
-          <el-form-item label="仓库" prop="warehouse_id">
-            <el-select v-model="addLendForm.warehouse_id" clearable @change="selWarehouse">
-              <el-option v-for="item in warehouseList" :key="item.id" :label="item.name" :value="item.id" />
-            </el-select>
-            <span style="color: red;margin-left: 20px;cursor: pointer;text-decoration:underline;" v-if="warehouseList.length==0" @click="gowareHouse">新增仓库</span>
-          </el-form-item>
-          <el-form-item label="库位号" prop="code">
-            <el-input v-model="addLendForm.code" maxlength="12" placeholder="请输入库位号" style="width: 270px;">
-              <template slot="prepend">{{ warehouseSn }}-</template>
-            </el-input>
-          </el-form-item>
-          <el-form-item label="库位区域" prop="type">
-            <el-select v-model="addLendForm.type" clearable>
-              <el-option v-for="item in typeList" :key="item.id" :label="item.label" :value="item.value" />
-            </el-select>
-          </el-form-item>
-          <el-form-item label="库位说明">
-            <el-input
-                type="textarea"
-                :autosize="{ minRows: 2, maxRows: 4}"
-                placeholder="请输入内容"
-                v-model="addLendForm.intro">
-              </el-input>
-          </el-form-item>
-        </el-form>
-        <span slot="footer" class="dialog-footer">
-          <el-button @click="addHandleCancle ">取 消</el-button>
-          <el-button type="primary" @click="lendCommit">确 定</el-button>
-        </span>
+        <el-form-item label="仓库" prop="warehouse_id">
+          <el-select
+            v-model="addLendForm.warehouse_id"
+            clearable
+            @change="selWarehouse"
+          >
+            <el-option
+              v-for="item in warehouseList"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+            />
+          </el-select>
+          <span
+            style="
+              color: red;
+              margin-left: 20px;
+              cursor: pointer;
+              text-decoration: underline;
+            "
+            v-if="warehouseList.length == 0"
+            @click="gowareHouse"
+            >新增仓库</span
+          >
+        </el-form-item>
+        <el-form-item label="库位号" prop="code">
+          <el-input
+            v-model="addLendForm.code"
+            maxlength="12"
+            placeholder="请输入库位号"
+            style="width: 270px"
+          >
+            <template slot="prepend">{{ warehouseSn }}-</template>
+          </el-input>
+        </el-form-item>
+        <el-form-item label="库位区域" prop="type">
+          <el-select v-model="addLendForm.type" clearable>
+            <el-option
+              v-for="item in typeList"
+              :key="item.id"
+              :label="item.label"
+              :value="item.value"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="库位说明">
+          <el-input
+            type="textarea"
+            :autosize="{ minRows: 2, maxRows: 4 }"
+            placeholder="请输入内容"
+            v-model="addLendForm.intro"
+          >
+          </el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="addHandleCancle">取 消</el-button>
+        <el-button type="primary" @click="lendCommit">确 定</el-button>
+      </span>
     </el-dialog>
   </div>
 </template>
 
 <script>
-import * as API_GoodsLend from '@/api/goodsLend'
-import Print from 'print-js'
-import * as API_Setting from '@/api/setting'
-import { Foundation } from '~/ui-utils'
-import QRCode from 'qrcodejs2'
+import * as API_GoodsLend from "@/api/goodsLend";
+import Print from "print-js";
+import * as API_Setting from "@/api/setting";
+import { Foundation } from "~/ui-utils";
+import QRCode from "qrcodejs2";
 export default {
-  name: 'goodsLend',
+  name: "goodsLend",
   data() {
     return {
-      warehouseSn:"",
+      warehouseSn: "",
       warehouseList: [],
       // 列表loading状态
       loading: false,
       // 列表参数
       params: {
         page_no: 1,
-        page_size: 10
+        page_size: 10,
       },
       // 高级搜索数据
       advancedForm: {},
       // 列表数据
-      tableData: '',
+      tableData: "",
       dialogVisible: false,
       // 当前已选择的行
       multipleSelection: [],
       goodsLendForm: {},
-      codeList:[],
-      title:"",
-      dialogVisibleForm:false,
+      codeList: [],
+      title: "",
+      dialogVisibleForm: false,
       // 新增数据
-      addLendForm:{
-      },
+      addLendForm: {},
       rules: {
         warehouse_id: [
-            { required: true, message: '请选择仓库', trigger: 'change' },
-          ],
-          name: [
-            { required: true, message: '请选择输入仓库名称', trigger: 'blur' }
-          ],
-          code: [
-            { required: true, message: '请选择输入库位号', trigger: 'blur' }
-          ],
-          type: [
-            {  required: true, message: '请选择仓库类型', trigger: 'change' }
-          ]
-        },
-        typeList:[]
-    }
+          { required: true, message: "请选择仓库", trigger: "change" },
+        ],
+        name: [
+          { required: true, message: "请选择输入仓库名称", trigger: "blur" },
+        ],
+        code: [
+          { required: true, message: "请选择输入库位号", trigger: "blur" },
+        ],
+        type: [
+          { required: true, message: "请选择仓库类型", trigger: "change" },
+        ],
+      },
+      typeList: [],
+    };
   },
   mounted() {
-    this.GET_GoodsLendList()
-    this.GET_DeptList()
+    this.GET_GoodsLendList();
+    this.GET_DeptList();
   },
   watch: {
     $route: {
       immediate: true,
       handler(newVal) {
         if (newVal.query.status) {
-          this.params.status = newVal.query.status
-          this.advancedForm.status = newVal.query.status
+          this.params.status = newVal.query.status;
+          this.advancedForm.status = newVal.query.status;
         }
-        this.params.page_no = 1
-        this.GET_GoodsLendList()
-      }
-    }
+        this.params.page_no = 1;
+        this.GET_GoodsLendList();
+      },
+    },
   },
   methods: {
-    ceshi(){
-      this.$router.push({name:"demo"})
+    AddGoodsLend(row) {
+      this.$router.push({
+        name: "inventoryItem",
+        params: {
+          id: row.id,
+          warehouse_id:row.warehouse_id,
+          code:row.code
+        },
+      });
     },
-    gowareHouse(){
-      this.dialogVisibleForm=false
-      this.$router.push({ name: 'warehouseList'})
+    gowareHouse() {
+      this.dialogVisibleForm = false;
+      this.$router.push({ name: "warehouseList" });
     },
     /* 选中仓库 */
-    selWarehouse(val){
-      const list=this.warehouseList.filter(el=>{
-        return el.id===val
-      })
-      let obj = list[0]
-      this.warehouseSn=obj.sn
+    selWarehouse(val) {
+      const list = this.warehouseList.filter((el) => {
+        return el.id === val;
+      });
+      let obj = list[0];
+      this.warehouseSn = obj.sn;
     },
     // 确认提交
-    lendCommit(){
+    lendCommit() {
       this.$refs.addLendForm.validate((valid) => {
-      if (valid) {
-        if(this.title==='新增'){
-          this.addLendForm.code=this.warehouseSn+"-"+this.addLendForm.code
-           API_GoodsLend.create(this.addLendForm).then(res=>{
-            this.$message.success('添加成功!')
-            this.dialogVisibleForm=false
-            this.warehouseSn=""
-            this.addLendForm={}
-            this.GET_GoodsLendList()
-           })
-        }else if(this.title==='编辑'){
-          API_GoodsLend.update(this.addLendForm).then(res=>{
-            this.$message.success('修改成功!')
-            this.dialogVisibleForm=false
-            this.addLendForm={}
-            this.GET_GoodsLendList()
-           })
+        if (valid) {
+          if (this.title === "新增") {
+            this.addLendForm.code =
+              this.warehouseSn + "-" + this.addLendForm.code;
+            API_GoodsLend.create(this.addLendForm).then((res) => {
+              this.$message.success("添加成功!");
+              this.dialogVisibleForm = false;
+              this.warehouseSn = "";
+              this.addLendForm = {};
+              this.GET_GoodsLendList();
+            });
+          } else if (this.title === "编辑") {
+            API_GoodsLend.update(this.addLendForm).then((res) => {
+              this.$message.success("修改成功!");
+              this.dialogVisibleForm = false;
+              this.addLendForm = {};
+              this.GET_GoodsLendList();
+            });
+          }
+        } else {
+          this.$message.error("提交失败");
+          return false;
         }
-      } else {
-        this.$message.error('提交失败')
-        return false;
-      }
-    })
-
+      });
     },
-    addHandleCancle(){
-      this.dialogVisibleForm=false
-      this.addLendForm={}
+    addHandleCancle() {
+      this.dialogVisibleForm = false;
+      this.addLendForm = {};
     },
-    handleCancle () {
-      this.dialogVisible = false
-      this.codeList=[]
+    handleCancle() {
+      this.dialogVisible = false;
+      this.codeList = [];
     },
     // 二维码生成
     creatQrCode() {
       this.$nextTick(() => {
-          this.codeList.forEach((item,index)=>{
-            this.$refs.codeItem[index].innerHTML="";
-              var qrcode = new QRCode(this.$refs.codeItem[index], {
-                text: item, //二维码内容
-                width: 600,
-                height: 660,
-                render: 'table',
-                colorDark: "#333333", //二维码颜色
-                colorLight: "#ffffff", //二维码背景色
-                correctLevel : QRCode.CorrectLevel.H
-              })
+        this.codeList.forEach((item, index) => {
+          this.$refs.codeItem[index].innerHTML = "";
+          var qrcode = new QRCode(this.$refs.codeItem[index], {
+            text: item, //二维码内容
+            width: 600,
+            height: 660,
+            render: "table",
+            colorDark: "#333333", //二维码颜色
+            colorLight: "#ffffff", //二维码背景色
+            correctLevel: QRCode.CorrectLevel.H,
           });
-        },500)
+        });
+      }, 500);
     },
     handleEditGoodsLend(row) {
       console.log(row);
-      this.title="编辑"
-      this.addLendForm=row
-      this.dialogVisibleForm=true
+      this.title = "编辑";
+      this.addLendForm = row;
+      this.dialogVisibleForm = true;
       // this.$router.push({ name: 'goodsLendEdit', params: { id: row.id }})
     },
     handleReturnGoodsLend(row) {
-      this.$confirm('确定要删除吗?', '提示', { type: 'warning' }).then(() => {
-        API_GoodsLend.deletes({id:row.id}).then(() => {
-          this.$message.success('删除成功!')
-          this.GET_GoodsLendList()
+      this.$confirm("确定要删除吗?", "提示", { type: "warning" })
+        .then(() => {
+          API_GoodsLend.deletes({ id: row.id }).then(() => {
+            this.$message.success("删除成功!");
+            this.GET_GoodsLendList();
+          });
         })
-      }).catch(() => { })
+        .catch(() => {});
     },
     /** 状态 */
     statusFilter(val) {
-      const obj=this.typeList.filter(el=>{
-        return el.value===val
-      })
-      if(obj.length !== 0){
-        return obj[0].label
-      }else{
-        return ""
+      const obj = this.typeList.filter((el) => {
+        return el.value === val;
+      });
+      if (obj.length !== 0) {
+        return obj[0].label;
+      } else {
+        return "";
       }
-
     },
     handleConfirmGoodsLend() {
-      if (!this.multipleSelection || !this.multipleSelection.length) return this.$message.error('请先选择!')
-        const ids = this.multipleSelection.map(item => item.code)
-        this.codeList=ids
-        this.dialogVisible = true
-        this.creatQrCode()
-
+      if (!this.multipleSelection || !this.multipleSelection.length)
+        return this.$message.error("请先选择!");
+      const ids = this.multipleSelection.map((item) => item.code);
+      this.codeList = ids;
+      this.dialogVisible = true;
+      this.creatQrCode();
     },
     /** 获取部门 */
     GET_DeptList() {
-      API_Setting.getListAll().then(response => {
-        this.warehouseList = response
+      API_Setting.getListAll().then((response) => {
+        this.warehouseList = response;
         console.log(response);
-      })
-      API_Setting.getPage({dictType:"Warehouse_location_type",page_no: 1,page_size: 50}).then(res=>{
-        this.typeList=res.data
-      })
+      });
+      API_Setting.getPage({
+        dictType: "Warehouse_location_type",
+        page_no: 1,
+        page_size: 50,
+      }).then((res) => {
+        this.typeList = res.data;
+      });
     },
     /** 打印对账详情 */
     handlePrintGoodsLend() {
       Print({
-        printable: 'deliverySheet',
-        type: 'html',
-        targetStyles: ['*'],
+        printable: "deliverySheet",
+        type: "html",
+        targetStyles: ["*"],
         //style: 'body, html {font-size:300px !important;color:red;}', // 确保打印时应用这个样式
-        ignoreElements: ['no-logs', 'goods-image', 'no-btn','elementToIgnore']
-      })
+        ignoreElements: ["no-logs", "goods-image", "no-btn", "elementToIgnore"],
+      });
     },
     handleDeleteGoodsLend() {
-      if (!this.multipleSelection || !this.multipleSelection.length) return this.$message.error('请先选择!')
-      this.$confirm('确定要删除这些借出单吗?', '提示', { type: 'warning' }).then(() => {
-        const ids = this.multipleSelection.map(item => item.id)
-        API_GoodsLend.deleteGoodsLend(ids).then(() => {
-          this.$message.success('删除成功!')
-          this.GET_GoodsLendList()
+      if (!this.multipleSelection || !this.multipleSelection.length)
+        return this.$message.error("请先选择!");
+      this.$confirm("确定要删除这些借出单吗?", "提示", { type: "warning" })
+        .then(() => {
+          const ids = this.multipleSelection.map((item) => item.id);
+          API_GoodsLend.deleteGoodsLend(ids).then(() => {
+            this.$message.success("删除成功!");
+            this.GET_GoodsLendList();
+          });
         })
-      }).catch(() => { })
+        .catch(() => {});
     },
     /** 多选改变 */
     handleSelectionChange(val) {
-      this.multipleSelection = val
+      this.multipleSelection = val;
     },
     /** 分页大小发生改变 */
     handlePageSizeChange(size) {
-      this.params.page_size = size
-      this.GET_GoodsLendList()
+      this.params.page_size = size;
+      this.GET_GoodsLendList();
     },
 
     /** 分页页数发生改变 */
     handlePageCurrentChange(page) {
-      this.params.page_no = page
-      this.GET_GoodsLendList()
+      this.params.page_no = page;
+      this.GET_GoodsLendList();
     },
 
     /** 添加调整单 */
     handleAddGoodsLend() {
-      this.title="新增"
-      this.dialogVisibleForm=true
+      this.title = "新增";
+      this.dialogVisibleForm = true;
       // this.$router.push({ name: 'goodsLendAdd'})
     },
     /** 打印调整单 */
     handlePrintGoodsLendDialog(row) {
       // this.GET_GoodsLendDetail(row.id)
-      this.dialogVisible = true
-      this.codeList.push(row.code)
-        this.creatQrCode()
+      this.dialogVisible = true;
+      this.codeList.push(row.code);
+      this.creatQrCode();
     },
     /** 获取调整单详情页面数据 */
     GET_GoodsLendDetail(id) {
-      API_GoodsLend.getGoodsLendInfo(id).then(response => {
-        this.goodsLendForm = response
+      API_GoodsLend.getGoodsLendInfo(id).then((response) => {
+        this.goodsLendForm = response;
         if (response.product_list && response.product_list.length) {
-          var str = ''
-          response.product_list.forEach(function(i) {
-            str += i.product_name + '、'
-          })
+          var str = "";
+          response.product_list.forEach(function (i) {
+            str += i.product_name + "、";
+          });
         }
         // 生成库位号二维码
-        this.goodsLendForm.illustrate = str
-
-
-      })
+        this.goodsLendForm.illustrate = str;
+      });
     },
     /** 搜索事件触发 */
     searchEvent(data) {
       this.params = {
         ...this.params,
-        sn: data
-      }
-      Object.keys(this.advancedForm).forEach((key) => delete this.params[key])
-      this.params.page_no = 1
-      this.GET_GoodsLendList()
+        sn: data,
+      };
+      Object.keys(this.advancedForm).forEach((key) => delete this.params[key]);
+      this.params.page_no = 1;
+      this.GET_GoodsLendList();
     },
     /** 高级搜索事件触发 */
     advancedSearchEvent() {
       this.params = {
         ...this.params,
-        ...this.advancedForm
-      }
-      delete this.params.start_time
-      delete this.params.end_time
+        ...this.advancedForm,
+      };
+      delete this.params.start_time;
+      delete this.params.end_time;
       if (this.advancedForm.goodsLend_time_range) {
-        this.params.start_time = parseInt(Number(this.advancedForm.goodsLend_time_range[0]) / 1000)
-        this.params.end_time = parseInt(Number(this.advancedForm.goodsLend_time_range[1]) / 1000)
+        this.params.start_time = parseInt(
+          Number(this.advancedForm.goodsLend_time_range[0]) / 1000
+        );
+        this.params.end_time = parseInt(
+          Number(this.advancedForm.goodsLend_time_range[1]) / 1000
+        );
       }
-      delete this.params.goodsLend_time_range
-      this.params.page_no = 1
-      this.GET_GoodsLendList()
+      delete this.params.goodsLend_time_range;
+      this.params.page_no = 1;
+      this.GET_GoodsLendList();
     },
     /** 获取调整单列表 */
     GET_GoodsLendList() {
-      this.loading = true
-      API_GoodsLend.query(this.params).then(response => {
-        this.loading = false
-        this.tableData = response
-      }).catch(() => { this.loading = false })
-    }
-  }
-}
+      this.loading = true;
+      API_GoodsLend.query(this.params)
+        .then((response) => {
+          this.loading = false;
+          this.tableData = response;
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
+  },
+};
 </script>
 
 <style type="text/scss" lang="scss" scoped>
@@ -457,8 +626,8 @@ export default {
 /deep/ .el-dialog__body {
   padding: 10px 20px;
 }
-/deep/.el-form{
-    .el-form-item__content{
+/deep/.el-form {
+  .el-form-item__content {
     display: flex;
   }
 }

+ 523 - 0
manager-admin/src/views/stock/inventoryItem.vue

@@ -0,0 +1,523 @@
+<template>
+  <div class="bg-in-stock">
+    <el-form
+      ref="goodsExchangeAddForm"
+      :model="goodsExchangeAddForm"
+      :rules="goodsExchangeAddFormRule"
+      label-width="160px"
+      inline
+      class="change-form"
+    >
+      <div class="mx">
+        <h3>当前库位: {{ code }}</h3>
+      </div>
+      <div class="mx">
+        <h3>商品明细</h3>
+        <el-button
+          class="button"
+          size="mini"
+          type="primary"
+          v-if="type !== 'detail' && type !== 'audit'"
+          @click="handleSelectWarehouseEntryBatch"
+          >选择</el-button
+        >
+      </div>
+      <div style="width: 100%; display: block">
+        <el-form-item style="width: 100%">
+          <el-table
+            :data="goodsExchangeAddForm.product_list"
+            border
+            :cell-style="{ textAlign: 'center' }"
+            :header-cell-style="{ textAlign: 'center' }"
+            style="width: 100%; margin-top: 20px"
+          >
+            <el-table-column label="商品编号">
+              <template slot-scope="scope">
+               {{ scope.row.good_vo.sn }}
+              </template>
+            </el-table-column>
+            <el-table-column label="商品名称">
+              <template slot-scope="scope">
+              {{ scope.row.good_vo.name }}
+              </template>
+            </el-table-column>
+            <el-table-column label="条码">
+              <template slot-scope="scope">
+
+             {{ scope.row.product_vo.bar_code }}
+              </template>
+            </el-table-column>
+            <el-table-column label="序列号">
+              <template slot-scope="scope">
+
+                {{ scope.row.product_vo.sn_code }}
+              </template>
+            </el-table-column>
+            <el-table-column label="规格型号" v-if="id">
+              <template slot-scope="scope">
+                {{ scope.row.product_vo.spec_name.join("/") }}
+              </template>
+            </el-table-column>
+            <el-table-column label="规格型号" v-else>
+              <template slot-scope="scope">
+                {{ scope.row.product_vo.spec_name.join("/") }}
+              </template>
+            </el-table-column>
+            <el-table-column label="单位">
+              <template slot-scope="scope">
+             {{ scope.row.product_vo.unit }}
+              </template>
+            </el-table-column>
+           <!--  <el-table-column label="数量">
+              <template slot-scope="scope">
+                <el-input
+                  v-model="scope.row.out_num"
+                  type="number"
+                  :min="0"
+                  :maxlength="20"
+                  :disabled="type === 'detail' || type === 'audit'"
+                ></el-input>
+              </template>
+            </el-table-column> -->
+            <el-table-column label="库存数量">
+              <template slot-scope="scope">
+                {{ scope.row.usable_stock }}
+              </template>
+            </el-table-column>
+          <!--   <el-table-column label="剩余数量">
+              <template slot-scope="scope">
+                {{ scope.row.usable_stock - scope.row.out_num || 0 }}
+              </template>
+            </el-table-column> -->
+            <el-table-column
+              label="操作"
+              v-if="type !== 'detail' && type !== 'audit'"
+            >
+              <template slot-scope="scope">
+                <el-button
+                  size="mini"
+                  type="danger"
+                  @click="
+                    goodsExchangeAddForm.product_list.splice(scope.$index, 1)
+                  "
+                  >删除</el-button
+                >
+              </template>
+            </el-table-column>
+          </el-table>
+        </el-form-item>
+      </div>
+    </el-form>
+    <div class="footer">
+      <el-button
+        v-if="type !== 'audit' && type !== 'detail'"
+        type="primary"
+        @click="saveGoodsExchangeAddForm"
+        >添加
+      </el-button>
+      <!--   <el-button
+        v-if="type !== 'audit' && type !== 'detail'"
+        type="primary"
+        @click="submitGoodsExchangeAddForm"
+        >出库
+      </el-button>
+      <el-button @click="printIng" v-if="type == 'audit'">打印</el-button>-->
+      <el-button @click="$router.back()">返回</el-button>
+    </div>
+
+    <el-dialog
+      title="商品列表"
+      :visible.sync="goodsVisible"
+      width="1000px"
+      @close="closeGoosData"
+    >
+      <el-table
+        :data="goodsData"
+        border
+        style="width: 100%"
+        @selection-change="handleSelectionChange"
+      >
+        <el-table-column type="selection" width="55" />
+        <el-table-column prop="good_vo.sn" label="商品编号"> </el-table-column>
+        <el-table-column prop="product_vo.bar_code" label="商品条码"> </el-table-column>
+        <el-table-column prop="product_vo.sn_code" label="序列号"> </el-table-column>
+        <el-table-column prop="good_vo.name" label="商品名称"> </el-table-column>
+        <el-table-column prop="" label="规格型号"> </el-table-column>
+        <el-table-column prop="product_vo.unit" label="单位"> </el-table-column>
+        <el-table-column prop="usable_stock" label="库存数量">
+        </el-table-column>
+      </el-table>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="closeGoosData">取 消</el-button>
+        <el-button type="primary" @click="submitGoosData()">确 定</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { mapGetters } from "vuex";
+import { Foundation, RegExp } from "~/ui-utils";
+import * as API_GoodsExchange from "@/api/goodsExchange";
+import * as API_GoodsLend from "@/api/goodsLend"
+import * as API_Setting from "@/api/setting";
+import * as API_BasicSetting from "@/api/basicSetting";
+import * as API_Erp from "@/api/erp";
+import * as API_Auth from "@/api/auth";
+export default {
+  name: "goodsExchangeAdd",
+  data() {
+    const checkPrice = (rule, value, callback) => {
+      if (!value && value !== 0) {
+        return callback(new Error("换货金额不能为空"));
+      } else if (!RegExp.money.test(value)) {
+        callback(new Error("请输入正整数或者两位小数"));
+      } else if (parseFloat(value) > 99999999) {
+        callback(new Error("换货金额设置超过上限值"));
+      } else {
+        callback();
+      }
+    };
+    return {
+      typeList: [],
+      adminList: [],
+      dialogVisible: false,
+      warehouseList: [],
+      deptList: [],
+      deptListAll: [],
+      orderList: [],
+      id: "",
+      type: "",
+      /** 出库单表单*/
+      goodsExchangeAddForm: {
+        product_list: [],
+        type: "",
+      },
+      /** 校验规则 */
+      goodsExchangeAddFormRule: {},
+      warehouseProduct: null,
+      scanDialogVisible: false,
+      scanGoodsForm: {},
+      //出入库
+      sttorageType: "",
+      // 出库商品明细
+      goodsVisible: false,
+      goodsData: [],
+      // 暂存已勾选商品
+      goodsList: [],
+      product_list: [],
+      code: "", //当前库位号
+      warehouse_id:"",//当前仓库id
+    };
+  },
+  mounted() {
+    this.id=this.$route.params.id
+    this.warehouse_id=this.$route.params.warehouse_id
+    this.code = this.$route.params.code;
+    this.GET_WarehouseList();
+    this.GET_DeptList();
+    this.outType();
+  },
+  watch: {
+    $route: {
+      immediate: true,
+      handler(newVal) {
+        if (this.$route.name === "goodsExchangeEdit") {
+          this.type = "edit";
+        } else if (this.$route.name === "goodsExchangeAudit") {
+          this.type = "audit";
+        } else if (this.$route.name === "goodsExchangeReturn") {
+          this.type = "return";
+        } else if (this.$route.name === "inventoryItem") {
+          this.type = "add";
+          this.$set(
+            this.goodsExchangeAddForm,
+            "change_time",
+            new Date().getTime()
+          );
+        } else if (this.$route.name === "goodsExchangeDetail") {
+          this.type = "detail";
+        }
+        if (this.$route.params.id) {
+          this.id = this.$route.params.id;
+          this.GET_goodsExchangeAddDetail();
+        }
+        this.GET_AdministratorList();
+      },
+    },
+  },
+  computed: {
+    ...mapGetters(["user"]),
+  },
+  methods: {
+    // 保存已选商品
+    submitGoosData() {
+      console.log(this.goodsList.length);
+      if (this.goodsList.length >= 1) {
+        this.goodsExchangeAddForm.product_list = this.goodsList
+        this.goodsVisible = false;
+      } else {
+        this.$message.error("请选择商品信息");
+      }
+    },
+    //选择商品
+    handleSelectionChange(val) {
+      this.goodsList=val.map((el) => {
+        return el;
+      });
+
+    },
+    // 关闭商品明细
+    closeGoosData() {
+      this.goodsVisible = false;
+    },
+    //获取出库类型字典
+    outType() {
+      API_Setting.getPage({ dictType: "out_warehouse_type" }).then((res) => {
+        this.typeList = res.data.filter((el) => {
+          if (el.value !== "SALE_OUT" && el.value !== "HAIL_OUT") {
+            return el;
+          }
+        });
+      });
+    },
+    // 打印功能
+    printIng() {},
+    toSearch() {
+      API_GoodsExchange.getGoodsInfo({
+        barcode: this.scanGoodsForm.bar_code,
+      }).then((res) => {});
+    },
+    // 扫码入库
+    scanCode() {
+      this.scanDialogVisible = true;
+      this.$nextTick(() => {
+        this.$refs.input.focus();
+      });
+    },
+    /** 获取人员列表 */
+    GET_AdministratorList() {
+      API_Auth.getAdministratorList({
+        page_no: 1,
+        page_size: 9999,
+        user_state: 0,
+      }).then((response) => {
+        this.adminList = response.data;
+      });
+    },
+    /** 获取仓库 */
+    GET_WarehouseList(e) {
+      API_BasicSetting.getWarehouseListAll().then((response) => {
+        this.warehouseList = response;
+      });
+    },
+    //保存
+    saveGoodsExchangeAddForm() {
+      this.$refs["goodsExchangeAddForm"].validate((valid) => {
+        if (valid) {
+          const { id } = this.goodsExchangeAddForm;
+          const params = this.MixinClone(this.goodsExchangeAddForm);
+          const query=[]
+          if (!this.goodsExchangeAddForm.product_list.length) {
+            this.$message.error("请选择商品!");
+            return;
+          }
+          this.goodsExchangeAddForm.product_list.map(el=>{
+            return query.push(el.id)
+          })
+          params.stock_id_list=query
+          API_GoodsLend.bindAreaStock(this.warehouse_id,this.id,params).then(() => {
+              this.$message.success("添加成功!");
+              const { callback } = this.$route.params;
+              if (typeof callback === "function") callback();
+              this.$store.dispatch("delCurrentViews", {
+                view: this.$route,
+                $router: this.$router,
+              });
+              this.$router.push({ name: "goodsLend" });
+            });
+        }
+      });
+    },
+    // 商品列表
+    async handleSelectWarehouseEntryBatch() {
+      API_GoodsLend.goodNotAreaList(this.warehouse_id,this.params).then((res) => {
+        this.goodsData = res.records;
+        this.goodsVisible = true;
+      });
+      /* if (!this.goodsExchangeAddForm.warehouse_id) {
+        this.$message.error("请先选择仓库!");
+        return;
+      }
+      const goodsData = await this.$EnwarehouseEntryBatch({
+        goodsApi: `/admin/erp/warehouseOut/getGoodByWarehouse/${this.goodsExchangeAddForm.warehouse_id}`,
+        warehouseList: this.warehouseList,
+        //change_list
+        selectedIds: this.id
+          ? this.goodsExchangeAddForm.product_list &&
+            this.goodsExchangeAddForm.product_list.map((item) => item.id)
+          : this.goodsExchangeAddForm.product_list.map((item) => item.id),
+        purchasePlanApiParams: {
+          warehouse_id: this.goodsExchangeAddForm.warehouse_id,
+        },
+      });
+      this.goodsExchangeAddForm.warehouse_id = goodsData.warehouse_id;
+      this.goodsExchangeAddForm.product_list = goodsData.purchasePlans;
+      this.goodsExchangeAddForm.change_amount =
+        this.goodsExchangeAddForm.product_list.reduce(
+          (sum, obj) => sum + obj.entry_price,
+          0
+        );*/
+    },
+    /** 选择订单编号 */
+    async handleSelectOrderSn() {
+      const orders = await this.$EnPickerOrder({
+        orderApi: "admin/erp/order",
+        selectedIds: [this.goodsExchangeAddForm.order_sn],
+        limit: 1,
+      });
+      this.$set(
+        this.goodsExchangeAddForm,
+        "distribution_name",
+        orders[0].distribution_name
+      );
+      const orderIds = orders.map((v) => v.sn);
+      this.$set(this.goodsExchangeAddForm, "order_sn", orderIds.join(","));
+      this.GET_WarehouseOutProduct();
+    },
+    /** 获取出库单商品明细 */
+    async GET_WarehouseOutProduct() {
+      const res = await API_Erp.getWarehouseOutProduct({
+        order_sn: this.goodsExchangeAddForm.order_sn,
+      });
+      this.goodsExchangeAddForm.return_list = res.data.map((item) => {
+        item.amount = item.product_price;
+        item.product_sn = item.product_sn;
+        item.product_name = item.product_name;
+        item.specification = item.product_specification;
+        item.product_id = item.product_id;
+        item.unit = item.product_unit;
+        item.out_num = item.return_num;
+        item.stock_sn = item.warehouse_entry_sn;
+        item.cost_price = item.product_cost_price;
+        return item;
+      });
+    },
+    /** 获取仓库 */
+    GET_DeptList() {
+      API_GoodsExchange.getInfo().then((response) => {
+        this.deptListAll = response;
+        this.deptListAll.password = "";
+      });
+    },
+    /** 切换仓库 */
+    handleChangeWareHouse(val) {
+      //this.goodsExchangeAddForm.product_list = []change_list
+    },
+    /** 获取详情页面数据 */
+    GET_goodsExchangeAddDetail() {
+      this.$nextTick(() => {
+        /*  API_GoodsExchange.getGoodsWarehouseOut(this.id).then((response) => {
+          this.goodsExchangeAddForm = response;
+          this.GET_WarehouseList({ dept_id: response.warehouse_id });
+          this.goodsExchangeAddForm.change_time = Math.floor(
+            this.goodsExchangeAddForm.change_time * 1000
+          );
+          this.goodsExchangeAddForm.distribution_name = response.staff_name;
+          this.goodsExchangeAddForm.product_list =
+            response.product_list;
+        }); */
+      });
+    },
+  },
+};
+</script>
+
+<style type="text/scss" lang="scss" scoped>
+/** 底部步骤 */
+.footer {
+  width: 100%;
+  padding: 10px;
+  bottom: 0px;
+  text-align: center;
+  z-index: 999;
+}
+
+.mx {
+  display: flex;
+  align-items: center;
+  width: 100%;
+
+  .button {
+    margin-left: 10px;
+  }
+}
+
+.change-form {
+  display: flex;
+  justify-content: flex-start;
+  align-items: flex-start;
+  flex-wrap: wrap;
+  min-width: 900px;
+
+  .change-form-item {
+    width: 30%;
+    margin: 0 10px 20px 0;
+    display: flex;
+    flex-direction: row;
+    flex-wrap: nowrap;
+  }
+
+  /deep/ {
+    .el-form-item__content {
+      flex: 1;
+      width: 100%;
+    }
+
+    .el-date-editor,
+    .el-cascader,
+    .el-select {
+      width: 100%;
+    }
+  }
+}
+
+.bg-in-stock {
+  background-color: #fff;
+  margin: 10px;
+  padding: 25px;
+}
+
+.goods-info {
+  display: flex;
+
+  .goods-name-box {
+    text-align: left;
+
+    .goods-name {
+      text-overflow: ellipsis;
+      display: -webkit-box;
+      -webkit-line-clamp: 2;
+      -webkit-box-orient: vertical;
+      overflow: hidden;
+      line-height: 16px;
+    }
+
+    .specs {
+      color: #999999;
+    }
+  }
+}
+
+/deep/ {
+  .el-input--suffix .el-input__inner {
+    padding-right: 10px;
+  }
+
+  .error-input {
+    .el-input__inner {
+      border: 1px solid red;
+    }
+  }
+}
+</style>

+ 41 - 29
manager-admin/src/views/stock/orderOutbound.vue

@@ -243,7 +243,8 @@
                   clearable
                   :disabled="disabledType"
                   placeholder="请输入物品总体积"
-                ><template slot="append">m³</template></el-input>
+                  ><template slot="append">m³</template></el-input
+                >
               </el-form-item>
             </el-col>
             <el-col :span="8">
@@ -294,9 +295,18 @@
           </el-row>
         </el-form>
       </div>
-      <div v-if="outType !== undefined &&(JSON.stringify(deliveryForms.create_order_fail)!=='{}'||JSON.stringify(deliveryForms.create_order_success)!=='{}') ">
+      <div
+        v-if="
+          outType !== undefined &&
+          (JSON.stringify(deliveryForms.create_order_fail) !== '{}' ||
+            JSON.stringify(deliveryForms.create_order_success) !== '{}')
+        "
+      >
         <h3>物流状态:</h3>
-        <div class="steps-wrap" v-if="JSON.stringify(deliveryForms.create_order_fail)!=='{}'">
+        <div
+          class="steps-wrap"
+          v-if="JSON.stringify(deliveryForms.create_order_fail) !== '{}'"
+        >
           <el-steps class="steps" direction="vertical" process-status="finish">
             <el-step
               icon="el-icon-error"
@@ -329,7 +339,7 @@
           >
             <el-step
               icon="el-icon-success"
-              v-if="JSON.stringify(deliveryForms.sign_in)!=='{}'"
+              v-if="JSON.stringify(deliveryForms.sign_in) !== '{}'"
               :title="deliveryForms.sign_in.orderStatus == 402 ? '退回' : ''"
             >
               <div slot="description">
@@ -340,8 +350,8 @@
               </div>
             </el-step>
             <el-step
-            icon="el-icon-success"
-              v-if="JSON.stringify(deliveryForms.sign_in)!=='{}'"
+              icon="el-icon-success"
+              v-if="JSON.stringify(deliveryForms.sign_in) !== '{}'"
               :title="deliveryForms.sign_in.orderStatus == 401 ? '签收' : ''"
             >
               <div slot="description">
@@ -353,7 +363,7 @@
             </el-step>
             <el-step
               icon="el-icon-success"
-              v-if="JSON.stringify(deliveryForms.user_sending)!=='{}'"
+              v-if="JSON.stringify(deliveryForms.user_sending) !== '{}'"
               :title="
                 deliveryForms.user_sending.orderStatus == 300 ? '配送中' : ''
               "
@@ -371,7 +381,7 @@
             </el-step>
             <el-step
               icon="el-icon-success"
-              v-if="JSON.stringify(deliveryForms.user_arrives)!=='{}'"
+              v-if="JSON.stringify(deliveryForms.user_arrives) !== '{}'"
               :title="
                 deliveryForms.user_arrives.orderStatus == 202 ? '已取件' : ''
               "
@@ -389,7 +399,7 @@
             </el-step>
             <el-step
               icon="el-icon-success"
-              v-if="JSON.stringify(deliveryForms.user_take_order)!=='{}'"
+              v-if="JSON.stringify(deliveryForms.user_take_order) !== '{}'"
               :title="
                 deliveryForms.user_take_order.orderStatus == 201 ? '已接单' : ''
               "
@@ -408,7 +418,7 @@
             </el-step>
             <el-step
               icon="el-icon-success"
-              v-if="JSON.stringify(deliveryForms.create_order_success)!=='{}'"
+              v-if="JSON.stringify(deliveryForms.create_order_success) !== '{}'"
               :title="
                 deliveryForms.create_order_success.orderStatus == 100
                   ? '待接单'
@@ -534,8 +544,8 @@ export default {
   name: "orderOutbound",
   data() {
     return {
-      btnType:false,
-      disabledType:false,
+      btnType: false,
+      disabledType: false,
       // 列表loading状态
       loading: false,
       appointmentList: [
@@ -695,7 +705,7 @@ export default {
     obtainOrder() {
       this.$refs["ruleForm"].validate((valid) => {
         if (valid) {
-          this.btnType=true
+          this.btnType = true;
           const params = this.MixinClone(this.deliveryForms);
           //发货详细地址
           params.receiver.province_city_area_address =
@@ -726,12 +736,12 @@ export default {
           params.total_volume = Number(params.total_volume);
           params.declared_value = Number(params.declared_value);
           //地址
-          params.send_address=this.send_address;
-          params.receive_address=this.receive_address;
+          params.send_address = this.send_address;
+          params.receive_address = this.receive_address;
           params.order_code = this.id;
           API_order.getKdShip(this.id, params).then((res) => {
             this.kdnCode = res;
-            this.btnType=false
+            this.btnType = false;
           });
         } else {
           console.log("error submit!!");
@@ -753,7 +763,7 @@ export default {
       });
     },
     saveErpWarehouseOut() {
-      API_order.outOrderSend(this.id, ).then((res) => {
+      API_order.outOrderSend(this.id).then((res) => {
         this.$router.push({ name: "warehouseOut" });
       });
       return;
@@ -818,10 +828,10 @@ export default {
       API_order.getSendOrderDetail(this.id).then((res) => {
         res.product_list = res.order_item_vos;
         this.product_list = res.order_item_vos;
-        console.log(res.kdn_order_code==undefined);
+        console.log(res.kdn_order_code == undefined);
 
-        if (this.outType !== undefined ||res.kdn_order_code!==undefined) {
-          this.disabledType=true
+        if (this.outType !== undefined || res.kdn_order_code !== undefined) {
+          this.disabledType = true;
           this.deliveryForms.appointment_type = res.appointment_type;
           this.deliveryForms.appointment_time = res.appointment_time;
           this.deliveryForms.sender.name = res.sender_name;
@@ -835,15 +845,15 @@ export default {
           this.deliveryForms.remark = res.remark;
           this.kdnCode = res.kdn_order_code;
           if (
-            JSON.stringify(res.create_order_fail)=='{}' ||
-            JSON.stringify(res.create_order_success)=='{}' ||
-            JSON.stringify(res.user_take_order)=='{}' ||
-             JSON.stringify(res.user_arrives)=='{}' ||
-             JSON.stringify(res.user_sending)=='{}' ||
-             JSON.stringify(res.order_fee)=='{}' ||
-             JSON.stringify(res.sign_in)=='{}'
+            JSON.stringify(res.create_order_fail) == "{}" ||
+            JSON.stringify(res.create_order_success) == "{}" ||
+            JSON.stringify(res.user_take_order) == "{}" ||
+            JSON.stringify(res.user_arrives) == "{}" ||
+            JSON.stringify(res.user_sending) == "{}" ||
+            JSON.stringify(res.order_fee) == "{}" ||
+            JSON.stringify(res.sign_in) == "{}"
           ) {
-             /* let arr =[]
+            /* let arr =[]
             arr.push(res.create_order_fail)
             arr.push(res.create_order_success)
             arr.push(res.user_take_order)
@@ -862,7 +872,9 @@ export default {
           }
         }
         res.order_item_vos.map((el) => {
-          this.deliveryForms.total_weight = Number(el.product_vo.weight * el.num);
+          this.deliveryForms.total_weight = Number(
+            el.product_vo.weight * el.num
+          );
         });
         this.deliveryForms.declared_value = Number(res.order_vo.real_price);
         if (res.send_address && res.receiver_address) {

+ 239 - 90
manager-admin/src/views/stock/warehouseList.vue

@@ -3,45 +3,141 @@
     <en-table-layout :tableData="tableData.data" :loading="loading">
       <div slot="toolbar" class="inner-toolbar">
         <div class="toolbar-btns">
-          <el-button size="mini" v-if="checkPermission(['stock:add'])" type="primary"
-            @click="handleAddWarehouse">新增</el-button>
+          <el-button
+            size="mini"
+            v-if="checkPermission(['stock:add'])"
+            type="primary"
+            @click="handleAddWarehouse"
+            >新增</el-button
+          >
         </div>
         <div class="toolbar-search">
-          <en-table-search @search="searchEvent" placeholder="请输入关键字搜索" />
+          <en-table-search
+            @search="searchEvent"
+            placeholder="请输入关键字搜索"
+          />
         </div>
       </div>
 
       <template slot="table-columns">
         <el-table-column prop="sn" label="仓库编号" />
         <el-table-column prop="name" label="仓库名称" />
+        <!-- <el-table-column prop="admin_id" label="负责人姓名">
+          <template slot-scope="scope">
+            {{ adminName(scope.row.admin_id) }}
+          </template>
+        </el-table-column> -->
+        <el-table-column prop="phone" label="负责人手机号" />
+        <el-table-column prop="name" label="仓库地址">
+          <template slot-scope="scope">
+            {{
+              adminName(scope.row.ware_pro_city_area) +
+                scope.row.warehouse_address || ""
+            }}
+          </template>
+        </el-table-column>
         <el-table-column prop="description" label="仓库说明" />
         <el-table-column label="操作">
           <template slot-scope="scope">
-            <el-button size="mini" v-if="checkPermission(['stock:edit'])"
-              @click="handleEditWarehouse(scope.$index, scope.row)">编辑</el-button>
-            <el-button size="mini" v-if="checkPermission(['stock:del'])" type="danger"
-              @click="handleDeleteWarehouse(scope.$index, scope.row)">删除</el-button>
+            <el-button
+              size="mini"
+              v-if="checkPermission(['stock:edit'])"
+              @click="handleEditWarehouse(scope.$index, scope.row)"
+              >编辑</el-button
+            >
+            <!-- <el-button
+              size="mini"
+              v-if="checkPermission(['stock:del'])"
+              type="danger"
+              @click="handleDeleteWarehouse(scope.$index, scope.row)"
+              >删除</el-button
+            > -->
           </template>
         </el-table-column>
       </template>
 
-      <el-pagination v-if="tableData" slot="pagination" @size-change="handlePageSizeChange"
-        @current-change="handlePageCurrentChange" :current-page="tableData.page_no" :page-sizes="[10, 20, 50, 100]"
-        :page-size="tableData.page_size" layout="total, sizes, prev, pager, next, jumper" :total="tableData.data_total">
+      <el-pagination
+        v-if="tableData"
+        slot="pagination"
+        @size-change="handlePageSizeChange"
+        @current-change="handlePageCurrentChange"
+        :current-page="tableData.page_no"
+        :page-sizes="[10, 20, 50, 100]"
+        :page-size="tableData.page_size"
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="tableData.data_total"
+      >
       </el-pagination>
     </en-table-layout>
-    <el-dialog :title="stockForm.id ? '编辑仓库' : '添加仓库'" :visible.sync="dialogVisible" width="500px"
-      @open="handleDialogOpen" :modal-append-to-body="false" :close-on-click-modal="false" :close-on-press-escape="false">
-      <el-form :model="stockForm" :rules="stockRules" ref="stockForm" label-width="120px">
+    <el-dialog
+      :title="stockForm.id ? '编辑仓库' : '添加仓库'"
+      :visible.sync="dialogVisible"
+      width="500px"
+      @open="handleDialogOpen"
+      :modal-append-to-body="false"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+    >
+      <el-form
+        :model="stockForm"
+        :rules="stockRules"
+        ref="stockForm"
+        label-width="120px"
+      >
         <el-form-item label="仓库编号" prop="sn">
-          <el-input v-model="stockForm.sn" :minlength="2" :maxlength="4" clearable placeholder="请输入仓库编号"></el-input>
+          <el-input
+            v-model="stockForm.sn"
+            :minlength="2"
+            :maxlength="4"
+            clearable
+            placeholder="请输入仓库编号"
+          ></el-input>
         </el-form-item>
         <el-form-item label="仓库名称" prop="name">
-          <el-input v-model="stockForm.name" :minlength="2" :maxlength="20" clearable placeholder="请输入仓库名称"></el-input>
+          <el-input
+            v-model="stockForm.name"
+            :minlength="2"
+            :maxlength="20"
+            clearable
+            placeholder="请输入仓库名称"
+          ></el-input>
+        </el-form-item>
+        <!-- <el-form-item label="负责人姓名" prop="">
+          <el-input v-model="stockForm" clearable placeholder="请输入负责人名称"></el-input>
+        </el-form-item> -->
+        <el-form-item label="负责人电话" prop="phone">
+          <el-input
+            v-model="stockForm.phone"
+            :minlength="2"
+            :maxlength="20"
+            clearable
+            placeholder="请输入负责人电话"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="仓库地址" prop="">
+          <el-cascader
+            size="large"
+            :options="options"
+            clearable
+            v-model="selectedOptions"
+            @change="handleChange"
+          >
+          </el-cascader>
+          <span>
+            <el-input
+              style="margin-top: 10px"
+              v-model="stockForm.warehouse_address"
+              placeholder="请输入"
+            ></el-input>
+          </span>
         </el-form-item>
         <el-form-item label="备注" prop="description">
-          <el-input v-model="stockForm.description" type="textarea" :autosize="{ minRows: 3, maxRows: 4 }"
-            placeholder="请输入备注"></el-input>
+          <el-input
+            v-model="stockForm.description"
+            type="textarea"
+            :autosize="{ minRows: 3, maxRows: 4 }"
+            placeholder="请输入备注"
+          ></el-input>
         </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
@@ -53,13 +149,20 @@
 </template>
 
 <script>
-import * as API_BasicSetting from '@/api/basicSetting'
-import * as API_Setting from '@/api/setting'
-import * as API_Auth from '@/api/auth'
-import { Foundation } from '~/ui-utils'
-import { mapGetters } from 'vuex'
+import * as API_BasicSetting from "@/api/basicSetting";
+import * as API_Setting from "@/api/setting";
+import * as API_Auth from "@/api/auth";
+import { Foundation } from "~/ui-utils";
+import { mapGetters } from "vuex";
+import {
+  provinceAndCityData,
+  pcTextArr,
+  regionData,
+  pcaTextArr,
+  codeToText,
+} from "element-china-area-data";
 export default {
-  name: 'warehouse',
+  name: "warehouse",
   data() {
     return {
       deptList: [],
@@ -70,44 +173,69 @@ export default {
       // 列表参数
       params: {
         page_no: 1,
-        page_size: 10
+        page_size: 10,
       },
       // 列表数据
-      tableData: '',
+      tableData: "",
       // 仓库表单
-      stockForm: {},
+      stockForm: {
+        phone: "",
+      },
       // 仓库表单 规则
       stockRules: {
-       sn: [
-            { required: true, message: '请输入仓库编号', trigger: 'blur' },
-          ],
-          name: [
-            { required: true, message: '请选择输入仓库名称', trigger: 'blur' }
-          ],
+        sn: [{ required: true, message: "请输入仓库编号", trigger: "blur" }],
+        name: [
+          { required: true, message: "请选择输入仓库名称", trigger: "blur" },
+        ],
+        phone: [
+          this.MixinRequired("请输入手机号码!"),
+          {
+            pattern: /^1[3456789]\d{9}$/,
+            message: "手机号码格式不正确",
+            trigger: "blur",
+          },
+        ],
       },
       // 仓库表单 dialog
-      dialogVisible: false
-    }
+      dialogVisible: false,
+      options: regionData,
+      selectedOptions: [],
+    };
   },
   mounted() {
-    this.GET_WarehouseList()
-    this.GET_DeptList()
+    this.GET_WarehouseList();
+    this.GET_DeptList();
     // this.GET_StationAllList()
-    this.GET_AdministratorList()
+    this.GET_AdministratorList();
   },
   computed: {
-    ...mapGetters(['user'])
+    ...mapGetters(["user"]),
   },
   methods: {
+    adminName(val) {
+      let text = "";
+      if (val !== undefined) {
+        text += codeToText[val[0]];
+        text += codeToText[val[1]];
+        text += codeToText[val[2]];
+      }
+      return text;
+    },
+    handleChange(value) {
+      this.stockForm.ware_pro_city_area = value.join(",");
+      /**/
+
+      //打印区域码所对应的属性值即中文地址
+    },
     /** 获取人员列表 */
     GET_AdministratorList() {
       API_Auth.getAdministratorList({
         page_no: 1,
         page_size: 9999,
-        user_state: 0
-      }).then(response => {
-        this.adminList = response.data
-      })
+        user_state: 0,
+      }).then((response) => {
+        this.adminList = response.data;
+      });
     },
     // /** 获取岗位 */
     // GET_StationAllList() {
@@ -117,100 +245,121 @@ export default {
     // },
     /** 获取部门 */
     GET_DeptList() {
-      API_Setting.getDeptList().then(response => {
-        this.deptList = Foundation.buildTree(response, '0')
-      })
+      API_Setting.getDeptList().then((response) => {
+        this.deptList = Foundation.buildTree(response, "0");
+      });
+      console.log(
+        JSON.parse(JSON.parse(localStorage.getItem("admin_user")).data)
+      );
     },
     /** 分页大小发生改变 */
     handlePageSizeChange(size) {
-      this.params.page_size = size
-      this.GET_WarehouseList()
+      this.params.page_size = size;
+      this.GET_WarehouseList();
     },
 
     /** 分页页数发生改变 */
     handlePageCurrentChange(page) {
-      this.params.page_no = page
-      this.GET_WarehouseList()
+      this.params.page_no = page;
+      this.GET_WarehouseList();
     },
 
     /** 添加仓库 */
     handleAddWarehouse() {
       this.stockForm = {
         dept_id: 0,
-        admin_id: this.user.uid
-      }
-      this.dialogVisible = true
+        admin_id: this.user.uid,
+      };
+      this.dialogVisible = true;
     },
 
     /** 编辑仓库 */
     handleEditWarehouse(index, row) {
-      this.stockForm = this.MixinClone(row)
-      this.dialogVisible = true
+      this.stockForm = row;
+      this.selectedOptions = row.ware_pro_city_area;
+      this.dialogVisible = true;
     },
 
     /** 删除仓库 */
     handleDeleteWarehouse(index, row) {
-      this.$confirm('确定要删除这个仓库吗?', '提示', { type: 'warning' }).then(() => {
-        API_BasicSetting.deleteWarehouse(row.id).then(() => {
-          this.$message.success('删除成功!')
-          this.GET_WarehouseList()
+      this.$confirm("确定要删除这个仓库吗?", "提示", { type: "warning" })
+        .then(() => {
+          API_BasicSetting.deleteWarehouse(row.id).then(() => {
+            this.$message.success("删除成功!");
+            this.GET_WarehouseList();
+          });
         })
-      }).catch(() => { })
+        .catch(() => {});
     },
     /** dialog打开后重置form表单校验结果 */
     handleDialogOpen() {
-      setTimeout(() => { this.$refs['stockForm'].clearValidate() })
+      setTimeout(() => {
+        this.$refs["stockForm"].clearValidate();
+      });
     },
 
     /** 提交仓库表单 */
     submitWarehouseForm() {
-      this.$refs['stockForm'].validate((valid) => {
+      this.$refs["stockForm"].validate((valid) => {
         if (valid) {
-          const { id } = this.stockForm
-          const params = this.MixinClone(this.stockForm)
-          if (!params.real_name) delete params.real_name
-          params.role_id === '超级仓库' ? params.role_id = 0 : null
-          delete params.admin_name
+          const { id } = this.stockForm;
+          const params = this.MixinClone(this.stockForm);
+          if (!params.real_name) delete params.real_name;
+          params.role_id === "超级仓库" ? (params.role_id = 0) : null;
+          delete params.admin_name;
+          params.admin_id = JSON.parse(
+            JSON.parse(localStorage.getItem("admin_user")).data
+          ).uid;
           if (id) {
-            API_BasicSetting.editWarehouse(id, params).then(response => {
-              this.dialogVisible = false
-              this.$message.success('修改成功!')
-              this.GET_WarehouseList()
-            })
+            API_BasicSetting.editWarehouse(id, params).then((response) => {
+              this.dialogVisible = false;
+              this.$message.success("修改成功!");
+              this.GET_WarehouseList();
+            });
           } else {
             API_BasicSetting.addWarehouse(params).then(() => {
-              this.dialogVisible = false
-              this.$message.success('添加成功!')
-              this.GET_WarehouseList()
-            })
+              this.dialogVisible = false;
+              this.$message.success("添加成功!");
+              this.GET_WarehouseList();
+            });
           }
         } else {
-          this.$message.error('表单填写有误,请核对!')
-          return false
+          this.$message.error("表单填写有误,请核对!");
+          return false;
         }
-      })
+      });
     },
 
     /** 搜索事件触发 */
     searchEvent(data) {
       this.params = {
         ...this.params,
-        keyword: data
-      }
-      this.params.page_no = 1
-      this.GET_WarehouseList()
+        keyword: data,
+      };
+      this.params.page_no = 1;
+      this.GET_WarehouseList();
     },
 
     /** 获取仓库列表 */
     GET_WarehouseList() {
-      this.loading = true
-      API_BasicSetting.warehouse(this.params).then(response => {
-        this.loading = false
-        this.tableData = response
-      }).catch(() => { this.loading = false })
-    }
-  }
-}
+      this.loading = true;
+      API_BasicSetting.warehouse(this.params)
+        .then((response) => {
+          this.loading = false;
+          response.data.map((el) => {
+            if (el.ware_pro_city_area !== undefined) {
+              el.ware_pro_city_area = el.ware_pro_city_area.split(",");
+            }
+            return el;
+          });
+          this.tableData = response;
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
+  },
+};
 </script>
 
 <style type="text/scss" lang="scss" scoped>

+ 391 - 0
manager-admin/src/views/stock/warehouseLocation.vue

@@ -0,0 +1,391 @@
+<template>
+  <div>
+    <en-table-layout :tableData="tableData" :loading="loading" @selection-change="handleSelectionChange">
+      <div slot="toolbar" class="inner-toolbar">
+        <div class="toolbar-btns">
+          <el-button size="mini" v-if="checkPermission(['goodsLend:add'])" type="primary"
+            @click="handleAddGoodsLend">新增</el-button>
+        </div>
+        <div class="toolbar-search">
+        </div>
+      </div>
+
+      <template slot="table-columns">
+        <el-table-column type="selection" width="55" />
+        <el-table-column prop="name" label="名称">
+        </el-table-column>
+        <el-table-column prop="remark" label="备注">
+          </el-table-column>
+        <el-table-column label="操作" width="250">
+          <template slot-scope="scope">
+            <el-button size="mini" v-if="checkPermission(['goodsLend:edit'])"
+              @click="handleEditGoodsLend(scope.row)">编辑</el-button>
+            <el-button type="success" size="mini"
+              v-if="checkPermission(['goodsLend:del'])"
+              @click="handleReturnGoodsLend(scope.row)">删除</el-button>
+          </template>
+        </el-table-column>
+      </template>
+
+      <!-- <el-pagination v-if="tableData" slot="pagination" @size-change="handlePageSizeChange"
+        @current-change="handlePageCurrentChange" :current-page="tableData.page_no" :page-sizes="[10, 20, 50, 100]"
+        :page-size="tableData.page_size" layout="total, sizes, prev, pager, next, jumper" :total="tableData.data_total">
+      </el-pagination> -->
+    </en-table-layout>
+    <el-dialog :title="title" :visible.sync="dialogVisibleForm"  width="940px" center @close='addHandleCancle'>
+        <el-form ref="addLendForm" :model="addLendForm" :rules="rules" label-width="90px">
+          <el-form-item label="编号" prop="code">
+            <el-input
+            placeholder="请输入编号"
+                v-model="addLendForm.code">
+              </el-input>
+          </el-form-item>
+          <el-form-item label="名称" prop="name">
+            <el-input
+            placeholder="请输入名称"
+                v-model="addLendForm.name">
+              </el-input>
+          </el-form-item>
+          <el-form-item label="备注">
+            <el-input
+                type="textarea"
+                :autosize="{ minRows: 2, maxRows: 4}"
+                placeholder="请输入内容"
+                v-model="addLendForm.remark">
+              </el-input>
+          </el-form-item>
+        </el-form>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="addHandleCancle ">取 消</el-button>
+          <el-button type="primary" @click="lendCommit">确 定</el-button>
+        </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import * as API_GoodsLend from '@/api/goodsLend'
+import Print from 'print-js'
+import * as API_Setting from '@/api/setting'
+import { Foundation } from '~/ui-utils'
+import QRCode from 'qrcodejs2'
+export default {
+  name: 'goodsLend',
+  data() {
+    return {
+      warehouseSn:"",
+      warehouseList: [],
+      // 列表loading状态
+      loading: false,
+      // 列表参数
+      params: {
+        page_no: 1,
+        page_size: 10
+      },
+      // 高级搜索数据
+      advancedForm: {},
+      // 列表数据
+      tableData: '',
+      dialogVisible: false,
+      // 当前已选择的行
+      multipleSelection: [],
+      goodsLendForm: {},
+      codeList:[],
+      title:"",
+      dialogVisibleForm:false,
+      // 新增数据
+      addLendForm:{
+        name:"",
+        remark:""
+      },
+      rules: {
+          name: [
+            { required: true, message: '请选择输入名称', trigger: 'blur' }
+          ],
+          code:[
+          { required: true, message: '请选择输入编号', trigger: 'blur' }
+          ]
+        },
+        typeList:[],
+        id:''
+    }
+  },
+  mounted() {
+    this.GET_GoodsLendList()
+    this.GET_DeptList()
+  },
+  watch: {
+    $route: {
+      immediate: true,
+      handler(newVal) {
+        if (newVal.query.status) {
+          this.params.status = newVal.query.status
+          this.advancedForm.status = newVal.query.status
+        }
+        this.params.page_no = 1
+        this.GET_GoodsLendList()
+      }
+    }
+  },
+  methods: {
+    ceshi(){
+      this.$router.push({name:"demo"})
+    },
+    gowareHouse(){
+      this.dialogVisibleForm=false
+      this.$router.push({ name: 'warehouseList'})
+    },
+    /* 选中仓库 */
+    selWarehouse(val){
+      const list=this.warehouseList.filter(el=>{
+        return el.id===val
+      })
+      let obj = list[0]
+      this.warehouseSn=obj.sn
+    },
+    // 确认提交
+    lendCommit(){
+      this.$refs.addLendForm.validate((valid) => {
+      if (valid) {
+        if(this.title==='新增'){
+          this.addLendForm.code=this.warehouseSn+"-"+this.addLendForm.code
+           API_GoodsLend.addCreateAreaType(this.addLendForm).then(res=>{
+            this.$message.success('添加成功!')
+            this.dialogVisibleForm=false
+            this.warehouseSn=""
+            this.addLendForm={}
+            this.GET_GoodsLendList()
+           })
+        }else if(this.title==='编辑'){
+          API_GoodsLend.editUpdateAreaType(this.id,this.addLendForm).then(res=>{
+            this.$message.success('修改成功!')
+            this.dialogVisibleForm=false
+            this.id=''
+            this.addLendForm={}
+            this.GET_GoodsLendList()
+           })
+        }
+      } else {
+        this.$message.error('提交失败')
+        return false;
+      }
+    })
+
+    },
+    addHandleCancle(){
+      this.dialogVisibleForm=false
+      this.addLendForm={}
+    },
+    handleCancle () {
+      this.dialogVisible = false
+      this.codeList=[]
+    },
+    // 二维码生成
+    creatQrCode() {
+      this.$nextTick(() => {
+          this.codeList.forEach((item,index)=>{
+            this.$refs.codeItem[index].innerHTML="";
+              var qrcode = new QRCode(this.$refs.codeItem[index], {
+                text: item, //二维码内容
+                width: 600,
+                height: 660,
+                render: 'table',
+                colorDark: "#333333", //二维码颜色
+                colorLight: "#ffffff", //二维码背景色
+                correctLevel : QRCode.CorrectLevel.H
+              })
+          });
+        },500)
+    },
+    handleEditGoodsLend(row) {
+      this.id=row.id
+      this.title="编辑"
+      this.addLendForm=row
+      this.dialogVisibleForm=true
+      // this.$router.push({ name: 'goodsLendEdit', params: { id: row.id }})
+    },
+    handleReturnGoodsLend(row) {
+      this.$confirm('确定要删除吗?', '提示', { type: 'warning' }).then(() => {
+        API_GoodsLend.removeAreaType(row.id).then(() => {
+          this.$message.success('删除成功!')
+          this.GET_GoodsLendList()
+        })
+      }).catch(() => { })
+    },
+    /** 状态 */
+    statusFilter(val) {
+      const obj=this.typeList.filter(el=>{
+        return el.value===val
+      })
+      if(obj.length !== 0){
+        return obj[0].label
+      }else{
+        return ""
+      }
+
+    },
+    handleConfirmGoodsLend() {
+      if (!this.multipleSelection || !this.multipleSelection.length) return this.$message.error('请先选择!')
+        const ids = this.multipleSelection.map(item => item.code)
+        this.codeList=ids
+        this.dialogVisible = true
+        this.creatQrCode()
+
+    },
+    /** 获取部门 */
+    GET_DeptList() {
+      API_Setting.getListAll().then(response => {
+        this.warehouseList = response
+        console.log(response);
+      })
+      API_Setting.getPage({dictType:"Warehouse_location_type",page_no: 1,page_size: 50}).then(res=>{
+        this.typeList=res.data
+      })
+    },
+    /** 打印对账详情 */
+    handlePrintGoodsLend() {
+      Print({
+        printable: 'deliverySheet',
+        type: 'html',
+        targetStyles: ['*'],
+        //style: 'body, html {font-size:300px !important;color:red;}', // 确保打印时应用这个样式
+        ignoreElements: ['no-logs', 'goods-image', 'no-btn','elementToIgnore']
+      })
+    },
+    handleDeleteGoodsLend() {
+      if (!this.multipleSelection || !this.multipleSelection.length) return this.$message.error('请先选择!')
+      this.$confirm('确定要删除这些借出单吗?', '提示', { type: 'warning' }).then(() => {
+        const ids = this.multipleSelection.map(item => item.id)
+        API_GoodsLend.deleteGoodsLend(ids).then(() => {
+          this.$message.success('删除成功!')
+          this.GET_GoodsLendList()
+        })
+      }).catch(() => { })
+    },
+    /** 多选改变 */
+    handleSelectionChange(val) {
+      this.multipleSelection = val
+    },
+    /** 分页大小发生改变 */
+    handlePageSizeChange(size) {
+      this.params.page_size = size
+      this.GET_GoodsLendList()
+    },
+
+    /** 分页页数发生改变 */
+    handlePageCurrentChange(page) {
+      this.params.page_no = page
+      this.GET_GoodsLendList()
+    },
+
+    /** 添加调整单 */
+    handleAddGoodsLend() {
+      this.title="新增"
+      this.dialogVisibleForm=true
+      // this.$router.push({ name: 'goodsLendAdd'})
+    },
+    /** 打印调整单 */
+    handlePrintGoodsLendDialog(row) {
+      // this.GET_GoodsLendDetail(row.id)
+      this.dialogVisible = true
+      this.codeList.push(row.code)
+        this.creatQrCode()
+    },
+    /** 获取调整单详情页面数据 */
+    GET_GoodsLendDetail(id) {
+      API_GoodsLend.getGoodsLendInfo(id).then(response => {
+        this.goodsLendForm = response
+        if (response.product_list && response.product_list.length) {
+          var str = ''
+          response.product_list.forEach(function(i) {
+            str += i.product_name + '、'
+          })
+        }
+        // 生成库位号二维码
+        this.goodsLendForm.illustrate = str
+
+
+      })
+    },
+    /** 搜索事件触发 */
+    searchEvent(data) {
+      this.params = {
+        ...this.params,
+        sn: data
+      }
+      Object.keys(this.advancedForm).forEach((key) => delete this.params[key])
+      this.params.page_no = 1
+      this.GET_GoodsLendList()
+    },
+    /** 高级搜索事件触发 */
+    advancedSearchEvent() {
+      this.params = {
+        ...this.params,
+        ...this.advancedForm
+      }
+      delete this.params.start_time
+      delete this.params.end_time
+      if (this.advancedForm.goodsLend_time_range) {
+        this.params.start_time = parseInt(Number(this.advancedForm.goodsLend_time_range[0]) / 1000)
+        this.params.end_time = parseInt(Number(this.advancedForm.goodsLend_time_range[1]) / 1000)
+      }
+      delete this.params.goodsLend_time_range
+      this.params.page_no = 1
+      this.GET_GoodsLendList()
+    },
+    /** 获取库存区域列表 */
+    GET_GoodsLendList() {
+      this.loading = true
+      API_GoodsLend.getListAreaType().then(response => {
+        this.loading = false
+        this.tableData = response
+      }).catch(() => { this.loading = false })
+    }
+  }
+}
+</script>
+
+<style type="text/scss" lang="scss" scoped>
+.print {
+  margin-left: 790px;
+}
+
+.tips-t {
+  display: flex;
+  padding: 10px 0;
+
+  div {
+    flex: 1;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    flex-direction: column;
+  }
+}
+
+.tips-f {
+  padding: 20px 0;
+}
+
+.face-image {
+  display: block;
+  width: 50px;
+  height: 50px;
+  margin: 0 auto;
+}
+
+/*  /deep/ .el-dialog__body {
+  padding: 10px 20px;
+}
+/deep/.el-form{
+    .el-form-item__content{
+    display: flex;
+  }
+} */
+/* @media print {
+  html, body {
+    font-size: 60pt !important;
+    color: red;
+  }
+} */
+</style>

+ 1 - 1
ui-domain/api.js

@@ -9,7 +9,7 @@
 module.exports = {
   // 开发环境 192.168.8.107:9999 apidoc.raycos.net
   dev: {
-    admin: window.__ENV__.API_ADMIN || 'http://192.168.100.106:9999'
+    admin: window.__ENV__.API_ADMIN || 'http://192.168.100.110:9999'
   },
   // 测试环境
   test: {