12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276 |
- <template>
- <div class="my-container">
- <div class="bill-left" v-show="isShow==='home'" key="item">
- <div class="bill-tab">
- <div class="bill-title">导航</div>
- <side-tree :propConfig="treeConfig" @onChange="onChangeTree" ref="sideTree" />
- </div>
- </div>
- <div class="bill-main" v-show="isShow==='home'" key="item2">
- <module-view :propConfig="config" ref="moduleView" @pagination="getDataList" @search="getDataList"
- @resert="onRefresh" @clickHandle="clickHandle" @detail="getDetail" @onRefresh="onRefresh" />
- </div>
- <!-- 新增/编辑 -->
- <div class="detil" v-show="isShow==='add'" key="item3">
- <by-tool :propConfig="toolConfig" @clickHandle="insideTools" ref="byTool" />
- <div class="box-shadow">
- <el-button style="margin-bottom: 20px;" type="primary" icon="el-icon-sort" @click="openVxeData">关联金蝶财务系统物料</el-button>
- <by-form :propConfig="formConfig" ref="form">
- <template v-slot:description>
- <el-input type="textarea" :rows="5" placeholder="请输入内容" v-model="textarea">
- </el-input>
- </template>
- <template v-slot:tags>
- <el-tag style="margin-right: 16px;" :disable-transitions="true" v-for="(item,index) of tagsData"
- :key="index" closable @close="handleClose2(index)">
- {{item}}
- </el-tag>
- <by-input class="input-new-tag" ref="tagsValue" style="width: 150px;"></by-input>
- <el-button class="button-new-tag" @click="getTagsValue">添加</el-button>
- </template>
- <template v-slot:status>
- <el-radio v-model="status" :label="0">启用</el-radio>
- <el-radio v-model="status" :label="1">备用</el-radio>
- <el-radio v-model="status" :label="2">禁用</el-radio>
- </template>
- <template v-slot:ismakeup>
- <el-radio v-model="ismakeup" :label="0" :disabled="materialSpec==1">是</el-radio>
- <el-radio v-model="ismakeup" :label="1">否</el-radio>
- <el-button v-show="ismakeup===0" @click="openMakeup">选择商品</el-button>
- </template>
- <template v-slot:makeupTable>
- <div v-if="ismakeup===0">
- <by-table :propConfig="makeupTable" ref="makeupTable" @onChangeRow="getMakeupTableValue"></by-table>
- </div>
- </template>
- <template v-slot:issued>
- <el-radio v-model="issued" :label="0">是</el-radio>
- <el-radio v-model="issued" :label="1">否</el-radio>
- </template>
- <template v-slot:materialSpec>
- <el-radio v-model="materialSpec" :label="0" @input="changeSingle">单规格</el-radio>
- <el-radio v-model="materialSpec" :label="1" @input="changeSingle" :disabled="ismakeup==0">多规格</el-radio>
- </template>
- <template v-slot:attributeName>
- <div v-if="isSingle" key="item4">
- <by-table :propConfig="singleTable" @onChangeRow="getInputValue" ref="singeTable">
- <template v-slot:stock="{row}">
- <vxe-input v-if="!isEdit" v-model="row.stock" size="mini" type="integer"></vxe-input>
- <span v-else>{{ row.stock }}</span>
- </template>
- </by-table>
- </div>
- <div v-if="!isSingle" key="item5">
- <el-select :value="selectValue" clearable placeholder="请选择" style="width: 19.5%;" @input="getSelectValue">
- <el-option v-for="item in selectList" :key="item.value" :label="item.name" :value="item.id">
- </el-option>
- </el-select>
- <div class="by-tab" key="item6">
- <div v-for="(item,index) of attributeList" :key="index">
- <div class="tab-title">{{item.title}} <i class="el-icon-circle-close" @click="closeGroup(index)"></i>
- </div>
- <el-tag class="item-tab" :disable-transitions="true" :key="i" v-for="(tag,i) of item.list" closable
- @close="handleClose(tag,index)">
- {{tag}}
- </el-tag>
- <by-input class="input-new-tag" :ref="'getValue_'+index"></by-input>
- <el-button class="button-new-tag" @click="showInput(index)">添加</el-button>
- </div>
- <div style="margin: 20px 0;" v-if="!isAdd" key="item7">
- <div class="el-button mr15 el-button--primary el-button--small" @click="isAdd=true">添加新规格</div>
- </div>
- <div style="display: flex;margin: 20px 0;" v-else key='item8'>
- <div class="flex-item">
- <label>规格:</label>
- <div class="el-input el-input--small" style="width: 250px;margin-right: 16px;">
- <input type="text" v-model="norms" placeholder="请输入规格" class="el-input__inner">
- </div>
- </div>
- <div class="flex-item">
- <label>规格值:</label>
- <div class="el-input el-input--small" style="width: 250px;margin-right: 16px;">
- <input type="text" v-model="normsValue" placeholder="请输入规格值" class="el-input__inner">
- </div>
- </div>
- <div @click="doComfirm" class="el-button el-button--primary el-button--small">确定</div>
- <div @click="isAdd=false" class="el-button el-button--danger el-button--small">取消</div>
- </div>
- <div>
- <by-table :propConfig="tableConfig" @onChangeRow="getInputValue" ref="table">
- <template v-slot:stock="{row}">
- <vxe-input v-if="!isEdit" v-model="row.stock" size="mini" type="integer"></vxe-input>
- <span v-else>{{ row.stock }}</span>
- </template>
- </by-table>
- </div>
- </div>
- </div>
- </template>
- </by-form>
- </div>
- </div>
- <!-- 选择物料 -->
- <productModal ref="product" :mulit="true" @confirm="confirmProduct" />
-
- <vxe-modal v-model="vxeValue" width="48%" height="88%" show-zoom resize transfer show-footer mask-closable :loading="tableloading">
- <template #title>
- <span>关联金蝶财务系统物料</span>
- </template>
- <template #default>
- <el-form ref="tableSearchForm" :inline="true" :model="tableSearchForm" label-width="80px">
- <el-form-item label="标题">
- <el-input style="width: 220px;" v-model="tableSearchForm.fname" placeholder="请输入标题" clearable></el-input>
- </el-form-item>
- <el-form-item label="财务编号">
- <el-input style="width: 220px;" v-model="tableSearchForm.fnumber" placeholder="请输入财务编号" clearable></el-input>
- </el-form-item>
- <el-form-item label="开始时间">
- <el-date-picker style="width: 220px;" v-model="tableSearchForm.stime" type="date" placeholder="选择日期" :clearable="false" value-format="yyyy-MM-dd"></el-date-picker>
- </el-form-item>
- <el-form-item label="结束时间">
- <el-date-picker style="width: 220px;" v-model="tableSearchForm.etime" type="date" placeholder="选择日期" :clearable="false" value-format="yyyy-MM-dd"></el-date-picker>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="tableSearchOnSubmit">搜索</el-button>
- <el-button @click="resetTableSearch">重置</el-button>
- </el-form-item>
- </el-form>
- <el-table
- ref="multipleTable"
- :data="newtableData"
- stripe
- border
- style="width: 100%"
- :header-cell-style="{ background: '#f3f6fd', color: '#555'}">
- <el-table-column
- width="55">
- <template slot-scope="scope">
- <el-radio v-model="tableRadio" :label="scope.row" @input="handleSelectionChange">{{""}}</el-radio>
- </template>
- </el-table-column>
- <el-table-column prop="fname" label="标题"></el-table-column>
- <el-table-column prop="fnumber" label="财务编号"></el-table-column>
- <el-table-column prop="fbaseUnitName" label="单位"></el-table-column>
- <el-table-column prop="fbaseUnitCode" label="单位编码"></el-table-column>
- </el-table>
- <el-pagination
- style="margin-top: 25px;"
- background
- layout="prev, pager, next"
- :page-size="tablePageSize"
- :current-page="tablePageNum"
- :total="tableDataTotal"
- @current-change="currentChange">
- </el-pagination>
- </template>
- <template #footer>
- <div class="btn">
- <el-button size="small" @click="vxeValue=false">取消</el-button>
- <el-button type="primary" size="small" @click="doConfirm">确定</el-button>
- </div>
- </template>
- </vxe-modal>
-
- <el-dialog
- title="同步金蝶物料"
- v-loading="dateLoading"
- :visible.sync="dateDialogVisible"
- :close-on-click-modal='false'
- :close-on-press-escape='false'
- :show-close='false'
- width="518px">
- <el-date-picker v-model="stime" type="date" :picker-options="stimePickerOptions" placeholder="选择日期" value-format="yyyy-MM-dd"></el-date-picker>
- <span style="margin: 0 12px;">至</span>
- <el-date-picker v-model="etime" type="date" :picker-options="etimePickerOptions" placeholder="选择日期" value-format="yyyy-MM-dd"></el-date-picker>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dateDialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="dateConfirm">确 定</el-button>
- </span>
- </el-dialog>
- <StoreRecord ref="StoreRecord" />
- </div>
- </template>
- <script lang="ts">
- import { Component, Prop, Vue, Watch } from "vue-property-decorator";
- import api from '@/api/currency'
- import other from '@/api/other'
- import ForTab from "@/components/ForTab/index.vue";
- import productModal from "./components/productModal.vue";
- import brandType from "./components/brandType.vue";
- import StoreRecord from "./components/storeRecord.vue";
- // import selectKin from "./components/selectKin.vue";
- @Component({ components: { ForTab, productModal, brandType,StoreRecord } })
- export default class productManagement extends Vue {
- tagsData : any = [] // 标签值
- isShow = 'home'
- isEdit = true
- vxeValue = false
- editInfo : any = ''
- isSingle : any = true
- timeNum = 0;
- timer : any = null
- materialSpec : any = 0
- status : any = 0
- ismakeup : any = 1
- issued : any = 0
- textarea : any = ''
- categoryIds : any = ''
- selectList = []
- selectValue = ''
- // tab
- singeTable : any = ''
- setTableConfig : any = ''
- towTable : any = ''
- attributeList : any = [] // 物料属性规格
- inputValue : any = ''
- norms : any = ''
- normsValue : any = ''
- isAdd : any = false
- skuRuleList : any = ''
- tableList : any = ''
- attributeId : any = ''
- intercept : any = ''
- makeupList : any = [] // 组合商品列表
-
- dateDialogVisible = false
- dateLoading = false
- stime : any = null
- etime : any = null
- stimePickerOptions : any = {
- disabledDate(time : any) {
- return time.getTime() > Date.now();
- }
- }
- etimePickerOptions : any = {
- disabledDate(time : any) {
- return time.getTime() > Date.now();
- }
- }
- // tab
- toolConfig = {
- tools: {
- return: true,
- save: true,
- }
- }
- treeConfig = {
- attr: {
- retConfig: {
- id: 'id',
- },
- defaultExpandAll: true,
- label: 'name',
- // resType: 'data'
- },
- // request: {
- // url: '/maindata/maindataMaterialCategory/treeUseList',
- // method: 'GET'
- // }
- }
- singleTable : any = {
- attr: {
- size: 'mini',
- align: 'left',
- editRules: {
- skuTitle: [
- { required: true, message: '请输入标题'}
- ],
- skuCode: [
- { required: true, message: '请输入物料编码'}
- ],
- barCode: [
- { required: true, message: '请输入69码-商品条码'}
- ]
- }
- },
- columns: [
- {
- // width: '150px',
- title: '标题(必填项)',
- field: 'skuTitle',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' '
- },
- }
- },
- {
- // width: '150px',
- title: '副标题',
- field: 'skuSubtitle',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' '
- },
- }
- },
- {
- // width: '150px',
- title: '物料编码(必填项)',
- field: 'skuCode',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' '
- },
- }
- },
- {
- width: '110px',
- title: '69码-商品条码(必填项)',
- field: 'barCode',
- component: 'by-input',
- // width:110,
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' '
- },
- }
- },
- // {
- // width: '55px',
- // component: selectKin
- // },
- {
- // width: '150px',
- title: '财务编号',
- field: 'financialCode',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' '
- },
- }
- },
- {
- width: '90px',
- title: '价格',
- field: 'price',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' ',
- type: "number",
- min: 0,
- defaultValue: 0
- },
- }
- },
- {
- width: '90px',
- title: '单位',
- field: 'unit',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' ',
- },
- }
- },
- {
- width: '90px',
- title: '单位编码',
- field: 'unitCode',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' ',
- },
- }
- },
- // {
- // width: '70px',
- // title: '库存',
- // field: 'stock',
- // slot: true,
- // },
- {
- width: '100px',
- title: '保质期(天)',
- field: 'shelfLife',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' ',
- type: "integer",
- min: 0,
- },
- }
- },
- {
- width: '80px',
- title: '重量/g',
- field: 'weight',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' ',
- type: "number",
- min: 0,
- },
- }
- },
- {
- width: '80px',
- title: '长/cm',
- field: 'length',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' ',
- type: "number",
- min: 0,
- },
- }
- },
- {
- width: '80px',
- title: '宽/cm',
- field: 'width',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' ',
- type: "number",
- min: 0,
- },
- }
- },
- {
- width: '80px',
- title: '高/cm',
- field: 'height',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' ',
- type: "number",
- min: 0,
- },
- }
- },
- {
- width: '80px',
- title: '体积/cm³',
- field: 'volume',
- },
- // {
- // width: '100px',
- // title: '操作',
- // action: true,
- // // plugins: [{
- // // icon: 'el-icon-edit',
- // // name: '选择物料',
- // // audit: '',
- // // event: {
- // // click: () => {
- // // (this as any).openVxeData(1)
- // // }
- // // }
- // // }]
- // }
- ]
- }
- tableConfig : any = {
- attr: {
- size: 'mini',
- align: 'left',
- editRules: {
- skuTitle: [
- { required: true, message: '请输入标题'}
- ],
- skuCode: [
- { required: true, message: '请输入物料编码'}
- ],
- barCode: [
- { required: true, message: '请输入69码-商品条码'}
- ]
- }
- },
- columns: [
- {
- width: '160px',
- title: '标题(必填项)',
- field: 'skuTitle',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' '
- },
- }
- },
- {
- width: '120px',
- title: '副标题',
- field: 'skuSubtitle',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' '
- },
- }
- },
- {
- width: '140px',
- title: '物料编码(必填项)',
- field: 'skuCode',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' '
- },
- }
- },
- {
- width: '110px',
- title: '69码-商品条码(必填项)',
- field: 'barCode',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' ',
- },
- }
- },
- // {
- // width: '55px',
- // component: selectKin
- // },
- {
- width: '140px',
- title: '财务编号',
- field: 'financialCode',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' '
- },
- }
- },
- {
- width: '80px',
- title: '价格',
- field: 'price',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' ',
- type: "number",
- min: 0,
- },
- }
- },
- {
- width: '80px',
- title: '单位',
- field: 'unit',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' ',
- },
- }
- },
- {
- width: '80px',
- title: '单位编码',
- field: 'unitCode',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' ',
- },
- }
- },
- // {
- // width: '80px',
- // title: '库存',
- // field: 'stock',
- // slot: true,
- // },
- {
- width: '100px',
- title: '保质期(天)',
- field: 'shelfLife',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' ',
- type: "integer",
- min: 0,
- },
- }
- },
- {
- width: '80px',
- title: '重量/g',
- field: 'weight',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' ',
- type: "number",
- min: 0,
- },
- }
- },
- {
- width: '80px',
- title: '长/cm',
- field: 'length',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' ',
- type: "number",
- min: 0,
- },
- }
- },
- {
- width: '80px',
- title: '宽/cm',
- field: 'width',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' ',
- type: "number",
- min: 0,
- },
- }
- },
- {
- width: '80px',
- title: '高/cm',
- field: 'height',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: ' ',
- type: "number",
- min: 0,
- },
- }
- },
- {
- width: '80px',
- title: '体积/cm³',
- field: 'volume',
- },
- {
- width: '180px',
- title: '操作',
- action: true,
- plugins: [
- // {
- // icon: 'el-icon-edit',
- // name: '选择物料',
- // audit: '',
- // event: {
- // click: () => {
- // (this as any).openVxeData(2)
- // }
- // }
- // },
- {
- icon: 'el-icon-delete',
- name: '删除',
- audit: '',
- event: {
- click: (item : any) => {
- (this as any).doDeleteTable(item)
- }
- }
- },
- ]
- }
- ]
- }
- makeupTable : any = {
- attr: {
- size: 'mini',
- align: 'center',
- },
- columns: [
- {
- // width: '170px',
- title: '标题',
- field: 'title',
- },
- {
- // width: '170px',
- title: '副标题',
- field: 'subtitle',
- },
- {
- width: '170px',
- title: '数量',
- field: 'number',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- defaultValue: '1',
- type: 'number',
- min: '0'
- },
- }
- },
- {
- width: 120,
- title: '操作',
- action: true,
- plugins: [{
- name: '删除',
- event: {
- click: (item : any) => (this as any).deleteMakeup(item)
- }
- }]
- }
- ]
- }
- formConfig = {
- attr: {
- size: 'medium',
- rules: {
- name: [{
- required: true, message: '请输入名称', trigger: 'blur'
- }],
- // materialCode: [{
- // required: true, message: '请输入物料编码', trigger: 'blur'
- // }],
- basePrice: [{
- required: true, message: '请输入基本售价', trigger: 'blur'
- }],
- categoryName: [{
- required: true, message: '请选择物料分类', trigger: 'change'
- }],
- brandId: [{
- required: true, message: '请选择物料品牌', trigger: 'change'
- }],
- }
- },
- columns: [
- [
- {
- span: 6,
- label: '名称',
- prop: 'name',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入名称',
- clearable: true
- }
- }
- },
- {
- span: 6,
- label: '简称',
- prop: 'shortName',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入简称',
- clearable: true
- }
- }
- },
- {
- span: 6,
- label: '物料编码',
- prop: 'materialCode',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入物料编码',
- }
- }
- },
- {
- span: 6,
- label: '货号',
- prop: 'itemNumber',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入货号',
- clearable: true
- }
- }
- },
- ],
- [
- {
- span: 6,
- label: '基本售价',
- prop: 'basePrice',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入基本售价',
- type: 'number',
- min: '0'
- }
- }
- },
- {
- span: 6,
- label: '市场价格',
- prop: 'markPrice',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入市场价格',
- type: 'number',
- min: '0'
- }
- }
- },
- {
- span: 6,
- label: '国际码',
- prop: 'nsCode',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入国际码',
- clearable: true
- }
- }
- },
- ],
- [
- {
- span: 6,
- label: '物料分类',
- prop: 'categoryName',
- component: 'select-tree',
- compConfig: {
- attr: {
- label: 'name',
- clearable: true,
- placeholder: '请选择物料分类',
- retConfig: {
- categoryName: 'name',
- categoryId: 'id'
- },
- defaultExpandAll: true
- },
- request: {
- url: '/maindata/maindataMaterialCategory/treeUseList'
- }
- }
- },
- {
- span: 6,
- label: '物料品牌',
- prop: 'brandId',
- component: brandType,
- },
- {
- span: 6,
- label: '虚拟分类',
- prop: 'vmCategoryName',
- component: 'select-tree',
- compConfig: {
- attr: {
- label: 'name',
- clearable: true,
- placeholder: '请选择虚拟分类',
- retConfig: {
- vmCategoryName: 'name',
- vmCategoryId: 'id'
- },
- defaultExpandAll: true
- },
- request: {
- url: '/maindata/maindataMaterialVmcategory/treeUseList'
- }
- }
- },
- {
- labelWidth: '116px',
- span: 6,
- label: '机构商品分类',
- prop: 'organizationCategoryName',
- component: 'select-tree',
- compConfig: {
- attr: {
- label: 'name',
- clearable: true,
- placeholder: '请选择机构商品分类',
- retConfig: {
- organizationCategoryName: 'name',
- organizationCategoryId: 'id'
- },
- defaultExpandAll: true
- },
- request: {
- url: '/maindata/maindataMaterialOrganizationCategory/treeUseList'
- }
- }
- },
- ],
- [
- {
- span: 30,
- label: '描述',
- slot: true,
- prop: 'description',
- }
- ],
- [
- {
- span: 20,
- label: '标签',
- slot: true,
- prop: 'tags',
- }
- ],
- [
- {
- span: 20,
- label: '物料状态',
- slot: true,
- prop: 'status',
- }
- ],
- [
- {
- span: 20,
- label: '组合商品',
- slot: true,
- prop: 'ismakeup',
- }
- ],
- [
- {
- span: 30,
- label: '',
- slot: true,
- prop: 'makeupTable',
- }
- ],
- [
- {
- span: 20,
- label: '是否公布',
- slot: true,
- prop: 'issued',
- }
- ],
- [
- {
- span: 20,
- label: '商品规格',
- slot: true,
- prop: 'materialSpec',
- }
- ],
- [
- {
- span: 30,
- label: '物料属性',
- slot: true,
- prop: 'attributeName',
- }
- ],
- ],
- }
- config : any = {
- attr: {
- calculateH: true
- },
- search: {
- attr: {
- size: 'mini'
- },
- columns: [
- [
- {
- span: 6,
- label: '名称',
- prop: 'name',
- component: 'by-input',
- labelWidth: '70px',
- compConfig: {
- attr: {
- placeholder: '请输入名称',
- clearable: true
- }
- },
- }, {
- span: 6,
- label: '简称',
- prop: 'shortName',
- component: 'by-input',
- labelWidth: '70px',
- compConfig: {
- attr: {
- placeholder: '请输入简称',
- clearable: true
- }
- }
- },
- {
- span: 6,
- label: '货号',
- prop: 'itemNumber',
- component: 'by-input',
- labelWidth: '70px',
- compConfig: {
- attr: {
- placeholder: '请输入货号',
- clearable: true
- }
- }
- },
- ],
- ]
- },
- tool: {
- tools: {
- add: true,
- delete: true,
- search: true,
- refresh: true,
- },
- customTools: [
- {
- name: '同步金蝶物料', icon: 'el-icon-top', audit: [''], event: {
- click: () => {
- (this as any).syncSystem()
- }
- }
- },
- {
- name: '商品监控', icon: 'el-icon-document', event: {
- click: () => {
- let data = (this.$refs.moduleView as any).getSelectData();
- if(data.length !== 1) {
- this.$message('请选择一条商品!')
- return
- }
- (this.$refs.StoreRecord as any).setShow(true);
- (this.$refs.StoreRecord as any).setData(data[0]);
- }
- }
- }
- ]
- },
- table: {
- attr: {
- size: 'mini',
- align: 'left',
- checkbox: true,
- },
- columns: [{
- width: 250,
- title: '名称',
- field: 'name',
- isDetail: true,
- }, {
- width: 200,
- title: '简称',
- field: 'shortName'
- }, {
- width: 200,
- title: '货号',
- field: 'itemNumber'
- }, {
- width: 200,
- title: '国际码',
- field: 'nsCode'
- }, {
- width: 90,
- title: '基本售价',
- field: 'basePrice'
- }, {
- width: 90,
- title: '市场价格', // (市场价格统一售价)
- field: 'markPrice'
- },
- {
- width: 120,
- title: '操作',
- action: true,
- plugins: [{
- icon: 'el-icon-edit',
- name: '编辑',
- audit: '',
- event: {
- click: (item : any) => {
- (this as any).getDetail(item)
- }
- }
- }, {
- name: '删除',
- event: {
- click: (item : any) => (this as any).doDelete2(item)
- }
- }]
- }]
- },
- }
-
- tableloading: boolean = true
- tableRadio: any = {}
- tableData: any = []
- newtableData: any = []
- tableSearchForm: any = {}
- tableDataTotal: any = 0
- tablePageSize: any = 10
- tablePageNum: any = 1
-
- productDataList: any = []
-
- mounted() {
- this.getAttribute()
- this.timer = setInterval(() => {
- this.getDataList()
- }, 500)
-
- // 获取关联金蝶财务系统物料列表
- var t = new Date();
- var y = t.getFullYear();
- var m:any = t.getMonth()+1;
- if(m<10){m='0'+m}
- var d:any = t.getDate()
- if(d<10){d='0'+d}
- this.tableSearchForm.stime = '2020-01-01';
- this.tableSearchForm.etime = y+'-'+m+'-'+d;
- this.etime = y+'-'+m+'-'+d;
- // this.getFinancialCode()
- }
- // 确定商品新增
- confirmProduct(e : any) {
- this.$nextTick(() => {
- let nowData = (this.$refs.makeupTable as any).getValue();
- let names = '';
- if (e.length > 0) {
- for (const item of e) {
- this.productDataList.push(item)
- let t = true;
- for (const t_item of nowData) {
- if (item.id == t_item.materialSkuId) {
- if (!names) {
- names = item.skuTitle
- } else {
- names = names + ',' + item.skuTitle
- }
- t = false;
- break;
- }
- }
- if (t) {
- let obj : any = {};
- obj.title = item.skuTitle
- obj.subtitle = item.skuSubtitle
- obj.materialSkuId = item.id
- obj.isDeleted = 0
- this.makeupList.push(obj);
- nowData.push(obj);
- }
- };
- (this as any).$refs.makeupTable.setValue(nowData) // 设置表格数据
- if (names) {
- this.$alert('商品 “' + names + '”已存在!', '提示', {
- confirmButtonText: '确定',
- });
- }
- }
- })
- }
- //点击树获取数据
- onChangeTree(e : any) {
- this.categoryIds = e.id;
- var ids:any = e.id;
- if(e.id[0]==0) ids = 0;
- let loading = this.$loading({ target: '.main-container' });
- api.byCategoryPage({
- categoryId: ids,
- pageSize: 20,
- pageNo: 1,
- }, 'maindataMaterialCategory').then((res : any) => {
- loading.close();
- if (res.code === 200) {
- (this.$refs.moduleView as any).setTableValue(res.data.records);
- let page = {
- pageNo: res.data.current, //当前页
- pageSize: res.data.size, //每页条数
- total: res.data.total //总条数
- };
- (this.$refs.moduleView as any).setPage(page);
- }
- }).catch(() => loading.close());
- }
- // 保存编辑/新增
- doFormData() {
- (this as any).$refs.form.validate().then(() => {
- let query = (this as any).$refs.form.getValue();
- // console.log('物料信息 ==> ', query);
- query.materialSpec = this.materialSpec; // 商品规格
- query.attributeList = JSON.stringify(this.attributeList) // 物料属性
- query.attributeId = this.attributeId // 物料属性ID
- query.status = this.status; // 物料状态
- query.tags = this.tagsData.join(","); // 标签
- query.ismakeup = this.ismakeup; // 商品组合
- query.issued = this.issued; // 是否公布
- query.description = this.textarea; // 备注
- let data : any = {}
- // 多规格
- if (query.materialSpec === 1) {
- if (this.tableList.length <= 0 || this.attributeList.length <= 0) return (this as any).$message.warning('多规格商品,物料属性不能为空!');
- // console.log('多规格表格数据 ==> ', this.tableList);
- for (let v of this.tableList) {
- // if (!v.price) return this.$message.warning('物料属性价格必填');
- // if (parseInt(v.price) <= 0) return this.$message.warning('物料属性价格不能小于1');
- // if (!v.unit) return this.$message.warning('物料属性单位必填');
- // if (!v.stock) return this.$message.warning('物料属性库存必填');
- // if (parseInt(v.stock) <= 0) return this.$message.warning('物料属性库存必须为自然数');
- // if (!v.shelfLife) return this.$message.warning('物料属性保质期必填');
- // if (parseInt(v.shelfLife) <= 0) return this.$message.warning('物料属性保质期必须为自然数');
- // if (!v.weight) return this.$message.warning('物料属性重量必填');
- // if (parseInt(v.weight) <= 0) return this.$message.warning('物料属性重量不能小于1');
- // if (!v.length) return this.$message.warning('物料属性长度必填');
- // if (parseInt(v.length) <= 0) return this.$message.warning('物料属性长度不能小于1');
- // if (!v.width) return this.$message.warning('物料属性宽度必填');
- // if (parseInt(v.width) <= 0) return this.$message.warning('物料属性宽度不能小于1');
- // if (!v.height) return this.$message.warning('物料属性高度必填');
- // if (parseInt(v.height) <= 0) return this.$message.warning('物料属性高度不能小于1');
- (this.$refs.table as any).validate();
- if (!v.skuTitle) return this.$message.warning('物料标题必填');
- if (!v.skuCode) return this.$message.warning('物料编码必填');
- if (!v.barCode) return this.$message.warning('物料属性的69码-商品条码需必填');
- if (!/^\d{1,32}$/.test(v.barCode)){
- return this.$message.warning('69码-商品条码为数字,最大32位');
- }
- // if(v.weight&&v.weight!=0){
- // v.weight = v.weight/1000
- // }
- // v.isDeleted = 0
- v.ismakeup = this.ismakeup
- };
- data = { maindataMaterialReceiveParam: query, maindataMaterialSkus: this.tableList }
- let newArray : any = []
- let materialSpecData : any = []
- let attributeLength = this.attributeList.length
- this.tableList.map((v : any) => {
- for (let kyes in v) {
- if (kyes.indexOf('_field_name') != -1) {
- let key = kyes.split('_field_name')[0]
- newArray.push({ [key]: v[kyes] })
- }
- }
- })
- // console.log('newArray ==> ',newArray);
- for (var i = 0; i < newArray.length; i += attributeLength) {
- materialSpecData.push(newArray.slice(i, i + attributeLength));
- }
- // console.log('materialSpecData ==> ', materialSpecData);
- data.maindataMaterialSkus.map((v : any, i : any) => {
- if (materialSpecData[i]) v.materialSpec = JSON.stringify(materialSpecData[i])
- })
- } else { // 单规格
- data = { maindataMaterialReceiveParam: query, maindataMaterialSkus: (this.$refs.singeTable as any).getValue() }
- // console.log('单规格表格数据 ==> ', data.maindataMaterialSkus);
- for (let v of data.maindataMaterialSkus) {
- // if (!v.price) return this.$message.warning('物料价格必填');
- // if (parseInt(v.price) <= 0) return this.$message.warning('物料价格不能小于1');
- // if (parseInt(v.price) < 0) return this.$message.warning('物料价格不能为负数');
- // if (!v.unit) return this.$message.warning('物料单位必填');
- // if (!v.stock) return this.$message.warning('物料库存必填');
- // if (parseInt(v.stock) <= 0) return this.$message.warning('物料库存必须为自然数');
- // if (!v.shelfLife) return this.$message.warning('物料保质期必填');
- // if (parseInt(v.shelfLife) <= 0) return this.$message.warning('物料保质期必须为自然数');
- // if (!v.weight) return this.$message.warning('物料重量必填');
- // if (parseInt(v.weight) <= 0) return this.$message.warning('物料重量不能小于1');
- // if (!v.length) return this.$message.warning('物料长必填');
- // if (parseInt(v.length) <= 0) return this.$message.warning('物料长不能小于1');
- // if (!v.width) return this.$message.warning('物料宽必填');
- // if (parseInt(v.width) <= 0) return this.$message.warning('物料宽不能小于1');
- // if (!v.height) return this.$message.warning('物料高必填');
- // if (parseInt(v.height) <= 0) return this.$message.warning('物料高不能小于1');
- (this.$refs.singeTable as any).validate();
- if (!v.skuTitle) return this.$message.warning('物料属性的标题需必填');
- if (!v.skuCode) return this.$message.warning('物料属性的物料编码需必填');
- if (!v.barCode) return this.$message.warning('物料属性的69码-商品条码需必填');
- if (!/^\d{1,32}$/.test(v.barCode)){
- return this.$message.warning('69码-商品条码为数字,最大32位');
- }
-
- // if(v.weight&&v.weight!=0){
- // v.weight = v.weight/1000
- // }
- // v.isDeleted = 1
- v.ismakeup = this.ismakeup
- };
- data.maindataMaterialSkus[0].isDeleted = 0;
- data.maindataMaterialReceiveParam.attributeList = ""
- }
- if (this.ismakeup === 0) {
- // console.log('this.makeupList ==> ', this.makeupList);
- if (this.makeupList.length <= 0) return this.$message.warning('请选择组合商品');
- data.maindataMaterialLinks = this.makeupList;
- // 表格删除
- data.maindataMaterialLinks.map((v : any, i : any) => {
- if (v.isDeleted === 1 && !v.id) {
- data.maindataMaterialLinks.splice(i, 1)
- }
- });
- }
- // console.log('data ==> ', data);
- let loading = this.$loading({ target: '.main-container' });
- if (this.isEdit) { // 编辑
- api.updateList(data, 'maindataMaterial').then((res : any) => {
- loading.close()
- if (res.code === 200) {
- this.isShow = 'home';
- // (this as any).$refs.sideTree.request();
- this.getDataList();
- this.$message.success('保存成功');
- }
- }).catch(() => loading.close());
- } else {// 新增
- api.saveList(data, 'maindataMaterial').then((res : any) => {
- loading.close()
- if (res.code === 200) {
- this.isShow = 'home';
- // (this as any).$refs.sideTree.request();
- this.getDataList();
- this.$message.success('保存成功');
- }
- }).catch(() => loading.close());
- }
- }).catch(() => {});
- }
- // 打开新增
- onAdd() {
- this.isShow = 'add'; // 展示类型
- this.selectValue = '' // 物料属性名称
- this.towTable = '' // 表格数据
- this.textarea = '' // 描述
- this.tagsData = [] // 标签
- this.attributeList = [] // 属性规格
- this.tableList = [] // 表格数据
- this.materialSpec = 0; // 单规格
- this.status = 0; // 物料状态
- this.ismakeup = 1; // 商品组合
- this.makeupList = [] // 组合商品列表
- this.issued = 0; // 是否公布
- this.isSingle = true; // 显示单表格
- this.isEdit = false; // 是否编辑
- (this as any).$refs.byTool.setTool({ return: true, save: true });
- this.$nextTick(() => {
- (this as any).$refs.form.setValue(); // 设置表单数据
- (this as any).$refs.singeTable.setValue([{}]) // 设置单表格数据
- });
- }
- // 打开编辑
- getDetail(e : any) {
- // console.log('编辑 ==> ', e);
- (this as any).$refs.byTool.setTool({ return: true, save: true, delete: true });
- let loading = this.$loading({ target: '.my-container' });
- api.single({ id: e.id }, 'maindataMaterial').then((v : any) => {
- let data = v.data;
- if (data.vmCategoryId) {
- api.single({ id: data.vmCategoryId }, 'maindataMaterialVmcategory').then((res : any) => {
- if (res.code === 200) {
- if (res.data) data.vmCategoryName = res.data.name;
- }
- }).catch(() => loading.close());
- }
- if (data.organizationCategoryId) {
- api.single({ id: data.organizationCategoryId }, 'maindataMaterialOrganizationCategory').then((res : any) => {
- if (res.code === 200) {
- if (res.data) data.organizationCategoryName = res.data.name;
- }
- }).catch(() => loading.close());
- }
-
- this.intercept = data.attributeId // 拦截物料属性判断
- this.isEdit = true;
- this.editInfo = data;
- this.isShow = 'add';
- // 标签
- if (data.tags) {
- this.tagsData = data.tags.split(",")
- } else this.tagsData = [];
- this.materialSpec = data.materialSpec
- if(this.materialSpec == 1){
- this.ismakeup = 1
- }else{
- this.ismakeup = 0
- }
- this.isSingle = data.materialSpec === 0 ? true : false;
- if (data.attributeList) this.attributeList = JSON.parse(data.attributeList);
-
- if (data.categoryId) {
- api.single({ id: data.categoryId }, 'maindataMaterialCategory').then((res : any) => {
- if (res.code === 200) data.categoryName = res.data.name;
- if (data.attributeId) {
- api.single({ id: data.attributeId }, 'maindataMaterialAttribute').then((p : any) => {
- if (p.code === 200) {
- if (p.data) this.selectValue = p.data.name
- }
- }).catch(() => loading.close());
- }
- other.selectByMaterialId({ id: data.id }, 'maindataMaterialSku').then((info : any) => {
- if (info.code === 200) {
- this.status = data.status
- // console.log(data.ismakeup);
- this.ismakeup = data.ismakeup
- if (data.ismakeup === 0 && data.maindataMaterialLinks.length > 0) {
- (this as any).makeupList = data.maindataMaterialLinks;
- setTimeout(() => {
- (this as any).$refs.makeupTable.setValue(data.maindataMaterialLinks) // 设置组合表格数据
- })
- }
- this.issued = data.issued
- if (this.isSingle) {
- this.selectValue = '' // 物料属性名称
- this.towTable = '' // 表格数据
- this.attributeList = []; // 属性规格
- this.$nextTick(() => {
- // console.log(info.data);
- info.data.map((v : any, i : any) => {
- // if(v.volume&&v.weight!='0.00'&&v.weight!=0&&v.weight!='0'){
- // v.weight = parseFloat(v.weight)*1000
- // }
- if(v.volume&&v.volume!='0.00'&&v.volume!=0&&v.volume!='0'){
- v.volume = parseFloat(v.volume).toFixed(2)
- }
- });
- (this as any).$refs.singeTable.setValue(info.data);
- });
- } else {
- this.forFun(this.attributeList[0], 0) // 生成sku
- let tableConfig = (this as any).$lodash.cloneDeep(this.tableConfig);
- let skuRuleList = (this as any).$lodash.cloneDeep(this.skuRuleList);
- let newColumns = (this as any).$lodash.cloneDeep(this.attributeList).reverse();
- info.data.map((v : any, i : any) => {
- v = Object.assign(v, skuRuleList[i])
- v.dataIndex = i
- // if(v.volume&&v.weight!='0.00'&&v.weight!=0&&v.weight!='0'){
- // v.weight = parseFloat(v.weight)*1000
- // }
- if(v.volume&&v.volume!='0.00'&&v.volume!=0&&v.volume!='0'){
- v.volume = parseFloat(v.volume).toFixed(2)
- }
- });
- newColumns.map((v : any) => {
- tableConfig.columns.unshift({
- width: '80px',
- title: v.title,
- field: v.field,
- })
- });
- this.tableList = (this as any).$lodash.cloneDeep(info.data);
- // console.log('表格配置 ==> ', tableConfig);
- // console.log('skuRuleList ==> ', skuRuleList);
- // console.log('表格数据 ==> ', this.tableList);
- this.setTableConfig = tableConfig;
- this.$nextTick(() => {
- (this as any).$refs.table.setConfig(tableConfig); // 设置表格配置
- (this as any).$refs.table.setValue(this.tableList) // 设置表格数据
- });
- }
- }
- (this as any).$refs.form.setValue(data)
- loading.close()
- }).catch(() => loading.close());
- }).catch(() => loading.close());
- } else {
- // loading.close();
- // this.$message.error('该数据没有物料分类id')
- other.selectByMaterialId({ id: data.id }, 'maindataMaterialSku').then((info : any) => {
- if (info.code === 200) {
- this.status = data.status
- // console.log(data.ismakeup);
- this.ismakeup = data.ismakeup
- if (data.ismakeup === 0 && data.maindataMaterialLinks.length > 0) {
- (this as any).makeupList = data.maindataMaterialLinks;
- setTimeout(() => {
- (this as any).$refs.makeupTable.setValue(data.maindataMaterialLinks) // 设置组合表格数据
- })
- }
- this.issued = data.issued
- if (this.isSingle) {
- this.selectValue = '' // 物料属性名称
- this.towTable = '' // 表格数据
- this.attributeList = []; // 属性规格
- this.$nextTick(() => {
- (this as any).$refs.singeTable.setValue(info.data);
- });
- } else {
- this.forFun(this.attributeList[0], 0) // 生成sku
- let tableConfig = (this as any).$lodash.cloneDeep(this.tableConfig);
- let skuRuleList = (this as any).$lodash.cloneDeep(this.skuRuleList);
- let newColumns = (this as any).$lodash.cloneDeep(this.attributeList).reverse();
- info.data.map((v : any, i : any) => {
- v = Object.assign(v, skuRuleList[i])
- v.dataIndex = i
- });
- newColumns.map((v : any) => {
- tableConfig.columns.unshift({
- width: '80px',
- title: v.title,
- field: v.field,
- })
- });
- this.tableList = (this as any).$lodash.cloneDeep(info.data);
- // console.log('表格配置 ==> ', tableConfig);
- // console.log('skuRuleList ==> ', skuRuleList);
- // console.log('表格数据 ==> ', this.tableList);
- this.setTableConfig = tableConfig;
- this.$nextTick(() => {
- (this as any).$refs.table.setConfig(tableConfig); // 设置表格配置
- (this as any).$refs.table.setValue(this.tableList) // 设置表格数据
- });
- }
- }
- (this as any).$refs.form.setValue(data)
- loading.close()
- }).catch(() => loading.close());
- }
- }).catch(() => loading.close());
- }
- // 同步金蝶物料
- syncSystem() {
- (this as any).dateDialogVisible = true
- }
- dateConfirm(){
- if((this as any).stime){
- (this as any).dateLoading = true;
- var data = {
- stime: (this as any).stime,
- etime: (this as any).etime
- }
- // console.log(data)
- api.syncMaterialByKingdeeToOms(data).then((res : any) => {
- if(res.code === 200){
- (this as any).dateDialogVisible = false;
- (this as any).dateLoading = false;
- this.$message.success('同步金蝶物料成功');
- }else{
- (this as any).dateLoading = false;
- this.$message.error(res.msg);
- }
- }).catch(()=>{
- (this as any).dateLoading = false;
- })
- }else{
- this.$message.warning('请选择时间');
- }
-
- }
- // 立即生成
- generateNow() {
- this.forFun(this.attributeList[0], 0) // 生成sku
- let newArray : any = []
- let materialSpecData : any = []
- let attributeLength = this.attributeList.length
- let tableConfig = (this as any).$lodash.cloneDeep(this.tableConfig);
- let skuRuleList = (this as any).$lodash.cloneDeep(this.skuRuleList);
- let newColumns = (this as any).$lodash.cloneDeep(this.attributeList).reverse();
- let tableList = (this as any).$refs.table.getValue();
- tableList.map((v : any) => {
- for (let key in v) {
- if (key.indexOf('_field_name') != -1) {
- delete v[key]
- }
- }
- })
- skuRuleList.map((v : any) => {
- for (let kyes in v) {
- if (kyes.indexOf('_field_name') != -1) {
- let key = kyes.split('_field_name')[0]
- newArray.push({ [key]: v[kyes] })
- }
- }
- })
- // console.log('skuRuleList ==> ', skuRuleList);
- for (var i = 0; i < newArray.length; i += attributeLength) {
- materialSpecData.push(newArray.slice(i, i + attributeLength));
- }
- // console.log('materialSpecData ==> ', materialSpecData);
- skuRuleList.map((v : any, i : any) => {
- v.materialSpec = JSON.stringify(materialSpecData[i]);
- v.dataIndex = i;
- v.isDeleted = 0;
- if (tableList[i] && v.materialSpec.indexOf(tableList[i].materialSpec != -1)) {
- v = Object.assign(v, tableList[i])
- };
- })
- newColumns.map((v : any) => {
- tableConfig.columns.unshift({
- width: '80px',
- title: v.title,
- field: v.field,
- })
- });
- // console.log('旧表格数据 ==> ', tableList);
- // console.log('新表格数据 ==> ', skuRuleList);
- this.tableList = skuRuleList;
- this.setTableConfig = tableConfig;
- this.$nextTick(() => {
- (this as any).$refs.table.setConfig(tableConfig); // 设置表格配置
- (this as any).$refs.table.setValue(this.tableList); // 设置表格数据
- });
- }
- // 更换物料属性数据
- getSelectValue(e : any) {
- if (this.intercept === e) return console.log('拦截!');
- this.$confirm('确定更换物料属性吗?确定之后原表格数据会被清除', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- api.single({ id: e }, 'maindataMaterialAttribute').then((res : any) => {
- if (res.code === 200) {
- this.selectList.map((v : any) => {
- if (v.id === e) {
- v.id = e
- this.selectValue = v.name
- }
- });
- this.intercept = e
- this.attributeList = JSON.parse(res.data.attributeValue);
- this.attributeId = e
- this.forFun(this.attributeList[0], 0) // 生成sku
- let tableConfig = (this as any).$lodash.cloneDeep(this.tableConfig);
- let skuRuleList = (this as any).$lodash.cloneDeep(this.skuRuleList);
- let newColumns = (this as any).$lodash.cloneDeep(this.attributeList).reverse();
- let giveInfo = (this as any).$refs.form.getValue();
- skuRuleList.map((v : any, i : any) => {
- v.dataIndex = i;
- v.isDeleted = 0;
- v.skuTitle = giveInfo.name;
- v.skuSubtitle = giveInfo.shortName;
- v.price = giveInfo.basePrice
- })
- newColumns.map((v : any) => {
- tableConfig.columns.unshift({
- width: '80px',
- title: v.title,
- field: v.field,
- })
- });
- // console.log('表格配置 ==> ', tableConfig);
- // console.log('表格数据 ==> ', skuRuleList);
- this.setTableConfig = tableConfig;
- this.tableList = skuRuleList;
- this.$nextTick(() => {
- (this as any).$refs.table.setConfig(tableConfig); // 设置表格配置
- (this as any).$refs.table.setValue(skuRuleList); // 设置表格数据
- });
- }
- }).catch(() => {});
- }).catch(() => { });
- }
- // 关联金蝶财务系统物料选择
- handleSelectionChange(row: any){
- // console.log(row)
- this.tableRadio = row
- }
- // 关联金蝶财务系统物料列表搜索
- tableSearchOnSubmit(){
- this.getFinancialCode()
- }
- // 关联金蝶财务系统物料列表重置
- resetTableSearch(){
- var t = new Date();
- var y = t.getFullYear();
- var m:any = t.getMonth()+1;
- if(m<10){m='0'+m}
- var d:any = t.getDate()
- if(d<10){d='0'+d}
- this.tableSearchForm.fname = null;
- this.tableSearchForm.fnumber = null;
- this.tableSearchForm.stime = '2020-01-01';
- this.tableSearchForm.etime = y+'-'+m+'-'+d;
- this.getFinancialCode()
- }
- // 关联金蝶财务系统物料表格分页
- currentChange(e: any){
- this.newtableData = this.tableData.slice((e-1)*this.tablePageSize, e*this.tablePageSize)
- }
- // 打开关联金蝶财务系统物料选择
- openVxeData(){
- this.vxeValue = true;
- if(this.tableData.length==0){
- setTimeout(()=>{
- this.getFinancialCode();
- },0)
- }
- }
- // 获取关联金蝶财务系统物料列表
- getFinancialCode(){
- this.tableloading = true;
- api.getFinancialCode(this.tableSearchForm).then((res : any) => {
- if(res.code==200){
- this.tableloading = false;
- this.tableData = res.data
- if(this.tableSearchForm.fname || this.tableSearchForm.fnumber){
- let newData = [];
- if(this.tableSearchForm.fname){
- newData = this.tableData.filter((v : any) => v.fname.indexOf(this.tableSearchForm.fname) != -1);
- }
- if(this.tableSearchForm.fnumber){
- newData = this.tableData.filter((v : any) => v.fnumber.indexOf(this.tableSearchForm.fnumber) != -1);
- }
- if(this.tableSearchForm.fname && this.tableSearchForm.fnumber){
- newData = this.tableData.filter((v : any) => v.fname.indexOf(this.tableSearchForm.fname) != -1 && v.fnumber.indexOf(this.tableSearchForm.fnumber) != -1);
- }
- this.tableDataTotal = newData.length
- this.newtableData = newData.slice(0, this.tablePageNum*this.tablePageSize)
- }else{
- this.tableDataTotal = this.tableData.length
- this.newtableData = this.tableData.slice(0, this.tablePageNum*this.tablePageSize)
- }
- }else{
- this.$message.error(res.msg);
- this.tableloading = false;
- }
- }).catch(() => {});
- }
- // 确定关联金蝶财务系统物料
- doConfirm() {
- if(JSON.stringify(this.tableRadio) === "{}" || this.tableRadio === null || this.tableRadio === {}) { return this.$message.warning('请选择物料'); }
- // 表单赋值赋值
- var val2 = (this as any).$refs.form.getValue();
- val2.name = this.tableRadio.fname;
- val2.shortName = this.tableRadio.fname;
- // 物料属性赋值
- var val = (this as any).$refs.singeTable.getValue();
- if(JSON.stringify(val[0]) === "{}" || val[0] === null){
- val = [{
- skuTitle: this.tableRadio.fname,
- skuSubtitle: this.tableRadio.fname,
- // skuCode: '',
- financialCode: this.tableRadio.fnumber,
- // price: '0',
- unit: this.tableRadio.fbaseUnitName,
- unitCode: this.tableRadio.fbaseUnitCode,
- // shelfLife: '0',
- // weight: '0',
- // length: '0',
- // width: '0',
- // height: '0',
- // volume: '0',
- }];
- this.$message.success('关联物料 '+this.tableRadio.fname+' 成功');
- }else{
- this.$message.success('物料 '+val[0].skuTitle+' 信息变更为 '+this.tableRadio.fname);
- val[0].skuTitle = this.tableRadio.fname;
- val[0].skuSubtitle = this.tableRadio.fname;
- val[0].financialCode = this.tableRadio.fnumber;
- val[0].unit = this.tableRadio.fbaseUnitName;
- val[0].unitCode = this.tableRadio.fbaseUnitCode;
- }
- (this as any).$refs.singeTable.setValue(val);
- (this as any).$refs.form.setValue(val2);
- this.vxeValue = false;
- }
- // 切换组合商品
- openMakeup() {
- (this.$refs.product as any).setShow(true); // 打开sku弹窗
- }
- // 切换商品规格
- changeSingle() {
- if(this.materialSpec == 1){
- this.ismakeup = 1
- }
- if (this.isSingle) {
- if ((this as any).$refs.singeTable) this.singeTable = (this as any).$refs.singeTable.getValue()
- this.isSingle = false;
- this.$nextTick(() => {
- // 设置表格数据
- if (this.towTable) {
- if ((this as any).$refs.table) {
- this.tableList = this.towTable;
- (this as any).$refs.table.setConfig(this.setTableConfig); // 设置表格配置
- (this as any).$refs.table.setValue(this.towTable); // 设置表格数据
- }
- }
- });
- } else {
- if ((this as any).$refs.table) this.towTable = (this as any).$refs.table.getValue()
- this.isSingle = true;
- this.$nextTick(() => {
- // 设置单表格数据
- if (this.singeTable) {
- // console.log('单表格数据 ==> ', this.singeTable);
- (this as any).$refs.singeTable.setValue(this.singeTable);
- } else (this as any).$refs.singeTable.setValue([{}]);
- });
- }
- }
- // 添加规格
- showInput(index : any) {
- this.$confirm('确定添加吗!确定后将可能影响原表格数据', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- let inputValue = (this as any).$refs['getValue_' + index][0].getValue();
- if (!inputValue) return (this as any).$message.warning('请输入内容');
- if (!/^\S*$/.test(inputValue)) return (this as any).$message.warning('输入内容不能有空格');
- if (this.attributeList[index].list.indexOf(inputValue) !== -1) return (this as any).$refs['getValue_' + index][0].clearValue();
- if (inputValue) {
- this.attributeList[index].list.push(inputValue);
- }
- (this as any).$refs['getValue_' + index][0].clearValue();
- this.generateNow();
- this.$message.success('添加成功');
- }).catch(() => this.$message.info('已取消添加'));
- }
- // 添加sku规格
- doComfirm() {
- if (!this.normsValue || !this.norms) return (this as any).$message.warning('请添加完整的规格');
- if (!/^\S*$/.test(this.normsValue) || !/^\S*$/.test(this.norms)) return this.$message.warning('输入内容不能有空格');
- this.$confirm('确定添加吗!确定后将可能影响原表格数据', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- let obj : any = {
- title: this.norms,
- field: this.norms + '_field_name',
- list: [this.normsValue]
- };
- this.attributeList.push(obj);
- this.norms = '';
- this.normsValue = '';
- this.isAdd = false;
- this.generateNow();
- this.$message.success('添加成功');
- }).catch(() => this.$message.info('已取消添加'));
- }
- // 监听表格数据
- getInputValue(e : any) {
- // console.log('监听表格 ==> ', e);
- if (e.length && e.width && e.height) {
- e.volume = (e.length * e.width * e.height).toFixed(2);
- }
- }
- // 监听组合商品表格数据
- getMakeupTableValue(e : any) {
- // console.log('监听表格 ==> ', e);
- // console.log(this.productDataList)
- this.volumeCount()
- }
- volumeCount(){
- let nowData:any = (this.$refs.makeupTable as any).getValue();
- var data:any = {
- weight: 0,
- length: 0,
- width: 0,
- height: 0
- }
- for (let i in this.productDataList) {
- for (let j in nowData) {
- if(this.productDataList[i].id==nowData[j].materialSkuId){
- var number:any = 1;
- if(nowData[j].number){
- var number:any = parseFloat(nowData[j].number).toFixed(2);
- }
- if(this.productDataList[i].weight){
- var weight:any = parseFloat(this.productDataList[i].weight).toFixed(2);
- data.weight += weight*number;
- }
- if(this.productDataList[i].length){
- var length:any = parseFloat(this.productDataList[i].length).toFixed(2);
- data.length += length*number;
- }
- if(this.productDataList[i].width){
- var width:any = parseFloat(this.productDataList[i].width).toFixed(2);
- data.width += width*number;
- }
- if(this.productDataList[i].height){
- var height:any = parseFloat(this.productDataList[i].height).toFixed(2);
- data.height += height*number;
- }
- }
- }
- }
- var val = (this as any).$refs.singeTable.getValue();
- val[0].weight = data.weight;
- val[0].length = data.length;
- val[0].width = data.width;
- val[0].height = data.height;
- (this as any).$refs.singeTable.setValue(val);
- }
-
- // 排序生成
- forFun(data : any, i : number, v ?: any) {
- if (data.list) {
- let d : Array<any> = [];
- data.list.forEach((item : any) => {
- if (i == 0) { // 第一次循环
- let obj : any = {}
- obj[data.field] = item
- d.push(obj);
- } else {
- v.forEach((ele : any) => {
- let obj : any = {};
- obj = (this as any).$lodash.clone(ele);
- obj[data.field] = item
- d.push(obj);
- });
- }
- });
- i++
- if (this.attributeList[i]) {
- this.forFun(this.attributeList[i], i, d);
- }
- else {
- this.skuRuleList = d;
- }
- }
- }
- // 添加标签
- getTagsValue() {
- let value = (this as any).$refs.tagsValue.getValue().trim();
- if (!value) return this.$message.warning('请输入标签值');
- this.tagsData.push(value);
- (this as any).$refs.tagsValue.clearValue();
- }
- // 删除标签
- handleClose2(index : any) {
- this.$confirm('确定删除吗!', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- this.tagsData.splice(index, 1)
- this.$message.success('删除成功');
- }).catch(() => this.$message.info('已取消删除'));
- }
- // 删除标签
- handleClose(tag : any, index : any) {
- this.$confirm('确定删除吗!确定后将可能影响原表格数据', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- this.attributeList[index].list.splice(this.attributeList[index].list.indexOf(tag), 1);
- this.generateNow();
- this.$message.success('删除成功');
- }).catch(() => this.$message.info('已取消删除'));
- }
- // 删除数组
- closeGroup(index : any) {
- this.$confirm('确定删除吗!确定后将可能影响原表格数据', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- this.attributeList.splice(index, 1);
- this.generateNow();
- this.$message.success('删除成功');
- }).catch(() => this.$message.info('已取消删除'));
- }
- // 删除表格数据
- doDeleteTable(item : any) {
- if((this as any).tableList.length>1){
- this.$confirm('确定删除吗!', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- // console.log(this.tableList);
- (this as any).tableList.map((v : any) => {
- if (v.dataIndex === item.dataIndex) v.isDeleted = 1;
- })
- let filterList = this.tableList.filter((v : any) => v.isDeleted !== 1);
- (this as any).$refs.table.setValue(filterList); // 设置表格数据
- this.$message.success('删除成功');
- }).catch(() => this.$message.info('已取消删除'));
- }else{
- this.$message.warning('物料属性不能为空,无法删除!')
- }
- }
- // 获取物料属性
- getAttribute() {
- api.pageList({
- pageSize: 999,
- status: 0
- }, 'maindataMaterialAttribute').then((res : any) => {
- if (res.code === 200) {
- this.selectList = res.data.records
- } else this.$message.error(res.msg);
- }).catch(() => {});
- }
- // 获取列表数据
- getDataList() {
- if (!this.$refs.moduleView) {
- if (this.timeNum > 5) {
- clearInterval(this.timer)
- }
- this.timeNum++;
- return
- }
- clearInterval(this.timer)
- let query = (this.$refs.moduleView as any).getQuery();
- if (this.categoryIds) query.categoryIds = this.categoryIds;
- // console.log('表单字段 ==> ', query);
- this.getPageList(query)
- }
- getPageList(query : any) {
- let loading = this.$loading({ target: '.main-container' });
- api.treeList('maindataMaterialCategory').then((treeRes : any) => {
- if(treeRes.code==200){
- api.pageList(query, 'maindataMaterial').then((res : any) => {
- if (res.code === 200) {
-
- var data:any = [{
- id: 0,
- name: '物料分类',
- children: treeRes.data
- }];
- (this as any).$refs.sideTree.setData(data);
-
- (this.$refs.moduleView as any).setTableValue(res.data.records);
- let page = {
- pageNo: res.data.current, //当前页
- pageSize: res.data.size, //每页条数
- total: res.data.total //总条数
- };
- (this.$refs.moduleView as any).setPage(page);
- loading.close();
- } else this.$message.error(res.msg);
- }).catch(() => loading.close());
- }
- }).catch(() => loading.close());
- }
- // 工具栏方法
- clickHandle(e : any) {
- if (e === 'onAdd') this.onAdd();
- if (e === 'onDelete') this.doDelete();
- }
- // 内页工具栏方法
- insideTools(e : any) {
- // console.log(e);
- if (e === 'onReturn') this.isShow = 'home';
- if (e === 'onSave') this.doFormData();
- if (e === 'onDelete') this.pageDelete(this.editInfo);
- }
- // 组合商品删除
- deleteMakeup(item : any) {
- this.$confirm('确定删除吗', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then((res) => {
- // console.log(res)
- let data = (this.$refs.makeupTable as any).getValue();// 获取表格数据
- // let i = -1;
- // let j = -1;
- // for (const v of data) {
- // i++;
- // if (v.id == item.id) {
- // break
- // }
- // };
- // for (const v of this.makeupList) {
- // j++;
- // if (v.id == item.id && item.isDeleted === 0) {
- // break
- // }
- // };
- // this.makeupList[j].isDeleted = 1;
- // data.splice(i, 1);
- // this.productDataList.splice(i, 1);
- for (var i = 0; i < data.length; i++) {
- if(data[i].materialSkuId == item.materialSkuId){
- if(item.isDeleted == 0){
- this.makeupList[i].isDeleted = 1;
- }
- data.splice(i, 1);
- this.productDataList.splice(i, 1)
- }
- };
- (this.$refs.makeupTable as any).setValue(data);// 设置表格数据
- this.$message.success('删除成功');
- // setTimeout(()=> {
- // this.volumeCount()
- // }, 10);
- }).catch((err) => {
- this.$message.info('已取消删除');
- // console.log(err)
- });
- }
- // 内页删除
- pageDelete(item : any) {
- this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- other.deleteSpuAndSku({ ids: item.id }, 'maindataMaterial').then((res : any) => {
- if (res.code === 200) {
- this.$message.success('删除成功');
- this.isShow = 'home';
- // (this as any).$refs.sideTree.request();
- this.getDataList();
- } else this.$message.error(res.msg);
- }).catch(() => {});
- }).catch(() => this.$message.info('已取消删除'));
- }
- // 工具栏删除
- doDelete() {
- let selectData = (this.$refs.moduleView as any).getSelectData()
- let ids = '';
- if (selectData.length > 0) {
- selectData.map((v : any) => {
- ids += v.id + ','
- })
- } else return this.$message({ type: 'warning', message: '请选择删除数据' })
- ids = ids.slice(0, ids.length - 1);
- this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- other.deleteSpuAndSku({ ids: ids }, 'maindataMaterial').then((res : any) => {
- if (res.code === 200) {
- // (this as any).$refs.sideTree.request();
- this.getDataList();
- this.$message.success('删除成功');
- } else this.$message.error(res.msg);
- }).catch(() => {});
- }).catch(() => this.$message.info('已取消删除'));
- }
- // 操作删除
- doDelete2(item : any) {
- this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- other.deleteSpuAndSku({ ids: item.id }, 'maindataMaterial').then((res : any) => {
- if (res.code === 200) {
- // (this as any).$refs.sideTree.request();
- this.getDataList();
- this.$message.success('删除成功');
- } else this.$message.error(res.msg);
- }).catch(() => {});
- }).catch(() => this.$message.info('已取消删除'));
- }
- // 刷新
- onRefresh() {
- (this as any).$refs.moduleView.clearSearch();
- // (this as any).$refs.sideTree.request();
- this.categoryIds = '';
- this.getDataList();
- }
- }
- </script>
- <style>
- .el-tree{max-height: 100%;overflow-y: auto;}
- </style>
- <style lang="scss" scoped>
- .my-container {
- width: 100%;
- box-sizing: border-box;
- display: flex;
- padding: 16px;
- height: 100%;
- .bill-left {
- position: relative;
- border-right: solid #EEE 1px;
- padding-right: 16px;
- flex-shrink: 0;
- .bill-tab {
- width: 210px;
- height: 100%;
- transition: all .5s;
- overflow: auto;
- }
- .tab-title {
- font-size: 16px;
- padding-bottom: 16px;
- width: 200px;
- }
- }
- .item-tab {
- margin-right: 16px;
- }
- .bill-main {
- width: calc(100% - 16px);
- box-sizing: border-box;
- margin-left: 16px;
- position: relative;
- height: 100%;
- overflow-y: hidden;
- }
- .detil {
- width: 100%;
- .box-shadow {
- box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
- padding: 20px;
- border-radius: 4px;
- border: 1px solid #e6ebf5;
- background-color: #fff;
- overflow: hidden;
- color: #303133;
- -webkit-transition: .3s;
- transition: .3s;
- margin-top: 20px;
- }
- }
- }
- </style>
|