attribute.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  1. <template>
  2. <div>
  3. <el-form
  4. label-width="100px"
  5. :rules="rules"
  6. ref="form"
  7. :model="attributeData"
  8. >
  9. <el-row>
  10. <el-col :span="8" label-width="100px">
  11. <el-form-item label="名称:" prop="name">
  12. <el-input
  13. placeholder=""
  14. v-model="category.name"
  15. disabled
  16. ></el-input>
  17. </el-form-item>
  18. </el-col>
  19. <el-col :span="8" label-width="100px">
  20. <el-form-item label="编码:" prop="code">
  21. <el-input
  22. placeholder=""
  23. v-model="category.code"
  24. disabled
  25. ></el-input>
  26. </el-form-item>
  27. </el-col>
  28. <el-col :span="8" label-width="100px">
  29. <el-form-item label="牌号:" prop="brandNum">
  30. <el-input
  31. placeholder=""
  32. v-model="category.brandNum"
  33. disabled
  34. ></el-input>
  35. </el-form-item>
  36. </el-col>
  37. <el-col :span="8" label-width="100px">
  38. <el-form-item label="型号:" prop="modelType">
  39. <el-input
  40. placeholder=""
  41. v-model="category.modelType"
  42. disabled
  43. ></el-input>
  44. </el-form-item>
  45. </el-col>
  46. <el-col :span="8" label-width="100px">
  47. <el-form-item label="规格:" prop="specification">
  48. <el-input
  49. placeholder=""
  50. v-model="category.specification"
  51. disabled
  52. ></el-input>
  53. </el-form-item>
  54. </el-col>
  55. <el-col :span="8" label-width="100px">
  56. <el-form-item label="计量单位:" prop="measuringUnit">
  57. <el-input
  58. placeholder=""
  59. v-model="category.measuringUnit"
  60. disabled
  61. ></el-input>
  62. </el-form-item>
  63. </el-col>
  64. <el-col :span="8" label-width="100px">
  65. <el-form-item label="重量单位:" prop="weightUnit">
  66. <el-input
  67. placeholder=""
  68. v-model="category.weightUnit"
  69. disabled
  70. ></el-input>
  71. </el-form-item>
  72. </el-col>
  73. <el-col :span="8" label-width="100px">
  74. <el-form-item label="包装单位:" prop="packingUnit">
  75. <el-input
  76. placeholder=""
  77. v-model="category.packingUnit"
  78. disabled
  79. ></el-input>
  80. </el-form-item>
  81. </el-col>
  82. <el-col :span="8" label-width="100px">
  83. <el-form-item label="毛重:" prop="roughWeight">
  84. <el-input
  85. placeholder=""
  86. v-model="category.roughWeight"
  87. disabled
  88. ></el-input>
  89. </el-form-item>
  90. </el-col>
  91. <el-col :span="8" label-width="100px">
  92. <el-form-item label="净重:" prop="netWeight">
  93. <el-input
  94. placeholder=""
  95. v-model="category.netWeight"
  96. disabled
  97. ></el-input>
  98. </el-form-item>
  99. </el-col>
  100. <el-col :span="8" label-width="100px">
  101. <el-form-item
  102. label="加工类型:"
  103. prop="isConsumable"
  104. v-if="[1, 23, 9, 28].includes(Number(category.categoryLevelPathId))"
  105. >
  106. <el-input
  107. placeholder=""
  108. :v-model="category.isConsumable == 1 ? '批量' : '单件'"
  109. disabled
  110. ></el-input>
  111. </el-form-item>
  112. </el-col>
  113. <el-col :span="8" label-width="100px">
  114. <el-form-item label="生产类型:" prop="produceType">
  115. <el-select
  116. v-model="attributeData.produceType"
  117. disabled
  118. filterable
  119. multiple
  120. class="ele-block"
  121. >
  122. <el-option
  123. v-for="item in produceTypeList"
  124. :key="item.value"
  125. :value="item.value"
  126. :label="item.label"
  127. ></el-option>
  128. </el-select>
  129. </el-form-item>
  130. </el-col>
  131. <el-col :span="8" label-width="100px">
  132. <el-form-item label="存货类型:" prop="attributeType">
  133. <el-select
  134. v-model="attributeData.attributeType"
  135. disabled
  136. filterable
  137. class="ele-block"
  138. >
  139. <el-option
  140. v-for="item in attributeList"
  141. :key="item.value"
  142. :value="item.value"
  143. :label="item.label"
  144. ></el-option>
  145. </el-select>
  146. </el-form-item>
  147. </el-col>
  148. <el-col :span="8" label-width="100px">
  149. <el-form-item label="属性类型:" prop="componentAttribute">
  150. <el-select
  151. v-model="attributeData.componentAttribute"
  152. disabled
  153. filterable
  154. multiple
  155. class="ele-block"
  156. >
  157. <el-option
  158. v-for="item in lbjtList"
  159. :key="item.value"
  160. :value="item.value"
  161. :label="item.label"
  162. ></el-option>
  163. </el-select>
  164. </el-form-item>
  165. </el-col>
  166. </el-row>
  167. <el-row>
  168. <el-col :span="8" label-width="100px">
  169. <el-form-item label="材料" prop="materialsName">
  170. <el-input
  171. placeholder=""
  172. v-model="attributeData.materialsName"
  173. :disabled="attributeData.approvalStatus != 0"
  174. ></el-input>
  175. </el-form-item>
  176. </el-col>
  177. <el-col :span="8" label-width="100px">
  178. <el-form-item label="bom路线" prop="bomTypeRouting">
  179. <el-input
  180. placeholder=""
  181. v-model="attributeData.bomTypeRouting"
  182. :disabled="attributeData.approvalStatus != 0"
  183. ></el-input>
  184. </el-form-item>
  185. </el-col>
  186. </el-row>
  187. <el-row>
  188. <el-col :span="8" label-width="100px">
  189. <el-form-item label="来源" prop="sourceData">
  190. <el-input
  191. placeholder=""
  192. v-model="attributeData.sourceData"
  193. :disabled="attributeData.approvalStatus != 0"
  194. ></el-input>
  195. </el-form-item>
  196. </el-col>
  197. <!-- <el-col :span="8" label-width="100px">
  198. <el-form-item label="用量" >
  199. <el-input placeholder="" v-model="attributeData.dosage" :disabled="attributeData.approvalStatus != 0"></el-input>
  200. </el-form-item>
  201. </el-col> -->
  202. </el-row>
  203. <el-row>
  204. <el-col :span="8" label-width="100px">
  205. <el-form-item label="基本数量" prop="baseCount">
  206. <el-input
  207. placeholder=""
  208. v-model="attributeData.baseCount"
  209. :disabled="attributeData.approvalStatus != 0"
  210. ></el-input>
  211. </el-form-item>
  212. </el-col>
  213. <el-col :span="8" label-width="100px">
  214. <el-form-item label="物料库路径" prop="name">
  215. <el-input
  216. placeholder=""
  217. v-model="attributeData.materielPath"
  218. :disabled="attributeData.approvalStatus != 0"
  219. ></el-input>
  220. </el-form-item>
  221. </el-col>
  222. </el-row>
  223. <el-row>
  224. <el-col :span="20" label-width="100px">
  225. <el-form-item label="备注" prop="name">
  226. <el-input
  227. placeholder=""
  228. v-model="attributeData.remake"
  229. :disabled="attributeData.approvalStatus != 0"
  230. type="textarea"
  231. :rows="2"
  232. ></el-input>
  233. </el-form-item>
  234. </el-col>
  235. </el-row>
  236. <el-row>
  237. <el-col :span="8" label-width="100px">
  238. <el-form-item label="创建人" prop="name">
  239. <el-input
  240. placeholder=""
  241. disabled
  242. v-model="attributeData.createName"
  243. ></el-input>
  244. </el-form-item>
  245. </el-col>
  246. <el-col :span="8" label-width="100px">
  247. <el-form-item label="创建时间" prop="name">
  248. <el-input
  249. placeholder=""
  250. disabled
  251. v-model="attributeData.createTime"
  252. ></el-input>
  253. </el-form-item>
  254. </el-col>
  255. </el-row>
  256. <el-col :span="8" label-width="100px">
  257. <el-form-item label="来源版本号" prop="name">
  258. <!-- {{ attributeData }} -->
  259. <el-input
  260. placeholder=""
  261. disabled
  262. v-model="attributeData.resourceBomVersion"
  263. ></el-input>
  264. </el-form-item>
  265. </el-col>
  266. <div class="btn_box" v-if="attributeData.status != 1">
  267. <el-button type="primary" @click="handleUpdate" v-if="!isWt"
  268. >保存</el-button
  269. >
  270. </div>
  271. </el-form>
  272. </div>
  273. </template>
  274. <script>
  275. import { getByCode } from '@/api/system/dictionary-data';
  276. import { bomCategoryUpdate } from '@/api/material/BOM';
  277. import { produceTypeList } from '@/enum/dict.js';
  278. export default {
  279. components: {},
  280. data() {
  281. return {
  282. produceTypeList,
  283. form: {},
  284. category: {
  285. name: ''
  286. },
  287. // attributeData: {
  288. // baseCount:1,
  289. // },
  290. statusOptions: [
  291. {
  292. label: '默认',
  293. value: '0'
  294. },
  295. {
  296. label: '归档',
  297. value: '1'
  298. }
  299. ],
  300. bomTypeOptions: [
  301. {
  302. label: 'PBOM',
  303. value: '1'
  304. },
  305. {
  306. label: 'MBOM',
  307. value: '2'
  308. },
  309. {
  310. label: 'ABOM',
  311. value: '3'
  312. }
  313. ],
  314. dictList: [
  315. {
  316. label: '加工',
  317. value: 1
  318. },
  319. {
  320. label: '装配',
  321. value: 3
  322. }
  323. ],
  324. lbjtList: [
  325. {
  326. label: '自制件',
  327. value: 1
  328. },
  329. {
  330. label: '采购件',
  331. value: 2
  332. },
  333. {
  334. label: '外协件',
  335. value: 3
  336. },
  337. {
  338. label: '受托件',
  339. value: 4
  340. }
  341. ],
  342. attributeList: [],
  343. // dictList: [],
  344. rules: {
  345. dosage: [{ required: true, message: ' ', trigger: 'blur' }],
  346. baseCount: [{ required: true, message: ' ', trigger: 'blur' }],
  347. produceType: [{ required: true, message: ' ', trigger: 'blur' }],
  348. attributeType: [{ required: true, message: ' ', trigger: 'blur' }],
  349. componentAttribute: [
  350. { required: true, message: ' ', trigger: 'blur' }
  351. ]
  352. }
  353. };
  354. },
  355. created() {
  356. // this.getDictList('productionType');
  357. this.getAttriButeList('inventory_type');
  358. },
  359. beforeDestroy() {},
  360. methods: {
  361. async getDictList(code) {
  362. let { data: res } = await getByCode(code);
  363. this.dictList = res.map((item) => {
  364. let values = Object.keys(item);
  365. return {
  366. value: Number(values[0]),
  367. label: item[values[0]]
  368. };
  369. });
  370. },
  371. async getAttriButeList(code) {
  372. let { data: res } = await getByCode(code);
  373. this.attributeList = res.map((item) => {
  374. let values = Object.keys(item);
  375. return {
  376. value: Number(values[0]),
  377. label: item[values[0]]
  378. };
  379. });
  380. },
  381. handleUpdate() {
  382. this.$refs.form.validate(async (valid) => {
  383. if (valid) {
  384. this.category.produceType = this.attributeData.produceType;
  385. bomCategoryUpdate(this.attributeData).then((res) => {
  386. this.$message.success('修改成功');
  387. });
  388. } else {
  389. return false;
  390. }
  391. });
  392. }
  393. },
  394. props: {
  395. attributeData: {
  396. type: Object,
  397. default: {}
  398. },
  399. isWt: {
  400. type: Boolean,
  401. default: false
  402. }
  403. },
  404. mounted() {
  405. console.log(this.attributeData, 'attributeData');
  406. },
  407. watch: {
  408. attributeData(val) {
  409. console.log(val);
  410. val.baseCount = val.baseCount || 1;
  411. if (Object.prototype.hasOwnProperty.call(val, 'category')) {
  412. this.category = val.category;
  413. this.attributeData.produceType = val.category.produceType;
  414. // this.attributeData.baseCount = val.baseCount||1;
  415. // console.log(this.attributeData,'985');
  416. this.$forceUpdate();
  417. }
  418. }
  419. }
  420. };
  421. </script>
  422. <style lang="scss" scoped>
  423. .btn_box {
  424. display: flex;
  425. align-items: center;
  426. justify-content: center;
  427. }
  428. .el-form-item {
  429. margin-bottom: 10px !important;
  430. }
  431. </style>