index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <template>
  2. <div class="detil">
  3. <by-tool :propConfig="toolConfig" />
  4. <div class="box-shadow">
  5. <by-form :propConfig="config" ref="form">
  6. <template v-slot:description="option">
  7. <el-input type="textarea" :rows="5" placeholder="请输入内容" v-model="textarea">
  8. </el-input>
  9. </template>
  10. <template v-slot:radio="option">
  11. <el-radio v-model="radio" :label="1">单规格</el-radio>
  12. <el-radio v-model="radio" :label="2">多规格</el-radio>
  13. </template>
  14. <template v-slot:status="option">
  15. <el-radio v-model="radioStatus" :label="1">启用</el-radio>
  16. <el-radio v-model="radioStatus" :label="2">备用</el-radio>
  17. <el-radio v-model="radioStatus" :label="3">禁用</el-radio>
  18. </template>
  19. <template v-slot:ismakeup="option">
  20. <el-radio v-model="ismakeup" :label="1">是</el-radio>
  21. <el-radio v-model="ismakeup" :label="2">否</el-radio>
  22. </template>
  23. <template v-slot:issued="option">
  24. <el-radio v-model="issued" :label="1">是</el-radio>
  25. <el-radio v-model="issued" :label="2">否</el-radio>
  26. </template>
  27. </by-form>
  28. </div>
  29. </div>
  30. </template>
  31. <script lang="ts">
  32. import { Component, Prop, Vue, Watch } from "vue-property-decorator";
  33. import api from "@/api/material";
  34. @Component
  35. export default class MaterialEdit extends Vue {
  36. baseURL : any = process.env.VUE_APP_BASE_API
  37. radio : any = 1
  38. radioStatus : any = 1
  39. ismakeup : any = 1
  40. issued : any = 1
  41. textarea : any = ''
  42. toolConfig = {
  43. customTools: [
  44. {
  45. name: '保存', icon: 'el-icon-plus', audit: [''], event: {
  46. click: () => {
  47. (this as any).getFormData()
  48. }
  49. }
  50. }
  51. ]
  52. }
  53. config = {
  54. attr: {
  55. size: 'small',
  56. rules: {
  57. name: [{
  58. required: true, message: '请输入名称', trigger: 'blur'
  59. }],
  60. shortName: [{
  61. required: true, message: '请输入简称', trigger: 'blur'
  62. }]
  63. }
  64. },
  65. columns: [
  66. [
  67. {
  68. span: 6,
  69. label: '名称',
  70. prop: 'name',
  71. component: 'by-input',
  72. compConfig: {
  73. attr: {
  74. placeholder: '请输入名称',
  75. clearable: true
  76. }
  77. }
  78. },
  79. {
  80. span: 6,
  81. label: '简称',
  82. prop: 'shortName',
  83. component: 'by-input',
  84. compConfig: {
  85. attr: {
  86. placeholder: '请输入简称',
  87. clearable: true
  88. }
  89. }
  90. },
  91. {
  92. span: 6,
  93. label: '财务编号',
  94. prop: 'accountingCode',
  95. component: 'by-input',
  96. compConfig: {
  97. attr: {
  98. placeholder: '请输入财务编号',
  99. clearable: true
  100. }
  101. }
  102. },
  103. {
  104. span: 6,
  105. label: '国际码',
  106. prop: 'nsCode',
  107. component: 'by-input',
  108. compConfig: {
  109. attr: {
  110. placeholder: '请输入国际码',
  111. clearable: true
  112. }
  113. }
  114. },
  115. ],
  116. [
  117. {
  118. span: 6,
  119. label: '基本售价',
  120. prop: 'basePrice',
  121. component: 'by-input',
  122. compConfig: {
  123. attr: {
  124. placeholder: '请输入基本售价',
  125. clearable: true
  126. }
  127. }
  128. }, {
  129. span: 6,
  130. label: '市场价格',
  131. prop: 'markPrice',
  132. component: 'by-input',
  133. compConfig: {
  134. attr: {
  135. placeholder: '请输入市场价格',
  136. clearable: true
  137. }
  138. }
  139. },
  140. {
  141. span: 6,
  142. label: '价格',
  143. prop: 'price',
  144. component: 'by-input',
  145. compConfig: {
  146. attr: {
  147. placeholder: '请输入价格(成交、成本价)',
  148. clearable: true
  149. }
  150. }
  151. },
  152. {
  153. span: 6,
  154. label: '单位',
  155. prop: 'unit',
  156. component: 'by-input',
  157. compConfig: {
  158. attr: {
  159. placeholder: '请输入单位',
  160. clearable: true
  161. }
  162. }
  163. },
  164. ],
  165. [
  166. {
  167. span: 6,
  168. label: '重量',
  169. prop: 'weight',
  170. component: 'by-input',
  171. compConfig: {
  172. attr: {
  173. placeholder: '请输入重量',
  174. clearable: true
  175. }
  176. }
  177. },
  178. {
  179. span: 6,
  180. label: '保质期(天)',
  181. prop: 'shelfLife',
  182. component: 'by-input',
  183. compConfig: {
  184. attr: {
  185. placeholder: '请输入保质期(天)',
  186. clearable: true
  187. }
  188. }
  189. },
  190. {
  191. span: 6,
  192. label: '库存',
  193. prop: 'stock',
  194. component: 'by-input',
  195. compConfig: {
  196. attr: {
  197. placeholder: '请输入库存',
  198. clearable: true
  199. }
  200. }
  201. },
  202. {
  203. span: 6,
  204. label: '安全库存',
  205. prop: 'warningStock',
  206. component: 'by-input',
  207. compConfig: {
  208. attr: {
  209. placeholder: '请输入安全库存',
  210. clearable: true
  211. }
  212. }
  213. }
  214. ],
  215. [
  216. {
  217. span: 6,
  218. label: '货号',
  219. prop: 'itemNumber',
  220. component: 'by-input',
  221. compConfig: {
  222. attr: {
  223. placeholder: '请输入货号',
  224. clearable: true
  225. }
  226. }
  227. },
  228. {
  229. span: 6,
  230. label: '分类',
  231. prop: 'select',
  232. component: 'by-select',
  233. compConfig: {
  234. attr: {
  235. placeholder: '请选择数据',
  236. clearable: true,
  237. },
  238. request: '/maindata/maindataMaterialCategory/treeList'
  239. },
  240. },
  241. {
  242. span: 6,
  243. label: '虚拟分类',
  244. prop: 'select',
  245. component: 'by-select',
  246. compConfig: {
  247. attr: {
  248. placeholder: '请选择数据',
  249. clearable: true,
  250. },
  251. request: '/maindata/maindataMaterialCategory/treeList'
  252. },
  253. },
  254. {
  255. span: 6,
  256. label: '厂家物料',
  257. prop: 'factoryId',
  258. component: 'by-select',
  259. compConfig: {
  260. attr: {
  261. placeholder: '请选择数据',
  262. clearable: true,
  263. },
  264. request: '/maindata/maindataMaterialCategory/treeList'
  265. },
  266. }
  267. ],
  268. [
  269. {
  270. span: 6,
  271. label: '机构商品分类',
  272. prop: 'select',
  273. component: 'by-select',
  274. compConfig: {
  275. attr: {
  276. placeholder: '请选择数据',
  277. clearable: true,
  278. },
  279. request: '/maindata/maindataMaterialCategory/treeList'
  280. },
  281. },
  282. {
  283. span: 6,
  284. label: '物料属性表',
  285. prop: 'select',
  286. component: 'by-select',
  287. compConfig: {
  288. attr: {
  289. placeholder: '请选择数据',
  290. clearable: true,
  291. },
  292. request: '/maindata/maindataMaterialCategory/treeList'
  293. },
  294. }
  295. ],
  296. [
  297. {
  298. span: 30,
  299. label: '描述',
  300. slot: true,
  301. prop: 'description',
  302. }
  303. ],
  304. [
  305. {
  306. span: 20,
  307. label: '商品规格',
  308. slot: true,
  309. prop: 'radio',
  310. }
  311. ],
  312. [
  313. {
  314. span: 20,
  315. label: '物料状态',
  316. slot: true,
  317. prop: 'status',
  318. }
  319. ],
  320. [
  321. {
  322. span: 20,
  323. label: '是否组合商品',
  324. slot: true,
  325. prop: 'ismakeup',
  326. }
  327. ],
  328. [
  329. {
  330. span: 20,
  331. label: '是否公布',
  332. slot: true,
  333. prop: 'issued',
  334. }
  335. ],
  336. ],
  337. }
  338. created() {
  339. setTimeout(() => {
  340. if (this.$route.params) (this as any).$refs.form.setValue(this.$route.params.baseInfo)
  341. }, 300)
  342. }
  343. getMaterialData(e : any) {
  344. console.log(e);
  345. }
  346. getFormData() {
  347. (this as any).$refs.form.validate().then(() => {
  348. let data = (this as any).$refs.form.getValue();
  349. api.update(data).then((res : any) => {
  350. if (res.code === 200) {
  351. (this as any).$tab.closeOpenPage('/materialFile/productManagement')
  352. this.$message({ type: 'success', message: res.msg })
  353. }
  354. })
  355. });
  356. }
  357. }
  358. </script>
  359. <style lang="scss" scoped>
  360. .detil {
  361. padding: 20px;
  362. .box-shadow {
  363. box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
  364. padding: 20px;
  365. border-radius: 4px;
  366. border: 1px solid #e6ebf5;
  367. background-color: #fff;
  368. overflow: hidden;
  369. color: #303133;
  370. -webkit-transition: .3s;
  371. transition: .3s;
  372. margin-top: 20px;
  373. }
  374. }
  375. </style>