123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429 |
- <template>
- <div>
- <div class="borderless">
- <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="backToList">返回列表
- </el-button>
- </div>
- <div class="add-customer-btn">
- <el-button type="primary" size="small" @click="editCustomer">
- 保存数据
- </el-button>
- </div>
- </div>
- <trade-card title="基础资料" style="margin-top: 60px">
- <avue-form ref="form" class="trading-form" v-model="form" :option="option">
- </avue-form>
- </trade-card>
- <trade-card title="地址管理">
- <avue-crud ref="crud" :option="optionList" :data="data" :table-loading="loading" @saveColumn="saveColumn"
- @resetColumn="resetColumn" :cell-style="cellStyle" @row-save="rowSave" @row-update="addUpdate">
- <template slot="menuLeft">
- <el-button type="primary" @click="addRow" size="mini" :disabled="detailData.status == 1">新建地址
- </el-button>
- </template>
- <template slot="menu" slot-scope="{ row, index }">
- <el-button size="small" type="text" @click="rowCell(row, index)">{{
- row.$cellEdit ? "保存" : "修改" }}</el-button>
- <el-button size="small" type="text" @click="rowDel(row, index)">删除
- </el-button>
- </template>
- </avue-crud>
- </trade-card>
- <containerTitle title="上传附件"></containerTitle>
- <c-upload typeUpload="CD" deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId"
- :data="orderFilesList" display :enumerationValue="35.1" :disabled="detailData.status == 1"></c-upload>
- <el-dialog :title="addressTitle" v-dialogDrag :visible.sync="addressVisible" class="avue-dialog avue-dialog--top"
- width="50%" append-to-body>
- <span>
- <el-tabs v-model="activeName">
- <el-tab-pane label="客户地址" name="first">
- <avue-form class="trading-form" v-model="form2" :option="option2"></avue-form>
- </el-tab-pane>
- <el-tab-pane label="物流地址" name="second">
- <avue-form class="trading-form" v-model="form3" :option="option3"></avue-form>
- </el-tab-pane>
- </el-tabs>
- </span>
- <div class="avue-dialog__footer">
- <el-button @click="addressVisible=false">取 消</el-button>
- <el-button @click="addressVisible=false" type="primary">确 定</el-button>
- </div>
- </el-dialog>
- </div>
- </div>
- </template>
- <script>
- import { optionList } from "./js/optionList";
- import { getDetails } from "@/api/basicData/client";
- import { areaTypeTree } from "@/api/basicData/customerInformation";
- import { getCode } from "@/api/basicData/customerInquiry";
- export default {
- name: "index",
- data() {
- return {
- activeName: 'first',
- loadingBtn: false,
- addressTitle: null,
- addressVisible: false,
- form: {},
- form2: {
- },
- form3: {
- },
- data: [],
- option: {
- menuBtn: false,
- labelWidth: 130,
- column: [
- {
- label: "客户名称",
- prop: "id",
- type: "select",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 8,
- },
- {
- label: "客户分类",
- prop: "corpsTypeId",
- type: "select",
- span: 8,
- },
- {
- label: "期初欠款",
- prop: "arrears",
- span: 8,
- },
- {
- label: "电话",
- prop: "tel",
- span: 8,
- },
- {
- label: "备用电话",
- prop: "telephone",
- span: 8,
- },
- {
- label: "传真",
- prop: "Fax",
- span: 8,
- },
- {
- label: "邮箱",
- prop: "mailbox",
- span: 8,
- },
- {
- label: "备注",
- prop: "remarks",
- type: "textarea",
- minRows: 2,
- span: 24,
- }
- ]
- },
- option2: {
- menuBtn: false,
- labelWidth: 90,
- column: [
- {
- label: "简称",
- prop: "a",
- type: "select",
- span: 24,
- },
- {
- label: "地址",
- prop: "b",
- type: "select",
- span: 24,
- },
- {
- label: "详细地址",
- prop: "c",
- span: 24,
- },
- {
- label: "邮编",
- prop: "d",
- span: 24,
- },
- {
- label: "备注",
- prop: "e",
- type: 'textarea',
- minRows: 3,
- span: 24,
- },
- {
- label: "地址智能识别",
- prop: "ad",
- placeholder:"例:上海市徐汇区枫林街道斜土路100号",
- type: "textarea",
- minRows: 3,
- span: 24,
- }
- ]
- },
- option3: {
- menuBtn: false,
- labelWidth: 80,
- column: [
- {
- label: "目的地",
- prop: "a",
- type: "select",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 24,
- },
- {
- label: "物流公司",
- prop: "b",
- span: 24,
- },
- {
- label: "电话",
- prop: "c",
- span: 24,
- },
- {
- label: "地址",
- prop: "d",
- span: 24,
- },
- {
- label: "详细地址",
- prop: "e",
- span: 24,
- },
- {
- label: "邮编",
- prop: "f",
- span: 24,
- },
- {
- label: "备注",
- prop: "remarks",
- type: "textarea",
- minRows: 3,
- span: 24,
- },
- {
- label: "地址智能识别",
- prop: "g",
- type: "textarea",
- minRows: 3,
- span: 24,
- }
- ]
- },
- optionList: {},
- };
- },
- props: {
- detailData: {
- type: Object
- }
- },
- async created() {
- this.optionList = await this.getColumnData(
- this.getColumnName(208),
- optionList
- );
- if (this.detailData.id) {
- this.getDetail(this.detailData.id);
- }
- if (this.detailData.status == 1) {
- this.option.disabled = true;
- }
- this.getAllWorkDicts()
- },
- methods: {
- getAllWorkDicts() {
- this.findObject(this.optionList.column, "departureId").dicData = JSON.parse(localStorage.getItem('areaTypeTree'));
- },
- cellStyle() {
- return "padding:0;height:40px;";
- },
- selectValue(value, row) {
- console.log(value, row)
- if (row.feesId) {
- row.feesName = value.cname
- } else {
- row.feesName = ""
- }
- },
- getDetail(id) {
- this.loadingBtn = true
- getDetails({id:id})
- .then(res => {
- this.form = res.data.data;
- this.data = res.data.data.orderCostItemList;
- })
- .finally(() => {
- this.loadingBtn = false;
- });
- },
- getCorpData(row) {
- this.form.corpName = row.cname
- },
- addRow() {
- this.addressTitle = '新增地址'
- this.addressVisible = true
- },
- rowCell(row, index) {
- this.$refs.crud.rowCell(row, index)
- },
- rowSave(form, done) {
- done()
- },
- addUpdate(form, index, done, loading) {
- done()
- },
- rowDel(row, index) {
- this.$confirm("确定删除数据?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- if (row.id) {
- // itemDel(row.id).then(res => {
- // this.$message({
- // type: "success",
- // message: "删除成功!"
- // });
- // this.data.splice(index, 1);
- // });
- } else {
- this.$message({
- type: "success",
- message: "删除成功!"
- });
- this.data.splice(index, 1);
- }
- });
- },
- //修改提交触发
- editCustomer() {
- this.$refs["form"].validate((valid, done) => {
- done();
- if (valid) {
- this.data.forEach(e => {
- e.departure = e.departureId ? e.departureId.replace(/,/g, "/") : ''
- })
- this.loadingBtn = true;
- // submit({ ...this.form, feesType: 1, orderCostItemList: this.data })
- // .then(res => {
- // this.$message.success("保存成功");
- // this.form = res.data.data;
- // this.data = res.data.data.orderCostItemList;
- // })
- // .finally(() => {
- // this.loadingBtn = false;
- // });
- } else {
- return false;
- }
- });
- },
- async saveColumn() {
- const inSave = await this.saveColumnData(
- this.getColumnName(208),
- this.optionList
- );
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.crud.doLayout();
- });
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }
- },
- async resetColumn() {
- this.optionList = optionList;
- const inSave = await this.delColumnData(
- this.getColumnName(208),
- optionList
- );
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.crud.doLayout();
- });
- this.getAllWorkDicts()
- this.$message.success("重置成功");
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }
- },
- //返回列表
- backToList() {
- this.$emit("goBack");
- console.log(11111)
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .trading-form ::v-deep .el-form-item {
- margin-bottom: 8px !important;
- }
- ::v-deep .el-dialog__body {
- padding: 0px 20px 15px 20px;
- }
- ::v-deep .el-form-item__error {
- display: none !important;
- }
- .img-form ::v-deep .el-form-item {
- height: 150px;
- line-height: 150px;
- margin-bottom: 8px !important;
- }
- .img-form ::v-deep .avue-upload__icon {
- font-size: 20px;
- width: 150px;
- height: 150px;
- line-height: 150px;
- }
- ::v-deep .el-table .cell {
- padding: 0 2px !important;
- }
- ::v-deep .avue-crud .el-table .el-form-item__label {
- left: -1px;
- }
- .addressTabs {
- display: flex;
- justify-content: center;
- span {
- width: 100px;
- font-size: 18px;
- font-weight: 600;
- text-align: center;
- }
- }
- </style>
|