detailsPageEdit.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. <template>
  2. <div class="borderless">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button
  6. type="danger"
  7. style="border: none;background: none;color: red"
  8. icon="el-icon-arrow-left"
  9. @click="backToList"
  10. >返回列表
  11. </el-button>
  12. </div>
  13. <el-button
  14. class="el-button--small-yh add-customer-btn"
  15. type="primary"
  16. :disabled="disabled"
  17. @click="editProductInfo"
  18. size="small"
  19. >{{ form.id ? "确认修改" : "确认新增" }}
  20. </el-button>
  21. </div>
  22. <div style="margin-top: 60px">
  23. <containerTitle title="基础信息"></containerTitle>
  24. <basic-container style="margin-bottom: 10px">
  25. <avue-form ref="form" v-model="form" :option="option">
  26. <template slot="goodsTypeId" slot-scope="scope">
  27. <avue-input-tree
  28. v-model="form.goodsTypeId"
  29. :props="{ label: 'title', value: 'id' }"
  30. multiple
  31. placeholder=" "
  32. type="tree"
  33. :dic="dicData"
  34. />
  35. </template>
  36. <template slot="corpId" slot-scope="scope">
  37. <selectComponent
  38. v-model="form.corpId"
  39. :configuration="configuration"
  40. style="width: 100%"
  41. typeData="GYS"
  42. />
  43. </template>
  44. <template slot="cntrVolumn" slot-scope="scope">
  45. <el-input
  46. v-input-limit="2"
  47. v-model="form.cntrVolumn"
  48. clearable
  49. placeholder="请输入 箱立方"
  50. ></el-input>
  51. </template>
  52. <template slot="cartonWeight" slot-scope="scope">
  53. <el-input
  54. v-input-limit="2"
  55. v-model="form.cartonWeight"
  56. clearable
  57. placeholder="请输入 箱重量"
  58. >
  59. <template slot="append">kg</template>
  60. </el-input>
  61. </template>
  62. </avue-form>
  63. </basic-container>
  64. </div>
  65. </div>
  66. </template>
  67. <script>
  68. import {
  69. getDetail,
  70. updateDetail,
  71. getDeptTree,
  72. priceDelete
  73. } from "@/api/basicData/commodityType";
  74. export default {
  75. props:{
  76. detailData:Object
  77. },
  78. name: "detailsPage",
  79. data() {
  80. return {
  81. configuration: {
  82. multipleChoices: false,
  83. multiple: false,
  84. collapseTags: false,
  85. placeholder: "请点击右边按钮选择",
  86. dicData: []
  87. },
  88. form: {},
  89. disabled: false,
  90. userDialog: false, //供应商导入窗口
  91. dicData: [],
  92. detailsSelect: {},
  93. option: {
  94. menuBtn: false,
  95. labelWidth: 100,
  96. column: [
  97. {
  98. label: "产品编码",
  99. prop: "code",
  100. span: 8,
  101. rules: [
  102. {
  103. required: true,
  104. message: " ",
  105. trigger: "blur"
  106. }
  107. ]
  108. },
  109. {
  110. label: "产品名称",
  111. prop: "cname",
  112. span: 8,
  113. rules: [
  114. {
  115. required: true,
  116. message: " ",
  117. trigger: "blur"
  118. }
  119. ],
  120. slot: true
  121. },
  122. {
  123. label: "产品分类",
  124. prop: "goodsTypeId",
  125. span: 8,
  126. rules: [
  127. {
  128. required: true,
  129. message: " ",
  130. trigger: "blur"
  131. }
  132. ]
  133. },
  134. {
  135. label: "花纹",
  136. prop: "brandItem",
  137. span: 8,
  138. rules: [
  139. {
  140. required: true,
  141. message: " ",
  142. trigger: "blur"
  143. }
  144. ]
  145. },
  146. {
  147. label: "品牌",
  148. prop: "brand",
  149. span: 8,
  150. rules: [
  151. {
  152. required: true,
  153. message: " ",
  154. trigger: "blur"
  155. }
  156. ]
  157. },
  158. {
  159. label: "状态",
  160. prop: "status",
  161. span: 8,
  162. type: "select",
  163. dicData: [
  164. {
  165. label: "正常",
  166. value: 0
  167. },
  168. {
  169. label: "停用",
  170. value: 1
  171. }
  172. ]
  173. },
  174. {
  175. label: "规格",
  176. prop: "typeno", //specs
  177. span: 8,
  178. rules: [
  179. {
  180. required: true,
  181. message: " ",
  182. trigger: "blur"
  183. }
  184. ]
  185. },
  186. {
  187. label: "规格1",
  188. prop: "specsOne",
  189. span: 8,
  190. rules: [
  191. {
  192. required: true,
  193. message: " ",
  194. trigger: "blur"
  195. }
  196. ]
  197. },
  198. {
  199. label: "规格2",
  200. prop: "specsTwo",
  201. span: 8,
  202. rules: [
  203. {
  204. required: true,
  205. message: " ",
  206. trigger: "blur"
  207. }
  208. ]
  209. },
  210. {
  211. label: "级别",
  212. prop: "level",
  213. span: 8,
  214. rules: [
  215. {
  216. required: true,
  217. message: " ",
  218. trigger: "blur"
  219. }
  220. ]
  221. },
  222. {
  223. label: "产地",
  224. prop: "placeProduction",
  225. span: 8,
  226. rules: [
  227. {
  228. required: true,
  229. message: " ",
  230. trigger: "blur"
  231. }
  232. ]
  233. },
  234. {
  235. label: "箱立方",
  236. prop: "cntrVolumn",
  237. span: 8,
  238. rules: [
  239. {
  240. required: true,
  241. message: " ",
  242. trigger: "blur"
  243. }
  244. ]
  245. },
  246. {
  247. label: "箱重量",
  248. prop: "cartonWeight",
  249. span: 8,
  250. rules: [
  251. {
  252. required: true,
  253. message: " ",
  254. trigger: "blur"
  255. }
  256. ]
  257. },
  258. {
  259. label: "供应商",
  260. prop: "corpId",
  261. span:16,
  262. rules: [
  263. {
  264. required: true,
  265. message: " ",
  266. trigger: "blur"
  267. }
  268. ]
  269. },
  270. {
  271. label: "三包",
  272. prop: "threeGuarantees",
  273. span: 8
  274. },
  275. {
  276. label: "积分倍数",
  277. prop: "integralMultiples",
  278. span: 8
  279. },
  280. {
  281. label: "兑换积分",
  282. prop: "integral",
  283. span: 8
  284. },
  285. {
  286. label: "备注",
  287. prop: "remarks",
  288. type: "textarea",
  289. minRows: 2,
  290. span: 24
  291. }
  292. ]
  293. }
  294. };
  295. },
  296. //初始化查询
  297. created() {
  298. getDeptTree().then(res => {
  299. this.dicData = res.data.data;
  300. });
  301. this.$set(this.form, 'integralMultiples', 1)
  302. this.$set(this.form, 'integral', 0)
  303. if (this.detailData.id) {
  304. this.queryData(this.detailData.id)
  305. } else {
  306. this.$set(this.form, "goodsTypeId", this.$route.query.treeDeptId);
  307. }
  308. },
  309. methods: {
  310. queryData(id) {
  311. this.openFullScreen(false, '正在努力的加载...');
  312. getDetail(id).then(res => {
  313. this.form = res.data.data;
  314. }).finally(() => {
  315. this.openFullScreen(true);
  316. });
  317. },
  318. addSftRow() {
  319. this.sftData.push({
  320. $cellEdit: true,
  321. cname: null,
  322. texture: null,
  323. colour: null,
  324. describe: null,
  325. remarks: null
  326. });
  327. },
  328. rowContactCell(row, index) {
  329. this.$refs.crudContact.rowCell(row, index);
  330. },
  331. rowPurchaseCell(row, index) {
  332. this.$refs.crudPurchase.rowCell(row, index);
  333. },
  334. //修改提交触发
  335. editProductInfo() {
  336. this.$refs["form"].validate(valid => {
  337. //校验明细列表
  338. if (valid) {
  339. this.configuration.dicData.forEach(e => {
  340. if (e.id == this.form.corpId) {
  341. this.form.corpName = e.cname;
  342. }
  343. });
  344. if (typeof this.form.goodsTypeId !== 'string') {
  345. this.form.goodsTypeId = this.form.goodsTypeId.join(',')
  346. }
  347. const params = {
  348. ...this.form,
  349. type: 0
  350. };
  351. this.openFullScreen(false, '正在努力的加载...');
  352. updateDetail(params).then(res => {
  353. if (res.data.success) {
  354. this.$message.success("操作成功!");
  355. }
  356. this.form = res.data.data
  357. this.queryData(res.data.data.id)
  358. }).catch(() => {
  359. this.openFullScreen(true);
  360. });
  361. } else {
  362. return false;
  363. }
  364. });
  365. },
  366. //返回列表
  367. backToList() {
  368. this.$emit("goBack");
  369. },
  370. //遮罩层
  371. openFullScreen(res, text) {
  372. const loading = this.$loading({
  373. lock: true,
  374. text: text,
  375. spinner: 'el-icon-loading',
  376. background: 'rgba(0, 0, 0, 0.7)'
  377. });
  378. if (res === true) loading.close();
  379. },
  380. }
  381. };
  382. </script>
  383. <style lang="scss" scoped>
  384. .back-icon {
  385. line-height: 64px;
  386. font-size: 20px;
  387. margin-right: 8px;
  388. }
  389. ::v-deep .el-form-item {
  390. margin-bottom: 8px;
  391. }
  392. .el-dialogDeep {
  393. ::v-deep .el-dialog {
  394. margin: 1vh auto 0 !important;
  395. padding-bottom: 10px !important;
  396. .el-dialog__body,
  397. .el-dialog__footer {
  398. padding-bottom: 0 !important;
  399. padding-top: 0 !important;
  400. }
  401. }
  402. }
  403. </style>