123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365 |
- <template>
- <div class="mis-pageBox">
- <!-- 主页 -->
- <el-container>
- <el-header height="40px">
- <el-row>
- <el-col :span="18">
- <el-input
- v-model="queryParams.searchText"
- size="small"
- style="width: 300px"
- placeholder="输入关键字"
- clearable
- @keyup.enter.native="clickQuery()"
- />
- <el-button
- type="primary"
- size="small"
- icon="el-icon-search"
- @click="clickQuery()"
- >查询</el-button
- >
- </el-col>
- <el-col :span="6" class="list-opCol">
- <el-button
- type="primary"
- size="small"
- icon="el-icon-plus"
- @click="clickAdd()"
- >添加</el-button
- >
- <el-button
- type="primary"
- size="small"
- icon="el-icon-edit"
- @click="clickModify()"
- :disabled="disabledModify"
- >修改</el-button
- >
- <el-button
- type="danger"
- size="small"
- icon="el-icon-delete"
- @click="clickDelete()"
- :disabled="disabledDelete"
- >删除</el-button
- >
- </el-col>
- </el-row>
- </el-header>
- <el-main>
- <tfTable
- :table-data="dataList"
- :column="columns"
- :for-id="false"
- :pagination="false"
- :currentpage="pageInfo.current"
- :pagesize="pageInfo.size"
- :total="pageInfo.tableTotal"
- :border="true"
- :multiple="true"
- :fixed="true"
- :isdelete="false"
- :is-select="false"
- :stripe="true"
- @handleCurrentChange="handleCurrentChange"
- @handleSizeChange="handleSizeChange"
- @handleSelectionChange="handleSelectionChange"
- @rowDblclick="showDetail"
- @detail="showDetail"
- />
- </el-main>
- </el-container>
- <!-- 详情页 -->
- <el-dialog
- v-if="dialogVisible"
- v-dialogDrag
- top="20vh"
- :title="dialogTitle"
- :visible.sync="dialogVisible"
- width="800px"
- class="dialog"
- >
- <tfDetail :detailData="detailData" :editState="editState" ref="dForm" />
- <template slot="footer">
- <el-button
- type="warning"
- icon="el-icon-check"
- @click="clickSave()"
- v-if="!editState"
- >确 定</el-button
- >
- <el-button type="warning" icon="el-icon-close" @click="clickCancel()"
- >关 闭</el-button
- >
- </template>
- </el-dialog>
- </div>
- </template>
- <script>
- import "@/views/mis/common/assets/styles/misStyle.scss";
- import { DateHelper } from "@/views/mis/common/assets/scripts/utils.js";
- import { chargingUnit } from "@/views/mis/common/api/codingManagement.js";
- import tfTable from "@/views/mis/common/misTable/index.vue";
- import tfDetail from "./chargingUnit-form.vue";
- export default {
- components: { tfTable, tfDetail },
- props: ["data"],
- data() {
- return {
-
- queryParams: {
- searchText: "",
- },
- disabledModify: true,
- disabledDelete: true,
- editType: true,
- loading: false,
- pageInfo: {
- current: 1,
- size: 10,
- tableTotal: 1,
- "orders[0].asc": "true",
- "orders[0].column": "gsbm",
- },
- columns: [
- {
- label: "代收公司编码",
- prop: "gsbm",
- align: "center",
- sortable: true,
- },
- {
- label: "代收公司名称",
- prop: "gsmc",
- align: "center",
- },
- {
- label: "公司地址",
- prop: "gsdz",
- align: "center",
- },
- {
- label: "联系电话",
- prop: "lxdh",
- align: "center",
- },
- {
- label: "是否启用",
- prop: "disabled",
- align: "center",
- formatter: function (row, column, cellValue, index) {
- return cellValue == 1 ? "是" : "否";
- },
- },
- {
- label: "操作人员",
- prop: "czryxm",
- align: "center",
- },
- {
- label: "操作时间",
- prop: "czsj",
- align: "center",
- sortable: true,
- },
- ],
- dataList: [],
- selectionsData: [],
- selectedRow: {},
-
- dialogTitle: "新增",
- editState: false,
- dialogVisible: false,
- detailData: {
- gsbm: undefined,
- gsmc: undefined,
- gsdz:undefined,
- lxdh:undefined,
- czsj: undefined,
- disabled: undefined,
- czryxm: undefined,
- },
- };
- },
- watch: {
- selectionsData(value) {
- this.disabledModify = this.selectionsData.length !== 1;
- this.disabledDelete = this.selectionsData.length == 0;
- },
- dialogVisible(newVal, oldVal) {
- if (!newVal) {
- this.resetDetailData();
- }
- },
- },
- created() {},
- mounted() {
- this.bindList();
- },
- methods: {
-
-
- bindList() {
-
- let params = Object.assign({}, this.pageInfo, this.queryParams);
- this.dataList = [];
- this.loading = true;
- chargingUnit.query(params)
- .then((res) => {
- if (res.code !== 1) {
- this.$message.error("查询失败!");
- return;
- }
-
- this.pageInfo.tableTotal = res.result.total;
- this.dataList = res.result.records;
- })
- .catch((ex) => {
- this.$message.error("查询失败!");
- })
- .finally(() => {
- this.loading = false;
- });
- },
- resetDetailData() {
-
- for (var key in this.detailData) {
-
- this.detailData[key] = undefined;
- }
- },
- add() {
- let params = Object.assign({}, this.detailData);
- params.czry = this.$store.state.user.userId;
- params.czryxm = this.$store.state.user.realName;
- chargingUnit.add(params).then((res) => {
- if (res.code == 1) {
- this.bindList();
- this.$message.success("添加成功!");
- this.dialogVisible = false;
- }
- });
- },
- modify() {
- let params = Object.assign({}, this.detailData);
- params.czry = this.$store.state.user.userId;
- params.czryxm = this.$store.state.user.realName;
- params.czsj = DateHelper.getNowFormatDate(true);
- chargingUnit.modify(params).then((res) => {
- if (res.code == 1) {
- this.bindList();
- this.$message.success("修改成功!");
- this.dialogVisible = false;
- }
- });
- },
- delete() {
- const ids = this.selectionsData.map((item) => {
- return item.code;
- });
- chargingUnit.delete({ ids: ids.join(",") }).then((res) => {
- if (res.code == 1) {
- this.bindList();
- this.$message.success("删除成功!");
- }
- });
- },
-
- showDetail(data) {
- this.selectedRow = data;
- this.detailData = Object.assign({}, this.selectedRow);
- this.dialogTitle = "查看";
- this.editState = true;
- this.dialogVisible = true;
- },
-
-
- clickQuery() {
- this.pageInfo.current = 1;
- this.bindList();
- },
-
- clickAdd() {
- this.detailData.czryxm = this.$store.state.user.realName;
- this.detailData.czsj = DateHelper.getNowFormatDate(true);
- this.editType = true;
- this.dialogTitle = "添加";
- this.editState = false;
- this.dialogVisible = true;
- },
-
- clickModify() {
- this.selectedRow = this.selectionsData[0];
- this.detailData = Object.assign({}, this.selectedRow);
- this.editType = false;
- this.dialogTitle = "修改";
- this.editState = false;
- this.dialogVisible = true;
- },
-
- clickDelete() {
- this.$confirm("确定删除?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- this.delete();
- });
- },
- clickCancel() {
- this.dialogVisible = false;
- },
- clickSave() {
- let flag = this.$refs.dForm.validate();
- if (flag) {
- if (this.editType) this.add();
- else this.modify();
- }
- },
-
-
- handleCurrentChange(current) {
- this.pageInfo.current = current;
- this.bindList();
- },
-
- handleSizeChange(size) {
- this.pageInfo.size = size;
- this.bindList();
- },
-
- handleSelectionChange(rows) {
- this.selectionsData = rows;
- },
- },
- };
- </script>
|