|
@@ -1,689 +1,690 @@
|
|
|
-<template>
|
|
|
- <el-dialog
|
|
|
- :close-on-click-modal="false"
|
|
|
- :close-on-press-escape="false"
|
|
|
- :title="title"
|
|
|
- :append-to-body="true"
|
|
|
- :visible.sync="isVisible"
|
|
|
- width="950px"
|
|
|
- top="50px"
|
|
|
- >
|
|
|
- <el-form
|
|
|
- ref="form"
|
|
|
- :disabled="formDisabled"
|
|
|
- :model="tenant"
|
|
|
- :rules="rules"
|
|
|
- label-position="right"
|
|
|
- label-width="100px"
|
|
|
- >
|
|
|
- <!--订单名称-->
|
|
|
- <el-form-item :label="$t("runCenter.form.orderName")+":"" prop="orderName">
|
|
|
- <el-input v-model="tenant.orderName" :placeholder='$t("common.pleaseEnter")' style="width: 50%;"/>
|
|
|
- </el-form-item>
|
|
|
- <!-- 所属产线 -->
|
|
|
- <el-form-item
|
|
|
- :label="$t("runCenter.form.zoneId")+":""
|
|
|
- prop="zoneId"
|
|
|
- >
|
|
|
- <el-select
|
|
|
- v-model="tenant.zoneId"
|
|
|
- :placeholder="$t("common.pleaseSelect")"
|
|
|
- style="width: 50%;"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in zoneList"
|
|
|
- :key="item.id"
|
|
|
- :label="item.name"
|
|
|
- :value="item.id"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <!-- 交付时间 -->
|
|
|
- <el-form-item
|
|
|
- :label="$t("runCenter.form.deliveryTime")+":""
|
|
|
- prop="deliveryTime"
|
|
|
- >
|
|
|
- <el-date-picker
|
|
|
- v-model="tenant.deliveryTime"
|
|
|
- type="date"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
- :placeholder="$t("common.pleaseSelect")"
|
|
|
- :picker-options="pickerOptions"
|
|
|
- style="width: 50%;"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <!-- 下单时间 -->
|
|
|
- <el-form-item
|
|
|
- :label="$t("runCenter.form.orderTime")+":""
|
|
|
- prop="orderTime"
|
|
|
- >
|
|
|
- <el-date-picker
|
|
|
- v-model="tenant.orderTime"
|
|
|
- type="date"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
- :placeholder="$t("common.pleaseSelect")"
|
|
|
- :picker-options="pickerOptions"
|
|
|
- style="width: 50%;"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <!-- 启用状态 -->
|
|
|
- <el-form-item
|
|
|
- :label="$t("runCenter.form.status")+":""
|
|
|
- prop="status"
|
|
|
- >
|
|
|
- <template>
|
|
|
- <el-radio
|
|
|
- v-model="tenant.status"
|
|
|
- label="1"
|
|
|
- >
|
|
|
- {{ $t("common.show") }}
|
|
|
- </el-radio>
|
|
|
- <el-radio
|
|
|
- v-model="tenant.status"
|
|
|
- label="0"
|
|
|
- >
|
|
|
- {{ $t("common.hide") }}
|
|
|
- </el-radio>
|
|
|
- </template>
|
|
|
- </el-form-item>
|
|
|
- <!-- 零件 -->
|
|
|
- <el-form-item
|
|
|
- :label="$t("runCenter.form.lingjian")+":""
|
|
|
- prop="product"
|
|
|
- >
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- :disabled="type == 'view' ? true : false"
|
|
|
- icon="el-icon-plus"
|
|
|
- size="small"
|
|
|
- circle
|
|
|
- @click="add"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <!-- Table数据 -->
|
|
|
- <el-table
|
|
|
- ref="table"
|
|
|
- :data="tableData"
|
|
|
- border
|
|
|
- fit
|
|
|
- style="width: 100%;"
|
|
|
- >
|
|
|
- <!-- 零部件编号 -->
|
|
|
- <el-table-column
|
|
|
- prop="partsNo"
|
|
|
- :label="$t("runCenter.table.orderSldPro.partsNo")"
|
|
|
- align="center"
|
|
|
- :show-overflow-tooltip="true"
|
|
|
- width="120px"
|
|
|
- >
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <span>{{ row.partsNo }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <!-- 产品代号 -->
|
|
|
- <el-table-column
|
|
|
- prop="bomAlias"
|
|
|
- :label="$t("runCenter.table.orderSldPro.bomAlias")"
|
|
|
- align="center"
|
|
|
- :show-overflow-tooltip="true"
|
|
|
- width="100px"
|
|
|
- />
|
|
|
- <!-- 零件名称 -->
|
|
|
- <el-table-column
|
|
|
- prop="bomName"
|
|
|
- :label="$t("runCenter.table.orderSldPro.name")"
|
|
|
- align="center"
|
|
|
- width="100px"
|
|
|
- >
|
|
|
- <template slot-scope="{ row }">
|
|
|
- {{ row.name || row.bomName }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <!-- 零件代号 -->
|
|
|
- <el-table-column
|
|
|
- prop="partsAlias"
|
|
|
- :label="$t("runCenter.table.orderSldPro.partsAlias")"
|
|
|
- align="center"
|
|
|
- width="100px"
|
|
|
- />
|
|
|
- <!-- 零件批号 -->
|
|
|
- <!--<el-table-column
|
|
|
- prop="brand"
|
|
|
- :label="$t("runCenter.table.orderSldPro.brand")"
|
|
|
- align="center"
|
|
|
- width="100px"
|
|
|
- />-->
|
|
|
- <!-- 原料炉批号 -->
|
|
|
- <el-table-column
|
|
|
- prop="furnaceBatchNo"
|
|
|
- label="原料炉批号"
|
|
|
- align="center"
|
|
|
- width="150px"
|
|
|
- >
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <div style="color: #42d885;cursor: pointer;" @click="changeMetral(row)">
|
|
|
- <span v-if="row.furnaceBatchNo">{{ row.furnaceBatchNo }}</span>
|
|
|
- <a v-else>请选择</a>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <!-- 数量 -->
|
|
|
- <el-table-column
|
|
|
- prop="bomNum"
|
|
|
- :label="$t("runCenter.table.orderSldPro.bomNum")"
|
|
|
- width="150px"
|
|
|
- align="center"
|
|
|
- >
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-input-number
|
|
|
- v-model="row.bomNum"
|
|
|
- :min="1"
|
|
|
- :max="999999999"
|
|
|
- :label="$t("common.pleaseEnter")"
|
|
|
- size="small"
|
|
|
- />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="deliveryTime"
|
|
|
- :label="$t("runCenter.table.orderSldPro.deliveryTime")"
|
|
|
- width="220px"
|
|
|
- align="center"
|
|
|
- >
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-date-picker
|
|
|
- v-model="row.deliveryTime"
|
|
|
- type="date"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
- size="small"
|
|
|
- :placeholder="$t("common.pleaseSelect")"
|
|
|
- :picker-options="pickerOptions"
|
|
|
- style="width: 100%;"
|
|
|
- />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="remark"
|
|
|
- :label="$t("common.remark")"
|
|
|
- :show-overflow-tooltip="true"
|
|
|
- width="180px"
|
|
|
- align="center"
|
|
|
- >
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-input
|
|
|
- v-model="row.remark"
|
|
|
- size="small"
|
|
|
- :label="$t("common.pleaseEnter")"
|
|
|
- />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- v-if="type != 'view'"
|
|
|
- :label="$t('table.operation')"
|
|
|
- fixed="right"
|
|
|
- align="center"
|
|
|
- column-key="operation"
|
|
|
- width="60px"
|
|
|
- >
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <!--<el-tooltip class="item" :content='$t("common.edit")' effect="dark" placement="top-start">
|
|
|
- <i
|
|
|
- class="el-icon-edit table-operation"
|
|
|
- style="color: #2db7f5;"
|
|
|
- @click="edit(row)"
|
|
|
- />
|
|
|
- </el-tooltip>-->
|
|
|
- <el-tooltip
|
|
|
- class="item"
|
|
|
- :content="$t("common.delete")"
|
|
|
- effect="dark"
|
|
|
- placement="top-start"
|
|
|
- >
|
|
|
- <i
|
|
|
- class="el-icon-delete table-operation"
|
|
|
- style="color: #f50;"
|
|
|
- @click="domDelete(row)"
|
|
|
- />
|
|
|
- </el-tooltip>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </el-form>
|
|
|
- <div
|
|
|
- slot="footer"
|
|
|
- class="dialog-footer"
|
|
|
- >
|
|
|
- <el-button
|
|
|
- plain
|
|
|
- type="warning"
|
|
|
- @click="isVisible = false"
|
|
|
- >
|
|
|
- {{ $t('common.cancel') }}
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- plain
|
|
|
- type="primary"
|
|
|
- :disabled="confirmDisabled"
|
|
|
- @click="submitForm"
|
|
|
- >
|
|
|
- {{ $t('common.confirm') }}
|
|
|
- </el-button>
|
|
|
- </div>
|
|
|
-
|
|
|
- <!-- 选择数据的组件 -->
|
|
|
- <select-table
|
|
|
- ref="edit"
|
|
|
- :dialog-visible="dialog.isVisible"
|
|
|
- :title="dialog.title"
|
|
|
- @close="editClose"
|
|
|
- @success="editSuccess"
|
|
|
- />
|
|
|
-
|
|
|
- <!-- 选择数据的组件 -->
|
|
|
- <meterial-select
|
|
|
- ref="meterial"
|
|
|
- :dialog-visible="dialogMeterial.isVisible"
|
|
|
- :title="dialogMeterial.title"
|
|
|
- @close="editMeterialClose"
|
|
|
- @success="editMeterialSuccess"
|
|
|
- />
|
|
|
-
|
|
|
- </el-dialog>
|
|
|
-</template>
|
|
|
-<script>
|
|
|
- // 日期格式化组件
|
|
|
- import moment from 'moment'
|
|
|
- // 选择【新增】组件
|
|
|
- import SelectTable from "./Select"
|
|
|
- // 选择【原料炉批号】组件
|
|
|
- import MeterialSelect from "./MeterialSelect"
|
|
|
- // 【客户管理】-API
|
|
|
- import customerMgrApi from "@/api/basicConfiguration/customerMgr"
|
|
|
- //【所属产线】-API
|
|
|
- import areaMgrApi from "@/api/resourceProductMgr/areaMgr"
|
|
|
- // 【订单管理】-API
|
|
|
- import orderMgrApi from "@/api/runManageCenter/orderMgr"
|
|
|
- // 【订单明细】-API
|
|
|
- import orderDetailApi from "@/api/runManageCenter/orderDetail"
|
|
|
- import { arrReduce } from '@/utils/commons'
|
|
|
-export default {
|
|
|
- name: 'TenantEdit',
|
|
|
- components: { SelectTable, MeterialSelect },
|
|
|
- props: {
|
|
|
- dialogVisible: {
|
|
|
- type: Boolean,
|
|
|
- default: false
|
|
|
- },
|
|
|
- title: {
|
|
|
- type: String,
|
|
|
- default: ''
|
|
|
- }
|
|
|
- },
|
|
|
- data () {
|
|
|
- return {
|
|
|
- type: 'add',
|
|
|
- tenant: this.initTenant(),
|
|
|
- screenWidth: 0,
|
|
|
- width: this.initWidth(),
|
|
|
- confirmDisabled: false,
|
|
|
- dialog: {
|
|
|
- isVisible: false,
|
|
|
- title: ""
|
|
|
- },
|
|
|
- dialogMeterial: {
|
|
|
- isVisible: false,
|
|
|
- title: ""
|
|
|
- },
|
|
|
- customList: [],
|
|
|
- currRow: {}, // 当前选择的Row
|
|
|
- zoneList: [],
|
|
|
- tableData: [],
|
|
|
- dicts:{
|
|
|
- NATION: {}
|
|
|
- },
|
|
|
- roles: [],
|
|
|
- pickerOptions: {
|
|
|
- disabledDate: (time) => {
|
|
|
- return time.getTime() < Date.now() - 86400000;
|
|
|
- },
|
|
|
- },
|
|
|
- rules: {
|
|
|
- custId: [
|
|
|
- { required: true, message: this.$t("rules.require"), trigger: 'blur' }
|
|
|
- ],
|
|
|
- deliveryTime: [
|
|
|
- { required: true, message: this.$t("rules.require"), trigger: 'change' }
|
|
|
- ],
|
|
|
- orderTime: [
|
|
|
- { required: true, message: this.$t("rules.require"), trigger: 'change' }
|
|
|
- ],
|
|
|
- status: [
|
|
|
- { required: true, message: this.$t("rules.require"), trigger: 'change' }
|
|
|
- ]
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- computed: {
|
|
|
- formDisabled(){
|
|
|
- if(this.type == "view"){
|
|
|
- this.confirmDisabled = true
|
|
|
- return true
|
|
|
- }else{
|
|
|
- this.confirmDisabled = false
|
|
|
- return false
|
|
|
- }
|
|
|
- },
|
|
|
- isVisible: {
|
|
|
- get () {
|
|
|
- // 清空数据
|
|
|
- this.tableData = [];
|
|
|
- return this.dialogVisible
|
|
|
- },
|
|
|
- set () {
|
|
|
- this.close()
|
|
|
- this.reset()
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
|
|
|
- created() {
|
|
|
- // 加载客户列表数据
|
|
|
- this.customerList()
|
|
|
- this.getZoneList()
|
|
|
- },
|
|
|
- mounted () {
|
|
|
- window.onresize = () => {
|
|
|
- return (() => {
|
|
|
- this.width = this.initWidth()
|
|
|
- })()
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- // 【原料炉批号】点击-事件
|
|
|
- changeMetral(row) {
|
|
|
- // 当前选择的行。row
|
|
|
- this.currRow = row;
|
|
|
- this.$refs.meterial.type = "edit";
|
|
|
- this.$refs.meterial.setTenant(row);
|
|
|
- this.dialogMeterial.title = "选择原料炉批号";
|
|
|
- this.dialogMeterial.isVisible = true;
|
|
|
- },
|
|
|
-
|
|
|
- // 【原料炉批号-修改】弹出框,关闭
|
|
|
- editMeterialClose () {
|
|
|
- this.dialogMeterial.isVisible = false
|
|
|
- },
|
|
|
-
|
|
|
- // 【原料炉批号-修改】弹出框,确定事件
|
|
|
- editMeterialSuccess (obj) {
|
|
|
- console.log("【原料炉批号-修改】: ", obj);
|
|
|
- let arr = [];
|
|
|
- this.tableData.map(item => {
|
|
|
- if(item.id == this.currRow.id) {
|
|
|
- // 赋值,原料炉批号
|
|
|
- item.furnaceBatchNo = obj.furnaceBatchNo;
|
|
|
- // 带入参数
|
|
|
- item.meterialReceiveId = obj.id;
|
|
|
- }
|
|
|
- arr.push(item);
|
|
|
- })
|
|
|
- // 赋值
|
|
|
- this.tableData = arr;
|
|
|
- },
|
|
|
-
|
|
|
- // 【删除】按钮-事件
|
|
|
- domDelete(row){
|
|
|
- this.$confirm(this.$t("tips.comTips"), this.$t("common.tips"), {
|
|
|
- distinguishCancelAndClose: true,
|
|
|
- confirmButtonText: this.$t("common.confirm"),
|
|
|
- cancelButtonText: this.$t("common.cancel"),
|
|
|
- type: "warning"
|
|
|
- }).then(() => {
|
|
|
- // 过滤我们需要的数据
|
|
|
- let list = this.tableData.filter(item => item.id != row.id)
|
|
|
- // 重新赋值
|
|
|
- this.tableData = list
|
|
|
- }).catch(() => {})
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- // 【新增-修改】弹出框,关闭
|
|
|
- editClose () {
|
|
|
- this.dialog.isVisible = false
|
|
|
- },
|
|
|
-
|
|
|
- // 【新增-修改】弹出框,确定事件
|
|
|
- editSuccess (arr) {
|
|
|
- // 清除备注
|
|
|
- arr.forEach(item => {
|
|
|
- item.remark = "";
|
|
|
- });
|
|
|
- // 合并当前数组,和新增的数组
|
|
|
- let list = [...this.tableData, ...arr];
|
|
|
- // 去除数组中重复的数据
|
|
|
- this.tableData = arrReduce(list, "id");
|
|
|
- },
|
|
|
-
|
|
|
- add () {
|
|
|
- this.$refs.edit.type = "add"
|
|
|
- this.dialog.title = this.$t("runCenter.common.selectPro")
|
|
|
- this.dialog.isVisible = true
|
|
|
- },
|
|
|
-
|
|
|
- initTenant () {
|
|
|
- return {
|
|
|
- orderTime: moment(new Date()).format('YYYY-MM-DD'),
|
|
|
- status: '1',
|
|
|
- zoneId: '',
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- initWidth () {
|
|
|
- this.screenWidth = document.body.clientWidth
|
|
|
- if (this.screenWidth < 991) {
|
|
|
- return '90%'
|
|
|
- } else if (this.screenWidth < 1400) {
|
|
|
- return '45%'
|
|
|
- } else {
|
|
|
- return '800px'
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- setTenant (val, dicts) {
|
|
|
- if(val){
|
|
|
- this.tenant = { ...val }
|
|
|
- // 修改的时候,订单详情数据(BOM产品)
|
|
|
- this.getBomList()
|
|
|
- }
|
|
|
- // 字典表
|
|
|
- this.dicts = dicts
|
|
|
- },
|
|
|
-
|
|
|
- close () {
|
|
|
- this.$emit('close')
|
|
|
- },
|
|
|
-
|
|
|
- reset () {
|
|
|
- // 先清除校验,再清除表单,不然有奇怪的bug
|
|
|
- this.$refs.form.clearValidate()
|
|
|
- this.$refs.form.resetFields()
|
|
|
- this.tenant = this.initTenant()
|
|
|
- // 关闭时候,清空数据
|
|
|
- this.tableData = []
|
|
|
- },
|
|
|
-
|
|
|
- submitForm () {
|
|
|
- this.$refs.form.validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- this.confirmDisabled = true
|
|
|
- // 验证【数量】不能不填写
|
|
|
- let flag = false, flagBatchNo = false;
|
|
|
- this.tableData.map(item => {
|
|
|
- if(!item.bomNum){
|
|
|
- flag = true
|
|
|
- }
|
|
|
- if(!item.deliveryTime){
|
|
|
- flag = true
|
|
|
- }
|
|
|
- // 验证【原料炉批号】
|
|
|
- if(!item.furnaceBatchNo){
|
|
|
- flagBatchNo = true
|
|
|
- }
|
|
|
- })
|
|
|
- if(flag){
|
|
|
- this.$message({
|
|
|
- message: this.$t('runCenter.tips.prodNums'),
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
- this.confirmDisabled = false
|
|
|
- return false
|
|
|
- }
|
|
|
- if(flagBatchNo){
|
|
|
- this.$message({
|
|
|
- message: this.$t('请选择【原料炉批号】~'),
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
- this.confirmDisabled = false
|
|
|
- return false
|
|
|
- }
|
|
|
- // 添加数据
|
|
|
- this.tenant.orderProductList = []
|
|
|
- this.tableData.map(item => {
|
|
|
- // 添加数据
|
|
|
- this.tenant.orderProductList.push({
|
|
|
- bomId: item.bomId,
|
|
|
- bomNum: item.bomNum,
|
|
|
- meterialReceiveId: item.meterialReceiveId,
|
|
|
- furnaceBatchNo: item.furnaceBatchNo,
|
|
|
- deliveryTime: item.deliveryTime,
|
|
|
- remark: item.remark
|
|
|
- })
|
|
|
- })
|
|
|
-
|
|
|
- // 验证订单是否是否有待生产产品
|
|
|
- if(this.tenant.orderProductList.length == 0){
|
|
|
- this.$message({
|
|
|
- message: this.$t('runCenter.tips.prods'),
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
- this.confirmDisabled = false
|
|
|
- return false
|
|
|
- }
|
|
|
-
|
|
|
- if (this.type === 'add') {
|
|
|
- this.save()
|
|
|
- } else {
|
|
|
- this.update()
|
|
|
- }
|
|
|
- } else {
|
|
|
- return false
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- save () {
|
|
|
- orderMgrApi.save(this.tenant)
|
|
|
- .then((response) => {
|
|
|
- const res = response.data
|
|
|
- if (res.isSuccess) {
|
|
|
- this.isVisible = false
|
|
|
- this.$message({
|
|
|
- message: this.$t('tips.createSuccess'),
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- // 通知列表
|
|
|
- this.$emit("success");
|
|
|
- // 通知列表-并关闭弹出框
|
|
|
- this.$emit("close");
|
|
|
- }
|
|
|
- }).finally(() => {
|
|
|
- this.confirmDisabled = false
|
|
|
- return true
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- update () {
|
|
|
- orderMgrApi.update(this.tenant)
|
|
|
- .then((response) => {
|
|
|
- const res = response.data
|
|
|
- if (res.isSuccess) {
|
|
|
- this.isVisible = false
|
|
|
- this.$message({
|
|
|
- message: this.$t('tips.updateSuccess'),
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- // 通知列表
|
|
|
- this.$emit("success");
|
|
|
- // 通知列表-并关闭弹出框
|
|
|
- this.$emit("close");
|
|
|
- }
|
|
|
- }).finally(() => {
|
|
|
- this.confirmDisabled = false
|
|
|
- return true
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- // 客户下拉数据
|
|
|
- customerList(){
|
|
|
- customerMgrApi.getList({}).then(res => {
|
|
|
- res = res.data
|
|
|
- if(res.isSuccess){
|
|
|
- // console.log("88888== ",res)
|
|
|
- this.customList = res.data.data
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- //获取产线数据
|
|
|
- getZoneList(){
|
|
|
- areaMgrApi.getList({status:1}).then(res => {
|
|
|
- res = res.data
|
|
|
- if(res.isSuccess){
|
|
|
- this.zoneList = res.data
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // [BOM产品]数据-修改的时候
|
|
|
- getBomList(){
|
|
|
- orderDetailApi.getList({orderId: this.tenant.id}).then(res => {
|
|
|
- res = res.data
|
|
|
- if(res.isSuccess){
|
|
|
- this.tableData = res.data
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-</script>
|
|
|
-<style lang="scss" >
|
|
|
-.avatar-uploader .el-upload {
|
|
|
- border: 1px dashed #d9d9d9;
|
|
|
- border-radius: 6px;
|
|
|
- cursor: pointer;
|
|
|
- position: relative;
|
|
|
- overflow: hidden;
|
|
|
-}
|
|
|
-.avatar-uploader .el-upload:hover {
|
|
|
- border-color: #409eff;
|
|
|
-}
|
|
|
-.avatar-uploader-icon {
|
|
|
- font-size: 28px;
|
|
|
- color: #8c939d;
|
|
|
- width: 100px;
|
|
|
- height: 100px;
|
|
|
- line-height: 100px;
|
|
|
- text-align: center;
|
|
|
-}
|
|
|
-.avatar {
|
|
|
- width: 100px;
|
|
|
- height: 100px;
|
|
|
- display: block;
|
|
|
-}
|
|
|
-.checkUsed{
|
|
|
- display: inline-block;
|
|
|
- margin-left: 10px;
|
|
|
- color: #1890ff;
|
|
|
-}
|
|
|
-</style>
|
|
|
+<template>
|
|
|
+ <el-dialog
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :close-on-press-escape="false"
|
|
|
+ :title="title"
|
|
|
+ :append-to-body="true"
|
|
|
+ :visible.sync="isVisible"
|
|
|
+ width="950px"
|
|
|
+ top="50px"
|
|
|
+ >
|
|
|
+ <el-form
|
|
|
+ ref="form"
|
|
|
+ :disabled="formDisabled"
|
|
|
+ :model="tenant"
|
|
|
+ :rules="rules"
|
|
|
+ label-position="right"
|
|
|
+ label-width="100px"
|
|
|
+ >
|
|
|
+ <!--订单名称-->
|
|
|
+ <el-form-item :label="$t("runCenter.form.orderName")+":"" prop="orderName">
|
|
|
+ <el-input v-model="tenant.orderName" :placeholder='$t("common.pleaseEnter")' style="width: 50%;"/>
|
|
|
+ </el-form-item>
|
|
|
+ <!-- 所属产线 -->
|
|
|
+ <el-form-item
|
|
|
+ :label="$t("runCenter.form.zoneId")+":""
|
|
|
+ prop="zoneId"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ v-model="tenant.zoneId"
|
|
|
+ :placeholder="$t("common.pleaseSelect")"
|
|
|
+ style="width: 50%;"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in zoneList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <!-- 交付时间 -->
|
|
|
+ <el-form-item
|
|
|
+ :label="$t("runCenter.form.deliveryTime")+":""
|
|
|
+ prop="deliveryTime"
|
|
|
+ >
|
|
|
+ <el-date-picker
|
|
|
+ v-model="tenant.deliveryTime"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ :placeholder="$t("common.pleaseSelect")"
|
|
|
+ :picker-options="pickerOptions"
|
|
|
+ style="width: 50%;"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <!-- 下单时间 -->
|
|
|
+ <el-form-item
|
|
|
+ :label="$t("runCenter.form.orderTime")+":""
|
|
|
+ prop="orderTime"
|
|
|
+ >
|
|
|
+ <el-date-picker
|
|
|
+ v-model="tenant.orderTime"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ :placeholder="$t("common.pleaseSelect")"
|
|
|
+ :picker-options="pickerOptions"
|
|
|
+ style="width: 50%;"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <!-- 启用状态 -->
|
|
|
+ <el-form-item
|
|
|
+ :label="$t("runCenter.form.status")+":""
|
|
|
+ prop="status"
|
|
|
+ >
|
|
|
+ <template>
|
|
|
+ <el-radio
|
|
|
+ v-model="tenant.status"
|
|
|
+ label="1"
|
|
|
+ >
|
|
|
+ {{ $t("common.show") }}
|
|
|
+ </el-radio>
|
|
|
+ <el-radio
|
|
|
+ v-model="tenant.status"
|
|
|
+ label="0"
|
|
|
+ >
|
|
|
+ {{ $t("common.hide") }}
|
|
|
+ </el-radio>
|
|
|
+ </template>
|
|
|
+ </el-form-item>
|
|
|
+ <!-- 零件 -->
|
|
|
+ <el-form-item
|
|
|
+ :label="$t("runCenter.form.lingjian")+":""
|
|
|
+ prop="product"
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ :disabled="type == 'view' ? true : false"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ size="small"
|
|
|
+ circle
|
|
|
+ @click="add"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <!-- Table数据 -->
|
|
|
+ <el-table
|
|
|
+ ref="table"
|
|
|
+ :data="tableData"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ style="width: 100%;"
|
|
|
+ >
|
|
|
+ <!-- 零部件编号 -->
|
|
|
+ <el-table-column
|
|
|
+ prop="partsNo"
|
|
|
+ :label="$t("runCenter.table.orderSldPro.partsNo")"
|
|
|
+ align="center"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ width="120px"
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <span>{{ row.partsNo }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <!-- 产品代号 -->
|
|
|
+ <el-table-column
|
|
|
+ prop="bomAlias"
|
|
|
+ :label="$t("runCenter.table.orderSldPro.bomAlias")"
|
|
|
+ align="center"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ width="100px"
|
|
|
+ />
|
|
|
+ <!-- 零件名称 -->
|
|
|
+ <el-table-column
|
|
|
+ prop="bomName"
|
|
|
+ :label="$t("runCenter.table.orderSldPro.name")"
|
|
|
+ align="center"
|
|
|
+ width="100px"
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ {{ row.name || row.bomName }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <!-- 零件代号 -->
|
|
|
+ <el-table-column
|
|
|
+ prop="partsAlias"
|
|
|
+ :label="$t("runCenter.table.orderSldPro.partsAlias")"
|
|
|
+ align="center"
|
|
|
+ width="100px"
|
|
|
+ />
|
|
|
+ <!-- 零件批号 -->
|
|
|
+ <!--<el-table-column
|
|
|
+ prop="brand"
|
|
|
+ :label="$t("runCenter.table.orderSldPro.brand")"
|
|
|
+ align="center"
|
|
|
+ width="100px"
|
|
|
+ />-->
|
|
|
+ <!-- 原料炉批号 -->
|
|
|
+ <el-table-column
|
|
|
+ prop="furnaceBatchNo"
|
|
|
+ label="原料炉批号"
|
|
|
+ align="center"
|
|
|
+ width="150px"
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <div style="color: #42d885;cursor: pointer;" @click="changeMetral(row)">
|
|
|
+ <span v-if="row.furnaceBatchNo">{{ row.furnaceBatchNo }}</span>
|
|
|
+ <a v-else>请选择</a>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <!-- 数量 -->
|
|
|
+ <el-table-column
|
|
|
+ prop="bomNum"
|
|
|
+ :label="$t("runCenter.table.orderSldPro.bomNum")"
|
|
|
+ width="150px"
|
|
|
+ align="center"
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-input-number
|
|
|
+ v-model="row.bomNum"
|
|
|
+ :min="1"
|
|
|
+ :max="999999999"
|
|
|
+ :label="$t("common.pleaseEnter")"
|
|
|
+ size="small"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="deliveryTime"
|
|
|
+ :label="$t("runCenter.table.orderSldPro.deliveryTime")"
|
|
|
+ width="220px"
|
|
|
+ align="center"
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="row.deliveryTime"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ size="small"
|
|
|
+ :placeholder="$t("common.pleaseSelect")"
|
|
|
+ :picker-options="pickerOptions"
|
|
|
+ style="width: 100%;"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="remark"
|
|
|
+ :label="$t("common.remark")"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ width="180px"
|
|
|
+ align="center"
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-input
|
|
|
+ v-model="row.remark"
|
|
|
+ size="small"
|
|
|
+ :label="$t("common.pleaseEnter")"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ v-if="type != 'view'"
|
|
|
+ :label="$t('table.operation')"
|
|
|
+ fixed="right"
|
|
|
+ align="center"
|
|
|
+ column-key="operation"
|
|
|
+ width="60px"
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <!--<el-tooltip class="item" :content='$t("common.edit")' effect="dark" placement="top-start">
|
|
|
+ <i
|
|
|
+ class="el-icon-edit table-operation"
|
|
|
+ style="color: #2db7f5;"
|
|
|
+ @click="edit(row)"
|
|
|
+ />
|
|
|
+ </el-tooltip>-->
|
|
|
+ <el-tooltip
|
|
|
+ class="item"
|
|
|
+ :content="$t("common.delete")"
|
|
|
+ effect="dark"
|
|
|
+ placement="top-start"
|
|
|
+ >
|
|
|
+ <i
|
|
|
+ class="el-icon-delete table-operation"
|
|
|
+ style="color: #f50;"
|
|
|
+ @click="domDelete(row)"
|
|
|
+ />
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-form>
|
|
|
+ <div
|
|
|
+ slot="footer"
|
|
|
+ class="dialog-footer"
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ plain
|
|
|
+ type="warning"
|
|
|
+ @click="isVisible = false"
|
|
|
+ >
|
|
|
+ {{ $t('common.cancel') }}
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ plain
|
|
|
+ type="primary"
|
|
|
+ :disabled="confirmDisabled"
|
|
|
+ @click="submitForm"
|
|
|
+ >
|
|
|
+ {{ $t('common.confirm') }}
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 选择数据的组件 -->
|
|
|
+ <select-table
|
|
|
+ ref="edit"
|
|
|
+ :dialog-visible="dialog.isVisible"
|
|
|
+ :title="dialog.title"
|
|
|
+ @close="editClose"
|
|
|
+ @success="editSuccess"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 选择数据的组件 -->
|
|
|
+ <meterial-select
|
|
|
+ ref="meterial"
|
|
|
+ :dialog-visible="dialogMeterial.isVisible"
|
|
|
+ :title="dialogMeterial.title"
|
|
|
+ @close="editMeterialClose"
|
|
|
+ @success="editMeterialSuccess"
|
|
|
+ />
|
|
|
+
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+ // 日期格式化组件
|
|
|
+ import moment from 'moment'
|
|
|
+ // 选择【新增】组件
|
|
|
+ import SelectTable from "./Select"
|
|
|
+ // 选择【原料炉批号】组件
|
|
|
+ import MeterialSelect from "./MeterialSelect"
|
|
|
+ // 【客户管理】-API
|
|
|
+ import customerMgrApi from "@/api/basicConfiguration/customerMgr"
|
|
|
+ //【所属产线】-API
|
|
|
+ import areaMgrApi from "@/api/resourceProductMgr/areaMgr"
|
|
|
+ // 【订单管理】-API
|
|
|
+ import orderMgrApi from "@/api/runManageCenter/orderMgr"
|
|
|
+ // 【订单明细】-API
|
|
|
+ import orderDetailApi from "@/api/runManageCenter/orderDetail"
|
|
|
+ import { arrReduce } from '@/utils/commons'
|
|
|
+export default {
|
|
|
+ name: 'TenantEdit',
|
|
|
+ components: { SelectTable, MeterialSelect },
|
|
|
+ props: {
|
|
|
+ dialogVisible: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
+ title: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ type: 'add',
|
|
|
+ tenant: this.initTenant(),
|
|
|
+ screenWidth: 0,
|
|
|
+ width: this.initWidth(),
|
|
|
+ confirmDisabled: false,
|
|
|
+ dialog: {
|
|
|
+ isVisible: false,
|
|
|
+ title: ""
|
|
|
+ },
|
|
|
+ dialogMeterial: {
|
|
|
+ isVisible: false,
|
|
|
+ title: ""
|
|
|
+ },
|
|
|
+ customList: [],
|
|
|
+ currRow: {}, // 当前选择的Row
|
|
|
+ zoneList: [],
|
|
|
+ tableData: [],
|
|
|
+ dicts:{
|
|
|
+ NATION: {}
|
|
|
+ },
|
|
|
+ roles: [],
|
|
|
+ pickerOptions: {
|
|
|
+ disabledDate: (time) => {
|
|
|
+ return time.getTime() < Date.now() - 86400000;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ custId: [
|
|
|
+ { required: true, message: this.$t("rules.require"), trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ deliveryTime: [
|
|
|
+ { required: true, message: this.$t("rules.require"), trigger: 'change' }
|
|
|
+ ],
|
|
|
+ orderTime: [
|
|
|
+ { required: true, message: this.$t("rules.require"), trigger: 'change' }
|
|
|
+ ],
|
|
|
+ status: [
|
|
|
+ { required: true, message: this.$t("rules.require"), trigger: 'change' }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ formDisabled(){
|
|
|
+ if(this.type == "view"){
|
|
|
+ this.confirmDisabled = true
|
|
|
+ return true
|
|
|
+ }else{
|
|
|
+ this.confirmDisabled = false
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ isVisible: {
|
|
|
+ get () {
|
|
|
+ // 清空数据
|
|
|
+ this.tableData = [];
|
|
|
+ return this.dialogVisible
|
|
|
+ },
|
|
|
+ set () {
|
|
|
+ this.close()
|
|
|
+ this.reset()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
|
|
|
+ created() {
|
|
|
+ // 加载客户列表数据
|
|
|
+ this.customerList()
|
|
|
+ this.getZoneList()
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ window.onresize = () => {
|
|
|
+ return (() => {
|
|
|
+ this.width = this.initWidth()
|
|
|
+ })()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 【原料炉批号】点击-事件
|
|
|
+ changeMetral(row) {
|
|
|
+ // 当前选择的行。row
|
|
|
+ this.currRow = row;
|
|
|
+ this.$refs.meterial.type = "edit";
|
|
|
+ this.$refs.meterial.setTenant(row);
|
|
|
+ this.dialogMeterial.title = "选择原料炉批号";
|
|
|
+ this.dialogMeterial.isVisible = true;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 【原料炉批号-修改】弹出框,关闭
|
|
|
+ editMeterialClose () {
|
|
|
+ this.dialogMeterial.isVisible = false
|
|
|
+ },
|
|
|
+
|
|
|
+ // 【原料炉批号-修改】弹出框,确定事件
|
|
|
+ editMeterialSuccess (obj) {
|
|
|
+ console.log("【原料炉批号-修改】: ", obj);
|
|
|
+ let arr = [];
|
|
|
+ this.tableData.map(item => {
|
|
|
+ if(item.id == this.currRow.id) {
|
|
|
+ // 赋值,原料炉批号
|
|
|
+ item.furnaceBatchNo = obj.furnaceBatchNo;
|
|
|
+ // 带入参数
|
|
|
+ item.meterialReceiveId = obj.id;
|
|
|
+ }
|
|
|
+ arr.push(item);
|
|
|
+ })
|
|
|
+ // 赋值
|
|
|
+ this.tableData = arr;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 【删除】按钮-事件
|
|
|
+ domDelete(row){
|
|
|
+ this.$confirm(this.$t("tips.comTips"), this.$t("common.tips"), {
|
|
|
+ distinguishCancelAndClose: true,
|
|
|
+ confirmButtonText: this.$t("common.confirm"),
|
|
|
+ cancelButtonText: this.$t("common.cancel"),
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ // 过滤我们需要的数据
|
|
|
+ let list = this.tableData.filter(item => item.id != row.id)
|
|
|
+ // 重新赋值
|
|
|
+ this.tableData = list
|
|
|
+ }).catch(() => {})
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ // 【新增-修改】弹出框,关闭
|
|
|
+ editClose () {
|
|
|
+ this.dialog.isVisible = false
|
|
|
+ },
|
|
|
+
|
|
|
+ // 【新增-修改】弹出框,确定事件
|
|
|
+ editSuccess (arr) {
|
|
|
+ // 清除备注
|
|
|
+ arr.forEach(item => {
|
|
|
+ item.remark = "";
|
|
|
+ });
|
|
|
+ // 合并当前数组,和新增的数组
|
|
|
+ let list = [...this.tableData, ...arr];
|
|
|
+ // 去除数组中重复的数据
|
|
|
+ this.tableData = arrReduce(list, "id");
|
|
|
+ },
|
|
|
+
|
|
|
+ add () {
|
|
|
+ this.$refs.edit.type = "add"
|
|
|
+ this.dialog.title = this.$t("runCenter.common.selectPro")
|
|
|
+ this.dialog.isVisible = true
|
|
|
+ },
|
|
|
+
|
|
|
+ initTenant () {
|
|
|
+ return {
|
|
|
+ orderTime: moment(new Date()).format('YYYY-MM-DD'),
|
|
|
+ status: '1',
|
|
|
+ zoneId: '',
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ initWidth () {
|
|
|
+ this.screenWidth = document.body.clientWidth
|
|
|
+ if (this.screenWidth < 991) {
|
|
|
+ return '90%'
|
|
|
+ } else if (this.screenWidth < 1400) {
|
|
|
+ return '45%'
|
|
|
+ } else {
|
|
|
+ return '800px'
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ setTenant (val, dicts) {
|
|
|
+ if(val){
|
|
|
+ this.tenant = { ...val }
|
|
|
+ // 修改的时候,订单详情数据(BOM产品)
|
|
|
+ this.getBomList()
|
|
|
+ }
|
|
|
+ // 字典表
|
|
|
+ this.dicts = dicts
|
|
|
+ },
|
|
|
+
|
|
|
+ close () {
|
|
|
+ this.$emit('close')
|
|
|
+ },
|
|
|
+
|
|
|
+ reset () {
|
|
|
+ // 先清除校验,再清除表单,不然有奇怪的bug
|
|
|
+ this.$refs.form.clearValidate()
|
|
|
+ this.$refs.form.resetFields()
|
|
|
+ this.tenant = this.initTenant()
|
|
|
+ // 关闭时候,清空数据
|
|
|
+ this.tableData = []
|
|
|
+ },
|
|
|
+
|
|
|
+ submitForm () {
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.confirmDisabled = true
|
|
|
+ // 验证【数量】不能不填写
|
|
|
+ let flag = false, flagBatchNo = false;
|
|
|
+ this.tableData.map(item => {
|
|
|
+ if(!item.bomNum){
|
|
|
+ flag = true
|
|
|
+ }
|
|
|
+ if(!item.deliveryTime){
|
|
|
+ flag = true
|
|
|
+ }
|
|
|
+ // 验证【原料炉批号】
|
|
|
+ if(!item.furnaceBatchNo){
|
|
|
+ flagBatchNo = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(flag){
|
|
|
+ this.$message({
|
|
|
+ message: this.$t('runCenter.tips.prodNums'),
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ this.confirmDisabled = false
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if(flagBatchNo){
|
|
|
+ this.$message({
|
|
|
+ message: this.$t('请选择【原料炉批号】~'),
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ this.confirmDisabled = false
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ // 添加数据
|
|
|
+ this.tenant.orderProductList = []
|
|
|
+ this.tableData.map(item => {
|
|
|
+ // 添加数据
|
|
|
+ this.tenant.orderProductList.push({
|
|
|
+ id:item.id,
|
|
|
+ bomId: item.bomId,
|
|
|
+ bomNum: item.bomNum,
|
|
|
+ meterialReceiveId: item.meterialReceiveId,
|
|
|
+ furnaceBatchNo: item.furnaceBatchNo,
|
|
|
+ deliveryTime: item.deliveryTime,
|
|
|
+ remark: item.remark
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ // 验证订单是否是否有待生产产品
|
|
|
+ if(this.tenant.orderProductList.length == 0){
|
|
|
+ this.$message({
|
|
|
+ message: this.$t('runCenter.tips.prods'),
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ this.confirmDisabled = false
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.type === 'add') {
|
|
|
+ this.save()
|
|
|
+ } else {
|
|
|
+ this.update()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ save () {
|
|
|
+ orderMgrApi.save(this.tenant)
|
|
|
+ .then((response) => {
|
|
|
+ const res = response.data
|
|
|
+ if (res.isSuccess) {
|
|
|
+ this.isVisible = false
|
|
|
+ this.$message({
|
|
|
+ message: this.$t('tips.createSuccess'),
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ // 通知列表
|
|
|
+ this.$emit("success");
|
|
|
+ // 通知列表-并关闭弹出框
|
|
|
+ this.$emit("close");
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ this.confirmDisabled = false
|
|
|
+ return true
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ update () {
|
|
|
+ orderMgrApi.update(this.tenant)
|
|
|
+ .then((response) => {
|
|
|
+ const res = response.data
|
|
|
+ if (res.isSuccess) {
|
|
|
+ this.isVisible = false
|
|
|
+ this.$message({
|
|
|
+ message: this.$t('tips.updateSuccess'),
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ // 通知列表
|
|
|
+ this.$emit("success");
|
|
|
+ // 通知列表-并关闭弹出框
|
|
|
+ this.$emit("close");
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ this.confirmDisabled = false
|
|
|
+ return true
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 客户下拉数据
|
|
|
+ customerList(){
|
|
|
+ customerMgrApi.getList({}).then(res => {
|
|
|
+ res = res.data
|
|
|
+ if(res.isSuccess){
|
|
|
+ // console.log("88888== ",res)
|
|
|
+ this.customList = res.data.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //获取产线数据
|
|
|
+ getZoneList(){
|
|
|
+ areaMgrApi.getList({status:1}).then(res => {
|
|
|
+ res = res.data
|
|
|
+ if(res.isSuccess){
|
|
|
+ this.zoneList = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // [BOM产品]数据-修改的时候
|
|
|
+ getBomList(){
|
|
|
+ orderDetailApi.getList({orderId: this.tenant.id}).then(res => {
|
|
|
+ res = res.data
|
|
|
+ if(res.isSuccess){
|
|
|
+ this.tableData = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style lang="scss" >
|
|
|
+.avatar-uploader .el-upload {
|
|
|
+ border: 1px dashed #d9d9d9;
|
|
|
+ border-radius: 6px;
|
|
|
+ cursor: pointer;
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+}
|
|
|
+.avatar-uploader .el-upload:hover {
|
|
|
+ border-color: #409eff;
|
|
|
+}
|
|
|
+.avatar-uploader-icon {
|
|
|
+ font-size: 28px;
|
|
|
+ color: #8c939d;
|
|
|
+ width: 100px;
|
|
|
+ height: 100px;
|
|
|
+ line-height: 100px;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+.avatar {
|
|
|
+ width: 100px;
|
|
|
+ height: 100px;
|
|
|
+ display: block;
|
|
|
+}
|
|
|
+.checkUsed{
|
|
|
+ display: inline-block;
|
|
|
+ margin-left: 10px;
|
|
|
+ color: #1890ff;
|
|
|
+}
|
|
|
+</style>
|