| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436 |
- <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" :disabled="loadingBtn || detailData.status == 1">
- 保存数据
- </el-button>
- </div>
- </div>
- <containerTitle title="基础资料" style="margin-top: 60px"></containerTitle>
- <basic-container v-loading="loadingBtn">
- <avue-form ref="form" class="trading-form" v-model="form" :option="option">
- <template slot="corpId">
- <crop-select v-model="form.corpId" corpType="KH" :refresh="false" @getCorpData="getCorpData"
- :disabled="detailData.status == 1"></crop-select>
- </template>
- <!-- <template slot="warehouseId">
- <el-cascader v-model="form.warehouseId" :options="storagetreeList" :show-all-levels="false"
- :disabled="detailData.status == 1"
- :props="{ checkStrictly: true, emitPath: false, label: 'title',multiple: true }" clearable>
- </el-cascader>
- </template> -->
- </avue-form>
- </basic-container>
- <containerTitle title="基础明细"></containerTitle>
- <basic-container v-loading="loadingBtn">
- <avue-crud ref="crud" :option="optionList" :data="dataList" :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="small" :disabled="detailData.status == 1">新增
- </el-button>
- </template>
- <template slot="feeId" slot-scope="{ row,index }">
- <breakdown-select v-if="row.$cellEdit" v-model="row.feeId" @selectValue="value => selectValue(value,row)"
- :configuration="breakConfiguration">
- </breakdown-select>
- <span v-else>{{ row.feeName }}</span>
- </template>
- <template slot="menu" slot-scope="{ row, index }">
- <el-button size="small" type="text" @click="rowCell(row, index)" :disabled="detailData.status == 1">{{
- row.$cellEdit ? "保存" : "修改" }}</el-button>
- <el-button size="small" type="text" @click="rowDel(row, index)" :disabled="detailData.status == 1">删除
- </el-button>
- </template>
- </avue-crud>
- </basic-container>
- <upload-file ref="uploadFile" title="合同附件" :disabled="detailData.status == 1" :orderFilesList="orderFilesList"
- delUrl="" />
- </div>
- </div>
- </template>
- <script>
- import { optionList } from "./js/optionList";
- import { getDetail, submit, getStoragetree, getAllgoodstype, getLazylist,itemsubmit } from "@/api/basicData/agreement";
- export default {
- name: "index",
- data() {
- return {
- loadingBtn: false,
- form: {},
- dataList: [],
- option: {
- menuBtn: false,
- labelWidth: 130,
- column: [
- {
- label: "合同编号",
- prop: "contractNo",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 6,
- },
- {
- label: "制单部门",
- prop: "deptId",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- type: "select",
- dataType: "string",
- props: {
- label: "deptName",
- value: "id"
- },
- dicData: [],
- span: 6,
- },
- {
- label: "客户名称",
- prop: "corpId",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 6,
- },
- {
- label: "贸易方式",
- prop: "billType",
- type: "select",
- dataType: "string",
- props: {
- label: "dictValue",
- value: "dictKey"
- },
- dicData: [],
- multiple: true,
- span: 6,
- },
- {
- label: "有效期起",
- prop: "beginDate",
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd",
- span: 6,
- },
- {
- label: "有效期至",
- prop: "endDate",
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd",
- span: 6,
- },
- {
- label: "商品名称",
- prop: "goodsId",
- type: "select",
- dataType: "string",
- props: {
- label: "cname",
- value: "id"
- },
- dicData: [],
- multiple: true,
- span: 6,
- },
- {
- label: "仓库",
- prop: "warehouseId",
- type: "cascader",
- dataType: "string",
- dicData: [],
- props: {
- label: 'title',
- value: 'id'
- },
- multiple: true,
- span: 6,
- },
- {
- label: "状态",
- prop: "billStatus",
- type: "select",
- props: {
- label: "dictValue",
- value: "dictKey"
- },
- dicData: [],
- disabled: true,
- span: 6,
- },
- {
- label: "备注",
- prop: "remark",
- type: "textarea",
- minRows: 2,
- width: 120,
- span: 18,
- },
- ]
- },
- optionList: {},
- resultList: [],
- normTypeList: [],
- jobTitleList: [],
- jobLevelList: [],
- occupationalLevelList: [],
- maritalList: [],
- orderFilesList: [],
- storagetreeList: [],
- breakConfiguration: {
- multipleChoices: false,
- multiple: false,
- disabled: false,
- searchShow: true,
- collapseTags: false,
- clearable: true,
- placeholder: "请点击右边按钮选择",
- dicData: []
- },
- };
- },
- props: {
- detailData: {
- type: Object
- }
- },
- async created() {
- this.optionList = await this.getColumnData(
- this.getColumnName(193),
- optionList
- );
- if (this.detailData.id) {
- this.getDetail(this.detailData.id);
- }
- if (this.detailData.status == 1) {
- this.option.disabled = true;
- }
- this.getWorkDicts("result_type").then(res => {
- this.resultList = res.data.data;
- });
- this.getWorkDicts("trading_type").then(res => {
- this.findObject(this.option.column, "billType").dicData =
- res.data.data;
- });
- this.getWorkDicts("bill_status").then(res => {
- this.findObject(this.option.column, "billSdtatus").dicData = res.data.data;
- });
- getStoragetree().then(res => {
- this.findObject(this.option.column, "warehouseId").dicData = res.data.data;
- })
- getAllgoodstype().then(res => {
- this.findObject(this.option.column, "goodsId").dicData =
- res.data.data;
- })
- getLazylist().then(res => {
- this.findObject(this.option.column, "deptId").dicData =
- res.data.data;
- })
- this.getAllWorkDicts()
- },
- methods: {
- getAllWorkDicts() {
- this.getWorkDicts("unit").then(res => {
- this.findObject(this.optionList.column, "feeUnitId").dicData =
- res.data.data;
- });
- },
- cellStyle() {
- return "padding:0;height:40px;";
- },
- selectValue(value,row) {
- console.log(value,row)
- if(row.feeId){
- row.feeName=value.cname
- }else{
- row.feeName=""
- }
- },
- getDetail(id) {
- this.loadingBtn=true
- getDetail(id)
- .then(res => {
- // if (res.data.data.warehouseId) {
- // res.data.data.warehouseId = res.data.data.warehouseId.split(',')
- // }
- this.form = res.data.data;
- this.dataList = res.data.data.agreementitemsList;
- this.orderFilesList = res.data.data.orderFilesList
- })
- .finally(() => {
- // this.loading = false;
- // this.showBut = true;
- this.loadingBtn = false;
- });
- },
- getCorpData(row) {
- this.form.corpName = row.cname
- },
- addRow() {
- this.dataList.push({ $cellEdit: true });
- },
- // rowCell(row, index) {
- // if (row.$cellEdit == true) {
- // this.editCustomer();
- // this.$set(row, "$cellEdit", false);
- // } else {
- // this.$set(row, "$cellEdit", true);
- // }
- // },
- rowCell(row, index) {
- this.$refs.crud.rowCell(row, index)
- },
- rowSave(form, done) {
- done()
- this.itemsubmit(form)
- },
- addUpdate(form, index, done, loading) {
- done()
- this.itemsubmit(form)
- },
- itemsubmit(row){
- itemsubmit({
- pid:this.form.id,
- ...row
- }).then(res=>{
- this.$message.success("保存成功");
- })
- },
- rowDel(row, index) {
- this.$confirm("确定删除数据?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- if (row.id) {
- // delItem(row.id).then(res => {
- // this.$message({
- // type: "success",
- // message: "删除成功!"
- // });
- // this.dataList.splice(index, 1);
- // });
- } else {
- this.$message({
- type: "success",
- message: "删除成功!"
- });
- this.dataList.splice(index, 1);
- }
- });
- },
- //修改提交触发
- editCustomer() {
- this.$refs["form"].validate((valid, done) => {
- done();
- if (valid) {
- // if (this.form.warehouseId) {
- // this.form.warehouseId = this.form.warehouseId.join(',')
- // }
- this.loadingBtn = true;
- submit({ ...this.form, agreementitemsList: this.dataList })
- .then(res => {
- this.$message.success("保存成功");
- // if (res.data.data.data.warehouseId) {
- // res.data.data.data.warehouseId = res.data.data.data.warehouseId.split(',')
- // }
- console.log()
- this.form = res.data.data.data;
- this.dataList = res.data.data.data.agreementitemsList;
- this.orderFilesList = res.data.data.orderFilesList
- })
- .finally(() => {
- this.loadingBtn = false;
- });
- } else {
- return false;
- }
- });
- },
- async saveColumn() {
- const inSave = await this.saveColumnData(
- this.getColumnName(193),
- 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(193),
- 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");
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .trading-form ::v-deep .el-form-item {
- margin-bottom: 8px !important;
- }
- ::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;
- }
- </style>
|