瀏覽代碼

feat: 对接入库退货

linwenxin 1 年之前
父節點
當前提交
12a7e8c62c

+ 6 - 0
src/api/purchasingManagement.js

@@ -48,6 +48,9 @@ export function websitPurchaseInDetail(params) {
   })
 }
 
+export function websitPurchaseInImport(data) {
+  return handleImport('/websit/purchase/in/import', data.formdata, data.id || '')
+}
 
 
 
@@ -58,6 +61,9 @@ export function websitPurchaseInDetail(params) {
 
 
 
+export function websitPurchaseRetImport(data) {
+  return handleImport('/websit/purchase/ret/import', data.formdata, data.id || '')
+}
 
 
 

+ 299 - 0
src/components/geographicalPosi/index.vue

@@ -0,0 +1,299 @@
+<template>
+  <div class="withinLine">
+    <el-button :disabled="disabled" type="primary" size="mini" @click="open">地理定位</el-button>
+    <el-dialog
+      title="地理定位"
+      custom-class="address_map"
+      :visible.sync="dialogVisible"
+      :append-to-body="true"
+      width="1000px"
+      :before-close="handleClose"
+    >
+      <template v-if="dialogVisible">
+        <div>
+          <el-row :gutter="20">
+            <el-col :xs="24" :sm="24" :lg="24">
+              <div class="teshubuju">
+                <el-autocomplete
+                  style="width: 100%; margin-right: 10px"
+                  v-model="queryString"
+                  placeholder="请输入内容"
+                  :fetch-suggestions="querySearchAsync"
+                  @select="handleSelect"
+                ></el-autocomplete>
+                <el-button
+                  size="mini"
+                  type="primary"
+                  @click="
+                    () => {
+                      querySearchAsync(queryString)
+                    }
+                  "
+                  >查询</el-button
+                >
+              </div>
+            </el-col>
+          </el-row>
+        </div>
+        <br />
+        <div style="height: calc(100% - 45px); position: relative">
+          <zj-amap-polygon
+            @getGeocoder="getGeocoder"
+            :markers="markers"
+            :zoom="zoom"
+            :center="center"
+            :electronicFence="false"
+          >
+            <template #marker="{ marker }">
+              <i class="el-icon-location-outline IP_font"></i>
+              <div class="IP">
+                <div>地址:{{ marker.name }}</div>
+                <div>经度:{{ marker.center[0] }}</div>
+                <div>维度:{{ marker.center[1] }}</div>
+              </div>
+            </template>
+          </zj-amap-polygon>
+          <!-- 周边数据 -->
+          <div class="zhoubian">
+            <div class="zhoubianItem" v-for="(item, index) in mapzhoubian" :key="index" @click="zhoubiandw(item)">
+              <div class="zhoubianItemview">
+                <i class="el-icon-location-outline"></i>
+                <div>
+                  <div style="font-weight: bold; margin-bottom: 8px; box-sizing: border-box; padding: 0px 5px">
+                    {{ item.pname }}{{ item.cityname }}{{ item.adname }}{{ item.address }}
+                  </div>
+                  <div>地址:{{ item.name }}</div>
+                </div>
+                <div>
+                  <template v-for="(p, i) in item.photos || []">
+                    <img :key="i" v-if="i === 0" :src="seturl(p.url)" />
+                  </template>
+                </div>
+              </div>
+            </div>
+          </div>
+        </div>
+        <span slot="footer" class="dialog-footer">
+          <el-button size="mini" @click="handleClose">取 消</el-button>
+          <el-button size="mini" type="primary" @click="sub">提交</el-button>
+        </span>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { getLocation, getAddress, supervisorChangeList, axiosMapZb } from '@/utils/lbs'
+export default {
+  props: {
+    formData: { type: Object, default: () => ({}) },
+    disabled: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data() {
+    return {
+      dialogVisible: false,
+      loading: false,
+      center: [113.36242, 23.1368425],
+      zoom: 16.7,
+      markers: [],
+      mapSearchList: [],
+      mapzhoubian: [],
+      queryString: ''
+    }
+  },
+  watch: {
+    'formData.gpsAddress'() {
+      if (this.markers[0] && this.markers[0].name !== this.formData.gpsAddress) {
+        Object.assign(this.$data, this.$options.data())
+      }
+    }
+  },
+  methods: {
+    seturl(url) {
+      if (~url.indexOf('https://')) {
+        return url
+      } else {
+        return url.replace('http://', 'https://')
+      }
+    },
+    async open() {
+      this.dialogVisible = true
+      if (this.formData.lng && this.formData.lat && this.formData.gpsAddress) {
+        this.changeSearchMapFn(`${this.formData.lng}//${this.formData.lat}//${this.formData.gpsAddress}`)
+      } else {
+        var str = ''
+        if (!~(this.formData.gpsAddress || '').indexOf(this.formData.province)) {
+          str += this.formData.province || ''
+        }
+        if (!~(this.formData.gpsAddress || '').indexOf(this.formData.city)) {
+          str += this.formData.city || ''
+        }
+        if (!~(this.formData.gpsAddress || '').indexOf(this.formData.area)) {
+          str += this.formData.area || ''
+        }
+        if (!~(this.formData.gpsAddress || '').indexOf(this.formData.street)) {
+          str += this.formData.street || ''
+        }
+        str += this.formData.gpsAddress || ''
+        await this.remoteMethod(str)
+        if (this.mapSearchList.length) {
+          var v = this.mapSearchList[0]
+          this.changeSearchMapFn(`${v.location.KL}//${v.location.kT}//${v.formattedAddress}`)
+        }
+      }
+    },
+    async querySearchAsync(queryString, cb) {
+      if (!queryString) {
+        cb && cb([])
+      } else {
+        var res = await supervisorChangeList(queryString)
+        var list = res.tips.map(item => {
+          return {
+            ...item,
+            value: item.district + item.name + item.address
+          }
+        })
+        if (cb) {
+          cb(list)
+        } else if (list.length) {
+          this.handleSelect(list[0])
+        }
+      }
+    },
+    async handleSelect(item) {
+      this.center = [item.location.lng, item.location.lat]
+      var data = await getAddress(this.center)
+      this.markers = [
+        {
+          id: '',
+          name: item.value,
+          center: [item.location.lng, item.location.lat],
+          data: {
+            ...data,
+            formattedAddress: item.value
+          }
+        }
+      ]
+      this.getAxiosMapZb(this.center)
+    },
+    zhoubiandw(item) {
+      this.changeSearchMapFn(
+        `${item.location.split(',').join('//')}//${
+          item.pname + item.cityname + item.adname + item.name + item.address
+        }`,
+        false
+      )
+    },
+    async changeSearchMapFn(value, bool = true) {
+      let res = value.split('//')
+      var data = await getAddress([Number(res[0]), Number(res[1])])
+      this.queryString = res[2]
+      this.markers = [
+        {
+          id: '',
+          name: res[2],
+          center: [res[0], res[1]],
+          data
+        }
+      ]
+      this.center = [res[0], res[1]]
+      if (bool) {
+        this.getAxiosMapZb(this.center)
+      }
+    },
+    async remoteMethod(query) {
+      if (query !== '') {
+        this.loading = true
+        this.mapSearchList = await getLocation(query)
+        this.loading = false
+      } else {
+        this.workerList = []
+      }
+    },
+    async getAxiosMapZb(center = []) {
+      axiosMapZb({
+        location: center.join(',')
+      })
+        .then(res => {
+          this.mapzhoubian = res.data.pois
+        })
+        .catch(err => {
+          console.log(err)
+        })
+    },
+    getGeocoder(data) {
+      this.markers = [
+        {
+          id: '',
+          name: data.formattedAddress,
+          center: data.center,
+          data
+        }
+      ]
+      this.changeSearchMapFn(`${data.center[0]}//${data.center[1]}//${data.formattedAddress}`)
+    },
+    handleClose(done) {
+      this.dialogVisible = false
+    },
+    sub() {
+      this.$emit('selectPosi', this.markers[0])
+      this.handleClose()
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+::v-deep .address_map {
+  margin: 0 !important;
+  width: 100% !important;
+  height: 100% !important;
+  & > .el-dialog__body {
+    width: 100% !important;
+    height: calc(100% - 54px - 58px) !important;
+    overflow-y: auto;
+  }
+}
+.IP_font {
+  font-size: 28px;
+  color: #409eff;
+  position: absolute;
+  left: -13px;
+  top: -25px;
+}
+.IP {
+  width: 15vw;
+  background-color: #fff;
+  padding: 6px 0 6px 6px;
+}
+.teshubuju {
+  display: flex;
+}
+.zhoubian {
+  width: 320px;
+  max-height: 100%;
+  position: absolute;
+  right: 0;
+  top: 0;
+  overflow-y: auto;
+  .zhoubianItem {
+    width: 100%;
+    height: auto;
+    box-sizing: border-box;
+    padding: 16px 8px;
+    border-bottom: 1px solid #aaa;
+    background: #fff;
+    cursor: pointer;
+    .zhoubianItemview {
+      display: flex;
+      justify-content: space-between;
+      img {
+        width: 100px;
+      }
+    }
+  }
+}
+</style>

+ 25 - 6
src/views/auxiliaryFittings/purchasingManagement/components/inStorage.vue

@@ -15,8 +15,10 @@
         </zj-form-container>
         <div slot="footer" class="dialog-footer">
           <el-button size="mini" @click="formCancel">取 消</el-button>
-          <el-button size="mini" @click="formConfirm" type="primary">确 定</el-button>
-          <el-button size="mini" @click="passExamination" type="primary">审核通过</el-button>
+          <el-button v-if="~[0, 1].indexOf(formDialogType)" size="mini" @click="formConfirm" type="primary">确
+            定</el-button>
+          <el-button v-if="~[3].indexOf(formDialogType)" size="mini" @click="passExamination"
+            type="primary">审核通过</el-button>
         </div>
       </el-dialog>
     </div>
@@ -47,7 +49,7 @@ export default {
         "createBy": "",
         "createTime": "",
         "flag": "",
-        "goodsType": "",
+        "goodsType": this.storageType,
         "purchaseId": "",
         "purchaseTime": "",
         "remark": "",
@@ -94,7 +96,13 @@ export default {
     },
     getDetail(purchaseId, type) {
       websitPurchaseInDetail({ purchaseId }).then(res => {
-        Object.assign(this.formData, res.data)
+        Object.assign(this.formData, res.data, {
+          imageUrl: res.data.imageUrl ? [{ url: res.data.imageUrl }] : [],
+          items: res.data.items.map(item => ({
+            ...item,
+            isEditRow: false
+          }))
+        })
         this.formDialogType = type
         this.openForm()
       })
@@ -102,7 +110,11 @@ export default {
     formConfirm() {
       this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
         if (valid) {
-          ([websitPurchaseInAdd, websitPurchaseInEdit][this.formDialogType])(this.formData).then(res => {
+          ([websitPurchaseInAdd, websitPurchaseInEdit][this.formDialogType])({
+            ...this.formData,
+            "goodsType": this.storageType,
+            imageUrl: this.formData.imageUrl.map(item => item.url).join(",")
+          }).then(res => {
             this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
             this.formCancel()
             this.$refs.pageRef.refreshList()
@@ -125,4 +137,11 @@ export default {
 }
 </script>
 
-<style lang="scss" scoped></style>
+<style lang="scss">
+.redbordererr {
+  .el-form-item {
+    margin: 0 !important;
+    overflow: hidden;
+  }
+}
+</style>

+ 26 - 6
src/views/auxiliaryFittings/purchasingManagement/components/retStorage.vue

@@ -15,8 +15,10 @@
         </zj-form-container>
         <div slot="footer" class="dialog-footer">
           <el-button size="mini" @click="formCancel">取 消</el-button>
-          <el-button size="mini" @click="formConfirm" type="primary">确 定</el-button>
-          <el-button size="mini" @click="passExamination" type="primary">审核通过</el-button>
+          <el-button v-if="~[0, 1].indexOf(formDialogType)" size="mini" @click="formConfirm" type="primary">确
+            定</el-button>
+          <el-button v-if="~[3].indexOf(formDialogType)" size="mini" @click="passExamination"
+            type="primary">审核通过</el-button>
         </div>
       </el-dialog>
     </div>
@@ -47,7 +49,7 @@ export default {
         "createBy": "",
         "createTime": "",
         "flag": "",
-        "goodsType": "",
+        "goodsType": this.storageType,
         "purchaseId": "",
         "purchaseRetId": "",
         "remark": "",
@@ -96,7 +98,13 @@ export default {
     },
     getDetail(purchaseRetId, type) {
       websitPurchaseRetDetail({ purchaseRetId }).then(res => {
-        Object.assign(this.formData, res.data)
+        Object.assign(this.formData, res.data, {
+          imageUrl: res.data.imageUrl ? [{ url: res.data.imageUrl }] : [],
+          items: res.data.items.map(item => ({
+            ...item,
+            isEditRow: false
+          }))
+        })
         this.formDialogType = type
         this.openForm()
       })
@@ -104,7 +112,11 @@ export default {
     formConfirm() {
       this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
         if (valid) {
-          ([websitPurchaseRetAdd, websitPurchaseRetEdit][this.formDialogType])(this.formData).then(res => {
+          ([websitPurchaseRetAdd, websitPurchaseRetEdit][this.formDialogType])({
+            ...this.formData,
+            "goodsType": this.storageType,
+            imageUrl: this.formData.imageUrl.map(item => item.url).join(","),
+          }).then(res => {
             this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
             this.formCancel()
             this.$refs.pageRef.refreshList()
@@ -127,4 +139,12 @@ export default {
 }
 </script>
 
-<style lang="scss" scoped></style>
+<style lang="scss">
+.redbordererr {
+  .el-form-item {
+    margin: 0 !important;
+    overflow: hidden;
+  }
+}
+</style>
+

+ 460 - 89
src/views/auxiliaryFittings/purchasingManagement/mixins/form_tpl.js

@@ -1,6 +1,12 @@
 import ImageUpload from '@/components/file-upload'
 import { getWebsit } from "@/api/customerManagement.js"
 import { listPageV2 } from "@/api/auxiliaryFittings/supplier";
+import { materialCategoryList } from "@/api/auxiliaryMaterialClass";
+import { materialNormList } from "@/api/auxiliaryPriceManagement";
+import { listPageV2 as peijianList } from "@/api/auxiliaryFittings/attachmentProfile";
+import { websitPurchaseInList, websitPurchaseInImport, websitPurchaseRetImport, websitPurchaseInDetail } from "@/api/purchasingManagement.js"
+import { commonTemplateDownload } from '@/api/common.js'
+import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
 export default {
   data() {
     return {
@@ -15,6 +21,64 @@ export default {
             }
           ],
         ],
+        [
+          [
+            {
+              isRole: !!~['auxiliaryMaterialsStorage'].indexOf(this?.$route?.name),
+              name: '采购入库模板',
+              click: () => {
+                commonTemplateDownload({ name: '采购入库模板.xlsx' }, `${this.$route.meta.title}`)
+                  .then(res => {
+                    this.$message({
+                      message: '下载成功',
+                      type: 'success'
+                    })
+                  })
+                  .catch(err => {
+                    this.$message.error('下载失败')
+                  })
+              }
+            }
+          ],
+          [
+            {
+              isRole: !!~['auxiliaryMaterialsStorage'].indexOf(this?.$route?.name),
+              name: '导入模板',
+              render: () => {
+                return this.importButton(websitPurchaseInImport, '导入模板')
+              }
+            }
+          ],
+        ],
+        [
+          [
+            {
+              isRole: !!~['partsStorage'].indexOf(this?.$route?.name),
+              name: '采购退货模板',
+              click: () => {
+                commonTemplateDownload({ name: '采购退货模板.xlsx' }, `${this.$route.meta.title}`)
+                  .then(res => {
+                    this.$message({
+                      message: '下载成功',
+                      type: 'success'
+                    })
+                  })
+                  .catch(err => {
+                    this.$message.error('下载失败')
+                  })
+              }
+            }
+          ],
+          [
+            {
+              isRole: !!~['partsStorage'].indexOf(this?.$route?.name),
+              name: '导入模板',
+              render: () => {
+                return this.importButton(websitPurchaseRetImport, '导入模板')
+              }
+            }
+          ],
+        ],
       ],
       // 表格属性
       tableAttributes: {
@@ -30,6 +94,11 @@ export default {
       formDialogType: 0, // 0:新增, 1:编辑, 2:查看, 3:审核
       formDialogTitles: ['新增', '编辑', '查看', '审核'],
       pageType: this?.$route?.name,
+      materialCategoryListL1: [],
+      materialCategoryListL2: [],
+      materialNormList: [],
+      peijianList: [],
+      websitPurchaseInList: []
     }
   },
   computed: {
@@ -71,10 +140,31 @@ export default {
               render: (h, { row, column, index }) => {
                 return (
                   row.isEditRow ?
-                    <el-select value={row[column.prop]} onInput={(val) => { row[column.prop] = val }} placeholder="请选择">
-                      {[].map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
-                    </el-select> :
-                    <div>{row[column.prop]}</div>
+                    <div class="redbordererr">
+                      <el-form-item label="" lebel-width="0px" prop={`items.${index}.parentCategoryId`} rules={required}>
+                        <el-select
+                          value={row[column.columnAttributes.prop]}
+                          onInput={(val) => { row[column.columnAttributes.prop] = val }}
+                          onChange={(val) => {
+                            row['goodsCategoryId'] = ""
+                            row['goodsCategoryName'] = ""
+                            row['goodsId'] = ""
+                            row['goodsName'] = ""
+                            this.materialNormList = [];
+                            this.qkrow(row)
+                            if (val) {
+                              row['parentCategoryName'] = this.materialCategoryListL1.find(item => item.categoryId == val).categoryName
+                            } else {
+                              row['parentCategoryName'] = ''
+                            }
+                          }}
+                          placeholder="请选择">
+                          {this.materialCategoryListL1.map((item, index_) => <el-option key={index_} label={item.categoryName} value={item.categoryId}></el-option>)}
+                        </el-select>
+                      </el-form-item>
+                    </div>
+                    :
+                    <div>{row['parentCategoryName']}</div>
                 )
               }
             }]
@@ -89,12 +179,35 @@ export default {
                 prop: 'goodsCategoryId',
               },
               render: (h, { row, column, index }) => {
+                var selectList = row['parentCategoryId'] ? this.materialCategoryListL2.filter(item => item.parentCategoryId == row['parentCategoryId']) : []
                 return (
                   row.isEditRow ?
-                    <el-select value={row[column.prop]} onInput={(val) => { row[column.prop] = val }} placeholder="请选择">
-                      {[].map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
-                    </el-select> :
-                    <div>{row[column.prop]}</div>
+                    <div class="redbordererr">
+                      <el-form-item label="" lebel-width="0px" prop={`items.${index}.goodsCategoryId`} rules={required}>
+                        <el-select
+                          value={row[column.columnAttributes.prop]}
+                          onInput={(val) => { row[column.columnAttributes.prop] = val }}
+                          placeholder="请选择"
+                          onChange={(val) => {
+                            row['goodsId'] = ""
+                            row['goodsName'] = ""
+                            this.qkrow(row)
+                            if (val) {
+                              row['goodsCategoryName'] = selectList.find(item => item.categoryId == val).categoryName
+                              materialNormList({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "b.category_id", "compare": "=", "value": val }] }).then(res => {
+                                this.materialNormList = res.data.records
+                              })
+                            } else {
+                              this.materialNormList = [];
+                              row['goodsCategoryName'] = ''
+                            }
+                          }}>
+                          {selectList.map((item, index_) => <el-option key={index_} label={item.categoryName} value={item.categoryId}></el-option>)}
+                        </el-select>
+                      </el-form-item>
+                    </div>
+                    :
+                    <div>{row['goodsCategoryName']}</div>
                 )
               }
             }]
@@ -105,16 +218,43 @@ export default {
           if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials'].indexOf(this.pageType)) {
             return [{
               columnAttributes: {
-                label: '辅材名称',
-                prop: 'goodsName',
+                label: '辅材',
+                prop: 'goodsId',
               },
               render: (h, { row, column, index }) => {
                 return (
                   row.isEditRow ?
-                    <el-select value={row[column.prop]} onInput={(val) => { row[column.prop] = val }} placeholder="请选择">
-                      {[].map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
-                    </el-select> :
-                    <div>{row[column.prop]}</div>
+                    <div class="redbordererr">
+                      <el-form-item label="" lebel-width="0px" prop={`items.${index}.goodsId`} rules={required}>
+                        <el-select
+                          value={row[column.columnAttributes.prop]}
+                          onInput={(val) => { row[column.columnAttributes.prop] = val }}
+                          placeholder="请选择"
+                          onChange={(val) => {
+                            if (val) {
+                              var data = this.materialNormList.find(item => item.goodsId == val)
+                              row['goodsName'] = data.goodsName
+                              this.qkrow(row, {
+                                "goodsStockUnit": data.goodsStockUnit,
+                                "goodsCode": data.goodsCode,
+                                "goodsSpecification": data.goodsSpecification,
+                                "brand": "",
+                                "productCategory": "",
+                                "cost": data.cost,
+                                "costValue": "",
+                                "stockQty": data.stockQty
+                              })
+                            } else {
+                              row['goodsName'] = ''
+                              this.qkrow(row)
+                            }
+                          }}>
+                          {this.materialNormList.map((item, index_) => <el-option key={index_} label={item.goodsName} value={item.goodsId}></el-option>)}
+                        </el-select>
+                      </el-form-item>
+                    </div>
+                    :
+                    <div>{row['goodsName']}</div>
                 )
               }
             }]
@@ -125,16 +265,45 @@ export default {
           if (!!~['partsStorage', 'partsReturn'].indexOf(this.pageType)) {
             return [{
               columnAttributes: {
-                label: '配件名称',
-                prop: 'goodsName',
+                label: '配件',
+                prop: 'goodsId',
               },
               render: (h, { row, column, index }) => {
                 return (
                   row.isEditRow ?
-                    <el-select value={row[column.prop]} onInput={(val) => { row[column.prop] = val }} placeholder="请选择">
-                      {[].map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
-                    </el-select> :
-                    <div>{row[column.prop]}</div>
+                    <div class="redbordererr">
+                      <el-form-item label="" lebel-width="0px" prop={`items.${index}.goodsId`} rules={required}>
+                        <el-select
+                          value={row[column.columnAttributes.prop]}
+                          onInput={(val) => { row[column.columnAttributes.prop] = val }}
+                          placeholder="请选择"
+                          onChange={(val) => {
+                            this.materialNormList = [];
+                            if (val) {
+                              var data = this.peijianList.find(item => item.goodsId == val)
+                              row['goodsName'] = data.goodsName
+                              console.log(data)
+                              this.qkrow(row, {
+                                "goodsStockUnit": data.goodsStockUnit,
+                                "goodsCode": data.goodsCode,
+                                "goodsSpecification": data.goodsSpecification,
+                                "brand": data.brandRelaName,
+                                "productCategory": data.productRelaName,
+                                "cost": data.cost,
+                                "costValue": "",
+                                "stockQty": data.stockQty
+                              })
+                            } else {
+                              row['goodsName'] = ''
+                              this.qkrow(row)
+                            }
+                          }}>
+                          {this.peijianList.map((item, index_) => <el-option key={index_} label={item.goodsName} value={item.goodsId}></el-option>)}
+                        </el-select>
+                      </el-form-item>
+                    </div>
+                    :
+                    <div>{row['goodsName']}</div>
                 )
               }
             }]
@@ -162,9 +331,25 @@ export default {
               render: (h, { row, column, index }) => {
                 return (
                   row.isEditRow ?
-                    <el-input type="number" value={row[column.prop]} onInput={(val) => { row[column.prop] = val }} placeholder="请选择">
-                    </el-input> :
-                    <div>{row[column.prop]}</div>
+                    <div class="redbordererr">
+                      <el-form-item label="" lebel-width="0px" prop={`items.${index}.recQty`} rules={required}>
+                        <el-input
+                          type="number"
+                          value={row[column.columnAttributes.prop]}
+                          onInput={(val) => {
+                            row[column.columnAttributes.prop] = val
+                            if (val) {
+                              row.costValue = Number(row.cost) * Number(val)
+                            } else {
+                              row.costValue = ""
+                            }
+                          }}
+                          placeholder="请选择">
+                        </el-input>
+                      </el-form-item>
+                    </div>
+                    :
+                    <div>{row[column.columnAttributes.prop]}</div>
                 )
               }
             }]
@@ -181,9 +366,25 @@ export default {
               render: (h, { row, column, index }) => {
                 return (
                   row.isEditRow ?
-                    <el-input type="number" value={row[column.prop]} onInput={(val) => { row[column.prop] = val }} placeholder="请选择">
-                    </el-input> :
-                    <div>{row[column.prop]}</div>
+                    <div class="redbordererr">
+                      <el-form-item label="" lebel-width="0px" prop={`items.${index}.retQty`} rules={required}>
+                        <el-input
+                          type="number"
+                          value={row[column.columnAttributes.prop]}
+                          onInput={(val) => {
+                            row[column.columnAttributes.prop] = val
+                            if (val) {
+                              row.retValue = Number(row.cost) * Number(val)
+                            } else {
+                              row.retValue = ""
+                            }
+                          }}
+                          placeholder="请选择">
+                        </el-input>
+                      </el-form-item>
+                    </div>
+                    :
+                    <div>{row[column.columnAttributes.prop]}</div>
                 )
               }
             }]
@@ -196,14 +397,6 @@ export default {
               columnAttributes: {
                 label: '退款金额',
                 prop: 'retValue',
-              },
-              render: (h, { row, column, index }) => {
-                return (
-                  row.isEditRow ?
-                    <el-input type="number" value={row[column.prop]} onInput={(val) => { row[column.prop] = val }} placeholder="请选择">
-                    </el-input> :
-                    <div>{row[column.prop]}</div>
-                )
               }
             }]
           }
@@ -322,17 +515,33 @@ export default {
                       this.formData.items.splice(index, 1)
                     }}>删除</el-button>
                     {
+                      row.isEditRow ?
+                        <el-button type="text" onClick={() => {
+                          this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
+                            if (valid) {
+                              this.formData.items[index].isEditRow = false
+                            }
+                          })
+                        }}>确定</el-button> :
+                        null
+                    }
+                    {
                       !row.isEditRow ?
-                      <el-button type="text" onClick={() => {
-                        this.formData.items.map((item, index_) => {
-                          if (index_ == index) {
-                            item.isEditRow = true
-                          } else {
-                            item.isEditRow = false
-                          }
-                        })
-                      }}>编辑</el-button> :
-                      null
+                        <el-button type="text" onClick={() => {
+                          this.formData.items.map((item, index_) => {
+                            if (index_ == index) {
+                              item.isEditRow = true
+                            } else {
+                              item.isEditRow = false
+                            }
+                            if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials'].indexOf(this.pageType) && row.goodsCategoryId) {
+                              materialNormList({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "b.category_id", "compare": "=", "value": row.goodsCategoryId }] }).then(res => {
+                                this.materialNormList = res.data.records
+                              })
+                            }
+                          })
+                        }}>编辑</el-button> :
+                        null
                     }
                   </div>
                 )
@@ -371,21 +580,88 @@ export default {
                 </el-descriptions>
                 <el-descriptions border title="" column={2} colon={false} labelStyle={{ width: '8%' }} contentStyle={{ width: '42%' }} style="margin-top:-1px">
                   <el-descriptions-item label="网点名称">
-                    <el-select style="width:100%" value={this.formData.websitId} onInput={(val) => { this.formData.websitId = val }} placeholder="请选择">
-                      {this.getWebsitList.map(item => <el-option key={item.websitId} label={item.name} value={item.websitId}></el-option>)}
-                    </el-select>
+                    <div class="redbordererr">
+                      <el-form-item label="" lebel-width="0px" prop={`websitId`} rules={required}>
+                        <el-select
+                          style="width:100%"
+                          value={this.formData.websitId} onInput={(val) => { this.formData.websitId = val }}
+                          placeholder="请选择"
+                          disabled={this.formDialogType >= 2}
+                          onChange={(val) => {
+                            if (val) {
+                              this.formData['websitName'] = this.getWebsitList.find(item => item.websitId == val).name
+                            } else {
+                              this.formData['websitName'] = ''
+                            }
+                            this.getorderlist()
+                          }}>
+                          {this.getWebsitList.map(item => <el-option key={item.websitId} label={item.name} value={item.websitId}></el-option>)}
+                        </el-select>
+                      </el-form-item>
+                    </div>
                   </el-descriptions-item>
                   <el-descriptions-item label="供应商名称">
-                    <el-select style="width:100%" value={this.formData.venderId} onInput={(val) => { this.formData.venderId = val }} placeholder="请选择">
-                      {this.listPageV2Data.map(item => <el-option key={item.venderId} label={item.venderName} value={item.venderId}></el-option>)}
-                    </el-select>
+                    <div class="redbordererr">
+                      <el-form-item label="" lebel-width="0px" prop={`venderId`} rules={required}>
+                        <el-select
+                          style="width:100%"
+                          value={this.formData.venderId}
+                          onInput={(val) => { this.formData.venderId = val }}
+                          placeholder="请选择"
+                          disabled={this.formDialogType >= 2}
+                          onChange={(val) => {
+                            if (val) {
+                              this.formData['venderName'] = this.listPageV2Data.find(item => item.venderId == val).venderName
+                            } else {
+                              this.formData['venderName'] = ''
+                            }
+                            this.getorderlist()
+                          }}>
+                          {this.listPageV2Data.map(item => <el-option key={item.venderId} label={item.venderName} value={item.venderId}></el-option>)}
+                        </el-select>
+                      </el-form-item>
+                    </div>
                   </el-descriptions-item>
                 </el-descriptions>
                 {
                   !!~['returnAuxiliaryMaterials', 'partsReturn'].indexOf(this.pageType) ?
                     <el-descriptions border title="" column={4} colon={false} labelStyle={{ width: '8%' }} contentStyle={{ width: '17%' }} style="margin-top:-1px">
                       <el-descriptions-item label="采购入库单号" contentStyle={{ width: '42%' }}>
-                        {this.formData.purchaseId}
+                        <div class="redbordererr">
+                          <el-form-item label="" lebel-width="0px" prop={`purchaseId`} rules={required}>
+                            <zj-select
+                              style="width:100%"
+                              value={this.formData.purchaseId}
+                              onInput={(val) => { this.formData.purchaseId = val }}
+                              placeholder="请选择"
+                              disabled={this.formDialogType >= 2}
+                              clearable={true}
+                              filterable={true}
+                              blurNoMatchText={true}
+                              blurNoMatchInputBorderColor=""
+                              onChange={(val) => {
+                                if (val) {
+                                  var data = this.websitPurchaseInList.find(item => item.purchaseId == val)
+                                  if (data) {
+                                    websitPurchaseInDetail({ purchaseId: data.purchaseId }).then(res => {
+                                      Object.assign(this.formData, {
+                                        items: res.data.items.map(item => ({
+                                          ...item,
+                                          retQty: "",
+                                          retValue: "",
+                                          isEditRow: false
+                                        }))
+                                      })
+                                    })
+                                    return
+                                  }
+                                }
+                                this.formData.items = []
+                              }}>
+                              {this.websitPurchaseInList.map(item => <zj-option key={item.purchaseId} label={item.showLabel} value={item.purchaseId}></zj-option>)}
+                            </zj-select>
+                          </el-form-item>
+                        </div>
                       </el-descriptions-item>
                       <el-descriptions-item label="退货数量">
                         {this.formData.retTotalQty}
@@ -422,6 +698,7 @@ export default {
                       maxlength="200"
                       show-word-limit
                       autosize={{ minRows: 6, maxRows: 8 }}
+                      disabled={this.formDialogType >= 2}
                     >
                     </el-input>
                   </el-descriptions-item>
@@ -439,8 +716,9 @@ export default {
           name: 'slot-component',
           formItemAttributes: {
             label: '',
-            prop: '',
-            'label-width': '0px'
+            prop: 'items',
+            'label-width': '0px',
+            rules: [...required]
           },
           render: (h, { props, onInput }) => {
             var { value } = props
@@ -448,37 +726,37 @@ export default {
               <div>
                 {!!~[0, 1].indexOf(this.formDialogType) ? <div style="margin-bottom:8px">
                   <el-button onClick={() => {
-                    this.formData.items.map((item) => {item.isEditRow = false})
-                    this.formData.items.push({
-                      "brand": "",
-                      "companyWechatId": "",
-                      "cost": "",
-                      "costValue": "",
-                      "goodsCategoryId": "",
-                      "goodsCategoryName": "",
-                      "goodsCode": "",
-                      "goodsId": "",
-                      "goodsName": "",
-                      "goodsSpecification": "",
-                      "goodsStockUnit": "",
-                      "goodsType": "",
-                      "note": "",
-                      "parentCategoryId": "",
-                      "parentCategoryName": "",
-                      "productCategory": "",
-                      "purchaseId": "",
-                      "recQty": "",
-                      "retQty": "",
-                      "stockQty": "",
-                      "websitId": "",
-                      "websitName": "",
-                      "isEditRow": true
+                    this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
+                      if (valid || !this.formData.items.length) {
+                        this.formData.items.map((item) => { item.isEditRow = false })
+                        this.formData.items.push({
+                          "brand": "",
+                          "companyWechatId": "",
+                          "cost": "",
+                          "costValue": "",
+                          "goodsCategoryId": "",
+                          "goodsCategoryName": "",
+                          "goodsCode": "",
+                          "goodsId": "",
+                          "goodsName": "",
+                          "goodsSpecification": "",
+                          "goodsStockUnit": "",
+                          "goodsType": "",
+                          "note": "",
+                          "parentCategoryId": "",
+                          "parentCategoryName": "",
+                          "productCategory": "",
+                          "purchaseId": "",
+                          "recQty": "",
+                          "retQty": "",
+                          "retValue": "",
+                          "stockQty": "",
+                          "websitId": "",
+                          "websitName": "",
+                          "isEditRow": true,
+                        })
+                      }
                     })
-                    // if (this.pageType == "auxiliaryMaterialsStorage") {
-                    // } else if (this.pageType == "returnAuxiliaryMaterials") {
-                    // } else if (this.pageType == "partsStorage") {
-                    // } else if (this.pageType == "partsReturn") {
-                    // }
                   }}>添加</el-button>
                 </div> : null}
                 <zj-table
@@ -497,6 +775,15 @@ export default {
   methods: {
     // 表格列解析渲染数据更改
     columnParsing(item, defaultData) {
+      if (item.jname === 'imageUrl') {
+        defaultData.render = (h, { row, index, column }) => {
+          return (
+            <div style="padding:0 6px;cursor: pointer;">
+              {row.imageUrl ? row.imageUrl.split(",").map(url => <el-image src={url} preview-src-list={[url]} fit="fit" style="width:80px;height:80px;" />) : null}
+            </div>
+          )
+        }
+      }
       return defaultData
     },
     // 监听勾选变化
@@ -505,16 +792,100 @@ export default {
     },
     // 打开
     openForm() {
-      Promise.all([
-        getWebsit(),
+
+      this.getorderlist(false)
+
+      var req = [
+        getWebsit({ type: "C" }),
         listPageV2({ "pageNum": 1, "pageSize": -1, "params": [] })
-      ]).then(([res1, res2]) => {
-        this.getWebsitList = res1.data.filter(item => item.type == "B")
-        this.listPageV2Data = res2.data.records
-        console.log(res1.data.filter(item => item.type == "B"), res2.data.records)
+      ]
+
+      var runs = [
+        (res) => { this.getWebsitList = res.data.filter(item => item.type == "C") },
+        (res) => { this.listPageV2Data = res.data.records }
+      ]
+
+      if (~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials'].indexOf(this.pageType)) {
+        req.push(...[
+          materialCategoryList({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.status", "compare": "=", "value": "ON" }, { "param": "a.category_level", "compare": "=", "value": "1" }] }),
+          materialCategoryList({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.status", "compare": "=", "value": "ON" }, { "param": "a.category_level", "compare": "=", "value": "2" }] }),
+        ])
+        runs.push(...[
+          (res) => { this.materialCategoryListL1 = res.data.records },
+          (res) => { this.materialCategoryListL2 = res.data.records }
+        ])
+      }
+
+      if (~['partsStorage', 'partsReturn'].indexOf(this.pageType)) {
+        req.push(...[
+          peijianList({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.status", "compare": "=", "value": "ON" }] })
+        ])
+        runs.push(...[
+          (res) => { this.peijianList = res.data.records },
+        ])
+      }
+
+      Promise.all(req).then((ress) => {
+        ress.forEach((res, index) => {
+          runs[index](res)
+        })
         this.formDialog = true
       })
     },
+    qkrow(row, data = {}) {
+      ["goodsStockUnit", "recQty", "retQty", "retValue", "goodsCode", "goodsSpecification", "brand", "productCategory", "cost", "costValue", "stockQty"].map(key => {
+        if (row[key] !== undefined) {
+          row[key] = data[key] || ""
+        }
+      })
+    },
+    getorderlist(bool = true) {
+      if (this.formData.websitId && this.formData.venderId) {
+        if (~['returnAuxiliaryMaterials'].indexOf(this.pageType)) {
+          if (bool) {
+            this.websitPurchaseInList = []
+            this.formData.items = []
+            this.formData.purchaseId = ""
+          }
+          websitPurchaseInList({
+            "pageNum": 1,
+            "pageSize": -1,
+            "params": [
+              { "param": "a.goods_type", "compare": "=", "value": "M" },
+              { "param": "a.flag", "compare": "=", "value": "OK" },
+              { "param": "a.websit_id", "compare": "=", "value": this.formData.websitId },
+              { "param": "a.vender_id", "compare": "=", "value": this.formData.venderId },
+            ]
+          }).then(res => {
+            this.websitPurchaseInList = res.data.records.map(item => ({
+              ...item,
+              showLabel: `单号:${item.purchaseId} / 金额:${item.totalAmount} / 时间:${item.createTime.split(" ")[0]}`
+            }))
+          })
+        } else if (~['partsReturn'].indexOf(this.pageType)) {
+          if (bool) {
+            this.websitPurchaseInList = []
+            this.formData.items = []
+            this.formData.purchaseId = ""
+          }
+          websitPurchaseInList({
+            "pageNum": 1,
+            "pageSize": -1,
+            "params": [
+              { "param": "a.goods_type", "compare": "=", "value": "P" },
+              { "param": "a.flag", "compare": "=", "value": "OK" },
+              { "param": "a.websit_id", "compare": "=", "value": this.formData.websitId },
+              { "param": "a.vender_id", "compare": "=", "value": this.formData.venderId },
+            ]
+          }).then(res => {
+            this.websitPurchaseInList = res.data.records.map(item => ({
+              ...item,
+              showLabel: `单号:${item.purchaseId} / 金额:${item.totalAmount} / 时间:${item.createTime.split(" ")[0]}`
+            }))
+          })
+        }
+      }
+    },
     // 添加
     addData() {
       this.formDialogType = 0