123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791 |
- <template>
- <div style="padding: 20px 10px 0 0">
- <el-form ref="ruleForm" :model="form" :rules="formRules" label-width="90px">
- <el-row>
- <el-col :span="24">
- <el-col :span="12">
- <el-form-item label="品牌:">
- <span>{{ form.brandName }}</span>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="型号:">
- <span>{{ form.productModelChinese }}</span>
- </el-form-item>
- </el-col>
- </el-col>
- </el-row>
- <el-form-item label="材质:">
- <span>{{ form.materialChinese }}</span>
- </el-form-item>
- <div style="padding-left: 80px">
- <el-table :data="form.colors" :cell-style="{ padding: '0' }" :row-style="{ height: '35px' }" v-loading="loading" header-row-class-name="tableHeader">
- <el-table-column type="expand">
- <template slot-scope="props">
- <div style="padding: 8px 20px 0px">
- <el-row :gutter="10">
- <el-col :span="12">
- <div style="display: flex; margin-bottom: 10px">
- <el-button size="mini" type="primary" @click="handleOpenOftenDialog(props.$index)">选择常用包材</el-button>
- <el-button size="mini" type="primary" style="background: #20b2aa; border-color: #20b2aa" @click="openSaveOftenDialog(props.$index)"
- >保存常用包材</el-button
- >
- <el-button size="mini" type="primary" @click="handleOpenTwoBOM(props.$index)">选择包材配件</el-button>
- </div>
- <el-table :data="props.row.mountingsList" size="small" :row-style="{ height: '35px' }" :cell-style="{ padding: '0' }" border ref="table">
- <el-table-column label="数量" width="160">
- <template slot-scope="scope">
- <el-form-item
- label-width="0px"
- :prop="'colors.' + props.$index + '.mountingsList.' + scope.$index + '.quantity'"
- :rules="formRules.quantity"
- class="input"
- >
- <el-input-number
- style="width: 100%"
- size="mini"
- v-model="scope.row.quantity"
- :controls="false"
- :min="1"
- :max="10000000"
- :precision="0"
- />
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="名称" prop="bomColorName" min-width="150" />
- <el-table-column label="操作" align="center" width="80" fixed="right">
- <template slot-scope="scope">
- <span
- class="el-icon-remove-outline"
- style="font-size: 16px; cursor: pointer; color: #d9001b"
- @click="removeTwoBOM(props.$index, scope.$index)"
- ></span>
- </template>
- </el-table-column>
- </el-table>
- </el-col>
- <el-col :span="12">
- <div style="display: flex; margin-bottom: 10px">
- <el-button size="mini" type="primary" @click="clickSelectBOM(props.$index)">选择快递包装</el-button>
- </div>
- <el-table :data="props.row.exPackList" size="small" :row-style="{ height: '35px' }" :cell-style="{ padding: '0' }" border ref="table">
- <el-table-column label="数量" width="130">
- <template slot-scope="scope">
- <el-form-item
- label-width="0px"
- :prop="'colors.' + props.$index + '.exPackList.' + scope.$index + '.quantity'"
- :rules="formRules.quantity"
- class="input"
- >
- <el-input-number
- style="width: 100%"
- size="mini"
- v-model="scope.row.quantity"
- :controls="false"
- :min="1"
- :max="10000000"
- :precision="0"
- />
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="名称" prop="bomColorName" min-width="140" />
- <el-table-column label="操作" align="center" width="80" fixed="right">
- <template slot-scope="scope">
- <span
- class="el-icon-remove-outline"
- style="font-size: 16px; cursor: pointer; color: #d9001b"
- @click="removePackingBOM(props.$index, scope.$index)"
- ></span>
- </template>
- </el-table-column>
- </el-table>
- </el-col>
- </el-row>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="规格图" align="center" width="70">
- <template slot-scope="scope">
- <el-upload
- class="avatar-uploader"
- :action="action"
- :headers="{ 'Blade-Auth': token }"
- :show-file-list="false"
- :before-upload="beforeAvatarUpload"
- :on-success="
- (response, file, fileList) => {
- return uploadSuccess(response, file, fileList, scope.$index)
- }
- "
- :on-error="
- (err, file, fileList) => {
- return uploadError(err, file, fileList, scope.$index)
- }
- "
- :on-progress="
- (event, file, fileList) => {
- return uploadProgress(event, file, fileList, scope.$index)
- }
- "
- :disabled="judgeStatus(scope.row)"
- accept=".jpg, .png, .jpeg"
- >
- <div v-loading="scope.row.loading">
- <div v-if="scope.row.colorAccessory">
- <img
- v-if="!scope.row.colorAccessory.includes('https')"
- :src="pathPrefix + scope.row.colorAccessory"
- class="productImg"
- style="width: 50px; height: 50px"
- />
- <img v-else class="productImg" style="width: 50px; height: 50px" :src="scope.row.colorAccessory" />
- </div>
- <i v-else class="el-icon-plus avatar-uploader-icon"></i>
- </div>
- </el-upload>
- </template>
- </el-table-column>
- <el-table-column label="设计图" align="center" width="70" v-if="userInfo.subsidiaryId">
- <template slot-scope="scope">
- <el-upload
- class="avatar-uploader"
- :action="action"
- :headers="{ 'Blade-Auth': token }"
- :show-file-list="false"
- :before-upload="beforeAvatarUpload"
- :on-success="
- (response, file, fileList) => {
- return uploadSuccess1(response, file, fileList, scope.$index)
- }
- "
- :on-error="
- (err, file, fileList) => {
- return uploadError1(err, file, fileList, scope.$index)
- }
- "
- :on-progress="
- (event, file, fileList) => {
- return uploadProgress1(event, file, fileList, scope.$index)
- }
- "
- :disabled="scope.row.loading1"
- accept=".jpg, .png, .jpeg"
- >
- <div v-loading="scope.row.loading1">
- <div v-if="scope.row.designSketch">
- <img
- v-if="!scope.row.designSketch.includes('https')"
- :src="pathPrefix + scope.row.designSketch"
- class="productImg"
- style="width: 50px; height: 50px"
- />
- <img v-else class="productImg" style="width: 50px; height: 50px" :src="scope.row.designSketch" />
- </div>
- <i v-else class="el-icon-plus avatar-uploader-icon"></i>
- </div>
- </el-upload>
- </template>
- </el-table-column>
- <el-table-column label="品号" align="left" width="170">
- <template slot-scope="scope">
- <el-form-item :prop="'colors.' + scope.$index + '.specCode'" :rules="formRules.specCode" label-width="0px">
- <el-input v-model="scope.row.specCode" placeholder="请输入" size="small" style="width: 100%" v-if="judgeSubsidiaryId()"></el-input>
- <span v-else>{{ scope.row.specCode }}</span>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="品名" align="left" min-width="200">
- <template slot-scope="scope">
- <el-form-item :prop="'colors.' + scope.$index + '.nameChinese'" :rules="formRules.nameChinese" label-width="0px">
- <el-input v-model="scope.row.nameChinese" placeholder="请输入" size="small" style="width: 100%" v-if="judgeSubsidiaryId()"></el-input>
- <span v-else>{{ scope.row.nameChinese }}</span>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="加工版面" align="left" width="140">
- <template slot-scope="scope">
- <el-form-item label-width="0px">
- <el-select v-model="scope.row.processingLayout" placeholder="请选择加工版面" size="small" style="width: 100%" v-if="judgeSubsidiaryId()">
- <el-option v-for="item in processingLayout" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
- </el-select>
- <span v-else>{{ getNameProcessingLayout(scope.row) }}</span>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="尺寸(长宽高,cm)" align="left" width="240">
- <template slot-scope="scope">
- <el-row v-if="judgeSubsidiaryId()">
- <el-col :span="8" style="padding: 0px 5px">
- <el-form-item :prop="'colors.' + scope.$index + '.length'" :rules="formRules.length" label-width="0px">
- <el-input v-model="scope.row.length" placeholder="长" size="small" style="width: 70%"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8" style="padding: 0px 5px">
- <el-form-item :prop="'colors.' + scope.$index + '.width'" :rules="formRules.width" label-width="0px">
- <el-input v-model="scope.row.width" placeholder="宽" size="small" style="width: 70%"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8" style="padding: 0px 5px">
- <el-form-item :prop="'colors.' + scope.$index + '.height'" :rules="formRules.height" label-width="0px">
- <el-input v-model="scope.row.height" placeholder="高" size="small" style="width: 70%"></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <span v-else>{{ scope.row.length }} * {{ scope.row.width }} * {{ scope.row.height }}</span>
- </template>
- </el-table-column>
- <el-table-column label="净重(g)" align="left" width="100">
- <template slot-scope="scope">
- <el-form-item :prop="'colors.' + scope.$index + '.weight'" :rules="formRules.weight" label-width="0px">
- <el-input v-model="scope.row.weight" placeholder="净重" size="small" style="width: 90%" v-if="judgeSubsidiaryId()"></el-input>
- <span v-else>{{ scope.row.weight }}</span>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="共享文件夹" align="left" width="100" v-if="userInfo.subsidiaryId">
- <template slot-scope="scope">
- <span style="color: #027db4; cursor: pointer" @click="handleClickUpload(scope.row.artworkDocument)">上传ez3/dxf</span>
- </template>
- </el-table-column>
- <el-table-column label="BOM" align="left" width="250">
- <template slot-scope="scope">
- <div>
- <el-button
- v-if="!scope.row.bomList.length > 0 && !userInfo.subsidiaryId"
- type="primary"
- size="mini"
- @click="handleOpen(scope.$index)"
- style="margin: 5px 0; background-color: #43b214; border-color: #43b214"
- >选择BOM</el-button
- >
- <div v-for="(item, index) in scope.row.bomList" :key="index">
- <div>{{ item.bomColorSpecCode }}</div>
- <div style="display: flex; align-items: center">
- <span
- class="el-icon-remove-outline"
- style="font-size: 16px; cursor: pointer"
- v-if="!userInfo.subsidiaryId"
- @click="removeBOM(index, scope.$index)"
- ></span>
- <img
- v-if="item.magPath"
- :src="pathPrefix + item.magPath"
- class="productImg"
- style="margin: 0px 10px; width: 36px; height: 36px"
- @click="openFile(pathPrefix + item.magPath)"
- />
- <span>{{ item.bomColorName }}</span>
- </div>
- </div>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="60" align="center" v-if="!userInfo.subsidiaryId">
- <template slot-scope="scope">
- <el-button type="text" @click="handleDelete(scope.row, scope.$index)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </el-form>
- <!-- 选择BOM -->
- <el-dialog title="选择BOM" v-if="openBOM" top="50px" :visible.sync="openBOM" width="90%" append-to-body center>
- <SelectBOM @selectBOM="handleSelectBOM" ref="SelectBOM"></SelectBOM>
- <span slot="footer" class="dialog-footer">
- <el-button @click="openBOM = false">关 闭</el-button>
- </span>
- </el-dialog>
- <el-dialog v-if="openOftenDialog" :visible.sync="openOftenDialog" title="选择常用包材" width="60%" append-to-body>
- <el-form :model="composeQuery" ref="composeForm" :inline="true">
- <el-form-item label="组合名称" prop="name">
- <el-input placeholder="请输入" v-model="composeQuery.name" clearable size="small" @keyup.enter.native="handleQuery" />
- </el-form-item>
- <el-form-item>
- <el-button size="mini" @click="handleQuery" class="searchBtn">搜索</el-button>
- <el-button size="mini" @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-form>
- <div class="compose-table">
- <el-table :data="oftenTableList" size="small" :row-style="{ height: '35px' }" :cell-style="{ padding: '0' }" header-row-class-name="tableHeader">
- <el-table-column type="expand" align="left" width="50">
- <template slot-scope="scope">
- <div>
- <el-table :data="scope.row.bomCombinationDetailsList" size="small" :row-style="{ height: '35px' }" :cell-style="{ padding: '0' }">
- <el-table-column label="主图" width="80" align="center">
- <template slot-scope="scope">
- <div v-if="scope.row.magPath">
- <img class="img" :src="pathPrefix + scope.row.magPath" @click="openFile(pathPrefix + scope.row.magPath)" />
- </div>
- </template>
- </el-table-column>
- <el-table-column label="品号" prop="bomColorspecCode" />
- <el-table-column label="品名" prop="bomColorName" />
- <el-table-column label="数量" prop="singleQuantity" width="80" />
- <el-table-column label="单价¥" prop="price" width="80" align="right" />
- </el-table>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="组合名称" prop="name" align="left" />
- <el-table-column label="操作" align="center" width="120" fixed="right">
- <template slot-scope="scope">
- <el-button type="text" @click="removeCompose(scope.row.id)">删 除</el-button>
- <el-button type="text" @click="selectCompose(scope.row)">选择</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <el-row style="text-align: center; margin-top: 30px">
- <el-button size="small" @click="openOftenDialog = false">取 消</el-button>
- </el-row>
- </el-dialog>
- <el-dialog v-if="saveOftenDialog" :visible.sync="saveOftenDialog" title="保存常用包材" width="40%" append-to-body>
- <el-form label-width="120px" :model="saveform" ref="saveform" :rules="rules">
- <el-form-item label="常用包材名称:" prop="name">
- <el-input v-model="saveform.name" placeholder="请输入"> </el-input>
- </el-form-item>
- </el-form>
- <el-row style="text-align: center; margin-top: 30px">
- <el-button size="small" @click="saveCancel">取 消</el-button>
- <el-button size="small" type="primary" @click="saveOften">保 存</el-button>
- </el-row>
- </el-dialog>
- <!-- 选择包材配件-->
- <el-dialog title="选择包材配件" v-if="openTwoBOM" top="50px" :visible.sync="openTwoBOM" width="90%" append-to-body center>
- <SelectBOM @selectBOM="handleSelectTwoBOM" showType="parts" ref="SelectBOM"></SelectBOM>
- <span slot="footer" class="dialog-footer">
- <el-button @click="openTwoBOM = false">关 闭</el-button>
- </span>
- </el-dialog>
- <el-dialog title="选择快递包装" v-if="openSelect" :visible.sync="openSelect" width="80%" append-to-body>
- <SelectPackingBOM @handleSelect="handlePackingSelect"></SelectPackingBOM>
- </el-dialog>
- </div>
- </template>
- <script>
- import { mapGetters } from 'vuex'
- import SelectBOM from '@/components/shengde/SelectBOM/index'
- import SelectPackingBOM from '@/views/shengde/productionSystem/production/order/selectBOM'
- import { addColor, removeColor, addFolder } from '@/api/product/customProductLibrary'
- import { list, del, save } from '@/api/shengde/subsidiary/compose/index.js'
- export default {
- name: 'ProductMaterial',
- props: {
- form: Object,
- },
- components: { SelectBOM, SelectPackingBOM },
- data() {
- const checkRewardKey = (rule, value, callback) => {
- if (/[\u4E00-\u9FA5]/g.test(value)) {
- callback(new Error('不能输入汉字'))
- } else {
- callback()
- }
- }
- return {
- action: process.env.VUE_APP_ACTION_URL,
- pathPrefix: process.env.VUE_APP_IMG_URL,
- filePrefix: process.env.VUE_APP_FILE_PREFIX,
- formRules: {
- // brandName: [{ required: true, message: '请输入材质(EN)', trigger: 'blur' }],
- // materialChinese: [{ required: true, message: '请输入材质(CN)', trigger: 'blur' }],
- productModel: [{ required: true, message: '请输入型号(EN)', trigger: 'blur' }],
- // productModelChinese: [{ required: true, message: '请输入型号(CN)', trigger: 'blur' }],
- productLong: [{ required: true, message: '请输入长(CM)', trigger: 'blur' }],
- productWide: [{ required: true, message: '请输入宽(CM)', trigger: 'blur' }],
- productHigh: [{ required: true, message: '请输入高(CM)', trigger: 'blur' }],
- length: [{ required: true, message: '长', trigger: 'blur' }],
- width: [{ required: true, message: '宽', trigger: 'blur' }],
- height: [{ required: true, message: '高', trigger: 'blur' }],
- weight: [{ required: true, message: '净重(g)', trigger: 'blur' }],
- code: [{ required: true, message: '请输入', trigger: 'blur' }],
- // packagLong: [{ required: true, message: '请输入长(CM)', trigger: 'blur' }],
- // packagWide: [{ required: true, message: '请输入宽(CM)', trigger: 'blur' }],
- specCode: [
- { required: true, message: '请输入品号', trigger: 'blur' },
- { validator: checkRewardKey, trigger: 'blur' },
- ],
- // netWeight: [{ required: true, message: '请输入净重(g)', trigger: 'blur' }],
- nameChinese: [{ required: true, message: '请输入品名', trigger: 'blur' }],
- quantity: [{ required: true, message: '请输入数量', trigger: 'blur' }],
- },
- loading: false,
- openBOM: false,
- rowIndex: null, //行index
- oftenTableList: [],
- selectIndex: undefined,
- openOftenDialog: false,
- saveOftenList: [],
- saveOftenDialog: false,
- openTwoBOM: false,
- composeQuery: {
- name: '',
- pageSize: 999,
- pageNum: 1,
- },
- saveform: {
- name: '',
- bomCombinationDetailsList: [],
- },
- rules: {
- name: [{ required: true, message: '请输入常用包材配组合名称', trigger: 'blur' }],
- },
- openSelect: false,
- selectPackingIndex: 0,
- processingLayout: [],
- }
- },
- created() {
- this.processingLayout = this.dictData.filter((item) => item.code === 'processing_layout')[0].children
- },
- mounted() {},
- computed: mapGetters(['userInfo', 'token', 'dictData']),
- methods: {
- handleAddColor() {
- this.loading = true
- addColor().then(
- (res) => {
- let path = res.data.data.replace(/\//g, '\\')
- this.form.colors.push({
- productId: '',
- nameChinese: '',
- colorAccessory: '',
- loading: false,
- artworkDocument: path,
- length: '',
- width: '',
- height: '',
- bomList: [],
- designSketch: '',
- mountingsList: [],
- exPackList: [],
- })
- this.loading = false
- },
- (err) => {
- console.log('addColor:' + err)
- this.loading = false
- }
- )
- },
- handleDelete(row, index) {
- this.$confirm('确认删除该行数据?', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- }).then(() => {
- this.loading = true
- let path = row.artworkDocument.replace(/\\/g, '/')
- removeColor(path).then(
- () => {
- this.form.colors.splice(index, 1)
- this.msgSuccess('删除成功!')
- this.loading = false
- },
- (err) => {
- console.log('removeColor:' + err)
- this.loading = false
- }
- )
- })
- },
- validateForm() {
- let flag = null
- this.$refs.ruleForm.validate((valid) => {
- if (valid) {
- if (this.form.colors.length > 0) {
- for (let j = 0; j < this.form.colors.length; j++) {
- const jele = this.form.colors[j]
- jele.artworkDocument = jele.artworkDocument.replace(/\\/g, '/')
- }
- flag = true
- } else this.msgInfo('请添加颜色!')
- } else {
- flag = false
- }
- })
- return flag
- },
- beforeAvatarUpload(file) {
- let fileType = this.getFileType(file.name)
- if (['jpg', 'png', 'jpeg'].includes(fileType)) {
- // const isLt5M = file.size / 1024 / 1024 < 5
- // if (!isLt5M) {
- // this.$message.error('上传图片大小不能超过 5MB!')
- // }
- // return isLt5M
- } else {
- this.msgInfo('请上传jpg,png,jpeg格式的文件')
- return false
- }
- },
- uploadSuccess(response, file, fileList, index) {
- this.form.colors[index].loading = false
- this.form.colors[index].colorAccessory = response.data.details.path
- },
- uploadError(response, file, fileList, index) {
- this.form.colors[index].loading = false
- },
- uploadProgress(event, file, fileList, index) {
- this.form.colors[index].loading = true
- },
- uploadError1(response, file, fileList, index) {
- this.form.colors[index].loading1 = false
- },
- uploadProgress1(event, file, fileList, index) {
- this.form.colors[index].loading1 = true
- },
- uploadSuccess1(response, file, fileList, index) {
- this.form.colors[index].loading1 = false
- this.form.colors[index].designSketch = response.data.details.path
- },
- openFile(path) {
- window.open(path)
- },
- handleOpen(index) {
- this.rowIndex = index
- this.openBOM = true
- },
- handleSelectBOM(row, index) {
- // 多个bom写法
- // let data = row.bomColors[index]
- // this.form.colors[this.rowIndex].bomList.push(data)
- // this.msgSuccess('选择成功!')
- // this.openBOM=false
- //单个bom写法
- let arr = []
- let data = row.bomColors[index]
- let submitData = {
- id: row.id,
- bomColorId: data.id,
- bomColorName: data.nameChinese,
- magPath: data.magPath,
- }
- arr.push(submitData)
- this.form.colors[this.rowIndex].bomList = arr
- this.msgSuccess('选择成功!')
- this.openBOM = false
- },
- removeBOM(index, parentIndex) {
- this.$confirm('确认删除该BOM?', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- })
- .then(() => {
- this.form.colors[parentIndex].bomList.splice(index, 1)
- this.msgSuccess('删除成功!')
- })
- .catch(() => {})
- },
- handleClickUpload(item) {
- let path = JSON.parse(JSON.stringify(item)).replace(/\\/g, '/')
- addFolder(path).then(
- () => {
- let a = document.createElement('a')
- a.href = 'printer://' + (this.filePrefix + path).replace(/\//g, '/') + '/'
- a.style.display = 'none'
- document.body.appendChild(a)
- a.click()
- document.body.removeChild(a)
- },
- (err) => {
- console.log('addFolder:' + err)
- }
- )
- },
- removeTwoBOM(numOne, numTwo) {
- this.$confirm('确认删除该行包材配件?', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- }).then(() => {
- this.form.colors[numOne].mountingsList.splice(numTwo, 1)
- this.msgSuccess('删除成功!')
- })
- },
- handleOpenOftenDialog(index) {
- this.handleQuery()
- this.selectIndex = index
- this.openOftenDialog = true
- },
- openSaveOftenDialog(index) {
- this.saveOftenList = this.form.colors[index].mountingsList
- this.saveOftenDialog = true
- },
- handleOpenTwoBOM(index) {
- this.selectIndex = index
- this.openTwoBOM = true
- },
- handleQuery() {
- list(this.composeQuery).then((res) => {
- this.oftenTableList = res.data.data
- })
- },
- resetQuery() {
- this.resetForm('composeForm')
- this.handleQuery()
- },
- removeCompose(id) {
- this.$confirm('是否确认删除此条包材组合?', '警告', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- }).then(() => {
- del({ id }).then(() => {
- this.msgSuccess('删除成功!')
- this.handleQuery()
- })
- })
- },
- selectCompose(row) {
- const list = row.bomCombinationDetailsList
- let arr = list.map((item) => {
- return {
- bomColorName: item.bomColorName,
- bomColorId: item.bomColorId,
- quantity: Number(item.singleQuantity),
- id: item.bomId,
- }
- })
- this.form.colors[this.selectIndex].mountingsList = arr
- this.msgSuccess('选择完成')
- },
- saveCancel() {
- this.saveOftenDialog = false
- this.saveform = {
- name: '',
- bomCombinationDetailsList: [],
- }
- },
- saveOften() {
- this.$refs['saveform'].validate((valid) => {
- if (valid) {
- let arr = this.saveOftenList.map((item) => ({ bomColorId: item.bomColorId, singleQuantity: item.singleQuantity, price: item.price }))
- this.saveform.bomCombinationDetailsList = arr
- save(this.saveform).then(() => {
- this.msgSuccess('保存成功!')
- this.saveCancel()
- })
- }
- })
- },
- handleSelectTwoBOM(data, index) {
- let list = this.form.colors[this.selectIndex].mountingsList.filter((item) => item.categoryId === data.categoryId)
- if (list && list.length > 0) {
- return this.msgInfo('该类型包材配件已添加')
- }
- let row = data.bomColors[index]
- let item = {
- bomColorName: row.nameChinese,
- id: data.id,
- bomColorId: row.id,
- categoryId: data.categoryId,
- quantity: '',
- }
- this.form.colors[this.selectIndex].mountingsList.push(item)
- this.msgSuccess('添加完成')
- },
- judgeStatus(val) {
- if (val.loading || this.userInfo.subsidiaryId) {
- return true
- } else {
- return false
- }
- },
- clickSelectBOM(index) {
- this.selectPackingIndex = index
- this.openSelect = true
- },
- handlePackingSelect(row, rowParent) {
- let data = this.form.colors[this.selectPackingIndex].exPackList.filter((item) => item.bomColorId === row.id)
- if (data && data.length > 0) {
- return this.msgInfo('快递包装已选择')
- }
- this.form.colors[this.selectPackingIndex].exPackList.push({
- id: rowParent.id,
- bomColorId: row.id,
- quantity: undefined,
- bomColorName: row.nameChinese,
- })
- this.msgSuccess('选择完成')
- },
- removePackingBOM(index, indexTwo) {
- this.form.colors[index].exPackList.splice(indexTwo, 1)
- },
- judgeSubsidiaryId() {
- if (this.userInfo.subsidiaryId) {
- return false
- }
- return true
- },
- getNameProcessingLayout(row) {
- return this.selectConstantsLabel(this.processingLayout, row.processingLayout)
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- ::v-deep {
- .el-input-number {
- .el-input__inner {
- text-align: left !important;
- }
- }
- .el-button {
- border-radius: 0;
- }
- .tableHeader th {
- background-color: #edf0f5;
- height: 35px;
- padding: 0;
- }
- .color .el-form-item__content,
- .color .el-form-item__label {
- line-height: 32px !important;
- }
- .el-form-item__error {
- top: 90%;
- }
- }
- .searchBtn {
- background: #20b2aa;
- color: #fff;
- border: 1px solid #20b2aa;
- }
- .productImg {
- width: 60px;
- height: 60px;
- cursor: pointer;
- object-fit: contain;
- vertical-align: middle;
- border: none;
- }
- .avatar-uploader-icon {
- margin: 4px 0;
- font-size: 28px;
- color: rgb(140, 147, 157);
- border: 1px dashed #d9d9d9;
- background-color: #fbfdff;
- border-radius: 2px;
- width: 50px;
- height: 50px;
- line-height: 50px;
- text-align: center;
- &:hover {
- border-color: #409eff;
- }
- }
- </style>
|