| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419 |
- <template>
- <div class="ele-body">
- <el-card shadow="never">
- <!-- <patrolSearch @search="search"></patrolSearch> -->
- <seek-page
- :seekList="seekList"
- @search="search"
- :maxLength="4"
- style="margin-bottom: 15px"
- ></seek-page>
- <ele-pro-table
- ref="table"
- row-key="id"
- :columns="columns"
- :datasource="datasource"
- @columns-change="handleColumnChange"
- :cache-key="cacheKeyUrl"
- height="calc(100vh - 420px)"
- :page-size="defPageSize"
- >
- <template v-slot:toolbar>
- <el-button
- type="primary"
- size="mini"
- icon="el-icon-plus"
- @click="openEdit('add')"
- >新建临时计划</el-button
- >
- </template>
- <template v-slot:code="{ row }">
- <el-link
- type="primary"
- :underline="false"
- @click="openEdit('detail', row)"
- >
- {{ row.code }}
- </el-link>
- </template>
- <template v-slot:action="{ row }">
- <el-link
- type="primary"
- :underline="false"
- @click="openEdit('edit', row)"
- v-if="row.status != 2 && row.status != 3"
- >
- 修改
- </el-link>
- <el-link
- type="primary"
- :underline="false"
- v-if="row.status != 2 && row.status != 3"
- @click="openEdit('dispatch', row)"
- >
- 派单
- </el-link>
- <el-popconfirm
- v-if="row.status == 2"
- class="ele-action"
- title="确定要撤回此条数据吗?"
- @confirm="revoke(row.id)"
- >
- <template v-slot:reference>
- <el-link type="primary" :underline="false"> 撤回 </el-link>
- </template>
- </el-popconfirm>
- <el-popconfirm
- class="ele-action"
- title="确定要删除此条数据吗?"
- @confirm="deleteRow(row.id)"
- v-if="row.status != 2 && row.status != 3"
- >
- <template v-slot:reference>
- <el-link type="danger" :underline="false"> 删除 </el-link>
- </template>
- </el-popconfirm>
- </template>
- </ele-pro-table>
- </el-card>
- <programRulesDialog
- ref="programRulesDialogRef"
- @reload="reload"
- :planType="planTypeList[pageName]"
- ></programRulesDialog>
- </div>
- </template>
- <script>
- import dictMixins from '@/mixins/dictMixins';
- import tableColumnsMixin from '@/mixins/tableColumnsMixin';
- import {
- recordrulesplanPage,
- recordrulesplanDelete,
- recordrulesplanRevoke
- } from '@/api/recordRules/index';
- import programRulesDialog from './programRulesDialog.vue';
- import { getteampage } from '@/api/main/index.js';
- import { getFactoryarea } from '@/api/factoryModel/index';
- export default {
- mixins: [dictMixins, tableColumnsMixin],
- components: {
- programRulesDialog
- },
- props: {
- pageName: {
- type: String,
- default: 'productionRecords'
- }
- },
- data() {
- return {
- planTypeList: {
- productionRecords: 2,
- steamInjectionInspectionRecord: 3,
- solidWasteRecord: 4,
- qualityTestRecords: 5,
- boilerOperationRecord: 6,
- QualityInspection: 7,
- HaulSlag: 8,
- TransportAsh: 9
- },
- columns: [
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- prop: 'code',
- label: '计划单号',
- align: 'center',
- minWidth: 160,
- slot: 'code'
- },
- {
- prop: 'name',
- label: '计划名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'ruleName',
- label: '记录规则名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'productLineName',
- label: '场站名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'teamName',
- label: '班组',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: '',
- label: '部门',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110,
- formatter: (row) => {
- return [
- ...new Set(
- (row.executeUsers || [])
- .map((i) => i.groupName)
- .filter((i) => i)
- )
- ].join(',');
- }
- },
- {
- prop: '',
- label: '负责人',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110,
- formatter: (row) => {
- return row.executeUsers.map((i) => i.userName).join(',');
- }
- },
- {
- prop: 'workshopName',
- label: '记录对象',
- align: 'center',
- showOverflowTooltip: true,
- formatter: (row) => {
- console.log(row);
- if (row.associatedObject == 1) {
- return row.workshopName;
- } else {
- return row.deviceName;
- }
- },
- minWidth: 110
- },
- // {
- // prop: 'autoOrder',
- // label: '自动派单',
- // align: 'center',
- // showOverflowTooltip: true,
- // minWidth: 110,
- // formatter: (row) => {
- // return row.autoOrder ? '是' : '否';
- // }
- // },
- {
- prop: 'status',
- label: '状态',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110,
- formatter: (row) => {
- // 0-未派单,2-执行中,3-已完成,4-已撤回
- const statusMap = {
- 0: '未派单',
- 2: '执行中',
- 3: '已完成',
- 4: '已撤回'
- };
- return statusMap[row.status] || '';
- }
- },
- {
- prop: 'createUserName',
- label: '创建人',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'createTime',
- label: '创建时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- columnKey: 'action',
- label: '操作',
- width: 220,
- align: 'center',
- resizable: false,
- fixed: 'right',
- slot: 'action',
- showOverflowTooltip: true
- }
- ],
- cacheKeyUrl: `pcs-2511241029-${this.pageName + ''}-plan`,
- teamList: [],
- productLineList: []
- };
- },
- computed: {
- seekList() {
- return [
- {
- label: '关键字',
- value: 'keyword',
- type: 'input',
- width: '280px',
- placeholder: '计划单号,计划名称,记录规则名称'
- },
- {
- label: '场站',
- value: 'productLineId',
- type: 'select',
- planList: this.productLineList,
- placeholder: '请选择'
- },
- {
- label: '班组',
- value: 'teamId',
- type: 'select',
- planList: this.teamList,
- placeholder: '请选择'
- },
- {
- label: '状态',
- value: 'status',
- type: 'select',
- placeholder: '请输入',
- planList: [
- { value: 0, label: '未派单' },
- { value: 2, label: '执行中' },
- { value: 3, label: '已完成' },
- { value: 4, label: '已撤回' }
- ]
- },
- {
- label: '创建时间:',
- value: 'createTime',
- type: 'date',
- dateType: 'datetimerange',
- placeholder: '',
- width: 380,
- valueAr: ['createTimeStart', 'createTimeEnd']
- }
- ];
- }
- },
- created() {
- this.requestDict('记录规则类型');
- getteampage({
- pageNum: 1,
- size: -1
- }).then((res) => {
- this.teamList =
- res.list.map((item) => {
- return {
- value: item.id,
- label: item.name
- };
- }) || [];
- });
- getFactoryarea({
- pageNum: 1,
- size: 999,
- type: 4
- }).then((res) => {
- console.log(res, 'res');
- this.productLineList =
- res.list.map((item) => {
- return {
- value: item.id,
- label: item.name
- };
- }) || [];
- });
- },
- methods: {
- // 刷新表格
- reload(where = {}) {
- this.$refs.table.reload({
- where
- });
- },
- /* 表格数据源 */
- datasource({ page, limit, where, order }) {
- // 参数
- const body = {
- ...where,
- ...order,
- pageNum: page,
- size: limit,
- planType: this.planTypeList[this.pageName]
- };
- return recordrulesplanPage(body);
- },
- search(where) {
- console.log('where', where);
- if (where.time) {
- where.createTimeStart = where.time[0];
- where.createTimeEnd = where.time[1];
- where.time = null;
- }
- this.reload(where);
- },
- openEdit(type, row = null) {
- this.$refs.programRulesDialogRef.open(
- type,
- row,
- this.getDictCode(
- '记录规则类型',
- this.pageName == 'productionRecords'
- ? '生产记录'
- : this.pageName == 'steamInjectionInspectionRecord'
- ? '注汽检查记录'
- : this.pageName == 'solidWasteRecord'
- ? '固废记录'
- : this.pageName == 'qualityTestRecords'
- ? '质量检查检测记录'
- : this.pageName == 'QualityInspection'
- ? '来煤质检记录'
- : this.pageName == 'HaulSlag'
- ? '拉渣记录'
- : this.pageName == 'TransportAsh'
- ? '拉灰记录'
- : '锅炉运行记录'
- )
- );
- },
- async deleteRow(id) {
- await recordrulesplanDelete([id]);
- this.$message.success('删除成功');
- this.reload();
- },
- async revoke(id) {
- await recordrulesplanRevoke({ id });
- this.$message.success('撤回成功');
- this.reload();
- }
- }
- };
- </script>
- <style></style>
|