| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395 |
- <template>
- <div>
- <div class="customer-head">
- <div class="customer-back">
- <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
- @click="goBack(0)">返回列表
- </el-button>
- </div>
- <div class="add-customer-btn">
- <el-button class="el-button--small-yh" style="margin-left: 6px;" type="primary" size="small"
- @click="submit">保 存
- </el-button>
- </div>
- </div>
- <div style="margin-top: 50px">
- <trade-card title="基础信息">
- <avue-form :option="optionForm" v-model="form" ref="form">
- </avue-form>
- </trade-card>
- <trade-card title="仓储明细">
- <avue-crud :option="option" :data="form.storageFeeItemsList" id="out-table" ref="crud"
- @selection-change="selectionChange" @resetColumn="resetColumn('crud', 'option', 'optionBack', 409)"
- @saveColumn="saveColumn('crud', 'option', 'optionBack', 409)">
- <template slot="menuLeft">
- <el-button type="primary" size="small" icon="el-icon-plus" @click="addRow">新 增
- </el-button>
- </template>
- <tempalte slot="goodsTypeForm" slot-scope="{ row }">
- <dic-select v-if="row.$cellEdit" v-model="row.goodsType" placeholder="商品类型" key="dictKey"
- label="dictValue" url="/blade-system/dict-biz/dictionary?code=goods-type"
- :filterable="true"></dic-select>
- <span v-else>{{ row.goodsType }}</span>
- </tempalte>
- <!-- <template slot="feeName" slot-scope="{ row }">
- <dic-select v-if="row.$cellEdit" v-model="row.feeName" placeholder="费用信息" key="id" res="records"
- label="cnName" url="/blade-los/bfees/list" :filterable="true" :remote="true" fff
- dataName="cnName" @selectChange="rowDicChange('feeName', $event, row)"></dic-select>
- <span v-else>{{ row.feeName }}</span>
- </template> -->
- <template slot="menu" slot-scope="{ row, index }">
- <el-button size="small" icon="el-icon-edit" type="text" @click="rowEdit(row)">{{ row.$cellEdit ?
- '保存' : '编辑' }}</el-button>
- <el-button size="small" icon="el-icon-delete" type="text" @click="rowDel(row, index)">删除</el-button>
- </template>
- </avue-crud>
- </trade-card>
- <!-- <containerTitle title="上传附件"></containerTitle>
- <c-upload :data="form.filesCenterList" :enumerationValue="76"
- deleteUrl="/blade-purchase-sales/orderfiles/update" display :disabled="editDisabled"></c-upload> -->
- </div>
- </div>
- </template>
- <script>
- import { submit, getDetail, copyAgent, itemRemove } from "@/api/iosBasicData/storageFee";
- import { getBtrademodesList, getBtrademodesDetail, addBtrademodes, updateBtrademodes, removeBtrademodes } from "@/api/iosBasicData/warehouse";
- import dicSelect from "@/components/dicSelect/main";
- import { bfeesList } from "@/api/iosBasicData/bfees";
- import _ from "lodash";
- export default {
- name: "detailsPage",
- data() {
- return {
- form: {
- status: '0',
- storageFeeItemsList: []
- },
- optionForm: {
- menuBtn: false,
- span: 8,
- column: [
- {
- label: "编码",
- prop: "code",
- disabled: false,
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- },
- {
- label: "中文名称",
- prop: "cname",
- disabled: false,
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- },
- {
- label: "状态",
- prop: "status",
- type: "select",
- search: true,
- dicData: [{
- label: '启用',
- value: '0'
- }, {
- label: '停用',
- value: '1'
- }],
- value: '0',
- overHidden: true,
- },
- {
- label: '备注',
- prop: "remarks",
- type: 'textarea',
- disabled: false,
- minRows: 2,
- },
- ]
- },
- option: {},
- optionBack: {
- height: 'auto',
- calcHeight: 30,
- menuWidth: 140,
- border: true,
- index: true,
- addBtn: false,
- viewBtn: false,
- editBtn: false,
- delBtn: false,
- refreshBtn: false,
- align: 'center',
- column: [
- {
- label: "费用名称",
- prop: "feeName",
- overHidden: true
- },
- {
- label: "计价单位",
- prop: "feeUnit",
- // cell: true,
- type: 'select',
- filterable: true,
- remote: true,
- dicUrl: "/api/blade-los/bunits/list",
- props: {
- label: 'cnName',
- value: 'cnName',
- res: 'data.records'
- },
- overHidden: true
- },
- {
- label: "商品类别",
- prop: "goodsType",
- cell: true,
- slot: true,
- formslot: true,
- overHidden: true,
- rules: [
- {
- required: true,
- message: '请选择商品类别',
- trigger: 'blur'
- }
- ]
- },
- // {
- // label: "开始天数",
- // prop: "fromDays",
- // cell: true,
- // type: 'number',
- // controls: false,
- // overHidden: true
- // },
- // {
- // label: "结束天数",
- // prop: "enDays",
- // cell: true,
- // type: 'number',
- // controls: false,
- // overHidden: true
- // },
- {
- label: "应收单价",
- prop: "price",
- cell: true,
- type: 'number',
- controls: false,
- overHidden: true,
- rules: [
- {
- required: true,
- message: '请输入应收单价',
- trigger: 'blur'
- }
- ]
- },
- {
- label: "应付单价",
- prop: "priceC",
- cell: true,
- type: 'number',
- controls: false,
- overHidden: true,
- rules: [
- {
- required: true,
- message: '请输入应付单价',
- trigger: 'blur'
- }
- ]
- },
- {
- label: "备注",
- prop: "remarks",
- cell: true,
- overHidden: true
- }
- ]
- },
- }
- },
- components: {
- dicSelect,
- },
- props: {
- detailData: Object
- },
- async created() {
- this.option = await this.getColumnData(this.getColumnName(409), this.optionBack);
- if (this.detailData.id) {
- this.getDetails(this.detailData.id)
- }
- },
- methods: {
- rowEdit(row, index) {
- if (row.$cellEdit) {
- if (!row.goodsType || !row.price|| !row.priceC) {
- this.$refs.crud.rowCell(row, row.$index)
- return this.$message.error("请完善明细信息");
- }
- this.$set(row, '$cellEdit', false)
- } else {
- this.$set(row, '$cellEdit', true)
- }
- },
- rowDel(row, index) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- if (row.id) {
- itemRemove({ ids: row.id }).then(res => {
- this.form.storageFeeItemsList.splice(index, 1);
- this.$message.success("操作成功!");
- });
- } else {
- this.form.storageFeeItemsList.splice(index, 1);
- this.$message.success("操作成功!");
- }
- }
- );
- },
- rowDicChange(name, row, el) {
- if (name == 'feeName') {
- if (row) {
- el.feeId = row.id
- } else {
- el.feeId = null
- }
- }
- },
- getDetails(id) {
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- getBtrademodesDetail(id).then(res => {
- this.form = res.data.data
- console.log(this.form)
- this.$refs.crud.dicInit();
- }).finally(() => {
- loading.close()
- })
- },
- getCopydate(id) {
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- copyAgent({ id: id }).then(res => {
- this.form = res.data.data
- }).finally(() => {
- loading.close()
- })
- },
- addRow() {
- this.$refs.crud.dicInit();
- bfeesList(1, 10, { cnName: '仓储费' }).then(res => {
- res.data.data.records.forEach(e => {
- if (e.cnName == '仓储费')
- this.form.storageFeeItemsList.push({
- feeId: e.id,
- feeName: e.cnName,
- feeUnit: '吨',
- $cellEdit: true
- })
- })
- })
- },
- submit() {
- this.$refs["form"].validate((valid, done) => {
- done();
- if (valid) {
- for (let row of this.form.storageFeeItemsList) {
- if (!row.goodsType || !row.price|| !row.priceC) {
- this.$refs.crud.rowCell(row, row.$index)
- return this.$message.error("请完善明细信息");
- }
- }
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- updateBtrademodes(this.form).then(res => {
- this.$message.success("保存成功");
- this.getDetails(res.data.data.id)
- }).finally(() => {
- loading.close();
- })
- } else {
- return false;
- }
- });
- },
- //自定义列保存
- async saveColumn(ref, option, optionBack, code) {
- const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
- if (inSave) {
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- //自定义列重置
- async resetColumn(ref, option, optionBack, code) {
- this[option] = this[optionBack];
- const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
- if (inSave) {
- this.$message.success("重置成功");
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- goBack(type) {
- this.$emit("goBack", type);
- this.$emit('updateKey')
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- ::v-deep .el-form-item {
- margin-bottom: 8px !important;
- }
- ::v-deep .el-table .cell {
- padding: 0 2px !important;
- .el-form-item {
- margin-bottom: 0px !important;
- }
- }
- ::v-deep .avue-crud .el-table .el-form-item__label {
- left: -1px;
- }
- ::v-deep#out-table .back-one {
- background: #ecf5ff !important;
- }
- ::v-deep#out-table .back-two {
- background: #ecf5ff !important;
- }
- </style>
|