|
@@ -321,7 +321,7 @@
|
|
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
|
|
|
|
|
<!-- 添加或修改资产信息对话框 -->
|
|
|
- <el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body @close="dialogColose">
|
|
|
+ <el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body>
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="130px">
|
|
|
<el-row :gutter="10">
|
|
|
<el-col :span="8">
|
|
@@ -628,8 +628,8 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
<el-dialog title="标签打印" :visible.sync="isPrinter" width="400px" append-to-body>
|
|
|
- <el-form ref="printForm" :model="printForm" :rules="printRules" label-width="80px">
|
|
|
- <el-form-item label="资产编号" prop="ids">
|
|
|
+ <el-form ref="printForm" :model="printForm" :rules="printRules" label-width="80px" v-if="!isSinglePrinter">
|
|
|
+ <el-form-item label="资产ID" prop="ids">
|
|
|
{{ printForm.ids }}
|
|
|
</el-form-item>
|
|
|
<el-form-item label="标签编码" prop="labelCode">
|
|
@@ -641,6 +641,30 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
+ <el-form ref="printForm" :model="singlePrintForm" :rules="printRules" label-width="80px" v-if="isSinglePrinter">
|
|
|
+ <el-form-item label="资产ID" prop="id">
|
|
|
+ {{ singlePrintForm.id }}
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="标签编码" prop="labelCode">
|
|
|
+ <el-select v-model="singlePrintForm.labelCode" placeholder="请选择标签编码">
|
|
|
+ <el-option v-for="item in labelCodes" :key="item.value" :label="item.label" :value="item.value">
|
|
|
+ <span style="float: left">{{ item.label }}</span>
|
|
|
+ <span style="float: right; color: #8492a6; font-size: 13px">{{ item.value }}</span>
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="可选标签" prop="indexes">
|
|
|
+ <el-select v-model="singlePrintForm.indexes" multiple placeholder="默认全选" clearable :filterable="true">
|
|
|
+ <el-option
|
|
|
+ v-for="item in singlePrintIndexes"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <p class="msg" v-if="form.orderType !== 1"><i class="el-icon-info"></i> 可选标签留空,即默认全选</p>
|
|
|
+ </el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="onSubmitPrint">确 定</el-button>
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
@@ -650,7 +674,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listInformation, getInformation, delInformation, addInformation, updateInformation, setDiy, getDiy, printLabel } from '@/api/asset/information'
|
|
|
+import { listInformation, getInformation, delInformation, addInformation, updateInformation, setDiy, getDiy, printLabel, singlePrintLabel } from '@/api/asset/information'
|
|
|
import { listCategory } from '@/api/asset/category'
|
|
|
import { treeSelect } from '@/api/asset/location'
|
|
|
import ImageUploadTemp from '@/components/ImageUploadTemp'
|
|
@@ -793,6 +817,13 @@ export default {
|
|
|
labelCode: [{ required: true, message: '标签编码不能为空', trigger: 'change' }],
|
|
|
},
|
|
|
isPrinter: false,
|
|
|
+ singlePrintForm: {
|
|
|
+ id: null,
|
|
|
+ indexes: null,
|
|
|
+ labelCode: null,
|
|
|
+ },
|
|
|
+ singlePrintIndexes: [],
|
|
|
+ isSinglePrinter: false,
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -997,25 +1028,56 @@ export default {
|
|
|
const ids = row.id || this.ids
|
|
|
|
|
|
if (Object.prototype.toString.call(ids) === '[object Array]') {
|
|
|
+ if (ids.length === 1) {
|
|
|
+ row = this.informationList.filter(item => item.id === ids[0])[0]
|
|
|
+ this.handSinglePrint(row, ids)
|
|
|
+ this.isPrinter = true
|
|
|
+ return
|
|
|
+ }
|
|
|
this.printForm.ids = ids
|
|
|
+ this.isSinglePrinter = false
|
|
|
} else {
|
|
|
- this.printForm.ids = [ids]
|
|
|
+ this.handSinglePrint(row, row.id)
|
|
|
}
|
|
|
this.isPrinter = true
|
|
|
},
|
|
|
+ handSinglePrint(row, id) {
|
|
|
+ this.isSinglePrinter = true
|
|
|
+ this.singlePrintForm.id = id
|
|
|
+ const singlePrintIndexes = [];
|
|
|
+ if (row.quantity <= 1) {
|
|
|
+ singlePrintIndexes.push({
|
|
|
+ label: `${row.number}`,
|
|
|
+ value: 0
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ for (let i = 0; i < row.quantity; i++) {
|
|
|
+ singlePrintIndexes.push({
|
|
|
+ label: `${row.number}-${i+1}`,
|
|
|
+ value: i
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.singlePrintIndexes = singlePrintIndexes
|
|
|
+ },
|
|
|
onSubmitPrint() {
|
|
|
this.$refs.printForm.validate((valid) => {
|
|
|
if (valid) {
|
|
|
- printLabel(this.printForm).then((res) => {
|
|
|
- this.$modal.msgSuccess('操作成功,等待打印...')
|
|
|
- this.cancel()
|
|
|
- })
|
|
|
+ if (this.isSinglePrinter) {
|
|
|
+ singlePrintLabel(this.singlePrintForm).then((res) => {
|
|
|
+ this.$modal.msgSuccess('操作成功,等待打印...')
|
|
|
+ this.cancel()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ printLabel(this.printForm).then((res) => {
|
|
|
+ this.$modal.msgSuccess('操作成功,等待打印...')
|
|
|
+ this.cancel()
|
|
|
+ })
|
|
|
+ }
|
|
|
} else {
|
|
|
return false
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
- printLabel(this.printForm)
|
|
|
},
|
|
|
/** 自定义字段按钮 */
|
|
|
handleDIY() {
|
|
@@ -1140,4 +1202,8 @@ export default {
|
|
|
height: 32px;
|
|
|
}
|
|
|
}
|
|
|
+.msg {
|
|
|
+ text-align: left;
|
|
|
+ color: red;
|
|
|
+}
|
|
|
</style>
|