|
@@ -11,7 +11,7 @@
|
|
|
>
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="商品名称" prop="goods_name">
|
|
|
+ <el-form-item label="商品名称" prop="good_name">
|
|
|
<el-input
|
|
|
:disabled="
|
|
|
!(
|
|
@@ -19,7 +19,7 @@
|
|
|
(status === '0' && powers.some((item) => item == '005'))
|
|
|
)
|
|
|
"
|
|
|
- v-model="ruleForm.goods_name"
|
|
|
+ v-model="ruleForm.good_name"
|
|
|
readonly="true"
|
|
|
:placeholder="'商品名称'"
|
|
|
@focus="showGoodsModel = true"
|
|
@@ -29,16 +29,25 @@
|
|
|
<!-- 采购数量 -->
|
|
|
<el-col :span="5">
|
|
|
<el-form-item label="采购数量" prop="goods_num">
|
|
|
- <el-input
|
|
|
+ <digital-input
|
|
|
+ :values="ruleForm.goods_num"
|
|
|
+ :name="'ruleForm.goods_num'"
|
|
|
+ :placeholder="'采购数量'"
|
|
|
+ :min="0"
|
|
|
:disabled="
|
|
|
!(
|
|
|
id === 'add' ||
|
|
|
(status === '0' && powers.some((item) => item == '005'))
|
|
|
)
|
|
|
"
|
|
|
- v-model="ruleForm.goods_num"
|
|
|
- placeholder="采购数量"
|
|
|
- ></el-input>
|
|
|
+ :max="100000000000"
|
|
|
+ :position="'right'"
|
|
|
+ :precision="0"
|
|
|
+ :size="'mini'"
|
|
|
+ :controls="false"
|
|
|
+ :append="''"
|
|
|
+ @reschange="number_change($event, 'goods_num')"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<!-- 最晚入库时间 -->
|
|
@@ -50,9 +59,9 @@
|
|
|
>
|
|
|
<el-date-picker
|
|
|
v-model="ruleForm.lasttime"
|
|
|
- type="datetime"
|
|
|
+ type="date"
|
|
|
style="width: 100%"
|
|
|
- value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
placeholder="最晚入库时间"
|
|
|
:picker-options="pickerOptions"
|
|
|
:disabled="
|
|
@@ -77,24 +86,32 @@
|
|
|
}"
|
|
|
>
|
|
|
<p v-if="ruleForm.file_url">
|
|
|
- {{ ruleForm.file_url_name }}
|
|
|
+ <el-link :underline="false" :href="ruleForm.file_url" target="_blank">{{
|
|
|
+ ruleForm.file_url_name
|
|
|
+ }}</el-link>
|
|
|
+ <el-link class="fr" type="info" :underline="false"
|
|
|
+ ><i
|
|
|
+ class="el-icon-circle-close"
|
|
|
+ @click="close_url"
|
|
|
+ :size="'mini'"
|
|
|
+ ></i
|
|
|
+ ></el-link>
|
|
|
</p>
|
|
|
<p v-else class="no">附件</p>
|
|
|
- <file-upload-pdf
|
|
|
- v-if="
|
|
|
- id === 'add' ||
|
|
|
- (status === '0' && powers.some((item) => item == '005'))
|
|
|
- "
|
|
|
- class="Upload"
|
|
|
- :accept="'.pdf'"
|
|
|
- :multiple="false"
|
|
|
- :size="'mini'"
|
|
|
- :uploadcondition="beforeAvatarUpload"
|
|
|
- @UploadErrorEvent="UploadErrorEvent"
|
|
|
- @UploadSuccessEvent="UploadSuccessEvent"
|
|
|
- />
|
|
|
- <div class="yulan" v-if="ruleForm.file_url" @click="PDFModelShow">
|
|
|
- 查看
|
|
|
+ <div v-if="ruleForm.file_url === ''">
|
|
|
+ <file-upload-pdf
|
|
|
+ v-if="
|
|
|
+ id === 'add' ||
|
|
|
+ (status === '0' && powers.some((item) => item == '005'))
|
|
|
+ "
|
|
|
+ class="Upload"
|
|
|
+ :accept="'.pdf'"
|
|
|
+ :multiple="false"
|
|
|
+ :size="'mini'"
|
|
|
+ :uploadcondition="beforeAvatarUpload"
|
|
|
+ @UploadErrorEvent="UploadErrorEvent"
|
|
|
+ @UploadSuccessEvent="UploadSuccessEvent"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
@@ -105,7 +122,7 @@
|
|
|
type="textarea"
|
|
|
:rows="2"
|
|
|
placeholder="备注"
|
|
|
- v-model="remark"
|
|
|
+ v-model="ruleForm.remark"
|
|
|
>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
@@ -130,14 +147,13 @@
|
|
|
:cat_id="cat_id"
|
|
|
:show-model="showGoodsModel"
|
|
|
@cancel="showGoodsModel = false"
|
|
|
- @searchChange="addGoodsRes"
|
|
|
+ @resultList="addGoodsRes"
|
|
|
/>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import resToken from "@/mixins/resToken";
|
|
|
import asyncRequest from "@/apis/service/sellOut/stockApply";
|
|
|
-import { isnumber } from "@/utils/validate";
|
|
|
import searchGoodModal from "@/components/search-good-modal";
|
|
|
export default {
|
|
|
name: "stockApply",
|
|
@@ -167,15 +183,21 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
data() {
|
|
|
- const validateWeight = (rule, value, callback) => {
|
|
|
- if (value === "") {
|
|
|
- callback(new Error("不能为空!"));
|
|
|
+ const validate_num_0 = (rule, value, callback) => {
|
|
|
+ const { required } = rule;
|
|
|
+ if (required && value === "") {
|
|
|
+ callback(new Error("不能为空!"));
|
|
|
+ } else if (
|
|
|
+ required &&
|
|
|
+ (value === "0" ||
|
|
|
+ value === "0." ||
|
|
|
+ value === "0.0" ||
|
|
|
+ value === "0.00" ||
|
|
|
+ value === "0.000")
|
|
|
+ ) {
|
|
|
+ callback(new Error("不能为零!"));
|
|
|
} else {
|
|
|
- if (!isnumber(value)) {
|
|
|
- callback(new Error("仅支持整数!"));
|
|
|
- } else {
|
|
|
- callback();
|
|
|
- }
|
|
|
+ callback();
|
|
|
}
|
|
|
};
|
|
|
return {
|
|
@@ -194,8 +216,7 @@ export default {
|
|
|
ruleForm: {
|
|
|
id: "",
|
|
|
good_code: "",
|
|
|
- good_type_code: "",
|
|
|
- goods_name: "",
|
|
|
+ good_name: "",
|
|
|
goods_num: "",
|
|
|
file_url: "",
|
|
|
file_url_name: "",
|
|
@@ -207,7 +228,7 @@ export default {
|
|
|
},
|
|
|
rulesThis: this.rules,
|
|
|
rules: {
|
|
|
- goods_name: [
|
|
|
+ good_name: [
|
|
|
{
|
|
|
required: true,
|
|
|
message: "商品名称不能为空!",
|
|
@@ -217,14 +238,14 @@ export default {
|
|
|
goods_num: [
|
|
|
{
|
|
|
required: true,
|
|
|
- validator: validateWeight,
|
|
|
+ validator: validate_num_0,
|
|
|
trigger: "blur",
|
|
|
},
|
|
|
],
|
|
|
lasttime: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请输入入库最晚时间!",
|
|
|
+ message: "请输入最晚入库时间!",
|
|
|
trigger: "change",
|
|
|
},
|
|
|
],
|
|
@@ -261,16 +282,24 @@ export default {
|
|
|
|
|
|
// 执行点击商品名称的抛出事件
|
|
|
addGoodsRes(e) {
|
|
|
- let { spuCode, type_code, good_name } = e[0];
|
|
|
- this.ruleForm.goods_name = good_name;
|
|
|
- this.ruleForm.good_type_code = type_code;
|
|
|
+ console.log(e);
|
|
|
+ let { spuCode, good_name } = e[0];
|
|
|
+ this.ruleForm.good_name = good_name;
|
|
|
this.ruleForm.good_code = spuCode;
|
|
|
- this.$refs.ruleForm.validateField("goods_name");
|
|
|
+ this.$refs.ruleForm.validateField("good_name");
|
|
|
+ },
|
|
|
+ number_change(e, key) {
|
|
|
+ this.ruleForm[key] = e + "" || "0";
|
|
|
+ this.$refs.ruleForm.validateField(key);
|
|
|
},
|
|
|
-
|
|
|
closeModel() {
|
|
|
this.$emit("closeModel");
|
|
|
},
|
|
|
+ close_url() {
|
|
|
+ this.ruleForm.file_url_name = "";
|
|
|
+ this.ruleForm.file_url = "";
|
|
|
+ this.$refs.ruleForm.validateField("file_url");
|
|
|
+ },
|
|
|
// 重置
|
|
|
async resetForm() {
|
|
|
// 重置
|
|
@@ -282,28 +311,23 @@ export default {
|
|
|
const {
|
|
|
id,
|
|
|
good_code,
|
|
|
- good_type_code,
|
|
|
good_name, //商品名
|
|
|
good_num, //采购数量
|
|
|
lasttime, //最晚入库时间
|
|
|
file_url,
|
|
|
file_name,
|
|
|
- // wsm_code, //仓库名
|
|
|
status,
|
|
|
- // 缺供应商
|
|
|
} = this.sitem;
|
|
|
|
|
|
this.ruleForm = {
|
|
|
- id,
|
|
|
- good_code,
|
|
|
- good_type_code,
|
|
|
- goods_name: good_name,
|
|
|
- goods_num: good_num,
|
|
|
- lasttime: lasttime,
|
|
|
+ id: id || "",
|
|
|
+ good_code: good_code || "",
|
|
|
+ good_name: good_name || "",
|
|
|
+ goods_num: good_num || "0",
|
|
|
+ lasttime: lasttime || "",
|
|
|
file_url: file_url || "",
|
|
|
file_url_name: file_name || "",
|
|
|
-
|
|
|
- status,
|
|
|
+ status: status || "",
|
|
|
};
|
|
|
}
|
|
|
}
|
|
@@ -320,7 +344,7 @@ export default {
|
|
|
good_type_code,
|
|
|
goods_num,
|
|
|
file_url,
|
|
|
- file_name,
|
|
|
+ // file_name,
|
|
|
// stock_code,
|
|
|
lasttime,
|
|
|
} = this.ruleForm;
|
|
@@ -330,10 +354,7 @@ export default {
|
|
|
good_type_code,
|
|
|
good_num: goods_num || "",
|
|
|
file_url: file_url || "",
|
|
|
- file_url_name: file_name || "",
|
|
|
- // wsm_code:
|
|
|
- // this.id == "add" ? stock_code.toString() : stock_code.toString(),
|
|
|
-
|
|
|
+ // file_url_name: file_name || "",
|
|
|
lastime: lasttime || "",
|
|
|
};
|
|
|
let res = {};
|
|
@@ -363,26 +384,26 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- //图片上传失败
|
|
|
+ //附件上传失败
|
|
|
async UploadErrorEvent(e) {
|
|
|
- if (e) {
|
|
|
+ if (e !== "break") {
|
|
|
this.$message.error("附件上传失败!");
|
|
|
this.$refs.ruleForm.validateField("file_url");
|
|
|
- } else {
|
|
|
- await this.logout();
|
|
|
}
|
|
|
},
|
|
|
- //图片上传成功
|
|
|
- UploadSuccessEvent(data) {
|
|
|
- if (data && data.url && data.url !== "break") {
|
|
|
- const { url, name } = data.url;
|
|
|
+ //附件上传成功
|
|
|
+ async UploadSuccessEvent(data) {
|
|
|
+ const { url, name } = data;
|
|
|
+ if (url === "noToken") {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
this.ruleForm.file_url_name = name;
|
|
|
this.ruleForm.file_url = url;
|
|
|
this.$message.success("附件上传成功!");
|
|
|
this.$refs.ruleForm.validateField("file_url");
|
|
|
}
|
|
|
},
|
|
|
- //判断图片规格
|
|
|
+ //判断附件规格
|
|
|
beforeAvatarUpload(file) {
|
|
|
let isJPG = false,
|
|
|
isLt2M = false;
|
|
@@ -392,10 +413,10 @@ export default {
|
|
|
}
|
|
|
isLt2M = file.size / 1024 / 1024 < 1;
|
|
|
if (!isJPG) {
|
|
|
- this.$message.error("图片格式不正确!");
|
|
|
+ this.$message.error("附件格式不正确!");
|
|
|
}
|
|
|
if (!isLt2M) {
|
|
|
- this.$message.error("图片大小不能超过 1MB!");
|
|
|
+ this.$message.error("附件大小不能超过 1MB!");
|
|
|
}
|
|
|
}
|
|
|
|