| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275 | <template>  <div>    <save-form      :inline="true"      :model="searchForm"      ref="searchForm"      @submit="search"      @reset="onReSet"      saveKey="/main/main/teamSchedule"    >      <el-form-item prop="organIds">        <el-select          class="multiple"          v-model.trim="searchForm.organIds"          filterable          placeholder="请选择分部"        >          <el-option            v-for="(item, index) in selects.branchs"            :key="index"            :label="item.name"            :value="item.id"          ></el-option>        </el-select>      </el-form-item>      <el-form-item prop="userId">        <remote-search :commit="'setEducations'" v-model="searchForm.userId" />      </el-form-item>      <el-form-item prop="month">        <el-date-picker          v-model="searchForm.month"          value-format="yyyy-MM"          type="monthrange"          start-placeholder="开始周期"          end-placeholder="结束周期"          style="width: 220px;"        >        </el-date-picker>      </el-form-item>      <el-form-item>        <el-button native-type="submit" type="primary">搜索</el-button>        <el-button native-type="reset" type="danger">重置</el-button>      </el-form-item>    </save-form>    <el-table      style="width: 100%"      :header-cell-style="{ background: '#EDEEF0', color: '#444' }"      :data="tableList"    >      <el-table-column align="center" prop="organName" label="分部">        <template slot-scope="scope">          <div>            <copy-text>{{ scope.row.organName }}</copy-text>          </div>        </template>      </el-table-column>      <el-table-column align="center" prop="month" label="工作周期">        <template slot-scope="scope">          <div>            {{ scope.row.month | dayjsFormatWeek }}          </div>        </template>      </el-table-column>      <el-table-column align="center" prop="userName" label="乐团主管">        <template slot-scope="scope">          <div>            <copy-text>{{ scope.row.userName }}</copy-text>          </div>        </template>      </el-table-column>      <el-table-column align="center" prop="item" label="任务事项">        <template slot-scope="scope">          <div>            {{ scope.row.item | inspectionItemFormat }}          </div>        </template>      </el-table-column>      <el-table-column        align="center"        prop="times"        label="任务次数"      ></el-table-column>      <el-table-column        align="center"        prop="plannedTimes"        label="已安排日程次数"      ></el-table-column>      <el-table-column        align="center"        prop="submittedTimes"        label="已提交任务数"      >        <template slot-scope="scope">          <div            :style="              scope.row.times > scope.row.submittedTimes ? 'color:red' : ''            "          >            {{ scope.row.submittedTimes }}          </div>        </template>      </el-table-column>      <el-table-column align="center" prop="memo" label="处理意见" width="220">        <template slot-scope="scope">          <overflow-text :text="scope.row.memo"></overflow-text>        </template>      </el-table-column>      <el-table-column align="center" prop="studentId" label="操作">        <template slot-scope="scope">          <div>            <auth v-if="scope.row.item == 'INSPECT'" auths="/teamSchedule/scheduleDetail">              <el-button type="text" @click="gotoHander(scope.row)"                >安排日程</el-button              >            </auth>            <auth v-else  auths="/returnVisitList">            <el-button type="text"  @click="gotoHander(scope.row)"              >回访记录</el-button            >            </auth>            <auth :auths="['inspectionItem/update']">              <el-button                type="text"                :disabled="scope.row.times < scope.row.submittedTimes"                @click="resetLine(scope.row)"                >立即处理</el-button              >            </auth>          </div>        </template>      </el-table-column>    </el-table>    <pagination      sync      :total.sync="rules.total"      save-key="teamSchedule"      :page.sync="rules.page"      :limit.sync="rules.limit"      :page-sizes="rules.page_size"      @pagination="getList"    />    <el-dialog title="处理方式" width="700px" :visible.sync="handleVisible">      <el-input        type="textarea"        :rows="3"        v-model="handleForm.memo"        placeholder="请填写处理方式"      ></el-input>      <div slot="footer" class="dialog-footer">        <el-button @click="handleVisible = false">取 消</el-button>        <el-button type="primary" @click="submitHandle">确 定</el-button>      </div>    </el-dialog>  </div></template><script>import { getInspectionItem, resetInspectionItem } from "../api";import { permission } from "@/utils/directivePage";import pagination from "@/components/Pagination/index";import dayjs from "dayjs";import { getTimes } from "@/utils";export default {  components: { pagination },  data() {    return {      searchForm: {        userId: "",        organIds: "",        month: [],        searchType: "",      },      handleForm: {        memo: "",        searchType: "",      },      tableList: [],      handleVisible: false,      rules: {        // 分页规则        limit: 10, // 限制显示条数        page: 1, // 当前页        total: 0, // 总条数        page_size: [10, 20, 40, 50], // 选择限制显示条数      },    };  }, async mounted() {  await  this.$store.dispatch("setBranchs");  this.$set(this.searchForm,'organId',this.selects.branchs[0].id)    this.getList();  },  methods: {    permission(str) {      return permission(str);    },    onReSet() {      this.$refs.searchForm.resetFields();      this.search();    },    search() {      this.rules.page = 1;      this.getList();    },    async getList() {      const { query } = this.$route;    if (query.organId) {      this.searchForm.organId = query.organId;    }    if (query.start && query.end) {      this.searchForm.month = [query.start, query.end];    }      let { month, ...rest } = this.searchForm;      let params = {        ...rest,        page: this.rules.page,        rows: this.rules.limit,        ...getTimes(month, ["startTime", "endTime"], "YYYY-MM"),        searchType: this.$route.query.searchType,      };      try {        const res = await getInspectionItem(params);        this.tableList = res.data.rows;        this.rules.total = res.data.total;      } catch (e) {        console.log(e);      }    },    resetLine(row) {      let { id, memo } = row;      this.handleForm = { id, memo };      this.handleVisible = true;    },    async submitHandle() {      try {        const res = await resetInspectionItem(this.handleForm);        this.$message.success("提交成功");        this.getList();        this.handleVisible = false;      } catch (e) {        console.log(e);      }    },    gotoHander(row) {      let startTime = dayjs(row.month).startOf("month").format("YYYY-MM-DD");      let endTime = dayjs(row.month).endOf("month").format("YYYY-MM-DD");      if (row.item == "VISIT") {        // 学员回访        // 跳到回访页面 搜索条件 教务老师 时间范围        this.$router.push({          path: "/studentManager/returnVisitList",          query: { teacher: row.userName, timer: [startTime, endTime] },        });      } else {        // 下校巡查        this.$router.push({          path: "/main/scheduleDetail",          query: {            teacher: row.userId,            startTime,            endTime,            name: row.userName,            organId: row.organId,            itemId: row.id,            times: row.times,          },        });      }    },  },};</script><style lang="scss" scoped></style>
 |