detailsPage.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <template>
  2. <div>
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="goBack(0)">返回列表
  7. </el-button>
  8. </div>
  9. <div class="add-customer-btn">
  10. <el-button class="el-button--small-yh" style="margin-left: 6px;" type="primary" size="small"
  11. @click="submit">保 存
  12. </el-button>
  13. </div>
  14. </div>
  15. <div style="margin-top: 50px">
  16. <trade-card title="基础信息">
  17. <avue-form :option="optionForm" v-model="form" ref="form">
  18. <tempalte slot="corpName" slot-scope="{ row }">
  19. <dic-select v-model="form.corpName" placeholder="客户" key="id" label="cnName" res="records"
  20. url="/blade-los/bcorps/listByType" :filterable="true" :remote="true" dataName="cnName"
  21. @selectChange="dicChange('corpName', $event)"></dic-select>
  22. </tempalte>
  23. <tempalte slot="warehouseName" slot-scope="{ row }">
  24. <dic-select v-model="form.warehouseName" placeholder="仓库" key="id" label="cname" res="records"
  25. url="/blade-los/storage/list" :filterable="true" :remote="true" dataName="cname"
  26. @selectChange="dicChange('warehouseName', $event)"></dic-select>
  27. </tempalte>
  28. <tempalte slot="goodsType" slot-scope="{ row }">
  29. <dic-select v-model="form.goodsType" placeholder="商品类型" key="dictKey" label="dictValue"
  30. url="/blade-system/dict-biz/dictionary?code=goods-type" :filterable="true"></dic-select>
  31. </tempalte>
  32. </avue-form>
  33. </trade-card>
  34. <trade-card title="仓储明细">
  35. <avue-crud :option="option" :data="form.storageFeeItemsList" id="out-table" ref="crud"
  36. @selection-change="selectionChange" @resetColumn="resetColumn('crud', 'option', 'optionBack', 396)"
  37. @saveColumn="saveColumn('crud', 'option', 'optionBack', 396)">
  38. <template slot="menuLeft">
  39. <el-button type="primary" size="small" icon="el-icon-plus" @click="addRow">新 增
  40. </el-button>
  41. </template>
  42. <template slot="feeName" slot-scope="{ row }">
  43. <dic-select v-if="row.$cellEdit" v-model="row.feeName" placeholder="费用信息" key="id" res="records"
  44. label="cnName" url="/blade-los/bfees/list" :filterable="true" :remote="true" fff
  45. dataName="cnName" @selectChange="rowDicChange('feeName', $event, row)"></dic-select>
  46. <span v-else>{{ row.feeName }}</span>
  47. </template>
  48. </avue-crud>
  49. </trade-card>
  50. <containerTitle title="上传附件"></containerTitle>
  51. <c-upload :data="form.filesCenterList" :enumerationValue="76"
  52. deleteUrl="/blade-purchase-sales/orderfiles/update" display :disabled="editDisabled"></c-upload>
  53. </div>
  54. </div>
  55. </template>
  56. <script>
  57. import { submit, getDetail,copyAgent } from "@/api/iosBasicData/storageFee";
  58. import dicSelect from "@/components/dicSelect/main";
  59. import { bfeesList } from "@/api/iosBasicData/bfees";
  60. import _ from "lodash";
  61. export default {
  62. name: "detailsPage",
  63. data() {
  64. return {
  65. form: {
  66. status:'0',
  67. storageFeeItemsList: []
  68. },
  69. optionForm: {
  70. menuBtn: false,
  71. span: 8,
  72. column: [
  73. {
  74. label: '客户',
  75. prop: "corpName",
  76. disabled: false,
  77. rules: [{
  78. required: true,
  79. message: " ",
  80. trigger: "blur"
  81. }]
  82. },
  83. {
  84. label: "仓库名称",
  85. prop: "warehouseName",
  86. },
  87. {
  88. label: "商品类别",
  89. prop: "goodsType",
  90. },
  91. {
  92. label: "有效期起",
  93. prop: "beginDate",
  94. type: "date",
  95. format: "yyyy-MM-dd",
  96. valueFormat: "yyyy-MM-dd 00:00:00",
  97. },
  98. {
  99. label: "有效期至",
  100. prop: "endDate",
  101. type: "date",
  102. format: "yyyy-MM-dd",
  103. valueFormat: "yyyy-MM-dd 23:59:59"
  104. },
  105. {
  106. label: "状态",
  107. prop: "status",
  108. type: "select",
  109. dicData: [{
  110. label: '启用',
  111. value: '0'
  112. }, {
  113. label: '停用',
  114. value: '1'
  115. }],
  116. },
  117. {
  118. label: '备注',
  119. prop: "remarks",
  120. type: 'textarea',
  121. disabled: false,
  122. minRows: 2,
  123. },
  124. ]
  125. },
  126. option: {},
  127. optionBack: {
  128. height: 'auto',
  129. calcHeight: 30,
  130. menuWidth: 140,
  131. border: true,
  132. index: true,
  133. addBtn: false,
  134. viewBtn: false,
  135. editBtn: false,
  136. delBtn: false,
  137. menu: false,
  138. refreshBtn: false,
  139. align: 'center',
  140. column: [
  141. {
  142. label: "费用名称",
  143. prop: "feeName",
  144. overHidden: true
  145. },
  146. {
  147. label: "计价单位",
  148. prop: "feeUnit",
  149. cell: true,
  150. type: 'select',
  151. filterable: true,
  152. remote: true,
  153. dicUrl: "/api/blade-los/bunits/list",
  154. props: {
  155. label: 'cnName',
  156. value: 'cnName',
  157. res: 'data.records'
  158. },
  159. overHidden: true
  160. },
  161. {
  162. label: "开始天数",
  163. prop: "fromDays",
  164. cell: true,
  165. type: 'number',
  166. controls: false,
  167. overHidden: true
  168. },
  169. {
  170. label: "结束天数",
  171. prop: "enDays",
  172. cell: true,
  173. type: 'number',
  174. controls: false,
  175. overHidden: true
  176. },
  177. {
  178. label: "单价",
  179. prop: "price",
  180. cell: true,
  181. type: 'number',
  182. controls: false,
  183. overHidden: true
  184. },
  185. {
  186. label: "备注",
  187. prop: "remarks",
  188. cell: true,
  189. overHidden: true
  190. }
  191. ]
  192. },
  193. }
  194. },
  195. components: {
  196. dicSelect,
  197. },
  198. props: {
  199. detailData: Object
  200. },
  201. async created() {
  202. this.option = await this.getColumnData(this.getColumnName(396), this.optionBack);
  203. if (this.detailData.id) {
  204. this.getDetails(this.detailData.id)
  205. }
  206. if (this.detailData.copyId) {
  207. this.getCopydate(this.detailData.copyId)
  208. }
  209. },
  210. methods: {
  211. dicChange(name, row) {
  212. if (name == 'corpName') {
  213. if (row) {
  214. this.form.corpId = row.id
  215. } else {
  216. this.form.corpId = null
  217. }
  218. }
  219. },
  220. rowDicChange(name, row, el) {
  221. if (name == 'feeName') {
  222. if (row) {
  223. el.feeId = row.id
  224. } else {
  225. el.feeId = null
  226. }
  227. }
  228. if (name == 'warehouseName') {
  229. if (row) {
  230. el.warehouseId = row.id
  231. } else {
  232. el.warehouseId = null
  233. }
  234. }
  235. },
  236. getDetails(id) {
  237. const loading = this.$loading({
  238. lock: true,
  239. text: '加载中',
  240. spinner: 'el-icon-loading',
  241. background: 'rgba(255,255,255,0.7)'
  242. });
  243. getDetail({ id: id }).then(res => {
  244. this.form = res.data.data
  245. this.$refs.crud.dicInit();
  246. }).finally(() => {
  247. loading.close()
  248. })
  249. },
  250. getCopydate(id) {
  251. const loading = this.$loading({
  252. lock: true,
  253. text: '加载中',
  254. spinner: 'el-icon-loading',
  255. background: 'rgba(255,255,255,0.7)'
  256. });
  257. copyAgent({ id: id }).then(res => {
  258. this.form = res.data.data
  259. }).finally(() => {
  260. loading.close()
  261. })
  262. },
  263. addRow() {
  264. if (!this.form.corpId) {
  265. return this.$message.error("请选择客户名称");
  266. }
  267. this.$refs.crud.dicInit();
  268. bfeesList(1, 10, { cnName: '仓储费' }).then(res => {
  269. res.data.data.records.forEach(e => {
  270. if (e.cnName == '仓储费')
  271. this.form.storageFeeItemsList.push({
  272. feeId: e.id,
  273. feeName: e.cnName,
  274. $cellEdit: true
  275. })
  276. })
  277. })
  278. },
  279. submit() {
  280. this.$refs["form"].validate((valid, done) => {
  281. done();
  282. if (valid) {
  283. const loading = this.$loading({
  284. lock: true,
  285. text: '加载中',
  286. spinner: 'el-icon-loading',
  287. background: 'rgba(255,255,255,0.7)'
  288. });
  289. submit(this.form).then(res => {
  290. this.$message.success("保存成功");
  291. this.getDetails(res.data.data.id)
  292. }).finally(() => {
  293. loading.close();
  294. })
  295. } else {
  296. return false;
  297. }
  298. });
  299. },
  300. //自定义列保存
  301. async saveColumn(ref, option, optionBack, code) {
  302. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  303. if (inSave) {
  304. this.$message.success("保存成功");
  305. //关闭窗口
  306. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  307. }
  308. },
  309. //自定义列重置
  310. async resetColumn(ref, option, optionBack, code) {
  311. this[option] = this[optionBack];
  312. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  313. if (inSave) {
  314. this.$message.success("重置成功");
  315. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  316. }
  317. },
  318. goBack(type) {
  319. this.$emit("goBack", type);
  320. this.$emit('updateKey')
  321. },
  322. }
  323. }
  324. </script>
  325. <style lang="scss" scoped>
  326. ::v-deep .el-form-item {
  327. margin-bottom: 8px !important;
  328. }
  329. ::v-deep .el-table .cell {
  330. padding: 0 2px !important;
  331. .el-form-item {
  332. margin-bottom: 0px !important;
  333. }
  334. }
  335. ::v-deep .avue-crud .el-table .el-form-item__label {
  336. left: -1px;
  337. }
  338. ::v-deep#out-table .back-one {
  339. background: #ecf5ff !important;
  340. }
  341. ::v-deep#out-table .back-two {
  342. background: #ecf5ff !important;
  343. }
  344. </style>