SignList.vue 6.18 KB
Newer Older
fukai committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
<template>
  <div class="eibs-tab">
    <c-col :span="12">
      <el-form-item label="渠道名称" prop="fromflg">
        <c-select v-model="sinConditon.fromflg" style="width: 100%" placeholder="请选择渠道名称" dbCode="FRMFLG"> </c-select>
      </el-form-item>
    </c-col>
    <c-col :span="12">
      <el-form-item label="签约状态" prop="sinsta">
        <c-select v-model="sinConditon.sinsta" style="width: 100%" placeholder="请选择签约状态" dbCode="SINSTA"> </c-select>
      </el-form-item>
    </c-col>
    <c-col :span="24">
      <c-col :span="12" style="text-align: left">
        <el-button type="primary" size="small" @click="signAdd" :disabled="isPageDisabled">新增</el-button>
      </c-col>
      <c-col :span="12" style="text-align: right">
        <el-button size="small" @click="handleReset">重置</el-button>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="small"
          @click="onSearch()"
          >查询
        </el-button>
      </c-col>
    </c-col>
    <c-col :span="24">
      <c-table :list="sinList" :columnsConfig="columns">
        <c-table-column fixed="right" prop="op" label="操作" width="200px">
          <template slot-scope="{ scope }">
            <c-button
              style="margin-left: 5px"
              size="small"
              type="primary"
              :disabled="isPageDisabled"
              @click="signEdit(scope.$index, scope.row)"
            >
              修改
            </c-button>
          </template>
        </c-table-column>
      </c-table>
    </c-col>
    <el-dialog
      :title="
        '签约信息:' +
        (operate === 'details' ? '详情' : operate === 'edit' ? '修改' : '新增')
      "
      :visible.sync="signDialog"
      top="10vh"
      width="80%"
      :destroy-on-close="true"
      :before-close="handleClose"
    >
      <m-sign-info ref="signInfo" :signInfo="signInfo" :operate="operate"></m-sign-info>
      <span slot="footer" class="dialog-footer">
        <button
          class="el-button el-button--default el-button--small"
          style="margin-left: 0"
          size="small"
          :disabled="false"
          @click.prevent="cancel"
        >
          <span>取 消</span>
        </button>
        <c-button type="primary" @click="editSignInf" v-if="operate === 'edit'"
          >保 存</c-button
        >
        <c-button type="primary" @click="saveSignInf" v-if="operate === 'add'"
          >保 存</c-button
        >
      </span>
    </el-dialog>
  </div>
</template>

<script>
import codes from "~/config/CodeTable";
import { querySignList, addSign, editSign, querySignInfo } from "~/service/manage/sin.js";
import Sign from "./Signjs/Sign.js"
import SignInfo from "./SignInfo.vue";

export default {
  inject: ["root"],
  props: ['model','type'],
  data() {
    return {
      sign: null,
      signDialog: false,
      sinConditon: {
        fromflg: "",
        sinsta: "",
        ptyinr: "",
      },
      operate: "",
      sinList: [],
      signInfo: null,
      operateIdx: 0,
      columns: [
        { label: "渠道名称", prop: "fromflg", width: "auto" },
        { label: "客户编号", prop: "ptyextkey", width: "auto" },
        { label: "客户名称", prop: "ptynam", width: "auto" },
        { label: "统一社会信用代码", prop: "ptyidcode", width: "auto" },
        { label: "客户所属机构", prop: "branch", width: "auto" },
        { label: "签约状态", prop: "sinsta", width: "auto" },
        { label: "签约时间", prop: "sintime", width: "auto" },
        { label: "是否接受通知", prop: "ntfsta", width: "auto" },
        { label: "备注", prop: "remark", width: "auto" },
      ],
    };
  },
  components: {
    "m-sign-info": SignInfo
  },

  computed: {
    isPageDisabled() {
      if (this.type=="info") {
        return true
      }else if (this.type=="edit"){
        if  (this.$route.query.maaFlg != "Y" && this.$route.query.zFlg != "Y"){
          return true
        }
      }else if (this.type=="add"){
        return false
      }
      return false
    },
  },

  created() {
      
  },
  methods: {
    init() {
      const ptyinr = this.$route.query.inr;
      querySignList({"ptyinr": ptyinr}).then((res)=> {
        if (res.respCode == "AAAAAA") {
          this.$set(this, "sinList", res.data)
        } else {
          this.$notify.error("客户不存在")
        }
      });
    },
    getCodesByKey(key) {
      return codes[key] || [];
    },
    onSearch() {
      this.sinConditon.ptyinr = this.$route.query.inr
      querySignList(this.sinConditon).then((res) => {
        if (res.respCode == SUCCESS) {
          this.sinList = res.data
        }
      })
    },
    signAdd() {
      var signInfo = new Sign().data;
      signInfo.ptyextkey = this.model.extkey
      signInfo.nam = this.model.nam
      this.signInfo = signInfo
      this.operate = "add";
      this.signDialog = true;
    },
    signEdit(index, row) {
      querySignInfo(row).then((res) => {
        if (res.respCode == "AAAAAA") {
          this.signInfo = res.data
          this.signInfo.ptyextkey = this.model.extkey
          this.signInfo.nam = this.model.nam
        }
      })
      this.operate = "edit";
      this.operateIdx = index;
      this.signDialog = true;
    },
    cancel() {
      this.handleClose();
    },
    editSignInf() {
      this.signInfo.ptyextkey = this.model.extkey
      this.signInfo.ptynam = this.model.nam
      console.log(this.signInfo)
      editSign(this.signInfo).then((res) => {
        if(res.respCode == "AAAAAA") {
          this.$notify.success("修改成功!")
          this.handleClose();
          this.onSearch();
        }
      })
    },
    saveSignInf() {
      this.signInfo.ptyextkey = this.model.extkey
      this.signInfo.ptynam = this.model.nam
      addSign(this.signInfo).then((res) => {
        if (res.respCode == "AAAAAA") {
          this.$notify.success("新建成功!")
          this.handleClose();
          this.onSearch();
        }
      })
    },
    handleClose(done) {
      this.signDialog = false;
      if (done && typeof done === "function") {
        done();
      }
    },
    handleReset() {
      this.sinConditon = new Sign().data
    },
  }
};
</script>

<style>
</style>