<template>
|
<div class="add_wordshop">
|
<el-dialog :title="editConfig.dialogTitle + '生丝定价标准'" :visible.sync="editConfig.visible" width="30%"
|
:before-close="handleClose">
|
<el-form :inline="true" label-width="20%" style="width: 100%;" :model="editConfig.infomitton" :rules="rules"
|
ref="ruleForm">
|
<el-form-item prop="market" label="庄口" style="width: 100%;">
|
<el-select :disabled="this.editConfig.dialogTitle === '查看'" v-model="editConfig.infomitton.market" value-key="ID"
|
placeholder="请选择庄口">
|
<el-option v-for="item in shanguchiList" :key="item.name" :label="item.name" :value="item">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item prop="rawSilkGrade" label="生丝等级" style="width: 100%;">
|
<el-select :disabled="this.editConfig.dialogTitle === '查看'" v-model="editConfig.infomitton.rawSilkGrade"
|
placeholder="请选择生丝等级">
|
<el-option v-for="item in classList" :key="item" :label="item" :value="item">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item prop="payStandard" label="薪酬标准" style="width: 100%;">
|
<!-- <el-input-number
|
v-model="form.workshopNumber"
|
placeholder="请输入组别"
|
:controls="false"
|
style="width: 100%; margin-right: 5px;text-align:left;"
|
></el-input-number> -->
|
<el-input :disabled="this.editConfig.dialogTitle === '查看'" v-model="editConfig.infomitton.payStandard" :rows="4"
|
style="resize: none !important;" placeholder="请输入薪酬标准">
|
</el-input>
|
</el-form-item>
|
<el-form-item label="单位" style="width: 100%;">
|
<el-input :disabled="this.editConfig.dialogTitle === '查看'" v-model="editConfig.infomitton.unit" :rows="4"
|
style="resize: none !important;" placeholder="请输入组别">
|
</el-input>
|
</el-form-item>
|
<el-form-item label="备注" style="width: 100%;">
|
<el-input :disabled="this.editConfig.dialogTitle === '查看'" v-model="editConfig.infomitton.notes" type="textarea"
|
:rows="4" style="resize: none !important;" placeholder="">
|
</el-input>
|
</el-form-item>
|
</el-form>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="editConfig.visible = false">取 消</el-button>
|
<el-button type="primary" @click="commitForm('ruleForm')">确 定</el-button>
|
</span>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import { getDict, getRankStandardGrade, savePriceStandard } from "@/api/systemSetting/silkPriceStandard"
|
export default {
|
props: {
|
editDiaConfig: {
|
type: Object,
|
default: () => {
|
return {
|
visible: false,
|
dialogTitle: "添加",
|
isReadonly: true,
|
infomitton: {
|
},
|
}
|
}
|
}
|
},
|
data() {
|
return {
|
editConfig: this.editDiaConfig,
|
form: {
|
workshopNumber: null,
|
groupNumber: null,
|
startCarNumber: null,
|
endCarNumber: null,
|
carFlag: null,
|
notes: null
|
},
|
shanguchiList: [],
|
carFlagList: [
|
{ id: 1, name: "左半车" },
|
{ id: 2, name: "右半车" },
|
{ id: 3, name: "全车结束" },
|
],
|
classList: [],
|
rules: {
|
market: [
|
{ required: true, message: '请选择庄口', trigger: 'change' }
|
],
|
rawSilkGrade: [
|
{ required: true, message: '请选择生丝等级', trigger: 'change' }
|
],
|
payStandard: [
|
{ required: true, message: '请输入薪酬标准', trigger: 'change' },
|
{pattern: /^[0-9.]*$/, message: '薪酬标准需为数字', trigger: 'blur'}
|
]
|
},
|
};
|
},
|
computed: {
|
},
|
created() {
|
this.getDictData()
|
this.getRankStandardGrade()
|
},
|
mounted() {
|
|
},
|
watch: {
|
|
},
|
methods: {
|
handleClose(done) {
|
done();
|
},
|
async getDictData() {
|
await getDict({ dictType: 0 }).then((res) => {
|
if (res && res.code === 200) {
|
this.shanguchiList = res.data
|
}
|
})
|
},
|
setParams() {
|
let params = {
|
marketId: this.editConfig.infomitton.market.ID,
|
marketName: this.editConfig.infomitton.market.name,
|
unit: this.editConfig.infomitton.unit,
|
payStandard: Number(this.editConfig.infomitton.payStandard),
|
rawSilkGrade: this.editConfig.infomitton.rawSilkGrade,
|
notes: this.editConfig.infomitton.notes,
|
// id:Number(this.editConfig.infomitton.workshopId),
|
}
|
return params
|
},
|
async commitForm(formName) {
|
this.$refs[formName].validate((valid) => {
|
if (valid) {
|
let params = this.setParams()
|
console.log(this.editConfig.infomitton.market,params,"看那")
|
if (this.editConfig.dialogTitle === "新增") {
|
savePriceStandard(params).then((res) => {
|
if (res && res.code === 200) {
|
this.editConfig.visible = false
|
this.$message({
|
message: "保存成功!",
|
type: "success",
|
});
|
this.$parent.getData()
|
}
|
})
|
} else if (this.editConfig.dialogTitle === "修改") {
|
this.editConfig.infomitton.workshopNumber = this.editConfig.infomitton.workshopNumber + ""
|
savePriceStandard({...params,id:this.editConfig.infomitton.ID}).then((res) => {
|
if (res && res.code === 200) {
|
this.editConfig.visible = false
|
this.$message({
|
message: "保存成功!",
|
type: "success",
|
});
|
this.$parent.getData()
|
}
|
})
|
}
|
} else {
|
console.log('error submit!!');
|
return false;
|
}
|
});
|
},
|
async getRankStandardGrade() {
|
await getRankStandardGrade().then((res) => {
|
if (res && res.data) {
|
this.classList = res.data
|
}
|
})
|
}
|
},
|
components: {
|
|
},
|
};
|
</script>
|
|
<style scoped lang="scss">
|
::v-deep .el-form-item__content {
|
width: 70% !important;
|
}
|
|
::v-deep {
|
.el-form {
|
.el-input__inner {
|
text-align: left;
|
}
|
}
|
|
.el-select {
|
width: 100%;
|
}
|
}
|
</style>
|