update 0625 料仓动态
This commit is contained in:
parent
02f7578179
commit
0c6646dd29
@ -1,6 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog class="dialog-just-form" :visible="dialogVisible" @close="handleClose" :destroy-on-close="false"
|
<el-dialog
|
||||||
:close-on-click-modal="configs.clickModalToClose ?? true" :width="configs.dialogWidth ?? '50%'">
|
class="dialog-just-form"
|
||||||
|
:visible="dialogVisible"
|
||||||
|
@close="handleClose"
|
||||||
|
:destroy-on-close="false"
|
||||||
|
:close-on-click-modal="configs.clickModalToClose ?? true"
|
||||||
|
:width="configs.dialogWidth ?? '50%'">
|
||||||
<!-- title -->
|
<!-- title -->
|
||||||
<div slot="title" class="dialog-title">
|
<div slot="title" class="dialog-title">
|
||||||
<h1 class="">
|
<h1 class="">
|
||||||
@ -14,45 +19,116 @@
|
|||||||
<el-col v-for="(col, colIndex) in row" :key="colIndex" :span="24 / row.length">
|
<el-col v-for="(col, colIndex) in row" :key="colIndex" :span="24 / row.length">
|
||||||
<!-- 通过多个 col === null 可以控制更灵活的 span 大小 -->
|
<!-- 通过多个 col === null 可以控制更灵活的 span 大小 -->
|
||||||
<el-form-item v-if="col !== null" :label="col.label" :prop="col.prop" :rules="col.rules || null">
|
<el-form-item v-if="col !== null" :label="col.label" :prop="col.prop" :rules="col.rules || null">
|
||||||
<el-input v-if="col.input" v-model="dataForm[col.prop]" clearable :disabled="IsNotAvaliable(col)"
|
<el-input
|
||||||
|
v-if="col.input"
|
||||||
|
v-model="dataForm[col.prop]"
|
||||||
|
clearable
|
||||||
|
:disabled="IsNotAvaliable(col)"
|
||||||
v-bind="col.elparams" />
|
v-bind="col.elparams" />
|
||||||
<el-input v-if="col.forceDisabled && col.eraseOnSubmit" v-model="shadowDataForm[col.prop]" disabled
|
<el-input
|
||||||
|
v-if="col.forceDisabled && col.eraseOnSubmit"
|
||||||
|
v-model="shadowDataForm[col.prop]"
|
||||||
|
disabled
|
||||||
v-bind="col.elparams" />
|
v-bind="col.elparams" />
|
||||||
<el-input v-if="col.forceDisabled && !col.eraseOnSubmit" v-model="dataForm[col.prop]" disabled
|
<el-input
|
||||||
|
v-if="col.forceDisabled && !col.eraseOnSubmit"
|
||||||
|
v-model="dataForm[col.prop]"
|
||||||
|
disabled
|
||||||
v-bind="col.elparams" />
|
v-bind="col.elparams" />
|
||||||
<el-button type="" plain v-if="col.button" v-bind="col.elparams" style="width: 100%"
|
<el-button
|
||||||
@click="handleButtonClick(col)">{{
|
type=""
|
||||||
col.label
|
plain
|
||||||
}}</el-button>
|
v-if="col.button"
|
||||||
<el-cascader v-if="col.cascader" v-model="dataForm[col.prop]" :options="col.options"
|
v-bind="col.elparams"
|
||||||
:disabled="IsNotAvaliable(col)" v-bind="col.elparams"></el-cascader>
|
style="width: 100%"
|
||||||
<el-select v-if="col.forceDisabledSelect" disabled v-model="dataForm[col.prop]" clearable
|
@click="handleButtonClick(col)">
|
||||||
|
{{ col.label }}
|
||||||
|
</el-button>
|
||||||
|
<el-cascader
|
||||||
|
v-if="col.cascader"
|
||||||
|
v-model="dataForm[col.prop]"
|
||||||
|
:options="col.options"
|
||||||
|
:disabled="IsNotAvaliable(col)"
|
||||||
|
v-bind="col.elparams"></el-cascader>
|
||||||
|
<el-select
|
||||||
|
v-if="col.forceDisabledSelect"
|
||||||
|
disabled
|
||||||
|
v-model="dataForm[col.prop]"
|
||||||
|
clearable
|
||||||
v-bind="col.elparams">
|
v-bind="col.elparams">
|
||||||
<el-option v-for="(opt, optIdx) in col.options" :key="'option_' + optIdx" :label="opt.label"
|
<el-option
|
||||||
|
v-for="(opt, optIdx) in col.options"
|
||||||
|
:key="'option_' + optIdx"
|
||||||
|
:label="opt.label"
|
||||||
:value="opt.value" />
|
:value="opt.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-select v-if="col.select" v-model="dataForm[col.prop]" clearable :disabled="IsNotAvaliable(col)"
|
<el-select
|
||||||
v-bind="col.elparams" @change="handleSelectChange(col, $event)">
|
v-if="col.select"
|
||||||
<el-option v-for="(opt, optIdx) in col.options" :key="'option_' + optIdx" :label="opt.label"
|
v-model="dataForm[col.prop]"
|
||||||
:value="opt.value" />
|
clearable
|
||||||
|
:disabled="IsNotAvaliable(col)"
|
||||||
|
v-bind="col.elparams"
|
||||||
|
@change="handleSelectChange(col, $event)">
|
||||||
|
<el-option
|
||||||
|
v-for="(opt, optIdx) in col.options"
|
||||||
|
:key="'option_' + optIdx"
|
||||||
|
:label="opt.label"
|
||||||
|
:value="opt.value">
|
||||||
|
<span>{{ opt.label }}</span>
|
||||||
|
<span
|
||||||
|
v-if="col.customLabel"
|
||||||
|
style="display: inline-clock; margin-left: 12px; font-size: 0.9em; color: #ccce">
|
||||||
|
{{ opt[col.customLabel] || "-" }}
|
||||||
|
</span>
|
||||||
|
</el-option>
|
||||||
|
<!-- <el-option
|
||||||
|
v-for="(opt, optIdx) in col.options"
|
||||||
|
:key="'option_' + optIdx"
|
||||||
|
:label="opt.label"
|
||||||
|
:value="opt.value" /> -->
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-switch v-if="col.switch" v-model="dataForm[col.prop]" :active-value="col.activeValue ?? 1"
|
<el-switch
|
||||||
:inactive-value="col.activeValue ?? 0" @change="handleSwitchChange" :disabled="detailMode" />
|
v-if="col.switch"
|
||||||
<el-input v-if="col.textarea" type="textarea" v-model="dataForm[col.prop]" :disabled="IsNotAvaliable(col)"
|
v-model="dataForm[col.prop]"
|
||||||
|
:active-value="col.activeValue ?? 1"
|
||||||
|
:inactive-value="col.activeValue ?? 0"
|
||||||
|
@change="handleSwitchChange"
|
||||||
|
:disabled="detailMode" />
|
||||||
|
<el-input
|
||||||
|
v-if="col.textarea"
|
||||||
|
type="textarea"
|
||||||
|
v-model="dataForm[col.prop]"
|
||||||
|
:disabled="IsNotAvaliable(col)"
|
||||||
v-bind="col.elparams" />
|
v-bind="col.elparams" />
|
||||||
<el-date-picker v-if="col.datetime" v-model="dataForm[col.prop]" :disabled="IsNotAvaliable(col)"
|
<el-date-picker
|
||||||
|
v-if="col.datetime"
|
||||||
|
v-model="dataForm[col.prop]"
|
||||||
|
:disabled="IsNotAvaliable(col)"
|
||||||
v-bind="col.elparams" />
|
v-bind="col.elparams" />
|
||||||
<uploadBtn v-if="col.upload" :key="'upload_' + rowIndex + colIndex" :action="col.actionUrl"
|
<uploadBtn
|
||||||
:file-list="dataForm['files']" :disabled="IsNotAvaliable(col)" v-bind="col.elparams"
|
v-if="col.upload"
|
||||||
|
:key="'upload_' + rowIndex + colIndex"
|
||||||
|
:action="col.actionUrl"
|
||||||
|
:file-list="dataForm['files']"
|
||||||
|
:disabled="IsNotAvaliable(col)"
|
||||||
|
v-bind="col.elparams"
|
||||||
@update-file-list="handleFilelistUpdate" />
|
@update-file-list="handleFilelistUpdate" />
|
||||||
|
|
||||||
<quillEditor v-if="col.richInput" ref="quill-editor" v-model="dataForm[col.prop]"
|
<quillEditor
|
||||||
:options="col.quillConfig ?? defaultQuillConfig" style="margin-top: 42px" :disabled="IsNotAvaliable(col)" />
|
v-if="col.richInput"
|
||||||
|
ref="quill-editor"
|
||||||
|
v-model="dataForm[col.prop]"
|
||||||
|
:options="col.quillConfig ?? defaultQuillConfig"
|
||||||
|
style="margin-top: 42px"
|
||||||
|
:disabled="IsNotAvaliable(col)" />
|
||||||
|
|
||||||
<div class="" v-if="col.component" style="margin: 42px 0 0">
|
<div class="" v-if="col.component" style="margin: 42px 0 0">
|
||||||
<!-- 下面这个 component 几乎是为 富文本 quill 定制的了... TODO:后续可能会根据业务需求创建新的版本 -->
|
<!-- 下面这个 component 几乎是为 富文本 quill 定制的了... TODO:后续可能会根据业务需求创建新的版本 -->
|
||||||
<component :is="col.component" :key="'component_' + col.prop"
|
<component
|
||||||
@update:modelValue="handleComponentModelUpdate(col.prop, $event)" :modelValue="dataForm[col.prop]"
|
:is="col.component"
|
||||||
|
:key="'component_' + col.prop"
|
||||||
|
@update:modelValue="handleComponentModelUpdate(col.prop, $event)"
|
||||||
|
:modelValue="dataForm[col.prop]"
|
||||||
:mode="detailMode ? 'detail' : dataForm.id ? 'edit' : 'create'" />
|
:mode="detailMode ? 'detail' : dataForm.id ? 'edit' : 'create'" />
|
||||||
</div>
|
</div>
|
||||||
<!-- add more... -->
|
<!-- add more... -->
|
||||||
@ -64,10 +140,13 @@
|
|||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
<div slot="footer">
|
<div slot="footer">
|
||||||
<template v-for="(operate, index) in configs.form.operations">
|
<template v-for="(operate, index) in configs.form.operations">
|
||||||
<el-button v-if="showButton(operate)" :key="'operation_' + index" :type="operate.type"
|
<el-button
|
||||||
@click="handleBtnClick(operate)">{{
|
v-if="showButton(operate)"
|
||||||
operate.label
|
:key="'operation_' + index"
|
||||||
}}</el-button>
|
:type="operate.type"
|
||||||
|
@click="handleBtnClick(operate)">
|
||||||
|
{{ operate.label }}
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
<el-button @click="handleBtnClick({ name: 'cancel' })">取消</el-button>
|
<el-button @click="handleBtnClick({ name: 'cancel' })">取消</el-button>
|
||||||
</div>
|
</div>
|
||||||
@ -125,7 +204,8 @@ export default {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.configs.extraFields) this.configs.extraFields.forEach((cnf) => {
|
if (this.configs.extraFields)
|
||||||
|
this.configs.extraFields.forEach((cnf) => {
|
||||||
dataForm[cnf.prop] = cnf.default ?? null;
|
dataForm[cnf.prop] = cnf.default ?? null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -174,11 +254,25 @@ export default {
|
|||||||
promiseHistory[col.prop] = col.fetchData(param).then(({ data: res }) => {
|
promiseHistory[col.prop] = col.fetchData(param).then(({ data: res }) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
if ("list" in res.data) {
|
if ("list" in res.data) {
|
||||||
|
console.log(
|
||||||
|
"SdASD ",
|
||||||
|
res.data.list.map((i) => ({
|
||||||
|
label: col.optionLabel ? i[col.optionLabel] : i.name,
|
||||||
|
value: col.optionValue ? i[col.optionValue] : i.id,
|
||||||
|
[col.customLabel]: i[col.customLabel],
|
||||||
|
}))
|
||||||
|
);
|
||||||
// 填充 options
|
// 填充 options
|
||||||
this.$set(
|
this.$set(
|
||||||
col,
|
col,
|
||||||
"options",
|
"options",
|
||||||
res.data.list.map((i) => ({
|
col.customLabel
|
||||||
|
? res.data.list.map((i) => ({
|
||||||
|
label: col.optionLabel ? i[col.optionLabel] : i.name,
|
||||||
|
value: col.optionValue ? i[col.optionValue] : i.id,
|
||||||
|
[col.customLabel]: i[col.customLabel],
|
||||||
|
}))
|
||||||
|
: res.data.list.map((i) => ({
|
||||||
label: col.optionLabel ? i[col.optionLabel] : i.name,
|
label: col.optionLabel ? i[col.optionLabel] : i.name,
|
||||||
value: col.optionValue ? i[col.optionValue] : i.id,
|
value: col.optionValue ? i[col.optionValue] : i.id,
|
||||||
}))
|
}))
|
||||||
@ -233,7 +327,13 @@ export default {
|
|||||||
this.$set(
|
this.$set(
|
||||||
col,
|
col,
|
||||||
"options",
|
"options",
|
||||||
res.data.map((i) => ({
|
col.customLabel
|
||||||
|
? res.data.map((i) => ({
|
||||||
|
label: col.optionLabel ? i[col.optionLabel] : i.name,
|
||||||
|
value: col.optionValue ? i[col.optionValue] : i.id,
|
||||||
|
[col.customLabel]: i[col.customLabel],
|
||||||
|
}))
|
||||||
|
: res.data.map((i) => ({
|
||||||
label: col.optionLabel ? i[col.optionLabel] : i.name,
|
label: col.optionLabel ? i[col.optionLabel] : i.name,
|
||||||
value: col.optionValue ? i[col.optionValue] : i.id,
|
value: col.optionValue ? i[col.optionValue] : i.id,
|
||||||
}))
|
}))
|
||||||
@ -352,7 +452,8 @@ export default {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.configs.extraFields) this.configs.extraFields.forEach((cnf) => {
|
if (this.configs.extraFields)
|
||||||
|
this.configs.extraFields.forEach((cnf) => {
|
||||||
if (cnf.listenTo) {
|
if (cnf.listenTo) {
|
||||||
console.log("set watcher for: ", cnf.prop);
|
console.log("set watcher for: ", cnf.prop);
|
||||||
const unwatch = this.$watch(
|
const unwatch = this.$watch(
|
||||||
@ -557,7 +658,9 @@ export default {
|
|||||||
const { startTime, endTime } = this.dataForm;
|
const { startTime, endTime } = this.dataForm;
|
||||||
httpPayload = {
|
httpPayload = {
|
||||||
...httpPayload,
|
...httpPayload,
|
||||||
startTime: startTime ? moment(startTime).format("YYYY-MM-DDTHH:mm:ss") : moment().format("YYYY-MM-DDTHH:mm:ss"),
|
startTime: startTime
|
||||||
|
? moment(startTime).format("YYYY-MM-DDTHH:mm:ss")
|
||||||
|
: moment().format("YYYY-MM-DDTHH:mm:ss"),
|
||||||
endTime: endTime ? moment(endTime).format("YYYY-MM-DDTHH:mm:ss") : null, // moment().format("YYYY-MM-DDTHH:mm:ss"),
|
endTime: endTime ? moment(endTime).format("YYYY-MM-DDTHH:mm:ss") : null, // moment().format("YYYY-MM-DDTHH:mm:ss"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -567,7 +670,9 @@ export default {
|
|||||||
const { updateTime } = this.dataForm;
|
const { updateTime } = this.dataForm;
|
||||||
httpPayload = {
|
httpPayload = {
|
||||||
...httpPayload,
|
...httpPayload,
|
||||||
updateTime: updateTime ? moment(updateTime).format("YYYY-MM-DDTHH:mm:ss") : moment().format("YYYY-MM-DDTHH:mm:ss"),
|
updateTime: updateTime
|
||||||
|
? moment(updateTime).format("YYYY-MM-DDTHH:mm:ss")
|
||||||
|
: moment().format("YYYY-MM-DDTHH:mm:ss"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -647,7 +752,7 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.dialog-just-form>>>.el-dialog__body {
|
.dialog-just-form >>> .el-dialog__body {
|
||||||
/* padding-top: 16px !important;
|
/* padding-top: 16px !important;
|
||||||
padding-bottom: 16px !important; */
|
padding-bottom: 16px !important; */
|
||||||
padding-top: 0 !important;
|
padding-top: 0 !important;
|
||||||
@ -660,7 +765,7 @@ export default {
|
|||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-just-form>>>.el-dialog__header {
|
.dialog-just-form >>> .el-dialog__header {
|
||||||
padding: 10px 20px 10px;
|
padding: 10px 20px 10px;
|
||||||
/* background: linear-gradient(to bottom, rgba(0, 0, 0, 0.25), white); */
|
/* background: linear-gradient(to bottom, rgba(0, 0, 0, 0.25), white); */
|
||||||
}
|
}
|
||||||
|
@ -108,6 +108,7 @@ export default function () {
|
|||||||
prop: "materialId",
|
prop: "materialId",
|
||||||
fetchData: () => this.$http.get("/pms/material/page", { params: { key: '', limit: 999, page: 1 } }),
|
fetchData: () => this.$http.get("/pms/material/page", { params: { key: '', limit: 999, page: 1 } }),
|
||||||
options: [],
|
options: [],
|
||||||
|
customLabel: 'description',
|
||||||
rules: { required: true, message: "必填项不能为空", trigger: "change" },
|
rules: { required: true, message: "必填项不能为空", trigger: "change" },
|
||||||
elparams: { placeholder: "请选择原料" },
|
elparams: { placeholder: "请选择原料" },
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user