| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- <template>
- <div class="ele-body">
- <el-card shadow="never">
- <!-- 数据表格 -->
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="datasource"
- :selection.sync="selection"
- row-key="id"
- >
- <!-- 表头工具栏 -->
- <!-- v-if="attributeData.status != 1 && !isWt" -->
- <template v-slot:toolbar>
- <el-button
- v-if="
- attributeData.approvalStatus != 1 &&
- attributeData.approvalStatus != 2 &&
- !isWt &&
- attributeData.parentId == '0' &&
- attributeData.id != attributeData.resourceBomId
- "
- size="small"
- type="primary"
- icon="el-icon-plus"
- class="ele-btn-icon"
- @click="add"
- >新增</el-button
- >
- </template>
- <!-- 状态列 -->
- <template v-slot:status="{ row }">
- {{ checkStatus(row) }}
- </template>
- <template v-slot:routeType="{ row }">
- {{
- row.routeType == 2
- ? '委外'
- : row.routeType == 1
- ? '生产'
- : row.routeType == 3
- ? '质检'
- : ''
- }}
- </template>
- <template v-slot:action="{ row, $index }">
- <el-link
- type="danger"
- @click="handleDel(row)"
- v-if="
- attributeData.approvalStatus != 1 &&
- attributeData.approvalStatus != 2 &&
- attributeData.parentId == '0' &&
- attributeData.id != attributeData.resourceBomId
- "
- >删除</el-link
- >
- </template>
- </ele-pro-table>
- </el-card>
- <routingDialog ref="routingDialogRef" @reload="reload"></routingDialog>
- </div>
- </template>
- <script>
- import { getMbomPage } from '@/api/material/BOM';
- import routingDialog from './routingDialog.vue';
- import route from '@/api/technology/route';
- import { workingProcedureUpdate } from '@/api/material/BOM';
- export default {
- name: 'technologyRoute',
- components: {
- routingDialog
- },
- props: {
- taskParam: Object,
- resourceBomId: String,
- attributeData: {
- type: Object,
- default: {}
- },
- isWt: {
- type: Boolean,
- default: false
- }
- },
- watch: {
- attributeData: {
- handler(val) {
- this.$nextTick(() => {
- this.reload();
- });
- },
- deep: true,
- immediate: true
- }
- },
- data() {
- return {
- tableData: [],
- selection: [],
- versionList: [],
- where: {},
- // 表格列配置
- columns: [
- {
- prop: 'code',
- label: '工艺路线编码',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110,
- slot: 'code'
- },
- {
- prop: 'name',
- label: '工艺路线名称',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- },
- {
- prop: 'version',
- label: '工艺路线版本',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'produceVersionName',
- label: '工艺类型',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'status',
- label: '状态',
- align: 'center',
- slot: 'status',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- slot: 'routeType',
- label: '类型',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'action',
- label: '操作',
- align: 'center',
- slot: 'action'
- }
- ],
- // 表格选中数据
- selection: [],
- // 当前编辑数据
- current: null,
- // 是否显示编辑弹窗
- showEdit: false,
- detailEdit: false,
- statusList: [
- { label: '草稿', value: -1 },
- { label: '失效', value: 0 },
- { label: '生效', value: 1 }
- ],
- loading: false
- };
- },
- created() {
- console.log(this.attributeData, 'attributeDataattributeData');
- },
- methods: {
- add() {
- console.log(this.taskParam, this.tableData);
- this.$refs.routingDialogRef.open(this.taskParam, this.tableData);
- },
- search(e) {
- this.reload(this.where);
- },
- /* 表格数据源 */
- async datasource({ page, limit, where }) {
- let data = await getMbomPage({
- ...where,
- bomCategoryId: this.resourceBomId,
- pageNum: page,
- size: limit
- });
- if (data?.length > 0) {
- this.tableData = data[0];
- return data[0].processRoute.list || [];
- } else {
- this.tableData = {};
- return [];
- }
- },
- handleDel(row) {
- // route.getProcessById([row.id]).then((data) => {
- // })
- // console.log(row,'41444444',this.tableData.processRoute.list);
- // return
- this.$confirm('是否删除?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- workingProcedureUpdate({
- id: this.tableData.id,
- categoryId: this.taskParam.categoryId,
- bomCategoryId: this.taskParam.id,
- categoryCode: this.taskParam.categoryCode,
- isRouting: 1,
- processRoute: {
- list: this.tableData.processRoute.list.filter(
- (item) => item.id !== row.id
- )
- }
- }).then((data) => {
- this.$message.success('删除成功');
- this.reload();
- });
- })
- .catch(() => console.info('操作取消'));
- },
- checkStatus(row) {
- let obj = this.statusList.find((it) => it.value == row.status);
- return obj.label;
- },
- /* 刷新表格 */
- reload(where) {
- this.$refs.table.reload({ page: 1, where: where });
- }
- }
- };
- </script>
|