lyfO_o
2022-03-31 4a6b6d253451a14063df0659877f3d8c4ca921a5
src/views/safetyproduction/reviewXG.vue
@@ -9,7 +9,7 @@
              <el-col :span="11">
                <el-form-item label="A级要素">
                  <el-select
                    v-model="formInline.region"
                    v-model="form.elementAName"
                    :disabled="true"
                    style="width: 100%"
                  >
@@ -21,7 +21,7 @@
              <el-col :span="11" :offset="2" style="white-space: nowrap">
                <el-form-item label="B级要素">
                  <el-select
                    v-model="formInline.region"
                    v-model="form.elementBName"
                    :disabled="true"
                    style="width: 100%"
                  >
@@ -37,7 +37,7 @@
                  <el-input
                    :rows="3"
                    type="textarea"
                    v-model="form.name"
                    v-model="form.standardizationRequirements"
                    placeholder=""
                  ></el-input>
                </el-form-item>
@@ -49,7 +49,7 @@
                  <el-input
                    type="textarea"
                    :rows="3"
                    v-model="form.name"
                    v-model="form.enterpriseStandard"
                    placeholder=""
                  ></el-input>
                </el-form-item>
@@ -61,7 +61,7 @@
                  <el-input
                    type="textarea"
                    :rows="3"
                    v-model="form.name"
                    v-model="form.reviewMethod"
                    placeholder=""
                  ></el-input>
                </el-form-item>
@@ -76,7 +76,7 @@
                  <el-input
                    type="textarea"
                    :rows="3"
                    v-model="form.name"
                    v-model="form.veto"
                    placeholder=""
                  ></el-input>
                </el-form-item>
@@ -90,7 +90,12 @@
                >
              </el-col>
              <el-col :span="12" style="text-align: right">
              <el-button type="primary" @click="dialogVisible=true" class="btns" size="mini" icon="el-icon-plus"
                <el-button
                  type="primary"
                  @click="coAdd('', '新增')"
                  class="btns"
                  size="mini"
                  icon="el-icon-plus"
                >新增</el-button
              >
            </el-col>
@@ -98,12 +103,12 @@
            <el-row>
              <el-col :span="22" :offset="2">
                <el-table
                  :data="tableData"
                  :data="form.deductionList"
                  border
                  style="width: 99%; margin-left: 1%"
                >
                  <el-table-column
                    prop="date"
                    type="index"
                    align="center"
                    label="序号"
                    width="150"
@@ -117,12 +122,16 @@
                  <el-table-column align="center" label="操作" width="200px">
                  <template slot-scope="scope">
                    <el-button
                      @click="handleClick(scope.row)"
                        @click="coAdd(scope.row, '编辑')"
                      type="text"
                      size="small"
                      >编辑</el-button
                    >
                    <el-button type="text" size="small" style="color: red"
                      <el-button
                        type="text"
                        size="small"
                        style="color: red"
                        @click="listDel(scope.row)"
                      >删除</el-button
                    >
                  </template>
@@ -133,24 +142,25 @@
          </div>
          <el-row>
            <el-col :span="24" style="padding: 20px 0; text-align: center">
              <el-button type="primary" class="btns">提交</el-button>
              <el-button>取消</el-button>
              <el-button type="primary" @click="safetyInspectionItemA()" class="btns">提交</el-button>
              <el-button @click="back()">取消</el-button>
            </el-col>
          </el-row>
        </el-form>
      </div>
    </div>
    <el-dialog title="扣分详情" :visible.sync="dialogVisible" width="30%">
      <el-form ref="form" :model="form" label-width="54px">
    <el-dialog title="扣分详情" :visible.sync="dialogVisible" :close-on-click-modal="false" width="30%">
      <el-form ref="form" :model="formInline" label-width="54px">
        <el-form-item label="说明">
          <el-input v-model="form.name"></el-input>
        </el-form-item>
        <el-form-item label="扣分值">
          <el-input v-model="form.name"></el-input>
          <el-input v-model="formInline.name"></el-input>
        </el-form-item>
        <el-form-item label="备注">
          <el-input v-model="form.name" :rows="5" type="textarea"></el-input>
          <el-input
            v-model="formInline.remark"
            :rows="5"
            type="textarea"
          ></el-input>
        </el-form-item>
      </el-form>
      <span
@@ -158,7 +168,7 @@
        class="dialog-footer"
        style="text-align: center; display: block"
      >
        <el-button type="primary" class="btns" @click="dialogVisible = false"
        <el-button type="primary" class="btns" @click="listAdd"
          >确 定</el-button
        >
        <el-button @click="dialogVisible = false">取 消</el-button>
@@ -168,63 +178,93 @@
</template>
<script>
import Titlename from "../../components/Titlename/index.vue";
import { safetyInspectionItemId } from "@/api/safetySelfInspection.js";
import { safetyInspectionItemMod } from "@/api/safetyInspectionItem.js";
export default {
  components: { Titlename },
  data() {
    return {
      dialogVisible: false,
      id: "",
      resource: "0",
      form: {
        name: "",
      },
      form: {},
      formInline: {
        user: "",
        region: "",
      },
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1518 弄",
          zip: 200333,
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1517 弄",
          zip: 200333,
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1519 弄",
          zip: 200333,
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1516 弄",
          zip: 200333,
        },
      ],
      defaultProps: {
        children: "children",
        label: "label",
        name: "",
        remark: "",
      },
    };
  },
  created(){
  console.log(this.$route.query.id)
    this.id = this.$route.query.id;
    console.log('tagee',this.$route.query)
    this.safeT(this.id);
  },
  methods: {
    safeT(id) {
      safetyInspectionItemId({ id: id }).then((res) => {
        if (res.data.code == 200) {
          this.form = res.data.result;
        }
      });
    },
    coAdd(val, type) {
      this.titleN = type;
      if (type == "新增") {
        this.dialogVisible = true;
        this.formInline = {
          name: "",
          remark: "",
        };
      } else {
        this.dialogVisible = true;
        this.index = this.form.deductionList.findIndex(
          (item) => item.name == val.name
        );
        this.formInline = val;
      }
    },
    listAdd() {
      if (this.titleN == "新增") {
        this.form.deductionList.push(this.formInline);
        this.dialogVisible = false;
      } else {
        this.form.deductionList[this.index].name = this.formInline.name;
        this.form.deductionList[this.index].space = this.formInline.space;
        this.dialogVisible = false;
      }
    },
    listDel(val) {
      var i = this.form.deductionList.findIndex(
        (item) => item.name == val.name
      );
      this.form.deductionList.splice(i, 1);
    },
       safetyInspectionItemA() {
        safetyInspectionItemMod(this.form).then((res) => {
          console.log(res)
          if (res.data.code == 200) {
            this.$notify({
              type: "success",
              duration: 2000,
              message: "修改成功",
              title: "成功",
            });
            this.$router.push({
              path:"/new"
            })
          } else {
            this.$message({
              type: "warning",
              message: res.data.message,
            });
          }
        });
    },
    back(){
       this.$router.push({
              path:"/new"
            })
    },
    handleClick() {
      this.dialogVisible = true;
    },