123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821 |
- <template>
- <div>
- <div class="borderless">
- <div class="customer-head">
- <div class="customer-back">
- <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
- @click="backToList">
- 返回列表
- </el-button>
- </div>
- <div class="add-customer-btn">
- <el-button v-if="form.enableOrNot == 0" size="small" @click="disabled(1)">
- 启用
- </el-button>
- <el-button v-if="form.enableOrNot == 1" size="small" @click="disabled(0)">
- 禁用
- </el-button>
- <el-button type="primary" size="small" @click="editCustomer">
- 保存数据
- </el-button>
- </div>
- </div>
- <trade-card title="基础资料" style="margin-top: 60px">
- <avue-form ref="form" class="trading-form" v-model="form" :option="option" :key="key">
- <template slot="goodsTypeId" slot-scope="{disabled}">
- <div style="display:flex;">
- <avue-cascader :disabled="disabled" :emit-path="false" check-strictly
- :show-all-levels="false" v-model="form.goodsTypeId" placeholder="请选择产品分类"
- :dic="goodsTypeList" :props="props"></avue-cascader>
- <i class="el-icon-circle-plus-outline"
- style="font-size:18px;line-height: 32px;margin-left:4px"
- @click="goodsTypeVisible = true"></i>
- </div>
- </template>
- <template slot="unit" slot-scope="{disabled}">
- <div style="display:flex;">
- <avue-select :disabled="disabled" v-model="form.unit" filterable placeholder="请选择单位"
- :dic="unitList" :props="props2"></avue-select>
- <i class="el-icon-circle-plus-outline"
- style="font-size:18px;line-height: 32px;margin-left:4px"
- @click="$refs.dictbiz.open()"></i>
- </div>
- </template>
- <template slot="whether" slot-scope="{disabled}">
- <!--<el-switch v-model="form.whether" active-text="是" inactive-text="否" active-value="1" inactive-value="0" @change="whetherChange"/>-->
- <el-switch v-model="form.whether" :disabled="disabled || isWhether" active-text="是"
- inactive-text="否" active-value="1" inactive-value="0" />
- </template>
- <template slot="whetherIntegral" slot-scope="{disabled}">
- <!--<el-switch v-model="form.whetherIntegral" active-text="是" inactive-text="否" active-value="1" inactive-value="0" @change="whetherChange"/>-->
- <el-switch v-model="form.whetherIntegral" :disabled="disabled" active-text="是" inactive-text="否"
- active-value="1" inactive-value="0" />
- </template>
- <template slot="explosionProof" slot-scope="{disabled}">
- <!--<el-switch v-model="form.explosionProof" :disabled="disabled" active-text="是" inactive-text="否"-->
- <!-- active-value="1" inactive-value="0" />-->
- <!--<el-radio v-model="form.explosionProof"></el-radio>-->
- <el-checkbox v-model="form.explosionProof" :checked="form.explosionProof == 1" :true-label="1"
- :false-label="0"></el-checkbox>
- </template>
- <template slot="originalFactory" slot-scope="{disabled}">
- <!--<el-switch v-model="form.originalFactory" :disabled="disabled" active-text="是" inactive-text="否"-->
- <!-- active-value="1" inactive-value="0" />-->
- <el-checkbox v-model="form.originalFactory" :checked="form.originalFactory == 1" :true-label="1"
- :false-label="0"></el-checkbox>
- </template>
- <template slot="selfRecovery" slot-scope="{disabled}">
- <!--<el-switch v-model="form.selfRecovery" :disabled="disabled" active-text="是" inactive-text="否"-->
- <!-- active-value="1" inactive-value="0" />-->
- <el-checkbox v-model="form.selfRecovery" :checked="form.selfRecovery == 1" :true-label="1"
- :false-label="0"></el-checkbox>
- </template>
- </avue-form>
- </trade-card>
- <containerTitle title="附件信息"></containerTitle>
- <c-upload :data="filesList" display deleteUrl="/api/blade-sales-part/goodsfiles/remove"
- :enumerationValue="160.1" :disabled="form.enableOrNot == 1" />
- <el-dialog title="设置产品分类" v-dialogDrag :visible.sync="goodsTypeVisible" class="avue-dialog" width="80%"
- append-to-body @closed="goodsTypeClosed">
- <span>
- <!-- <avue-form :key="reload" ref="goodsType" v-model="form2" :option="option2" style="margin-top:20px"></avue-form> -->
- <!--<goods-type></goods-type>-->
- <corp-type></corp-type>
- </span>
- <div class="avue-dialog__footer">
- <el-button @click="goodsTypeVisible = false" size="mini">取 消</el-button>
- <el-button @click="saveGoodstype" type="primary" size="mini">确 定</el-button>
- </div>
- </el-dialog>
- <!--<el-dialog title="添加仓库" v-dialogDrag :visible.sync="storageVisible" class="avue-dialog avue-dialog--top" width="30%" append-to-body @closed="storageClosed">-->
- <!-- <span>-->
- <!-- <avue-form :key="reload2" ref="storage" v-model="form3" :option="option3" style="margin-top:20px"></avue-form>-->
- <!-- </span>-->
- <!-- <div class="avue-dialog__footer">-->
- <!-- <el-button @click="storageVisible = false" size="mini">取 消</el-button>-->
- <!-- <el-button @click="savestorage" type="primary" size="mini">确 定</el-button>-->
- <!-- </div>-->
- <!--</el-dialog>-->
- <dictbiz-dialog ref="dictbiz" title="添加单位" code="unit" parentId="1585962784498225154"
- @closed="getAllWorkDicts"></dictbiz-dialog>
- </div>
- </div>
- </template>
- <script>
- import {
- getGoodstype,
- // getDetails,
- goodsTypesubmit,
- getStoragetype,
- // submit,
- itemRemove,
- // disabled,
- getStoragelist,
- storagesubmit
- } from "@/api/basicData/product";
- import {
- getDetails,
- getCorpType,
- submit,
- customerList,
- itemDel,
- disabled
- } from "@/api/tirePartsMall/basicData/commodityInformation"
- import { optionList } from "./js/optionList";
- import goodsType from '@/components/goodsType/index'
- import corpType from './components/index'
- import { brandfigureListAll } from "@/api/tirePartsMall/basicData/listingManagement";
- import { isProcurement } from "@/api/basicData/configuration";
- export default {
- name: "index",
- data() {
- return {
- loadingBtn: false,
- goodsTypeVisible: false,
- storageVisible: false,
- isWhether: false,
- form: {
- whether: '0',
- whetherIntegral: '1'
- },
- form2: {},
- form3: {},
- data: [],
- key: 0,
- option: {
- menuBtn: false,
- labelWidth: 100,
- disabled: false,
- column: [
- {
- label: "名称",
- prop: "cname",
- span: 16,
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- },
- {
- label: "产品分类",
- prop: "goodsTypeId",
- type: 'select',
- dicData: [],
- props: {
- label: 'detailedAddress',
- value: 'detailedAddress'
- },
- filterable: true,
- span: 8,
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- },
- {
- label: "单位",
- prop: "unit",
- type: "select",
- props: {
- label: "dictValue",
- value: "dictValue"
- },
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit",
- span: 8,
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- },
- {
- label: "品牌",
- prop: "brandId",
- span: 8,
- type: 'select',
- props: {
- label: 'cname',
- value: 'id',
- disabled: 'disabled'
- },
- dicUrl: '/api/blade-sales-part/brandDesc/listAllV1?type=PP&enableOrNot=1&whetherIntegral=1',
- change: (value) => {
- if (!value.value) return
- brandfigureListAll({ pid: value.value }).then(res => {
- this.findObject(this.option.column, "brandItem").dicData = res.data.data
- })
- },
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- },
- {
- label: "商品编码",
- prop: "code",
- span: 8,
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- },
- {
- label: "规格型号",
- prop: "specificationAndModel",
- span: 8,
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- },
- {
- label: "产地",
- prop: "placeProduction",
- span: 8,
- },
- {
- label: "供应商",
- prop: "corpId",
- span: 8,
- type: 'select',
- props: {
- label: 'cname',
- value: 'id'
- },
- dicUrl: '/api/blade-sales-part/corpsDesc/listAll?corpType=GYS&enableOrNot=1'
- },
- {
- label: "所属公司",
- prop: "salesCompanyId",
- span: 8,
- type: 'select',
- props: {
- label: 'fullName',
- value: 'id'
- },
- display: false,
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }],
- dicUrl: '/api/blade-system/dept/top-list'
- },
- {
- label: "快捷品名查询",
- prop: "cnameInt",
- span: 8,
- },
- {
- label: "商品描述",
- prop: "goodsDescription",
- span: 8,
- },
- // {
- // label: "采购价",
- // prop: "purchasePrice",
- // type: 'number',
- // minRows: 0,
- // controls: false,
- // span: 8,
- // rules: [{
- // required: true,
- // message: " ",
- // trigger: "blur"
- // }]
- // },
- // {
- // label: "销售价",
- // prop: "salesPrice",
- // type: 'number',
- // minRows: 0,
- // controls: false,
- // span: 8,
- // rules: [{
- // required: true,
- // message: " ",
- // trigger: "blur"
- // }]
- // },
- // {
- // label: "售价1",
- // prop: "priceOne",
- // type: 'number',
- // minRows: 0,
- // controls: false,
- // span: 8,
- // rules: [{
- // required: true,
- // message: " ",
- // trigger: "blur"
- // }]
- // },
- // {
- // label: "售价2",
- // prop: "priceTwo",
- // type: 'number',
- // minRows: 0,
- // controls: false,
- // span: 8,
- // rules: [{
- // required: true,
- // message: " ",
- // trigger: "blur"
- // }]
- // },
- // {
- // label: "售价3",
- // prop: "priceThree",
- // type: 'number',
- // minRows: 0,
- // controls: false,
- // span: 8,
- // rules: [{
- // required: true,
- // message: " ",
- // trigger: "blur"
- // }]
- // },
- // {
- // label: "售价4",
- // prop: "priceFour",
- // type: 'number',
- // minRows: 0,
- // controls: false,
- // span: 8,
- // rules: [{
- // required: true,
- // message: " ",
- // trigger: "blur"
- // }]
- // },
- // {
- // label: "售价5",
- // prop: "priceFive",
- // type: 'number',
- // minRows: 0,
- // controls: false,
- // span: 8,
- // rules: [{
- // required: true,
- // message: " ",
- // trigger: "blur"
- // }]
- // },
- // {
- // label: "售价6",
- // prop: "priceSix",
- // type: 'number',
- // minRows: 0,
- // controls: false,
- // span: 8,
- // rules: [{
- // required: true,
- // message: " ",
- // trigger: "blur"
- // }]
- // },
- // {
- // label: "售价7",
- // prop: "priceSeven",
- // type: 'number',
- // minRows: 0,
- // controls: false,
- // span: 8,
- // rules: [{
- // required: true,
- // message: " ",
- // trigger: "blur"
- // }]
- // },
- // {
- // label: "售价8",
- // prop: "priceEight",
- // type: 'number',
- // minRows: 0,
- // controls: false,
- // span: 8,
- // rules: [{
- // required: true,
- // message: " ",
- // trigger: "blur"
- // }]
- // },
- {
- label: "库存预警",
- prop: "inventoryAlert",
- span: 8
- },
- {
- label: "兑换积分",
- prop: "integral",
- span: 8
- },
- {
- label: "备注",
- prop: "remarks",
- type: "textarea",
- minRows: 3,
- span: 24,
- }
- ]
- },
- option2: {
- menuBtn: false,
- labelWidth: 80,
- column: [
- {
- label: "分类名称",
- prop: "cname",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 24,
- },
- {
- label: "上级类型",
- prop: "parentId",
- dicData: [],
- type: "tree",
- props: {
- label: "title",
- value: "id"
- },
- span: 24,
- }
- ]
- },
- option3: {
- menuBtn: false,
- labelWidth: 80,
- column: [
- {
- label: "仓库名称",
- prop: "cname",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 24,
- },
- {
- label: "仓库编码",
- prop: "code",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 24,
- },
- {
- label: "上级类型",
- prop: "parentId",
- dicData: [],
- type: "tree",
- props: {
- label: 'cname',
- value: 'id'
- },
- span: 24,
- }
- ]
- },
- filesList: [],
- props: {
- label: 'title',
- value: 'value'
- },
- props2: {
- label: 'dictValue',
- value: 'dictValue'
- },
- goodsTypeList: [],
- unitList: [],
- optionList: {}
- };
- },
- components: {
- goodsType,
- corpType
- },
- props: {
- detailData: {
- type: Object
- }
- },
- async created() {
- isProcurement({ "param": "whether.model" }).then(res => {
- if (res.data.data == 1) {
- this.findObject(this.option.column, "brandItem").label = '规格型号1'
- }
- })
- this.optionList = await this.getColumnData(
- this.getColumnName(218.1),
- optionList
- );
- if (await this.detailData.goodsTypeId) {
- this.form.goodsTypeId = this.detailData.goodsTypeId;
- }
- if (this.detailData.id) {
- this.getDetail(this.detailData.id);
- }
- if (this.detailData.status == 1) {
- this.option.disabled = true;
- }
- this.getAllWorkDicts()
- },
- methods: {
- getAllWorkDicts() {
- // getGoodstype().then(res => {
- // this.goodsTypeList = res.data.data;
- // this.findObject(this.option2.column, "parentId").dicData = res.data.data;
- // });
- getCorpType({ corpType: "SP", whetherIntegral: '1' }).then(res => {
- console.log(res);
- this.goodsTypeList = res.data.data;
- })
- customerList({ corpType: "SP", whetherIntegral: '1' }).then(res => {
- console.log('kk', res);
- // this.goodsTypeList = res.data.data.records;
- this.findObject(this.option2.column, "parentId").dicData = res.data.data.records;
- });
- // getStoragelist().then(res => {
- // this.findObject(this.optionList.column, "storageId").dicData = res.data;
- // this.findObject(this.option3.column, "parentId").dicData = res.data;
- // });
- this.getWorkDicts("unit").then(res => {
- this.unitList = res.data.data;
- });
- },
- cellStyle() {
- return "padding:0;height:40px;";
- },
- addRow() {
- this.data.push({ $cellEdit: true })
- },
- rowCell(row, index) {
- this.$refs.crud.rowCell(row, index)
- },
- rowSave(form, done) {
- done()
- },
- rowUpdate(form, index, done) {
- done()
- },
- rowDel(row, index) {
- this.$confirm("确定删除数据?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- if (row.id) {
- itemRemove({ ids: row.id }).then(res => {
- this.$message({
- type: "success",
- message: "删除成功!"
- });
- this.data.splice(index, 1);
- });
- } else {
- this.$message({
- type: "success",
- message: "删除成功!"
- });
- this.data.splice(index, 1);
- }
- });
- },
- disabled(val) {
- disabled({ id: this.form.id, enableOrNot: val }).then(res => {
- this.$message({
- type: "success",
- message: val ? '启用成功' : '禁用成功'
- });
- if (val == 0) {
- console.log('禁用中');
- this.option.disabled = false;
- for (let item of this.option.column) {
- this.$set(item, 'disabled', false)
- }
- }
- console.log('执行getdetail')
- this.getDetail(this.form.id);
- })
- },
- saveGoodstype() {
- this.$refs["goodsType"].validate((valid, done) => {
- done();
- if (valid) {
- goodsTypesubmit({ ...this.form2, status: 0 }).then(res => {
- this.getDetail(res.data.data.id)
- this.getAllWorkDicts()
- })
- this.goodsTypeVisible = false
- } else {
- return false;
- }
- });
- },
- savestorage() {
- // this.$refs["storage"].validate((valid, done) => {
- // done();
- // if (valid) {
- // storagesubmit({ ...this.form3, status: 0 }).then(res => {
- // this.getAllWorkDicts()
- // })
- // this.storageVisible = false
- // } else {
- // return false;
- // }
- // });
- this.getAllWorkDicts()
- this.goodsTypeVisible = false
- },
- goodsTypeClosed() {
- // this.reload = Math.random();
- // this.form2 = this.$options.data().form2
- },
- storageClosed() {
- this.reload2 = Math.random();
- this.form3 = this.$options.data().form3
- },
- getDetail(id) {
- this.loadingBtn = true
- getDetails({ id: id }).then(res => {
- this.form = res.data.data;
- this.form.explosionProof += ''
- // this.data = res.data.data.stockGoodsList;
- this.filesList = res.data.data.goodsFilesList
- // 把详情得到的主图附图状态从数值型转化成字符串型
- for (let item of this.filesList) {
- item.mainImage = item.mainImage + ''
- }
- this.whetherChange(res.data.data.whether)
- //如果modifiable为0则不能修改
- if (this.form.modifiable == 0) {
- console.log(this.form.modifiable, '0');
- for (let item of this.option.column) {
- this.$set(item, 'disabled', true)
- }
- this.isWhether = true
- } else if (this.form.modifiable == 1) {
- console.log(this.form.modifiable, '1');
- for (let item of this.option.column) {
- item.disabled = false
- }
- this.isWhether = false
- }
- if (this.form.enableOrNot == 0) {
- for (let item of this.option.column) {
- this.$set(item, 'disabled', false)
- }
- } else {
- for (let item of this.option.column) {
- this.$set(item, 'disabled', true)
- }
- }
- this.key++
- }).finally(() => {
- this.loadingBtn = false;
- });
- },
- whetherChange(val) {
- if (val == 0 || val == null) {
- this.findObject(this.optionList.column, "lotNo").hide = true
- this.findObject(this.optionList.column, "lotNo").showColumn = false
- } else {
- this.findObject(this.optionList.column, "lotNo").hide = false
- this.findObject(this.optionList.column, "lotNo").showColumn = true
- }
- },
- //修改提交触发
- editCustomer() {
- this.$refs["form"].validate((valid, done) => {
- done();
- if (valid) {
- this.loadingBtn = true;
- submit({
- ...this.form,
- type: 0,
- // stockGoodsList: this.data,
- goodsFilesList: this.filesList
- }).then(res => {
- this.$message.success("保存成功");
- this.form = res.data.data;
- // this.data = res.data.data.stockGoodsList;
- this.filesList = res.data.data.goodsFilesList;
- this.getDetail(res.data.data.id);
- // setTimeout(() => {
- // this.backToList()
- // }, 1000);
- }).finally(() => {
- this.loadingBtn = false;
- });
- } else {
- return false;
- }
- });
- },
- async saveColumn() {
- const inSave = await this.saveColumnData(
- this.getColumnName(218.1),
- this.optionList
- );
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.crud.doLayout();
- });
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }
- },
- async resetColumn() {
- this.optionList = optionList;
- const inSave = await this.delColumnData(
- this.getColumnName(218.1),
- optionList
- );
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.crud.doLayout();
- });
- this.getAllWorkDicts()
- this.$message.success("重置成功");
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }
- },
- //返回列表
- backToList() {
- this.$emit("goBack");
- }
- },
- };
- </script>
- <style lang="scss" scoped>
- .trading-form ::v-deep .el-form-item {
- margin-bottom: 8px !important;
- }
- ::v-deep .el-dialog__body {
- padding: 0px 20px 15px 20px;
- }
- ::v-deep .el-form-item__error {
- display: none !important;
- }
- .img-form ::v-deep .el-form-item {
- height: 150px;
- line-height: 150px;
- margin-bottom: 8px !important;
- }
- .img-form ::v-deep .avue-upload__icon {
- font-size: 20px;
- width: 150px;
- height: 150px;
- line-height: 150px;
- }
- ::v-deep .el-table .cell {
- padding: 0 2px !important;
- }
- ::v-deep .avue-crud .el-table .el-form-item__label {
- left: -1px;
- }
- .addressTabs {
- display: flex;
- justify-content: center;
- span {
- width: 100px;
- font-size: 18px;
- font-weight: 600;
- text-align: center;
- }
- }
- </style>
|