| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403 |
- <template>
- <div>
- <el-form
- label-width="100px"
- :rules="rules"
- ref="form"
- :model="attributeData"
- >
- <el-row>
-
- <el-col :span="8" label-width="100px">
- <el-form-item label="名称:" prop="name">
- <el-input
- placeholder=""
- v-model="category.name"
- disabled
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="编码:" prop="code">
- <el-input
- placeholder=""
- v-model="category.code"
- disabled
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="牌号:" prop="brandNum">
- <el-input
- placeholder=""
- v-model="category.brandNum"
- disabled
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="型号:" prop="modelType">
- <el-input
- placeholder=""
- v-model="category.modelType"
- disabled
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="规格:" prop="specification">
- <el-input
- placeholder=""
- v-model="category.specification"
- disabled
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="计量单位:" prop="measuringUnit">
- <el-input
- placeholder=""
- v-model="category.measuringUnit"
- disabled
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="重量单位:" prop="weightUnit">
- <el-input
- placeholder=""
- v-model="category.weightUnit"
- disabled
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="包装单位:" prop="packingUnit">
- <el-input
- placeholder=""
- v-model="category.packingUnit"
-
- disabled
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="毛重:" prop="roughWeight">
- <el-input
- placeholder=""
- v-model="category.roughWeight"
-
- disabled
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="净重:" prop="netWeight">
- <el-input
- placeholder=""
- v-model="category.netWeight"
- disabled
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item
- label="加工类型:"
- prop="isConsumable"
- v-if="[1, 23, 9, 28].includes(Number(category.categoryLevelPathId))"
- >
- <el-input
- placeholder=""
- :v-model="category.isConsumable == 1 ? '批量' : '单件'"
- disabled
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="生产类型:" prop="produceType">
- <el-select
- v-model="attributeData.produceType"
- :disabled="attributeData.approvalStatus != 0"
- filterable
- multiple
- class="ele-block"
- >
- <el-option
- v-for="item in dictList"
- :key="item.value"
- :value="item.value"
- :label="item.label"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="属性类型:" prop="attributeType">
- <el-select
- v-model="attributeData.attributeType"
- :disabled="attributeData.approvalStatus != 0"
- filterable
- multiple
- class="ele-block"
- >
- <el-option
- v-for="item in attributeList"
- :key="item.value"
- :value="item.value"
- :label="item.label"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="8" label-width="100px">
- <el-form-item label="材料" prop="materialsName">
- <el-input
- placeholder=""
- v-model="attributeData.materialsName"
- :disabled="attributeData.approvalStatus != 0"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="bom路线" prop="bomTypeRouting">
- <el-input
- placeholder=""
- v-model="attributeData.bomTypeRouting"
- :disabled="attributeData.approvalStatus != 0"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="8" label-width="100px">
- <el-form-item label="来源" prop="sourceData">
- <el-input
- placeholder=""
- v-model="attributeData.sourceData"
- :disabled="attributeData.approvalStatus != 0"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="用量" prop="dosage">
- <el-input placeholder="" v-model="attributeData.dosage" :disabled="attributeData.approvalStatus != 0"></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="8" label-width="100px">
- <el-form-item label="基本数量" prop="baseCount">
- <el-input
- placeholder=""
- v-model="attributeData.baseCount"
- :disabled="attributeData.approvalStatus != 0"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="物料库路径" prop="name">
- <el-input
- placeholder=""
- v-model="attributeData.materielPath"
- :disabled="attributeData.approvalStatus != 0"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="20" label-width="100px">
- <el-form-item label="备注" prop="name">
- <el-input
- placeholder=""
- v-model="attributeData.remake"
- :disabled="attributeData.approvalStatus != 0"
- type="textarea"
- :rows="2"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="8" label-width="100px">
- <el-form-item label="创建人" prop="name">
- <el-input
- placeholder=""
- disabled
- v-model="attributeData.createName"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="创建时间" prop="name">
- <el-input
- placeholder=""
- disabled
- v-model="attributeData.createTime"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
-
- <div class="btn_box" v-if="attributeData.status != 1">
- <el-button type="primary" @click="handleUpdate">保存</el-button>
- </div>
- </el-form>
- </div>
- </template>
- <script>
- import { getByCode } from '@/api/system/dictionary-data';
- import { bomCategoryUpdate } from '@/api/material/BOM';
- export default {
- components: {},
- data() {
- return {
- form: {},
- category: {
- name: ''
- },
- statusOptions: [
- {
- label: '默认',
- value: '0'
- },
- {
- label: '归档',
- value: '1'
- }
- ],
- bomTypeOptions: [
- {
- label: 'PBOM',
- value: '1'
- },
- {
- label: 'MBOM',
- value: '2'
- },
- {
- label: 'ABOM',
- value: '3'
- }
- ],
- attributeList: [
- {
- label: '总装',
- value: 1
- },
- {
- label: '部件',
- value: 2
- },
- {
- label: '零',
- value: 3
- },{
- label: '原材料',
- value: 4
- }
- ],
- dictList: [],
- rules: {
- dosage: [{ required: true, message: ' ', trigger: 'blur' }],
- baseCount: [{ required: true, message: ' ', trigger: 'blur' }],
- produceType: [{ required: true, message: ' ', trigger: 'blur' }],
- attributeType: [{ required: true, message: ' ', trigger: 'blur' }],
- },
- };
- },
- created() {
- this.getDictList('productionType');
- },
- beforeDestroy() {},
- methods: {
- async getDictList(code) {
- let { data: res } = await getByCode(code);
- this.dictList = res.map((item) => {
- let values = Object.keys(item);
- return {
- value: Number(values[0]),
- label: item[values[0]]
- };
- });
- },
- handleUpdate() {
- this.$refs.form.validate(async (valid) => {
- if (valid) {
- this.category.produceType = this.attributeData.produceType;
- bomCategoryUpdate(this.attributeData).then((res) => {
- this.$message.success('修改成功');
- });
- } else {
- return false;
- }
- });
- }
- },
- props: {
- attributeData: {
- type: Object,
- default: {}
- }
- },
- watch: {
- attributeData(val) {
- console.log(Object.prototype.hasOwnProperty.call(val, 'category'));
- if (Object.prototype.hasOwnProperty.call(val, 'category')) {
- this.category = val.category;
- this.attributeData.produceType = val.category.produceType;
-
- this.$forceUpdate();
- }
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .btn_box {
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .el-form-item {
- margin-bottom: 10px !important;
- }
- </style>
|