lilei 2 years ago
parent
commit
790eab7d3e

+ 1 - 1
public/version.json

@@ -1,5 +1,5 @@
 {
 {
   "message": "发现有新版本发布,确定更新系统?",
   "message": "发现有新版本发布,确定更新系统?",
   "vendorJsVersion": "",
   "vendorJsVersion": "",
-  "version": 1675667461119
+  "version": 1675669028449
 }
 }

+ 25 - 24
src/views/common/receivingAddress/chooseAddressModal.vue

@@ -39,30 +39,31 @@
         </template>
         </template>
         <!-- 操作 -->
         <!-- 操作 -->
         <template slot="action" slot-scope="text, record">
         <template slot="action" slot-scope="text, record">
-          <a-button
-            size="small"
-            type="link"
-            class="button-primary"
-            v-if="record.defaultFlag!=1"
-            @click="handleDefault(record)"
-            id="chooseAddressList-default-btn">设为默认</a-button>
-          <a-button
-            size="small"
-            type="link"
-            class="button-primary"
-            v-if="record.readOnlyFlag!=1&&record.defaultFlag!=1"
-            @click="handleEdit(record)"
-            id="chooseAddressList-edit-btn"
-          >编辑</a-button>
-          <a-button
-            size="small"
-            type="link"
-            class="button-error"
-            v-if="record.readOnlyFlag!=1&&record.defaultFlag!=1"
-            @click="handleDel(record)"
-            id="chooseAddressList-del-btn"
-          >删除</a-button>
-          <span v-if="!(record.defaultFlag!=1) && !(record.readOnlyFlag!=1)">--</span>
+          <div>
+            <a-button
+              size="small"
+              type="link"
+              class="button-primary"
+              v-if="record.defaultFlag!=1"
+              @click="handleDefault(record)"
+              id="chooseAddressList-default-btn">设为默认</a-button>
+            <a-button
+              size="small"
+              type="link"
+              class="button-primary"
+              v-if="record.readOnlyFlag!=1"
+              @click="handleEdit(record)"
+              id="chooseAddressList-edit-btn"
+            >编辑</a-button>
+            <a-button
+              size="small"
+              type="link"
+              class="button-error"
+              v-if="record.readOnlyFlag!=1"
+              @click="handleDel(record)"
+              id="chooseAddressList-del-btn"
+            >删除</a-button>
+          </div>
         </template>
         </template>
         <!-- 选择 -->
         <!-- 选择 -->
         <template slot="choose" slot-scope="text, record">
         <template slot="choose" slot-scope="text, record">

+ 1 - 1
src/views/purchasingManagement/purchaseOrder/basicInfoModal.vue

@@ -54,7 +54,7 @@
 <script>
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
 import { VSelect } from '@/components'
-import chooseAddressModal from './receivingAddress/chooseAddressModal.vue'
+import chooseAddressModal from '@/views/common/receivingAddress/chooseAddressModal.vue'
 import { shippingAddressQuery } from '@/api/shippingAddress'
 import { shippingAddressQuery } from '@/api/shippingAddress'
 import { purchaseSave, purchaseTargetList } from '@/api/purchase'
 import { purchaseSave, purchaseTargetList } from '@/api/purchase'
 export default {
 export default {

+ 1 - 1
src/views/purchasingManagement/purchaseOrder/edit.vue

@@ -276,7 +276,7 @@ import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import { STable, VSelect } from '@/components'
 import ImportGuideModal from './importGuideModal.vue'
 import ImportGuideModal from './importGuideModal.vue'
 import outStockModal from './outStockModal.vue'
 import outStockModal from './outStockModal.vue'
-import chooseAddressModal from './receivingAddress/chooseAddressModal.vue'
+import chooseAddressModal from '@/views/common/receivingAddress/chooseAddressModal.vue'
 import ProductType from '../../common/productType.js'
 import ProductType from '../../common/productType.js'
 import ProductBrand from '../../common/productBrand.js'
 import ProductBrand from '../../common/productBrand.js'
 import { purchaseDetailBySn, purchaseWriteSubmit, purchaseDetailPrint, purchaseDetailExport, purchaseDetailAddress } from '@/api/purchase'
 import { purchaseDetailBySn, purchaseWriteSubmit, purchaseDetailPrint, purchaseDetailExport, purchaseDetailAddress } from '@/api/purchase'

+ 0 - 252
src/views/purchasingManagement/purchaseOrder/receivingAddress/chooseAddressModal.vue

@@ -1,252 +0,0 @@
-<template>
-  <a-modal
-    centered
-    class="chooseAddressList-modal"
-    :footer="null"
-    :maskClosable="false"
-    title="收货地址"
-    v-model="isShow"
-    @cancel="isShow=false"
-    :width="960">
-    <a-spin :spinning="spinning" tip="Loading...">
-      <!-- 操作按钮 -->
-      <div class="table-operator">
-        <a-button id="chooseAddressList-add" type="primary" class="button-error" @click="handleEdit()">新增</a-button>
-      </div>
-      <!-- 列表 -->
-      <s-table
-        class="sTable"
-        ref="table"
-        size="small"
-        :rowKey="(record) => record.id"
-        :columns="columns"
-        :data="loadData"
-        :scroll="{ y: 500 }"
-        :showPagination="false"
-        :defaultLoadData="false"
-        bordered>
-        <!-- 收货人 -->
-        <template slot="consignee" slot-scope="text, record">
-          <div class="item-box">
-            <a-tooltip placement="top">
-              <template slot="title">
-                <span>{{ record.consigneeName }}</span>
-              </template>
-              <p class="ellipsis-txt">{{ record.consigneeName }}</p>
-            </a-tooltip>
-            <span v-if="record.defaultFlag==1" class="badge-txt">默认</span>
-          </div>
-        </template>
-        <!-- 操作 -->
-        <template slot="action" slot-scope="text, record">
-          <a-button
-            size="small"
-            type="link"
-            class="button-primary"
-            v-if="record.defaultFlag!=1"
-            @click="handleDefault(record)"
-            id="chooseAddressList-default-btn">设为默认</a-button>
-          <a-button
-            size="small"
-            type="link"
-            class="button-primary"
-            v-if="record.readOnlyFlag!=1"
-            @click="handleEdit(record)"
-            id="chooseAddressList-edit-btn"
-          >编辑</a-button>
-          <a-button
-            size="small"
-            type="link"
-            class="button-error"
-            v-if="record.readOnlyFlag!=1"
-            @click="handleDel(record)"
-            id="chooseAddressList-del-btn"
-          >删除</a-button>
-          <span v-if="!(record.defaultFlag!=1) && !(record.readOnlyFlag!=1)">--</span>
-        </template>
-        <!-- 选择 -->
-        <template slot="choose" slot-scope="text, record">
-          <a-button
-            size="small"
-            type="link"
-            class="button-primary"
-            @click="handleChoose(record)"
-            id="chooseAddressList-choose-btn">选择</a-button>
-        </template>
-      </s-table>
-    </a-spin>
-    <!-- 新增/编辑地址 -->
-    <edit-address-modal ref="addrModal" :openModal="openAddrModal" @ok="handleOk" @close="openAddrModal=false" />
-  </a-modal>
-</template>
-
-<script>
-import { commonMixin } from '@/utils/mixin'
-import { STable, VSelect } from '@/components'
-import editAddressModal from './editAddressModal'
-import { shippingAddressQuery, shippingAddressSet, shippingAddressDel } from '@/api/shippingAddress.js'
-export default {
-  name: 'ChooseAddressModal',
-  components: { STable, VSelect, editAddressModal },
-  mixins: [commonMixin],
-  props: {
-    openModal: { //  弹框显示状态
-      type: Boolean,
-      default: false
-    }
-  },
-  data () {
-    return {
-      spinning: false,
-      isShow: this.openModal, //  是否打开弹框
-      queryParam: {},
-      // 表头
-      columns: [
-        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
-        { title: '收货人', scopedSlots: { customRender: 'consignee' }, width: '24%', align: 'center', ellipsis: true },
-        { title: '联系电话', dataIndex: 'consigneeTel', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '收货地址', dataIndex: 'address', width: '25%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '24%', align: 'center' },
-        { title: '选择', scopedSlots: { customRender: 'choose' }, width: '10%', align: 'center' }
-      ],
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        this.disabled = true
-        this.spinning = true
-        return shippingAddressQuery(Object.assign(parameter, this.queryParam)).then(res => {
-          let data
-          if (res.status == 200) {
-            data = res.data
-            const no = 0
-            for (var i = 0; i < data.length; i++) {
-              data[i].no = no + i + 1
-              const provinceName = data[i].provinceName ? (data[i].provinceName + '-') : ''
-              const cityName = data[i].cityName ? (data[i].cityName + '-') : ''
-              const countyName = data[i].countyName ? (data[i].countyName + '-') : ''
-              const addr = data[i].addr || ''
-              data[i].address = provinceName + cityName + countyName + addr
-            }
-            this.disabled = false
-          }
-          this.spinning = false
-          return data
-        })
-      },
-      openAddrModal: false // 选择地址弹框是否显示
-    }
-  },
-  methods: {
-    //  设为默认
-    handleDefault (row) {
-      this.spinning = true
-      shippingAddressSet({ id: row.id }).then(res => {
-        if (res.status == 200) {
-          this.$message.success(res.message)
-          this.$refs.table.refresh(true)
-          this.spinning = false
-        } else {
-          this.spinning = false
-        }
-      })
-    },
-    //  新增/编辑收货地址
-    handleEdit (row) {
-      if (row) {
-        this.$refs.addrModal.setData({
-          id: row.id,
-          consigneeName: row.consigneeName,
-          consigneeTel: row.consigneeTel,
-          provinceSn: row.provinceSn,
-          provinceName: row.provinceName,
-          citySn: row.citySn,
-          cityName: row.cityName,
-          countySn: row.countySn,
-          countyName: row.countyName,
-          addr: row.addr
-        })
-      }
-      this.openAddrModal = true
-    },
-    //  选择
-    handleChoose (row) {
-      this.$emit('ok', row)
-    },
-    //  删除
-    handleDel (row) {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '删除后不可恢复,确定要进行删除吗?',
-        centered: true,
-        onOk () {
-          _this.spinning = true
-          shippingAddressDel({
-            id: row.id
-          }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.$emit('verify', row.id)
-              _this.$refs.table.refresh(true)
-              _this.spinning = false
-            } else {
-              _this.spinning = false
-            }
-          })
-        }
-      })
-    },
-    //  地址保存成功
-    handleOk (data) {
-      this.$refs.table.refresh(true)
-    }
-  },
-  watch: {
-    //  父页面传过来的弹框状态
-    openModal (newValue, oldValue) {
-      this.isShow = newValue
-    },
-    //  重定义的弹框状态
-    isShow (newValue, oldValue) {
-      if (!newValue) {
-        this.$emit('close')
-        this.$refs.table.clearTable()
-      } else {
-        const _this = this
-        setTimeout(() => {
-          _this.$refs.table.refresh(true)
-        }, 300)
-      }
-    }
-  }
-}
-</script>
-
-<style lang="less">
-  .chooseAddressList-modal{
-    .table-operator{
-      margin-bottom: 10px;
-    }
-    .item-box{
-      position: relative;
-      display: flex;
-      align-items: center;
-      .ellipsis-txt{
-        margin: 0;
-        width: 100%;
-        overflow: hidden;
-        text-overflow:ellipsis;
-        whitewhite-space: nowrap;
-      }
-      .badge-txt{
-        line-height: 20px;
-        padding: 0 7px;
-        font-size: 12px;
-        background-color: #fff;
-        color: #ed1c24;
-        border-color: #ed1c24;
-        border-radius: 20px;
-        box-shadow: 0 0 0 1px #d9d9d9 inset;
-      }
-    }
-  }
-</style>

+ 0 - 265
src/views/purchasingManagement/purchaseOrder/receivingAddress/editAddressModal.vue

@@ -1,265 +0,0 @@
-<template>
-  <a-modal
-    centered
-    class="editAddress-modal"
-    :footer="null"
-    :maskClosable="false"
-    title="收货地址"
-    v-model="isShow"
-    @cancel="isShow=false"
-    :width="800">
-    <a-spin :spinning="spinning" tip="Loading...">
-      <a-form-model
-        id="editAddress-form"
-        ref="ruleForm"
-        :model="form"
-        :rules="rules"
-        :label-col="formItemLayout.labelCol"
-        :wrapper-col="formItemLayout.wrapperCol"
-      >
-        <a-form-model-item label="收货人" prop="consigneeName">
-          <a-input
-            id="editAddress-name"
-            :maxLength="30"
-            v-model.trim="form.consigneeName"
-            placeholder="请输入收货人(最多30个字符)"
-            allowClear />
-        </a-form-model-item>
-        <a-form-model-item label="联系电话" prop="consigneeTel">
-          <a-input
-            id="editAddress-phone"
-            :maxLength="30"
-            v-model.trim="form.consigneeTel"
-            placeholder="请输入联系电话(最多30个字符)"
-            allowClear />
-        </a-form-model-item>
-        <a-form-model-item label="所在地区" required style="margin: 0;">
-          <a-row :gutter="20">
-            <!-- 所在地区 -->
-            <a-col span="8">
-              <a-form-model-item prop="provinceSn">
-                <a-select id="editAddress-provinceSn" allowClear @change="getCityList" v-model="form.provinceSn" placeholder="请选择省">
-                  <a-select-option v-for="item in addrProvinceList" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
-                </a-select>
-              </a-form-model-item>
-            </a-col>
-            <a-col span="8">
-              <a-form-model-item prop="citySn">
-                <a-select id="editAddress-citySn" allowClear @change="getAreaList" v-model="form.citySn" placeholder="请选择市">
-                  <a-select-option v-for="item in addrCityList" :value="item.areaSn" :key="item.areaSn + 'b'">{{ item.name }}</a-select-option>
-                </a-select>
-              </a-form-model-item>
-            </a-col>
-            <a-col span="8">
-              <a-form-model-item prop="countySn">
-                <a-select id="editAddress-countySn" allowClear @change="areaCharged" v-model="form.countySn" placeholder="请选择区/县">
-                  <a-select-option v-for="item in addrDistrictList" :value="item.areaSn" :key="item.areaSn + 'c'">{{ item.name }}</a-select-option>
-                </a-select>
-              </a-form-model-item>
-            </a-col>
-          </a-row>
-        </a-form-model-item>
-        <a-form-model-item label="详细地址" prop="addr">
-          <a-input
-            id="editAddress-address"
-            :maxLength="60"
-            v-model.trim="form.addr"
-            placeholder="请输入详细地址(最多60个字符)"
-            allowClear />
-        </a-form-model-item>
-        <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;">
-          <a-button type="primary" @click="handleSubmit" id="editAddress-btn-submit">保存</a-button>
-          <a-button @click="isShow=false" style="margin-left: 15px" id="editAddress-btn-back">返回</a-button>
-        </a-form-model-item>
-      </a-form-model>
-    </a-spin>
-  </a-modal>
-</template>
-
-<script>
-import { commonMixin } from '@/utils/mixin'
-import { getArea } from '@/api/data'
-import { shippingAddressSave } from '@/api/shippingAddress.js'
-export default {
-  name: 'EditAddressModal',
-  mixins: [commonMixin],
-  props: {
-    openModal: { //  弹框显示状态
-      type: Boolean,
-      default: false
-    }
-  },
-  data () {
-    return {
-      spinning: false,
-      isShow: this.openModal, //  是否打开弹框
-      isEdit: false,
-      formItemLayout: {
-        labelCol: { span: 4 },
-        wrapperCol: { span: 18 }
-      },
-      form: {
-        consigneeName: '',
-        consigneeTel: '',
-        provinceSn: undefined,
-        provinceName: '',
-        citySn: undefined,
-        cityName: '',
-        countySn: undefined,
-        countyName: '',
-        addr: ''
-      },
-      rules: {
-        consigneeName: [
-          { required: true, message: '请输入收货人', trigger: 'change' }
-        ],
-        consigneeTel: [
-          { required: true, message: '请输入联系电话', trigger: 'change' }
-        ],
-        provinceSn: [
-          { required: true, message: '请选择省', trigger: 'change' }
-        ],
-        citySn: [
-          { required: true, message: '请选择市', trigger: 'change' }
-        ],
-        countySn: [
-          { required: true, message: '请选择区', trigger: 'change' }
-        ],
-        addr: [
-          { required: true, message: '请输入详细地址', trigger: 'change' }
-        ]
-      },
-      addrProvinceList: [], //  省下拉
-      addrCityList: [], //  市下拉
-      addrDistrictList: [] //  区下拉
-    }
-  },
-  methods: {
-    //  保存
-    handleSubmit () {
-      this.$refs.ruleForm.validate(valid => {
-        if (valid) {
-          this.spinning = true
-          shippingAddressSave(this.form).then(res => {
-            if (res.status == 200) {
-              this.isShow = false
-              this.$emit('ok')
-              this.$message.success(res.message)
-              this.spinning = false
-            } else {
-              this.spinning = false
-            }
-          })
-        } else {
-          console.log('error submit!!')
-          return false
-        }
-      })
-    },
-    // 获取城市列表
-    getCityList (val) {
-      this.addrCityList = []
-      this.addrDistrictList = []
-      this.form.citySn = undefined
-      this.form.countySn = undefined
-      if (val) {
-        this.getArea('city', val)
-        this.form.provinceName = this.addrProvinceList.find(item => item.areaSn == val).name
-      } else {
-        this.form.provinceName = ''
-      }
-    },
-    // 获取区县列表
-    getAreaList (val) {
-      this.addrDistrictList = []
-      this.form.countySn = undefined
-      if (val) {
-        this.getArea('district', val)
-        this.form.cityName = this.addrCityList.find(item => item.areaSn == val).name
-      } else {
-        this.form.cityName = ''
-      }
-    },
-    // 区县变更
-    areaCharged (val) {
-      if (val) {
-        this.form.countyName = this.addrDistrictList.find(item => item.areaSn == val).name
-      } else {
-        this.form.countyName = ''
-      }
-    },
-    //  省/市/区
-    getArea (leve, sn) {
-      let params
-      if (leve == 'province') {
-        params = { type: '2' }
-      } else {
-        params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
-      }
-      getArea(params).then(res => {
-        if (res.status == 200) {
-          if (leve == 'province') {
-            this.addrProvinceList = res.data || []
-          } else if (leve == 'city') {
-            this.addrCityList = res.data || []
-          } else if (leve == 'district') {
-            this.addrDistrictList = res.data || []
-          }
-        } else {
-          if (leve == 'province') {
-            this.addrProvinceList = []
-          } else if (leve == 'city') {
-            this.addrCityList = []
-          } else if (leve == 'district') {
-            this.addrDistrictList = []
-          }
-        }
-      })
-    },
-    // 编辑数据
-    setData (data) {
-      this.isEdit = true
-      Promise.all([getArea({ type: '2' }), getArea({ parentId: data.provinceSn, type: '3' }), getArea({ parentId: data.citySn, type: '4' })]).then(res => {
-        console.log(res)
-        this.addrProvinceList = res[0].data
-        const provinceName = this.addrProvinceList.find(item => item.id == data.provinceSn)
-        if (provinceName && provinceName.name) {
-          this.form.provinceName = provinceName.name
-        }
-        this.addrCityList = res[1].data
-        const cityName = this.addrCityList.find(item => item.id == data.citySn)
-        if (cityName && cityName.name) {
-          this.form.cityName = cityName.name
-        }
-        this.addrDistrictList = res[2].data
-        const countyName = this.addrDistrictList.find(item => item.id == data.countySn)
-        if (countyName && countyName.name) {
-          this.form.countyName = countyName.name
-        }
-        this.form = Object.assign({}, this.form, data)
-      })
-    }
-  },
-  watch: {
-    //  父页面传过来的弹框状态
-    openModal (newValue, oldValue) {
-      this.isShow = newValue
-    },
-    //  重定义的弹框状态
-    isShow (newValue, oldValue) {
-      if (!newValue) {
-        this.$emit('close')
-        this.$refs.ruleForm.resetFields()
-        this.addrCityList = []
-        this.addrDistrictList = []
-        this.isEdit = false
-        delete this.form.id
-      } else {
-        if (!this.isEdit) {
-          this.getArea('province')
-        }
-      }
-    }
-  }
-}
-</script>