123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- <template>
- <div>
- <div class="mt20">
- <el-button type="primary" @click="addData">添加</el-button>
- <el-button
- type="danger"
- @click="delData"
- :disabled="multipleSelection.length == 0"
- >删除</el-button
- >
- </div>
- <el-table
- :data="tableData"
- tooltip-effect="dark"
- v-loading="loading"
- ref="multipleTable"
- @selection-change="handleSelectionChange"
- class="mt20"
- style="width: 100%"
- >
- <el-table-column type="selection" align="center" width="55">
- </el-table-column>
- <el-table-column label="检查项目" prop="xdww_name"> </el-table-column>
- <el-table-column label="操作">
- <template slot-scope="scope">
- <el-button type="text" @click="editData(scope.row)">编辑 </el-button>
- <el-button type="text" @click="pfxData(scope.row.xdww_id)"
- >评分项
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <footer
- class="flex-item-none"
- style="display: flex; justify-content: flex-end; margin-top: 30px"
- >
- <el-pagination
- background
- layout="total,prev, pager, next"
- :page-size="limit"
- :total="total"
- :current-page.sync="cur_page"
- @current-change="handleCurrentChange"
- ></el-pagination>
- </footer>
- <el-dialog
- :title="title"
- :visible.sync="dialogFormVisible"
- append-to-body
- width="580px"
- >
- <el-form
- :inline="true"
- :model="dialogForm"
- ref="dialogForm"
- :rules="rules"
- label-width="120px"
- >
- <h4 class="mb20 ml30 font-size-14" style="color: #265cd4">
- 每个班级总分为100分(卫生50分+常规50分)
- </h4>
- <el-form-item class="mr75" label="检查项目名称" prop="wdmc">
- <el-input
- placeholder="请输入检查项目名称"
- v-model="dialogForm.wdmc"
- ></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="text-center">
- <el-button @click="formCancel">取 消</el-button>
- <el-button :disabled="isButton" type="primary" @click="formSubmit('dialogForm')"
- >确 定</el-button
- >
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { wdsz_list, wdsz_add, wdsz_edit, wdsz_del } from "./api";
- export default {
- name: "index",
- data() {
- return {
- limit: 10,
- total: 12,
- cur_page: 1,
- keyword: "",
- tableData: [],
- title: "",
- id: "",
- loading: false,
- isEdit: false,
- dialogFormVisible: false,
- dialogForm: {
- wdmc: "",
- },
- rules: {
- wdmc: [{ required: true, message: "请输入维度名称", trigger: "blur" }],
- },
- multipleSelection: [],
- isButton: false,
- };
- },
- methods: {
- handleCurrentChange(val) {
- this.cur_page = val;
- this.getListData();
- },
- getListData() {
- this.loading = true;
- let data = {
- page: this.cur_page,
- limit: this.limit,
- keyword: this.keyword,
- xdbs_jclx: "1",
- };
- wdsz_list(data).then((res) => {
- this.loading = false;
- this.tableData = res.data.page_data;
- this.cur_page = Number(res.data.page_now);
- this.total = Number(res.data.total_rows);
- });
- },
- addData() {
- this.isButton = false;
- this.title = "添加";
- this.dialogForm = {
- wdmc: "",
- };
- this.isEdit = false;
- this.dialogFormVisible = true;
- },
- editData(item) {
- this.isButton = false;
- this.title = "编辑信息";
- this.isEdit = true;
- this.dialogFormVisible = true;
- this.id = item.xdww_id;
- this.dialogForm.wdmc = item.xdww_name;
- },
- formSubmit(formName) {
- this.$refs[formName].validate((valid) => {
- if (valid) {
- this.isButton = true;
- let data = {
- xdww_name: this.dialogForm.wdmc,
- xdbs_jclx: "1",
- };
- if (!this.isEdit) {
- wdsz_add(data).then((res) => {
- if (res.code == 1) {
- this.$message({
- message: "信息添加成功!",
- type: "success",
- });
- this.isButton = true;
- this.dialogFormVisible = false;
- this.getListData();
- } else {
- this.$message({
- message: res.msg,
- type: "error",
- });
- }
- });
- } else {
- data.xdww_id = this.id;
- wdsz_edit(data).then((res) => {
- if (res.code == 1) {
- this.$message({
- message: "信息编辑成功!",
- type: "success",
- });
- this.dialogFormVisible = false;
- this.getListData();
- } else {
- this.$message({
- message: res.msg,
- type: "error",
- });
- }
- });
- }
- }
- else {
- this.isButton = false
- }
- });
- },
- formCancel() {
- this.dialogFormVisible = false;
- },
- delData() {
- this.$confirm("确认删除这些信息?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- let data = {
- xdww_id: this.multipleSelection,
- };
- wdsz_del(data).then((res) => {
- if (res.code == 1) {
- this.$message({
- message: "信息删除成功!",
- type: "success",
- });
- this.getListData();
- } else {
- this.$message({
- message: res.msg,
- type: "error",
- });
- }
- });
- })
- .catch(() => {});
- },
- handleSelectionChange(val) {
- this.multipleSelection = [];
- for (let i in val) {
- this.multipleSelection.push(val[i].xdww_id);
- }
- },
- pfxData(id) {
- this.$router.push({ name: "wypj_wdsz_wdpfx", params: { id: id } });
- },
- },
- mounted() {
- this.getListData();
- },
- };
- </script>
- <style scoped></style>;
|