|
|
@@ -0,0 +1,282 @@
|
|
|
+<!-- @desc:商户初始数据 @auth:常皓宁 @time:2024/6/4 14:47 -->
|
|
|
+<template>
|
|
|
+ <div class="main-div" ref="mainDiv">
|
|
|
+<!-- <loading :loading="loading" v-if="!modalVisible"></loading>-->
|
|
|
+ <DkForm ref="formInline" v-model="formData" :col-count="4" :width="50">
|
|
|
+ <!--企业-->
|
|
|
+ <DkFormItem prop="cpId" :label="this.$t('cpName')" :required="true" :span="6" :data-type="$config.dataType.number">
|
|
|
+ <SelectMagnifier v-model="formData.cpId" :display-text="formData.cpName"
|
|
|
+ :type="this.$config.MagnifierType.company"
|
|
|
+ :multiple="false"
|
|
|
+ @ok="clickOk"/>
|
|
|
+ </DkFormItem>
|
|
|
+ </DkForm>
|
|
|
+ <BaseIndexButtonGroup ref="BaseIndexButtonGroup" id="BaseIndexButtonGroup">
|
|
|
+ <template #left>
|
|
|
+ <!-- 查询 -->
|
|
|
+ <BaseIndexButton ref="search" name="search" @click="getData"></BaseIndexButton>
|
|
|
+ <DkButton style="margin-left: 10px;" @click="openModel">导入
|
|
|
+ </DkButton>
|
|
|
+ <DkButton style="margin-left: 10px;" @click="exportNoPriceList">导出模板
|
|
|
+ </DkButton>
|
|
|
+ </template>
|
|
|
+ </BaseIndexButtonGroup>
|
|
|
+ <DkTabs v-model="tableModel" :options="tabsOptions" @on-click="changeTab"></DkTabs>
|
|
|
+
|
|
|
+ <!-- 表格部分 -->
|
|
|
+ <div :style="'height: ' + tableHeight + 'px'" class="split-div-class" v-if="tableModel == 'goodSku'">
|
|
|
+ <DkSplit v-model="split">
|
|
|
+ <!-- 左边部分 -->
|
|
|
+ <DkTable slot="left" ref="leftTable" :data="leftData" :height="tableHeight" :page-flag="false"
|
|
|
+ :page-total-flag="false" :choose-flag="false" :show-setting-flag="false"
|
|
|
+ @current-change="currentChangeEvent($event)" primaryKey="seriesId">
|
|
|
+ <DkTableColumn field="seriesName" />
|
|
|
+ </DkTable>
|
|
|
+
|
|
|
+ <!-- 右边部分 -->
|
|
|
+ <DkTable slot="right" :id="'table-' + $options.name" ref="table-select" :data="skuTableData" :pageFlag="true"
|
|
|
+ :page-total="pageInfo.total" :current-page="pageInfo.currentPage" :choose-flag="false"
|
|
|
+ :height="this.tableHeight-30" primaryKey="skuId" @pageChange="pageSizeChange">
|
|
|
+ <DkTableColumn field="skuCode"></DkTableColumn>
|
|
|
+ <DkTableColumn field="skuName"></DkTableColumn>
|
|
|
+ <DkTableColumn field="skuModel"></DkTableColumn>
|
|
|
+ <DkTableColumn field="skuSpec"></DkTableColumn>
|
|
|
+ <DkTableColumn field="seriesName"></DkTableColumn>
|
|
|
+ <DkTableColumn field="brandName"></DkTableColumn>
|
|
|
+ <DkTableColumn field="shortName"></DkTableColumn>
|
|
|
+ <DkTableColumn field="pricePurchase" dataType="number"></DkTableColumn>
|
|
|
+ <DkTableColumn field="priceStandard" dataType="number"></DkTableColumn>
|
|
|
+ <DkTableColumn field="priceWholesale" dataType="number"></DkTableColumn>
|
|
|
+ <DkTableColumn field="priceLimited" dataType="number"></DkTableColumn>
|
|
|
+ <DkTableColumn field="priceOther" dataType="number"></DkTableColumn>
|
|
|
+ <DkTableColumn field="remarks"></DkTableColumn>
|
|
|
+ <DkTableColumn field="flgValid" type="switch" ></DkTableColumn>
|
|
|
+ </DkTable>
|
|
|
+ </DkSplit>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!--上传窗口-->
|
|
|
+ <DkModal
|
|
|
+ v-model="uploadModal"
|
|
|
+ ref="upload_modal"
|
|
|
+ @on-visible-change="handleVisibleModal"
|
|
|
+ @modalOk="save"
|
|
|
+ :saveFlag="true"
|
|
|
+ :title="modalTitle"
|
|
|
+ :okVisibleFlag="false"
|
|
|
+ :width="600"
|
|
|
+ >
|
|
|
+ <!-- 导入-->
|
|
|
+ <Upload :headers="{Authorization: 'Bearer ' + $store.state.user.token}"
|
|
|
+ :action="this.importUrl"
|
|
|
+ accept=".xls, .xlsx" :on-success="uploadSuccess"
|
|
|
+ :multiple="false"
|
|
|
+ >
|
|
|
+ <Button ref="uploadButton"> 上传文件
|
|
|
+ </Button>
|
|
|
+ </Upload>
|
|
|
+ </DkModal>
|
|
|
+
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import {indexMixin} from "@/mixins";
|
|
|
+import XLSX from 'xlsx';
|
|
|
+import {request} from "@/api/base";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "company-init",
|
|
|
+ mixins: [indexMixin],
|
|
|
+ data() {
|
|
|
+ let self = this
|
|
|
+ return {
|
|
|
+ //商品档案相关
|
|
|
+ leftData: [],//商品档案左侧
|
|
|
+ seriesId:null,
|
|
|
+ split: 0.15,
|
|
|
+ minSplit: 0.15,
|
|
|
+ skuTableData:[],
|
|
|
+
|
|
|
+ //客户档案相关
|
|
|
+
|
|
|
+ //上传相关
|
|
|
+ uploadModal:false,//上传窗口
|
|
|
+ modalTitle:'上传文件',
|
|
|
+ importUrl:'',
|
|
|
+ importService:'/mst/goodsSku/import/',//上传地址
|
|
|
+
|
|
|
+ //导出相关
|
|
|
+ templateType:'goodSku',//模板类型
|
|
|
+ service:'/mdm-server/mst/companyInit/',//服务地址
|
|
|
+
|
|
|
+ //主页相关
|
|
|
+ tableModel:'goodSku',
|
|
|
+ tabsOptions: [
|
|
|
+ {
|
|
|
+ label: this.$t('商品档案'),
|
|
|
+ name: 'goodSku'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: this.$t('客户档案'),
|
|
|
+ name: 'cus'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+
|
|
|
+ formData: {
|
|
|
+ cpId: null,
|
|
|
+ cpName: null,
|
|
|
+ svcIp: null,
|
|
|
+ svcPort: null,
|
|
|
+ svcCode:null,
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 选择后事件
|
|
|
+ * @author : 常皓宁
|
|
|
+ * @date : 2024/6/5 9:18
|
|
|
+ */
|
|
|
+ clickOk(val) {
|
|
|
+ this.formData.cpId = val[0]['cpId']
|
|
|
+ this.formData.svcIp = val[0]['svcIp']
|
|
|
+ this.formData.svcPort = val[0]['svcPort']
|
|
|
+ this.formData.svcCode = val[0]['svcCode']
|
|
|
+
|
|
|
+ //TODO 上线需放开
|
|
|
+ // this.importUrl = this.$config.serviceUrl + '/' + 'mdm-server-' + this.formData.svcCode + this.importService + this.formData.cpId
|
|
|
+ this.importUrl = 'http://192.168.1.24:7001/mdm-server-dkic-b1' + this.importService + this.formData.cpId
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : tab切换
|
|
|
+ * @author : 常皓宁
|
|
|
+ * @date : 2023/8/26 16:25
|
|
|
+ */
|
|
|
+ changeTab(val) {
|
|
|
+ //商品档案
|
|
|
+ if (val === 'goodSku') {
|
|
|
+ this.templateType = 'goodSku'
|
|
|
+ this.importService = '/mst/goodsSku/import/'
|
|
|
+ }
|
|
|
+ //客户档案
|
|
|
+ if (val === 'cus') {
|
|
|
+ this.templateType = 'cus'
|
|
|
+ this.importService = '/mst/customer/import/'
|
|
|
+ }
|
|
|
+ this.service = '/mdm-server/mst/companyInit/'
|
|
|
+
|
|
|
+ ///TODO 上线需放开
|
|
|
+ // this.importUrl = this.$config.serviceUrl + '/' + 'mdm-server-' + this.formData.svcCode + this.importService + this.formData.cpId
|
|
|
+ this.importUrl = 'http://192.168.1.24:7001/mdm-server-dkic-b1' + this.importService + this.formData.cpId
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 导出
|
|
|
+ * @author : 常皓宁
|
|
|
+ * @date : 2024/6/5 9:44
|
|
|
+ */
|
|
|
+ exportNoPriceList () {
|
|
|
+ console.log('this.templateType',this.templateType)
|
|
|
+ window.location.href = this.$config.serviceUrl + '/mdm-server/mst/companyInit/export_template/' + this.templateType
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 打开导入窗体
|
|
|
+ * @author : 常皓宁
|
|
|
+ * @date : 2024/6/5 13:29
|
|
|
+ */
|
|
|
+ openModel () {
|
|
|
+ console.log('this.',this.formData)
|
|
|
+ this.$refs['formInline'].validate().then(valid => {
|
|
|
+ if(!valid){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.uploadModal = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 上传成功
|
|
|
+ * @author : 常皓宁
|
|
|
+ * @date : 2024/6/5 13:37
|
|
|
+ */
|
|
|
+ uploadSuccess(res) {
|
|
|
+ if (res.code == -300) {
|
|
|
+ console.log('asdasda',res)
|
|
|
+ this.$Message.error("文件校验失败,已反馈错误数据")
|
|
|
+ // window.location.href = this.$config.serviceUrl + res.message
|
|
|
+ } else if(res.code == 200){
|
|
|
+ this.$Message.success(this.$t('I_001', {'param':'文件校验通过,成功新建商品档案'}))
|
|
|
+ }else {
|
|
|
+ this.$Message.error(res.message)
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 获取数据
|
|
|
+ * @author : 常皓宁
|
|
|
+ * @date : 2024/6/13 10:49
|
|
|
+ */
|
|
|
+ getData(param){
|
|
|
+ this.$refs['formInline'].validate().then(valid => {
|
|
|
+ if(!valid){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ if(this.tableModel == 'goodSku'){
|
|
|
+ request('http://192.168.1.24:7001'+ '/' + 'mdm-server-' + this.formData.svcCode + '/mst/goodsSeries/list_by_nopage', {}).then(res =>{
|
|
|
+ if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
+ this.leftData = res.data;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 右侧列表行变化事件
|
|
|
+ * @author : 宋扬
|
|
|
+ * @date : 2024/4/7 15:03
|
|
|
+ */
|
|
|
+ currentChangeEvent({row}){
|
|
|
+ if (row != null){
|
|
|
+ this.seriesId = row.seriesId;
|
|
|
+ //调用查询事件
|
|
|
+ this.getSkuData();
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 查询商品档案
|
|
|
+ * @author : 常皓宁
|
|
|
+ * @date : 2024/6/13 11:32
|
|
|
+ */
|
|
|
+ getSkuData(){
|
|
|
+ if (this.tableModel == 'goodSku') {
|
|
|
+ let params = {
|
|
|
+ seriesId : this.seriesId,
|
|
|
+ flgValidList: ["true"],
|
|
|
+ }
|
|
|
+ request('http://192.168.1.24:7001' + '/' + 'mdm-server-' + this.formData.svcCode + '/mst/goodsSku/list_by', params).then(res => {
|
|
|
+ if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
+ this.skuTableData = res.data.list;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+
|
|
|
+</style>
|