|
|
@@ -1,7 +1,11 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <el-button size="small" type="primary" @click="show">
|
|
|
- {{ title_btn ? $t(title_btn) : $t('新 建') }}
|
|
|
+ <el-button
|
|
|
+ :size="btn_size ? btn_size : 'small'"
|
|
|
+ type="primary"
|
|
|
+ @click="show"
|
|
|
+ >
|
|
|
+ {{ title_btn ? $t(title_btn) : $t("新 建") }}
|
|
|
</el-button>
|
|
|
<el-drawer
|
|
|
:title="title_drawer ? $t(title_drawer) : $t(`新建服务物料`)"
|
|
|
@@ -21,49 +25,63 @@
|
|
|
label-position="right"
|
|
|
size="mini"
|
|
|
>
|
|
|
- <!-- 物料名称 -->
|
|
|
<el-col :span="24">
|
|
|
<el-form-item :label="$t('物料名称:')" prop="name">
|
|
|
- <el-input v-model="form.name" :placeholder="$t('请填写物料名称')"></el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="form.name"
|
|
|
+ :placeholder="$t('请填写物料名称')"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-
|
|
|
- <!-- 物料编号 -->
|
|
|
<el-col :span="24">
|
|
|
<el-form-item :label="$t('物料编号:')" prop="code">
|
|
|
- <el-input v-model="form.code" :placeholder="$t('请填写物料编号')"></el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="form.code"
|
|
|
+ :placeholder="$t('请填写物料编号')"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-
|
|
|
- <!-- erp品名 -->
|
|
|
<el-col :span="24">
|
|
|
- <el-form-item :label="$t('erp品名:')" prop="erpitemname">
|
|
|
- <el-input v-model="form.erpitemname" :placeholder="$t('请填写erp品名')"></el-input>
|
|
|
+ <el-form-item
|
|
|
+ :label="$t('erp品名:')"
|
|
|
+ prop="erpitemname"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="form.erpitemname"
|
|
|
+ :placeholder="$t('请填写erp品名')"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-
|
|
|
- <!-- erp品号 -->
|
|
|
<el-col :span="24">
|
|
|
<el-form-item :label="$t('erp品号:')" prop="erpitemno">
|
|
|
- <el-input v-model="form.erpitemno" :placeholder="$t('请填写erp品号')"></el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="form.erpitemno"
|
|
|
+ :placeholder="$t('请填写erp品号')"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-
|
|
|
<el-col :span="24">
|
|
|
<el-form-item :label="$t('牌价:')" prop="marketprice">
|
|
|
- <el-input v-model="form.marketprice" :placeholder="$t('请填写牌价')"></el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="form.marketprice"
|
|
|
+ :placeholder="$t('请填写牌价')"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-
|
|
|
- <!-- 是否辅助单位 -->
|
|
|
<el-col :span="24">
|
|
|
- <el-form-item :label="$t('辅助单位:')" prop="isauxunit">
|
|
|
- <el-checkbox v-model="form.isauxunit" :true-label="1" :false-label="0">
|
|
|
- {{ $t('是否需要辅助单位') }}
|
|
|
+ <el-form-item
|
|
|
+ :label="$t('辅助单位:')"
|
|
|
+ prop="isauxunit"
|
|
|
+ >
|
|
|
+ <el-checkbox
|
|
|
+ v-model="form.isauxunit"
|
|
|
+ :true-label="1"
|
|
|
+ :false-label="0"
|
|
|
+ >
|
|
|
+ {{ $t("是否需要辅助单位") }}
|
|
|
</el-checkbox>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-
|
|
|
<el-col :span="24">
|
|
|
<el-form-item :label="$t(`主单位`)" prop="unit">
|
|
|
<el-select
|
|
|
@@ -82,7 +100,6 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-
|
|
|
<!-- 辅助单位 -->
|
|
|
<!-- <el-col :span="24">
|
|
|
<el-form-item :label="$t('辅助单位:')" prop="auxunit">
|
|
|
@@ -103,11 +120,22 @@
|
|
|
:label="$t(item.unitgroupname)"
|
|
|
:value="item.unitgroupid"
|
|
|
>
|
|
|
- <p style="float: left">{{ item.unitgroupname }}</p>
|
|
|
- <p style="float: right; color: #8492a6; font-size: 13px">
|
|
|
- {{ item.conversionrate }}{{ item.unitname }}/{{ item.auxunitname }},{{
|
|
|
- $t(`换算率`)
|
|
|
- }}:{{ '1:' + item.conversionrate }}
|
|
|
+ <p style="float: left">
|
|
|
+ {{ item.unitgroupname }}
|
|
|
+ </p>
|
|
|
+ <p
|
|
|
+ style="
|
|
|
+ float: right;
|
|
|
+ color: #8492a6;
|
|
|
+ font-size: 13px;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ {{ item.conversionrate
|
|
|
+ }}{{ item.unitname }}/{{
|
|
|
+ item.auxunitname
|
|
|
+ }},{{ $t(`换算率`) }}:{{
|
|
|
+ "1:" + item.conversionrate
|
|
|
+ }}
|
|
|
</p>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
@@ -132,28 +160,65 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-
|
|
|
- <!-- 起订量 -->
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item :label="$t('型号:')" prop="type">
|
|
|
+ <el-input
|
|
|
+ v-model="form.type"
|
|
|
+ :placeholder="$t('请填写型号')"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item :label="$t('规格:')" prop="spec">
|
|
|
+ <el-input
|
|
|
+ v-model="form.spec"
|
|
|
+ :placeholder="$t('请填写规格')"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <!-- <el-col :span="24">
|
|
|
+ <el-form-item :label="$t('品牌:')" prop="brand">
|
|
|
+ <el-input
|
|
|
+ v-model="form.brand"
|
|
|
+ :placeholder="$t('请填写品牌')"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item :label="$t('分类:')" prop="itemclassids">
|
|
|
+ <el-input
|
|
|
+ v-model="form.itemclassids"
|
|
|
+ :placeholder="$t('请填写分类')"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col> -->
|
|
|
<el-col :span="24">
|
|
|
<el-form-item :label="$t('起订量:')" prop="start_num">
|
|
|
- <el-input-number v-model="form.start_num" :min="1" :placeholder="$t('请填写起订量')" />
|
|
|
+ <el-input-number
|
|
|
+ v-model="form.start_num"
|
|
|
+ :min="1"
|
|
|
+ :placeholder="$t('请填写起订量')"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-
|
|
|
- <!-- 增量 -->
|
|
|
<el-col :span="24">
|
|
|
<el-form-item :label="$t('增量:')" prop="increment">
|
|
|
- <el-input-number v-model="form.increment" :min="1" :placeholder="$t('请填写增量')" />
|
|
|
+ <el-input-number
|
|
|
+ v-model="form.increment"
|
|
|
+ :min="1"
|
|
|
+ :placeholder="$t('请填写增量')"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-
|
|
|
- <!-- 备注 -->
|
|
|
<el-col :span="24">
|
|
|
<el-form-item :label="$t('备注:')" prop="remarks">
|
|
|
- <el-input type="textarea" v-model="form.remarks" :placeholder="$t('请填写备注')"></el-input>
|
|
|
+ <el-input
|
|
|
+ type="textarea"
|
|
|
+ v-model="form.remarks"
|
|
|
+ :placeholder="$t('请填写备注')"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-
|
|
|
<el-col :span="20">
|
|
|
<el-form-item :label="$t('物料图:')">
|
|
|
<uploadFile
|
|
|
@@ -168,39 +233,52 @@
|
|
|
</uploadFile>
|
|
|
<!-- <previewImage :image="form.attinfos[0]" :deletebtn="true"
|
|
|
@onSuccess="clearCover"></previewImage> -->
|
|
|
- <small style="display: block; margin-top: 20px" class="info"
|
|
|
- >{{ $t(`注:建议上传图片大小`) }}1024x1024px,{{ $t('大小不超过') }}2M,{{
|
|
|
- $t('格式为')
|
|
|
- }}JPG/PNG</small
|
|
|
+ <small
|
|
|
+ style="display: block; margin-top: 20px"
|
|
|
+ class="info"
|
|
|
+ >{{ $t(`注:建议上传图片大小`) }}1024x1024px,{{
|
|
|
+ $t("大小不超过")
|
|
|
+ }}2M,{{ $t("格式为") }}JPG/PNG</small
|
|
|
>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
<div class="fixed__btn__panel">
|
|
|
- <el-button size="small" @click="onCancel" class="normal-btn-width">{{ $t('取 消') }}</el-button>
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ @click="onCancel"
|
|
|
+ class="normal-btn-width"
|
|
|
+ >{{ $t("取 消") }}</el-button
|
|
|
+ >
|
|
|
<el-button
|
|
|
:loading="loading"
|
|
|
class="normal-btn-width"
|
|
|
size="small"
|
|
|
:type="title_btn == '编辑' ? 'warning' : 'primary'"
|
|
|
@click="onSubmit"
|
|
|
- >{{ title_btn == '编辑' ? $t('保 存') : $t('确 定') }}
|
|
|
+ >{{ title_btn == "编辑" ? $t("保 存") : $t("确 定") }}
|
|
|
</el-button>
|
|
|
</div>
|
|
|
</el-drawer>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import uploadFile from '@/components/upload/preview_upload.vue';
|
|
|
+import uploadFile from "@/components/upload/preview_upload.vue";
|
|
|
|
|
|
export default {
|
|
|
- name: 'add',
|
|
|
+ name: "add",
|
|
|
components: { uploadFile },
|
|
|
- props: { title_btn: String, title_drawer: String, data: Object },
|
|
|
+ props: {
|
|
|
+ btn_size: String,
|
|
|
+ title_btn: String,
|
|
|
+ title_drawer: String,
|
|
|
+ data: Object,
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
- folderid: JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
|
|
|
+ folderid: JSON.parse(sessionStorage.getItem("folderid"))
|
|
|
+ .appfolderid,
|
|
|
tradefield: [], // 领域
|
|
|
unitData: [], // 主单位
|
|
|
unitGroupData: [],
|
|
|
@@ -211,41 +289,73 @@ export default {
|
|
|
currentData: {},
|
|
|
form: {
|
|
|
sc_itemid: 0,
|
|
|
- code: 'ITEM001', //物料编号
|
|
|
- name: '测试物料', //物料名称
|
|
|
- erpitemno: '品号', // 品号
|
|
|
- erpitemname: '品名', // 品名
|
|
|
- marketprice: '32', // 牌价
|
|
|
+ code: "ITEM001", //物料编号
|
|
|
+ name: "测试物料", //物料名称
|
|
|
+ erpitemno: "品号", // 品号
|
|
|
+ erpitemname: "品名", // 品名
|
|
|
+ marketprice: "32", // 牌价
|
|
|
isauxunit: 0, //是否启用辅助单位
|
|
|
- unit: '', //主单位
|
|
|
- auxunit: '', // 辅助单位
|
|
|
- domain: '', // 领域
|
|
|
- start_num: '1', // 起订量
|
|
|
- increment: '1', // 增量
|
|
|
- remarks: '', // 备注
|
|
|
- pic: '', // 图片
|
|
|
- status: 1,
|
|
|
- shelf: 0,
|
|
|
- shefl_time: '2026-05-15 10:00:00',
|
|
|
- type: '配件',
|
|
|
- spec: '规格A',
|
|
|
- brand: '品牌A',
|
|
|
- category: '分类A',
|
|
|
+ unit: "", //主单位
|
|
|
+ auxunit: "", // 辅助单位
|
|
|
+ domain: "", // 领域
|
|
|
+ type: "", // 型号
|
|
|
+ spec: "", // 规格
|
|
|
+ // brand: "", // 品牌
|
|
|
+ // itemclassids: "", // 分类
|
|
|
+ start_num: "1", // 起订量
|
|
|
+ increment: "1", // 增量
|
|
|
+ remarks: "", // 备注
|
|
|
+ pic: "", // 图片
|
|
|
+ status: 1, // 状态
|
|
|
+ shelf: 0, // 是否上架
|
|
|
},
|
|
|
rules: {
|
|
|
- name: [{ required: true, message: this.$t('请填写物料名称'), trigger: 'blur' }],
|
|
|
- code: [{ required: true, message: this.$t('请填写物料编号'), trigger: 'blur' }],
|
|
|
- marketprice: [{ required: true, message: this.$t('请填写牌价'), trigger: 'blur' }],
|
|
|
- unit: [{ required: true, message: this.$t('请选择主单位'), trigger: 'change' }],
|
|
|
- domain: [{ required: true, message: this.$t('请选择领域'), trigger: 'change' }],
|
|
|
+ name: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: this.$t("请填写物料名称"),
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ code: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: this.$t("请填写物料编号"),
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ marketprice: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: this.$t("请填写牌价"),
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ unit: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: this.$t("请选择主单位"),
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ domain: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: this.$t("请选择领域"),
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
},
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
// 查询领域
|
|
|
async fieldData() {
|
|
|
- const res = await this.$store.dispatch('optiontypeselect', 'tradefield');
|
|
|
- console.log('res-----------', res);
|
|
|
+ const res = await this.$store.dispatch(
|
|
|
+ "optiontypeselect",
|
|
|
+ "tradefield"
|
|
|
+ );
|
|
|
+ console.log("res-----------", res);
|
|
|
this.tradefield = res.data;
|
|
|
},
|
|
|
//初始化
|
|
|
@@ -255,19 +365,19 @@ export default {
|
|
|
this.unitlist();
|
|
|
this.unitGrouplist();
|
|
|
this.dialogFormVisible = true;
|
|
|
- if (this.title_btn == '编辑') {
|
|
|
+ if (this.title_btn == "编辑") {
|
|
|
this.form = Object.assign({}, this.form, this.data);
|
|
|
}
|
|
|
},
|
|
|
async unitlist() {
|
|
|
const res = await this.$api.requested({
|
|
|
- id: '20220922084803',
|
|
|
+ id: "20220922084803",
|
|
|
version: 1,
|
|
|
nocache: true,
|
|
|
content: {
|
|
|
pageSize: 1000,
|
|
|
where: {
|
|
|
- condition: '',
|
|
|
+ condition: "",
|
|
|
},
|
|
|
},
|
|
|
});
|
|
|
@@ -278,13 +388,13 @@ export default {
|
|
|
},
|
|
|
async unitGrouplist() {
|
|
|
const res = await this.$api.requested({
|
|
|
- id: '20220922084503',
|
|
|
+ id: "20220922084503",
|
|
|
version: 1,
|
|
|
nocache: true,
|
|
|
content: {
|
|
|
pageSize: 1000,
|
|
|
where: {
|
|
|
- condition: '',
|
|
|
+ condition: "",
|
|
|
unitid: this.form.unitid,
|
|
|
},
|
|
|
},
|
|
|
@@ -309,7 +419,7 @@ export default {
|
|
|
// this.form.domain = this.form.tradefield.map((e) => {
|
|
|
// return e.tradefield;
|
|
|
// });
|
|
|
- fn ? fn() : '';
|
|
|
+ fn ? fn() : "";
|
|
|
},
|
|
|
// onSubmit() {
|
|
|
// console.log('this.form---------', this.form);
|
|
|
@@ -329,28 +439,28 @@ export default {
|
|
|
// });
|
|
|
// },
|
|
|
onSubmit() {
|
|
|
- console.log('this.form---------', this.form);
|
|
|
- this.$refs['form'].validate(async (valid) => {
|
|
|
+ console.log("this.form---------", this.form);
|
|
|
+ this.$refs["form"].validate(async (valid) => {
|
|
|
if (!valid) return false;
|
|
|
- this.$store.commit('setLoading', true);
|
|
|
+ this.$store.commit("setLoading", true);
|
|
|
const res = await this.$api.requested({
|
|
|
id: 2026051508523606,
|
|
|
content: this.form,
|
|
|
});
|
|
|
this.tool.showMessage(res, () => {
|
|
|
- this.$store.commit('setLoading', false);
|
|
|
+ this.$store.commit("setLoading", false);
|
|
|
this.bindData = {
|
|
|
- ownertable: 'hs_item',
|
|
|
+ ownertable: "hs_item",
|
|
|
ownerid: res.data.itemid,
|
|
|
- usetype: 'default',
|
|
|
+ usetype: "default",
|
|
|
};
|
|
|
/* this.setTag(res.data.itemid,res.data.rowindex)*/
|
|
|
- this.$refs['form'].resetFields();
|
|
|
- this.$refs['upload'].toUpload();
|
|
|
- this.$emit('onSuccess');
|
|
|
+ this.$refs["form"].resetFields();
|
|
|
+ this.$refs["upload"].toUpload();
|
|
|
+ this.$emit("onSuccess");
|
|
|
this.refresh();
|
|
|
this.dialogFormVisible = false;
|
|
|
- this.$store.dispatch('changeDetailDrawer', true);
|
|
|
+ this.$store.dispatch("changeDetailDrawer", true);
|
|
|
// this.$router.push({
|
|
|
// path: '/productmagDetail',
|
|
|
// query: { id: res.data.itemid, rowindex: res.data.rowindex },
|
|
|
@@ -360,10 +470,10 @@ export default {
|
|
|
},
|
|
|
onCancel() {
|
|
|
this.dialogFormVisible = false;
|
|
|
- this.$refs['form'].resetFields();
|
|
|
+ this.$refs["form"].resetFields();
|
|
|
},
|
|
|
uploadSuccess(res) {
|
|
|
- this.$emit('onSuccess');
|
|
|
+ this.$emit("onSuccess");
|
|
|
},
|
|
|
},
|
|
|
};
|