123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379 |
- <template>
- <div class="detil">
- <by-tool :propConfig="toolConfig" />
- <div class="box-shadow">
- <by-form :propConfig="config" ref="form">
- <template v-slot:description="option">
- <el-input type="textarea" :rows="5" placeholder="请输入内容" v-model="textarea">
- </el-input>
- </template>
- <template v-slot:radio="option">
- <el-radio v-model="radio" :label="1">单规格</el-radio>
- <el-radio v-model="radio" :label="2">多规格</el-radio>
- </template>
- <template v-slot:status="option">
- <el-radio v-model="radioStatus" :label="1">启用</el-radio>
- <el-radio v-model="radioStatus" :label="2">备用</el-radio>
- <el-radio v-model="radioStatus" :label="3">禁用</el-radio>
- </template>
- <template v-slot:ismakeup="option">
- <el-radio v-model="ismakeup" :label="1">是</el-radio>
- <el-radio v-model="ismakeup" :label="2">否</el-radio>
- </template>
- <template v-slot:issued="option">
- <el-radio v-model="issued" :label="1">是</el-radio>
- <el-radio v-model="issued" :label="2">否</el-radio>
- </template>
- </by-form>
- </div>
- </div>
- </template>
- <script lang="ts">
- import { Component, Prop, Vue, Watch } from "vue-property-decorator";
- import api from "@/api/material";
- @Component
- export default class MaterialEdit extends Vue {
- baseURL : any = process.env.VUE_APP_BASE_API
- radio : any = 1
- radioStatus : any = 1
- ismakeup : any = 1
- issued : any = 1
- textarea : any = ''
- toolConfig = {
- customTools: [
- {
- name: '保存', icon: 'el-icon-plus', audit: [''], event: {
- click: () => {
- (this as any).getFormData()
- }
- }
- }
- ]
- }
- config = {
- attr: {
- size: 'small',
- rules: {
- name: [{
- required: true, message: '请输入名称', trigger: 'blur'
- }],
- shortName: [{
- required: true, message: '请输入简称', trigger: 'blur'
- }]
- }
- },
- 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: 'accountingCode',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入财务编号',
- clearable: true
- }
- }
- },
- {
- span: 6,
- label: '国际码',
- prop: 'nsCode',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入国际码',
- clearable: true
- }
- }
- },
- ],
- [
- {
- span: 6,
- label: '基本售价',
- prop: 'basePrice',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入基本售价',
- clearable: true
- }
- }
- }, {
- span: 6,
- label: '市场价格',
- prop: 'markPrice',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入市场价格',
- clearable: true
- }
- }
- },
- {
- span: 6,
- label: '价格',
- prop: 'price',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入价格(成交、成本价)',
- clearable: true
- }
- }
- },
- {
- span: 6,
- label: '单位',
- prop: 'unit',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入单位',
- clearable: true
- }
- }
- },
- ],
- [
- {
- span: 6,
- label: '重量',
- prop: 'weight',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入重量',
- clearable: true
- }
- }
- },
- {
- span: 6,
- label: '保质期(天)',
- prop: 'shelfLife',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入保质期(天)',
- clearable: true
- }
- }
- },
- {
- span: 6,
- label: '库存',
- prop: 'stock',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入库存',
- clearable: true
- }
- }
- },
- {
- span: 6,
- label: '安全库存',
- prop: 'warningStock',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入安全库存',
- clearable: true
- }
- }
- }
- ],
- [
- {
- span: 6,
- label: '货号',
- prop: 'itemNumber',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入货号',
- clearable: true
- }
- }
- },
- {
- span: 6,
- label: '分类',
- prop: 'select',
- component: 'by-select',
- compConfig: {
- attr: {
- placeholder: '请选择数据',
- clearable: true,
- },
- request: '/maindata/maindataMaterialCategory/treeList'
- },
- },
- {
- span: 6,
- label: '虚拟分类',
- prop: 'select',
- component: 'by-select',
- compConfig: {
- attr: {
- placeholder: '请选择数据',
- clearable: true,
- },
- request: '/maindata/maindataMaterialCategory/treeList'
- },
- },
- {
- span: 6,
- label: '厂家物料',
- prop: 'factoryId',
- component: 'by-select',
- compConfig: {
- attr: {
- placeholder: '请选择数据',
- clearable: true,
- },
- request: '/maindata/maindataMaterialCategory/treeList'
- },
- }
- ],
- [
- {
- span: 6,
- label: '机构商品分类',
- prop: 'select',
- component: 'by-select',
- compConfig: {
- attr: {
- placeholder: '请选择数据',
- clearable: true,
- },
- request: '/maindata/maindataMaterialCategory/treeList'
- },
- },
- {
- span: 6,
- label: '物料属性表',
- prop: 'select',
- component: 'by-select',
- compConfig: {
- attr: {
- placeholder: '请选择数据',
- clearable: true,
- },
- request: '/maindata/maindataMaterialCategory/treeList'
- },
- }
- ],
- [
- {
- span: 30,
- label: '描述',
- slot: true,
- prop: 'description',
- }
- ],
- [
- {
- span: 20,
- label: '商品规格',
- slot: true,
- prop: 'radio',
- }
- ],
- [
- {
- span: 20,
- label: '物料状态',
- slot: true,
- prop: 'status',
- }
- ],
- [
- {
- span: 20,
- label: '是否组合商品',
- slot: true,
- prop: 'ismakeup',
- }
- ],
- [
- {
- span: 20,
- label: '是否公布',
- slot: true,
- prop: 'issued',
- }
- ],
- ],
- }
- created() {
- setTimeout(() => {
- if (this.$route.params) (this as any).$refs.form.setValue(this.$route.params.baseInfo)
- }, 300)
- }
- getMaterialData(e : any) {
- console.log(e);
- }
- getFormData() {
- (this as any).$refs.form.validate().then(() => {
- let data = (this as any).$refs.form.getValue();
- api.update(data).then((res : any) => {
- if (res.code === 200) {
- (this as any).$tab.closeOpenPage('/materialFile/productManagement')
- this.$message({ type: 'success', message: res.msg })
- }
- })
- });
- }
- }
- </script>
- <style lang="scss" scoped>
- .detil {
- padding: 20px;
- .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>
|