xiangpei
2024-07-19 4e4e3042f9240816d49332f19ca85a68cb89c2e4
src/views/system/work-order/distribute/index.vue
@@ -64,8 +64,8 @@
          </el-form>
          <el-button slot="reference" type="primary" size="small">快捷下发</el-button>
        </el-popover>
        <el-button size="small" type="primary" @click="page">刷新</el-button>
        <el-button size="small" type="primary" @click="handleAdd">新增</el-button>
        <el-button size="small" type="success" @click="handleAdd">手动新增工单</el-button>
        <el-button icon="el-icon-refresh" circle @click="page"></el-button>
      </el-col>
    </el-row>
@@ -112,6 +112,7 @@
            reserve-keyword
            placeholder="请选择来源"
            :remote-method="remoteGetPoints"
            @change="setPointId"
            :loading="selectLoading">
            <el-option
              v-for="item in pointList"
@@ -146,6 +147,10 @@
  name: 'index',
  data() {
    return {
      selectedIdsDistributeForm: {
        ids: [],
        unitId: null
      },
      unitList: [],
      settingForm: {
        // 离线
@@ -197,7 +202,7 @@
      queryParams: {
        unitId: null,
        pageNum: 1,
        pageSize: 20,
        pageSize: 10,
      },
      // 总条数
      total: 0,
@@ -243,6 +248,10 @@
    },
  },
  methods: {
    setPointId(selectedValue) {
      const selectedItem = this.pointList.find(item => item.value === selectedValue);
      this.form.pointId = selectedItem.id
    },
    submitSetting() {
      this.$refs['settingForm'].validate((valid) => {
        if (valid) {
@@ -257,7 +266,7 @@
      this.loading = true;
      this.selectUnit();
      distributeWorkOrder(this.queryParams).then(res => {
        this.workOrderList = res.data;
        this.workOrderList = res.data.records;
        this.total = res.total;
        this.loading = false;
      })
@@ -278,7 +287,8 @@
    },
    // 全部下发
    allDistribute() {
      selectedIdsDistribute([], this.unitId).then(res => {
      this.selectedIdsDistributeForm.unitId = this.unitId
      selectedIdsDistribute(this.selectedIdsDistributeForm).then(res => {
        this.$message.success("工单下发成功")
        this.page();
      })
@@ -296,16 +306,19 @@
            this.page();
          })
        }
      })
      })
    },
    // 选中工单下发
    selectedDistribute() {
      if (this.multipleSelection.length < 1) {
        this.$message.warning("请先选择要下发的工单")
        return
      }
      selectedIdsDistribute(this.multipleSelection, this.unitId).then(res => {
      }
      this.selectedIdsDistributeForm.unitId = this.unitId;
      this.selectedIdsDistributeForm.ids = this.multipleSelection;
      selectedIdsDistribute(this.selectedIdsDistributeForm).then(res => {
        this.$message.success("工单下发成功")
        this.selectedIdsDistributeForm.ids = [];
        this.page();
      })
    },