detailsPageEdit.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  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. <template slot="integralMultiples" slot-scope="scope">
  63. <el-input
  64. v-input-limit="2"
  65. v-model="form.integralMultiples"
  66. clearable
  67. placeholder="请输入 积分倍数"
  68. ></el-input>
  69. </template>
  70. <template slot="integral" slot-scope="scope">
  71. <el-input
  72. v-input-limit="2"
  73. v-model="form.integral"
  74. clearable
  75. placeholder="请输入 兑换积分"
  76. ></el-input>
  77. </template>
  78. <template slot="batch">
  79. <el-switch
  80. v-model="form.batch"
  81. active-text="是"
  82. inactive-text="否"
  83. :active-value="1"
  84. :inactive-value="0"
  85. />
  86. </template>
  87. <template slot="unit">
  88. <el-select
  89. v-model="form.unit"
  90. clearable
  91. filterable
  92. placeholder="请选择 计量单位"
  93. >
  94. <el-option
  95. v-for="(item, index) in unitOption"
  96. :key="index"
  97. :label="item.dictValue"
  98. :value="item.dictValue"
  99. />
  100. </el-select>
  101. </template>
  102. </avue-form>
  103. </basic-container>
  104. </div>
  105. </div>
  106. </template>
  107. <script>
  108. import {
  109. getDetail,
  110. updateDetail,
  111. getDeptTree,
  112. priceDelete
  113. } from "@/api/basicData/commodityType";
  114. export default {
  115. props:{
  116. detailData:Object
  117. },
  118. name: "detailsPage",
  119. data() {
  120. return {
  121. configuration: {
  122. multipleChoices: false,
  123. multiple: false,
  124. collapseTags: false,
  125. placeholder: "请点击右边按钮选择",
  126. dicData: []
  127. },
  128. form: {},
  129. disabled: false,
  130. userDialog: false, //供应商导入窗口
  131. dicData: [],
  132. detailsSelect: {},
  133. option: {
  134. menuBtn: false,
  135. labelWidth: 110,
  136. column: [
  137. {
  138. label: "产品编码",
  139. prop: "code",
  140. span: 8,
  141. rules: [
  142. {
  143. required: true,
  144. message: " ",
  145. trigger: "blur"
  146. }
  147. ]
  148. },
  149. {
  150. label: "产品名称",
  151. prop: "cname",
  152. span: 8,
  153. rules: [
  154. {
  155. required: true,
  156. message: " ",
  157. trigger: "blur"
  158. }
  159. ],
  160. slot: true
  161. },
  162. {
  163. label: "产品分类",
  164. prop: "goodsTypeId",
  165. span: 8,
  166. rules: [
  167. {
  168. required: true,
  169. message: " ",
  170. trigger: "blur"
  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: "brandItem",
  189. span: 8,
  190. rules: [
  191. {
  192. required: true,
  193. message: " ",
  194. trigger: "blur"
  195. }
  196. ]
  197. },
  198. {
  199. label: "规格2(尺寸)",
  200. prop: "size",
  201. span: 8
  202. },
  203. {
  204. label: "供应商",
  205. prop: "corpId",
  206. span:16,
  207. rules: [
  208. {
  209. required: true,
  210. message: " ",
  211. trigger: "blur"
  212. }
  213. ]
  214. },
  215. {
  216. label: "品牌",
  217. prop: "brand",
  218. span: 8,
  219. rules: [
  220. {
  221. required: true,
  222. message: " ",
  223. trigger: "blur"
  224. }
  225. ]
  226. },
  227. {
  228. label: "级别(负荷指数)",
  229. prop: "specsOne",
  230. span: 8,
  231. rules: [
  232. {
  233. required: false,
  234. message: " ",
  235. trigger: "blur"
  236. }
  237. ]
  238. },
  239. {
  240. label: "级别2(速级)",
  241. prop: "specsTwo",
  242. span: 8,
  243. rules: [
  244. {
  245. required: false,
  246. message: " ",
  247. trigger: "blur"
  248. }
  249. ]
  250. },
  251. {
  252. label: "级别3(加强型)",
  253. prop: "level",
  254. span: 8,
  255. rules: [
  256. {
  257. required: false,
  258. message: " ",
  259. trigger: "blur"
  260. }
  261. ]
  262. },
  263. {
  264. label: "产地",
  265. prop: "placeProduction",
  266. span: 8,
  267. rules: [
  268. {
  269. required: true,
  270. message: " ",
  271. trigger: "blur"
  272. }
  273. ]
  274. },
  275. {
  276. label: "箱立方",
  277. prop: "cntrVolumn",
  278. span: 8,
  279. rules: [
  280. {
  281. required: true,
  282. message: " ",
  283. trigger: "blur"
  284. }
  285. ]
  286. },
  287. {
  288. label: "箱重量",
  289. prop: "cartonWeight",
  290. span: 8,
  291. rules: [
  292. {
  293. required: true,
  294. message: " ",
  295. trigger: "blur"
  296. }
  297. ]
  298. },
  299. {
  300. label: "计量单位",
  301. prop: "unit",
  302. span: 8
  303. },
  304. {
  305. label: "辅助单位",
  306. prop: "assistUnit",
  307. span: 8
  308. },
  309. {
  310. label: "状态",
  311. prop: "status",
  312. span: 8,
  313. type: "select",
  314. dicData: [
  315. {
  316. label: "正常",
  317. value: 0
  318. },
  319. {
  320. label: "停用",
  321. value: 1
  322. }
  323. ]
  324. },
  325. {
  326. label: "积分倍数",
  327. prop: "integralMultiples",
  328. span: 8
  329. },
  330. {
  331. label: "兑换积分",
  332. prop: "integral",
  333. span: 8
  334. },
  335. {
  336. label: "按批次号计算",
  337. prop: "batch",
  338. span: 8
  339. },
  340. {
  341. label: "备注",
  342. prop: "remarks",
  343. type: "textarea",
  344. minRows: 2,
  345. span: 24
  346. }
  347. ]
  348. },
  349. unitOption: [], //计量单位数组
  350. };
  351. },
  352. //初始化查询
  353. created() {
  354. this.getWorkDicts('unit').then(res => {
  355. this.unitOption = res.data.data;
  356. })
  357. this.$set(this.form, 'status', 0)
  358. getDeptTree().then(res => {
  359. this.dicData = res.data.data;
  360. });
  361. this.$set(this.form, 'integralMultiples', 1)
  362. this.$set(this.form, 'integral', 0)
  363. this.$set(this.form, 'batch', 0)
  364. if (this.detailData.id) {
  365. this.queryData(this.detailData.id)
  366. } else {
  367. this.$set(this.form, "goodsTypeId", this.detailData.goodsTypeId);
  368. }
  369. },
  370. methods: {
  371. queryData(id) {
  372. this.openFullScreen(false, '正在努力的加载...');
  373. getDetail(id).then(res => {
  374. this.form = res.data.data;
  375. }).finally(() => {
  376. this.openFullScreen(true);
  377. });
  378. },
  379. addSftRow() {
  380. this.sftData.push({
  381. $cellEdit: true,
  382. cname: null,
  383. texture: null,
  384. colour: null,
  385. describe: null,
  386. remarks: null
  387. });
  388. },
  389. rowContactCell(row, index) {
  390. this.$refs.crudContact.rowCell(row, index);
  391. },
  392. rowPurchaseCell(row, index) {
  393. this.$refs.crudPurchase.rowCell(row, index);
  394. },
  395. //修改提交触发
  396. editProductInfo() {
  397. this.$refs["form"].validate((valid, done) => {
  398. done();
  399. //校验明细列表
  400. if (valid) {
  401. this.configuration.dicData.forEach(e => {
  402. if (e.id == this.form.corpId) {
  403. this.form.corpName = e.cname;
  404. }
  405. });
  406. if (typeof this.form.goodsTypeId !== 'string') {
  407. this.form.goodsTypeId = this.form.goodsTypeId.join(',')
  408. }
  409. const params = {
  410. ...this.form,
  411. type: 0
  412. };
  413. this.openFullScreen(false, '正在努力的加载...');
  414. updateDetail(params).then(res => {
  415. if (res.data.success) {
  416. this.$message.success("操作成功!");
  417. }
  418. this.form = res.data.data
  419. this.queryData(res.data.data.id)
  420. }).catch(() => {
  421. this.openFullScreen(true);
  422. });
  423. } else {
  424. return false;
  425. }
  426. });
  427. },
  428. //返回列表
  429. backToList() {
  430. this.$emit("goBack");
  431. },
  432. //遮罩层
  433. openFullScreen(res, text) {
  434. const loading = this.$loading({
  435. lock: true,
  436. text: text,
  437. spinner: 'el-icon-loading',
  438. background: 'rgba(0, 0, 0, 0.7)'
  439. });
  440. if (res === true) loading.close();
  441. },
  442. }
  443. };
  444. </script>
  445. <style lang="scss" scoped>
  446. .back-icon {
  447. line-height: 64px;
  448. font-size: 20px;
  449. margin-right: 8px;
  450. }
  451. ::v-deep .el-form-item {
  452. margin-bottom: 8px;
  453. }
  454. .el-dialogDeep {
  455. ::v-deep .el-dialog {
  456. margin: 1vh auto 0 !important;
  457. padding-bottom: 10px !important;
  458. .el-dialog__body,
  459. .el-dialog__footer {
  460. padding-bottom: 0 !important;
  461. padding-top: 0 !important;
  462. }
  463. }
  464. }
  465. </style>