fix:工序添加父级
This commit is contained in:
parent
ddb3c4743c
commit
69decccef5
|
|
@ -25,12 +25,7 @@
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main class="nopadding">
|
<el-main class="nopadding">
|
||||||
<scTable
|
<scTable ref="table" :apiObj="apiObj" row-key="id" stripe :params="params" :query="query" @selection-change="selectionChange">
|
||||||
ref="table"
|
|
||||||
:apiObj="apiObj"
|
|
||||||
row-key="id"
|
|
||||||
@selection-change="selectionChange"
|
|
||||||
>
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="#"
|
label="#"
|
||||||
type="index"
|
type="index"
|
||||||
|
|
@ -112,10 +107,25 @@
|
||||||
size="small"
|
size="small"
|
||||||
v-auth="'material.delete'"
|
v-auth="'material.delete'"
|
||||||
type="danger"
|
type="danger"
|
||||||
>删除</el-button
|
>删除</el-button>
|
||||||
>
|
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
size="small"
|
||||||
|
v-if="scope.row.parent==null"
|
||||||
|
@click="table_child(scope.row)"
|
||||||
|
v-auth="'material.update'"
|
||||||
|
type="primary"
|
||||||
|
>添加子工序</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
size="small"
|
||||||
|
v-else
|
||||||
|
@click="table_child_remove(scope.row)"
|
||||||
|
v-auth="'material.update'"
|
||||||
|
type="primary"
|
||||||
|
>从父工序移除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</scTable>
|
</scTable>
|
||||||
|
|
@ -127,6 +137,43 @@
|
||||||
@success="handleSaveSuccess"
|
@success="handleSaveSuccess"
|
||||||
@closed="dialog.save = false"
|
@closed="dialog.save = false"
|
||||||
></save-dialog>
|
></save-dialog>
|
||||||
|
<el-dialog
|
||||||
|
:title="添加子工序"
|
||||||
|
v-model="visible"
|
||||||
|
:size="1000"
|
||||||
|
destroy-on-close
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="dialogForm"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
label-position="right"
|
||||||
|
label-width="100px"
|
||||||
|
>
|
||||||
|
<el-form-item label="父工序">
|
||||||
|
<el-input v-model="currentItem.name" disabled></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="子工序" prop="selectValue">
|
||||||
|
<el-select
|
||||||
|
v-model="selectValue"
|
||||||
|
clearable
|
||||||
|
placeholder="选择子工序"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in proOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-footer>
|
||||||
|
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
|
||||||
|
<el-button @click="visible = false">取消</el-button>
|
||||||
|
</el-footer>
|
||||||
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import saveDialog from "./process_form.vue";
|
import saveDialog from "./process_form.vue";
|
||||||
|
|
@ -137,6 +184,7 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
params: {with_children:'yes'},
|
||||||
apiObj: this.$API.mtm.process.list,
|
apiObj: this.$API.mtm.process.list,
|
||||||
search: {
|
search: {
|
||||||
keyword: null,
|
keyword: null,
|
||||||
|
|
@ -163,10 +211,30 @@ export default {
|
||||||
20:'切分',
|
20:'切分',
|
||||||
30:'结合'
|
30:'结合'
|
||||||
},
|
},
|
||||||
baseCode :this.$TOOL.data.get('BASE_INFO').base.base_code
|
currentItem:{},
|
||||||
|
selectValue:[],
|
||||||
|
visible:false,
|
||||||
|
isSaveing:false,
|
||||||
|
proOptions:[],
|
||||||
|
baseCode :this.$TOOL.data.get('BASE_INFO').base.base_code,
|
||||||
|
rules: {
|
||||||
|
selectValue: [
|
||||||
|
{ required: true, message: "请输选择子工序", trigger: "blur" },
|
||||||
|
],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getProcess();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getProcess(){
|
||||||
|
let that = this;
|
||||||
|
let params = {page: 0, parent__isnull: true, mtype: 10};
|
||||||
|
that.$API.mtm.process.list.req(params).then((res) => {
|
||||||
|
that.proOptions = res;
|
||||||
|
});
|
||||||
|
},
|
||||||
handleChange(value) {
|
handleChange(value) {
|
||||||
console.log(value);
|
console.log(value);
|
||||||
console.log(this.form.belong_dept);
|
console.log(this.form.belong_dept);
|
||||||
|
|
@ -196,6 +264,40 @@ export default {
|
||||||
this.$message.success("删除成功");
|
this.$message.success("删除成功");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
table_child(row){
|
||||||
|
let that = this;
|
||||||
|
Object.assign(that.currentItem,row);
|
||||||
|
this.visible = true;
|
||||||
|
},
|
||||||
|
submit(){
|
||||||
|
let that = this;
|
||||||
|
let obj = {};
|
||||||
|
that.isSaveing = true;
|
||||||
|
that.proOptions.forEach((item) => {
|
||||||
|
if (item.id == that.selectValue) {
|
||||||
|
obj.name = item.name;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
obj.parent = that.currentItem.id;
|
||||||
|
that.$API.mtm.process.update.req(that.selectValue, obj).then((res) => {
|
||||||
|
that.isSaveing = false;
|
||||||
|
that.visible = false;
|
||||||
|
that.$refs.table.refresh();
|
||||||
|
that.getProcess();
|
||||||
|
}).catch((err) => {
|
||||||
|
that.isSaveing = false;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
table_child_remove(row){
|
||||||
|
let that = this;
|
||||||
|
let obj = {};
|
||||||
|
obj.parent = null;
|
||||||
|
obj.name = row.name;
|
||||||
|
that.$API.mtm.process.update.req(row.id, obj).then((res) => {
|
||||||
|
that.$refs.table.refresh();
|
||||||
|
that.getProcess();
|
||||||
|
})
|
||||||
|
},
|
||||||
//表格选择后回调事件
|
//表格选择后回调事件
|
||||||
selectionChange(selection) {
|
selectionChange(selection) {
|
||||||
this.selection = selection;
|
this.selection = selection;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue