haoxuan
2024-04-09 4bf10a1ba42ddaeab565c105b376c5732b0f3dab
src/views/systemSetting/workshopManage/components/silkTableList.vue
@@ -50,6 +50,13 @@
                  </div>
                </div>
                <span v-else>{{ item.label }}</span>
                <span v-if="item.iconRight">
                  <i
                    @click="settingClick(item)"
                    :class="item.iconRight"
                    style="font-size: 16px ;color:#5582F3; margin-left: 5px; cursor: pointer"
                  ></i>
                </span>
              </template>
              <!-- column样式 -->
              <template slot-scope="scope">
@@ -73,17 +80,37 @@
                    ></el-input>
                  </el-form-item>
                  <el-form-item
                    v-else-if="item.projectName"
                    v-else-if="item.workshop"
                    label=" "
                    :prop="'tableData.' + scope.$index + '.' + item.prop"
                  >
                    <div class="custom-name">
                      <el-select v-model="scope.row[item.prop]" clearable size="mini" placeholder="请选择">
                        <el-option
                          v-for="(item, index) in projectOptions"
                          v-for="(item, index) in workshopList"
                          :key="index"
                          :label="item.value"
                          :value="item.value"
                          :label="item.name"
                          :value="item.ID"
                        >
                        </el-option>
                      </el-select>
                      <div class="common-select-btn" @click="clearupClient(scope)">
                        <i class="el-icon-remove" title="删除"></i>
                      </div>
                    </div>
                  </el-form-item>
                  <el-form-item
                    v-else-if="item.carFlag"
                    label=" "
                    :prop="'tableData.' + scope.$index + '.' + item.prop"
                  >
                    <div class="custom-name">
                      <el-select v-model="scope.row[item.prop]" clearable size="mini" placeholder="请选择">
                        <el-option
                          v-for="(item, index) in carFlagList"
                          :key="index"
                          :label="item.name"
                          :value="item.id"
                        >
                        </el-option>
                      </el-select>
@@ -123,7 +150,6 @@
                      v-model="scope.row[item.prop]"
                      placeholder=""
                      :min="0"
                      :precision="4"
                      :disabled="!isOperate"
                      :controls="false"
                      size="mini"
@@ -135,6 +161,25 @@
                      "
                    ></el-input-number>
                  </el-form-item>
                  <el-form-item
                    v-else-if="item.showInput"
                    label=" "
                    :prop="'tableData.' + scope.$index + '.' + item.prop"
                    :rules="[{ required: item.isRequird ? true : false, message: '输入不能为空' }]"
                  >
                    <el-input
                      v-model="scope.row[item.prop]"
                      placeholder=""
                      size="mini"
                      style="width: 100%; margin-right: 5px"
                    ></el-input>
                  </el-form-item>
                  <!-- 调用方法显示文字 -->
                  <div v-else-if="item.isCallMethod">
                    <span :class="item.isClass ? item.getClassName(scope.row[item.prop], scope.row) : ''">{{
                      item.getCallMethod(scope.row[item.prop], scope.row)
                    }}</span>
                  </div>
                  <span v-else>
                    <template>
                      {{ scope.row[item.prop] }}
@@ -161,7 +206,14 @@
                      }
                    "
                  ></el-input-number>
                </el-form-item>
                <!-- 调用方法显示文字 -->
                <div v-else-if="item.isCallMethod">
                  <span :class="item.isClass ? item.getClassName(scope.row[item.prop], scope.row) : ''">{{
                    item.getCallMethod(scope.row[item.prop], scope.row)
                  }}</span>
                </div>
                <span v-else style="text-align: right">{{ scope.row[item.prop] }}</span>
              </template>
            </el-table-column>
@@ -177,14 +229,14 @@
          </el-table>
        </el-form>
      </div>
      <div
      <!-- <div
        v-if="detailEnter"
        class="add-column-box"
        @click="addColumnClick"
        :style="{ width: detailEnter ? '40px' : '0px' }"
      >
        <i class="el-icon-circle-plus"></i>
      </div>
      </div> -->
    </div>
    <div v-if="detailEnter" style="margin: 10px">
      <div class="add-btn-box" @click="addRowClick">
@@ -198,6 +250,7 @@
<script>
// import { getProductList } from "@/api/common/other"
import {getDict } from "@/api/systemSetting/dataDictionary"
export default {
  name: "CommmonFormTableView",
  components: {},
@@ -256,7 +309,18 @@
        { id: 3, value: "清洁分" },
        { id: 4, value: "洁净分" },
        { id: 5, value: "最大偏差" }
      ]
      ],
      workshopList:[],// 车间列表
      carFlagList:[
        {name:"左半车",id:1},
        {name:"右半车",id:2},
        {name:"全车结束",id:3},
      ],//半车标志
      getDataParams:{
        page: 1,
        pageSize:10,
        dictType:1,
      },
    }
  },
  created() {
@@ -264,6 +328,7 @@
    //   this.getProductList()
    // }
    this.getTableInfo()
    this.getWorkshopList()
  },
  watch: {
    silkTableList: {
@@ -275,6 +340,10 @@
  },
  computed: {},
  methods: {
  // 自定义表头点击事件
    settingClick(item) {
      this.$emit("settingClick", item);
    },
    getTableInfo() {
      this.tableList = this.silkTableList
      if (this.tableList.tableData.length === 1 && this.tableList.tableData[0].name === "") {
@@ -322,6 +391,16 @@
    clearupColumn(prop) {
      console.log(prop)
      this.$emit("clearupColumn", prop)
    },
    async getWorkshopList(){
      await getDict({
        dictType:this.getDataParams.dictType,
        page:this.getDataParams.page,
        pageSize:this.getDataParams.pageSize,
      }).then((res)=>{
        console.log(res,"res")
        this.workshopList=res.data
      })
    }
  },
  //解决表格抖动问题
@@ -329,7 +408,7 @@
    this.$nextTick(() => {
      this.$refs["fromTable"].doLayout()
    })
  }
  },
}
</script>