123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355 |
- <template>
- <div class="app-container">
- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
- <el-form-item label="申请人" prop="applier">
- <el-select v-model="queryParams.applier" filterable clearable @change="handleQuery">
- <el-option v-for="item in $store.state.user.userList" :key="item.userId" :label="item.nickName"
- :value="item.userId">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="申请部门" prop="useDept">
- <el-select v-model="queryParams.useDept" filterable clearable @change="handleQuery">
- <el-option v-for="item in $store.state.user.deptList" :key="item.deptId" :label="item.deptName"
- :value="item.deptId">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="项目编号" prop="projectId">
- <el-select v-model="queryParams.projectId" clearable filterable remote reserve-keyword placeholder="请输入项目编号"
- :remote-method="remoteMethod" :loading="loading" style="width: 400px;">
- <el-option v-for="project in projectList" :key="project.projectId"
- :label="project.projectNumber + '-' + project.projectName" :value="project.projectId">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="申请类型" prop="carUsage">
- <el-select v-model="queryParams.carUsage" clearable @change="handleQuery">
- <el-option label="项目用车" value="0"></el-option>
- <el-option label="非项目用车" value="1"></el-option>
- <el-option label="工会用车" value="2"></el-option>
- <el-option label="党委用车" value="3"></el-option>
- <el-option label="团委用车" value="4"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
- </el-form-item>
- </el-form>
-
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
- v-hasPermi="['car:record:export']">导出</el-button>
- </el-col>
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
- </el-row>
-
- <el-table v-loading="loading" :data="carApprovalList" @selection-change="handleSelectionChange">
- <el-table-column type="index" label="序号" width="55" align="center" />
- <!-- <el-table-column label="用车申请id" align="center" prop="carApplyId" /> -->
- <el-table-column label="申请类型" align="center" prop="carUsage">
- <template slot-scope="scope">
- <el-tag :type="setTypeCarUsage(scope.row.carUsage)">
- {{ setCarUsage(scope.row.carUsage) }}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column label="申请人" align="center" prop="applier">
- <template slot-scope="scope">
- {{ getUserName(scope.row.applier) }}
- </template>
- </el-table-column>
- <el-table-column label="申请部门" align="center" prop="useDept">
- <template slot-scope="scope">
- {{ getDeptName(scope.row.useDept) }}
- </template>
- </el-table-column>
- <el-table-column label="项目编号" align="center" prop="project.projectNumber" />
- <el-table-column label="项目名称" align="center" prop="project.projectName" width="200px" />
- <el-table-column label="用车事由" align="center" prop="applyReason" />
- <el-table-column label="乘车人数" align="center" prop="passengers" />
- <el-table-column label="开始日期" align="center" prop="beginDate">
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.beginDate, '{y}-{m}-{d}') }}</span>
- </template>
- </el-table-column>
- <el-table-column label="结束日期" align="center" prop="endDate">
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.endDate, '{y}-{m}-{d}') }}</span>
- </template>
- </el-table-column>
- <el-table-column label="天数" align="center" prop="days" />
- <!-- <el-table-column label="部门审批人" align="center" prop="deptUser.nickName" /> -->
- <el-table-column label="申请日期" align="center" prop="applyDate">
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.applyDate, '{y}-{m}-{d}') }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
- <template slot-scope="scope">
- <el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)">查看</el-button>
- </template>
- </el-table-column>
- </el-table>
-
- <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
- @pagination="getList" />
-
- <!-- 添加或修改cmc用车审批对话框 -->
- <el-dialog :title="title" :visible.sync="open" width="65%" append-to-body>
- <car-form :taskForm="taskForm" :taskName="''" :flowDisabled="false"></car-form>
- </el-dialog>
- </div>
- </template>
-
- <script>
- import { listCarApproval, getCarApproval, delCarApproval, addCarApproval, updateCarApproval } from "@/api/oa/car/carApproval";
- import { listProject } from '@/api/oa/project/project';
- import carForm from '../../flowable/form/oa/carForm.vue';
- import { mapGetters } from 'vuex'
-
- export default {
- components: { carForm },
- name: "CarApproval",
- computed: {
- ...mapGetters(['roles', 'deptId']),
- },
- data() {
- return {
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // cmc用车审批表格数据
- carApprovalList: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- applier: null,
- useDept: null,
- cars: null,
- drivers: null,
- projectId: null,
- carUsage: null,
- applyReason: null,
- passengers: null,
- beginDate: null,
- endDate: null,
- days: null,
- deptUserId: null,
- deptComment: null,
- deptTime: null,
- managerUserId: null,
- managerComment: null,
- managerTime: null,
- unionUserId: null,
- unionComment: null,
- unionTime: null,
- gmUserId: null,
- gmComment: null,
- gmTime: null,
- dispatcher: null,
- dispatchComment: null,
- dispatchTime: null,
- estimateCost: null,
- applyDate: null
- },
- // 表单参数
- form: {},
- // 表单校验
- rules: {
- },
- projectList: [],
- taskForm: {
- formId: ''
- }
- };
- },
- created() {
- this.queryParams.carUsage = '0'
- this.getList();
- },
- methods: {
- /** 查询cmc用车审批列表 */
- getList() {
- this.loading = true;
- if (this.roles.some(element => element === "dept")) {
- if (this.queryParams.carUsage == '0') {
- this.queryParams.undertakingDept = this.deptId;
- this.queryParams.useDept = null;
- }
- else {
- this.queryParams.useDept = this.deptId;
- this.queryParams.undertakingDept = null;
- }
- }
- if (this.roles.some(e => e === 'leader')) {
- this.queryParams.useDept = null;
- this.queryParams.undertakingDept = null;
- }
- listCarApproval(this.queryParams).then(response => {
- this.carApprovalList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- remoteMethod(val) {
- listProject({
- pageNum: 1,
- pageSize: 20,
- projectNumber: val
- }).then(res => {
- this.projectList = res.rows;
- })
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- carApplyId: null,
- applier: null,
- useDept: null,
- cars: null,
- drivers: null,
- projectId: null,
- carUsage: null,
- applyReason: null,
- passengers: null,
- beginDate: null,
- endDate: null,
- days: null,
- deptUserId: null,
- deptComment: null,
- deptTime: null,
- managerUserId: null,
- managerComment: null,
- managerTime: null,
- unionUserId: null,
- unionComment: null,
- unionTime: null,
- gmUserId: null,
- gmComment: null,
- gmTime: null,
- dispatcher: null,
- dispatchComment: null,
- dispatchTime: null,
- estimateCost: null,
- applyDate: null
- };
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm("queryForm");
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.carApplyId)
- this.single = selection.length !== 1
- this.multiple = !selection.length
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset();
- this.open = true;
- this.title = "添加cmc用车审批";
- },
- handleView(row) {
- this.open = true;
- this.taskForm.formId = row.carApplyId;
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset();
- const carApplyId = row.carApplyId || this.ids
- getCarApproval(carApplyId).then(response => {
- this.form = response.data;
- this.open = true;
- this.title = "修改cmc用车审批";
- });
- },
- /** 提交按钮 */
- submitForm() {
- this.$refs["form"].validate(valid => {
- if (valid) {
- if (this.form.carApplyId != null) {
- updateCarApproval(this.form).then(response => {
- this.$modal.msgSuccess("修改成功");
- this.open = false;
- this.getList();
- });
- } else {
- addCarApproval(this.form).then(response => {
- this.$modal.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- });
- }
- }
- });
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const carApplyIds = row.carApplyId || this.ids;
- this.$modal.confirm('是否确认删除cmc用车审批编号为"' + carApplyIds + '"的数据项?').then(function () {
- return delCarApproval(carApplyIds);
- }).then(() => {
- this.getList();
- this.$modal.msgSuccess("删除成功");
- }).catch(() => { });
- },
- /** 导出按钮操作 */
- handleExport() {
- this.download('oa/carApproval/export', {
- ...this.queryParams
- }, `carApproval_${new Date().getTime()}.xlsx`)
- },
- setCarUsage(val) {
- if (val == '0') {
- return '项目用车'
- } else if (val == '1') {
- return '非项目用车'
- } else if (val == '2') {
- return '工会用车'
- } else if (val == '3') {
- return '党委用车'
- } else if (val == '4') {
- return '团委用车'
- }
- },
- setTypeCarUsage(val) {
- if (val == '0') {
- return 'success'
- } else if (val == '1') {
- return 'warning'
- } else {
- return ''
- }
- }
- }
- };
- </script>
|