|
|
@@ -412,6 +412,15 @@
|
|
|
>
|
|
|
生产准备
|
|
|
</el-link>
|
|
|
+
|
|
|
+ <el-link
|
|
|
+ type="danger"
|
|
|
+ :underline="false"
|
|
|
+ v-if="activeName == 'second' && row.status != 10"
|
|
|
+ @click="handleTerminate(row)"
|
|
|
+ >
|
|
|
+ 终止
|
|
|
+ </el-link>
|
|
|
</template>
|
|
|
</ele-pro-table>
|
|
|
</el-card>
|
|
|
@@ -482,7 +491,9 @@
|
|
|
updatePriority,
|
|
|
getPlanStatistics,
|
|
|
factoryDelete,
|
|
|
- planIsReview
|
|
|
+ planIsReview,
|
|
|
+ checkTerminatePlan,
|
|
|
+ terminatePlan
|
|
|
} from '@/api/productionPlan/index.js';
|
|
|
import productionPlanSearch from './components/productionPlan-search.vue';
|
|
|
import unpackDialog from './components/unpackDialog.vue';
|
|
|
@@ -565,11 +576,12 @@
|
|
|
{ label: '已发布', value: '4' }
|
|
|
],
|
|
|
second: [
|
|
|
- { label: '所有状态', value: '7,4,5,6' },
|
|
|
+ { label: '所有状态', value: '7,4,5,6,10' },
|
|
|
{ label: '待生产', value: '4' },
|
|
|
{ label: '生产中', value: '5' },
|
|
|
{ label: '已完成', value: '6' },
|
|
|
- { label: '已延期', value: '7' }
|
|
|
+ { label: '已延期', value: '7' },
|
|
|
+ { label: '已终止', value: '10' }
|
|
|
],
|
|
|
change: [{ label: '已变更', value: '9' }]
|
|
|
},
|
|
|
@@ -650,7 +662,9 @@
|
|
|
flattenPlanRows(list = []) {
|
|
|
const result = [];
|
|
|
(list || []).forEach((item) => {
|
|
|
- const childList = Array.isArray(item?.childList) ? item.childList : [];
|
|
|
+ const childList = Array.isArray(item?.childList)
|
|
|
+ ? item.childList
|
|
|
+ : [];
|
|
|
if (childList.length > 0 && item.splitBatch != 2) {
|
|
|
result.push(...childList);
|
|
|
} else if (item) {
|
|
|
@@ -1287,7 +1301,7 @@
|
|
|
getFieldModel() {
|
|
|
fieldModel({ fieldModel: 't_main_category' }).then((res) => {
|
|
|
const privateColumn = [];
|
|
|
- if (this.activeName == 'first') {
|
|
|
+ if (this.activeName == 'first' || this.activeName == 'second') {
|
|
|
privateColumn.push({
|
|
|
columnKey: 'action',
|
|
|
label: '操作',
|
|
|
@@ -1393,7 +1407,9 @@
|
|
|
if (row.taskName === '完结') {
|
|
|
return '';
|
|
|
}
|
|
|
- const endTime = new Date(String(row.endTime).replace(/-/g, '/')).getTime();
|
|
|
+ const endTime = new Date(
|
|
|
+ String(row.endTime).replace(/-/g, '/')
|
|
|
+ ).getTime();
|
|
|
if (isNaN(endTime)) {
|
|
|
return '';
|
|
|
}
|
|
|
@@ -1440,6 +1456,57 @@
|
|
|
this.$refs.checkProductionPreparationsRef.open(item);
|
|
|
},
|
|
|
|
|
|
+ async handleTerminate(row) {
|
|
|
+ try {
|
|
|
+ const data = await checkTerminatePlan({ id: row.id });
|
|
|
+ const {
|
|
|
+ apsWorkOrderCodeList = [],
|
|
|
+ childPlanCodeList = [],
|
|
|
+ mesWorkOrderCodeList = [],
|
|
|
+ salesCodeList = []
|
|
|
+ } = data || {};
|
|
|
+
|
|
|
+ const hasRelated =
|
|
|
+ (apsWorkOrderCodeList && apsWorkOrderCodeList.length) ||
|
|
|
+ (childPlanCodeList && childPlanCodeList.length) ||
|
|
|
+ (mesWorkOrderCodeList && mesWorkOrderCodeList.length) ||
|
|
|
+ (salesCodeList && salesCodeList.length);
|
|
|
+
|
|
|
+ if (hasRelated) {
|
|
|
+ const segments = [];
|
|
|
+ if (apsWorkOrderCodeList && apsWorkOrderCodeList.length) {
|
|
|
+ segments.push(`APS工单:${apsWorkOrderCodeList.join('、')}`);
|
|
|
+ }
|
|
|
+ if (childPlanCodeList && childPlanCodeList.length) {
|
|
|
+ segments.push(`子计划:${childPlanCodeList.join('、')}`);
|
|
|
+ }
|
|
|
+ if (mesWorkOrderCodeList && mesWorkOrderCodeList.length) {
|
|
|
+ segments.push(`MES工单:${mesWorkOrderCodeList.join('、')}`);
|
|
|
+ }
|
|
|
+ if (salesCodeList && salesCodeList.length) {
|
|
|
+ segments.push(`销售订单:${salesCodeList.join('、')}`);
|
|
|
+ }
|
|
|
+ const msg = `该计划存在关联数据:<br/>${segments.join(
|
|
|
+ '<br/>'
|
|
|
+ )}<br/>确定终止该计划吗?`;
|
|
|
+ try {
|
|
|
+ await this.$confirm(msg, '终止确认', {
|
|
|
+ dangerouslyUseHTMLString: true,
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ } catch (e) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ await terminatePlan({ id: row.id, status: 10 });
|
|
|
+ this.$message.success('终止成功');
|
|
|
+ this.reload();
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
goDetail({ id, processInstanceId }) {
|
|
|
console.log(id, processInstanceId, 'id, processInstanceId');
|
|
|
this.$router.push({
|