| | |
| | | >删除</el-button |
| | | > --> |
| | | </span> |
| | | <el-button |
| | | v-if="showEdit" |
| | | plain |
| | | size="mini" |
| | | style="margin-left: 15px" |
| | | @click="editClick" |
| | | >编辑</el-button |
| | | > |
| | | <el-button v-if="showEdit" plain size="mini" style="margin-left: 15px" @click="editClick">编辑</el-button> |
| | | </div> |
| | | </div> |
| | | <!-- 内容 --> |
| | |
| | | ref="form" |
| | | :model="editConfig.infomation" |
| | | :rules="rules" |
| | | label-position="left" |
| | | label-position="right" |
| | | label-width="110px" |
| | | size="mini" |
| | | style="height: 60vh; overflow-x: hidden" |
| | | style="height: 290px; overflow-x: hidden" |
| | | > |
| | | <div class="basic-info"> |
| | | <FormBtnsView :showProduct="true" @productClick="productClick" /> |
| | | <div class="basic-info-view"> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <!-- <el-row> --> |
| | | <!-- <el-col :span="24"> |
| | | <div style="margin-left: 20px"><span class="color_F56C6C">*</span>类别</div> |
| | | <el-form-item label="" prop="name" label-width="20px"> |
| | | <el-input |
| | |
| | | style="width: 85%" |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item |
| | | label="上级品类" |
| | | prop="parentId" |
| | | style="margin-left: 20px" |
| | | > |
| | | </el-col> --> |
| | | <!-- <el-col :span="24"> |
| | | <el-form-item label="上级品类" prop="parentId" style="margin-left: 20px"> |
| | | <el-select |
| | | v-model="editConfig.infomation.parentId" |
| | | placeholder="请选择" |
| | |
| | | style="width: 45%" |
| | | :disabled="!showFooter" |
| | | > |
| | | <el-option |
| | | v-for="item in productCategoryList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | > |
| | | <el-option v-for="item in productCategoryList" :key="item.id" :label="item.name" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-row> --> |
| | | </div> |
| | | <div class="bottom"> |
| | | <div class="purchase-view"> |
| | | <div class="left"> |
| | | <div class="second-label">物流</div> |
| | | <!-- <div class="second-label">物流</div> --> |
| | | <el-form-item label="类别" prop="name"> |
| | | <el-input |
| | | v-model="editConfig.infomation.name" |
| | | placeholder="" |
| | | :disabled="!showFooter" |
| | | style="width: 85%" |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="上级品类" prop="parentId"> |
| | | <el-select |
| | | v-model="editConfig.infomation.parentId" |
| | | placeholder="请选择" |
| | | size="mini" |
| | | style="width: 85%" |
| | | :disabled="!showFooter" |
| | | > |
| | | <el-option v-for="item in productCategoryList" :key="item.id" :label="item.name" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- <el-form-item label="路线" prop="client_name" style="margin-left: 20px"> |
| | | <el-select |
| | | v-model="editConfig.infomation.memberId" |
| | |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> --> |
| | | <el-form-item |
| | | label="强制下架策略" |
| | | prop="forceRemovalStrategy" |
| | | style="margin-left: 20px" |
| | | > |
| | | <el-form-item label="强制下架策略" prop="forceRemovalStrategy"> |
| | | <el-select |
| | | v-model="editConfig.infomation.forceRemovalStrategy" |
| | | placeholder="请选择" |
| | | size="mini" |
| | | style="width: 63%" |
| | | style="width: 85%" |
| | | :disabled="!showFooter" |
| | | > |
| | | <el-option |
| | |
| | | </el-form-item> |
| | | </div> |
| | | <div class="right"> |
| | | <div class="second-label">库存计价</div> |
| | | <el-form-item |
| | | label="成本方法" |
| | | prop="costingMethod" |
| | | style="margin-left: 20px" |
| | | > |
| | | <!-- <div class="second-label">库存计价</div> --> |
| | | <el-form-item label="成本方法" prop="costingMethod"> |
| | | <el-select |
| | | v-model="editConfig.infomation.costingMethod" |
| | | placeholder="请选择" |
| | | size="mini" |
| | | style="width: 63%" |
| | | style="width: 85%" |
| | | :disabled="!showFooter" |
| | | > |
| | | <el-option |
| | | v-for="item in costingMethodList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | > |
| | | <el-option v-for="item in costingMethodList" :key="item.id" :label="item.name" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item |
| | | label="库存计价" |
| | | prop="inventoryValuation" |
| | | style="margin-left: 20px" |
| | | > |
| | | <el-form-item label="库存计价" prop="inventoryValuation"> |
| | | <el-select |
| | | v-model="editConfig.infomation.inventoryValuation" |
| | | placeholder="请选择" |
| | | size="mini" |
| | | style="width: 63%" |
| | | style="width: 85%" |
| | | :disabled="!showFooter" |
| | | > |
| | | <el-option |
| | |
| | | <!-- 尾 --> |
| | | <div v-if="showFooter" slot="footer" class="dialog-footer"> |
| | | <!-- <el-button type="primary" size="small" @click="editConfig.visible = false">保并提交审批</el-button> --> |
| | | <el-button type="primary" size="small" @click="saveClick('form')" |
| | | >保存</el-button |
| | | > |
| | | <el-button size="small" @click="editConfig.visible = false" |
| | | >取消</el-button |
| | | > |
| | | <el-button type="primary" size="small" @click="saveClick('form')">保存</el-button> |
| | | <el-button size="small" @click="editConfig.visible = false">取消</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | addProductCategory, |
| | | updateProductCategory, |
| | | deleteProductCategory, |
| | | } from "@/api/product/productCategory"; |
| | | import { addProductCategory, updateProductCategory, deleteProductCategory } from "@/api/product/productCategory" |
| | | |
| | | import { getDataByType } from "@/api/data"; |
| | | import { getDataByType } from "@/api/data" |
| | | export default { |
| | | name: "AddProductCategoryDialog", |
| | | props: { |
| | |
| | | return { |
| | | visible: false, |
| | | title: "新建", |
| | | infomation: { type: [] }, |
| | | }; |
| | | }, |
| | | infomation: { type: [] } |
| | | } |
| | | } |
| | | }, |
| | | productCategoryList: { |
| | | type: Array, |
| | | default: () => { |
| | | return []; |
| | | }, |
| | | }, |
| | | return [] |
| | | } |
| | | } |
| | | }, |
| | | components: {}, |
| | | computed: {}, |
| | |
| | | dialogWidth: "50%", |
| | | editConfig: this.editCommonConfig, |
| | | rules: { |
| | | name: [{ required: true, message: "请输入", trigger: "change" }], |
| | | name: [{ required: true, message: "请输入", trigger: "change" }] |
| | | }, |
| | | forceRemovalStrategyList: getDataByType("forceRemovalStrategy"), |
| | | // 成本方法 |
| | |
| | | showButton: true, |
| | | showEdit: false, // 是否显示编辑按钮 |
| | | isDelClick: false, // 删除按钮是否可点击 |
| | | showFooter: false, // 是否显示取消保存 |
| | | }; |
| | | showFooter: false // 是否显示取消保存 |
| | | } |
| | | }, |
| | | created() { |
| | | this.setBottonView(); |
| | | this.setBottonView() |
| | | }, |
| | | methods: { |
| | | // 设置删除/打印/编辑是否显示 |
| | | setBottonView() { |
| | | if (this.editConfig.title === "新建") { |
| | | this.showButton = false; |
| | | this.showEdit = false; |
| | | this.showFooter = true; |
| | | this.showButton = false |
| | | this.showEdit = false |
| | | this.showFooter = true |
| | | } else { |
| | | this.showEdit = true; |
| | | this.showFooter = false; |
| | | this.showEdit = true |
| | | this.showFooter = false |
| | | } |
| | | }, |
| | | // 关闭 |
| | | handleClose() { |
| | | this.editConfig.visible = false; |
| | | this.editConfig.visible = false |
| | | }, |
| | | // 刪除 |
| | | deleteClick() { |
| | | let data = JSON.parse(JSON.stringify(this.editConfig.infomation)); |
| | | let data = JSON.parse(JSON.stringify(this.editConfig.infomation)) |
| | | deleteProductCategory({ id: data.id }).then((res) => { |
| | | if (res.code === 200) { |
| | | this.editConfig.visible = false; |
| | | this.$message.success("刪除成功!"); |
| | | this.$emit("refresh"); |
| | | this.editConfig.visible = false |
| | | this.$message.success("刪除成功!") |
| | | this.$emit("refresh") |
| | | } else { |
| | | this.$message.warning(res.msg?res.msg:"删除失败!") |
| | | } |
| | | }); |
| | | }) |
| | | }, |
| | | // 编辑 |
| | | editClick() { |
| | | this.showEdit = false; |
| | | this.showButton = false; |
| | | this.showFooter = true; |
| | | this.showEdit = false |
| | | this.showButton = false |
| | | this.showFooter = true |
| | | }, |
| | | saveParams() { |
| | | let data = JSON.parse(JSON.stringify(this.editConfig.infomation)); |
| | | let data = JSON.parse(JSON.stringify(this.editConfig.infomation)) |
| | | |
| | | let params = { |
| | | costingMethod: data.costingMethod, |
| | | forceRemovalStrategy: data.forceRemovalStrategy, |
| | | inventoryValuation: data.inventoryValuation, |
| | | name: data.name, |
| | | parentId: data.parentId, |
| | | }; |
| | | if (data.id) { |
| | | params.id = data.id; |
| | | parentId: data.parentId |
| | | } |
| | | return params; |
| | | if (data.id) { |
| | | params.id = data.id |
| | | } |
| | | return params |
| | | }, |
| | | // 保存 |
| | | saveClick(formName) { |
| | | this.$refs[formName].validate((valid) => { |
| | | if (valid) { |
| | | const params = this.saveParams(); |
| | | const params = this.saveParams() |
| | | if (this.editConfig.title === "新建") { |
| | | addProductCategory(params).then((res) => { |
| | | if (res.code === 200) { |
| | | this.editConfig.visible = false; |
| | | this.$message.success("添加成功!"); |
| | | this.$emit("refresh"); |
| | | this.editConfig.visible = false |
| | | this.$message.success("添加成功!") |
| | | this.$emit("refresh") |
| | | } else { |
| | | this.$message.warning(res.msg?res.msg:"添加失败!") |
| | | } |
| | | }); |
| | | }) |
| | | } else { |
| | | updateProductCategory(params).then((res) => { |
| | | if (res.code === 200) { |
| | | this.editConfig.visible = false; |
| | | this.$message.success("编辑成功!"); |
| | | this.$emit("refresh"); |
| | | this.editConfig.visible = false |
| | | this.$message.success("编辑成功!") |
| | | this.$emit("refresh") |
| | | } else { |
| | | this.$message.warning(res.msg?res.msg:"编辑失败!") |
| | | } |
| | | }); |
| | | }) |
| | | } |
| | | } else { |
| | | console.log("error submit"); |
| | | return false; |
| | | console.log("error submit") |
| | | return false |
| | | } |
| | | }); |
| | | }) |
| | | }, |
| | | // 删除 |
| | | delClick() {}, |
| | |
| | | if (valid) { |
| | | this.$router.push({ |
| | | path: "/productManage/product", |
| | | query: { categoryName:this.editConfig.infomation.name, id: this.editConfig.title === "新建"?'':this.editConfig.infomation.id}, |
| | | }); |
| | | query: { |
| | | categoryName: this.editConfig.infomation.name, |
| | | id: this.editConfig.title === "新建" ? "" : this.editConfig.infomation.id |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | }, |
| | | }; |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <!-- Add "scoped" attribute to limit CSS to this component only --> |
| | |
| | | height: calc(100% - 80px); |
| | | overflow: auto; |
| | | margin: 20px; |
| | | border: 1px solid #dcdfe6; |
| | | box-shadow: inset 0 0 2px #dee2e6; |
| | | -moz-box-shadow: inset 0 0 2px #dee2e6; |
| | | -webkit-box-shadow: inset 0 0 2px #dee2e6; |
| | | // border: 1px solid #dcdfe6; |
| | | // box-shadow: inset 0 0 2px #dee2e6; |
| | | // -moz-box-shadow: inset 0 0 2px #dee2e6; |
| | | // -webkit-box-shadow: inset 0 0 2px #dee2e6; |
| | | .content-number { |
| | | display: flex; |
| | | justify-content: right; |
| | | height: 44px; |
| | | border-bottom: 1px solid #e9e9e9; |
| | | // border-bottom: 1px solid #e9e9e9; |
| | | font-size: 13px; |
| | | .sub-number { |
| | | width: 12.5%; |
| | |
| | | color: #333; |
| | | } |
| | | } |
| | | .el-tabs--card > .el-tabs__header .el-tabs__nav { |
| | | margin-left: 20px; |
| | | .el-tabs--card > .el-tabs__header { |
| | | border-bottom: none; |
| | | } |
| | | .el-tabs__item.is-active { |
| | | color: #fff; |
| | | background: #2a78fb; |
| | | } |
| | | .el-tabs__item { |
| | | height: 30px; |
| | | line-height: 30px; |
| | | font-size: 13px; |
| | | background: #f3f3f3; |
| | | } |
| | | } |
| | | </style> |